]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
PR: merge from trunk tag mergeto_PRAS_br3_05Nov04 PRAS_br3
authorprascle <prascle>
Fri, 5 Nov 2004 15:21:53 +0000 (15:21 +0000)
committerprascle <prascle>
Fri, 5 Nov 2004 15:21:53 +0000 (15:21 +0000)
199 files changed:
INSTALL
Makefile.in
bin/VERSION
bin/launchConfigureParser.py
bin/runSalome
bin/runSalome.csh
bin/runSalome.py
bin/salome.launch
build_configure
configure.in.base
doc/salome/gui/KERNEL/files/running_salome_pro.htm
doc/salome/tui/KERNEL/HTML/SALOMEDS.html
doc/salome/tui/KERNEL/HTML/SALOMEDS_Attributes.html
doc/salome/tui/KERNEL/HTML/SALOME_Component.html
doc/salome/tui/KERNEL/HTML/SALOME_ModuleCatalog.html
doc/salome/tui/KERNEL/HTML/SALOME_Session.html
doc/salome/tui/KERNEL/HTML/SALOME_TestComponent.html
doc/salome/tui/KERNEL/doxyfile
doc/salome/tui/KERNEL/sources/static/tree.js
idl/Makefile.in
idl/SALOMEDS.idl
idl/SALOME_Session.idl
salome_adm/Makefile.in
salome_adm/unix/config_files/check_boost.m4
salome_adm/unix/config_files/check_cas.m4
salome_adm/unix/config_files/check_mpi.m4
salome_adm/unix/config_files/check_mpich.m4
salome_adm/unix/config_files/check_omniorb.m4
salome_adm/unix/config_files/check_pyqt.m4
salome_adm/unix/config_files/production.m4
salome_adm/unix/make_commence.in
salome_adm/unix/make_conclude.in
src/Container/Container_i.cxx
src/Container/Makefile.in
src/Container/SALOME_Component_i.hxx
src/Container/SALOME_Container.cxx
src/Container/SALOME_Container_i.hxx
src/DataTypeCatalog/SALOME_DataTypeCatalog_Handler.cxx
src/DataTypeCatalog/SALOME_DataTypeCatalog_Handler.hxx
src/DataTypeCatalog/SALOME_DataTypeCatalog_Parser.hxx
src/Event/SALOME_Event.cxx
src/Event/SALOME_Event.hxx
src/GenericObj/SALOME_GenericObj_i.cc
src/HDFPersist/HDFconvert.cc
src/HDFPersist/HDFconvert.hxx
src/HDFPersist/HDFexception.hxx
src/Loader/InquireServersQThread.cxx
src/Logger/SALOME_Trace.hxx
src/MEDWrapper/MED_Test.cxx
src/MPIContainer/MPIContainer_i.cxx
src/MPIContainer/MPIObject_i.cxx
src/MPIContainer/Makefile.in
src/MSG2QM/msg2qm.cxx
src/Makefile.in
src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.cxx
src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.hxx
src/ModuleCatalog/SALOME_ModuleCatalog_Handler.cxx
src/ModuleCatalog/SALOME_ModuleCatalog_Handler.hxx
src/ModuleCatalog/SALOME_ModuleCatalog_Parser_IO.cxx
src/ModuleCatalog/SALOME_ModuleCatalog_impl.cxx
src/ModuleCatalog/SALOME_ModuleCatalog_impl.hxx
src/NamingService/SALOME_NamingService.cxx
src/NamingService/SALOME_NamingService.hxx
src/Notification/NOTIFICATION_Consumer.cxx
src/OBJECT/Makefile.in
src/OBJECT/SALOME_AISShape.hxx
src/OBJECT/SALOME_Actor.cxx
src/OBJECT/SALOME_Actor.h
src/OBJECT/SALOME_InteractiveObject.cxx
src/OBJECT/SALOME_InteractiveObject.hxx
src/OBJECT/VTKViewer_Common.h [deleted file]
src/OCCViewer/Makefile.in
src/OCCViewer/OCCViewer_AISSelector.cxx
src/OCCViewer/OCCViewer_AISSelector.h
src/OCCViewer/OCCViewer_Selector.cxx [deleted file]
src/OCCViewer/OCCViewer_Selector.h [deleted file]
src/OCCViewer/OCCViewer_ViewFrame.cxx
src/OCCViewer/OCCViewer_ViewFrame.h
src/OCCViewer/OCCViewer_ViewPort.cxx
src/OCCViewer/OCCViewer_Viewer3d.cxx
src/OCCViewer/OCCViewer_Viewer3d.h
src/PatchQt/Makefile.in
src/PatchQt/qactionP.cxx
src/PatchQt/qactionP.h
src/PatchQt/qsplitterP.cxx
src/PatchQt/qsplitterP.h
src/PatchQt/qworkspaceP.cxx
src/PatchQt/qworkspaceP.h
src/Plot2d/Makefile.in
src/Plot2d/Plot2d_CurveContainer.cxx
src/Plot2d/Plot2d_CurveContainer.h
src/Plot2d/Plot2d_SetupPlot2dDlg.cxx
src/Plot2d/Plot2d_ViewFrame.cxx
src/Plot2d/Plot2d_ViewFrame.h
src/RegistryDisplay/RegWidget.cxx
src/RessourcesCatalog/SALOME_RessourcesCatalog_Handler.cxx
src/RessourcesCatalog/SALOME_RessourcesCatalog_Handler.hxx
src/RessourcesCatalog/SALOME_RessourcesCatalog_Parser.hxx
src/SALOMEDS/Makefile.in
src/SALOMEDS/SALOMEDS_AttributeDrawable_i.cxx
src/SALOMEDS/SALOMEDS_AttributeExpandable_i.cxx
src/SALOMEDS/SALOMEDS_AttributeName_i.cxx
src/SALOMEDS/SALOMEDS_AttributeOpened_i.cxx
src/SALOMEDS/SALOMEDS_AttributePythonObject_i.cxx
src/SALOMEDS/SALOMEDS_AttributeReal_i.cxx
src/SALOMEDS/SALOMEDS_AttributeSelectable_i.cxx
src/SALOMEDS/SALOMEDS_AttributeSequenceOfInteger_i.cxx
src/SALOMEDS/SALOMEDS_AttributeSequenceOfReal_i.cxx
src/SALOMEDS/SALOMEDS_AttributeStudyProperties_i.cxx
src/SALOMEDS/SALOMEDS_AttributeTreeNode_i.cxx
src/SALOMEDS/SALOMEDS_GenericAttribute_i.hxx
src/SALOMEDS/SALOMEDS_SComponent_i.cxx
src/SALOMEDS/SALOMEDS_SObject_i.cxx
src/SALOMEDS/SALOMEDS_SObject_i.hxx
src/SALOMEDS/SALOMEDS_StudyBuilder_i.cxx
src/SALOMEDS/SALOMEDS_StudyManager_i.cxx
src/SALOMEDS/SALOMEDS_TableOfStringAttribute.cxx
src/SALOMEDS/SALOMEDS_TargetAttribute.cxx
src/SALOMEDS/SALOMEDS_Tool.cxx [deleted file]
src/SALOMEDS/SALOMEDS_Tool.hxx [deleted file]
src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.cxx
src/SALOMEGUI/CLIENT_msg_en.po
src/SALOMEGUI/Makefile.in
src/SALOMEGUI/PyInterp_PyQt.cxx
src/SALOMEGUI/PyInterp_base.cxx
src/SALOMEGUI/QAD_Desktop.cxx
src/SALOMEGUI/QAD_Desktop.h
src/SALOMEGUI/QAD_FileDlg.cxx
src/SALOMEGUI/QAD_FileDlg.h
src/SALOMEGUI/QAD_FileValidator.cxx
src/SALOMEGUI/QAD_ListView.cxx
src/SALOMEGUI/QAD_ObjectBrowser.cxx
src/SALOMEGUI/QAD_ObjectBrowser.h
src/SALOMEGUI/QAD_PyEditor.cxx
src/SALOMEGUI/QAD_PyInterp_mono.cxx
src/SALOMEGUI/QAD_RightFrame.cxx
src/SALOMEGUI/QAD_RightFrame.h
src/SALOMEGUI/QAD_Study.cxx
src/SALOMEGUI/QAD_Study.h
src/SALOMEGUI/QAD_StudyFrame.cxx
src/SALOMEGUI/QAD_StudyFrame.h
src/SALOMEGUI/QAD_ViewFrame.cxx
src/SALOMEGUI/QAD_ViewFrame.h
src/SALOMEGUI/QAD_msg_en.po
src/SALOMEGUI/SALOMEGUI_Application.cxx
src/SALOMEGUI/SALOMEGUI_Swig.cxx
src/SALOMEGUI/SALOMEGUI_Swig.hxx
src/SALOMEGUI/SALOMEGUI_TableDlg.cxx
src/SALOMEGUI/SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger.hxx
src/SALOMEGUI/SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger_0.cxx
src/SALOMEGUI/SALOME_DataMapNodeOfDataMapOfIOMapOfInteger.hxx
src/SALOMEGUI/SALOME_DataMapNodeOfDataMapOfIOMapOfInteger_0.cxx
src/SALOMEGUI/SALOME_DataMapOfIOMapOfInteger.hxx
src/SALOMEGUI/SALOME_DataMapOfIOMapOfInteger_0.cxx
src/SALOMEGUI/SALOME_Selection.cxx
src/SALOMEGUI/SALOME_Selection.h
src/SALOMELogger/SALOME_LoggerClient.cxx
src/SALOME_PYQT/SALOME_PYQT_GUI.cxx
src/SALOME_SWIG/batchmode_salome.py
src/SALOME_SWIG/salome_test.py
src/SUPERVGraph/SUPERVGraph_ViewFrame.h
src/Session/Makefile.in
src/Session/SALOME_Session_Server.cxx
src/Session/SALOME_Session_i.cxx
src/Session/SALOME_Session_i.hxx
src/Session/Session_ServerLauncher.cxx
src/Session/Session_ServerThread.cxx
src/Session/Session_ServerThread.hxx
src/TOOLSDS/SALOMEDS_Tool.cxx
src/TOOLSDS/SALOMEDS_Tool.hxx
src/TOOLSGUI/ToolsGUI_CatalogGeneratorDlg.cxx
src/TestContainer/TestContainer.cxx
src/Utils/Makefile.in
src/Utils/Utils_CatchSignals.cxx [deleted file]
src/Utils/Utils_CatchSignals.h [deleted file]
src/Utils/Utils_DESTRUCTEUR_GENERIQUE.cxx
src/Utils/Utils_ExceptHandlers.cxx
src/Utils/Utils_ExceptHandlers.hxx
src/Utils/Utils_Identity.cxx
src/Utils/Utils_SALOME_Exception.hxx
src/Utils/Utils_SINGLETON.hxx
src/Utils/Utils_Timer.cxx
src/Utils/duplicate.cxx
src/VTKFilter/Makefile.in
src/VTKFilter/SALOME_ExtractUnstructuredGrid.cxx
src/VTKFilter/SALOME_ExtractUnstructuredGrid.h
src/VTKFilter/SALOME_GeometryFilter.cxx
src/VTKFilter/SALOME_GeometryFilter.h
src/VTKViewer/Makefile.in
src/VTKViewer/VTKViewer_CellRectPicker.cxx
src/VTKViewer/VTKViewer_Filter.h
src/VTKViewer/VTKViewer_InteractorStyleSALOME.cxx
src/VTKViewer/VTKViewer_InteractorStyleSALOME.h
src/VTKViewer/VTKViewer_RenderWindowInteractor.cxx
src/VTKViewer/VTKViewer_RenderWindowInteractor.h
src/VTKViewer/VTKViewer_Trihedron.cxx
src/VTKViewer/VTKViewer_Trihedron.h
src/VTKViewer/VTKViewer_ViewFrame.cxx
src/VTKViewer/VTKViewer_ViewFrame.h

diff --git a/INSTALL b/INSTALL
index 197b45757794d32f96d3b3ab8271faeea922557c..a8d9d6266804b8a968bb3841619378c902818b66 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -1,6 +1,7 @@
-This is the version 2.0.0 of KERNEL
+This is the version 2.1.0 of KERNEL
 
 Previous versions :
-       - 1.4.1
+        - 2.0.0
+        - 1.4.1
        - 1.3.0
        - 1.2.1
index 5ec410ee3b9d79316433d906844a5827464a4389..426130bbdc03de15b1744e4b3366b2fe55011e45 100644 (file)
@@ -100,10 +100,20 @@ salome.launch \
 showNS.py
 
 # copy header files in common directory
-ifeq ($(HAVE_SSTREAM),yes)
-  include_list=include/salome/SALOMEconfig.h
+OWN_CONFIG_H=@OWN_CONFIG_H@
+
+ifeq ($(OWN_CONFIG_H),yes)
+    ifeq ($(HAVE_SSTREAM),yes)
+       include_list=include/salome/SALOMEconfig.h include/salome/config.h
+    else
+       include_list=include/salome/SALOMEconfig.h include/salome/config.h include/salome/sstream
+    endif
 else
-  include_list=include/salome/SALOMEconfig.h include/salome/sstream
+    ifeq ($(HAVE_SSTREAM),yes)
+       include_list=include/salome/SALOMEconfig.h
+    else
+       include_list=include/salome/SALOMEconfig.h include/salome/sstream
+    endif
 endif
 
 inc: idl $(include_list)
@@ -121,6 +131,10 @@ salome_adm/unix/SALOMEconfig.ref: salome_adm/unix/SALOMEconfig.h
          cp -p $< $@;        \
        fi;                   \
 
+include/salome/config.h: salome_adm/unix/config.h
+       -$(RM) $@
+       $(LN_S) ../../$< $@
+
 include/salome/sstream: salome_adm/unix/sstream
        -$(RM) $@
        $(LN_S) ../../$< $@
@@ -168,7 +182,7 @@ distclean: distclean-other
 distclean-other:
        -$(RM) salome_adm/unix/*~ salome_adm/unix/*% salome_adm/unix/*.bak salome_adm/unix/*.new salome_adm/unix/*.old
        -$(RM) salome_adm/unix/make_* 
-       -$(RM) salome_adm/unix/depend salome_adm/unix/SALOMEconfig.h 
+       -$(RM) salome_adm/unix/depend salome_adm/unix/SALOMEconfig.h salome_adm/unix/config.h 
        -$(RM) config.cache config.log config.status 
 
 @MODULE@
index 699b2270c8f404687bf3dfc1530861b39703e9ac..f15697e352f79c739e4a4609daa6ed1e90a66ae2 100755 (executable)
@@ -1 +1 @@
-THIS IS SALOME - KERNEL VERSION: 2.0.0
+THIS IS SALOME - KERNEL VERSION: 2.1.0
index 47f120d8e01cad8d8dd62fa89789774e3d7cd9e9..b673049e990ae8787e1f92cd3ea6b97261f6315a 100755 (executable)
@@ -44,7 +44,7 @@ class xml_parser:
                 pass
         elif self.space == ["Configuration-list","modules-list","module","plugin"] and "name" in attrs.getNames():
             key = str(self.currentModuleName)+"_plugins"
-            if not self.opts.has_key("key"):
+            if not self.opts.has_key(key):
                 self.opts[key]=[]
                 pass
             self.opts[key].append(attrs.getValue("name"))
index 9577ea58ebdb5fa1206d5c39a33d9715426e3acf..7505e8b891648bfbf556c3f7719ac61327ed4b34 100755 (executable)
@@ -1,19 +1,33 @@
 #!/bin/bash
 
-NSPORT=2809
-echo -n "Searching for free port for the SALOME Naming Service: "
-while [ ${NSPORT} -lt 3000 ]; do
-    NSPORT=`expr ${NSPORT} + 1`
-    aRes=`netstat -ltn | grep -E :${NSPORT}`
-    if [ -z "$aRes" ]; then
-cat > ${OMNIORB_CONFIG} <<EOF
-ORBInitRef NameService=corbaname::`hostname`:${NSPORT}
-EOF
-        echo ${NSPORT} - Ok
-        break
-    fi
-    echo -n "${NSPORT}; "
-done
+searchFreePort() {
+    echo -n "Searching for a free port for naming service: "
+    export NSPORT=2810
+    local limit=$NSPORT
+    let limit=limit+100
+    while [ 1 ]
+    do
+        aRes=`netstat -ltn | grep -E :${NSPORT}`
+        if [ -z "$aRes" ]; then
+            echo ${NSPORT} - Ok
+           local myhost=`hostname`
+            export OMNIORB_CONFIG=${HOME}/.omniORB_${myhost}_${NSPORT}.cfg
+            local initref="NameService=corbaname::"`hostname`":$NSPORT"
+            echo "ORBInitRef $initref" > $OMNIORB_CONFIG
+            break
+        fi
+        echo -n "${NSPORT} "
+        if [[ $NSPORT -eq $limit ]] ; then
+            echo
+            echo "Can't find a free port to launch omniNames"
+            echo "Try to kill the running servers and then launch SALOME again."
+            exit
+        fi
+        let NSPORT=NSPORT+1
+    done
+}
+
+searchFreePort
 
 if [ $# -ne 0 ] ; then
     python -i ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py $* 
@@ -26,15 +40,15 @@ fi
 # ---------
 #  $: ${KERNEL_ROOT_DIR}/bin/salome/runSalome
 #
-#     parameters read from $HOME/.salome/salome.launch 
-#     if the config file does not exist, it is created with default values
+#     - parameters for launching are taken from $HOME/.salome/salome.launch;
+#     - if the config file does not exist, it is created with default values.
 #
 #  
 #  $: ${KERNEL_ROOT_DIR}/bin/salome/runSalome --modules=GEOM,SMESH,VISU,SUPERV,MED --embedded=registry,study,moduleCatalog,cppContainer --standalone=pyContainer,supervContainer --xterm --killall
 #
 #     parameters from command line supersede those from $HOME/.salome/salome.launch
 #
-# Some CORBA servers could be launched in the SALOME_Session_Server
+# Some CORBA servers can be launched in the SALOME_Session_Server's process
 # (embedded = same process) or in a separate process (standalone):
 # --> registry,study,moduleCatalog,cppContainer
 # Other CORBA servers could only be launched in separate process (standalone):
index 5761b299f96d1aa6dc71ec31009eb8a5468fc6c1..73798c25c137f8ae3ae66b7f8b84e2054dd74a66 100755 (executable)
@@ -1,3 +1,3 @@
 #!/bin/csh -f
 
-runSalome --gui --modules=GEOM,SMESH,DATA,VISU,SUPERV,MED --containers=cpp,python --killall
+runSalome --gui --modules=GEOM,SMESH,VISU,SUPERV,MED --containers=cpp,python --killall
index cb8902df5c7236abbebb9604ca6827f9f2f6983b..1274e9a4530a388ba25c31ec90f2396f77698fb5 100755 (executable)
@@ -168,6 +168,10 @@ def set_env(args, modules_list, modules_root_dir):
             pass
         pass
 
+    # set environment for SUPERV module
+    os.environ["ENABLE_MACRO_NODE"]="1"
+   
+
 # -----------------------------------------------------------------------------
 
 from killSalome import killAllPorts
@@ -471,6 +475,10 @@ def startSalome(args, modules_list, modules_root_dir):
         os.environ["CSF_GEOMDS_ResourcesDefaults"] \
         = os.path.join(modules_root_dir["GEOM"],"share",
                        args['appname'],"resources")
+       print "GEOM Shape Healing Resources"
+        os.environ["CSF_ShHealingDefaults"] \
+        = os.path.join(modules_root_dir["GEOM"],"share",
+                       args['appname'],"resources")
 
     if 'study' not in args['embedded']:
         myServer=SalomeDSServer(args)
index 43b8fc9f6e0cb757bfd5a10eee19d0be4b9f4da8..1b5bbdd1b579140b8b69c8f1ffbaa0ac1493ba6c 100644 (file)
@@ -10,8 +10,8 @@
                <module name="GEOM"/>
                <module name="SMESH">
                        <plugin name="NETGENPlugin"/>
+                       <plugin name="GHS3DPlugin"/>
                </module>
-               <module name="DATA"/>
                <module name="VISU"/>
                <module name="SUPERV"/>
                <module name="MED"/>
index 0cf5fc380ad1cb9c6ef1809fefdc8e7d658e694f..8ce1d16edf507dc0ed325a91bceff90b0b15b673 100755 (executable)
@@ -119,7 +119,7 @@ echo "  ./salome_adm/Makefile \\" >> configure.in_tmp1
 touch configure.in_tmp2
 find_in . configure.in_tmp2
 sed '/^...salome_adm/d' configure.in_tmp2 >  configure.in_tmp3
-sed '/configure.in/d' configure.in_tmp3 >  configure.in_tmp2
+sed '/configure.in/d;/make_config.in/d' configure.in_tmp3 >  configure.in_tmp2
 sed 's/.in / /' configure.in_tmp2 >> configure.in_tmp1
 
 echo  "])" >> configure.in_tmp1
@@ -191,6 +191,23 @@ else
        echo "failed (check file permissions and/or user quotas ...)"
 fi
 
+###############################################################
+# Creating make_config
+#
+if test -f make_config
+then
+       echo -n "Updating 'make_config' script ...  "
+else
+       echo -n "Creating 'make_config' script ...  "
+fi
+
+if autoconf -o make_config make_config.in
+then
+       echo "done"
+else
+       echo "failed (check file permissions and/or user quotas ...)"
+fi
+
 cd ${ORIG_DIR}
 
 echo
index 02da876494f8d0b581ac8f8f2ded22ed81f35034..0eef838db2ab3e6fd9498899f4c078614e488d8a 100644 (file)
@@ -125,13 +125,45 @@ echo
 
 CHECK_BOOST
 
+echo
+echo ---------------------------------------------
+echo testing threads
+echo ---------------------------------------------
+echo
+
+ENABLE_PTHREADS
+
 dnl
 dnl ---------------------------------------------
-dnl testing MPICH
+dnl testing MPI
 dnl ---------------------------------------------
 dnl
 
-CHECK_MPICH
+CHECK_MPI
+
+dnl
+dnl ---------------------------------------------
+dnl testing sockets
+dnl ---------------------------------------------
+dnl
+
+CHECK_SOCKETS
+
+dnl
+dnl ---------------------------------------------
+dnl testing OpenPBS
+dnl ---------------------------------------------
+dnl
+
+echo
+echo ---------------------------------------------
+echo testing OpenPBS
+echo ---------------------------------------------
+echo
+
+openpbs_ok=no
+CHECK_OPENPBS
+dnl openpbs_ok is set to yes by CHECK_OPENPBS
 
 echo
 echo ---------------------------------------------
@@ -168,14 +200,6 @@ echo
 
 CHECK_SWIG
 
-echo
-echo ---------------------------------------------
-echo testing threads
-echo ---------------------------------------------
-echo
-
-ENABLE_PTHREADS
-
 echo
 echo ---------------------------------------------
 echo testing omniORB
@@ -292,12 +316,15 @@ echo ---------------------------------------------
 echo
 
 echo Configure
-variables="cc_ok boost_ok lex_yacc_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok med2_ok omniORB_ok occ_ok sip_ok pyqt_ok qwt_ok doxygen_ok graphviz_ok"
+variables="cc_ok boost_ok lex_yacc_ok mpi_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok med2_ok omniORB_ok occ_ok sip_ok pyqt_ok qwt_ok doxygen_ok graphviz_ok openpbs_ok"
  
 for var in $variables
 do
-   printf "   %10s : " `echo \$var | sed -e "s,_ok,,"`
-   eval echo \$$var
+   eval toto=\$$var
+   if test x$toto != "x"; then
+     printf "   %10s : " `echo \$var | sed -e "s,_ok,,"`
+     eval echo \$$var
+   fi
 done
 
 echo
@@ -363,7 +390,7 @@ do
   case "$local_bin" in
         *.in | *~) ;;
         ./bin/CVS | ./bin/salome)                    ;;
-        *) /usr/bin/install -C $i .; echo $local_bin ;;
+        *) /usr/bin/install -c $i .; echo $local_bin ;;
   esac
 done
 cd $ROOT_BUILDDIR
index c375593918fe54eafe67d4040ba50a51d4e152d7..358eb21ac3334254ebf50178629704b7a77ff533 100755 (executable)
@@ -1,38 +1,41 @@
-<!doctype HTML public "-//W3C//DTD HTML 4.0 Frameset//EN">\r
-\r
-<html>\r
-\r
-<!--(==============================================================)-->\r
-<!--(Document created with RoboEditor. )============================-->\r
-<!--(==============================================================)-->\r
-\r
-<head>\r
-\r
-<title>Running SALOME</title>\r
-\r
-<!--(Meta)==========================================================-->\r
-\r
-<meta http-equiv=content-type content="text/html; charset=windows-1252">\r
-<meta name=generator content="RoboHELP by eHelp Corporation - www.ehelp.com">\r
-<meta name=generator-major-version content=0.1>\r
-<meta name=generator-minor-version content=1>\r
-<meta name=filetype content=kadov>\r
-<meta name=filetype-version content=1>\r
-<meta name=page-count content=1>\r
-<meta name=layout-height content=1118>\r
-<meta name=layout-width content=707>\r
-\r
-\r
-<!--(Links)=========================================================-->\r
-\r
- <link rel='stylesheet' href='../default_ns.css'>\r
-<script type="text/javascript" language="JavaScript" title="WebHelpSplitCss">\r
+<!DOCTYPE doctype PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN">
+<html>
+<head>
+<!--(==============================================================)--><!--(Document created with RoboEditor. )============================--><!--(==============================================================)-->
+  <title>Running SALOME</title>
+    <!--(Meta)==========================================================--> 
+  <meta http-equiv="content-type"
+ content="text/html; charset=windows-1252">
+  <meta name="generator"
+ content="RoboHELP by eHelp Corporation - www.ehelp.com">
+  <meta name="generator-major-version" content="0.1">
+  <meta name="generator-minor-version" content="1">
+  <meta name="filetype" content="kadov">
+  <meta name="filetype-version" content="1">
+  <meta name="page-count" content="1">
+  <meta name="layout-height" content="1118">
+  <meta name="layout-width" content="707">
+   <!--(Links)=========================================================--> 
+  
+  <link rel="stylesheet" href="../default_ns.css">
+  <script type="text/javascript" language="JavaScript"
+ title="WebHelpSplitCss">\r
 <!--\r
 if (navigator.appName !="Netscape")\r
 {   document.write("<link rel='stylesheet' href='../default.css'>");}\r
 //-->\r
-</script>\r
-<style type="text/css">\r
+  </script> 
+  <style type="text/css">\r
 <!--\r
 h1.whs1 {font-family: 'Times New Roman', serif;}\r
 p.whs2 {margin-left: 0px; font-style: italic; color: #000000; font-family: 'Arial Black', sans-serif;}\r
@@ -65,8 +68,8 @@ p.whs28 {font-weight:bold; margin-left:0px; font-family:'Courier New' , monospac
 p.whs29 {font-family: 'Times New Roman', serif; margin-left: 80px;}\r
 p.whs30 {font-family: 'Courier New', monospace; margin-left: 0px;}\r
 -->\r
-</style>\r
-<script type="text/javascript" language="JavaScript">\r
+  </style> 
+  <script type="text/javascript" language="JavaScript">\r
 <!--\r
 if ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) == 4))\r
 {\r
@@ -81,8 +84,11 @@ if ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) == 4))
   document.write(strNSS);\r
 }\r
 //-->\r
-</script>\r
-<script type="text/javascript" language="JavaScript" title="BSSC Special Effects" src="../ehlpdhtm.js"></script><script type="text/javascript" language="JavaScript" title="WebHelpInlineScript">\r
+  </script> 
+  <script type="text/javascript" language="JavaScript"
+ title="BSSC Special Effects" src="../ehlpdhtm.js"></script>
+  <script type="text/javascript" language="JavaScript"
+ title="WebHelpInlineScript">\r
 <!--\r
 function reDo() {\r
   if (innerWidth != origWidth || innerHeight != origHeight)\r
@@ -95,24 +101,24 @@ if ((parseInt(navigator.appVersion) == 4) && (navigator.appName == "Netscape"))
 }\r
 onerror = null; \r
 //-->\r
-</script>\r
-<style type="text/css">\r
+  </script> 
+  <style type="text/css">\r
 <!--\r
   div.WebHelpPopupMenu {position:absolute; left:0px; top:0px; z-index:4; visibility:hidden;}\r
 -->\r
-</style>\r
-<script type="text/javascript" language="javascript1.2" src="../whmsg.js"></script>\r
-<script type="text/javascript" language="javascript" src="../whver.js"></script>\r
-<script type="text/javascript" language="javascript1.2" src="../whproxy.js"></script>\r
-<script type="text/javascript" language="javascript1.2" src="../whutils.js"></script>\r
-<script type="text/javascript" language="javascript1.2" src="../whtopic.js"></script>\r
-</head>\r
-\r
-<!--(Body)==========================================================-->\r
-\r
-\r
-<body>\r
-\r
+  </style> 
+  <script type="text/javascript" language="javascript1.2"
+ src="../whmsg.js"></script> 
+  <script type="text/javascript" language="javascript" src="../whver.js"></script> 
+  <script type="text/javascript" language="javascript1.2"
+ src="../whproxy.js"></script> 
+  <script type="text/javascript" language="javascript1.2"
+ src="../whutils.js"></script> 
+  <script type="text/javascript" language="javascript1.2"
+ src="../whtopic.js"></script><!--(Body)==========================================================-->
+</head>
+           <body>
+  
 <script type="text/javascript" language="javascript1.2">\r
 <!--\r
 if (window.gbWhTopic)\r
@@ -141,178 +147,212 @@ addButton("show",BTN_TEXT,"Show","","","","",0,0,"","","");
 else\r
        document.location.reload();\r
 //-->\r
-</script>\r
-<h1 class="whs1">Running SALOME</h1>\r
-\r
-<p class="whs2">To launch SALOME:</p>\r
-\r
-<p class="whs3">&nbsp;</p>\r
-\r
-<p class="whs4">1. Install the SALOME package into a definite \r
- directory (ex. <span style="font-weight: bold;"><B>SALOME</B></span>) on your \r
- hard disk. It is preferable if you use the <a href="installing_salome_pro.htm">special \r
- installation procedure</a> allowing to install the &nbsp;SALOME \r
- platform and all corresponding applications. </p>\r
-\r
-<p class="whs5">&nbsp;</p>\r
-\r
-<p class="whs6">2.<span style="font-family: 'Courier New', monospace;"> \r
- </span>The installation shell script will create a special file: <b>env.csh</b> \r
- (CShell file) in your <b><i><span style="font-style: normal; font-weight: bold;"><B>SALOME</B></span><span \r
- style="font-weight: normal; font-style: normal;"> </span></i></b>directory. \r
- This file contains all environment variables necessary for launching SALOME \r
- platform with other application products provided with SALOME installation \r
- package. You have a possibility to add one of them into your profile if \r
- you enter in the command console the following:</p>\r
-\r
-<p class="whs6">&nbsp;</p>\r
-\r
-<p class="whs6"><span style="font-family: 'Courier New', monospace;">source \r
- env.csh </span></p>\r
-\r
-<p class="whs6">&nbsp;</p>\r
-\r
-<p class="whs7"><img src="../tip1.gif" x-maintain-ratio="TRUE" width="35px" height="37px" border="0" class="img_whs8"> <span style="font-family: 'Times New Roman', serif;">During \r
- the installation procedure you have a possibility <a href="installing_salome_pro.htm#profile">to \r
- set your profile automatically.</a> </span>&nbsp;</p>\r
-\r
-<p class="whs9">&nbsp;</p>\r
-\r
-<p>&nbsp;</p>\r
-\r
-<p class="whs10">3. Launch SALOME platform, using the following \r
- Python script located in the <span style="font-weight: bold;"><B>SALOME/KERNEL/bin/salome</B></span> \r
- directory:</p>\r
-\r
-<p class="whs11">&nbsp;</p>\r
-\r
-<ul type="disc" class="whs12">\r
-       \r
-       <li class=kadov-p><p class="whs10"><span style="font-weight: bold;"><B>runSalome.py</B></span> \r
- [command line options]</p></li>\r
-</ul>\r
-\r
-<p class="whs10">&nbsp;</p>\r
-\r
-<!--(Table)=========================================================-->\r
-<table x-use-null-cells resizable="no" cellspacing="0" width="96.029%" class="whs13">\r
-<script language='JavaScript'><!--\r
+</script> 
+<h1 class="whs1">Running SALOME</h1>
+  
+<p class="whs2">To launch SALOME:</p>
+  
+<p class="whs3"> </p>
+  
+<p class="whs4">1. Install the SALOME package into a definite   directory
+(ex. <span style="font-weight: bold;"><b>SALOME</b></span>) on your   hard
+disk. It is preferable if you use the <a href="readme.html">special   installation
+procedure</a> allowing to install the  SALOME   platform and all corresponding
+applications. </p>
+  
+<p class="whs5"> </p>
+  
+<p class="whs6">2.<span style="font-family: 'Courier New',monospace;">  
+</span>The installation shell script will create a special file: <b>env.csh</b>
+  (CShell file) in your <b><i><span
+ style="font-style: normal; font-weight: bold;"><b>SALOME</b></span><span
+ style="font-weight: normal; font-style: normal;"> </span></i></b>directory.
+  This file contains all environment variables necessary for launching SALOME
+  platform with other application products provided with SALOME installation
+  package. You have a possibility to add one of them into your profile if
+  you enter in the command console the following:</p>
+  
+<p class="whs6"> </p>
+  
+<p class="whs6"><span style="font-family: 'Courier New',monospace;">source
+  env.csh </span></p>
+  
+<p class="whs6"> </p>
+  
+<p class="whs10">3. Launch SALOME platform, using the following   Python
+script located in the <span style="font-weight: bold;"><b>SALOME/KERNEL/bin/salome</b></span>
+  directory:</p>
+  
+<p class="whs11"> </p>
+  
+<ul type="disc" class="whs12">
+               <li class="kadov-p">
+    <p class="whs10"><span style="font-weight: bold;"><b>runSalome.py</b></span>
+  [command line options]</p>
+  </li>
+</ul>
+  
+<p class="whs10"> </p>
+  <!--(Table)=========================================================--> 
+<table x-use-null-cells="" resizable="no" cellspacing="0" width="96%"
+ class="whs13">
+  <script language="JavaScript"><!--\r
 if ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) == 4)) document.write("</table><table x-use-null-cells resizable='no' cellspacing='0' width='96.029%' border='1' bordercolor='silver' bordercolorlight='silver' bordercolordark='silver'>");\r
-//--></script>\r
-<col class="whs14">\r
-<col class="whs15">\r
-\r
-<tr valign="top" class="whs16">\r
-<td bgcolor="#400080" width="214px" class="whs17">\r
-<p class="whs18">Options</td>\r
-<td bgcolor="#400080" width="390px" class="whs19">\r
-<p class="whs18">Description</td></tr>\r
-\r
-<tr valign="top" class="whs16">\r
-<td width="214px" class="whs20">\r
-<p><span style="font-weight: bold;"><B>--help</B></span> <span style="font-style: italic;"><I>or</I></span> \r
- <span style="font-weight: bold;"><B>-h</B></span> &nbsp;&nbsp;</td>\r
-<td width="390px" class="whs21">\r
-<p>print this help</p>\r
-<p>&nbsp;</td></tr>\r
-\r
-<tr valign="top" class="whs16">\r
-<td width="214px" class="whs20">\r
-<p><span style="font-weight: bold;"><B>--gui</B></span> <span style="font-style: italic;"><I>or</I></span> \r
- <span style="font-weight: bold;"><B>-g</B></span> &nbsp;&nbsp;</td>\r
-<td width="390px" class="whs21">\r
-<p>launch with GUI</td></tr>\r
-\r
-<tr valign="top" class="whs16">\r
-<td width="214px" class="whs20">\r
-<p>&nbsp;<span style="font-weight: bold;"><B><a \r
- name=batchmode></a>--terminal</B></span> <span style="font-style: italic;"><I>or \r
- </I></span><span style="font-weight: bold;"><B>-t</B></span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>\r
-<td width="390px" class="whs21">\r
-<p>launch without GUI in batch mode</td></tr>\r
-\r
-<tr valign="top" class="whs16">\r
-<td colspan="1" rowspan="1" width="214px" class="whs20">\r
-<p><span style="font-weight: bold;"><B>--logger</B></span> <span style="font-style: italic;"><I>or</I></span> \r
- <span style="font-weight: bold;"><B>-l</B></span> &nbsp;&nbsp;</td>\r
-<td colspan="1" rowspan="1" width="390px" class="whs21">\r
-<p>redirection of log messages into a definite file </td></tr>\r
-\r
-<tr valign="top" class="whs16">\r
-<td colspan="1" rowspan="1" width="214px" class="whs20">\r
-<p><span style="font-weight: bold;"><B>--xterm</B></span> <span style="font-style: italic;"><I>or</I></span> \r
- <span style="font-weight: bold;"><B>-x</B></span> </td>\r
-<td colspan="1" rowspan="1" width="390px" class="whs21">\r
-<p>the servers open an xterm window and log messages are displayed in this \r
- window</td></tr>\r
-\r
-<tr valign="top" class="whs16">\r
-<td colspan="1" rowspan="1" width="214px" class="whs20">\r
-<p><span style="font-weight: bold;"><B>--modules=module1,module2,...</B></span> \r
- <span style="font-style: italic;"><I>or</I></span> <span style="font-weight: bold;"><B>-m=module1,module2,...</B></span></td>\r
-<td colspan="1" rowspan="1" width="390px" class="whs21">\r
-<p>list of SALOME modules which will be loaded into the module catalogue</td></tr>\r
-\r
-<tr valign="top" class="whs16">\r
-<td colspan="1" rowspan="1" width="214px" class="whs22">\r
-<p><span style="font-weight: bold;"><B>--containers=cpp,python,superv</B></span></p>\r
-<p><span style="font-style: italic;"><I>or</I></span> <span style="font-weight: bold;"><B>-c=cpp,python,superv</B></span></td>\r
-<td colspan="1" rowspan="1" width="390px" class="whs23">\r
-<p>launch of cpp, python and supervision containers</td></tr>\r
-\r
-<tr valign="top" class="whs16">\r
-<td colspan="1" rowspan="1" width="214px" class="whs24">\r
-<p><span style="font-weight: bold;"><B>--portkill</B></span> <span style="font-style: italic;"><I>or</I></span> \r
- <span style="font-weight: bold;"><B>-p</B></span></td>\r
-<td colspan="1" rowspan="1" width="390px" class="whs25">\r
-<p>kill SALOME launched with the current port</td></tr>\r
-\r
-<tr valign="top" class="whs16">\r
-<td colspan="1" rowspan="1" width="214px" class="whs26">\r
-<p><span style="font-weight: bold;"><B>--killall</B></span> <span style="font-style: italic;"><I>or</I></span> \r
- <span style="font-weight: bold;"><B>-k</B></span> &nbsp;&nbsp;&nbsp;</td>\r
-<td colspan="1" rowspan="1" width="390px" class="whs27">\r
-<p>kill SALOME</td></tr>\r
-<script language='JavaScript'><!--\r
+//--></script> 
+  <col class="whs14"> <col class="whs15">  <tbody>
+    <tr valign="top" class="whs16">
+ <td bgcolor="#400080" width="214" class="whs17"> 
+      <p class="whs18">Options</p>
+      </td>
+ <td bgcolor="#400080" width="390" class="whs19"> 
+      <p class="whs18">Description</p>
+      </td>
+    </tr>
+  <tr valign="top" class="whs16">
+ <td width="214" class="whs20"> 
+      <p><span style="font-weight: bold;"><b>--help</b></span> <span
+ style="font-style: italic;"><i>or</i></span>   <span
+ style="font-weight: bold;"><b>-h</b></span>   </p>
+      </td>
+ <td width="390" class="whs21"> 
+      <p>print this help</p>
+      <p> </p>
+      </td>
+    </tr>
+  <tr valign="top" class="whs16">
+ <td width="214" class="whs20"> 
+      <p><span style="font-weight: bold;"><b>--gui</b></span> <span
+ style="font-style: italic;"><i>or</i></span>   <span
+ style="font-weight: bold;"><b>-g</b></span>   </p>
+      </td>
+ <td width="390" class="whs21"> 
+      <p>launch with GUI</p>
+      </td>
+    </tr>
+  <tr valign="top" class="whs16">
+ <td width="214" class="whs20"> 
+      <p> <span style="font-weight: bold;"><b><a name="batchmode"></a>--terminal</b></span>
+      <span style="font-style: italic;"><i>or   </i></span><span
+ style="font-weight: bold;"><b>-t</b></span>      </p>
+      </td>
+ <td width="390" class="whs21"> 
+      <p>launch without GUI in batch mode</p>
+      </td>
+    </tr>
+  <tr valign="top" class="whs16">
+ <td colspan="1" rowspan="1" width="214" class="whs20"> 
+      <p><span style="font-weight: bold;"><b>--logger</b></span> <span
+ style="font-style: italic;"><i>or</i></span>   <span
+ style="font-weight: bold;"><b>-l</b></span>   </p>
+      </td>
+ <td colspan="1" rowspan="1" width="390" class="whs21"> 
+      <p>redirection of log messages into a definite file </p>
+      </td>
+    </tr>
+  <tr valign="top" class="whs16">
+ <td colspan="1" rowspan="1" width="214" class="whs20"> 
+      <p><span style="font-weight: bold;"><b>--xterm</b></span> <span
+ style="font-style: italic;"><i>or</i></span>   <span
+ style="font-weight: bold;"><b>-x</b></span> </p>
+      </td>
+ <td colspan="1" rowspan="1" width="390" class="whs21"> 
+      <p>the servers open an xterm window and log messages are displayed
+in this   window</p>
+      </td>
+    </tr>
+  <tr valign="top" class="whs16">
+ <td colspan="1" rowspan="1" width="214" class="whs20"> 
+      <p><span style="font-weight: bold;"><b>--modules=module1,module2,...</b></span>
+  <span style="font-style: italic;"><i>or</i></span> <span
+ style="font-weight: bold;"><b>-m=module1,module2,...</b></span></p>
+      </td>
+ <td colspan="1" rowspan="1" width="390" class="whs21"> 
+      <p>list of SALOME modules which will be loaded into the module catalogue</p>
+      </td>
+    </tr>
+  <tr valign="top" class="whs16">
+ <td colspan="1" rowspan="1" width="214" class="whs22"> 
+      <p><span style="font-weight: bold;"><b>--containers=cpp,python,superv</b></span></p>
+      <p><span style="font-style: italic;"><i>or</i></span> <span
+ style="font-weight: bold;"><b>-c=cpp,python,superv</b></span></p>
+      </td>
+ <td colspan="1" rowspan="1" width="390" class="whs23"> 
+      <p>launch of cpp, python and supervision containers</p>
+      </td>
+    </tr>
+  <tr valign="top" class="whs16">
+ <td colspan="1" rowspan="1" width="214" class="whs24"> 
+      <p><span style="font-weight: bold;"><b>--portkill</b></span> <span
+ style="font-style: italic;"><i>or</i></span>   <span
+ style="font-weight: bold;"><b>-p</b></span></p>
+      </td>
+ <td colspan="1" rowspan="1" width="390" class="whs25"> 
+      <p>kill SALOME launched with the current port</p>
+      </td>
+    </tr>
+  <tr valign="top" class="whs16">
+ <td colspan="1" rowspan="1" width="214" class="whs26"> 
+      <p><span style="font-weight: bold;"><b>--killall</b></span> <span
+ style="font-style: italic;"><i>or</i></span>   <span
+ style="font-weight: bold;"><b>-k</b></span>    </p>
+      </td>
+ <td colspan="1" rowspan="1" width="390" class="whs27"> 
+      <p>kill SALOME</p>
+      </td>
+    </tr>
+    <script language="JavaScript"><!--\r
 if ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) == 4)) document.write("</table></table><table>");\r
-//--></script>\r
-</table>\r
-\r
-<p class="whs10">&nbsp;</p>\r
-\r
-<p class="whs28"><img src="../tip1.gif" x-maintain-ratio="TRUE" width="35px" height="37px" border="0" class="img_whs8"><span style="font-weight: normal; font-family: 'Times New Roman', serif;"> \r
- If the </span><span style="font-family: 'Times New Roman', serif;">runSalome.py \r
- </span><span style="font-family: 'Times New Roman', serif; font-weight: normal;">script \r
- is launched without prompting any options, they will be taken by default \r
- from the xml file </span><span style="font-family: 'Times New Roman', serif;">salome.launch</span><span \r
- style="font-family: 'Times New Roman', serif; font-weight: normal;">, \r
- which has been automatically created in your home directory: </span><span \r
- style="font-family: 'Times New Roman', serif;">HOME/.salome/</span><span \r
- style="font-family: 'Times New Roman', serif; font-weight: normal;">. \r
- </span>&nbsp;&nbsp;&nbsp;</p>\r
-\r
-<p class="whs29">&nbsp;</p>\r
-\r
-<p class="whs29">&nbsp;</p>\r
-\r
-<p class="whs30">\r
-<a href="javascript:void(0);" onClick="var e; if (parseInt(navigator.appVersion)>=4){e=event;}  if (parseInt(navigator.appVersion) >=2 && typeof(PopupMenu_Invoke) == 'function') PopupMenu_Invoke(e,'','About SALOME PRO architecture','about_salome_pro_architecture.htm','Installing SALOME PRO','installing_salome_pro.htm','Introduction to SALOME PRO','introduction_to_salome_pro.htm');return false;" title="Related Topics"><img src="../ss_btn_related_topics.gif" border=0 height=17 width=82 alt="Related Topics"></a></p>\r
-\r
-<p class="whs30">&nbsp;</p>\r
-\r
-<p class="whs30">&nbsp;</p>\r
-\r
-<p class="whs30">&nbsp;</p>\r
-\r
-<script type="text/javascript" language="JavaScript" title="WebHelpRelatedTopics"><!--\r
+//--></script> 
+  </tbody>
+</table>
+  
+<p class="whs10"> </p>
+  
+<p class="whs28"><img src="../tip1.gif" x-maintain-ratio="TRUE"
+ width="35" height="37" border="0" class="img_whs8">
+<span style="font-weight: normal; font-family: 'Times New Roman',serif;">
+  If the </span><span style="font-family: 'Times New Roman',serif;">runSalome.py
+  </span><span
+ style="font-family: 'Times New Roman',serif; font-weight: normal;">script
+  is launched without prompting any options, they will be taken by default
+  from the xml file </span><span
+ style="font-family: 'Times New Roman',serif;">salome.launch</span><span
+ style="font-family: 'Times New Roman',serif; font-weight: normal;">,   which
+has been automatically created in your home directory: </span><span
+ style="font-family: 'Times New Roman',serif;">HOME/.salome/</span><span
+ style="font-family: 'Times New Roman',serif; font-weight: normal;">.   </span>   </p>
+  
+<p class="whs29"> </p>
+  
+<p class="whs29"> </p>
+  
+<p class="whs30"> <a href="javascript:void(0);"
+ onclick="var e; if (parseInt(navigator.appVersion)>=4){e=event;}  if (parseInt(navigator.appVersion) >=2 && typeof(PopupMenu_Invoke) == 'function') PopupMenu_Invoke(e,'','About SALOME PRO architecture','about_salome_pro_architecture.htm','Installing SALOME PRO','readme.html','Introduction to SALOME PRO','introduction_to_salome_pro.htm');return false;"
+ title="Related Topics"><img src="../ss_btn_related_topics.gif"
+ border="0" height="17" width="82" alt="Related Topics">
+</a></p>
+  
+<p class="whs30"> </p>
+  
+<p class="whs30"> </p>
+  
+<p class="whs30"> </p>
+  
+<script type="text/javascript" language="JavaScript"
+ title="WebHelpRelatedTopics"><!--\r
 if (parseInt(navigator.appVersion) >= 3 && typeof (WritePopupMenuLayer) == "function")\r
   WritePopupMenuLayer();\r
-//--></script><script type="text/javascript" language="javascript1.2">\r
+//--></script>
+<script type="text/javascript" language="javascript1.2">\r
 <!--\r
 if (window.writeIntopicBar)\r
        writeIntopicBar(0);\r
 //-->\r
-</script>\r
-</body>\r
-\r
-</html>\r
+</script> <br>
+</body>
+</html>
index 52291faa393bb0770831cbf9dcfea2e55f3a2316..f9d2b559dae623ec81791fa2cd4d46926ae77696 100644 (file)
 <td bgcolor= "lightgreen"><div align="center"><b>return_value = FindObjectID ( aObjectID )</b></div></td>
 </tr>
 <tr>
+<td bgcolor= "lightgreen"><div align="center"><b>SObject  CreateObjectID ( in ID aObjectID )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = CreateObjectID ( aObjectID )</b></div></td>
+</tr>
+<tr>
 <td bgcolor= "lightgreen"><div align="center"><b>SObject  FindObjectIOR ( in ID aObjectIOR )</b></div></td>
 <td bgcolor= "lightgreen"><div align="center"><b>return_value = FindObjectIOR ( aObjectIOR )</b></div></td>
 </tr>
 <td bgcolor= "lightgreen"><div align="center"><b>void EnableUseCaseAutoFilling ( in boolean isEnabled )</b></div></td>
 <td bgcolor= "lightgreen"><div align="center"><b>EnableUseCaseAutoFilling ( isEnabled )</b></div></td>
 </tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>void AddPostponed ( in string theIOR )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>AddPostponed ( theIOR )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>void AddCreatedPostponed ( in string theIOR )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>AddCreatedPostponed ( theIOR )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>void RemovePostponed ( in long theUndoLimit )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>RemovePostponed ( theUndoLimit )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>void UndoPostponed ( in long theWay )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>UndoPostponed ( theWay )</b></div></td>
+</tr>
 </table><br>
 <table width="100%" BORDER>
 <tr bgcolor="#FFFFCC">
 <td bgcolor= "lightgreen"><div align="center"><b>Addreference ( anObject, theReferencedObject )</b></div></td>
 </tr>
 <tr>
+<td bgcolor= "lightgreen"><div align="center"><b>void RemoveReference ( in SObject anObject )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>RemoveReference ( anObject )</b></div></td>
+</tr>
+<tr>
 <td bgcolor= "lightgreen"><div align="center"><b>void AddDirectory ( in string theName )</b></div></td>
 <td bgcolor= "lightgreen"><div align="center"><b>AddDirectory ( theName )</b></div></td>
 </tr>
 <td bgcolor= "lightgreen"><div align="center"><b>Callback  SetOnRemoveSObject ( in Callback theCallback )</b></div></td>
 <td bgcolor= "lightgreen"><div align="center"><b>return_value = SetOnRemoveSObject ( theCallback )</b></div></td>
 </tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>void SetName ( in SObject theSO, in string theValue )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>SetName ( theSO, theValue )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>void SetComment ( in SObject theSO, in string theValue )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>SetComment ( theSO, theValue )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>void SetIOR ( in SObject theSO, in string theValue )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>SetIOR ( theSO, theValue )</b></div></td>
+</tr>
 </table><br>
 <table width="100%" BORDER>
 <tr bgcolor="#FFFFCC">
 <td bgcolor= "lightgreen"><div align="center"><b>return_value = Tag (  )</b></div></td>
 </tr>
 <tr>
+<td bgcolor= "lightgreen"><div align="center"><b>short  Depth (  )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = Depth (  )</b></div></td>
+</tr>
+<tr>
 <td bgcolor= "lightgreen"><div align="center"><b>boolean  FindSubObject ( in long atag, out SObject obj )</b></div></td>
 <td bgcolor= "lightgreen"><div align="center"><b>[ return_value,  obj ] = FindSubObject ( atag )</b></div></td>
 </tr>
 <td bgcolor= "lightgreen"><div align="center"><b>Study  GetStudy (  )</b></div></td>
 <td bgcolor= "lightgreen"><div align="center"><b>return_value = GetStudy (  )</b></div></td>
 </tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>Object  GetObject (  )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = GetObject (  )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>string  GetName (  )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = GetName (  )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>string  GetComment (  )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = GetComment (  )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>string  GetIOR (  )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = GetIOR (  )</b></div></td>
+</tr>
 </table><br>
 <table width="100%" BORDER>
 <tr bgcolor="#FFFFCC">
 <td bgcolor= "lightgreen"><div align="center"><b>void CheckLocked (  )</b></div></td>
 <td bgcolor= "lightgreen"><div align="center"><b>CheckLocked (  )</b></div></td>
 </tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>string  Store (  )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = Store (  )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>void Restore ( in string theData )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>Restore ( theData )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>string  Type (  )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = Type (  )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>SObject  GetSObject (  )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = GetSObject (  )</b></div></td>
+</tr>
 </table><br>
 <table width="100%" BORDER>
 <tr bgcolor="#FFFFCC">
index 7dbf29d3f4e348d10042d6e3ae641755b0237927..49f848f73c631257ce07e26d636571f686f9c023 100644 (file)
 </table><br>
 <table width="100%" BORDER>
 <tr bgcolor="#FFFFCC">
+<td colspan="11"><font size="+3"><b><div align="center"><i>interface AttributeExternalFileDef</i></div></b></font></td>
+</tr>
+<td width="50%" bgcolor= "lightgreen" ><font size="+2"><div align="center"><b><i>IDL file</i></b></div></font></td>
+<td width="50%" bgcolor= "lightgreen"><font size="+2"><div align="center"><b><i>Python</i></b></div></font></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>string  Value (  )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = Value (  )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>void SetValue ( in string value )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>SetValue ( value )</b></div></td>
+</tr>
+</table><br>
+<table width="100%" BORDER>
+<tr bgcolor="#FFFFCC">
+<td colspan="11"><font size="+3"><b><div align="center"><i>interface AttributeFileType</i></div></b></font></td>
+</tr>
+<td width="50%" bgcolor= "lightgreen" ><font size="+2"><div align="center"><b><i>IDL file</i></b></div></font></td>
+<td width="50%" bgcolor= "lightgreen"><font size="+2"><div align="center"><b><i>Python</i></b></div></font></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>string  Value (  )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = Value (  )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>void SetValue ( in string value )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>SetValue ( value )</b></div></td>
+</tr>
+</table><br>
+<table width="100%" BORDER>
+<tr bgcolor="#FFFFCC">
 <td colspan="11"><font size="+3"><b><div align="center"><i>interface AttributeDrawable</i></div></b></font></td>
 </tr>
 <td width="50%" bgcolor= "lightgreen" ><font size="+2"><div align="center"><b><i>IDL file</i></b></div></font></td>
index 0457751176c3e289cd89c6824240c1d4362b8870..2d802860c5fd9742be6fc55fc7960147b5603d7a 100644 (file)
 <td bgcolor= "lightgreen"><div align="center"><b>boolean  Kill_impl (  )</b></div></td>
 <td bgcolor= "lightgreen"><div align="center"><b>return_value = Kill_impl (  )</b></div></td>
 </tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>string  getHostName (  )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = getHostName (  )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>long  getPID (  )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = getPID (  )</b></div></td>
+</tr>
 </table><br>
 <table width="100%" BORDER>
 <tr bgcolor="#FFFFCC">
 <td bgcolor= "lightgreen"><div align="center"><b>return_value = GetContainerRef (  )</b></div></td>
 </tr>
 <tr>
+<td bgcolor= "lightgreen"><div align="center"><b>void setProperties ( in FieldsDict dico )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>setProperties ( dico )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>FieldsDict  getProperties (  )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = getProperties (  )</b></div></td>
+</tr>
+<tr>
 <td bgcolor= "lightgreen"><div align="center"><b>void Names ( in string aGraphName, in string aNodeName )</b></div></td>
 <td bgcolor= "lightgreen"><div align="center"><b>Names ( aGraphName, aNodeName )</b></div></td>
 </tr>
index 009c6308d1b5cd1a2b612328e30607eb3105a5d9..5f618eb1a164d8ed4bbe6c40437bd9bb47993929 100644 (file)
 <td bgcolor= "lightgreen"><div align="center"><b>Acomponent  GetComponent ( in string componentname )</b></div></td>
 <td bgcolor= "lightgreen"><div align="center"><b>return_value = GetComponent ( componentname )</b></div></td>
 </tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>Component  GetComponentInfo ( in string componentName )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = GetComponentInfo ( componentName )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>void ImportXmlCatalogFile ( in string filename )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>ImportXmlCatalogFile ( filename )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>void shutdown (  )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>shutdown (  )</b></div></td>
+</tr>
 </table><br>
 </b></HTML>
index 804a067a9b435b3d158651a78fbfd473a49cc006..37b46747d0dc9be78e215d58f0b71197aa7878dd 100644 (file)
@@ -11,8 +11,8 @@
 <td bgcolor= "lightgreen"><div align="center"><b>GetInterface (  )</b></div></td>
 </tr>
 <tr>
-<td bgcolor= "lightgreen"><div align="center"><b>Component  GetVisuGen (  )</b></div></td>
-<td bgcolor= "lightgreen"><div align="center"><b>return_value = GetVisuGen (  )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>Component  GetVisuComponent (  )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = GetVisuComponent (  )</b></div></td>
 </tr>
 <tr>
 <td bgcolor= "lightgreen"><div align="center"><b>void StopSession (  )</b></div></td>
@@ -26,5 +26,9 @@
 <td bgcolor= "lightgreen"><div align="center"><b>void ping (  )</b></div></td>
 <td bgcolor= "lightgreen"><div align="center"><b>ping (  )</b></div></td>
 </tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>long  GetActiveStudyId (  )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = GetActiveStudyId (  )</b></div></td>
+</tr>
 </table><br>
 </b></HTML>
index 44a507fdd862c05b95f96b73eb57a3675a02476d..56348f8a1ebe685871c09e88702754ee1275f467 100644 (file)
@@ -10,5 +10,9 @@
 <td bgcolor= "lightgreen"><div align="center"><b>string  Coucou ( in long L )</b></div></td>
 <td bgcolor= "lightgreen"><div align="center"><b>return_value = Coucou ( L )</b></div></td>
 </tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>void Setenv (  )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>Setenv (  )</b></div></td>
+</tr>
 </table><br>
 </b></HTML>
index 6cda60af024ae7c5c5e25e54e2bc59a96c3d4dd4..29f6496ce04435e5d8c759733de45263c162595e 100755 (executable)
@@ -3,7 +3,7 @@
 #---------------------------------------------------------------------------
 # General configuration options
 #---------------------------------------------------------------------------
-PROJECT_NAME           = "SALOME v.2.0.0"
+PROJECT_NAME           = "SALOME v.2.1.0"
 PROJECT_NUMBER         = id#1.1
 OUTPUT_DIRECTORY       = ../
 OUTPUT_LANGUAGE        = English
index c765904909d28fd61e05a31706278b4f29377d43..18cf7f25f2104a7b810bd93871eeaad0a47908bb 100755 (executable)
@@ -1,4 +1,4 @@
-foldersTree = gFld("<b>SALOME v.2.0.0 </b>", "", "")
+foldersTree = gFld("<b>SALOME v.2.1.0 </b>", "", "")
      insDoc(foldersTree, gLnk("Main Page", "", "main.html"))
 
 aux1 = insFld(foldersTree, gFld("TUI Reference Guide", ""))
index 2c96c9b5fd4940c32ed445fb8e564f4d08d165b9..7de067f7454eff8be80916d2ee980c517707c64a 100644 (file)
@@ -12,6 +12,7 @@ VPATH=.
 
 IDL_FILES = \
   SALOME_Exception.idl \
+  SALOME_Comm.idl \
   SALOME_ModuleCatalog.idl \
   SALOME_DataTypeCatalog.idl \
   SALOME_RessourcesCatalog.idl \
@@ -34,7 +35,7 @@ PY_CLIENT_IDL = $(IDL_FILES)
 inc: $(top_builddir)/idl/salome $(IDL_FILES:%=$(top_builddir)/idl/salome/%)
 
 $(top_builddir)/idl/salome:
-       mkdir $@
+       mkdir -p $@
 
 $(IDL_FILES:%=$(top_builddir)/idl/salome/%):$(IDL_FILES:%=$(top_srcdir)/idl/%)
 #      $(CP) $< $@
@@ -55,7 +56,7 @@ $(PYTHON_BUILD_SITE)/%_idl.py: $(top_builddir)/idl/salome/%.idl
 
 
 # install python client (generated from idl file
-install: install-pyidl install-idl
+install: $(top_builddir)/idl/salome install-pyidl install-idl
 
 # create directory $(idldir) and copy idl files into it
 install-idl: $(IDL_FILES:%=$(top_builddir)/idl/salome/%)
index f019faf3110c27845f360b1ebf2c8479fc22e5e4..15e6511642f67b5d8504422b921208160f70e544 100644 (file)
@@ -820,6 +820,11 @@ Gets the list of open studies
     \return the %tag of a %SObject.
 */
     short      Tag();
+/*! Gets the depth of a %SObject
+
+    \return the depth of a %SObject.
+*/
+    short      Depth();
 /*! Looks for subobjects of a given %SObject.
 
     \param atag Tag of the given %SObject
index f42ccde7ef4b37f1abcaab1db364ca19127109c2..ae28b4472be00b983be4aba9d0ede18131a9f731 100644 (file)
@@ -101,6 +101,10 @@ module SALOME
     Determines whether the server has already been loaded or not.
 */ 
     void ping();
+/*!
+    Get Active study ID
+*/
+    long GetActiveStudyId();
   } ;
 
 } ;
index d170972f1ec634a5b412555d95128ceb35b719ae..2982ad06c7b72d28330a5d07054d545dae4afc79 100644 (file)
@@ -21,6 +21,8 @@ lib:
 
 include/salome/SALOMEconfig.h:
 
+include/salome/config.h:
+
 include/salome/sstream:
 
 depend:
index 66efc5a13b15d0ff660e2d1a03968ab0b2acd556..1cc692c5fd5bad4bd57f3c99f0f1d6066445a475 100644 (file)
@@ -43,7 +43,6 @@ else
   AC_CHECK_HEADER(boost/shared_ptr.hpp,boost_ok=yes,boost_ok=no)
 
   CPPFLAGS="${CPPFLAGS_old}"
-  boost_ok=yes
 fi
 
 AC_LANG_RESTORE
index 2b20480438cd30d151609152677d6336a3c158cf..85d8f0c73e3b111c8b5c375b19daa9e226d19499 100644 (file)
@@ -39,10 +39,14 @@ AC_SUBST(CAS_LDFLAGS)
 
 AC_SUBST(CAS_LDPATH)
 
+OWN_CONFIG_H=no
+
 CAS_CPPFLAGS=""
 CAS_CXXFLAGS=""
 CAS_LDFLAGS=""
 occ_ok=no
+own_config_h=no
+
 
 dnl libraries directory location
 case $host_os in
@@ -89,16 +93,48 @@ if test "x$occ_ok" = "xyes"; then
 dnl cascade headers
 
   CPPFLAGS_old="$CPPFLAGS"
-  CPPFLAGS="$CPPFLAGS -DLIN -DLINTEL -DCSFDB -DNO_CXX_EXCEPTION -DNo_exception -DHAVE_CONFIG_H -DHAVE_LIMITS_H -I$CASROOT/inc -I$CASROOT -Wno-deprecated -DHAVE_WOK_CONFIG_H"
+  CPPFLAGS="$CPPFLAGS -DLIN -DLINTEL -DCSFDB -DNO_CXX_EXCEPTION -DNo_exception -DHAVE_CONFIG_H -DHAVE_LIMITS_H -I$CASROOT/inc -I$CASROOT -I$KERNEL_ROOT_DIR/include/salome -Wno-deprecated -DHAVE_WOK_CONFIG_H"
   CXXFLAGS_old="$CXXFLAGS"
   CXXFLAGS="$CXXFLAGS -funsigned-char"
 
+
+  echo
+  echo
+  echo testing config.h
+  echo
+  echo
+
+  AC_CHECK_HEADER(config.h, own_config_h=no, [
+       echo
+       echo
+       echo "config.h file not found! Generating it..."
+       echo
+       echo
+       mv confdefs.h backup_confdefs.h
+       ${ROOT_SRCDIR}/make_config
+       rm -rf ${ROOT_BUILDDIR}/*.log
+       rm -rf ${ROOT_BUILDDIR}/*.status
+       mv backup_confdefs.h confdefs.h
+       rm -f backup_confdefs.h
+       own_config_h=yes
+       echo
+       echo
+  ])
+
+  if test "x$own_config_h" = xyes ; then
+    OWN_CONFIG_H=yes
+  fi
+
+  CPPFLAGS="$CPPFLAGS -I$ROOT_BUILDDIR/salome_adm/unix"
+  
   AC_CHECK_HEADER(Standard_Type.hxx,occ_ok=yes ,occ_ok=no)
 
   CPPFLAGS="$CPPFLAGS_old"
   CXXFLAGS="$CXXFLAGS_old"
 fi
 
+AC_SUBST(OWN_CONFIG_H)
+
 if test "x$occ_ok" = xyes ; then
 
   CAS_CPPFLAGS="-DOCC_VERSION_MAJOR=$OCC_VERSION_MAJOR -DLIN -DLINTEL -DCSFDB -DNO_CXX_EXCEPTION -DNo_exception -DHAVE_CONFIG_H -DHAVE_LIMITS_H -I$CASROOT/inc -I$CASROOT -DHAVE_WOK_CONFIG_H"
@@ -107,7 +143,7 @@ if test "x$occ_ok" = xyes ; then
   AC_MSG_CHECKING(for OpenCascade libraries)
 
   CPPFLAGS_old="$CPPFLAGS"
-  CPPFLAGS="$CPPFLAGS $CAS_CPPFLAGS -Wno-deprecated"
+  CPPFLAGS="$CPPFLAGS $CAS_CPPFLAGS -I$KERNEL_ROOT_DIR/include/salome -I$ROOT_BUILDDIR/salome_adm/unix -Wno-deprecated"
   CXXFLAGS_old="$CXXFLAGS"
   CXXFLAGS="$CXXFLAGS $CAS_CXXFLAGS"
   LIBS_old="$LIBS"
index 51f271a9f16f30f5ebfdf469228005f5006c8a84..6c68d7053eda52cf4ed1f7faa49cf553cc64ce77 100644 (file)
@@ -50,21 +50,54 @@ if test "$WITHMPI" = yes; then
   CPPFLAGS="$CPPFLAGS_old"
 
   if test "$WITHMPI" = "yes";then
+    LIBS_old="$LIBS"
     LDFLAGS_old="$LDFLAGS"
     LDFLAGS="$MPI_LIBS $LDFLAGS"
     AC_CHECK_LIB(elan,elan_init,MPI_LIBS="$MPI_LIBS -lelan")
     AC_CHECK_LIB(mpi,MPI_Init,WITHMPI="yes",WITHMPI="no")
+    AC_CHECK_LIB(mpi,MPI_Publish_name,WITHMPI2="yes",WITHMPI2="no")
     LDFLAGS="$LDFLAGS_old"
+    LIBS="$LIBS_old"
   fi
 
   if test "$WITHMPI" = "yes";then
     mpi_ok=yes
     MPI_LIBS="$MPI_LIBS -lmpi"
+  else
+    mpi_ok=no
   fi
 
 fi
+
+if test "$WITHMPI" = no; then
+dnl
+dnl ---------------------------------------------
+dnl testing MPICH
+dnl ---------------------------------------------
+dnl
+
+  CHECK_MPICH
+
+  if test "$WITHMPICH" = no; then
+dnl
+dnl ---------------------------------------------
+dnl testing LAM
+dnl ---------------------------------------------
+dnl
+
+    CHECK_LAM
+
+  fi
+
+fi
+
+if test "$WITHMPI2" = "yes";then
+  CPPFLAGS="-DHAVE_MPI2 $CPPFLAGS"
+  CORBA_IDLCXXFLAGS="-DHAVE_MPI2 $CORBA_IDLCXXFLAGS"
+  CORBA_IDLPYFLAGS="-DHAVE_MPI2 $CORBA_IDLPYFLAGS"
+fi
+
 AC_SUBST(MPI_INCLUDES)
 AC_SUBST(MPI_LIBS)
-AC_SUBST(WITHMPI)
-
+AC_SUBST(mpi_ok)
 ])dnl
index cb4af538888fde4bb42c47a31994a28888b5b102..5b34bcd806519c49d89fcdb85818c8ba2fe5a763 100644 (file)
@@ -28,8 +28,8 @@ AC_ARG_WITH(mpich,
            --with-mpich=DIR root directory path of MPICH installation,
            WITHMPICH="yes",WITHMPICH="no")
 
-MPICH_INCLUDES=""
-MPICH_LIBS=""
+MPI_INCLUDES=""
+MPI_LIBS=""
 if test "$WITHMPICH" = yes; then
 
   echo
@@ -40,29 +40,32 @@ if test "$WITHMPICH" = yes; then
   MPICH_HOME=$withval
 
   if test "$MPICH_HOME"; then
-    MPICH_INCLUDES="-I$MPICH_HOME/include"
-    MPICH_LIBS="-L$MPICH_HOME/lib"
+    MPI_INCLUDES="-I$MPICH_HOME/include"
+    MPI_LIBS="-L$MPICH_HOME/lib"
   fi
 
   CPPFLAGS_old="$CPPFLAGS"
-  CPPFLAGS="$MPICH_INCLUDES $CPPFLAGS"
+  CPPFLAGS="$MPI_INCLUDES $CPPFLAGS"
   AC_CHECK_HEADER(mpi.h,WITHMPICH="yes",WITHMPICH="no")
   CPPFLAGS="$CPPFLAGS_old"
 
   if test "$WITHMPICH" = "yes";then
     LDFLAGS_old="$LDFLAGS"
-    LDFLAGS="$MPICH_LIBS $LDFLAGS"
+    LDFLAGS="$MPI_LIBS $LDFLAGS"
     AC_CHECK_LIB(mpich,MPI_Init,
                AC_CHECK_LIB(pmpich, PMPI_Init,WITHMPICH="yes",WITHMPICH="no"),
                WITHMPICH="no")
+    AC_CHECK_LIB(mpich,MPI_Publish_name,WITHMPI2="yes",WITHMPI2="no")
     LDFLAGS="$LDFLAGS_old"
   fi
 
-  MPICH_LIBS="$MPICH_LIBS -lpmpich -lmpich"
+  if test "$WITHMPICH" = "yes";then
+     mpi_ok=yes
+     MPI_LIBS="$MPI_LIBS -lpmpich -lmpich"
+  else
+     mpi_ok=no
+  fi
 
 fi
-AC_SUBST(MPICH_INCLUDES)
-AC_SUBST(MPICH_LIBS)
-AC_SUBST(WITHMPICH)
 
 ])dnl
index c7a9699e31edaaa1ce5d3f3fa64a4834873999e1..f3d5abcdb62d902211015d7a4bdc6ef2c1a10514 100644 (file)
@@ -176,7 +176,7 @@ fi
 if test "x$omniORB_ok" = "xyes" 
 then
 
-  OMNIORB_IDLCXXFLAGS="-I$OMNIORB_ROOT/idl"
+  OMNIORB_IDLCXXFLAGS="-nf -I$OMNIORB_ROOT/idl"
   OMNIORB_IDLPYFLAGS="-bpython -I$OMNIORB_ROOT/idl"
   AC_SUBST(OMNIORB_IDLCXXFLAGS)
   AC_SUBST(OMNIORB_IDLPYFLAGS)
@@ -226,7 +226,7 @@ then
   fi
 fi
 
-AC_LANG_RESTORE
+dnl AC_LANG_RESTORE
 
 AC_MSG_RESULT(for omniORBpy: $omniORBpy_ok)
 AC_MSG_RESULT(for omniORB: $omniORB_ok)
@@ -234,5 +234,68 @@ AC_MSG_RESULT(for omniORB: $omniORB_ok)
 # Save cache
 AC_CACHE_SAVE
 
+dnl AC_LANG_CPLUSPLUS
+
+CXXFLAGS_old=$CXXFLAGS
+CXXFLAGS="$CXXFLAGS $OMNIORB_CXXFLAGS $OMNIORB_INCLUDES"
+LIBS_old=$LIBS
+LIBS="$LIBS $OMNIORB_LDFLAGS $OMNIORB_LIBS"
+AC_MSG_CHECKING(whether we have double and CORBA::Double compatibility)
+AC_TRY_RUN(
+#include <stdlib.h>
+#include <CORBA.h>
+int main ()
+{
+  CORBA::Double *a=new CORBA::Double(2.5);
+  double c=2.5;
+  double *b;
+  b=(double *)a;
+
+  if( (c==*b) && (sizeof(double)==sizeof(CORBA::Double)) ){
+    delete a;
+    exit(0);
+  }
+  else{
+    delete a;
+    exit(1);
+  }
+}
+,DOUBLECOMP="yes",DOUBLECOMP="no")
+if test "$DOUBLECOMP" = yes; then
+  OMNIORB_CXXFLAGS="$OMNIORB_CXXFLAGS -DCOMP_CORBA_DOUBLE"
+  AC_MSG_RESULT(yes)
+else
+  AC_MSG_RESULT(no)
+fi
+AC_MSG_CHECKING(whether we have int and CORBA::Long compatibility)
+AC_TRY_RUN(
+#include <stdlib.h>
+#include <CORBA.h>
+int main ()
+{
+  CORBA::Long *a=new CORBA::Long(2);
+  int c=2;
+  int *b;
+  b=(int *)a;
+
+  if( (c==*b) && (sizeof(int)==sizeof(CORBA::Long)) )
+    exit(0);
+  else
+    exit(1);
+}
+,LONGCOMP="yes",LONGCOMP="no")
+if test "$LONGCOMP" = yes; then
+  OMNIORB_CXXFLAGS="$OMNIORB_CXXFLAGS -DCOMP_CORBA_LONG"
+  AC_MSG_RESULT(yes)
+else
+  AC_MSG_RESULT(no)
+fi
+CXXFLAGS=$CXXFLAGS_old
+LIBS=$LIBS_old
+
+AC_LANG_RESTORE
+
+AC_SUBST(OMNIORB_CXXFLAGS)
+
 ])dnl
 dnl
index 6764c325aac17b6ae050ecfd1a678ec4c2626d87..cb99775f81b4482d491e14cbe65d13fe126f0069 100644 (file)
@@ -29,7 +29,7 @@ pyqt_ok=no
 if test "x$PYQTDIR" = x; then
   PYQTDIR="/usr"
 fi
-
+  
 if test "x$PYQT_SIPS" = x; then
   PYQT_SIPS="/usr/share/sip/qt"
 fi
@@ -50,7 +50,11 @@ else
   PYQTBIN=$PYQTDIR
 fi
 
-AC_CHECK_FILE("$PYQTBIN/pyuic",pyqt_ok=yes,pyqt_ok=no)
+if test "x$PYUIC" = x; then
+  PYUIC="$PYQTBIN/pyuic"
+fi
+  
+AC_CHECK_FILE("$PYUIC",pyqt_ok=yes,pyqt_ok=no)
 
 if test "x$pyqt_ok" = xyes ; then
   AC_CHECK_FILES("$PYQTLIB/qt.py",pyqt_ok=yes,pyqt_ok=no)
index aa161181a33df8bd695dca94c96a9cb278457517..b115b8aab84c79fdddd6c6c918b9f398c7b763d9 100644 (file)
@@ -53,9 +53,16 @@ no) enable_production=no ;;
 esac],
 enable_production=AC_ENABLE_PRODUCTION_DEFAULT)dnl
 
+CXXFLAGS="$CXXFLAGS -Wno-deprecated -Wparentheses -Wreturn-type -Wmissing-declarations -Wunused "
+
+CXXVERSION=`$CXX --version`
+if test "X$CXXVERSION" != "X2.95.3"; then
+  CXXFLAGS="${CXXFLAGS} -fmessage-length=0 "
+fi
+
 if test "X$enable_production" = "Xyes"; then
   CFLAGS="$CFLAGS -O"
-  CXXFLAGS="$CXXFLAGS -O -Wno-deprecated "
+  CXXFLAGS="$CXXFLAGS -O -Wuninitialized "
 fi
 ])
 
@@ -89,7 +96,7 @@ enable_debug=AC_ENABLE_DEBUG_DEFAULT)dnl
 
 if test "X$enable_debug" = "Xyes"; then
   CFLAGS="$CFLAGS -g -D_DEBUG_ "
-  CXXFLAGS="$CXXFLAGS -g -D_DEBUG_ -Wno-deprecated "
+  CXXFLAGS="$CXXFLAGS -g -D_DEBUG_ "
 fi
 ])
 
index 72033bdcd7dd38181d5b963ba5013099e98d65f1..e421712461fcbcaa5b7618253c2a51f0a87be568 100644 (file)
@@ -31,13 +31,19 @@ C_DEPEND_FLAG = @C_DEPEND_FLAG@
 # C++
 
 CXX = @CXX@
-CXXFLAGS = @CXXFLAGS@ 
+CXXFLAGS = @CXXFLAGS@
 CXX_DEPEND_FLAG = @CXX_DEPEND_FLAG@
 
 # BOOST Library
 
 BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
 
+# OpenPBS
+
+OPENPBS_INCLUDES = @OPENPBS_INCLUDES@
+OPENPBS_LIBDIR   = @OPENPBS_LIBDIR@
+OPENPBS_LIBS     = @OPENPBS_LIBS@
+
 # JAVA
 
 JAVA_INCLUDES = @JAVA_INCLUDES@
@@ -78,6 +84,8 @@ SIP_LIBS = @SIP_LIBS@
 # PYQT
 PYQT_SIPS = @PYQT_SIPS@
 PYQT_LIBS = @PYQT_LIBS@
+PYQT_INCLUDES = @PYQT_INCLUDES@
+PYUIC = @PYUIC@
 
 # openGL
 OGL_INCLUDES=@OGL_INCLUDES@
@@ -116,10 +124,11 @@ CAS_VIEWER=@CAS_VIEWER@
 CAS_MODELER=@CAS_MODELER@
 CAS_DATAEXCHANGE=@CAS_DATAEXCHANGE@
 CAS_LDPATH=@CAS_LDPATH@
-# MPICH
 
-MPICH_INCLUDES=@MPICH_INCLUDES@
-MPICH_LIBS=@MPICH_LIBS@
+# MPI
+
+MPI_INCLUDES=@MPI_INCLUDES@
+MPI_LIBS=@MPI_LIBS@
 
 # Swig C++ Python
 
index b791f484d28cbc6af3e46c0752c957c7cc341270..4ad410361db070076e7201f87ebdf090f4918ac0 100644 (file)
@@ -99,11 +99,27 @@ $(BIN) $(TEST_PROGS): %: %.lo $(BIN_OBJ)
 
 # copy python scripts in $(top_builddir)/bin/salome
 #
+
+UI_FILES = $(notdir $(wildcard $(srcdir)/*.ui))
+UI_PY_FILES_PY = $(patsubst %.ui, %.py, $(UI_FILES))
+UI_PY_FILES = $(filter-out $(EXPORT_PYSCRIPTS) ,$(UI_PY_FILES_PY))
+
 DEST_PYSCRIPTS = $(EXPORT_PYSCRIPTS:%=$(top_builddir)/bin/salome/%)
-pyscripts: $(DEST_PYSCRIPTS)
+DEST_UI_PY_FILES = $(UI_PY_FILES:%=$(top_builddir)/bin/salome/%)
+pyscripts: $(DEST_PYSCRIPTS) $(UI_PY_FILES) $(DEST_UI_PY_FILES)
 $(DEST_PYSCRIPTS): $(top_builddir)/bin/salome/%: %
        cp -f $< $@
 
+# generate generic python scripts from *.ui files
+#
+$(UI_PY_FILES): %.py: %.ui
+       $(PYUIC) $< -o $@
+
+# copy ui-generated python scripts in $(top_builddir)/bin
+#
+$(DEST_UI_PY_FILES): $(top_builddir)/bin/salome/%: %
+       cp -f $< $@
+
 # copy pyqt files in $(PYTHON_SHARED_SITE)
 #
 PYTHON_SHARED_SITE=$(top_builddir)/lib/python$(PYTHON_VERSION)/site-packages/salome/shared_modules
@@ -166,7 +182,10 @@ install: $(LIB) $(BIN) $(TEST_PROGS) $(libdir) $(includedir) $(bindir) $(datadir
        done
 
 # Install python script in $(bindir)
-install-python: $(bindir) $(EXPORT_PYSCRIPTS:%=install-%)
+install-python: $(bindir) $(EXPORT_PYSCRIPTS:%=install-%) $(UI_PY_FILES:%=install-%)
+
+$(UI_PY_FILES:%=install-%): install-%: %
+       $(INSTALL_PROGRAM) $< $(bindir)/.
 
 $(EXPORT_PYSCRIPTS:%=install-%): install-%: %
        $(INSTALL_PROGRAM) $< $(bindir)/.
@@ -224,6 +243,13 @@ uninstall:
           fi;                                                                \
        done
 
+# Uninstall python script in $(bindir)
+       @for f in X $(UI_PY_FILES); do                                        \
+          if test $$f != X; then                                             \
+            $(LT_UNINSTALL) $(bindir)/$$f ;                  \
+          fi;                                                                \
+       done
+
 # Uninstall pyqt script in $(sharedpydir)
        @for f in X $(EXPORT_SHAREDPYSCRIPTS); do                                     \
           if test $$f != X; then                                             \
index 9c68bb2a15727077b007ef14fa59eb64e625bf33..b753a67079b5a6d1b6bdb0902e982cd722c35f13 100644 (file)
@@ -449,7 +449,7 @@ void SigIntHandler(int what , siginfo_t * siginfo ,
 // Get the PID of the Container
 
 long Engines_Container_i::getPID() {
-    return(_pid);
+    return (long)getpid();
 }
 
 // Get the hostName of the Container
index 87f372867be63617a21151acb89a7a8d3f1cc5c9..6d68f0fd7dc48c72a6cbf59b40e0718b71fafe3c 100644 (file)
@@ -48,13 +48,14 @@ LIB_SERVER_IDL = SALOME_Registry.idl SALOME_Component.idl
 
 # Executables targets
 BIN = SALOME_Container
-BIN_SRC =
+BIN_SRC = SALOME_Container_SignalsHandler.cxx
 BIN_SERVER_IDL = SALOME_Component.idl
 
-CPPFLAGS+= $(PYTHON_INCLUDES)
+CPPFLAGS+= $(PYTHON_INCLUDES) $(MPI_INCLUDE) $(OCC_INCLUDES)
+CXXFLAGS+=$(OCC_CXXFLAGS)
 
 LDFLAGS+= -lSalomeNS -lRegistry -lOpUtil -lSalomeNotification -lSALOMELocalTrace
 
-LIBS += -Xlinker -export-dynamic $(PYTHON_LIBS)
+LIBS += -Xlinker -export-dynamic $(PYTHON_LIBS) $(MPI_LIBS) -lCASCatch
 
 @CONCLUDE@
index 4b93ef5b526dd6a2e642a14003ed9b22ba22f133..16a135dc2cd8deac57f6feb85d239e7f63e9a673 100644 (file)
@@ -93,11 +93,11 @@ public:
   long CpuUsed_impl() ;
 
 protected:
-  string _instanceName ;
-  string _interfaceName ;
-  string _serviceName ;
-  string _graphName ;
-  string _nodeName ;
+  std::string _instanceName ;
+  std::string _interfaceName ;
+  std::string _serviceName ;
+  std::string _graphName ;
+  std::string _nodeName ;
   CORBA::ORB_ptr _orb;
   PortableServer::POA_ptr _poa;
   PortableServer::ObjectId * _id;
@@ -105,7 +105,7 @@ protected:
   Engines_Component_i * _thisObj ;
   RegistryConnexion *_myConnexionToRegistry;
   NOTIFICATION_Supplier* _notifSupplier;
-  map<std::string,CORBA::Any>_fieldsDict;
+  std::map<std::string,CORBA::Any>_fieldsDict;
 
 private:
   pthread_t _ThreadId ;
index ee3bf487f1b2a71250431be52672d7a2765ce988..41a526d0a5ff8cc54122b90094e9057e798bae42 100644 (file)
 //  Module : SALOME
 //  $Header$
 
+#include <iostream>
+#include <string>
 #include <stdio.h>
 
 #include "Utils_ORB_INIT.hxx"
 #include "Utils_SINGLETON.hxx"
 #include "SALOME_NamingService.hxx"
 #include "SALOME_Container_i.hxx"
-#include <iostream>
-#include <string>
 #include "utilities.h"
 #include "LocalTraceCollector.hxx"
-#include "Utils_CatchSignals.h"
-using namespace std;
 
 #ifdef CHECKTIME
 #include <Utils_Timer.hxx>
 #endif
 
+#ifdef HAVE_MPI2
+#include <mpi.h>
+#endif
+
 #include <Python.h>
 
-static PyMethodDef MethodPyVoidMethod[] =
-  {
-    { NULL, NULL }
-  };
+extern "C" void HandleServerSideSignals(CORBA::ORB_ptr theORB);
+
+using namespace std;
+
+static PyMethodDef MethodPyVoidMethod[] = {{ NULL, NULL }};
 
 int main(int argc, char* argv[])
 {
+#ifdef HAVE_MPI2
+  MPI_Init(&argc,&argv);
+#endif
   // Initialise the ORB.
   ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
   CORBA::ORB_var &orb = init( argc , argv ) ;
   LocalTraceCollector *myThreadTrace = LocalTraceCollector::instance(orb);
   INFOS_COMPILATION;
-  BEGIN_OF(argv[0])
-
-    Py_Initialize() ;
+  BEGIN_OF(argv[0]);
+    
+  Py_Initialize() ;
   PySys_SetArgv( argc , argv ) ;
   Py_InitModule( "InitPyRunMethod" , MethodPyVoidMethod ) ;
-
-  try
-    {
+  
+  try{
+    // Obtain a reference to the root POA.
+    // obtain the root poa manager
+    //
+    long TIMESleep = 250000000;
+    int NumberOfTries = 40;
+    int a;
+    timespec ts_req;
+    ts_req.tv_nsec=TIMESleep;
+    ts_req.tv_sec=0;
+    timespec ts_rem;
+    ts_rem.tv_nsec=0;
+    ts_rem.tv_sec=0;
+    CosNaming::NamingContext_var inc;
+    PortableServer::POA_var root_poa;
+    CORBA::Object_var theObj;
+    CORBA::Object_var obj;
+    CORBA::Object_var object;
+    SALOME_NamingService &naming = *SINGLETON_<SALOME_NamingService>::Instance() ;
+    int CONTAINER=0;
+    const char * Env = getenv("USE_LOGGER");
+    int EnvL =0;
+    if(Env != NULL && strlen(Env))
+      EnvL=1;
     
-      // Obtain a reference to the root POA.
-      // obtain the root poa manager
-      //
-      long TIMESleep = 250000000;
-      int NumberOfTries = 40;
-      int a;
-      timespec ts_req;
-      ts_req.tv_nsec=TIMESleep;
-      ts_req.tv_sec=0;
-      timespec ts_rem;
-      ts_rem.tv_nsec=0;
-      ts_rem.tv_sec=0;
-      CosNaming::NamingContext_var inc;
-      PortableServer::POA_var root_poa;
-      CORBA::Object_var theObj;
-      CORBA::Object_var obj;
-      CORBA::Object_var object;
-      SALOME_NamingService &naming = *SINGLETON_<SALOME_NamingService>::Instance() ;
-      int CONTAINER=0;
-      const char * Env = getenv("USE_LOGGER");
-      int EnvL =0;
-      if ((Env!=NULL) && (strlen(Env)))
-       EnvL=1;
-
-      CosNaming::Name name;
-      name.length(1);
-      name[0].id=CORBA::string_dup("Logger");    
-      PortableServer::POAManager_var pman; 
-      for (int i = 1; i<=NumberOfTries; i++)
-       {
-         if (i!=1) 
-           a=nanosleep(&ts_req,&ts_rem);
-         try
-           { 
-             obj = orb->resolve_initial_references("RootPOA");
-             if(!CORBA::is_nil(obj))
-               root_poa = PortableServer::POA::_narrow(obj);
-             if(!CORBA::is_nil(root_poa))
-               pman = root_poa->the_POAManager();
-             if(!CORBA::is_nil(orb)) 
-               theObj = orb->resolve_initial_references("NameService");
-             if (!CORBA::is_nil(theObj))
-               inc = CosNaming::NamingContext::_narrow(theObj);
+    CosNaming::Name name;
+    name.length(1);
+    name[0].id=CORBA::string_dup("Logger");    
+    PortableServer::POAManager_var pman; 
+    for(int i = 1; i <= NumberOfTries; i++){
+      if(i != 1) 
+       a=nanosleep(&ts_req,&ts_rem);
+      try{ 
+       obj = orb->resolve_initial_references("RootPOA");
+       if(!CORBA::is_nil(obj))
+         root_poa = PortableServer::POA::_narrow(obj);
+       if(!CORBA::is_nil(root_poa))
+         pman = root_poa->the_POAManager();
+       if(!CORBA::is_nil(orb)) 
+         theObj = orb->resolve_initial_references("NameService");
+       if (!CORBA::is_nil(theObj))
+         inc = CosNaming::NamingContext::_narrow(theObj);
+      }catch(CORBA::COMM_FAILURE&){
+       MESSAGE( "Container: CORBA::COMM_FAILURE: Unable to contact the Naming Service" );
+      }
+      if(!CORBA::is_nil(inc)){
+       MESSAGE( "Container: Naming Service was found" );
+       if(EnvL == 1){
+         for(int j = 1; j <= NumberOfTries; j++){
+           if(j != 1) 
+             a=nanosleep(&ts_req, &ts_rem);
+           try{
+             object = inc->resolve(name);
+           }catch(CosNaming::NamingContext::NotFound){
+             MESSAGE( "Container: Logger Server wasn't found" );
+           }catch(...){
+             MESSAGE( "Container: Unknown exception" );
            }
-         catch( CORBA::COMM_FAILURE& )
-           {
-             MESSAGE( "Container: CORBA::COMM_FAILURE: Unable to contact the Naming Service" );
+           if(!CORBA::is_nil(object)){
+             MESSAGE( "Container: Logger Server was found" );
+             CONTAINER = 1;
+             break;
            }
-         if(!CORBA::is_nil(inc)) 
-           {
-             MESSAGE( "Container: Naming Service was found" );
-             if(EnvL==1)
-               {
-                 for(int j=1; j<=NumberOfTries; j++)
-                   {
-                     if (j!=1) 
-                       a=nanosleep(&ts_req, &ts_rem);
-                     try
-                       {
-                         object = inc->resolve(name);
-                       }
-                     catch(CosNaming::NamingContext::NotFound)
-                       {
-                         MESSAGE( "Container: Logger Server wasn't found" );
-                       }
-                     catch(...)
-                       {
-                         MESSAGE( "Container: Unknown exception" );
-                       }
-                     if (!CORBA::is_nil(object))
-                       {
-                         MESSAGE( "Container: Logger Server was found" );
-                         CONTAINER=1;
-                         break;
-                       }
-                   }
-               }
-           }
-         if ((CONTAINER==1)||((EnvL==0)&&(!CORBA::is_nil(inc))))
-            break;
-       }    
-
-      // 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
+         }
+       }
+      }
+      if(CONTAINER == 1 || (EnvL == 0 && !CORBA::is_nil(inc)))
+       break;
+    }
     
-      // create policy list
-      CORBA::PolicyList policyList;
-      policyList.length(2);
-      policyList[0] = PortableServer::ImplicitActivationPolicy::_duplicate(implicitActivation) ;
-      policyList[1] = PortableServer::ThreadPolicy::_duplicate(threadPolicy) ;
-
-      // create the child POA
-      PortableServer::POAManager_var nil_mgr = PortableServer::POAManager::_nil() ;
-      PortableServer::POA_var factory_poa =
-       root_poa->create_POA("factory_poa", pman, policyList) ;
-      //with nil_mgr instead of pman, a new POA manager is created with the new POA
+    // define policy objects     
+    PortableServer::ImplicitActivationPolicy_var implicitActivation =
+      root_poa->create_implicit_activation_policy(PortableServer::NO_IMPLICIT_ACTIVATION) ;
     
-      // destroy policy objects
-      implicitActivation->destroy() ;
-      threadPolicy->destroy() ;
-
-      char *containerName = "";
-      if (argc >1) 
-       {
-         containerName = argv[1] ;
-       }
+    // 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
     
-      Engines_Container_i * myContainer 
-       = new Engines_Container_i(orb, factory_poa, containerName , argc , argv );
-
-      //     Engines_Container_i * myContainer 
-      //      = new Engines_Container_i(string(argv[1]),string(argv[2]), orb, factory_poa);
-
-      // use naming service
-      //     myContainer->_NS.init_orb(orb);
-      //     Engines::Container_ptr pCont = Engines::Container::_narrow(myContainer->_this());
-      //     myContainer->_NS.Register(pCont, argv[2]); 
+    // create policy list
+    CORBA::PolicyList policyList;
+    policyList.length(2);
+    policyList[0] = PortableServer::ImplicitActivationPolicy::_duplicate(implicitActivation) ;
+    policyList[1] = PortableServer::ThreadPolicy::_duplicate(threadPolicy) ;
+    
+    // create the child POA
+    PortableServer::POAManager_var nil_mgr = PortableServer::POAManager::_nil() ;
+    PortableServer::POA_var factory_poa =
+      root_poa->create_POA("factory_poa", pman, policyList) ;
+    //with nil_mgr instead of pman, a new POA manager is created with the new POA
+    
+    // destroy policy objects
+    implicitActivation->destroy() ;
+    threadPolicy->destroy() ;
+    
+    char *containerName = "";
+    if(argc > 1){
+      containerName = argv[1] ;
+    }
+    
+    Engines_Container_i * myContainer 
+      = new Engines_Container_i(orb, factory_poa, containerName , argc , argv );
+    
+    //     Engines_Container_i * myContainer 
+    //      = new Engines_Container_i(string(argv[1]),string(argv[2]), orb, factory_poa);
+    
+    // use naming service
+    //     myContainer->_NS.init_orb(orb);
+    //     Engines::Container_ptr pCont = Engines::Container::_narrow(myContainer->_this());
+    //     myContainer->_NS.Register(pCont, argv[2]); 
+    
+    pman->activate();
     
-      pman->activate();
-
 #ifdef CHECKTIME
-      Utils_Timer timer;
-      timer.Start();
-      timer.Stop();
-      MESSAGE("SALOME_Registry_Server.cxx - orb->run()");
-      timer.ShowAbsolute();
+    Utils_Timer timer;
+    timer.Start();
+    timer.Stop();
+    MESSAGE("SALOME_Registry_Server.cxx - orb->run()");
+    timer.ShowAbsolute();
+#endif
+    
+    HandleServerSideSignals(orb);
+    
+    orb->destroy();
+  }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(std::exception& exc){
+    INFOS("Caught std::exception - "<<exc.what()); 
+  }catch(...){
+    INFOS("Caught unknown exception.");
+  }
+#ifdef HAVE_MPI2
+  MPI_Finalize();
 #endif
-      Utils_CatchSignals aCatch;
-      aCatch.Activate();
-
-      orb->run();
-
-      aCatch.Deactivate();
-      orb->destroy();
-    }
-  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.")
-       }
   END_OF(argv[0]);
   delete myThreadTrace;
   return 0 ;
index 4e83c867ba7f08ad26ece40fd92f23f4f0bd63b6..e960a3b830b902cb7b437d5fa31a694c6cf9cdf0 100644 (file)
 #ifndef _SALOME_CONTAINER_I_HXX_
 #define _SALOME_CONTAINER_I_HXX_
 
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOME_Component)
+
 #include <iostream>
 #include <signal.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <sys/types.h>
-#include <SALOMEconfig.h>
-#include CORBA_SERVER_HEADER(SALOME_Component)
 #include <omnithread.h>
 #include <map>
 #include <string>
 
 class SALOME_NamingService;
 
-class Engines_Container_i: public POA_Engines::Container,
-                public PortableServer::RefCountServantBase
+class Engines_Container_i: public virtual POA_Engines::Container,
+                          public virtual PortableServer::RefCountServantBase
 {
 public:
   Engines_Container_i();
index 55217510a8a1d278b7d40409b665d7fef2f212bf..47f8fb92dee049c515b2b9b0b68baf561bf84023 100644 (file)
 //  Module : SALOME
 //  $Header$
 
-using namespace std;
-#define WRITE_CATA_DATA_TYPE
 #include "SALOME_DataTypeCatalog_Handler.hxx"
 
+#include "utilities.h"
+
+using namespace std;
+
+// contains all the data types defined in the catalog
+ListOfParserDataType _datatypelist; 
+
 //----------------------------------------------------------------------
 // Function : SALOME_DataTypeCatalog_Handler
 // Purpose  : Constructor
index 7e76f636ce2031a58e6bae6f25ac7bfd7af7ffe2..78d08de307cfade863cd541fdcb14247b92deee6 100644 (file)
@@ -29,7 +29,6 @@
 #ifndef SALOME_DATA_CATALOG_HANDLER_H
 #define SALOME_DATA_CATALOG_HANDLER_H
 
-#include "utilities.h"
 #include "SALOME_DataTypeCatalog_Parser.hxx"
 #include <qxml.h>
 #include <string>
@@ -104,7 +103,7 @@ public:
 private:
   QString errorProt ;
 
-  string content;
+  std::string content;
 
   const char* test_data_type_name ;
   const char* test_data_type_interf_read ;
index ed65a0c59348a14457922278ffba6ab51652a21b..fc867bed3ac0d89cb6b02e4771d17fd25d3c1a2a 100644 (file)
 #include <vector>
 
 // Type Definitions
-typedef  vector<string> ListOfParserDataTypeName;
+typedef  std::vector<std::string> ListOfParserDataTypeName;
 
 struct ParserDataType{
-  string                               Parserdata_name ;       
-  string                        Parserdata_interface_read;
-  string                        Parserdata_interface_write;
+  std::string                          Parserdata_name ;       
+  std::string                   Parserdata_interface_read;
+  std::string                   Parserdata_interface_write;
   ListOfParserDataTypeName     Parserdata_parents ;
 };
 
-typedef vector<ParserDataType> ListOfParserDataType;
+typedef std::vector<ParserDataType> ListOfParserDataType;
 
-#ifdef WRITE_CATA_DATA_TYPE
 // contains all the data types defined in the catalog
-ListOfParserDataType _datatypelist; 
-#else
 extern ListOfParserDataType _datatypelist;
-#endif
+
 
 #endif // SALOME_DATA_CATALOG_PARSER_H
index dfebd7b02f751dbe9c8e6181150566b3d28a68b9..e12fc070f61af8241fedbdeeb93423fdb35b508f 100644 (file)
@@ -33,6 +33,7 @@
 #include <qsemaphore.h>
 #include <qapplication.h>
 #include <qthread.h>
+#include <pthread.h>
 
 #ifdef _DEBUG_
 static int MYDEBUG = 0;
@@ -40,22 +41,31 @@ static int MYDEBUG = 0;
 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(): 
-  myWait( true ),
-  myAutoRelease( false )
-{
-  if(MYDEBUG) MESSAGE( "SALOME_Event::SALOME_Event(): this = "<<this<<", myWait = "<<myWait );
-  if ( myWait ) {
-    // Prepare the semaphore 
-    mySemaphore = new QSemaphore( 2 );
-    mySemaphore->operator+=( 2 );
-  }
+SALOME_Event::SALOME_Event(){
+  if(MYDEBUG) MESSAGE( "SALOME_Event::SALOME_Event(): this = "<<this );
+  // Prepare the semaphore 
+  mySemaphore = new QSemaphore( 2 );
+  *mySemaphore += 2;
 }
 
 //===========================================================
@@ -64,14 +74,11 @@ SALOME_Event::SALOME_Event():
  *  Destructor
  */
 //===========================================================
-SALOME_Event::~SALOME_Event()
-{
-  if(MYDEBUG) MESSAGE( "SALOME_Event::~SALOME_Event(): this = "<<this<<", myWait = "<<myWait );
-  if ( myWait ) {
-    if ( mySemaphore->available() < mySemaphore->total() )
-      mySemaphore->operator-=( mySemaphore->total() - mySemaphore->available() );
-    delete mySemaphore;
-  }
+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;
 }
 
 //===========================================================
@@ -82,17 +89,10 @@ SALOME_Event::~SALOME_Event()
 //===========================================================
 void SALOME_Event::process()
 {
-  if(MYDEBUG) MESSAGE( "SALOME_Event::process(): this = "<<this<<", myWait = "<<myWait );
   QThread::postEvent( qApp, new QCustomEvent( SALOME_EVENT, (void*)this ) );
-  if ( myWait ) {
-    if(MYDEBUG) MESSAGE( "SALOME_Event::process(): available = " << mySemaphore->available() );
-    if ( !mySemaphore->available() )
-      mySemaphore->operator+=( 1 );
-
-    if(MYDEBUG) MESSAGE( "SALOME_Event::process() COMPLETED: this = "<<this<<", myWait = "<<myWait );
-  }
-  if ( myAutoRelease )
-    release();
+  if(MYDEBUG) MESSAGE( "SALOME_Event::process(): this = "<<this<<", *mySemaphore += 1 " );
+  *mySemaphore += 1;
+  if(MYDEBUG) MESSAGE( "SALOME_Event::process(): this = "<<this<<" - COMPLETED" );
 }
 
 //===========================================================
@@ -103,38 +103,7 @@ void SALOME_Event::process()
 //===========================================================
 void SALOME_Event::processed()
 {
-  if(MYDEBUG) MESSAGE( "SALOME_Event::processed(): this = "<<this<<", myWait = "<<myWait );
-  if ( myWait ) {
-    if(MYDEBUG) MESSAGE( "SALOME_Event::processed(): available = " << mySemaphore->available() );
-    if ( !mySemaphore->available() ) {
-      // process() takes control over mySemaphore after the next line is executed
-      mySemaphore->operator-=( 1 );
-
-      if(MYDEBUG) MESSAGE( "SALOME_Event::processed(): semaphore DECREMENTED" );
-
-      // Current thread will block here until process() completes
-      mySemaphore->operator+=( mySemaphore->total() );
-    }
-  }
-  if(MYDEBUG) MESSAGE( "SALOME_Event::processed() COMPLETED: this = "<<this<<", myWait = "<<myWait );
+  if(MYDEBUG) MESSAGE( "SALOME_Event::processed(): this = "<<this );
+  // process() takes control over mySemaphore after the next line is executed
+  *mySemaphore -= 1;
 }
-
-//===========================================================
-/*!
- *  SALOME_Event::release
- *  Wakes up the desktop
- */
-//===========================================================
-void SALOME_Event::release()
-{
-  if(MYDEBUG) MESSAGE( "SALOME_Event::release(): this = "<<this<<", myWait = "<<myWait );
-  if ( myWait ) {
-    if(MYDEBUG) MESSAGE( "SALOME_Event::release(): available = " << mySemaphore->available() );
-    mySemaphore->operator-=( mySemaphore->total() - mySemaphore->available() );
-  }
-  if(MYDEBUG) MESSAGE( "SALOME_Event::release() COMPLETED: this = "<<this<<", myWait = "<<myWait );
-}
-
-
-
-
index 2467912d904ee9345081cc3f60262fe0c8eca2dd..9414e5b3a0e598a1a73b8287d4a1ef930c75f47a 100644 (file)
@@ -51,39 +51,25 @@ class QSemaphore;
  *  no need to protect such fields with a mutex, for only one thread working with
  *  a SALOME_Event object is active at any moment.
  *
- *  It is possible to make the thread that creates SALOME_Event
- *  wait until the event is processed by the component GUI, SALOME_Event
- *  should be constructed with <wait> == TRUE in such a case.
- *
- *  SALOME_Event objects should be created on the heap. QAD_Desktop deletes
- *  these objects as soon as they have been processed.
- *
  *  Usage:
- *  - create SALOME_Event object on the heap with proper <type> and <wait> parameters
+ *  - 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. Between process() and release()
+ *  - call process() method to post the event. After process() execution
  *    it is possible to examine fields of your custom event object.
- *  - call release() method to wake up the desktop (you can also set <autoRelease>
+ *  - 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: 
- *  1. Never create SALOME_Event with <wait> == TRUE in code that is 
- *     supposed to be called within main GUI thread, for this will result
- *     in GUI process deadlock.
- *  2. Always call release() method after process() if you use <wait> parameters as TRUE,
- *     otherwise processed() method will never return and main GUI thread will be blocked!
- *  3. Never use pointers to the event after it has been released (either by calling release()
- *     or automatically by process() if <autoRelease> == TRUE) to avoid application crashes!
+ *    There is no.
  */
 //===========================================================
 
 
-class SALOME_Event
-{
+class SALOME_Event{
 public:
   SALOME_Event();
   virtual ~SALOME_Event();
@@ -91,14 +77,17 @@ public:
   // To do real work
   virtual void Execute() = 0;
 
+  static bool IsSessionThread();
   void process();
+
+protected:
   void processed();
+  friend class QAD_Desktop;
 
-  void release();
+  static void GetSessionThread();
+  friend int main(int, char **);
 
 private:
-  bool        myWait;
-  bool        myAutoRelease;
   QSemaphore* mySemaphore;
 };
 
@@ -242,17 +231,27 @@ private:
 
 // Template function for processing events with result returing
 template<class TEvent> inline typename TEvent::TResult ProcessEvent(TEvent* theEvent){
-  theEvent->process();
-  typename TEvent::TResult aResult = theEvent->myResult;
-  theEvent->release();
+  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){
-  theEvent->process();
-  theEvent->release();
+  if(SALOME_Event::IsSessionThread()){
+    theEvent->Execute();
+  }else{
+    theEvent->process();
+  }
+  delete theEvent;
 }
 
 
index f0fdad6e0b22160b0431fa2671e536d27a9c2f1f..e5281e72b77a5fb4d4a210b9bdad789df3e660b8 100644 (file)
 #include "SALOME_GenericObj_i.hh"
 #include "utilities.h"
 
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
 using namespace SALOME;
+using namespace std;
 
 GenericObj_i::GenericObj_i(PortableServer::POA_ptr thePOA): myRefCounter(1){
-  MESSAGE("GenericObj_i::GenericObj_i() - this = "<<this<<
-       "; CORBA::is_nil(thePOA) = "<<CORBA::is_nil(thePOA));
+  if(MYDEBUG) 
+    MESSAGE("GenericObj_i::GenericObj_i() - this = "<<this<<
+           "; CORBA::is_nil(thePOA) = "<<CORBA::is_nil(thePOA));
   if(CORBA::is_nil(thePOA))
     myPOA = PortableServer::RefCountServantBase::_default_POA();
   else
@@ -40,19 +48,20 @@ GenericObj_i::GenericObj_i(PortableServer::POA_ptr thePOA): myRefCounter(1){
 
 
 PortableServer::POA_ptr GenericObj_i::_default_POA(){
-  //return PortableServer::RefCountServantBase::_default_POA();
   return PortableServer::POA::_duplicate(myPOA);
 }
 
 
 void GenericObj_i::Register(){
-  MESSAGE("GenericObj_i::Register "<<this<<"; myRefCounter = "<<myRefCounter)
+  if(MYDEBUG)
+    MESSAGE("GenericObj_i::Register "<<this<<"; myRefCounter = "<<myRefCounter)
   ++myRefCounter;
 }
 
 
 void GenericObj_i::Destroy(){
-  MESSAGE("GenericObj_i::Destroy "<<this<<"; myRefCounter = "<<myRefCounter)
+  if(MYDEBUG)
+    MESSAGE("GenericObj_i::Destroy "<<this<<"; myRefCounter = "<<myRefCounter)
   if(--myRefCounter <= 0){
     PortableServer::ObjectId_var anObjectId = myPOA->servant_to_id(this);
     myPOA->deactivate_object(anObjectId.in());
index 2a6fe9b760a19a62fc65ef8ce57dd7d8cd2fb9ef..31c19c95353c6c22fc827acc0c441d3e318cd870 100644 (file)
@@ -99,4 +99,6 @@ int HDFConvert::FromAscii(const string& file, const HDFcontainerObject & hdf_con
     return -1;
   };
     
+
+  return length;    
 };
index c19e679654ca0c6656cfe6733629ee644778d400..42628a1c8bf43d07772bcf865cc0a4a10db61bfa 100644 (file)
@@ -43,7 +43,6 @@ extern "C"
 #include "HDFfile.hxx"
 #include <string>
 
-using namespace std;
 
 class HDFConvert 
 {
@@ -54,7 +53,7 @@ private:
 
 public:
 
-static int FromAscii(const string& file, const  HDFcontainerObject& hdf_container, const string& nomdataset);
+static int FromAscii(const std::string& file, const  HDFcontainerObject& hdf_container, const std::string& nomdataset);
 
 };
 
index 5395341a82345dc2d24013dc38625bdc377035a6..c62f6a18f02fc830c0f7b8900de1fce50b42b13f 100644 (file)
 /* Exception */
 #include <iostream>
 
-using namespace std;
 
 class HDFexception
 {
 public :
   HDFexception(const char *message) { 
-    cerr << message << endl;
+    std::cerr << message << std::endl;
   }
 };
index e40309918a9e25134b50c67407e9229350658091..d93260dc2ae6690d4cac24408a45b0072a1924d5 100644 (file)
@@ -193,7 +193,7 @@ void InquireServersGUI::customEvent( QCustomEvent* pe )
 
 int InquireServersGUI::getExitStatus()
 {
-  myThread->getExitStatus();
+  return myThread->getExitStatus();
 }
 
 InquireServersQThread::InquireServersQThread( InquireServersGUI* r )
index 90fbfd06fd441aa2e4a81594c52c4cc2e3754c61..e0019a1f5c57023376268c5bc35e99e692743b30 100644 (file)
@@ -11,6 +11,9 @@
 #if !defined(AFX_LOGGER_H__96F2A3AB_F6F8_11D6_BFA6_000476A0958C__INCLUDED_)
 #define AFX_LOGGER_H__96F2A3AB_F6F8_11D6_BFA6_000476A0958C__INCLUDED_
 
+#include <strstream.h>
+#include "Logger.hh"
+
 //these declarations for files don't using OCC includes (for example HDF)
 # ifdef WNT
 
 
 # endif  /* WNT */
 
-using namespace std;
-
-#include <strstream.h>
-#include "Logger.hh"
-
-class SALOME_Trace : public ostrstream  
+class SALOME_Trace : public std::ostrstream  
 {
 public:
        virtual ~SALOME_Trace();
index b227bc1106a4aac4491f7b75f8e538cb5eb63607..adc7477d1917b5044c99ad7b9d408f461e1ebe86 100644 (file)
@@ -45,7 +45,7 @@ void ReadMed(const char* theFileName){
   TWrapper aMedW(aFileName);
 
   int aNbMeshes = aMed.GetNbMeshes();
-  cout<<"GetNbMeshes() = "<<aNbMeshes<<endl;
+  MESSAGE("GetNbMeshes() = "<<aNbMeshes);
 
   string aName;
   for(int iMesh = 0; iMesh < aNbMeshes; iMesh++){
@@ -54,7 +54,7 @@ void ReadMed(const char* theFileName){
     aMed.GetMeshInfo(iMesh+1,*aMeshInfo);
     int aDim = aMeshInfo->myDim;
     aName = aMeshInfo->GetName();
-    cout<<"GetMeshInfo - aName = '"<<aName<<"'; aDim = "<<aDim<<endl;
+    MESSAGE("GetMeshInfo - aName = '"<<aName<<"'; aDim = "<<aDim);
     *aNewMeshInfo = *aMeshInfo;
     aName[0] += 1;
     aNewMeshInfo->SetName(aName);
@@ -63,18 +63,18 @@ void ReadMed(const char* theFileName){
     TEntityInfo aEntityInfo = aMed.GetEntityInfo(*aMeshInfo);
 
     med_int aNbFields = aMed.GetNbFields(); 
-    cout<<"GetNbFields() = "<<aNbFields<<endl;
+    MESSAGE("GetNbFields() = "<<aNbFields);
     for(int iField = 0; iField < aNbFields; iField++){
       med_int aNbComp = aMed.GetNbComp(iField+1);
       PFieldInfo aFieldInfo(new TFieldInfo(aMeshInfo,aNbComp));
       aMed.GetFieldInfo(iField+1,*aFieldInfo);
-      cout<<"\taName = '"<<aFieldInfo->GetName()<<"'; aNbComp = "<<aNbComp<<"; ";
+      MESSAGE("\taName = '"<<aFieldInfo->GetName()<<"'; aNbComp = "<<aNbComp<<"; ");
       aMedW.SetFieldInfo(*aFieldInfo);
       med_entite_maillage anEntity;
       TGeom aTGeom;
       med_int aNbTimeStamps = aMed.GetNbTimeStamps(*aFieldInfo,aEntityInfo,
                                                   anEntity,aTGeom);
-      cout<<"GetNbTimeStamps = "<<aNbTimeStamps<<endl;
+      MESSAGE("GetNbTimeStamps = "<<aNbTimeStamps);
       PTimeStampInfo aTimeStampInfo(new TTimeStampInfo(aFieldInfo,anEntity,aTGeom));
       for(int iTimeStamp = 0; iTimeStamp < aNbTimeStamps; iTimeStamp++){
        aMed.GetTimeStampInfo(iTimeStamp+1, *aTimeStampInfo);
@@ -88,34 +88,34 @@ void ReadMed(const char* theFileName){
        for(; aMeshValueIter != aMeshValue.end(); aMeshValueIter++){
          med_geometrie_element aGeom = aMeshValueIter->first;
          TValue aValue = aMeshValueIter->second;
-         cout<<"\t\taGeom = "<<aGeom<<"; aValue = "<<aValue.size()<<": ";
+         MESSAGE("\t\taGeom = "<<aGeom<<"; aValue = "<<aValue.size()<<": ");
          for(int i = 0, iEnd = aValue.size()/aNbComp; i < iEnd; i++){
            for(int j = 0, ij = i*aNbComp; j < aNbComp; j++, ij++){
-             //cout<<aValue[ij]<<",";
+             //MESSAGE(aValue[ij]<<",");
            }
-           //cout<<" ";
+           //MESSAGE(" ");
          }
-         cout<<"\n";
+         MESSAGE("\n");
        }
       }
     }
 
     int aNbFam = aMed.GetNbFamilies(*aMeshInfo);
-    cout<<"GetNbFamilies() = "<<aNbFam<<endl;
+    MESSAGE("GetNbFamilies() = "<<aNbFam);
     for(int iFam = 0; iFam < aNbFam; iFam++){
       int aNbAttr = aMed.GetNbFamAttr(iFam+1,*aMeshInfo);
       int aNbGroup = aMed.GetNbFamGroup(iFam+1,*aMeshInfo);
       PFamilyInfo aFamilyInfo(new TFamilyInfo(aMeshInfo,aNbGroup,aNbAttr));
       aMed.GetFamilyInfo(iFam+1,*aFamilyInfo);
       aName = aFamilyInfo->GetName();
-      cout<<"\taName = '"<<aName<<"'; aNbAttr = "<<aNbAttr<<"; aNbGroup = "<<aNbGroup<<endl;
+      MESSAGE("\taName = '"<<aName<<"'; aNbAttr = "<<aNbAttr<<"; aNbGroup = "<<aNbGroup);
       aName[0] += 1;
       aFamilyInfo->SetName(aName);
       aFamilyInfo->myMeshInfo = aNewMeshInfo;
       aName = aFamilyInfo->GetName();
       for(int iGroup = 0; iGroup < aNbGroup; iGroup++){
        aName = aFamilyInfo->GetGroupName(iGroup);
-       cout<<"\t\taGroupName = '"<<aName<<"'\n";
+       MESSAGE("\t\taGroupName = '"<<aName<<"'");
        aName[0] += 1;
        aFamilyInfo->SetGroupName(iGroup,aName);
       }
@@ -123,25 +123,25 @@ void ReadMed(const char* theFileName){
       aMedW.SetFamilyInfo(*aFamilyInfo);
     }
 
-    cout<<"GetEntityInfo - aNbEntities = "<<aEntityInfo.size()<<endl;
+    MESSAGE("GetEntityInfo - aNbEntities = "<<aEntityInfo.size());
     TEntityInfo::iterator anEntityInfoIter = aEntityInfo.begin();
     for(; anEntityInfoIter != aEntityInfo.end(); anEntityInfoIter++){
       const med_entite_maillage& anEntity = anEntityInfoIter->first;
-      cout<<"\tanEntity = "<<anEntity<<endl;
+      MESSAGE("\tanEntity = "<<anEntity);
       if(anEntity == MED_NOEUD){
        int aNbNodes = aMed.GetNbNodes(*aMeshInfo);
        PNodeInfo aNodeInfo(new TNodeInfo(aMeshInfo,aNbNodes));
        aMed.GetNodeInfo(*aNodeInfo);
-       cout<<"\tGetNodeInfo - aNbNodes = "<<aNbNodes<<": ";
+       MESSAGE("\tGetNodeInfo - aNbNodes = "<<aNbNodes<<": ");
        TNodeCoord& aCoord = aNodeInfo->myCoord;
        for(int iNode = 0; iNode < aNbNodes; iNode++){
          for(int iDim = 0, anId = iNode*aDim; iDim < aDim; iDim++, anId++){
-           //cout<<aCoord[anId]<<",";
+           //MESSAGE(aCoord[anId]<<",");
            aCoord[anId] += 1.0;
          }
-         //cout<<" ";
+         //MESSAGE(" ");
        }
-       cout<<endl;
+       MESSAGE(endl);
        aNodeInfo->myMeshInfo = aNewMeshInfo;
        aMedW.SetNodeInfo(*aNodeInfo);
        continue;
@@ -151,24 +151,24 @@ void ReadMed(const char* theFileName){
       for(; anTGeomIter != aTGeom.end(); anTGeomIter++){
        const med_geometrie_element& aGeom = anTGeomIter->first;
        med_int& aNbElem = anTGeomIter->second;
-       cout<<"\t\taGeom = "<<aGeom<<"; aNbElem = "<<aNbElem<<": ";
+       MESSAGE("\t\taGeom = "<<aGeom<<"; aNbElem = "<<aNbElem<<": ");
        PCellInfo aCellInfo(new TCellInfo(aMeshInfo,aNbElem,anEntity,aGeom));
        aMed.GetCellInfo(*aCellInfo);
        for(int iElem = 0; iElem < aCellInfo->myNbElem; iElem++){
          int i = iElem*aCellInfo->myConnDim;
          for(int iConn = 0; iConn < aCellInfo->myConnDim; iConn++, i++){
-           //cout<<aCellInfo->myConn[i]<<",";
+           //MESSAGE(aCellInfo->myConn[i]<<",");
          }
-         //cout<<" ";
+         //MESSAGE(" ");
        }
-       cout<<endl;
+       MESSAGE(endl);
        aCellInfo->myMeshInfo = aNewMeshInfo;
        aMedW.SetCellInfo(*aCellInfo);
       }
     }
     
   }
-  cout<<"OK"<<endl;
+  MESSAGE("OK");
 }
 
 
@@ -178,9 +178,9 @@ int main(int argc, char** argv){
       ReadMed(argv[1]);
     return 0;
   }catch(std::exception& exc){
-    cout<<"Follow exception was accured :\n"<<exc.what()<<endl;
+    MESSAGE("Follow exception was accured :\n"<<exc.what());
   }catch(...){
-    cout<<"Unknown exception was accured in VISU_Convertor_impl"<<endl;
+    MESSAGE("Unknown exception was accured in VISU_Convertor_impl");
   } 
   return 1;
 }
index 22ba51053497cb1bcafe0af1c44a28c0ec562c31..b3fb62e6bb2162abdb544dd2b57781003ee05e92 100644 (file)
@@ -35,7 +35,7 @@ MPIContainer_i::MPIContainer_i(int nbproc, int numproc,
                               CORBA::ORB_ptr orb, 
                               PortableServer::POA_ptr poa,
                               char * containerName) 
-  : Engines_Container_i(orb,poa,containerName,0), MPIObject_i(nbproc,numproc)
+  : Engines_Container_i(orb,poa,containerName,0,0), MPIObject_i(nbproc,numproc)
 {
   _id = _poa->activate_object(this);
 
index 218c01c9db9326679fd7824f88a1b76188ac9236..7f9324a9fdf905dada3b3d08c58ed044957453b0 100644 (file)
@@ -85,14 +85,14 @@ void MPIObject_i::BCastIOR(CORBA::ORB_ptr orb, Engines::MPIObject_var pobj,
 
     // Process 0 recupere les ior de l'object sur les autres process
     for(ip=1;ip<_nbproc;ip++){
-      err = MPI_Recv(&n,1,MPI_INTEGER,ip,ip,MPI_COMM_WORLD,&status);
+      err = MPI_Recv(&n,1,MPI_INT,ip,ip,MPI_COMM_WORLD,&status);
       if(err){
        MESSAGE("[" << _numproc << "] MPI_RECV error");
        exit(1);
       }
       // Allocation de la chaine de longueur n
       ior = (char*)calloc(n,sizeof(char));
-      err = MPI_Recv(ior,n,MPI_CHARACTER,ip,2*ip,MPI_COMM_WORLD,&status);
+      err = MPI_Recv(ior,n,MPI_CHAR,ip,2*ip,MPI_COMM_WORLD,&status);
       if(err){
        MESSAGE("[" << _numproc << "] MPI_RECV error");
        exit(1);
@@ -110,12 +110,12 @@ void MPIObject_i::BCastIOR(CORBA::ORB_ptr orb, Engines::MPIObject_var pobj,
   else{
     // On envoie l'IOR au process 0
     n = strlen((char*)sior);
-    err = MPI_Send(&n,1,MPI_INTEGER,0,_numproc,MPI_COMM_WORLD);
+    err = MPI_Send(&n,1,MPI_INT,0,_numproc,MPI_COMM_WORLD);
     if(err){
       MESSAGE("[" << _numproc << "] MPI_SEND error");
       exit(1);
     }
-    err = MPI_Send((char*)sior,n,MPI_CHARACTER,0,2*_numproc,MPI_COMM_WORLD);
+    err = MPI_Send((char*)sior,n,MPI_CHAR,0,2*_numproc,MPI_COMM_WORLD);
     if(err){
       MESSAGE("[" << _numproc << "] MPI_SEND error");
       exit(1);
index da4e295d95186e4f043a718bddbfcd47a69d1bb4..5576a570a74a10c5631626393929a250a962d51e 100644 (file)
@@ -51,8 +51,8 @@ BIN = SALOME_MPIContainer
 BIN_SRC = 
 BIN_SERVER_IDL = TypeData.idl MPIObject.idl MPIContainer.idl
 
-CXXFLAGS+=${MPICH_INCLUDES}
-CXX_DEPEND_FLAG+=${MPICH_INCLUDES}
-LDFLAGS+= -lSalomeContainer -lSalomeNS -lRegistry -lOpUtil ${MPICH_LIBS} 
+CXXFLAGS+=${MPI_INCLUDES}
+CXX_DEPEND_FLAG+=${MPI_INCLUDES}
+LDFLAGS+= -lSalomeContainer -lSalomeNS -lRegistry -lOpUtil ${MPI_LIBS} 
 
 @CONCLUDE@
index 097947db2d6068d7859d54bf8353286d123329c4..a7838c30d422cb2c0a748a5b0bdb1616061c840a 100644 (file)
@@ -1,30 +1,9 @@
-//  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   : msg2qm.cxx
-//  Module : SALOME
+/////////////////////////////////////////////////////////////////////////////
+// Module      : MSG2QM
+// File        : msg2qm.cxx
+// Description : This is a duplication of Qt tool for resources compiling 
+/////////////////////////////////////////////////////////////////////////////
 
-using namespace std;
 /****************************************************************************
 ** $Id$
 **
@@ -35,6 +14,8 @@ using namespace std;
 ** Copyright (C) 1998 by Trolltech AS.  All rights reserved.
 **
 *****************************************************************************/
+
+using namespace std;
 #include <qfile.h>
 #include <qtextstream.h>
 #include <qtextcodec.h>
@@ -61,7 +42,8 @@ QString extractContents( const QString& line )
        pos++;
     pos++;
     while ( pos < int(line.length()) && line[pos] != '\"' ) {
-       if ( line[pos] == '\\') {
+       // 0xa5: the yen sign is the Japanese backslash
+       if ( line[pos] == '\\' || line[pos] == QChar(0xa5) ) {
            pos++;
            switch (char(line[pos]) ) {
            case 'n':
index 78eef6e73a656adf93b732b9ce98f9abd4cff728..684d6230548e7a8abb78b1ade1e252bcf0e4c887 100644 (file)
@@ -32,21 +32,24 @@ VPATH=.:@srcdir@
 
 @COMMENCE@
 
-#SUBDIRS = MSG2QM SALOMELocalTrace Logger SALOMELogger Utils PatchQt 
-SUBDIRS = MSG2QM SALOMELocalTrace Logger Utils PatchQt \
+SUBDIRS = MSG2QM SALOMELocalTrace Logger Utils CASCatch PatchQt \
           GenericObj MEDWrapper NamingService Registry \
          ModuleCatalog DataTypeCatalog RessourcesCatalog \
           Notification  NOTIFICATION_SWIG \
-         Container TestContainer LifeCycleCORBA HDFPersist \
+         Container TestContainer LifeCycleCORBA HDFPersist Prs \
          VTKFilter OBJECT \
           TOOLSDS SALOMEDS Event \
           SALOMEGUI Plot2d VTKViewer OCCViewer \
          SUPERVGraph \
          Session SALOME_SWIG TOOLSGUI SALOME_PY \
-          RegistryDisplay ModuleGenerator SALOME_PYQT Loader
+          RegistryDisplay ModuleGenerator SALOME_PYQT Loader Communication
 
-ifeq (@WITHMPICH@,yes)
+ifeq (@mpi_ok@,yes)
   SUBDIRS+= MPIContainer
 endif
 
+ifeq (@WITHOPENPBS@,yes)
+  SUBDIRS += Batch Batch_SWIG
+endif
+
 @MODULE@
index 4cf8e579a929064a1bbd95d957798df105361f6c..ad1c341694a121db358bf5b88dec0dd8580e8f2e 100644 (file)
 //  Module : SALOME
 //  $Header$
 
-using namespace std;
 #include "SALOME_ModuleCatalog_Acomponent_impl.hxx"
 
 #include "Utils_ExceptHandlers.hxx"
 UNEXPECT_CATCH(MC_NotFound, SALOME_ModuleCatalog::NotFound);
 
+#include "utilities.h"
+
+using namespace std;
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
 //----------------------------------------------------------------------
 // Function : SALOME_ModuleCatalog_AcomponentImpl
 // Purpose  : Constructor
@@ -43,9 +52,9 @@ UNEXPECT_CATCH(MC_NotFound, SALOME_ModuleCatalog::NotFound);
 SALOME_ModuleCatalog_AcomponentImpl::SALOME_ModuleCatalog_AcomponentImpl
 (SALOME_ModuleCatalog::Component &C) : _Component(C)
 {
-  BEGIN_OF("SALOME_ModuleCatalog_AcomponentImpl");
+  if(MYDEBUG) BEGIN_OF("SALOME_ModuleCatalog_AcomponentImpl");
 
-  END_OF("SALOME_ModuleCatalog_AcomponentImpl");
+  if(MYDEBUG) END_OF("SALOME_ModuleCatalog_AcomponentImpl");
 }
 
 //----------------------------------------------------------------------
@@ -54,10 +63,10 @@ SALOME_ModuleCatalog_AcomponentImpl::SALOME_ModuleCatalog_AcomponentImpl
 //----------------------------------------------------------------------
 SALOME_ModuleCatalog_AcomponentImpl::~SALOME_ModuleCatalog_AcomponentImpl()
 {
-  BEGIN_OF("~SALOME_ModuleCatalog_AcomponentImpl");
+  if(MYDEBUG) BEGIN_OF("~SALOME_ModuleCatalog_AcomponentImpl");
 
 
-  END_OF("~SALOME_ModuleCatalog_AcomponentImpl");
+  if(MYDEBUG) END_OF("~SALOME_ModuleCatalog_AcomponentImpl");
 }
 
 //----------------------------------------------------------------------
@@ -67,7 +76,7 @@ SALOME_ModuleCatalog_AcomponentImpl::~SALOME_ModuleCatalog_AcomponentImpl()
 SALOME_ModuleCatalog::ListOfInterfaces* 
 SALOME_ModuleCatalog_AcomponentImpl::GetInterfaceList() 
 {
-  BEGIN_OF("GetInterfaceList");
+  if(MYDEBUG) BEGIN_OF("GetInterfaceList");
 
   SALOME_ModuleCatalog::ListOfInterfaces_var _list 
     = new SALOME_ModuleCatalog::ListOfInterfaces;
@@ -82,11 +91,11 @@ SALOME_ModuleCatalog_AcomponentImpl::GetInterfaceList()
   for (unsigned int ind = 0; ind < _length_interfaces; ind++)
     {
       _list[ind] = CORBA::string_dup(_Component.interfaces[ind].interfacename);
-      MESSAGE("The component " << _Component.name 
-             << " contains " << _list[ind] << " as interface");
+      if(MYDEBUG) MESSAGE("The component " << _Component.name 
+                         << " contains " << _list[ind] << " as interface");
     }
   
-  END_OF("GetInterfaceList");
+  if(MYDEBUG) END_OF("GetInterfaceList");
   return _list._retn();
 }
 
@@ -98,8 +107,8 @@ SALOME_ModuleCatalog::DefinitionInterface*
 SALOME_ModuleCatalog_AcomponentImpl::GetInterface(const char* interfacename)
                                      throw(SALOME_ModuleCatalog::NotFound)
 {
-  BEGIN_OF("GetInterface");
-  SCRUTE(interfacename);
+  if(MYDEBUG) BEGIN_OF("GetInterface");
+  if(MYDEBUG) SCRUTE(interfacename);
 
   SALOME_ModuleCatalog::DefinitionInterface *_interface =
          new SALOME_ModuleCatalog::DefinitionInterface;
@@ -120,7 +129,7 @@ SALOME_ModuleCatalog_AcomponentImpl::GetInterface(const char* interfacename)
        }
     }
 
-  SCRUTE(_find);
+  if(MYDEBUG) SCRUTE(_find);
   if (!_find)
     {
       // The interface was not found, the exception should be thrown
@@ -129,11 +138,11 @@ SALOME_ModuleCatalog_AcomponentImpl::GetInterface(const char* interfacename)
       message += " of the component ";
       message += _Component.name;
       message += " was not found"; 
-      MESSAGE(message)
-       throw SALOME_ModuleCatalog::NotFound(message.c_str());
+      if(MYDEBUG) MESSAGE(message);
+      throw SALOME_ModuleCatalog::NotFound(message.c_str());
     }
 
-  END_OF("GetInterface");
+  if(MYDEBUG) END_OF("GetInterface");
 
   return _interface;
 }
@@ -149,8 +158,8 @@ SALOME_ModuleCatalog::ListOfServices*
 SALOME_ModuleCatalog_AcomponentImpl::GetServiceList(const char* interfacename)
                                      throw(SALOME_ModuleCatalog::NotFound)
 {
-  BEGIN_OF("GetServiceList");
-  SCRUTE(interfacename);
+  if(MYDEBUG) BEGIN_OF("GetServiceList");
+  if(MYDEBUG) SCRUTE(interfacename);
 
   SALOME_ModuleCatalog::ListOfServices_var _list 
     = new SALOME_ModuleCatalog::ListOfServices;
@@ -173,8 +182,8 @@ SALOME_ModuleCatalog_AcomponentImpl::GetServiceList(const char* interfacename)
          for (unsigned int ind1 = 0; ind1 < _length_services ; ind1++)
            {
              _list[ind1] = CORBA::string_dup(I.interfaceservicelist[ind1].ServiceName);
-             MESSAGE("The interface " << interfacename << " of the component " 
-                     << _Component.name << " contains " << _list[ind1] << " as a service") 
+             if(MYDEBUG) MESSAGE("The interface " << interfacename << " of the component " 
+                                 << _Component.name << " contains " << _list[ind1] << " as a service") 
            }
        }
     }
@@ -187,11 +196,11 @@ SALOME_ModuleCatalog_AcomponentImpl::GetServiceList(const char* interfacename)
       message += " of the component ";
       message += _Component.name;
       message += " was not found"; 
-      MESSAGE(message)
-       throw SALOME_ModuleCatalog::NotFound(message.c_str());
+      if(MYDEBUG) MESSAGE(message);
+      throw SALOME_ModuleCatalog::NotFound(message.c_str());
     }
 
-  END_OF("GetServiceList");
+  if(MYDEBUG) END_OF("GetServiceList");
   return _list._retn();
 }
 
@@ -205,9 +214,9 @@ SALOME_ModuleCatalog_AcomponentImpl::GetService(const char* interfacename,
                                                const char* servicename) 
                                      throw(SALOME_ModuleCatalog::NotFound)
 {
-  BEGIN_OF("GetService");
-  SCRUTE(interfacename);
-  SCRUTE(servicename);
+  if(MYDEBUG) BEGIN_OF("GetService");
+  if(MYDEBUG) SCRUTE(interfacename);
+  if(MYDEBUG) SCRUTE(servicename);
 
   Unexpect aCatch( MC_NotFound );
   SALOME_ModuleCatalog::Service *service = new SALOME_ModuleCatalog::Service;
@@ -219,8 +228,8 @@ SALOME_ModuleCatalog_AcomponentImpl::GetService(const char* interfacename,
   // looking for the specified interface
   for (unsigned int ind = 0; ind < _Component.interfaces.length(); ind++)
     {
-      SCRUTE(ind);
-      SCRUTE(_Component.interfaces[ind].interfacename);
+      if(MYDEBUG) SCRUTE(ind);
+      if(MYDEBUG) SCRUTE(_Component.interfaces[ind].interfacename);
 
       SALOME_ModuleCatalog::DefinitionInterface &I = _Component.interfaces[ind];
       if (strcmp(interfacename, I.interfacename) == 0)
@@ -230,8 +239,8 @@ SALOME_ModuleCatalog_AcomponentImpl::GetService(const char* interfacename,
          for (unsigned int ind1 = 0; ind1 <  I.interfaceservicelist.length() ; ind1++)
            {
              SALOME_ModuleCatalog::Service &S = I.interfaceservicelist[ind1];
-             SCRUTE(ind1);
-             SCRUTE(S.ServiceName);
+             if(MYDEBUG) SCRUTE(ind1);
+             if(MYDEBUG) SCRUTE(S.ServiceName);
 
              if (strcmp(servicename, S.ServiceName) == 0)
              {
@@ -245,7 +254,7 @@ SALOME_ModuleCatalog_AcomponentImpl::GetService(const char* interfacename,
        }
     }
   
-  SCRUTE(_find);
+  if(MYDEBUG) SCRUTE(_find);
   if (!_find)
     {
       // The interface was not found, the exception should be thrown
@@ -256,11 +265,11 @@ SALOME_ModuleCatalog_AcomponentImpl::GetService(const char* interfacename,
       message += " of the component ";
       message += _Component.name;
       message += " was not found"; 
-      MESSAGE(message)
-       throw SALOME_ModuleCatalog::NotFound(message.c_str());
+      if(MYDEBUG) MESSAGE(message);
+      throw SALOME_ModuleCatalog::NotFound(message.c_str());
     }
 
-  END_OF("GetService");
+  if(MYDEBUG) END_OF("GetService");
   return service;
 }
 
@@ -272,8 +281,8 @@ SALOME_ModuleCatalog::Service*
 SALOME_ModuleCatalog_AcomponentImpl::GetDefaultService(const char* interfacename) 
                                      throw(SALOME_ModuleCatalog::NotFound)
 {
-  BEGIN_OF("GetDefaultService");
-  SCRUTE(interfacename);
+  if(MYDEBUG) BEGIN_OF("GetDefaultService");
+  if(MYDEBUG) SCRUTE(interfacename);
 
   Unexpect aCatch( MC_NotFound );
   SALOME_ModuleCatalog::Service *_service = new  SALOME_ModuleCatalog::Service;
@@ -310,11 +319,11 @@ SALOME_ModuleCatalog_AcomponentImpl::GetDefaultService(const char* interfacename
       message += " of the component ";
       message += _Component.name;
       message += " was not found";
-      MESSAGE(message)
-       throw SALOME_ModuleCatalog::NotFound(message.c_str());
+      if(MYDEBUG) MESSAGE(message);
+      throw SALOME_ModuleCatalog::NotFound(message.c_str());
     }
 
-  END_OF("GetDefaultService");
+  if(MYDEBUG) END_OF("GetDefaultService");
   return _service;
 }
 
@@ -326,8 +335,8 @@ char*
 SALOME_ModuleCatalog_AcomponentImpl::GetPathPrefix(const char* machinename) 
                                      throw(SALOME_ModuleCatalog::NotFound)
 {
-  BEGIN_OF("GetPathPrefix");
-  SCRUTE(machinename);
+  if(MYDEBUG) BEGIN_OF("GetPathPrefix");
+  if(MYDEBUG) SCRUTE(machinename);
   Unexpect aCatch( MC_NotFound );
 
  // Variables initialisation
@@ -349,7 +358,7 @@ SALOME_ModuleCatalog_AcomponentImpl::GetPathPrefix(const char* machinename)
            }
      }
 
-   SCRUTE(_find);
+   if(MYDEBUG) SCRUTE(_find);
    if (!_find)
      {
        // The computer was not found, the exception should be thrown
@@ -357,11 +366,11 @@ SALOME_ModuleCatalog_AcomponentImpl::GetPathPrefix(const char* machinename)
        message += machinename;
        message += " was not found in the catalog associated to the component ";
        message += _Component.name;
-       MESSAGE(message)
+       if(MYDEBUG) MESSAGE(message);
        throw SALOME_ModuleCatalog::NotFound(message.c_str());
      }
 
-  END_OF("GetPathPrefix");
+  if(MYDEBUG) END_OF("GetPathPrefix");
   return _path;
 }
 
@@ -499,7 +508,7 @@ void SALOME_ModuleCatalog_AcomponentImpl::duplicate
   
   // duplicate out DataStreamParameters
   _length = S_in.ServiceoutDataStreamParameter.length();
-  SCRUTE(_length);
+  if(MYDEBUG) SCRUTE(_length);
   S_out.ServiceoutDataStreamParameter.length(_length);
   
   for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++)
@@ -517,7 +526,7 @@ void SALOME_ModuleCatalog_AcomponentImpl::duplicate
   
   // duplicate service list
   unsigned int _length = I_in.interfaceservicelist.length();
-  SCRUTE(_length);
+  if(MYDEBUG) SCRUTE(_length);
   I_out.interfaceservicelist.length(_length);
   
   for (unsigned int ind1 = 0; ind1 < _length ; ind1 ++)
index b7718b1694321ef71167ab5aeb26818e014ffe6a..4580350ae1e14baaa06a2f90c9349e5cff9cf64c 100644 (file)
@@ -29,7 +29,6 @@
 #ifndef ACOMPONENT_IMPL_H
 #define ACOMPONENT_IMPL_H
 
-#include "utilities.h"
 #include "SALOME_ModuleCatalog_Parser.hxx"
 #include <SALOMEconfig.h>
 
index da1ce33ceb654cba42939cf7624306b4fd96a0dc..19275eec58bed30a1e24959ca66b44faaaf88dd8 100644 (file)
 //  $Header$ 
 
 #define WRITE_CATA_COMPONENT
+
 #include "SALOME_ModuleCatalog_Handler.hxx"
 #include "SALOME_ModuleCatalog_Parser_IO.hxx"
-using namespace std;
+#include "utilities.h"
+
 #include <sstream>
 
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
 //----------------------------------------------------------------------
 // Function : SALOME_ModuleCatalog_Handler
 // Purpose  : Constructor
 //----------------------------------------------------------------------
 SALOME_ModuleCatalog_Handler::SALOME_ModuleCatalog_Handler()
 {
-  BEGIN_OF("SALOME_ModuleCatalog_Handler");
+  if(MYDEBUG) BEGIN_OF("SALOME_ModuleCatalog_Handler");
 
   // XML Tags initialisation
   // Used in the function endElement
@@ -90,7 +98,7 @@ SALOME_ModuleCatalog_Handler::SALOME_ModuleCatalog_Handler()
 
   test_component="component";
 
-  END_OF("SALOME_ModuleCatalog_Handler");
+  if(MYDEBUG) END_OF("SALOME_ModuleCatalog_Handler");
 }
 
 //----------------------------------------------------------------------
@@ -99,8 +107,8 @@ SALOME_ModuleCatalog_Handler::SALOME_ModuleCatalog_Handler()
 //----------------------------------------------------------------------
 SALOME_ModuleCatalog_Handler::~SALOME_ModuleCatalog_Handler()
 {
-  BEGIN_OF("~SALOME_ModuleCatalog_Handler()")
-  END_OF("~SALOME_ModuleCatalog_Handler()")
+  if(MYDEBUG) BEGIN_OF("~SALOME_ModuleCatalog_Handler()")
+  if(MYDEBUG) END_OF("~SALOME_ModuleCatalog_Handler()")
 }
 
 //----------------------------------------------------------------------
@@ -109,7 +117,7 @@ SALOME_ModuleCatalog_Handler::~SALOME_ModuleCatalog_Handler()
 //----------------------------------------------------------------------
 bool SALOME_ModuleCatalog_Handler::startDocument()
 {
-  MESSAGE("Begin parse document")
+  if(MYDEBUG) MESSAGE("Begin parse document");
   // Empty the private elements
   _pathList.resize(0);
   _pathPrefix.listOfComputer.resize(0);
@@ -304,8 +312,8 @@ bool SALOME_ModuleCatalog_Handler::endElement(const QString&,
 
    //tag test_inParameter_name
    if ((qName.compare(test_inParameter_name)==0)) {
-     SCRUTE(parent);
-     SCRUTE(grandparent);
+     if(MYDEBUG) SCRUTE(parent);
+     if(MYDEBUG) SCRUTE(grandparent);
      if (grandparent.compare(test_inDataStreamParameter_list) == 0)
        _inDataStreamParam.name = content ;
      else 
@@ -324,7 +332,7 @@ bool SALOME_ModuleCatalog_Handler::endElement(const QString&,
     {
       if (parent.compare(test_inParameter_list)==0) {
        
-       MESSAGE("add inParameter : " << _inParam.name);
+       if(MYDEBUG) MESSAGE("add inParameter : " << _inParam.name);
        _inParamList.push_back(_inParam) ; 
        
        // Empty temporary structures
@@ -333,7 +341,7 @@ bool SALOME_ModuleCatalog_Handler::endElement(const QString&,
       }
       else if ((qName.compare(test_inDataStreamParameter)==0)) {
        
-       MESSAGE("add inDataStreamParameter : " << _inDataStreamParam.name);
+       if(MYDEBUG) MESSAGE("add inDataStreamParameter : " << _inDataStreamParam.name);
        _inDataStreamParamList.push_back(_inDataStreamParam) ; 
        
        // Empty temporary structures
@@ -347,7 +355,7 @@ bool SALOME_ModuleCatalog_Handler::endElement(const QString&,
    //tag test_inParameter_list
    if((qName.compare(test_inParameter_list)==0))
      {
-       SCRUTE(_inParamList.size());
+       if(MYDEBUG) SCRUTE(_inParamList.size());
        _aService.inParameters = _inParamList;
        _inParamList.resize(0);
        return true;
@@ -356,22 +364,23 @@ bool SALOME_ModuleCatalog_Handler::endElement(const QString&,
    //tag test_inDataStreamParameter_list
    if((qName.compare(test_inDataStreamParameter_list)==0))
      {
-       SCRUTE(_inDataStreamParamList.size());
+       if(MYDEBUG) SCRUTE(_inDataStreamParamList.size());
        _aService.inDataStreamParameters = _inDataStreamParamList;
        _inDataStreamParamList.resize(0);
      }
    //tag test_outDataStreamParameter_list
    if((qName.compare(test_outDataStreamParameter_list)==0))
      {
-       SCRUTE(_outDataStreamParamList.size());
+       if(MYDEBUG) SCRUTE(_outDataStreamParamList.size());
        _aService.outDataStreamParameters = _outDataStreamParamList;
        _outDataStreamParamList.resize(0);
        return true;
      }
 
 
+
    // Parameter out
-   SCRUTE(qName);
+   if(MYDEBUG) SCRUTE(qName);
 
    // tag test_outParameter_type
    if ((qName.compare(test_outParameter_type)==0)) {
@@ -402,8 +411,8 @@ bool SALOME_ModuleCatalog_Handler::endElement(const QString&,
         
    //tag test_outDataStreamParameter_name
    if ((qName.compare(test_outDataStreamParameter_name)==0)) {
-     SCRUTE(grandparent);
-     SCRUTE(test_outDataStreamParameter_list);
+     if(MYDEBUG) SCRUTE(grandparent);
+     if(MYDEBUG) SCRUTE(test_outDataStreamParameter_list);
      if (grandparent.compare(test_outDataStreamParameter_list) == 0)
        _outDataStreamParam.name = content ;
      else 
@@ -422,7 +431,7 @@ bool SALOME_ModuleCatalog_Handler::endElement(const QString&,
     {
       if (parent.compare(test_outParameter_list)==0) {
        
-       MESSAGE("add outParameter : " << _outParam.name);
+       if(MYDEBUG) MESSAGE("add outParameter : " << _outParam.name);
        _outParamList.push_back(_outParam) ; 
        
        // Empty temporary structures
@@ -431,7 +440,7 @@ bool SALOME_ModuleCatalog_Handler::endElement(const QString&,
       }
       else if ((qName.compare(test_outDataStreamParameter)==0)) {
        
-       MESSAGE("add outDataStreamParameter : " << _outDataStreamParam.name);
+       if(MYDEBUG) MESSAGE("add outDataStreamParameter : " << _outDataStreamParam.name);
        _outDataStreamParamList.push_back(_outDataStreamParam) ; 
        
        // Empty temporary structures
@@ -445,7 +454,7 @@ bool SALOME_ModuleCatalog_Handler::endElement(const QString&,
    //tag test_outParameter_list
    if((qName.compare(test_outParameter_list)==0))
      {
-       SCRUTE(_outParamList.size());
+       if(MYDEBUG) SCRUTE(_outParamList.size());
        _aService.outParameters = _outParamList;
        _outParamList.resize(0);
        return true;
@@ -525,24 +534,24 @@ bool SALOME_ModuleCatalog_Handler::endDocument()
 {
 //  ofstream f("/tmp/logs/xxx.log", std::ofstream::app);
 //  f << "---------------------------------------------------------" << std::endl;
-  BEGIN_OF("endDocument");
+  if(MYDEBUG) BEGIN_OF("endDocument");
   //_pathlist
   for (unsigned int ind = 0; ind < _pathList.size(); ind++)
     {
-      MESSAGE("Path :"<<_pathList[ind].path)
+      if(MYDEBUG) MESSAGE("Path :"<<_pathList[ind].path);
       for (unsigned int i = 0; i < _pathList[ind].listOfComputer.size(); i++)
-         MESSAGE("Computer name :" << _pathList[ind].listOfComputer[i])
+       if(MYDEBUG) MESSAGE("Computer name :" << _pathList[ind].listOfComputer[i]);
     }
 
    // _moduleList
-//  SCRUTE(_moduleList.size());
+//  if(MYDEBUG) SCRUTE(_moduleList.size());
 //  for (unsigned int ind = 0; ind < _moduleList.size(); ind++)
 //    {
 //      f << _moduleList[ind] << std::endl;
 //    }
 
-  MESSAGE("Document parsed");
-  END_OF("endDocument");
+  if(MYDEBUG) MESSAGE("Document parsed");
+  if(MYDEBUG) END_OF("endDocument");
   return true;
 }
  
index 3509d14232326a13360394d1be29140137056a8f..775966ae7b59f4969f2027c5422434b4cc938302 100644 (file)
@@ -29,7 +29,6 @@
 #ifndef SALOME_CATALOG_HANDLER_H
 #define SALOME_CATALOG_HANDLER_H
 
-#include "utilities.h"
 #include "SALOME_ModuleCatalog_Parser.hxx"
 #include <qxml.h>
 #include <string>
@@ -105,7 +104,7 @@ public:
 private:
   QString errorProt ;
 
-  string content;
+  std::string content;
 
   QString test_path_prefix_name ;
   QString test_computer_name ;
index 4864f32a451ca8acf5cc713840ae91c1e9e022c8..98ac7336ffb17ca417b84c825d544434d4bc0bb2 100644 (file)
 
 #include "SALOME_ModuleCatalog_Parser_IO.hxx"
 #include <string>
+#include <iostream>
 #include "utilities.h"
 
+using namespace std;
+
 std::ostream & operator<< (std::ostream & f, const ParserParameter & P)
 {
   f << "          name :       " << P.name << std::endl;
index 7ba1b29f9539881e57c8e1b65380afcdcdce7c0f..7018c1cacb2a7a5a04bc093864c428796133113d 100644 (file)
 #include <qfileinfo.h>
 using namespace std;
 
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
 static const char* SEPARATOR    = ":";
 
 //----------------------------------------------------------------------
@@ -43,7 +49,7 @@ static const char* SEPARATOR    = ":";
 //----------------------------------------------------------------------
 SALOME_ModuleCatalogImpl::SALOME_ModuleCatalogImpl(int argc, char** argv, CORBA::ORB_ptr orb) : _orb(orb)
 {
-  MESSAGE("Catalog creation");
+  if(MYDEBUG) MESSAGE("Catalog creation");
 
   // Conversion rules for component types
   ComponentTypeConvert[GEOM]
@@ -93,57 +99,56 @@ SALOME_ModuleCatalogImpl::SALOME_ModuleCatalogImpl(int argc, char** argv, CORBA:
 
   // Parse the arguments given at server run
   if (!_parseArguments(argc, argv,&_general_path,&_personal_path))
-    MESSAGE( "Error while argument parsing" );
+    if(MYDEBUG) MESSAGE( "Error while argument parsing" );
 
   // Test existency of files
-  if (_general_path == NULL)
-    MESSAGE( "Error the general catalog should be indicated" )
-  else
-    {
-      // Affect the _general_module_list and _general_path_list members
-      // with the common catalog
-      
-      QStringList dirList 
-       = QStringList::split( SEPARATOR, _general_path, 
-                             false ); // skip empty entries
-
-      for ( int i = 0; i < dirList.count(); i++ ) {
-       QFileInfo fileInfo( dirList[ i ] );
-       if ( fileInfo.isFile() && fileInfo.exists() ) {
-         _parse_xml_file(fileInfo.filePath(), 
-                         _general_module_list, 
-                         _general_path_list);
-       }
+  if (_general_path == NULL){
+    if(MYDEBUG) MESSAGE( "Error the general catalog should be indicated" );
+  }else{
+    // Affect the _general_module_list and _general_path_list members
+    // with the common catalog
+    
+    QStringList dirList 
+      = QStringList::split( SEPARATOR, _general_path, 
+                           false ); // skip empty entries
+    
+    for ( int i = 0; i < dirList.count(); i++ ) {
+      QFileInfo fileInfo( dirList[ i ] );
+      if ( fileInfo.isFile() && fileInfo.exists() ) {
+       _parse_xml_file(fileInfo.filePath(), 
+                       _general_module_list, 
+                       _general_path_list);
       }
-
-      // Verification of _general_path_list content
-      if(!_verify_path_prefix(_general_path_list))
-       MESSAGE( "Error while parsing the general path list, "
-                "differents paths are associated to the same computer," 
-                "the first one will be choosen")
-      else 
-       MESSAGE("General path list OK");
+    }
     
-      if(_personal_path != NULL)
-       {
-         // Initialize the _personal_module_list and 
-         // _personal_path_list members with the personal catalog files
-         _parse_xml_file(_personal_path,
-                         _personal_module_list, 
-                         _personal_path_list);
-         
-         // Verification of _general_path_list content
-         if(!_verify_path_prefix(_personal_path_list))
-           MESSAGE("Error while parsing the personal path list, "
-                   "differents paths are associated to the same computer, "
-                   "the first one will be choosen" )
-         else 
-           MESSAGE("Personal path list OK");
-       }
-      else 
-       MESSAGE("No personal catalog indicated or error while "
-               "opening the personal catalog");
+    // Verification of _general_path_list content
+    if(!_verify_path_prefix(_general_path_list)){
+      if(MYDEBUG) MESSAGE( "Error while parsing the general path list, "
+                          "differents paths are associated to the same computer," 
+                          "the first one will be choosen");
+    }else{
+      if(MYDEBUG) MESSAGE("General path list OK");
     }
+    
+    if(_personal_path != NULL){
+      // Initialize the _personal_module_list and 
+      // _personal_path_list members with the personal catalog files
+      _parse_xml_file(_personal_path,
+                     _personal_module_list, 
+                     _personal_path_list);
+      
+      // Verification of _general_path_list content
+      if(!_verify_path_prefix(_personal_path_list)){
+       if(MYDEBUG) MESSAGE("Error while parsing the personal path list, "
+                           "differents paths are associated to the same computer, "
+                           "the first one will be choosen" );
+      }else {
+       if(MYDEBUG) MESSAGE("Personal path list OK");
+      }
+    }else 
+      if(MYDEBUG) MESSAGE("No personal catalog indicated or error while "
+                         "opening the personal catalog");
+  }
 }
 
 //----------------------------------------------------------------------
@@ -152,7 +157,7 @@ SALOME_ModuleCatalogImpl::SALOME_ModuleCatalogImpl(int argc, char** argv, CORBA:
 //----------------------------------------------------------------------
 SALOME_ModuleCatalogImpl::~SALOME_ModuleCatalogImpl()
 {
-  MESSAGE("Catalog Destruction");
+  if(MYDEBUG) MESSAGE("Catalog Destruction");
 }
 
 
@@ -174,7 +179,7 @@ SALOME_ModuleCatalogImpl::GetComputerList()
 //----------------------------------------------------------------------
 char * 
 SALOME_ModuleCatalogImpl::GetPathPrefix(const char* machinename) {
-  MESSAGE("Begin of GetPathPrefix")
+  if(MYDEBUG) MESSAGE("Begin of GetPathPrefix");
   // Variables initialisation
   char* _path = NULL;
   bool _find = false ;
@@ -229,51 +234,47 @@ SALOME_ModuleCatalogImpl::GetPathPrefix(const char* machinename) {
 SALOME_ModuleCatalog::ListOfComponents* 
 SALOME_ModuleCatalogImpl::GetComponentList()
 {
-  MESSAGE("Begin of GetComponentList");
+  if(MYDEBUG) MESSAGE("Begin of GetComponentList");
   SALOME_ModuleCatalog::ListOfComponents_var _list_components = 
     new SALOME_ModuleCatalog::ListOfComponents;
 
   _list_components->length(_personal_module_list.size());
 
   // All the components defined in the personal catalog are taken
-  for (unsigned int ind=0; ind < _personal_module_list.size();ind++)
-    {
-       _list_components[ind]=(_personal_module_list[ind].name).c_str();
-       SCRUTE(_list_components[ind]) ;
-    }
+  for(unsigned int ind=0; ind < _personal_module_list.size();ind++){
+    _list_components[ind]=(_personal_module_list[ind].name).c_str();
+    if(MYDEBUG) SCRUTE(_list_components[ind]) ;
+  }
 
   int indice = _personal_module_list.size() ;
   bool _find = false;
   
   // The components in the general catalog are taken only if they're
   // not defined in the personal catalog
-  for (unsigned int ind=0; ind < _general_module_list.size();ind++)
-    {
-      _find = false;
-      for (unsigned int ind1=0; ind1 < _personal_module_list.size();ind1++)
-       {
-         // searching if the component is already defined in 
-         // the personal catalog
-         if ((_general_module_list[ind].name.compare(_personal_module_list[ind1].name)) == 0)
-           _find = true;
-       }
-      if (!_find)
-       {
-         MESSAGE("A new component " << _general_module_list[ind].name 
-                 << " has to be to added in the list");
-          _list_components->length(indice+1);
-         // The component is not already defined => has to be taken
-         _list_components[indice]=(_general_module_list[ind].name).c_str();   
-         SCRUTE(_list_components[indice]) ;
-
-         indice++;
-       }
-      else 
-       MESSAGE("The component " <<_general_module_list[ind].name 
-               << " was already defined in the personal catalog") ;
-     }
-
-  MESSAGE ( "End of GetComponentList" )
+  for(unsigned int ind=0; ind < _general_module_list.size();ind++){
+    _find = false;
+    for(unsigned int ind1=0; ind1 < _personal_module_list.size();ind1++){
+      // searching if the component is already defined in 
+      // the personal catalog
+      if ((_general_module_list[ind].name.compare(_personal_module_list[ind1].name)) == 0)
+       _find = true;
+    }
+    if(!_find){
+      if(MYDEBUG) MESSAGE("A new component " << _general_module_list[ind].name 
+                         << " has to be to added in the list");
+      _list_components->length(indice+1);
+      // The component is not already defined => has to be taken
+      _list_components[indice]=(_general_module_list[ind].name).c_str();   
+      if(MYDEBUG) SCRUTE(_list_components[indice]) ;
+      
+      indice++;
+    }else{
+      if(MYDEBUG) MESSAGE("The component " <<_general_module_list[ind].name 
+                         << " was already defined in the personal catalog") ;
+    }
+  }
+  
+  if(MYDEBUG) MESSAGE ( "End of GetComponentList" );
   return _list_components._retn();
 }
 
@@ -288,7 +289,7 @@ SALOME_ModuleCatalogImpl::GetComponentList()
 SALOME_ModuleCatalog::ListOfIAPP_Affich* 
 SALOME_ModuleCatalogImpl::GetComponentIconeList()
 {
-  MESSAGE("Begin of GetComponentIconeList");
+  if(MYDEBUG) MESSAGE("Begin of GetComponentIconeList");
 
   SALOME_ModuleCatalog::ListOfIAPP_Affich_var _list_components_icone = 
     new SALOME_ModuleCatalog::ListOfIAPP_Affich;
@@ -296,47 +297,43 @@ SALOME_ModuleCatalogImpl::GetComponentIconeList()
   _list_components_icone->length(_personal_module_list.size());
 
   // All the components defined in the personal catalog are taken
-  for (unsigned int ind=0; ind < _personal_module_list.size();ind++)
-    {
-       _list_components_icone[ind].modulename=(_personal_module_list[ind].name).c_str();
-       _list_components_icone[ind].moduleusername=(_personal_module_list[ind].username).c_str();
-       _list_components_icone[ind].moduleicone=(_personal_module_list[ind].icon).c_str();
-       //SCRUTE(_list_components_icone[ind].modulename); 
-       //SCRUTE(_list_components_icone[ind].moduleicone);
-    }
-
+  for(unsigned int ind=0; ind < _personal_module_list.size();ind++){
+    _list_components_icone[ind].modulename=(_personal_module_list[ind].name).c_str();
+    _list_components_icone[ind].moduleusername=(_personal_module_list[ind].username).c_str();
+    _list_components_icone[ind].moduleicone=(_personal_module_list[ind].icon).c_str();
+    //if(MYDEBUG) SCRUTE(_list_components_icone[ind].modulename); 
+    //if(MYDEBUG) SCRUTE(_list_components_icone[ind].moduleicone);
+  }
+  
   int indice = _personal_module_list.size() ;
   bool _find = false;
   
   // The components in the general catalog are taken only if they're
   // not defined in the personal catalog
-  for (unsigned int ind=0; ind < _general_module_list.size();ind++)
-    {
-      _find = false;
-      for (unsigned int ind1=0; ind1 < _personal_module_list.size();ind1++)
-       {
-         // searching if the component is aleready defined in 
-         // the personal catalog
-         if ((_general_module_list[ind].name.compare(_personal_module_list[ind1].name)) == 0)
-           _find = true;
-       }
-      if (!_find)
-       {
-         //      MESSAGE("A new component " << _general_module_list[ind].name << " has to be to added in the list");
-          _list_components_icone->length(indice+1);
-         // The component is not already defined => has to be taken
-         _list_components_icone[indice].modulename=_general_module_list[ind].name.c_str();  
-         _list_components_icone[indice].moduleusername=_general_module_list[ind].username.c_str();  
-         _list_components_icone[indice].moduleicone=_general_module_list[ind].icon.c_str(); 
-         //SCRUTE(_list_components_icone[indice].modulename) ;
-         //SCRUTE(_list_components_icone[indice].moduleicone);
-
-         indice++;
-       }
-      // else 
-       //MESSAGE("The component " <<_general_module_list[ind].name << " was already defined in the personal catalog"); 
-     }
-
+  for(unsigned int ind=0; ind < _general_module_list.size();ind++){
+    _find = false;
+    for(unsigned int ind1=0; ind1 < _personal_module_list.size();ind1++){
+      // searching if the component is aleready defined in 
+      // the personal catalog
+      if((_general_module_list[ind].name.compare(_personal_module_list[ind1].name)) == 0)
+       _find = true;
+    }
+    if(!_find){
+      //         if(MYDEBUG) MESSAGE("A new component " << _general_module_list[ind].name << " has to be to added in the list");
+      _list_components_icone->length(indice+1);
+      // The component is not already defined => has to be taken
+      _list_components_icone[indice].modulename=_general_module_list[ind].name.c_str();  
+      _list_components_icone[indice].moduleusername=_general_module_list[ind].username.c_str();  
+      _list_components_icone[indice].moduleicone=_general_module_list[ind].icon.c_str(); 
+      //if(MYDEBUG) SCRUTE(_list_components_icone[indice].modulename) ;
+      //if(MYDEBUG) SCRUTE(_list_components_icone[indice].moduleicone);
+      
+      indice++;
+    }
+    // else 
+    //if(MYDEBUG) MESSAGE("The component " <<_general_module_list[ind].name << " was already defined in the personal catalog"); 
+  }
+  
   return _list_components_icone._retn() ;
 }
 
@@ -350,7 +347,7 @@ SALOME_ModuleCatalogImpl::GetComponentIconeList()
 SALOME_ModuleCatalog::ListOfComponents* 
 SALOME_ModuleCatalogImpl::GetTypedComponentList(SALOME_ModuleCatalog::ComponentType component_type)
 {
-  MESSAGE("Begin of GetTypedComponentList");
+  if(MYDEBUG) MESSAGE("Begin of GetTypedComponentList");
   SALOME_ModuleCatalog::ListOfComponents_var _list_typed_component = 
     new SALOME_ModuleCatalog::ListOfComponents;
   int _j = 0;
@@ -392,7 +389,7 @@ SALOME_ModuleCatalogImpl::GetTypedComponentList(SALOME_ModuleCatalog::ComponentT
        {
          _list_typed_component->length(_j + 1); 
          _list_typed_component[_j] = (_moduleList[ind].name).c_str();
-         //SCRUTE(_list_typed_component[_j])
+         //if(MYDEBUG) SCRUTE(_list_typed_component[_j]);
          _j++;
        }
     }
@@ -417,16 +414,16 @@ SALOME_ModuleCatalogImpl::GetTypedComponentList(SALOME_ModuleCatalog::ComponentT
            }
          if (!_find)
            {
-             //MESSAGE("A new component " << _general_module_list[ind].name << " has to be to added in the list");
+             //if(MYDEBUG) MESSAGE("A new component " << _general_module_list[ind].name << " has to be to added in the list");
               _list_typed_component->length(indice+1);
              // The component is not already defined => has to be taken
              _list_typed_component[indice]=(_general_module_list[ind].name).c_str();   
-             //SCRUTE(_list_typed_component[indice]) ;
+             //if(MYDEBUG) SCRUTE(_list_typed_component[indice]) ;
 
              indice++;
            }
          //else 
-           //MESSAGE("The component " <<_general_module_list[ind].name << " was already defined in the personal catalog") ;
+           //if(MYDEBUG) MESSAGE("The component " <<_general_module_list[ind].name << " was already defined in the personal catalog") ;
         }
     }
 
@@ -474,8 +471,8 @@ SALOME_ModuleCatalogImpl::GetComponent(const char* name)
   else {
     // Not found in the personal catalog and in the general catalog
     // return NULL object
-    MESSAGE("Component with name  " << name 
-           << " not found in catalog");
+    if(MYDEBUG) MESSAGE("Component with name  " << name 
+                       << " not found in catalog");
     compo = NULL;
   }
   
@@ -509,8 +506,8 @@ SALOME_ModuleCatalogImpl::findComponent(const string & name)
     for (unsigned int ind=0; ind < _personal_module_list.size();ind++)
       if (name.compare(_personal_module_list[ind].name) == 0)
         {
-          MESSAGE("Component named " << name 
-                 << " found in the personal catalog");
+          if(MYDEBUG) MESSAGE("Component named " << name 
+                             << " found in the personal catalog");
          C_parser = &(_personal_module_list[ind]);
          break;
        }
@@ -520,8 +517,8 @@ SALOME_ModuleCatalogImpl::findComponent(const string & name)
       {
        if (name.compare(_general_module_list[ind].name) == 0)
          {
-           MESSAGE("Component named " << name 
-                   << " found in the general catalog");
+           if(MYDEBUG) MESSAGE("Component named " << name 
+                               << " found in the general catalog");
            C_parser = &(_general_module_list[ind]);
            break;
          }
@@ -539,8 +536,8 @@ SALOME_ModuleCatalogImpl::_parse_xml_file(const char* file,
                                          ParserComponents& modulelist, 
                                          ParserPathPrefixes& pathList)
 {
-  BEGIN_OF("_parse_xml_file");
-  SCRUTE(file);
+  if(MYDEBUG) BEGIN_OF("_parse_xml_file");
+  if(MYDEBUG) SCRUTE(file);
 
   SALOME_ModuleCatalog_Handler* handler = new SALOME_ModuleCatalog_Handler();
   QFile xmlFile(file);
@@ -622,7 +619,7 @@ void SALOME_ModuleCatalogImpl::duplicate
   
   // duplicate service list
   unsigned int _length = I_parser.services.size();
-  SCRUTE(_length);
+  if(MYDEBUG) SCRUTE(_length);
   //  I_corba.interfaceservicelist 
   //  = new SALOME_ModuleCatalog::ListOfInterfaceService;
   I_corba.interfaceservicelist.length(_length);
@@ -676,7 +673,7 @@ void SALOME_ModuleCatalogImpl::duplicate
   
   // duplicate out DataStreamParameters
   _length = S_parser.outDataStreamParameters.size();
-  SCRUTE(_length);
+  if(MYDEBUG) SCRUTE(_length);
   S_corba.ServiceoutDataStreamParameter.length(_length);
   
   for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++)
@@ -723,7 +720,7 @@ void SALOME_ModuleCatalogImpl::duplicate
   //     = (it_type == DataStreamTypeConvert.end()) 
   //     ? it_type->second : SALOME_ModuleCatalog::DATASTREAM_UNKNOWN;
 
-  SCRUTE(P_parser.type);
+  if(MYDEBUG) SCRUTE(P_parser.type);
   P_corba.Parametertype = SALOME_ModuleCatalog::DATASTREAM_UNKNOWN;
   for (it_type = DataStreamTypeConvert.begin(); 
        it_type != DataStreamTypeConvert.end(); 
@@ -732,7 +729,7 @@ void SALOME_ModuleCatalogImpl::duplicate
       P_corba.Parametertype = it_type->second;
       break;
     }
-  SCRUTE(P_corba.Parametertype);
+  if(MYDEBUG) SCRUTE(P_corba.Parametertype);
 
   // duplicate parameter type
 
@@ -742,7 +739,7 @@ void SALOME_ModuleCatalogImpl::duplicate
   //     = (it_type == DataStreamTypeConvert.end()) 
   //     ? it_type->second : SALOME_ModuleCatalog::DATASTREAM_UNKNOWN;
   
-  SCRUTE(P_parser.dependency);
+  if(MYDEBUG) SCRUTE(P_parser.dependency);
   P_corba.Parameterdependency = SALOME_ModuleCatalog::DATASTREAM_UNDEFINED;
   for (it_dep = DataStreamDepConvert.begin(); 
        it_dep != DataStreamDepConvert.end(); 
@@ -752,7 +749,7 @@ void SALOME_ModuleCatalogImpl::duplicate
       break;
     }
 
-  SCRUTE(P_corba.Parameterdependency);
+  if(MYDEBUG) SCRUTE(P_corba.Parameterdependency);
 }
 
 //----------------------------------------------------------------------
@@ -795,7 +792,7 @@ SALOME_ModuleCatalogImpl::_verify_path_prefix(ParserPathPrefixes & pathList)
        {
         if(_machine_list[ind].compare(_machine_list[ind1]) == 0)
           {
-            MESSAGE( "The computer " << _machine_list[ind] << " is indicated more than once in the path list")
+            if(MYDEBUG) MESSAGE( "The computer " << _machine_list[ind] << " is indicated more than once in the path list");
             _return_value = false; 
           }
        }
index a878c2f495d3cf0e2206fa858d3b4be8b6eef5e1..71209115140ec966680c191caa6fa9636bcee353 100644 (file)
@@ -123,7 +123,7 @@ private:
     \param name  string argument
     \return pointer on a component, NULL if not found
   */
-  ParserComponent *findComponent(const string & name);
+  ParserComponent *findComponent(const std::string & name);
 
   //! method to create a CORBA component description from parser
   /*!
index 6fe58e93c9f4aaae868976edb10da92ae7409646..07b0e93423de3be5914a2aa34133d8f965a79dae 100644 (file)
 //  Module : SALOME
 //  $Header$
 
-using namespace std;
 #include "SALOME_NamingService.hxx"
 #include "ServiceUnreachable.hxx"
+
+#include "utilities.h"
+
 #include <iostream>
 #include <cstring>
 
+using namespace std;
+
 //----------------------------------------------------------------------
 /*! Function : SALOME_NamingService
  *  Purpose  : Constructor and Initialisation of _root_context
index cd4683155d47e5370eee6b0702dc21a64ec21672..4504e6ec7bdd71d58d59a3a446d7e0757d791a7e 100644 (file)
@@ -82,7 +82,7 @@ public:
 
   //!method to get all the contexts contained in the current direcotry
   // Get only objects, isn't iterative
-  vector<string> list_directory()
+  std::vector<std::string> list_directory()
     throw(ServiceUnreachable);
  
   //! method to destroy an association Path-Object Reference
index 809d328eca5e8f4e3899f0b603229a6b357b4246..f7bc0d67dc7be5b5cf9c5d09430cde16f74da6eb 100644 (file)
@@ -109,13 +109,13 @@ bool NOTIFICATION_Consumer::Receive(char** graph, char** node, char** type, char
             event->filterable_data[5].value >>= Anode;
             event->filterable_data[6].value >>= Astamp;
             event->remainder_of_body        >>= Amessage;
-            *graph   = strdup(Agraph);
-            *node    = strdup(Anode);
-            *type    = strdup(Atype);
-            *message = strdup(Amessage);
-            *sender  = strdup(Asender);
+            *graph   = CORBA::string_dup(Agraph);
+            *node    = CORBA::string_dup(Anode);
+            *type    = CORBA::string_dup(Atype);
+            *message = CORBA::string_dup(Amessage);
+            *sender  = CORBA::string_dup(Asender);
             *counter = (long)Acounter;
-            *date    = strdup(Adate);
+            *date    = CORBA::string_dup(Adate);
             *stamp   = (long)Astamp;
         };
     };
index d15092cab254769df7030e6a828c67c070bbaa65..6d1a55859bbbef3d35d9151e3fbe2e08a7251bcc 100644 (file)
@@ -14,8 +14,6 @@ EXPORT_HEADERS = SALOME_InteractiveObject.hxx \
                 Handle_SALOME_AISShape.hxx \
                 SALOME_AISObject.hxx \
                 Handle_SALOME_AISObject.hxx \
-                VTKViewer_Common.h
-
 
 # Libraries targets
 
@@ -23,7 +21,7 @@ LIB = libSalomeObject.la
 LIB_SRC =       SALOME_InteractiveObject.cxx \
                 SALOME_Actor.cxx \
                 SALOME_AISShape.cxx\
-                SALOME_AISObject.cxx
+                SALOME_AISObject.cxx\
 
 LIB_CLIENT_IDL = 
 
index 137e0d9b9e0bd1e289cc05196e897da769c62993..6cc5077df087b5e87b15801bd31a559a284284b7 100644 (file)
@@ -48,6 +48,7 @@
 #endif
 class SALOME_InteractiveObject;
 class TopoDS_Shape;
+class TColStd_IndexedMapOfInteger;
 
 
 class SALOME_AISShape : public AIS_Shape {
@@ -77,6 +78,7 @@ 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();
 
 
index 43a88b90175110f0b4bf4a7faedd8b3a95688ebb..b2040b2a3ef5f4c16fbdd48edffb0bdd307f0278 100644 (file)
@@ -41,6 +41,9 @@
 #include "utilities.h"
 
 // VTK Includes
+#include <vtkCell.h>
+#include <vtkRenderer.h>
+#include <vtkPolyData.h>
 #include <vtkObjectFactory.h>
 #include <vtkDataSetMapper.h>
 #include <vtkPolyDataMapper.h>
@@ -60,14 +63,20 @@ vtkStandardNewMacro(SALOME_Actor);
 
 
 SALOME_Actor::SALOME_Actor(){
-  PreviewProperty = NULL;
-  ispreselected = Standard_False;
-  myProperty = vtkProperty::New();
+  myIsHighlighted = myIsPreselected = false;
 
-  myRepresentation = 2;
+  myRepresentation = 1;
+  myDisplayMode = myRepresentation - 1;
+
+  myProperty = vtkProperty::New();
+  PreviewProperty = NULL;
 
   myIsInfinite = false;
 
+  myIsResolveCoincidentTopology = true;
+
+  vtkMapper::GetResolveCoincidentTopologyPolygonOffsetParameters(myPolygonOffsetFactor,
+                                                                myPolygonOffsetUnits);
   myStoreMapping = false;
   myGeomFilter = SALOME_GeometryFilter::New();
 
@@ -111,73 +120,79 @@ 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;
-#if defined __GNUC_2__
-    myPassFilter[anId]->SetInput(theMapper->GetInput());
-#else
-    myPassFilter.at(anId)->SetInput(theMapper->GetInput());
-#endif
-    myGeomFilter->SetStoreMapping(myStoreMapping);
-#if defined __GNUC_2__
-    myGeomFilter->SetInput(myPassFilter[anId]->GetOutput());
-#else
-    myGeomFilter->SetInput(myPassFilter.at(anId)->GetOutput());
-#endif
-
-    anId++;
-
-#if defined __GNUC_2__
-    myPassFilter[anId]->SetInput(myGeomFilter->GetOutput());
-    myPassFilter[anId+1]->SetInput(myPassFilter[anId]->GetOutput());
-#else
-    myPassFilter.at(anId)->SetInput(myGeomFilter->GetOutput());
-    myPassFilter.at(anId+1)->SetInput(myPassFilter.at(anId)->GetOutput());
-#endif
+    myPassFilter[ anId ]->SetInput( theMapper->GetInput() );
+    myPassFilter[ anId + 1]->SetInput( myPassFilter[ anId ]->GetOutput() );
+    
+    anId++; // 1
+    myGeomFilter->SetStoreMapping( myStoreMapping );
+    myGeomFilter->SetInput( myPassFilter[ anId ]->GetOutput() );
 
-    anId++;
-#if defined __GNUC_2__
-    myPassFilter[anId+1]->SetInput(myPassFilter[anId]->GetOutput());
-#else
-    myPassFilter.at(anId+1)->SetInput(myPassFilter.at(anId)->GetOutput());
-#endif
+    anId++; // 2
+    myPassFilter[ anId ]->SetInput( myGeomFilter->GetOutput() ); 
+    myPassFilter[ anId + 1 ]->SetInput( myPassFilter[ anId ]->GetOutput() );
 
-    anId++;
-#if defined __GNUC_2__
-    myTransformFilter->SetInput(myPassFilter[anId]->GetPolyDataOutput());
-#else
-    myTransformFilter->SetInput(myPassFilter.at(anId)->GetPolyDataOutput());
-#endif
+    anId++; // 3
+    myTransformFilter->SetInput( myPassFilter[ anId ]->GetPolyDataOutput() );
 
-    anId++;
-#if defined __GNUC_2__
-    myPassFilter[anId]->SetInput(myTransformFilter->GetOutput());
-    myPassFilter[anId+1]->SetInput(myPassFilter[anId]->GetOutput());
-#else
-    myPassFilter.at(anId)->SetInput(myTransformFilter->GetOutput());
-    myPassFilter.at(anId+1)->SetInput(myPassFilter.at(anId)->GetOutput());
-#endif
+    anId++; // 4
+    myPassFilter[ anId ]->SetInput( myTransformFilter->GetOutput() );
+    myPassFilter[ anId + 1 ]->SetInput( myPassFilter[ anId ]->GetOutput() );
 
-    anId++;
-    if(vtkDataSetMapper* aMapper = dynamic_cast<vtkDataSetMapper*>(theMapper))
-#if defined __GNUC_2__
+    anId++; // 5
+    if(vtkDataSetMapper* aMapper = dynamic_cast<vtkDataSetMapper*>(theMapper)){
       aMapper->SetInput(myPassFilter[anId]->GetOutput());
-#else
-      aMapper->SetInput(myPassFilter.at(anId)->GetOutput());
-#endif
-    else if(vtkPolyDataMapper* aMapper = dynamic_cast<vtkPolyDataMapper*>(theMapper))
-#if defined __GNUC_2__
+    }else if(vtkPolyDataMapper* aMapper = dynamic_cast<vtkPolyDataMapper*>(theMapper)){
       aMapper->SetInput(myPassFilter[anId]->GetPolyDataOutput());
-#else
-      aMapper->SetInput(myPassFilter.at(anId)->GetPolyDataOutput());
-#endif
+    }
   }
   vtkLODActor::SetMapper(theMapper);
 }
 
-vtkPolyData* SALOME_Actor::GetPolyDataInput(){
-  return myPassFilter.back()->GetPolyDataOutput();
+
+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();
 }
 
 
@@ -195,17 +210,16 @@ unsigned long int SALOME_Actor::GetMTime(){
 
 void SALOME_Actor::SetRepresentation(int theMode) { 
   switch(myRepresentation){
-  case 0 : 
-  case 2 : 
+  case VTK_POINTS : 
+  case VTK_SURFACE : 
     myProperty->DeepCopy(GetProperty());
   }    
   switch(theMode){
-  case 0 : 
-  case 2 : 
+  case VTK_POINTS : 
+  case VTK_SURFACE : 
     GetProperty()->DeepCopy(myProperty);
     break;
   default:
-    break;
     GetProperty()->SetAmbient(1.0);
     GetProperty()->SetDiffuse(0.0);
     GetProperty()->SetSpecular(0.0);
@@ -215,7 +229,7 @@ void SALOME_Actor::SetRepresentation(int theMode) {
     myGeomFilter->SetInside(true);
     GetProperty()->SetRepresentation(1);
     break;
-  case 0 : 
+  case VTK_POINTS : 
     GetProperty()->SetPointSize(SALOME_POINT_SIZE);  
   default :
     GetProperty()->SetRepresentation(theMode);
@@ -228,6 +242,17 @@ 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.
@@ -235,41 +260,45 @@ int SALOME_Actor::GetRepresentation(){
 //=================================================================================
 int SALOME_Actor::GetObjDimension( const int theObjId )
 {
-  if ( theObjId < 0 )
-    return 0;
-    
-  std::vector<int> aVtkList = GetVtkId( theObjId );
-  int nbVtk = aVtkList.size();
-  
-  if ( nbVtk == 0 )
-    return 0;
-  else if ( nbVtk > 1 )
-    return 3;
-  else //  nbVtk = 1
-  {
-    if ( vtkDataSet* aGrid = GetMapper()->GetInput() )
-    {
-      if ( vtkCell* aCell = aGrid->GetCell( aVtkList.front() ) )
-        return aCell->GetCellDimension();
-    }
-  }
+  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;
+}
index 08a15bd4e17394cf44d8a34a0d420083d6dd0e1f..6b57f9ca81cd125459e701441a826a78a490fabb 100644 (file)
 #ifndef SALOME_ACTOR_H
 #define SALOME_ACTOR_H
 
-// SALOME Includes
-#include "VTKViewer_Common.h"
-#include "SALOME_InteractiveObject.hxx"
-
 #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;
@@ -43,42 +49,39 @@ class SALOME_PassThroughFilter;
 extern int SALOME_POINT_SIZE;
 
 class SALOME_Actor : public vtkLODActor{
- protected:
-  //constructor should be protected due to first implementation of this class
-  //it was abstract class
-  SALOME_Actor();
-  ~SALOME_Actor();
  public:
   static SALOME_Actor* New();
 
   vtkTypeMacro(SALOME_Actor,vtkLODActor);
 
   virtual Standard_Boolean hasIO() { return !myIO.IsNull(); }
-  virtual Handle_SALOME_InteractiveObject getIO() { return myIO; } 
+  virtual const Handle(SALOME_InteractiveObject)& getIO() { return myIO; } 
   virtual void setIO(const Handle(SALOME_InteractiveObject)& io) { myIO = io; }
 
-  virtual Standard_CString getName()     { return myName; }
-  virtual void setName(Standard_CString aName){
-    myName = aName;
-    if(hasIO())        myIO->setName(aName);
+  virtual const char* getName() { return myName.c_str(); }
+  virtual void setName(const char* theName){
+    if(hasIO())        myIO->setName(theName);
+    myName = theName;
   }
 
-  virtual int getDisplayMode() { return myDisplayMode; }
-  virtual void setDisplayMode(int mode) { myDisplayMode = mode; }
-
-  virtual bool hasHighlight() { return false; }  
-  virtual void highlight(Standard_Boolean highlight) { ishighlighted = highlight; }  
-  virtual Standard_Boolean isHighlighted() { return ishighlighted; }
+  // 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 opa) { m_opacity = opa; }
-  virtual float GetOpacity() { return m_opacity; }
+  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) {};
+  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(Standard_Boolean presel = Standard_False)   { ispreselected = presel; }
+  virtual void SetPreSelected(bool thePreselect = false) { myIsPreselected = thePreselect;}
+
 
   // Used to obtain all dependent actors
   virtual void GetChildActors(vtkActorCollection*) {};
@@ -86,14 +89,19 @@ class SALOME_Actor : public vtkLODActor{
   virtual void AddToRender(vtkRenderer* theRenderer); 
   virtual void RemoveFromRender(vtkRenderer* theRenderer);
 
-  typedef std::vector<int> TVectorId;
-  virtual int GetObjId(int theVtkID) { return -1;}
-  virtual TVectorId GetVtkId(int theObjID) { return TVectorId();}
+
+  // 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 vtkPolyData* GetPolyDataInput(); 
+  virtual vtkDataSet* GetInput(); 
+
 
   virtual void SetTransform(SALOME_Transform* theTransform); 
   virtual unsigned long int GetMTime();
@@ -101,19 +109,46 @@ class SALOME_Actor : public vtkLODActor{
   virtual void SetRepresentation(int theMode);
   virtual int GetRepresentation();
 
-  // Infinitive means actor without size (point for example
+  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
-  virtual bool IsInfinitive() { return myIsInfinite; }
+  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:
-  vtkProperty         *PreviewProperty;
-  Standard_Boolean    ispreselected;
+  bool myIsResolveCoincidentTopology;
+  float myPolygonOffsetFactor;
+  float myPolygonOffsetUnits;
 
   Handle(SALOME_InteractiveObject) myIO;
-  Standard_CString myName;
+  std::string myName;
 
-  float   m_opacity;
-  Standard_Boolean    ishighlighted;
+  vtkProperty *PreviewProperty;
+  bool myIsPreselected;
+
+  float myOpacity;
+  bool myIsHighlighted;
   int myDisplayMode;
   bool myIsInfinite;
 
@@ -124,6 +159,13 @@ class SALOME_Actor : public vtkLODActor{
 
   int myRepresentation;
   vtkProperty *myProperty;
+
+  void InitPipeLine(vtkMapper* theMapper); 
+
+  SALOME_Actor();
+  ~SALOME_Actor();
 };
 
+
 #endif // SALOME_ACTOR_H
+
index 36a977af643c4f24f0f3435dac86f915884c30db..4f07e3b88cbf04dd5b186b4a667659ff0598712a 100644 (file)
@@ -42,65 +42,54 @@ SALOME_InteractiveObject::SALOME_InteractiveObject()
   myReference = "";
 }
 
-SALOME_InteractiveObject::SALOME_InteractiveObject(const Standard_CString anEntry, 
-                                                  const Standard_CString aComponentDataType,
-                                                  const Standard_CString aName)
-{
-  myEntry = new char [strlen(anEntry)+1];
-  strcpy( myEntry, anEntry);
-
-  myName = new char [strlen(aName)+1];
-  strcpy( myName, aName);
-
-  myComponentDataType = new char [strlen(aComponentDataType)+1];
-  strcpy( myComponentDataType, aComponentDataType);
-
-  myReference = new char [strlen("")+1];
-  strcpy( myReference, "");
-}
-
-void SALOME_InteractiveObject::setEntry(const Standard_CString anEntry){
-  myEntry = new char [strlen(anEntry)+1];
-  strcpy( myEntry, anEntry);
+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;
 }
 
-Standard_CString SALOME_InteractiveObject::getEntry(){
-  return myEntry;
+const char* SALOME_InteractiveObject::getEntry(){
+  return myEntry.c_str();
 }
 
-void SALOME_InteractiveObject::setComponentDataType(const Standard_CString aComponentDataType){
-  myComponentDataType = new char [strlen(aComponentDataType)+1];
-  strcpy( myComponentDataType, aComponentDataType);
+void SALOME_InteractiveObject::setComponentDataType(const char* aComponentDataType){
+  myComponentDataType = aComponentDataType; 
 }
 
-Standard_CString SALOME_InteractiveObject::getComponentDataType(){
-  return myComponentDataType;
+const char* SALOME_InteractiveObject::getComponentDataType(){
+  return myComponentDataType.c_str();
 }
 
-void SALOME_InteractiveObject::setName(const Standard_CString aName){
-  myName = new char [strlen(aName)+1];
-  strcpy( myName, aName);
+void SALOME_InteractiveObject::setName(const char* aName){
+  myName = aName;
 }
 
-Standard_CString SALOME_InteractiveObject::getName(){
-  return myName;
+const char* SALOME_InteractiveObject::getName(){
+  return myName.c_str();
 }
 
 Standard_Boolean SALOME_InteractiveObject::hasEntry(){
-  return !( strcmp(myEntry, "" ) == 0 );
+  return myEntry != "";
 }
 
 Standard_Boolean SALOME_InteractiveObject::isSame(const Handle(SALOME_InteractiveObject)& anIO ){
   if ( anIO->hasEntry() && this->hasEntry() ) {
-    if ( strcmp(myEntry, anIO->getEntry() ) == 0 )
+    if ( myEntry == anIO->getEntry() )
       return Standard_True;
   }
   
   return Standard_False;
 }
 
-Standard_Boolean SALOME_InteractiveObject::isComponentType(const Standard_CString ComponentDataType){
-  if ( strcmp( myComponentDataType, ComponentDataType) == 0 )
+Standard_Boolean SALOME_InteractiveObject::isComponentType(const char* ComponentDataType){
+  if ( myComponentDataType == ComponentDataType )
     return Standard_True;
   else
     return Standard_False;
@@ -108,16 +97,15 @@ Standard_Boolean SALOME_InteractiveObject::isComponentType(const Standard_CStrin
 
 Standard_Boolean SALOME_InteractiveObject::hasReference()
 {
-  return !( strcmp(myReference, "" ) == 0 );
+  return myReference != "";
 }
 
-Standard_CString SALOME_InteractiveObject::getReference()
+const char* SALOME_InteractiveObject::getReference()
 {
-  return myReference;
+  return myReference.c_str();
 }
 
-void SALOME_InteractiveObject::setReference(const Standard_CString aReference)
+void SALOME_InteractiveObject::setReference(const char* aReference)
 {
-  myReference = new char [strlen(aReference)+1];
-  strcpy( myReference, aReference);
+  myReference = aReference;
 }
index 4c22120c31de15e1054e8d74ccb602d51f8336af..91d1e5af221cab18ef1213368ddb3b081e55fb91 100644 (file)
@@ -44,6 +44,7 @@
 #include <Standard_Boolean.hxx>
 #endif
 
+#include <string>
 
 class SALOME_InteractiveObject : public MMgt_TShared {
 
@@ -64,25 +65,31 @@ public:
  // Methods PUBLIC
  // 
 Standard_EXPORT   SALOME_InteractiveObject();
-Standard_EXPORT   SALOME_InteractiveObject(const Standard_CString anEntry, 
-                                          const Standard_CString aComponentDataType,
-                                          const Standard_CString aName = "");
-Standard_EXPORT   void setEntry(const Standard_CString anEntry) ;
-Standard_EXPORT   Standard_CString getEntry() ;
-Standard_EXPORT   void setName(const Standard_CString aName) ;
-Standard_EXPORT   Standard_CString getName() ;
+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   Standard_CString getReference() ;
-Standard_EXPORT   void setReference(const Standard_CString aReference) ;
+Standard_EXPORT   const char* getReference() ;
+Standard_EXPORT   void setReference(const char* aReference) ;
 
-Standard_EXPORT   void setComponentDataType(const Standard_CString ComponentDataType) ;
-Standard_EXPORT   Standard_CString getComponentDataType() ;
-Standard_EXPORT   Standard_Boolean isComponentType(const Standard_CString ComponentDataType) ;
+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 ); }
 
-Standard_EXPORT   ~SALOME_InteractiveObject();
 
 
 
@@ -101,10 +108,10 @@ protected:
 
  // Fields PROTECTED
  //
-Standard_CString myReference;
-Standard_CString myEntry;
-Standard_CString myName;
-Standard_CString myComponentDataType;
+  std::string myReference;
+  std::string myEntry;
+  std::string myName;
+  std::string myComponentDataType;
 
 private: 
 
diff --git a/src/OBJECT/VTKViewer_Common.h b/src/OBJECT/VTKViewer_Common.h
deleted file mode 100755 (executable)
index 6f6eb4b..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-//  File      : VTKViewer_Common.h
-//  Created   : Wed May 21 11:36:07 2003
-//  Author    : Michael PONIKAROV
-//  Project   : SALOME
-//  Module    : VTKViewer
-//  Copyright : Open CASCADE 2002
-//  $Header$
-
-#ifndef __VTKViewer_Common_h
-#define __VTKViewer_Common_h
-
-// common vtk include files
-#include <vtkLODActor.h>
-#include <vtkProperty.h>
-#include <vtkTexture.h>
-#include <vtkMapper.h>
-#include <vtkObjectFactory.h>
-#include <vtkPolyDataMapper.h>
-#include <vtkPolyDataNormals.h>
-#include <vtkMath.h>
-#include <vtkPolyData.h>
-#include <vtkTransform.h>
-#include <vtkRenderer.h>
-#include <vtkMatrix4x4.h>
-#include <vtkCamera.h>
-#include <vtkCell.h>
-#include <vtkCommand.h>
-#include <vtkAssemblyNode.h>
-#include <vtkPicker.h>
-#include <vtkPointPicker.h>
-#include <vtkCellPicker.h>
-#include <vtkLine.h> 
-#include <vtkUnstructuredGrid.h> 
-#include <vtkExtractEdges.h>
-#include <vtkDataSetCollection.h>
-#include <vtkRenderWindowInteractor.h>
-#include <vtkVolumeMapper.h>
-#include <vtkWarpTransform.h>
-#include <vtkVersion.h>
-#include <vtkTextSource.h>
-#include <vtkConeSource.h>
-#include <vtkTextMapper.h>
-#include <vtkMapper2D.h>
-#include <vtkActor2D.h>
-#include <vtkWindowToImageFilter.h>
-#include <vtkTIFFWriter.h>
-#include <vtkCellArray.h>
-#include <vtkTransformPolyDataFilter.h>
-#include <vtkDataSetMapper.h> 
-#include <vtkAxes.h>
-#include <vtkActor.h>
-#include <vtkInteractorStyle.h>
-#include <vtkActor2DCollection.h>
-//#include <vtkScalarBarActor.h>
-#include <vtkShrinkFilter.h>
-#include <vtkMaskPoints.h>
-#include <vtkCellCenters.h>
-#include <vtkSelectVisiblePoints.h>
-#include <vtkPointData.h>
-#include <vtkLabeledDataMapper.h>
-#include <vtkProperty2D.h>
-#include <vtkGeometryFilter.h>
-#include <vtkCellData.h>
-#include <vtkLookupTable.h>
-#include <vtkGlyphSource2D.h>
-#include <vtkFloatArray.h>
-#include <vtkWindow.h>
-#include <vtkTextProperty.h>
-
-#endif
index 5f466d4af9dfb3aeb3d675170777b4fbe70a1399..d42b49280640b0dc20ff93f4b75f90cab236e565 100644 (file)
@@ -9,33 +9,32 @@ VPATH=.:@srcdir@:@top_srcdir@/idl
 
 EXPORT_HEADERS = \
                  OCCViewer_AISSelector.h \
-                 OCCViewer_Selector.h \
                  OCCViewer_Viewer3d.h \
                  OCCViewer_ViewFrame.h \
                  OCCViewer_ViewPort.h \
                  OCCViewer_ViewPort3d.h \
-                 OCCViewer_VService.h 
+                 OCCViewer_VService.h \
+                 OCCViewer_Prs.h
 
 # Libraries targets
 
 LIB = libOCCViewer.la
 LIB_SRC =        OCCViewer.cxx \
-                 OCCViewer_Selector.cxx \
                  OCCViewer_Viewer3d.cxx \
                  OCCViewer_ViewFrame.cxx \
                  OCCViewer_ViewPort.cxx \
                  OCCViewer_ViewPort3d.cxx \
                  OCCViewer_AISSelector.cxx \
-                 OCCViewer_VService.cxx
+                 OCCViewer_VService.cxx \
+                  OCCViewer_Prs.cxx
 
 LIB_MOC = \
                  OCCViewer.h \
                  OCCViewer_AISSelector.h \
-                 OCCViewer_Selector.h \
                  OCCViewer_Viewer3d.h \
                  OCCViewer_ViewFrame.h \
                  OCCViewer_ViewPort.h \
-                 OCCViewer_ViewPort3d.h \
+                 OCCViewer_ViewPort3d.h
 
 LIB_CLIENT_IDL = SALOMEDS.idl \
                 SALOME_ModuleCatalog.idl \
@@ -44,7 +43,7 @@ LIB_CLIENT_IDL = SALOMEDS.idl \
 
 
 CPPFLAGS+=$(QT_INCLUDES) $(OCC_INCLUDES) $(OGL_INCLUDES) $(PYTHON_INCLUDES)
-LDFLAGS+=$(QT_MT_LIBS) $(OGL_LIBS) -lSalomeGUI
+LDFLAGS+=$(QT_MT_LIBS) $(OGL_LIBS) -lSalomePrs -lSalomeGUI
 
 
 @CONCLUDE@
index 6310f51c6c919748a3b3b0285d33296f2e49fe02..826b8d28506f8942f94c3ef8fdbf6da8f15afa9d 100644 (file)
@@ -40,7 +40,9 @@ using namespace std;
     Constructor
 */
 OCCViewer_AISSelector::OCCViewer_AISSelector( const Handle (AIS_InteractiveContext)& aisContext) :
-myAISContext ( aisContext )
+       myAISContext ( aisContext ),
+       myEnableSelection( true ),
+       myEnableMultipleSelection( true )
 {
   initialize();
 }
@@ -61,7 +63,7 @@ void OCCViewer_AISSelector::initialize()
   QAD_ASSERT_DEBUG_ONLY ( !myAISContext.IsNull() );
 
   myHilightColor = Quantity_NOC_CYAN1;
-  mySelectColor = Quantity_NOC_GRAY80;
+  mySelectColor = Quantity_NOC_WHITE;
 
   myAISContext->SetHilightColor( myHilightColor );
   myAISContext->SelectionColor( mySelectColor );
@@ -105,25 +107,13 @@ void OCCViewer_AISSelector::setContext ( const Handle (AIS_InteractiveContext)&
     'selSelectionCancel'.
     Returns 'true' if no error, 'false' otherwise.
 */
-bool OCCViewer_AISSelector::checkSelection ( AIS_StatusOfPick status, bool hadSelection, bool addTo )
+void OCCViewer_AISSelector::checkSelection ( int numSelBefore )
 {
-  myNumSelected = myAISContext->NbCurrents(); /* update after the last selection */
-
-  if ( status == AIS_SOP_NothingSelected && !hadSelection ) {
-    emit selSelectionCancel( addTo );
-  }
-  else if ( status == AIS_SOP_NothingSelected && hadSelection ) {
-    emit selSelectionCancel( addTo ); /* unselected now */
-  }
-  else if ( status == AIS_SOP_OneSelected || status == AIS_SOP_SeveralSelected )
-    {
-      //      if ( !hadSelection || status != AIS_SOP_SeveralSelected )
-      //       addTo = false;
-      //      MESSAGE (" AIS_StatusOfPick : " << AIS_SOP_OneSelected )
-
-      emit selSelectionDone( addTo ); /* selected ( the same object, may be ) */
-    }
-  return ( status != AIS_SOP_Error && status != AIS_SOP_NothingSelected );
+  int numSelAfter = numSelected();
+  if ( numSelAfter < 1 && numSelBefore > 0 )
+    emit selSelectionCancel( false );
+  else if ( numSelAfter > 0 )
+    emit selSelectionDone( numSelAfter > 1 );
 }
 
 
@@ -131,32 +121,31 @@ bool OCCViewer_AISSelector::checkSelection ( AIS_StatusOfPick status, bool hadSe
     Detects the interactive objects at position (x,y).
     Returns 'true' if no error, 'false' otherwise.
 */
-bool OCCViewer_AISSelector::moveTo ( int x, int y, const Handle (V3d_View)& view )
+void OCCViewer_AISSelector::moveTo ( int x, int y, const Handle (V3d_View)& view )
 {
   if ( !myEnableSelection )
-    return false;
+    return;
 
   QAD_ASSERT_DEBUG_ONLY ( !myAISContext.IsNull() );
-  AIS_StatusOfDetection status = AIS_SOD_Error;
-  status = myAISContext->MoveTo (x, y, view);
-
-  return ( status != AIS_SOD_Error && status != AIS_SOD_AllBad );
+  myAISContext->MoveTo (x, y, view);
 }
 
 /*!
     Selects the detected interactive objects.
     Calls checkSelection() for checking the status.
 */
-bool OCCViewer_AISSelector::select ()
+void OCCViewer_AISSelector::select ()
 {
   if ( !myEnableSelection )
-    return false;
+    return;
 
   QAD_ASSERT_DEBUG_ONLY ( !myAISContext.IsNull() );
-  bool hadSelection = ( myNumSelected > 0 );
+  int numBefore = numSelected();
 
-  /* select and send notifications */
-  return checkSelection ( myAISContext->Select(), hadSelection, false );
+  myAISContext->Select();
+
+  /* send notifications */
+  checkSelection ( numBefore );
 }
 
 /*!
@@ -164,18 +153,19 @@ bool OCCViewer_AISSelector::select ()
     Multiple selection must be enabled to get use of this function.
     Calls checkSelection() for checking the status.
 */
-bool OCCViewer_AISSelector::select ( int left, int top, int right, int bottom,
+void OCCViewer_AISSelector::select ( int left, int top, int right, int bottom,
                               const Handle (V3d_View)& view )
 {
   if ( !myEnableSelection || !myEnableMultipleSelection )
-    return false;      /* selection with rectangle is considered as multiple selection */
+    return;    /* selection with rectangle is considered as multiple selection */
 
   QAD_ASSERT_DEBUG_ONLY ( !myAISContext.IsNull() );
-  bool hadSelection = ( myNumSelected > 0 );
+  int numBefore = numSelected();
+
+  myAISContext->Select(left, top, right, bottom, view);
 
-  /* select and send notifications */
-  return checkSelection ( myAISContext->Select(left, top, right, bottom, view),
-                         hadSelection, false );
+  /* send notifications */
+  checkSelection ( numBefore );
 }
 
 /*!
@@ -183,18 +173,21 @@ bool OCCViewer_AISSelector::select ( int left, int top, int right, int bottom,
     Multiple selection must be enabled to get use of this function.
     Calls checkSelection() for checking the status.
 */
-bool OCCViewer_AISSelector::shiftSelect ()
+void OCCViewer_AISSelector::shiftSelect ()
 {
   if ( !myEnableSelection )
-    return false;
+    return;
 
   QAD_ASSERT_DEBUG_ONLY ( !myAISContext.IsNull() );
-  bool hadSelection = ( myNumSelected > 0 ); /* something was selected */
-  if ( hadSelection && !myEnableMultipleSelection)
-    return false;
+  int numBefore = numSelected();
+
+  if ( numBefore && !myEnableMultipleSelection)
+    myAISContext->Select();
+  else
+    myAISContext->ShiftSelect();
 
-  /* select and send notifications */
-  return checkSelection ( myAISContext->ShiftSelect(), hadSelection, true );
+  /* send notifications */
+  checkSelection ( numBefore );
 }
 
 /*!
@@ -203,19 +196,50 @@ bool OCCViewer_AISSelector::shiftSelect ()
     Multiple selection must be enabled to get use of this function.
     Calls checkSelection() for checking the status.
 */
-bool OCCViewer_AISSelector::shiftSelect ( int left, int top, int right, int bottom,
+void OCCViewer_AISSelector::shiftSelect ( int left, int top, int right, int bottom,
                                    const Handle (V3d_View)& view )
 
 {
   if ( !myEnableSelection || !myEnableMultipleSelection )
-    return false;      /* selection with rectangle is considered as multiple selection */
+    return;    /* selection with rectangle is considered as multiple selection */
 
   QAD_ASSERT_DEBUG_ONLY ( !myAISContext.IsNull() );
-  bool hadSelection = ( myNumSelected > 0 );                   /* something was selected */
-  if ( hadSelection && !myEnableMultipleSelection)
-    return false;
+  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;
 
-  /* select and send notifications */
-  return checkSelection ( myAISContext->ShiftSelect(left,top,right,bottom, view),
-                         hadSelection, true );
+  if ( myAISContext->HasOpenedContext() )
+    return myAISContext->NbSelected();
+  return myAISContext->NbCurrents();
 }
index e51a7bca5bed79962389e809443eb8be090dabf6..8a7bd6524810ab460fa48a2080f8c368e103498e 100644 (file)
 #define OCCViewer_AISSELECTOR_H
 
 #include "QAD.h"
-#include "OCCViewer_Selector.h"
+
+// QT Include
+#include <qobject.h>
 
 // Open CASCADE Includes
 #include <Quantity_NameOfColor.hxx>
 #include <AIS_InteractiveContext.hxx>
 
-class QAD_EXPORT OCCViewer_AISSelector : public OCCViewer_Selector
+class QAD_EXPORT OCCViewer_AISSelector : public QObject
 {
   Q_OBJECT
 
@@ -48,24 +50,35 @@ public:
   ~OCCViewer_AISSelector();
 
 public:
-  bool moveTo ( int, int, const Handle (V3d_View)& );
-  bool select ( int, int, int, int, const Handle (V3d_View)& );
-  bool shiftSelect ( int, int, int, int, const Handle (V3d_View)& );
-  bool select ();
-  bool shiftSelect ();
+  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 );
 
-protected:
-  bool checkSelection ( AIS_StatusOfPick status, bool hadSelection, bool addTo );
+  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
diff --git a/src/OCCViewer/OCCViewer_Selector.cxx b/src/OCCViewer/OCCViewer_Selector.cxx
deleted file mode 100644 (file)
index e037b6b..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-//  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_Selector.cxx
-//  Author : Nicolas REJNERI
-//  Module : SALOME
-//  $Header$
-
-using namespace std;
-/*!
-  \class OCCViewer_Selector OCCViewer_Selector.h
-  \brief Base class for object selection in Open CASCADE Viewer.
-*/
-
-#include "OCCViewer_Selector.h"
-
-/*!
-    Constructor
-*/
-OCCViewer_Selector::OCCViewer_Selector() :
-  myNumSelected (0),
-  myEnableSelection( true ),
-  myEnableMultipleSelection( true )
-{
-}
-
-/*!
-    Destructor
-*/
-OCCViewer_Selector::~OCCViewer_Selector()
-{
-}
-
-/*!
-    Enables/disables selection
-*/
-void OCCViewer_Selector::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_Selector::enableMultipleSelection( bool bEnable )
-{
-  myEnableMultipleSelection = bEnable;
-  if ( bEnable ) myEnableSelection = bEnable;
-}
diff --git a/src/OCCViewer/OCCViewer_Selector.h b/src/OCCViewer/OCCViewer_Selector.h
deleted file mode 100644 (file)
index 96c9600..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-//  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_Selector.h
-//  Author : Nicolas REJNERI
-//  Module : SALOME
-//  $Header$
-
-#ifndef OCCViewer_SELECTOR_H
-#define OCCViewer_SELECTOR_H
-
-#include "QAD.h"
-
-// QT Include
-#include <qobject.h>
-
-// Open CASCADE Include
-#include <AIS_InteractiveObject.hxx>
-#include <AIS_ListOfInteractive.hxx>
-
-class QAD_EXPORT OCCViewer_Selector : public QObject
-{
-  Q_OBJECT     
-               
- public:
-  OCCViewer_Selector();
-  virtual ~OCCViewer_Selector();
-
- public:
-  void         enableSelection( bool );
-  void         enableMultipleSelection( bool );
-
- signals:
-
-  void         selSelectionDone( bool bAdded );
-  void         selSelectionCancel( bool bAdded );
-       
- protected:
-
-  int          myNumSelected;
-  bool         myEnableSelection;
-  bool         myEnableMultipleSelection;
-};
-
-#endif
-
index 2ddc4325fc1abc068ffe48db69a951229cc378d5..b43955be1e17d8a77c95e14bf2e0dfab893cf6c9 100644 (file)
@@ -31,6 +31,7 @@ using namespace std;
 #include "OCCViewer_Viewer3d.h"
 #include "OCCViewer_ViewPort.h"
 #include "OCCViewer_ViewPort3d.h"
+#include "OCCViewer_Prs.h"
 
 #include "QAD.h"
 #include "QAD_Tools.h"
@@ -339,7 +340,8 @@ void OCCViewer_ViewFrame::onViewBack()
 void OCCViewer_ViewFrame::onViewRight()
 {
   Handle( V3d_View) view3d = ((OCCViewer_ViewPort3d*)myViewPort)->getView();
-  if ( !view3d.IsNull() ) view3d->SetProj (V3d_Yneg);
+  if ( !view3d.IsNull() )
+    view3d->SetProj( V3d_Ypos );
   onViewFitAll();
 }
 
@@ -349,7 +351,8 @@ void OCCViewer_ViewFrame::onViewRight()
 void OCCViewer_ViewFrame::onViewLeft()
 {
   Handle( V3d_View) view3d = ((OCCViewer_ViewPort3d*)myViewPort)->getView();
-  if ( !view3d.IsNull() ) view3d->SetProj (V3d_Ypos);
+  if ( !view3d.IsNull() )
+    view3d->SetProj( V3d_Yneg );
   onViewFitAll();
 }
 
@@ -415,97 +418,85 @@ void OCCViewer_ViewFrame::setPopupServer( QAD_Application* App )
   myViewer->setPopupServer( App );
 }
 
-void OCCViewer_ViewFrame::undo(SALOMEDS::Study_var aStudy,
-                                 const char* StudyFrameEntry)
+void OCCViewer_ViewFrame::undo(QAD_Study* theStudy, const char* StudyFrameEntry)
 {
+  SALOMEDS::Study_var aStudy = theStudy->getStudyDocument();
   AIS_ListOfInteractive List1;
   myViewer->getAISContext()->ObjectsInCollector(List1);
   AIS_ListIteratorOfListOfInteractive ite1(List1);
-  while (ite1.More()) {
-    if (ite1.Value()->IsKind(STANDARD_TYPE(SALOME_AISShape))) {
-      Handle(SALOME_AISShape) aSh = Handle(SALOME_AISShape)::DownCast(ite1.Value());
-      if ( aSh->hasIO() ) {
-       Handle(SALOME_InteractiveObject) IO = aSh->getIO();
-       if ( IO->hasEntry() ) { 
-         if (!QAD_ViewFrame::isInViewer(aStudy, IO->getEntry(), StudyFrameEntry))
-           myViewer->getAISContext()->Display(aSh);
-       }
-      }
+  for( ; ite1.More(); ite1.Next() )
+  {
+    Handle(SALOME_InteractiveObject) anObj =
+      Handle(SALOME_InteractiveObject)::DownCast( ite1.Value()->GetOwner() );
+      
+    if ( !anObj.IsNull() &&
+          anObj->hasEntry() &&
+          theStudy->isInViewer( anObj->getEntry(), StudyFrameEntry) )
+    {
+      myViewer->getAISContext()->Display( ite1.Value() );
     }
-    ite1.Next();
   }
   
   AIS_ListOfInteractive List;
   myViewer->getAISContext()->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->hasEntry() ) { 
-         if (!QAD_ViewFrame::isInViewer(aStudy, IO->getEntry(), StudyFrameEntry ))
-           myViewer->getAISContext()->Erase(aSh,true,true);
-       }
-      }
+  for ( ; ite.More(); ite.Next() )
+  {
+    Handle(SALOME_InteractiveObject) anObj =
+      Handle(SALOME_InteractiveObject)::DownCast( ite.Value()->GetOwner() );
+
+    if ( !anObj.IsNull() &&
+          anObj->hasEntry() &&
+          theStudy->isInViewer( anObj->getEntry(), StudyFrameEntry) )
+    {
+      myViewer->getAISContext()->Erase( ite.Value(), true, true ); 
     }
-    ite.Next();
   }
 }
 
-void OCCViewer_ViewFrame::redo(SALOMEDS::Study_var aStudy,
-                                 const char* StudyFrameEntry)
+void OCCViewer_ViewFrame::redo(QAD_Study* theStudy, const char* StudyFrameEntry)
 {
+  SALOMEDS::Study_var aStudy = theStudy->getStudyDocument();
   SALOMEDS::SObject_var RefSO;
   SALOMEDS::SObject_var SO = aStudy->FindObjectID( StudyFrameEntry );
   SALOMEDS::ChildIterator_var it = aStudy->NewChildIterator(SO);
   for (; it->More();it->Next()){
     SALOMEDS::SObject_var CSO= it->Value();
-    if (CSO->ReferencedObject(RefSO)) {
-      
+    if (CSO->ReferencedObject(RefSO))
+    {
       AIS_ListOfInteractive List;
       myViewer->getAISContext()->ObjectsInCollector(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->hasEntry() ) { 
-             if ( strcmp(IO->getEntry(),RefSO->GetID()) == 0 )
-               myViewer->getAISContext()->Display(aSh, false);
-           }
-         }
-       }
-       ite.Next();
+      for ( ; ite.More(); ite.Next() )
+      {
+        Handle(SALOME_InteractiveObject) anObj =
+          Handle(SALOME_InteractiveObject)::DownCast( ite.Value()->GetOwner() );
+          
+        if ( !anObj.IsNull() && anObj->hasEntry() && strcmp( anObj->getEntry(), RefSO->GetID() ) == 0 )
+          myViewer->getAISContext()->Display( ite.Value(), false );
       }
-      
     }
   }
   
   AIS_ListOfInteractive List1;
   myViewer->getAISContext()->DisplayedObjects(List1);
   AIS_ListIteratorOfListOfInteractive ite1(List1);
-  while (ite1.More()) {
-    if (ite1.Value()->IsKind(STANDARD_TYPE(SALOME_AISShape))) {
-      Handle(SALOME_AISShape) aSh = Handle(SALOME_AISShape)::DownCast(ite1.Value());
-      if ( aSh->hasIO() ) {
-       Handle(SALOME_InteractiveObject) IO = aSh->getIO();
-       if ( IO->hasEntry() ) { 
-         if (!QAD_ViewFrame::isInViewer(aStudy, IO->getEntry(), StudyFrameEntry ))
-           myViewer->getAISContext()->Erase(aSh,false,true);
-       }
-      }
-    }
-    ite1.Next();
+  for ( ; ite1.More(); ite1.Next() )
+  {
+    Handle(SALOME_InteractiveObject) anObj =
+      Handle(SALOME_InteractiveObject)::DownCast( ite1.Value()->GetOwner() );
+
+    if ( !anObj.IsNull() && anObj->hasEntry() && !theStudy->isInViewer( anObj->getEntry(), StudyFrameEntry ) )
+      myViewer->getAISContext()->Erase( ite1.Value(), false, true );
   }
+  
   Repaint();
 }
 
 /* selection */
 Handle(SALOME_InteractiveObject) OCCViewer_ViewFrame::FindIObject(const char* Entry)
 {
-  Handle(SALOME_InteractiveObject) IO;
   Handle (AIS_InteractiveContext) ic = myViewer->getAISContext();
       
   AIS_ListOfInteractive List;
@@ -515,24 +506,19 @@ Handle(SALOME_InteractiveObject) OCCViewer_ViewFrame::FindIObject(const char* En
   List.Append(List1);
 
   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() ) {
-       IO = aSh->getIO();
-       if ( IO->hasEntry() ) {
-         if ( strcmp( IO->getEntry(), Entry ) == 0 ) {
-           MESSAGE ( "IO found")
-           return IO;
-         }
-       }
-      }
+  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;
     }
-    ite.Next();
   }
   MESSAGE ( "IO not found")
-  return IO;
+  return Handle(SALOME_InteractiveObject)();
 }
 
 /* display */          
@@ -550,24 +536,21 @@ void OCCViewer_ViewFrame::Display(const Handle(SALOME_InteractiveObject)& IObjec
   ic->ObjectsInCollector(List1);
   List.Append(List1);
   
-  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 ) ) {
-         ic->Display(aSh, false);
-         //      ic->AddOrRemoveCurrentObject(aSh, false); repeated in Viewer3d after next statement
-         Sel->AddIObject(IO, false);
-         break;
-       }
-      }
+  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 ) )
+    {
+      ic->Display( ite.Value(), false );
+      Sel->AddIObject( anObj, false );
+      break;
     }
-    ite.Next();
   }
-  if (update)
+  
+  if ( update )
     Repaint();
 }
 
@@ -585,24 +568,27 @@ void OCCViewer_ViewFrame::DisplayOnly(const Handle(SALOME_InteractiveObject)& IO
   ic->ObjectsInCollector(List1);
   List.Append(List1);
   
-  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 ) ) {
-         ic->Erase(aSh, false);
-         Sel->RemoveIObject(IO, false);
-       } else {
-         ic->Display(aSh, false);
-         Sel->AddIObject(IO, false);
-       }
+  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() )
+    {
+      if ( !anObj->isSame( IObject ) )
+      {
+        ic->Erase( ite.Value(), false );
+        Sel->RemoveIObject( anObj, false );
+      }
+      else
+      {
+        ic->Display( ite.Value(), false );
+        Sel->AddIObject( anObj, false );
       }
     }
-    ite.Next();
   }
+  
   Repaint();
 }
 void OCCViewer_ViewFrame::Erase(const Handle(SALOME_InteractiveObject)& IObject, bool update)
@@ -615,27 +601,25 @@ void OCCViewer_ViewFrame::Erase(const Handle(SALOME_InteractiveObject)& IObject,
   
   AIS_ListOfInteractive List;
   ic->DisplayedObjects(List);
-  AIS_ListIteratorOfListOfInteractive ite(List);
-  while (ite.More()) 
+  
+  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() )
     {
-      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 ) )
-               {
-                 ic->Erase(aSh, false);
-                 Sel->RemoveIObject(IO, false);
-                 break;
-               }
-           }
-       }
-      ite.Next();
+      if ( anObj->isSame( IObject ) )
+      {
+        ic->Erase( ite.Value(), false );
+        Sel->RemoveIObject( anObj, false );
+        break;
+      }
     }
-  if (update)
+  }
+  
+  if ( update )
     Repaint();
 }
 
@@ -662,52 +646,308 @@ void OCCViewer_ViewFrame::Repaint()
   myViewer->getViewer3d()->Update();
 }
 
-void OCCViewer_ViewFrame::onAdjustTrihedron()
+//==========================================================
+/*!
+ *  OCCViewer_ViewFrame::getTrihedronSize
+ *  Get new an current trihedron 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;
+  double aPercents;
+
+  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;
+}
+
+void OCCViewer_ViewFrame::AdjustTrihedrons( const bool forced )
 {
   Handle (AIS_InteractiveContext) ic = myViewer->getAISContext();
-  
-  if (!ic->IsDisplayed(myViewer->getTrihedron())) 
+
+  if ( !myViewer->isTrihedronDisplayed() )
     return;
-  else 
+  else
+  {
+    AIS_ListOfInteractive List;
+    ic->DisplayedObjects(List);
+    if ( List.First() == List.Last() && List.First() == myViewer->getTrihedron() )
     {
-      AIS_ListOfInteractive List;
-      ic->Erase( myViewer->getTrihedron() );
-      ic->DisplayedObjects(List);
-      ic->Display( myViewer->getTrihedron() ); 
-      if (List.IsEmpty())
-       {
-         myViewer->setTrihedronSize(100);
-         return;
+      myViewer->setTrihedronSize( 100 );
+      return;
+    }
+  }
+
+  double aNewSize = 100, aSize = 100;
+  if ( getTrihedronSize( aNewSize, aSize ) || forced )
+    myViewer->setTrihedronSize( aNewSize );
+}
+
+void OCCViewer_ViewFrame::onAdjustTrihedron()
+{
+  AdjustTrihedrons( false );
+}
+
+//==========================================================
+/*!
+ *  OCCViewer_ViewFrame::Display
+ *  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 he 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 );
+      while ( ite.More() ) {
+       // 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;
        }
+       ite.Next();
+      }
+      if ( bDisplayed )
+       continue;
+      // then try to find presentation in the collector
+      bDisplayed = false;
+      ite.Initialize( ListCollector );
+      while ( ite.More() ) {
+       // 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;
+         break;
+       }
+       ite.Next();
+      }
+      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 );
+
+      // Deactivate object if necessary
+      if ( !anOCCPrs->ToActivate() )
+        ic->Deactivate( anAIS );
+    }
+  }
+}
+
+//==========================================================
+/*!
+ *  OCCViewer_ViewFrame::Erase
+ *  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 );
+    }
+  }
+}
+
+//==========================================================
+/*!
+ *  OCCViewer_ViewFrame::CreatePrs
+ *  Create presentation by 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;
+}
+
+//==========================================================
+/*!
+ *  OCCViewer_ViewFrame::LocalSelection
+ *  Activates selection of sub shapes
+ */
+//==========================================================
+void OCCViewer_ViewFrame::LocalSelection( const SALOME_OCCPrs* thePrs, const int theMode )
+{
+  Handle(AIS_InteractiveContext) anIC = myViewer->getAISContext();
   
-  Handle( V3d_View) view3d = ((OCCViewer_ViewPort3d*)myViewPort)->getView();
+  const OCCViewer_Prs* anOCCPrs = dynamic_cast<const OCCViewer_Prs*>( thePrs );
+  if ( anIC.IsNull() )
+    return;
   
-  if (!view3d.IsNull())
+  // 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() )
     {
-      double Xmin=0, Ymin=0, Zmin=0, Xmax=0, Ymax=0, Zmax=0;
-      double aMaxSide; 
-      double aPercents;
-     
-      view3d->View()->MinMaxValues(Xmin, Ymin, Zmin, Xmax, Ymax, Zmax);
-
-      if (Xmin==RealFirst() || Ymin==RealFirst() || Zmin==RealFirst() ||
-         Xmax==RealLast()  || Ymax==RealLast()  || Zmax==RealLast())
-       return;
-           
-      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;
-      float aSize = myViewer->getTrihedron()->Size();
-      float aNewSize = aMaxSide*aSizeInPercents/100.0;
-      // if the new trihedron size have sufficient difference, then apply the value
-      if(fabs(aNewSize-aSize) > aSize*EPS || fabs(aNewSize-aSize) > aNewSize*EPS)
-       myViewer->setTrihedronSize(aNewSize);
+      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 );
+      }
     }
+  }
+}
+
+//==========================================================
+/*!
+ *  OCCViewer_ViewFrame::GlobalSelection
+ *  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();
+}
+
+//==========================================================
+/*!
+ *  OCCViewer_ViewFrame::BeforeDisplay
+ *  Axiluary method called before displaying of objects
+ */
+//==========================================================
+void  OCCViewer_ViewFrame::BeforeDisplay( SALOME_Displayer* d )
+{
+  d->BeforeDisplay( this, SALOME_OCCViewType() );
+}
+
+//==========================================================
+/*!
+ *  OCCViewer_ViewFrame::AfterDisplay
+ *  Axiluary method called after displaying of objects
+ */
+//==========================================================
+void  OCCViewer_ViewFrame::AfterDisplay( SALOME_Displayer* d )
+{
+  d->AfterDisplay( this, SALOME_OCCViewType() );
 }
+
index 46bdb4af754170a0601ebb7fb42302778c05d17e..4d29bcc441b1e4bbb6c1cad11267e21f81398ffe 100644 (file)
@@ -24,7 +24,7 @@
 //  File   : OCCViewer_ViewFrame.h
 //  Author : Nicolas REJNERI
 //  Module : SALOME
-//  $Header$
+//  $Header$           
 
 #ifndef OCCViewer_ViewFrame_H
 #define OCCViewer_ViewFrame_H
@@ -81,10 +81,8 @@ class QAD_EXPORT OCCViewer_ViewFrame : public QAD_ViewFrame
   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);
+  void              undo(QAD_Study* aStudy, const char* StudyFrameEntry);
+  void              redo(QAD_Study* aStudy, const char* StudyFrameEntry);
 
   /* selection */
   Handle(SALOME_InteractiveObject) FindIObject(const char* Entry);
@@ -97,6 +95,21 @@ class QAD_EXPORT OCCViewer_ViewFrame : public QAD_ViewFrame
   void           EraseAll();
   void           Repaint();
 
+  /* Reimplemented from SALOME_View */
+  void          Display( const SALOME_OCCPrs* );
+  void          Erase( const SALOME_OCCPrs*, const bool = false );
+  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;
+
+
+  void          AdjustTrihedrons( const bool forced  = false );
+
+  // Method for activation of sub-shapes selection
+
+
  protected:    
   void              closeEvent(QCloseEvent* e);
   void              resizeEvent(QResizeEvent* e);
@@ -134,6 +147,9 @@ class QAD_EXPORT OCCViewer_ViewFrame : public QAD_ViewFrame
   void           onViewTop();
   void           onViewTrihedron(); 
   void           onAdjustTrihedron();
+
+private:
+  bool           getTrihedronSize( double& theNewSize, double& theSize ); 
  
  protected:
   OCCViewer_Viewer3d*      myViewer;    // my owner
index 1d6d410baba945ae175913993824eed26d61cfbc..695d4269226a75c43f2d8729190dd4f489fc4127 100644 (file)
@@ -26,7 +26,6 @@
 //  Module : SALOME
 //  $Header$
 
-using namespace std;
 #include <stdlib.h>
 
 #if !defined WNT
@@ -53,6 +52,10 @@ using namespace std;
 #include <qpixmap.h>
 #include <qintdict.h>
 
+#include "utilities.h"
+
+using namespace std;
+
 /* XPM */
 const char* imageZoomCursor[] = { 
 "32 32 3 1",
index 8d4a1331aef7589de27f25b87b090713a99df4f6..cd97a6e902f581d7894798548d19130fe64a3416 100644 (file)
@@ -56,6 +56,18 @@ using namespace std;
 #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>
+
+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
@@ -169,9 +181,20 @@ Handle(AIS_Trihedron) OCCViewer_Viewer3d::getTrihedron() const
   return myTrihedron;
 }
 
-void OCCViewer_Viewer3d::setTrihedronSize(float size)
+void OCCViewer_Viewer3d::setTrihedronSize( float size )
 {
-  myTrihedron->SetSize(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();
 }
 
@@ -187,21 +210,27 @@ void OCCViewer_Viewer3d::rename( const Handle(SALOME_InteractiveObject)& IObject
   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());
+  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 ) ) {
-         aSh->setName( strdup(newName.latin1()) );
-         break;
-       }
+      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());
+    }
+    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.
     }
@@ -216,87 +245,63 @@ void OCCViewer_Viewer3d::SetColor(const Handle(SALOME_InteractiveObject)& IObjec
   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 ) ) {
-         Quantity_Color CSFColor = Quantity_Color ( thecolor.red()/255., thecolor.green()/255., thecolor.blue()/255., Quantity_TOC_RGB );
-         aSh->SetColor ( CSFColor );
-         //      aSh->SetShadingColor ( CSFColor );
-         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.
+  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;
     }
-    ite.Next();
   }
+
   myV3dViewer->Update();
 }
 
-void OCCViewer_Viewer3d::SwitchRepresentation(const Handle(SALOME_InteractiveObject)& IObject,
-                                             int mode)
+void OCCViewer_Viewer3d::SwitchRepresentation( const Handle(SALOME_InteractiveObject)& IObject,
+                                               int mode )
 {  
   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 ) ) {
-         myAISContext->SetDisplayMode(aSh,Standard_Integer(mode),true);
-       }
-      }
-    } 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();
+  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)
+void OCCViewer_Viewer3d::SetTransparency( const Handle(SALOME_InteractiveObject)& IObject,
+                                          float transp )
 {
   AIS_ListOfInteractive List;
-  myAISContext->DisplayedObjects(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 ) ) {
-         myAISContext->SetTransparency( aSh, transp, false );
-         myAISContext->Redisplay( aSh, Standard_False, Standard_True );
-       }
-      }
-    } 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.
+  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 );
     }
-    ite.Next();
   }
+  
   myV3dViewer->Update();  
 }
 
@@ -305,38 +310,46 @@ void OCCViewer_Viewer3d::SetTransparency(const Handle(SALOME_InteractiveObject)&
 */
 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);
-  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 ) ) {
-         if ( highlight ) {
-           if ( !myAISContext->IsSelected(aSh) ) 
-             myAISContext->AddOrRemoveCurrentObject(aSh, false);
-         } else {
-           if ( myAISContext->IsSelected(aSh) ) 
-             myAISContext->AddOrRemoveCurrentObject(aSh, false);       
-         }      
-         break;
-       }
+  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 );
       }
-    } 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.
+      // 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;
     }
-    ite.Next();
   }
-  if (update)
-    myV3dViewer->Update();
+    
+  if ( update )
+    myV3dViewer->Redraw();
+    
   return false;
 }
 
@@ -345,7 +358,10 @@ bool OCCViewer_Viewer3d::highlight( const Handle(SALOME_InteractiveObject)& IObj
 */
 bool OCCViewer_Viewer3d::unHighlightAll()
 {
-  myAISContext->ClearCurrents();
+  if ( myAISContext->HasOpenedContext() )
+    myAISContext->ClearSelected();
+  else
+    myAISContext->ClearCurrents();
   return false;
 }
 
@@ -364,24 +380,13 @@ bool OCCViewer_Viewer3d::isInViewer( const Handle(SALOME_InteractiveObject)& IOb
   }
 
   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 ( IObject->isSame( IO ) ) {
-         return true;
-       }
-      }
-    } else if (ite.Value()->IsKind(STANDARD_TYPE(SALOME_AISObject))) {
-      Handle(SALOME_AISObject) aSh =
-       Handle(SALOME_AISObject)::DownCast(ite.Value());
+  for ( ; ite.More(); ite.Next() )
+  {
+    Handle(SALOME_InteractiveObject) anObj =
+        Handle(SALOME_InteractiveObject)::DownCast( ite.Value()->GetOwner() );
 
-      // Add code here, if someone create a MODULE_AISObject.
-    }
-    ite.Next();
+    if ( !anObj.IsNull() && anObj->hasEntry() && anObj->isSame( IObject ) )
+      return true;
   }
   return false;
 }
@@ -389,28 +394,18 @@ bool OCCViewer_Viewer3d::isInViewer( const Handle(SALOME_InteractiveObject)& IOb
 bool OCCViewer_Viewer3d::isVisible( const Handle(SALOME_InteractiveObject)& IObject )
 {
   AIS_ListOfInteractive List;
-  myAISContext->DisplayedObjects(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 ( IObject->isSame( IO ) ) {
-         return myAISContext->IsDisplayed(aSh);
-       }
-      }
-    } else if (ite.Value()->IsKind(STANDARD_TYPE(SALOME_AISObject))) {
-      Handle(SALOME_AISObject) aSh =
-       Handle(SALOME_AISObject)::DownCast(ite.Value());
+  AIS_ListIteratorOfListOfInteractive ite( List );
+  for ( ; ite.More(); ite.Next() )
+  {
+    Handle(SALOME_InteractiveObject) anObj =
+      Handle(SALOME_InteractiveObject)::DownCast( ite.Value()->GetOwner() );
 
-      // Add code here, if someone create a MODULE_AISObject.
-    }
-    ite.Next();
+    if ( !anObj.IsNull() && anObj->hasEntry() && anObj->isSame( IObject ) )
+      return myAISContext->IsDisplayed( ite.Value() );
   }
+  
   return false;
 }
 
@@ -498,13 +493,11 @@ void OCCViewer_Viewer3d::onMousePress( QMouseEvent* pe )
 void OCCViewer_Viewer3d::onMouseMove( QMouseEvent* pe )
 {
   /* activate hilighting only if no MB pressed */
-  if ( pe->state() == Qt::NoButton ) 
-    {
-      QAD_Application::getDesktop()->onMouseMove( pe );
-      
-      OCCViewer_ViewPort* vp = myViewFrame->getViewPort();
-      myAISSelector->moveTo ( pe->x(), pe->y(), ((OCCViewer_ViewPort3d*)vp)->getView() );
-    }
+  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() );
+  }
 }
 
 /*!
@@ -582,138 +575,247 @@ 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() )
+//  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();
+  QString ActiveComp = QAD_Application::getDesktop()->getActiveComponent();
 
-  if ( ActiveComp.isEmpty() ) {
+  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 ) { /* select */
-    myAISContext->InitCurrent();
-    while (myAISContext->MoreCurrent()) {
-      if (myAISContext->Current()->IsKind(STANDARD_TYPE(SALOME_AISShape))) {
-       Handle(SALOME_AISShape) aSh =
-         Handle(SALOME_AISShape)::DownCast(myAISContext->Current());
-       
-       if ( aSh->hasIO() ) {
-         Handle( SALOME_InteractiveObject) IO = aSh->getIO();
-       
-         bool itemAllreadySelected = false;
-         int nbSel = Sel->IObjectCount();
-         if ( nbSel == 0 ) {
-           DeltaPos.Append( IO );
-         } else {
-           SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
-           for(;It.More();It.Next()) {
-             Handle( SALOME_InteractiveObject) IO1 = It.Value();
-             if ( IO->isSame( IO1 ) ) {
-               itemAllreadySelected = true;
-               break;
-             }
-           }
-           if (!itemAllreadySelected) 
-             DeltaPos.Append( IO );
-         }
+  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.
       }
-      myAISContext->NextCurrent();
+      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 */
+
+  }
+  else
+  { /* shift select */
     SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
-    for(;It.More();It.Next()) {
+    for ( ;It.More(); It.Next() )
+    {
       Handle( SALOME_InteractiveObject) IO1 = It.Value();
 
       bool itemAllreadySelected = false;
-      myAISContext->InitCurrent();
-      while (myAISContext->MoreCurrent()) {
-       if (myAISContext->Current()->IsKind(STANDARD_TYPE(SALOME_AISShape))) {
-         Handle(SALOME_AISShape) aSh =
-           Handle(SALOME_AISShape)::DownCast(myAISContext->Current());
-         if ( aSh->hasIO() ) {
-           Handle( SALOME_InteractiveObject) IO = aSh->getIO();
-       
-           if ( IO->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.
-       }
-       myAISContext->NextCurrent();
+      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 );
+      if ( !itemAllreadySelected )
+        DeltaNeg.Append( IO1 );
     }
 
     myAISContext->InitCurrent();
-    while (myAISContext->MoreCurrent()) {
-      if (myAISContext->Current()->IsKind(STANDARD_TYPE(SALOME_AISShape))) {
-       Handle(SALOME_AISShape) aSh =
-         Handle(SALOME_AISShape)::DownCast(myAISContext->Current());
-       if ( aSh->hasIO() ) {
-         Handle( SALOME_InteractiveObject) IO = aSh->getIO();  
-       
-         bool itemAllreadySelected = false;
-         SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
-         for(;It.More();It.Next()) {
-           Handle( SALOME_InteractiveObject) IO1 = It.Value();
-           
-           if ( IO->isSame( IO1 ) ) {
-             itemAllreadySelected = true;
-             break;
-           }
-         }
-       
-         if (!itemAllreadySelected )
-           DeltaPos.Append( IO );
-       }
-      } 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.
+    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.
       }
-      myAISContext->NextCurrent();
     }
   }
-  
+
   //  MESSAGE ( "VIEWER onSelectionDone DeltaNeg.count() == " << DeltaNeg.count() )
   SALOME_ListIteratorOfListIO ItNeg( DeltaNeg );
-  for(;ItNeg.More();ItNeg.Next()) {
+  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()) {
+  for ( ;ItPos.More();ItPos.Next() )
+  {
     Sel->AddIObject( ItPos.Value(), false );
-  }  
-  myV3dViewer->Update();
+  }
+}
+
+/*!
+  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();
 }
 
 /*!
@@ -723,56 +825,56 @@ void OCCViewer_Viewer3d::onSelectionCancel( bool bAdded )
 {
   emit vw3dSelectionCancel();
 
-  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() )
+  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 */
+  
+  if ( !bAdded )
+  { /* select */
     Sel->ClearIObjects();
-  } else { /* shiftselect */
+  }
+  else
+  { /* shiftselect */
     SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
-    for(;It.More();It.Next()) {
+    for ( ; It.More(); It.Next() )
+    {
       Handle( SALOME_InteractiveObject) IO1 = It.Value();
 
       bool itemAllreadySelected = false;
       myAISContext->InitCurrent();
-      while (myAISContext->MoreCurrent()) {
-       if (myAISContext->Current()->IsKind(STANDARD_TYPE(SALOME_AISShape))) {
-         Handle(SALOME_AISShape) aSh =
-           Handle(SALOME_AISShape)::DownCast(myAISContext->Current());
-         if ( aSh->hasIO() ) {
-           Handle( SALOME_InteractiveObject) IO = aSh->getIO();        
-           if ( IO->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.
-       }
-       myAISContext->NextCurrent();
+      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 );
+      if ( !itemAllreadySelected )
+        DeltaNeg.Append( IO1 );
     }
   }
 
   //  MESSAGE ( "VIEWER onSelectionCancel DeltaNeg.count() == " << DeltaNeg.Extent() )
   SALOME_ListIteratorOfListIO ItNeg( DeltaNeg );
-  for(;ItNeg.More();ItNeg.Next()) {
+  for ( ; ItNeg.More(); ItNeg.Next() ) 
     Sel->RemoveIObject( ItNeg.Value(), false);
-  }
+
   myV3dViewer->Update();
 }
 
index 9cfed35a2aff35b4246000b29cb230516819adc6..dab77ab2aaf0323c4c8e86bf179a065cfce41a0d 100644 (file)
@@ -124,6 +124,11 @@ protected:
 protected:
  OCCViewer_ViewFrame*           myViewFrame;
 
+private:
+
+  void                   globalSelectionDone( const bool );
+  void                   localSelectionDone ( const bool );
+
  Handle (AIS_InteractiveContext) myAISContext;
  OCCViewer_AISSelector*                 myAISSelector;
  bool                           myEnableSelection;
index 81078aa9fdc09be431d5033965952a2cb6a7539d..d916a9a7acb7e6ceb608f175f409cf92e761afd8 100644 (file)
@@ -34,12 +34,13 @@ VPATH=.:@srcdir@:@top_srcdir@/idl
 EXPORT_HEADERS = \
        qsplitterP.h \
        qworkspaceP.h \
-       qactionP.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
+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
 
@@ -49,6 +50,9 @@ qworkspaceP_moc.cxx: $(inc_builddir)/qworkspaceP.h
 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) 
index 4779d3762e09b1e69349056bdf894d0a5331e49c..0d1269dac9abb0f3daf1d526c88c1e68e45899d8 100644 (file)
@@ -1,13 +1,45 @@
-//  SALOME PatchQt : patch for Qt
-//
-//  Copyright (C) 2003  CEA/DEN, EDF R&D
-//
-//
-//
-//  File   : qactionP.cxx
-//  Author : Vadim SANDLER
-//  Module : SALOME
-//  $Header$
+/////////////////////////////////////////////////////////////////////////////
+// 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"
 
index ecca035c7b321179531ebb4e8e51dbfc5b2b35e0..1fcf05053e73ddee4f6b18884d96bc9f06e7076b 100644 (file)
@@ -1,13 +1,45 @@
-//  SALOME PatchQt : patch for Qt
-//
-//  Copyright (C) 2003  CEA/DEN, EDF R&D
-//
-//
-//
-//  File   : qactionP.h
-//  Author : Vadim SANDLER
-//  Module : SALOME
-//  $Header$
+/////////////////////////////////////////////////////////////////////////////
+// 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
index 4b8268af90164280f6447e480547db41c7ca31ca..fd2a7fc5c6aa2c82ae0950a084f66f4ad728bf43 100644 (file)
@@ -1,30 +1,9 @@
-//  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   : qsplitterP.cxx
-//  Module : SALOME
+/////////////////////////////////////////////////////////////////////////////
+// Module      : PatchQt
+// File        : qsplitterP.cxx
+// Description : the patch for Qt's QSplitter class (qsplitter.cpp)
+/////////////////////////////////////////////////////////////////////////////
 
-using namespace std;
 /****************************************************************************
 ** $Id$
 **
@@ -61,6 +40,8 @@ using namespace std;
 ** not clear to you.
 **
 **********************************************************************/
+
+using namespace std;
 #include "qsplitterP.h"
 #ifndef QT_NO_COMPLEXWIDGETS
 
index 70d9a72ecb6d152c6a5d37c2bf1ca4902eedf19d..263a90429e4bedb039bc3fd482425881a20cdb00 100644 (file)
@@ -1,28 +1,8 @@
-//  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   : qsplitterP.h
-//  Module : SALOME
+/////////////////////////////////////////////////////////////////////////////
+// Module      : PatchQt
+// File        : qsplitterP.h
+// Description : the patch for Qt's QSplitter class (qsplitter.h)
+/////////////////////////////////////////////////////////////////////////////
 
 /****************************************************************************
 ** $Id$
@@ -116,6 +96,10 @@ public:
     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 * );
 
@@ -125,7 +109,7 @@ protected:
     int idAfter( QWidget* ) const;
     QWidget* widgetBefore( int id ) const;
     QWidget* widgetAfter( int id ) const;
-    bool isCompressed(const QWidget*) const;
+
     QSize minSize( const QWidget *w ) const;
     QSize maxSize( const QWidget *w ) const;
     
index 0d4d618f751574db9d1cc7dd940d2c9d4cbd7936..f73e7392787fa6810d8fb965eb3059f6c163b4d6 100644 (file)
@@ -1,13 +1,45 @@
-//  SALOME PatchQt : patch for Qt
-//
-//  Copyright (C) 2003  CEA/DEN, EDF R&D
-//
-//
-//
-//  File   : qworkspaceP.cxx
-//  Author : Vadim SANDLER
-//  Module : SALOME
-//  $Header$
+/////////////////////////////////////////////////////////////////////////////
+// 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.
+**
+**********************************************************************/
 
 using namespace std;
 #include "qworkspaceP.h"
index fd70401172c4b50ea72ad9c2c4c2549bac68664e..fb15237357d196e2c39d84f7b08fc70a9fcb446c 100644 (file)
@@ -1,13 +1,45 @@
-//  SALOME PatchQt : patch for Qt
-//
-//  Copyright (C) 2003  CEA/DEN, EDF R&D
-//
-//
-//
-//  File   : qworkspaceP.h
-//  Author : Vadim SANDLER
-//  Module : SALOME
-//  $Header$
+/////////////////////////////////////////////////////////////////////////////
+// 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
index 580beb4456d356bdd65ce5f81ce786b52ba0506e..375a786b08b215df5467908c2bee466a19546172 100644 (file)
@@ -14,7 +14,8 @@ EXPORT_HEADERS = \
            Plot2d_ViewFrame.h \
            Plot2d_SetupViewDlg.h \
            Plot2d_SetupPlot2dDlg.h \
-           Plot2d_FitDataDlg.h
+           Plot2d_FitDataDlg.h \
+          Plot2d_Prs.h
 
 # .po files to transform in .qm
 #PO_FILES = \
@@ -29,7 +30,8 @@ LIB_SRC =       \
            Plot2d_ViewFrame.cxx \
            Plot2d_SetupViewDlg.cxx \
            Plot2d_SetupPlot2dDlg.cxx \
-           Plot2d_FitDataDlg.cxx
+           Plot2d_FitDataDlg.cxx \
+           Plot2d_Prs.cxx
 
 LIB_MOC = \
            Plot2d.h \
@@ -44,7 +46,7 @@ LIB_CLIENT_IDL = SALOMEDS.idl \
                 SALOME_Exception.idl
 
 CPPFLAGS+=$(QT_INCLUDES) $(OCC_INCLUDES) $(OGL_INCLUDES) $(PYTHON_INCLUDES) $(QWT_INCLUDES) 
-LDFLAGS+=$(QT_MT_LIBS) $(OGL_LIBS) $(QWT_LIBS) -lSalomeGUI
+LDFLAGS+=$(QT_MT_LIBS) $(OGL_LIBS) $(QWT_LIBS) -lSalomePrs -lSalomeGUI
 
 
 @CONCLUDE@
index f55104645e12add265756be029f9185a04ee65a1..b5267b086f3927d0bbb4bff6bf0a52a86ef2e0f4 100644 (file)
@@ -62,7 +62,7 @@ int Plot2d_CurveContainer::count()
 /*!
   Returns true if contains no curves
 */
-bool Plot2d_CurveContainer::isEmpty()
+bool Plot2d_CurveContainer::isEmpty() const
 {
   return myCurves.isEmpty();
 }
index 7cbf58f856824e186df7423b403b387fec593e68..ff5fdfcd85e0839b513f6130b925dae1cf525b00 100644 (file)
@@ -23,7 +23,7 @@ public:
   void                removeCurve( const int index, bool alsoDelete = false ) ;
   void                clear( bool alsoDelete = false );
   int                 count();
-  bool                isEmpty();
+  bool                isEmpty() const;
   Plot2d_Curve*       curve( const int index );
 
 private:
index 89d8a738a3925b4c7ee4a3a2556188d0310314f3..1a14428e4342113344092cb3cd6c453cb4478036 100644 (file)
 #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
@@ -107,10 +111,10 @@ Plot2d_SetupPlot2dDlg::Plot2d_SetupPlot2dDlg( SALOMEDS::SObject_var object, QWid
          frameLayout->addWidget( item->myVBtn,        row, 1 );
          frameLayout->addWidget( item->myTitleLab,    row, 3 );
          if ( rowTitles->length() > 0 )
-           item->myTitleLab->setText( QString( strdup( rowTitles[ i ] ) ) );
+           item->myTitleLab->setText( QString( rowTitles[ i ] ) );
          frameLayout->addWidget( item->myUnitLab,     row, 5 );
          if ( rowUnits->length() > 0 )
-           item->myUnitLab->setText( QString( strdup( rowUnits[ i ] ) ) );
+           item->myUnitLab->setText( QString( rowUnits[ i ] ) );
          frameLayout->addWidget( item->myAutoCheck,   row, 7 );
          frameLayout->addWidget( item->myLineCombo,   row, 8 );
          frameLayout->addWidget( item->myLineSpin,    row, 9 );
@@ -142,10 +146,10 @@ Plot2d_SetupPlot2dDlg::Plot2d_SetupPlot2dDlg( SALOMEDS::SObject_var object, QWid
          frameLayout->addWidget( item->myVBtn,        row, 1 );
          frameLayout->addWidget( item->myTitleLab,    row, 3 );
          if ( rowTitles->length() > 0 )
-           item->myTitleLab->setText( QString( strdup( rowTitles[ i ] ) ) );
+           item->myTitleLab->setText( QString( rowTitles[ i ] ) );
          frameLayout->addWidget( item->myUnitLab,     row, 5 );
          if ( rowUnits->length() > 0 )
-           item->myUnitLab->setText( QString( strdup( rowUnits[ i ] ) ) );
+           item->myUnitLab->setText( QString( rowUnits[ i ] ) );
          frameLayout->addWidget( item->myAutoCheck,   row, 7 );
          frameLayout->addWidget( item->myLineCombo,   row, 8 );
          frameLayout->addWidget( item->myLineSpin,    row, 9 );
@@ -272,13 +276,13 @@ void Plot2d_SetupPlot2dDlg::getCurves( Plot2d_CurveContainer& container )
          Plot2d_Curve* curve = new Plot2d_Curve();
          // curve titles
          if ( rowTitles->length() > 0 ) {
-           curve->setHorTitle( strdup( rowTitles[ horIndex ] ) );
-           curve->setVerTitle( strdup( rowTitles[ verIndex[i] ] ) );
+           curve->setHorTitle( QString( rowTitles[ horIndex ] ) );
+           curve->setVerTitle( QString( rowTitles[ verIndex[i] ] ) );
          }
          // curve units
          if ( rowUnits->length() > 0 ) {
-           curve->setHorUnits( strdup( rowUnits[ horIndex ] ) );
-           curve->setVerUnits( strdup( rowUnits[ verIndex[i] ] ) );
+           curve->setHorUnits( QString( rowUnits[ horIndex ] ) );
+           curve->setVerUnits( QString( rowUnits[ verIndex[i] ] ) );
          }
          // curve data
          int nbPoints = 0;
@@ -324,13 +328,13 @@ void Plot2d_SetupPlot2dDlg::getCurves( Plot2d_CurveContainer& container )
          Plot2d_Curve* curve = new Plot2d_Curve();
          // curve titles
          if ( rowTitles->length() > 0 ) {
-           curve->setHorTitle( strdup( rowTitles[ horIndex ] ) );
-           curve->setVerTitle( strdup( rowTitles[ verIndex[i] ] ) );
+           curve->setHorTitle( QString( rowTitles[ horIndex ] ) );
+           curve->setVerTitle( QString( rowTitles[ verIndex[i] ] ) );
          }
          // curve units
          if ( rowUnits->length() > 0 ) {
-           curve->setHorUnits( strdup( rowUnits[ horIndex ] ) );
-           curve->setVerUnits( strdup( rowUnits[ verIndex[i] ] ) );
+           curve->setHorUnits( QString( rowUnits[ horIndex ] ) );
+           curve->setVerUnits( QString( rowUnits[ verIndex[i] ] ) );
          }
          // curve data
          int nbPoints = 0;
index a2a03544d8c41f92f392ffed03988d26e8a2a8f3..53a7b3d920d9739d5e07a4a0bf527985123c3344 100644 (file)
@@ -9,6 +9,8 @@
 
 #include "Plot2d_ViewFrame.h"
 #include "Plot2d_SetupViewDlg.h"
+#include "Plot2d_Prs.h"
+
 #include "QAD_Desktop.h"
 #include "QAD_ResourceMgr.h"
 #include "QAD_FileDlg.h"
@@ -806,6 +808,7 @@ void Plot2d_ViewFrame::updateCurve( Plot2d_Curve* curve, bool update )
                                                   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 )
@@ -1713,3 +1716,81 @@ bool Plot2d_Plot2d::existMarker( const QwtSymbol::Style typeMarker, const QColor
   }
   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() );
+}
index 40e41b35786f1d1200f03a7e1e997abb8caa1bdb..04c87155c3e41817d99b090d64ea509c8b122532 100644 (file)
@@ -78,6 +78,13 @@ public:
   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 );
 
index c7a16048fff2da2d82fefc7feb17e40e96430070..d78d5150fbe4fb7cd494a550f6ddd41451e4a489 100644 (file)
@@ -134,9 +134,11 @@ RegWidget::RegWidget(CORBA::ORB_var &orb, QWidget *parent, const char *name )
   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() ) );
index e82e54a2326d5fd20c6073262c1397a09ee8c834..56517030131e784cc8a7eba8475a512f42339300 100755 (executable)
 //  Module : SALOME
 //$Header$
 
-using namespace std;
-#define WRITE_RESSOURCES_TYPE
 #include "SALOME_RessourcesCatalog_Handler.hxx"
 
+#include "utilities.h"
+
+using namespace std;
+
+ListOfParserressources _ressources_list;
+
 //----------------------------------------------------------------------
 //Function : SALOME_RessourcesCatalog_Handler
 //Purpose: Constructor
index eaae9def9e903b7924109a52d89c7d31b6b30f17..9e1b8e2f8d898c377c63ef2c41b982ec11e029e6 100755 (executable)
@@ -29,8 +29,8 @@
 #ifndef SALOME_RESSOURCES_CATALOG_HANDLER
 #define SALOME_RESSOURCES_CATALOG_HANDLER
 
-#include "utilities.h"
 #include "SALOME_RessourcesCatalog_Parser.hxx"
+
 #include <qxml.h>
 #include <string>
 #include <vector>
@@ -101,7 +101,7 @@ public :
 private :
   QString errorProt;
 
-  string content;
+  std::string content;
 
   const char* test_computer;
   const char* test_computer_name;
index b32e4c31204634a1418113ce6c0b5ba1f4c6aea1..107f5ee41014e5b97ebfdee502f1daa9ef4a3a82 100755 (executable)
 
 struct ParserProc{
     long Parsernumber;
-    string Parsermodel_name;
+    std::string Parsermodel_name;
     float Parsercpu_mhz;
     float Parsercache_size;
 };
 
-typedef vector<ParserProc> ListOfParserProc;
+typedef std::vector<ParserProc> ListOfParserProc;
 
 enum Parsercontainertype {Cpp, python, NP};
-typedef vector<Parsercontainertype> ListOfParserContainerType;
+typedef std::vector<Parsercontainertype> ListOfParserContainerType;
 
 struct Parserressources{
-  string Parsername;
-  string ParserOS;
-  string ParserOS_version;
+  std::string Parsername;
+  std::string ParserOS;
+  std::string ParserOS_version;
   ListOfParserProc Parserprocs;
   ListOfParserContainerType Parsercontainertype;
 };
 
-typedef vector<Parserressources> ListOfParserressources;
+typedef std::vector<Parserressources> ListOfParserressources;
 
-#ifdef WRITE_RESSOURCES_TYPE
-ListOfParserressources _ressources_list;
-#else
 extern ListOfParserressources _ressources_list;
-#endif
+
 
 #endif //SALOME_RESSOURCES_CATALOG_PARSER
index 11336f9ae384de57e40d78b7b56f6cceba751df0..a5f6b39e812d1c5b35177220d88a5d6b248f36ab 100644 (file)
@@ -115,7 +115,7 @@ BIN_CLIENT_IDL =
 
 CPPFLAGS+=$(OCC_INCLUDES) $(HDF5_INCLUDES)
 CXXFLAGS+=$(OCC_CXXFLAGS)
-LDFLAGS+= $(HDF5_LIBS) -lTOOLSDS -lSalomeNS -lSalomeHDFPersist -lOpUtil -lSALOMELocalTrace $(CAS_LDPATH) -lTKCAF -lTKStdSchema -lSalomeGenericObj -lSalomeLifeCycleCORBA
+LDFLAGS+= $(HDF5_LIBS) -lTOOLSDS -lSalomeNS -lSalomeHDFPersist -lOpUtil -lSALOMELocalTrace $(CAS_LDPATH) -lTKCAF -lTKBO -lTKStdSchema -lSalomeGenericObj -lSalomeLifeCycleCORBA
 
 # _CS_gbo_090604 Ajout Spécifique Calibre 3, pour l'utilisation de la version 5.12 de la bibliothèque OCC.
 # La bibliothèque OCC5.12 a été compilée sur Calibre 3 avec l'extention Xmu (impossible de compiler sans).
index f21ae9b3bac5cd014db15cf8d499f6ff79d40afc..5164435584efd3c8ab34125b4170be302caf41e1 100644 (file)
@@ -42,7 +42,7 @@ void SALOMEDS_AttributeDrawable_i::SetDrawable(CORBA::Boolean value) {
 }
 
 char* SALOMEDS_AttributeDrawable_i::Store() {
-  return strdup(IsDrawable()?"1":"0");
+  return CORBA::string_dup(IsDrawable()?"1":"0");
 }
 
 void SALOMEDS_AttributeDrawable_i::Restore(const char* value) {
index 98a0720cf9373f66644f80aa440b47bd8fadeb31..01679d0cab39dc8aea3c51d1c602b3d4a7a12fac 100644 (file)
@@ -41,7 +41,7 @@ void SALOMEDS_AttributeExpandable_i::SetExpandable(CORBA::Boolean value) {
 }
 
 char* SALOMEDS_AttributeExpandable_i::Store() {
-  return strdup(IsExpandable()?"1":"0");
+  return CORBA::string_dup(IsExpandable()?"1":"0");
 }
 
 void SALOMEDS_AttributeExpandable_i::Restore(const char* value) {
index e9ce976d42ec4465b7585083fd66883b20b00174..3dafade54d62f0f0cc9611c3835f13ad348c5123 100644 (file)
@@ -39,8 +39,9 @@ char* SALOMEDS_AttributeName_i::Value() {
 
 void SALOMEDS_AttributeName_i::SetValue(const char* value) {
   CheckLocked();
-  CORBA::String_var Str = CORBA::string_dup(value);
-  Handle(TDataStd_Name)::DownCast(_myAttr)->Set(TCollection_ExtendedString(Str));
+  //CORBA::String_var Str = CORBA::string_dup(value);
+  //Handle(TDataStd_Name)::DownCast(_myAttr)->Set(TCollection_ExtendedString(Str));
+  Handle(TDataStd_Name)::DownCast(_myAttr)->Set(TCollection_ExtendedString((char*)value));
 }
 
 char* SALOMEDS_AttributeName_i::Store() {
index cd4e87f17b70702f7349d72699e62c13e14f0d79..1c5808a596adab0909c184350053c7e2462858d1 100644 (file)
@@ -41,7 +41,7 @@ void SALOMEDS_AttributeOpened_i::SetOpened(CORBA::Boolean value) {
 }
 
 char* SALOMEDS_AttributeOpened_i::Store() {
-  return strdup(IsOpened()?"1":"0");
+  return CORBA::string_dup(IsOpened()?"1":"0");
 }
 
 void SALOMEDS_AttributeOpened_i::Restore(const char* value) {
index a02fa874eba13d2403b8cde375c32ec160dceb17..dde8e609309227431f18e75f2b877bcb01c64282 100644 (file)
@@ -40,6 +40,7 @@ char* SALOMEDS_AttributePythonObject_i::Store() {
 }
 
 void SALOMEDS_AttributePythonObject_i::Restore(const char* value) {
-  char* aString = strdup(value);
+  char* aString = CORBA::string_dup(value);
   SetObject(aString + 1, aString[0]=='s');
+  delete(aString);
 }
index c87b604865658a359067986694116db9a8323aee..62b52968025ae5f7fae37021754b4411db192463 100644 (file)
 //  Module : SALOME
 //  $Header$
 
-using namespace std;
 #include "SALOMEDS_AttributeReal_i.hxx"
 #include "SALOMEDS_SObject_i.hxx"
+#include <sstream>
+
+using namespace std;
+
+static const char* write_double(double value)
+{
+  std::ostringstream os;
+  unsigned char* array = (unsigned char*)&value;
+  for(int i = 0; i < sizeof(double); i++) {
+    unsigned tmp = (unsigned short)array[i];
+    os << " " << tmp;
+  }
+  return os.str().c_str();
+}
+
+static double read_double(const char* str)
+{
+  std::istringstream is(str);
+  double value;
+  unsigned char* array = (unsigned char*)(&value);
+  for(int i = 0; i < sizeof(double); i++) {
+    unsigned tmp;
+    is >> tmp;
+    array[i] = (unsigned char)tmp;
+  }
+  return value;
+}
 
 CORBA::Double SALOMEDS_AttributeReal_i::Value() {
   return Handle(TDataStd_Real)::DownCast(_myAttr)->Get();
@@ -40,13 +66,16 @@ void SALOMEDS_AttributeReal_i::SetValue(CORBA::Double value) {
 }
 
 char* SALOMEDS_AttributeReal_i::Store() {
-  char* RealVal = new char[25];
-  sprintf(RealVal, "%f", Value());
-  return RealVal;
+  //  char* RealVal = new char[35];
+  //  sprintf(RealVal, "%.20f", Value());
+  //return RealVal;
+  return (char*)write_double( (double)Value() );
 }
 
 void SALOMEDS_AttributeReal_i::Restore(const char* value) {
-  char *err = NULL;
-  CORBA::Double r =  strtod(value, &err);
-  if (err != value) SetValue(r);
+  //char *err = NULL;
+  //CORBA::Double r =  strtod(value, &err);
+  //if (err != value) SetValue(r);
+  SetValue( read_double(value) );
 }
+
index fd9fa7ad2bc7a5399e88137d7933da2f3e43e26d..c18334aea5d0060e1d2e89dea84f3c3663190228 100644 (file)
@@ -41,7 +41,7 @@ void SALOMEDS_AttributeSelectable_i::SetSelectable(CORBA::Boolean value) {
 }
 
 char* SALOMEDS_AttributeSelectable_i::Store() {
-  return strdup(IsSelectable()?"1":"0");
+  return CORBA::string_dup(IsSelectable()?"1":"0");
 }
 
 void SALOMEDS_AttributeSelectable_i::Restore(const char* value) {
index 703810bc5b3cb72335324173e440eda70b53de7d..28748f7532f3d7e10051ba5b1da00bd0b3d2ae6b 100644 (file)
@@ -97,7 +97,7 @@ char* SALOMEDS_AttributeSequenceOfInteger_i::Store() {
 void SALOMEDS_AttributeSequenceOfInteger_i::Restore(const char* value) {
   Handle(TColStd_HSequenceOfInteger) CasCadeSeq = new TColStd_HSequenceOfInteger;
   
-  char* aCopy = strdup(value);
+  char* aCopy = CORBA::string_dup(value);
   char* adr = strtok(aCopy, " ");
   while (adr) {
     CORBA::Long l =  atol(adr);
index d7f480a160c7c86fd72fa6fb241a0fc2bf4001de..a88637f6a01504d802670375554cd3fafdb5a1b9 100644 (file)
@@ -96,7 +96,7 @@ char* SALOMEDS_AttributeSequenceOfReal_i::Store() {
 void SALOMEDS_AttributeSequenceOfReal_i::Restore(const char* value) {
   Handle(TColStd_HSequenceOfReal) CasCadeSeq = new TColStd_HSequenceOfReal;
   
-  char* aCopy = strdup(value);
+  char* aCopy =  CORBA::string_dup(value);
   char* adr = strtok(aCopy, " ");
   char *err = NULL;
   while (adr) {
index 9b2b8912c8f29a590098a3e65dd049e76d104ac9..8444beca918760d90dd3909b6e171292b794c439 100644 (file)
@@ -22,7 +22,7 @@ using namespace std;
 void SALOMEDS_AttributeStudyProperties_i::SetUserName(const char* theName) {
   CheckLocked();
   Handle(SALOMEDS_StudyPropertiesAttribute) aProp = Handle(SALOMEDS_StudyPropertiesAttribute)::DownCast(_myAttr);
-  aProp->SetFirstName(TCollection_ExtendedString(strdup(theName)));
+  aProp->SetFirstName((char*)theName);
 }
 
 char* SALOMEDS_AttributeStudyProperties_i::GetUserName() {
@@ -111,7 +111,7 @@ void SALOMEDS_AttributeStudyProperties_i::SetModification(const char* theName,
                                                          CORBA::Long theYear) {
   CheckLocked();
   Handle(SALOMEDS_StudyPropertiesAttribute) aProp = Handle(SALOMEDS_StudyPropertiesAttribute)::DownCast(_myAttr);
-  aProp->SetUserName(strdup(theName));
+  aProp->SetUserName((char*)theName);
   aProp->SetModificationDate((int)theMinute, (int)theHour, (int)theDay, (int)theMonth, (int)theYear);
 }
 void SALOMEDS_AttributeStudyProperties_i::GetModificationsList(SALOMEDS::StringSeq_out theNames,
@@ -185,7 +185,7 @@ char* SALOMEDS_AttributeStudyProperties_i::Store() {
 }
 
 void SALOMEDS_AttributeStudyProperties_i::Restore(const char* value) {
-  char* aCopy = strdup(value);
+  char* aCopy = CORBA::string_dup(value);
   if (aCopy[0] == 'f') SetCreationMode("from scratch");
   else if (aCopy[0] == 'c') SetCreationMode("copy from");
   else SetCreationMode("none");
index 6e575f1310ff8b49f490d352e8159e49c5457041..e37bd2a9bd884043df6e9ddb26a4e3767be137d9 100644 (file)
@@ -204,7 +204,7 @@ void SALOMEDS_AttributeTreeNode_i::Restore(const char* value) {
   Handle(TDataStd_TreeNode) aNode = Handle(TDataStd_TreeNode)::DownCast(_myAttr);
   Handle(TDF_Data) DF = TDocStd_Document::Get(_myAttr->Label())->GetData();
   
-  char* aCopy = strdup(value);
+  char* aCopy = CORBA::string_dup(value);
   char* adr = strtok(aCopy, " ");
   
   TDF_Label aLabel;
@@ -236,4 +236,5 @@ void SALOMEDS_AttributeTreeNode_i::Restore(const char* value) {
     if (!aLabel.FindAttribute(aNode->ID(), aDepNode)) aDepNode = TDataStd_TreeNode::Set(aLabel, aNode->ID());
     aNode->SetFirst(aDepNode);
   }
+  delete(aCopy);
 }
index 2ea8c97fe54b166a3d31fe3a3012520ac7abfbf2..2e4af4382fb204d4e83330260e36158b866d7a27 100644 (file)
@@ -62,13 +62,13 @@ public:
 
 // defines for creation attributes objects
 
-//cout<<"*** Create new CORBA attribute for "<<#CORBA_Name<<endl;
+//MESSAGE("*** Create new CORBA attribute for "<<#CORBA_Name);
 #define __ReturnCORBAAttribute(OCAF_Name, CORBA_Name) if (theAttr->ID() == OCAF_Name::GetID()) { \
     SALOMEDS_##CORBA_Name##_i* Attr = new SALOMEDS_##CORBA_Name##_i(Handle(OCAF_Name)::DownCast(theAttr), theOrb); \
     return Attr->CORBA_Name::_this(); \
   }
 
-//cout<<"Create New Attribute "<<#CORBA_Name<<endl;
+//MESSAGE("Create New Attribute "<<#CORBA_Name);
 #define __FindOrCreateAttribute(OCAF_Name, CORBA_Name) if (strcmp(aTypeOfAttribute, #CORBA_Name) == 0) { \
     Handle(OCAF_Name) anAttr; \
     if (!Lab.FindAttribute(OCAF_Name::GetID(), anAttr)) { \
@@ -79,7 +79,7 @@ public:
     return Attr->CORBA_Name::_this(); \
   }
 
-//cout<<"Create New Attribute "<<#CORBA_Name<<endl;
+//MESSAGE("Create New Attribute "<<#CORBA_Name);
 #define __FindOrCreateAttributeLocked(OCAF_Name, CORBA_Name) if (strcmp(aTypeOfAttribute, #CORBA_Name) == 0) { \
     Handle(OCAF_Name) anAttr; \
     if (!Lab.FindAttribute(OCAF_Name::GetID(), anAttr)) { \
index 896859cca1bd7bb366e8d213a7dbe9aa3113bd20..15b066e5ec96f4c7c3d1933c6d506b508a499a99 100644 (file)
@@ -87,7 +87,7 @@ CORBA::Boolean SALOMEDS_SComponent_i::ComponentIOR(CORBA::String_out IOR)
   if (!_lab.FindAttribute(SALOMEDS_IORAttribute::GetID(),ior) )
       return false;
   TCollection_AsciiString ch(ior->Get());
-  IOR = strdup(ch.ToCString());
+  IOR = CORBA::string_dup(ch.ToCString());
   return true;
 }
   
index 25cb25ac7f4416f99146fa250f5d2b2034c6a10a..42971688602e8cdf6fdb5fc0fb61264fd73500c1 100644 (file)
@@ -233,6 +233,16 @@ CORBA::Short SALOMEDS_SObject_i::Tag()
   return _lab.Tag();
 }
 
+//============================================================================
+/*! Function :
+ *  Purpose  : 
+ */
+//============================================================================
+CORBA::Short SALOMEDS_SObject_i::Depth()
+{
+  return _lab.Depth();
+}
+
 //============================================================================
 /*! Function :
  *  Purpose  : 
index fa0fa58dc6edc89fd589c6830910b0b1f06ecb9d..67ab9d9ba006b6ccff516fc3bf90de5486a25e94 100644 (file)
@@ -87,6 +87,7 @@ public:
   virtual char* GetIOR();
 
   virtual CORBA::Short Tag();
+  virtual CORBA::Short Depth();
 
   static char* AttributeIDToType(Standard_GUID);
   
index 64eba6c88b5fb489cfb825d0529b119f7904a5f0..47bfde5ae180fd1a8e54c909372ce52330b818a4 100644 (file)
@@ -457,16 +457,10 @@ void SALOMEDS_StudyBuilder_i::LoadWith(SALOMEDS::SComponent_ptr anSCO,
          aDriver->Load(anSCO, aStreamFile.in(), aDir, aMultifileState[0]=='M');
       if(!aResult) {
        RemoveAttribute( anSCO, "AttributeIOR" );
-       if (isASCII) {
-         SALOMEDS::ListOfFileNames_var aFilesToRemove = new SALOMEDS::ListOfFileNames;
-         aFilesToRemove->length(1);
-         aFilesToRemove[0] = CORBA::string_dup(&(aHDFUrl[strlen(SALOMEDS_Tool::GetDirFromPath(aHDFUrl))]));
-         SALOMEDS_Tool::RemoveTemporaryFiles(SALOMEDS_Tool::GetDirFromPath(aHDFUrl), aFilesToRemove, true);
-       }
-       delete aHDFUrl;
+
        MESSAGE("Can't load component");
-       THROW_SALOME_CORBA_EXCEPTION("Unable to load component data",SALOME::BAD_PARAM);
-         //    throw HDFexception("Unable to load component");
+       //THROW_SALOME_CORBA_EXCEPTION("Unable to load component data",SALOME::BAD_PARAM);
+       throw HDFexception("Unable to load component");
       }
       
       delete(aDir);
@@ -485,8 +479,8 @@ void SALOMEDS_StudyBuilder_i::LoadWith(SALOMEDS::SComponent_ptr anSCO,
       if (isASCII) {
        SALOMEDS::ListOfFileNames_var aFilesToRemove = new SALOMEDS::ListOfFileNames;
        aFilesToRemove->length(1);
-       aFilesToRemove[0] = CORBA::string_dup(&(aHDFUrl[strlen(SALOMEDS_Tool::GetDirFromPath(aHDFUrl))]));
-       SALOMEDS_Tool::RemoveTemporaryFiles(SALOMEDS_Tool::GetDirFromPath(aHDFUrl), aFilesToRemove, true);
+       aFilesToRemove[0] = CORBA::string_dup(&(aHDFUrl[strlen(SALOMEDS_Tool::GetDirFromPath(aHDFUrl).c_str())]));
+       SALOMEDS_Tool::RemoveTemporaryFiles(SALOMEDS_Tool::GetDirFromPath(aHDFUrl).c_str(), aFilesToRemove, true);
       }
       delete aHDFUrl;
     }
@@ -496,12 +490,12 @@ void SALOMEDS_StudyBuilder_i::LoadWith(SALOMEDS::SComponent_ptr anSCO,
       if (isASCII) {
        SALOMEDS::ListOfFileNames_var aFilesToRemove = new SALOMEDS::ListOfFileNames;
        aFilesToRemove->length(1);
-       aFilesToRemove[0] = CORBA::string_dup(&(aHDFUrl[strlen(SALOMEDS_Tool::GetDirFromPath(aHDFUrl))]));
-       SALOMEDS_Tool::RemoveTemporaryFiles(SALOMEDS_Tool::GetDirFromPath(aHDFUrl), aFilesToRemove, true);
+       aFilesToRemove[0] = CORBA::string_dup(&(aHDFUrl[strlen(SALOMEDS_Tool::GetDirFromPath(aHDFUrl).c_str())]));
+       SALOMEDS_Tool::RemoveTemporaryFiles(SALOMEDS_Tool::GetDirFromPath(aHDFUrl).c_str(), aFilesToRemove, true);
       }
       delete aHDFUrl;
       if (aLocked) anSCO->GetStudy()->GetProperties()->SetLocked(true);
-      return;
+      THROW_SALOME_CORBA_EXCEPTION("No persistent file Name found",SALOME::BAD_PARAM);   
     }
     
     try {
@@ -689,13 +683,15 @@ void SALOMEDS_StudyBuilder_i::RemoveReference(SALOMEDS::SObject_ptr me)
 
   Lab.ForgetAttribute(TDF_Reference::GetID());  
 
-  TDF_Label RefLab;  
+  //SRN: 30 Aug, 2004 : fix from Ecole l'ete version 
+
+  TDF_Label RefLab;
   ASSERT(!CORBA::is_nil(theReferencedObject));
   CORBA::String_var roid = theReferencedObject->GetID();
   TDF_Tool::Label(_doc->GetData(),roid,RefLab);
-
-  RemoveAttribute(theReferencedObject, "AttributeTarget");
-  //if(!CORBA::is_nil(_callbackOnRemove) && Lab.IsDescendant(_doc->Main())) _callbackOnRemove->OnRemoveSObject(me);
+       
+  Handle(SALOMEDS_TargetAttribute) aTarget;
+  if(RefLab.FindAttribute(SALOMEDS_TargetAttribute::GetID(), aTarget)) aTarget->Remove(Lab);
 }
 
 
@@ -849,7 +845,7 @@ void SALOMEDS_StudyBuilder_i::CommitCommand() throw (SALOMEDS::StudyBuilder::Loc
 //============================================================================
 CORBA::Boolean SALOMEDS_StudyBuilder_i::HasOpenCommand()
 {
-  _doc->HasOpenCommand();
+  return _doc->HasOpenCommand();
 }
 
 //============================================================================
index 222a6fe2738dfc0e7bd43a235d56cb0c5f4a0b3a..0f4a38c99d44ec05088deacaccfeb5934faff9e1 100644 (file)
@@ -278,7 +278,7 @@ SALOMEDS::Study_ptr SALOMEDS_StudyManager_i::NewStudy(const char* study_name)
 
   // Assign the value of the IOR in the study->root
   const char*  IORStudy = _orb->object_to_string(Study);
-  SALOMEDS_IORAttribute::Set(Doc->Main().Root(),TCollection_ExtendedString(strdup(IORStudy)),_orb);
+  SALOMEDS_IORAttribute::Set(Doc->Main().Root(),TCollection_ExtendedString((char*)IORStudy),_orb);
 
   // set Study properties
   SALOMEDS::AttributeStudyProperties_ptr aProp = Study->GetProperties();
@@ -315,7 +315,7 @@ SALOMEDS::Study_ptr  SALOMEDS_StudyManager_i::Open(const char* aUrl)
     sprintf(aHDFUrl, "%shdf_from_ascii.hdf", aResultPath);
     delete(aResultPath);
   } else {
-    aHDFUrl = strdup(aUrl);
+    aHDFUrl = CORBA::string_dup(aUrl);
   }
 
   hdf_file = new HDFfile(aHDFUrl);
@@ -354,7 +354,7 @@ SALOMEDS::Study_ptr  SALOMEDS_StudyManager_i::Open(const char* aUrl)
   SALOMEDS_IORAttribute::Set(Doc->Main().Root(),
                             TCollection_ExtendedString(CORBA::string_dup(IORStudy)),_orb);
 
-  SALOMEDS_PersRefAttribute::Set(Doc->Main(),strdup(aUrl)); 
+  SALOMEDS_PersRefAttribute::Set(Doc->Main(),(char*)aUrl); 
 
   if (!hdf_file->ExistInternalObject("STUDY_STRUCTURE")) {
     delete aHDFUrl;
@@ -391,8 +391,8 @@ SALOMEDS::Study_ptr  SALOMEDS_StudyManager_i::Open(const char* aUrl)
   if (isASCII) {
     SALOMEDS::ListOfFileNames_var aFilesToRemove = new SALOMEDS::ListOfFileNames;
     aFilesToRemove->length(1);
-    aFilesToRemove[0] = strdup(&(aHDFUrl[strlen(SALOMEDS_Tool::GetDirFromPath(aHDFUrl))]));
-    SALOMEDS_Tool::RemoveTemporaryFiles(SALOMEDS_Tool::GetDirFromPath(aHDFUrl), aFilesToRemove, true);
+    aFilesToRemove[0] = CORBA::string_dup(&(aHDFUrl[strlen(SALOMEDS_Tool::GetDirFromPath(aHDFUrl).c_str())]));
+    SALOMEDS_Tool::RemoveTemporaryFiles(SALOMEDS_Tool::GetDirFromPath(aHDFUrl).c_str(), aFilesToRemove, true);
   }
   delete aHDFUrl;
   delete hdf_file; // all related hdf objects will be deleted
@@ -583,20 +583,20 @@ static void SaveAttributes(SALOMEDS::SObject_ptr SO, HDFgroup *hdf_group_sobject
     if (strcmp(anAttrList[a]->Type(), "AttributeIOR") == 0) continue; // never write AttributeIOR to file
     if (strcmp(anAttrList[a]->Type(), "AttributeExternalFileDef") == 0) continue; // never write ExternalFileDef to file
     if (strcmp(anAttrList[a]->Type(), "AttributeFileType") == 0) continue; // never write FileType to file
-    CORBA::String_var aSaveStr = strdup(anAttrList[a]->Store());
+    CORBA::String_var aSaveStr = CORBA::string_dup(anAttrList[a]->Store());
     size[0] = (hdf_int32) strlen(aSaveStr) + 1;
     HDFdataset *hdf_dataset = new HDFdataset(anAttrList[a]->Type(),hdf_group_sobject,HDF_STRING,size,1);
     hdf_dataset->CreateOnDisk();
     hdf_dataset->WriteOnDisk(aSaveStr);
     hdf_dataset->CloseOnDisk();
-    //cout<<"********** Write Attribute "<<anAttrList[a]->Type()<<" : "<<aSaveStr<<" done"<<endl;
+    //MESSAGE("********** Write Attribute "<<anAttrList[a]->Type()<<" : "<<aSaveStr<<" done");
     hdf_dataset=0; //will be deleted by hdf_sco_group destructor
   }
 
   // Reference attribute has no CORBA attribute representation, so, GetAllAttributes can not return this attribute
   SALOMEDS::SObject_var RefSO;
   if(SO->ReferencedObject(RefSO)) {
-    CORBA::String_var attribute_reference = strdup(RefSO->GetID());
+    CORBA::String_var attribute_reference = CORBA::string_dup(RefSO->GetID());
     size[0] = strlen(attribute_reference) + 1 ; 
     HDFdataset *hdf_dataset = new HDFdataset("Reference",hdf_group_sobject,HDF_STRING,size,1);
     hdf_dataset->CreateOnDisk();
@@ -668,7 +668,8 @@ void SALOMEDS_StudyManager_i::_SaveProperties(SALOMEDS::Study_ptr aStudy, HDFgro
   MESSAGE("attribute StudyProperties " <<  aProperty << " wrote on file");
   hdf_dataset->CloseOnDisk();
   hdf_dataset=0; //will be deleted by hdf_sco_group destructor
-  delete(aProperty);
+  //delete(aProperty); 
+  delete [] aProperty;
   aProp->SetModified(0);
 }
 
@@ -717,28 +718,26 @@ void SALOMEDS_StudyManager_i::_SaveAs(const char* aUrl,
       for (; itcomponent1->More(); itcomponent1->Next())
        {
          SALOMEDS::SComponent_var sco = itcomponent1->Value();
+
          // if there is an associated Engine call its method for saving
          CORBA::String_var IOREngine;
          try {
-           
            if (!sco->ComponentIOR(IOREngine)) {
              SALOMEDS::GenericAttribute_var aGeneric;
-             SALOMEDS::AttributeName_var aName;
-             if(sco->FindAttribute(aGeneric, "AttributeName"))
-               aName = SALOMEDS::AttributeName::_narrow(aGeneric);
-
+             SALOMEDS::AttributeComment_var aName;
+             if(sco->FindAttribute(aGeneric, "AttributeComment"))
+               aName = SALOMEDS::AttributeComment::_narrow(aGeneric);
+           
              if (!aName->_is_nil()) {
                
                CORBA::String_var aCompType = aName->Value();
 
-               
                CORBA::String_var aFactoryType;
                if (strcmp(aCompType, "SUPERV") == 0) aFactoryType = "SuperVisionContainer";
                else aFactoryType = "FactoryServer";
                
                Engines::Component_var aComp =
                  SALOME_LifeCycleCORBA(_name_service).FindOrLoad_Component(aFactoryType, aCompType);
-               
                if (aComp->_is_nil()) {
                  Engines::Component_var aComp =
                    SALOME_LifeCycleCORBA(_name_service).FindOrLoad_Component("FactoryServerPy", aCompType);
@@ -842,8 +841,8 @@ void SALOMEDS_StudyManager_i::_SaveAs(const char* aUrl,
 
                  SALOMEDS::TMPFile_var aStream;
 
-                  if (theASCII) aStream = Engine->SaveASCII(sco,SALOMEDS_Tool::GetDirFromPath(aUrl),theMultiFile);
-                 else aStream = Engine->Save(sco,SALOMEDS_Tool::GetDirFromPath(aUrl),theMultiFile);
+                  if (theASCII) aStream = Engine->SaveASCII(sco,SALOMEDS_Tool::GetDirFromPath(aUrl).c_str(),theMultiFile);
+                 else aStream = Engine->Save(sco,SALOMEDS_Tool::GetDirFromPath(aUrl).c_str(),theMultiFile);
 
                  HDFdataset *hdf_dataset;
                  hdf_size aHDFSize[1];
@@ -1006,7 +1005,7 @@ void SALOMEDS_StudyManager_i::_SaveObject(SALOMEDS::Study_ptr aStudy,
        }
       }
 
-      CORBA::String_var scoid = strdup(SO->GetID());
+      CORBA::String_var scoid = CORBA::string_dup(SO->GetID());
       hdf_group_sobject = new HDFgroup(scoid,hdf_group_datatype);
       hdf_group_sobject->CreateOnDisk();
       SaveAttributes(SO, hdf_group_sobject);
@@ -1031,7 +1030,7 @@ const char *SALOMEDS_StudyManager_i::_SubstituteSlash(const char *aUrl)
   Standard_ExtCharacter val2 = ToExtCharacter(':');
   theUrl.ChangeAll(val1,val2);
   TCollection_AsciiString ch(theUrl);
-  return strdup(ch.ToCString());
+  return CORBA::string_dup(ch.ToCString());
 }
 
 //============================================================================
@@ -1122,7 +1121,7 @@ void SALOMEDS_StudyManager_i::CopyLabel(const SALOMEDS::Study_ptr theSourceStudy
     if (!Handle(SALOMEDS_IORAttribute)::DownCast(anAttr).IsNull()) { // IOR => ID and TMPFile of Engine
       TCollection_AsciiString anEntry;
       TDF_Tool::Entry(theSource, anEntry);
-      SALOMEDS::SObject_var aSO = theSourceStudy->FindObjectID(strdup(anEntry.ToCString()));
+      SALOMEDS::SObject_var aSO = theSourceStudy->FindObjectID(anEntry.ToCString());
 //        if (theEngine->CanCopy(aSO)) {
        CORBA::Long anObjID;
 //     TCollection_ExtendedString aResStr(strdup((char*)(theEngine->CopyFrom(aSO, anObjID))));
@@ -1176,14 +1175,15 @@ CORBA::Boolean SALOMEDS_StudyManager_i::Copy(SALOMEDS::SObject_ptr theObject) {
   // set component data type to the name attribute of root label
   if (!aStructureOnly) {
     TDataStd_Comment::Set(aTargetDocument->Main().Root(),
-                         TCollection_ExtendedString(strdup(Engine->ComponentDataType())));
+                         TCollection_ExtendedString(Engine->ComponentDataType()));
   }
   // set to the Root label integer attribute: study id
   TDataStd_Integer::Set(aTargetDocument->Main().Root(), aStudy->StudyId());
   // iterate all theObject's label children
   TDF_Label aStartLabel;
-  char* aStartID = strdup(theObject->GetID());
+  char* aStartID = CORBA::string_dup(theObject->GetID());
   TDF_Tool::Label(aDocument->GetData(), aStartID, aStartLabel);
+  delete(aStartID);
   Standard_Integer aSourceStartDepth = aStartLabel.Depth();
   
   // copy main source label
@@ -1230,7 +1230,7 @@ CORBA::Boolean SALOMEDS_StudyManager_i::CanPaste(SALOMEDS::SObject_ptr theObject
   CORBA::Object_var obj = _orb->string_to_object(IOREngine);
   SALOMEDS::Driver_var Engine = SALOMEDS::Driver::_narrow(obj) ;
   if (CORBA::is_nil(Engine)) return false;
-  return Engine->CanPaste(strdup(TCollection_AsciiString(aCompName->Get()).ToCString()), anObjID->Get());
+  return Engine->CanPaste(TCollection_AsciiString(aCompName->Get()).ToCString(), anObjID->Get());
 }
 //============================================================================
 /*! Function : PasteLabel
@@ -1265,7 +1265,7 @@ TDF_Label SALOMEDS_StudyManager_i::PasteLabel(const SALOMEDS::Study_ptr theDesti
     aAuxSourceLabel.FindAttribute(TDataStd_Integer::GetID(), anObjID);
     Handle(TDataStd_Comment) aComponentName;
     theSource.Root().FindAttribute(TDataStd_Comment::GetID(), aComponentName);
-    CORBA::String_var aCompName = strdup(TCollection_AsciiString(aComponentName->Get()).ToCString());
+    CORBA::String_var aCompName = CORBA::string_dup(TCollection_AsciiString(aComponentName->Get()).ToCString());
 
     if (theEngine->CanPaste(aCompName, anObjID->Get())) {
       SALOMEDS::TMPFile_var aTMPFil = new SALOMEDS::TMPFile();
@@ -1281,7 +1281,7 @@ TDF_Label SALOMEDS_StudyManager_i::PasteLabel(const SALOMEDS::Study_ptr theDesti
       
       TCollection_AsciiString anEntry;
       TDF_Tool::Entry(aTargetLabel, anEntry);
-      SALOMEDS::SObject_var aPastedSO = theDestinationStudy->FindObjectID(strdup(anEntry.ToCString()));
+      SALOMEDS::SObject_var aPastedSO = theDestinationStudy->FindObjectID(anEntry.ToCString());
       if (isFirstElement) {
        SALOMEDS::SObject_var aDestSO =
          theEngine->PasteInto(aTMPFil.in(),
@@ -1325,7 +1325,7 @@ TDF_Label SALOMEDS_StudyManager_i::PasteLabel(const SALOMEDS::Study_ptr theDesti
       if (aNameStart) TDataStd_Name::Set(aTargetLabel, aNameStart);
       else TDataStd_Name::Set(aTargetLabel, TCollection_ExtendedString("Reference to:")+anEntry);
     }
-    delete(anEntry);
+    delete [] anEntry;
   }
 
   return aTargetLabel;
index 737f1f752fde4b23930e765f300b65ef56a371a0..d3a3ab2e51b180b1bc80ae8bf23cb43b99a47a9a 100644 (file)
@@ -18,7 +18,7 @@ using namespace std;
 
 const Standard_GUID& SALOMEDS_TableOfStringAttribute::GetID() 
 {
-  static Standard_GUID SALOMEDS_TableOfStringAttributeID ("128371A2-8F52-11d6-A8A3-0001021E8C7F");
+  static Standard_GUID SALOMEDS_TableOfStringAttributeID ("128371A4-8F52-11d6-A8A3-0001021E8C7F");
   return SALOMEDS_TableOfStringAttributeID;
 }
 
@@ -332,8 +332,9 @@ void SALOMEDS_TableOfStringAttribute::ConvertToString(ostrstream& theStream)
     if (anIterator.Value().Length()) { // check empty string in the value table
       theStream << anIterator.Key() << "\n";
       unsigned long aValueSize = anIterator.Value().Length();
-      theStream.write((char*)&aValueSize, sizeof(unsigned long));
+      theStream<<aValueSize << "\n";
       theStream.write((TCollection_AsciiString(anIterator.Value()).ToCString()),aValueSize);
+      theStream<<"\n";
     } else { // write index only of kind: "0key"; "05", for an example
       theStream << "0" << anIterator.Key() << "\n";
     }
@@ -409,8 +410,10 @@ bool SALOMEDS_TableOfStringAttribute::RestoreFromString(istrstream& theStream)
       aValue = "";
     else {
       unsigned long aValueSize;
-      theStream.read((char*)&aValueSize, sizeof(unsigned long));
+      theStream >> aValueSize;
+      theStream.read(aValueString, 1); // an '\n' omitting
       theStream.read(aValueString, aValueSize);
+      theStream.read(aValueString, 1); // an '\n' omitting
       aValue = aValueString;
     }
     myTable.Bind(aKey, aValue);
index 004fd69730542957f50a03b369bd426c61d10777..9e623b8b1b16466ee78d511787fab97e4276e046 100644 (file)
@@ -77,6 +77,8 @@ void SALOMEDS_TargetAttribute::Append(TDF_Label& theReferencedObject) {
   Backup();
   Handle(TDF_Reference) aReference;
   if (theReferencedObject.FindAttribute(TDF_Reference::GetID(),aReference)) {
+    TDF_ListIteratorOfAttributeList anIter(GetVariables());
+    for(;anIter.More();anIter.Next()) if(anIter.Value()->Label() == theReferencedObject) return; //BugID: PAL6192    
     GetVariables().Append(aReference);
   } else {
     MESSAGE("SALOMEDS_TargetAttribute::Append: can't append referenced object");
diff --git a/src/SALOMEDS/SALOMEDS_Tool.cxx b/src/SALOMEDS/SALOMEDS_Tool.cxx
deleted file mode 100644 (file)
index 341ba99..0000000
+++ /dev/null
@@ -1,306 +0,0 @@
-//  SALOME SALOMEDS : data structure of SALOME and sources of Salome data server 
-//
-//  Copyright (C) 2003  CEA/DEN, EDF R&D
-//
-//
-//
-//  File   : SALOMEDS_Tool.cxx
-//  Author : Sergey RUIN
-//  Module : SALOME
-
-using namespace std;
-#include "SALOMEDS_Tool.hxx"
-
-#include "utilities.h"
-
-#include <TCollection_AsciiString.hxx> 
-#include <stdio.h>
-#include <iostream.h> 
-#include <fstream.h>
-#include <OSD_Path.hxx>
-#include <OSD_File.hxx>
-#include <OSD_Directory.hxx>
-#include <OSD_Process.hxx>
-#include <OSD_Directory.hxx>
-#include <OSD_Protection.hxx>
-#include <OSD_SingleProtection.hxx>
-#include <OSD_FileIterator.hxx>
-
-#include <sys/time.h>
-#include <stdlib.h>
-
-//============================================================================
-// function : GetTempDir
-// purpose  : Return a temp directory to store created files like "/tmp/sub_dir/" 
-//============================================================================ 
-char* SALOMEDS_Tool::GetTmpDir()
-{
-  //Find a temporary directory to store a file
-
-  TCollection_AsciiString aTmpDir;
-
-  char *Tmp_dir = getenv("SALOME_TMP_DIR");
-  if(Tmp_dir != NULL) {
-    aTmpDir = TCollection_AsciiString(Tmp_dir);
-#ifdef WIN32
-    if(aTmpDir.Value(aTmpDir.Length()) != '\\') aTmpDir+='\\';
-#else
-    if(aTmpDir.Value(aTmpDir.Length()) != '/') aTmpDir+='/';
-#endif      
-  }
-  else {
-#ifdef WIN32
-    aTmpDir = TCollection_AsciiString("C:\\");
-#else
-    aTmpDir = TCollection_AsciiString("/tmp/");
-#endif
-  }
-
-  srand((unsigned int)time(NULL));
-  int aRND = 999 + (int)(100000.0*rand()/(RAND_MAX+1.0)); //Get a random number to present a name of a sub directory
-  TCollection_AsciiString aSubDir(aRND);
-  if(aSubDir.Length() <= 1) aSubDir = TCollection_AsciiString("123409876");
-
-  MESSAGE("#### RND "  << aRND);
-
-  aTmpDir += aSubDir; //Get RND sub directory
-
-#ifdef WIN32
-  if(aTmpDir.Value(aTmpDir.Length()) != '\\') aTmpDir+='\\';
-#else
-  if(aTmpDir.Value(aTmpDir.Length()) != '/') aTmpDir+='/';
-#endif
-
-  OSD_Path aPath(aTmpDir);
-  OSD_Directory aDir(aPath);
-
-  for(aRND = 0; aDir.Exists(); aRND++) {
-    aTmpDir.Insert((aTmpDir.Length() - 1), TCollection_AsciiString(aRND));  //Build a unique directory name
-    aPath = OSD_Path(aTmpDir);
-    aDir = OSD_Directory(aPath);
-  }
-
-  MESSAGE("#### TMP" << aTmpDir.ToCString());
-
-  OSD_Protection aProtection(OSD_RW, OSD_RWX, OSD_RX, OSD_RX);
-  aDir.Build(aProtection);
-
-  return CORBA::string_dup(aTmpDir.ToCString());
-}
-
-//============================================================================
-// function : RemoveTemporaryFiles
-// purpose  : Removes files listed in theFileList
-//============================================================================
-void SALOMEDS_Tool::RemoveTemporaryFiles(const char* theDirectory, 
-                                        const SALOMEDS::ListOfFileNames& theFiles,
-                                        const bool IsDirDeleted)
-{
-  TCollection_AsciiString aDirName(const_cast<char*>(theDirectory));
-
-  int i, aLength = theFiles.length();
-  for(i=0; i<aLength; i++) {
-    TCollection_AsciiString aFile(aDirName);
-//     aFile += (char*)theFiles[i];
-    aFile += (char*)theFiles[i].in();
-    OSD_Path anOSDPath(aFile);
-    OSD_File anOSDFile(anOSDPath);
-    if(!anOSDFile.Exists()) continue;
-
-    anOSDFile.Remove();
-  }
-
-  if(IsDirDeleted) {
-    OSD_Path aPath(aDirName);
-    OSD_Directory aDir(aPath);
-    OSD_FileIterator anIterator(aPath, '*');
-
-    if(aDir.Exists() && !anIterator.More()) aDir.Remove();
-  }
-
-}
-
-//============================================================================
-// function : PutFilesToStream
-// purpose  : converts the files from a list 'theFiles' to the stream
-//============================================================================
-SALOMEDS::TMPFile* 
-SALOMEDS_Tool::PutFilesToStream(const char* theFromDirectory,
-                               const SALOMEDS::ListOfFileNames& theFiles,
-                               const int theNamesOnly)
-{
-  int i, aLength = theFiles.length();
-  if(aLength == 0) return NULL;
-
-  TCollection_AsciiString aTmpDir(const_cast<char*>(theFromDirectory)); //Get a temporary directory for saved a file
-
-  long aBufferSize = 0;
-  long aCurrentPos;
-
-  int aNbFiles = 0;
-  int* aFileNameSize= new int[aLength];
-  long* aFileSize= new long[aLength];
-
-  //Determine the required size of the buffer
-
-  for(i=0; i<aLength; i++) {
-
-    //Check if the file exists
-    
-    if (!theNamesOnly) { // mpv 15.01.2003: if only file names must be stroed, then size of files is zero
-      TCollection_AsciiString aFullPath = aTmpDir + strdup(theFiles[i]);   
-      OSD_Path anOSDPath(aFullPath);
-      OSD_File anOSDFile(anOSDPath);
-      if(!anOSDFile.Exists()) continue;
-#ifdef WNT
-      ifstream aFile(aFullPath.ToCString(), ios::binary);
-#else
-      ifstream aFile(aFullPath.ToCString());
-#endif
-      aFile.seekg(0, ios::end);
-      aFileSize[i] = aFile.tellg();
-      aBufferSize += aFileSize[i];              //Add a space to store the file
-    }
-    aFileNameSize[i] = strlen(theFiles[i])+1;
-    aBufferSize += aFileNameSize[i];          //Add a space to store the file name
-    aBufferSize += (theNamesOnly)?4:12;       //Add 4 bytes: a length of the file name,
-                                              //    8 bytes: length of the file itself
-    aNbFiles++;
-  } 
-
-  aBufferSize += 4;      //4 bytes for a number of the files that will be written to the stream;
-  unsigned char* aBuffer = new unsigned char[aBufferSize];  
-  if(aBuffer == NULL) return NULL; 
-
-  //Initialize 4 bytes of the buffer by 0
-  memset(aBuffer, 0, 4); 
-  //Copy the number of files that will be written to the stream
-  memcpy(aBuffer, &aNbFiles, ((sizeof(int) > 4) ? 4 : sizeof(int))); 
-
-
-  aCurrentPos = 4;
-
-  for(i=0; i<aLength; i++) {
-    ifstream *aFile;
-    if (!theNamesOnly) { // mpv 15.01.2003: we don't open any file if theNamesOnly = true
-      TCollection_AsciiString aFullPath = aTmpDir + strdup(theFiles[i]);
-      OSD_Path anOSDPath(aFullPath);
-      OSD_File anOSDFile(anOSDPath);
-      if(!anOSDFile.Exists()) continue;
-#ifdef WNT
-      aFile = new ifstream(aFullPath.ToCString(), ios::binary);
-#else
-      aFile = new ifstream(aFullPath.ToCString());
-#endif  
-    }
-    //Initialize 4 bytes of the buffer by 0
-    memset((aBuffer + aCurrentPos), 0, 4); 
-    //Copy the length of the file name to the buffer
-    memcpy((aBuffer + aCurrentPos), (aFileNameSize + i), ((sizeof(int) > 4) ? 4 : sizeof(int))); 
-    aCurrentPos += 4;
-
-    //Copy the file name to the buffer
-    memcpy((aBuffer + aCurrentPos), theFiles[i], aFileNameSize[i]);
-    aCurrentPos += aFileNameSize[i];
-    
-    if (!theNamesOnly) { // mpv 15.01.2003: we don't copy file content to the buffer if !theNamesOnly
-      //Initialize 8 bytes of the buffer by 0
-      memset((aBuffer + aCurrentPos), 0, 8); 
-      //Copy the length of the file to the buffer
-      memcpy((aBuffer + aCurrentPos), (aFileSize + i), ((sizeof(long) > 8) ? 8 : sizeof(long)));
-      aCurrentPos += 8;
-      
-      aFile->seekg(0, ios::beg);
-      aFile->read((char *)(aBuffer + aCurrentPos), aFileSize[i]);
-      aFile->close();
-      delete(aFile);
-      aCurrentPos += aFileSize[i];
-    }
-  }
-
-  delete[] aFileNameSize;
-  delete[] aFileSize;
-  
-  
-  CORBA::Octet* anOctetBuf =  (CORBA::Octet*)aBuffer;
-  
-  return (new SALOMEDS::TMPFile(aBufferSize, aBufferSize, anOctetBuf, 1));
-}
-
-//============================================================================
-// function : PutStreamToFile
-// purpose  : converts the stream "theStream" to the files
-//============================================================================
-SALOMEDS::ListOfFileNames* 
-SALOMEDS_Tool::PutStreamToFiles(const SALOMEDS::TMPFile& theStream,
-                               const char* theToDirectory,
-                               const int theNamesOnly)
-{
-  if(theStream.length() == 0) return NULL;
-  TCollection_AsciiString aTmpDir(const_cast<char*>(theToDirectory)); //Get a temporary directory for saving a file
-
-  unsigned char *aBuffer = (unsigned char*)theStream.NP_data();
-
-  if(aBuffer == NULL) return NULL;
-
-  long aBufferSize = theStream.length();
-  long aFileSize, aCurrentPos = 4;
-  int i, aFileNameSize, aNbFiles = 0;
-
-  //Copy the number of files in the stream
-  memcpy(&aNbFiles, aBuffer, sizeof(int)); 
-
-  SALOMEDS::ListOfFileNames_var aFiles = new SALOMEDS::ListOfFileNames;
-  aFiles->length(aNbFiles);
-
-  for(i=0; i<aNbFiles; i++) {
-
-    //Put a length of the file name to aFileNameSize
-    memcpy(&aFileNameSize, (aBuffer + aCurrentPos), ((sizeof(int) > 4) ? 4 : sizeof(int))); 
-    aCurrentPos += 4;
-
-    char *aFileName = new char[aFileNameSize];
-    //Put a file name to aFileName
-    memcpy(aFileName, (aBuffer + aCurrentPos), aFileNameSize); 
-    aCurrentPos += aFileNameSize;
-    //Put a length of the file to aFileSize
-    if (!theNamesOnly) {
-      memcpy(&aFileSize, (aBuffer + aCurrentPos), ((sizeof(long) > 8) ? 8 : sizeof(long)));
-      aCurrentPos += 8;    
-      
-      TCollection_AsciiString aFullPath = aTmpDir + aFileName;
-      ofstream aFile(aFullPath.ToCString());
-      aFile.write((char *)(aBuffer+aCurrentPos), aFileSize); 
-      aFile.close();  
-      aCurrentPos += aFileSize;
-    }
-    aFiles[i] = CORBA::string_dup(aFileName);
-    delete[] aFileName;
-  }
-
-  return aFiles._retn();
-}
-
-//============================================================================
-// function : GetNameFromPath
-// purpose  : Returns the name by the path
-//============================================================================
-char* SALOMEDS_Tool::GetNameFromPath(const char* thePath) {
-  if (thePath == NULL) return strdup("");
-  OSD_Path aPath = OSD_Path(TCollection_AsciiString(strdup(thePath)));
-  TCollection_AsciiString aNameString(aPath.Name());
-  return CORBA::string_dup(aNameString.ToCString());
-}
-
-//============================================================================
-// function : GetDirFromPath
-// purpose  : Returns the dir by the path
-//============================================================================
-char* SALOMEDS_Tool::GetDirFromPath(const char* thePath) {
-  if (thePath == NULL) return strdup("");
-  OSD_Path aPath = OSD_Path(TCollection_AsciiString(strdup(thePath)));
-  TCollection_AsciiString aDirString(aPath.Trek());
-  aDirString.ChangeAll('|','/');
-  return CORBA::string_dup(aDirString.ToCString());
-}
diff --git a/src/SALOMEDS/SALOMEDS_Tool.hxx b/src/SALOMEDS/SALOMEDS_Tool.hxx
deleted file mode 100644 (file)
index 8555737..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-//  SALOME SALOMEDS : data structure of SALOME and sources of Salome data server 
-//
-//  Copyright (C) 2003  CEA/DEN, EDF R&D
-//
-//
-//
-//  File   : SALOMEDS_Tool.hxx
-//  Author : Sergey RUIN
-//  Module : SALOME
-
-#ifndef __SALOMEDS_Tool_H__
-#define __SALOMEDS_Tool_H__
-
-
-
-// IDL headers
-#include <SALOMEDS.hh> 
-
-class SALOMEDS_Tool                                
-{
-public:
-  // Returns the unique temporary directory, that is defined in SALOME_TMP_DIR if this variable is set
-  // otherwise return /tmp/something/ for Unix or c:\something\ for WNT
-  static char* GetTmpDir();
-
-  // Removes files which are in <theDirectory>, the files for deletion are listed in <theFiles>
-  // if <IsDirDeleted> is true <theDirectory> is also deleted if it is empty
-  static void RemoveTemporaryFiles(const char* theDirectory,
-                                  const SALOMEDS::ListOfFileNames& theFiles,
-                                  const bool IsDirDeleted);
-
-  // Converts files listed in <theFiles> which are in <theFromDirectory> into a byte sequence TMPFile
-  static SALOMEDS::TMPFile* PutFilesToStream(const char* theFromDirectory, 
-                                            const SALOMEDS::ListOfFileNames& theFiles,
-                                            const int theNamesOnly = 0);
-
-  // Converts a byte sequence <theStream> to files and places them in <theToDirectory>
-  static SALOMEDS::ListOfFileNames* PutStreamToFiles(const SALOMEDS::TMPFile& theStream,
-                                                     const char* theToDirectory,
-                                                    const int theNamesOnly = 0);
-
-  // Returns the name by the path
-  // for an example: if thePath = "/tmp/aaa/doc1.hdf" the function returns "doc1"
-  static char* GetNameFromPath(const char* thePath);
-
-  // Returns the directory by the path
-  // for an example: if thePath = "/tmp/aaa/doc1.hdf" the function returns "/tmp/aaa"
-  static char* GetDirFromPath(const char* thePath);
-
-};
-#endif
index 698fbb1c6cb3de72b48c8a807e7584c4b2effac8..ba6d6397e5a3609b9dfc7f129a0b190cce8f47c3 100644 (file)
@@ -272,7 +272,7 @@ CORBA::Boolean SALOMEDS_UseCaseBuilder_i::SetName(const char* theName) {
   if(_root.IsNull()) return 0;
 
   Handle(TDataStd_Name) aNameAttrib;
-  TCollection_ExtendedString aName(strdup(theName));
+  TCollection_ExtendedString aName((char*)theName);
 
   if (!_root->FindAttribute(TDataStd_Name::GetID(), aNameAttrib))
     aNameAttrib = TDataStd_Name::Set(_root->Label(), aName);
@@ -315,7 +315,7 @@ char* SALOMEDS_UseCaseBuilder_i::GetName() {
 
   Handle(TDataStd_Name) aName;
   if (!_root->FindAttribute(TDataStd_Name::GetID(), aName)) return aString._retn();
-  aString = strdup(TCollection_AsciiString(aName->Get()).ToCString());
+  aString = CORBA::string_dup(TCollection_AsciiString(aName->Get()).ToCString());
   return aString._retn();
 }
 
@@ -368,7 +368,7 @@ SALOMEDS::SObject_ptr SALOMEDS_UseCaseBuilder_i::AddUseCase(const char* theName)
   TDF_Label aChild = aLabel.FindChild(anInteger->Get());
   aNode = TDataStd_TreeNode::Set(aChild, aBasicGUID);
   aFatherNode->Append(aNode);
-  TDataStd_Name::Set(aChild, TCollection_ExtendedString(strdup(theName)));
+  TDataStd_Name::Set(aChild, TCollection_ExtendedString((char*)theName));
 
   SALOMEDS_SObject_i *  so_servant = new SALOMEDS_SObject_i (aChild, _orb);
   SALOMEDS::SObject_var so = SALOMEDS::SObject::_narrow(so_servant->_this()); 
index f0e5f90f9e2d47a8f3ff99e633bea10e913391c6..73e232ffc22590f58d3dc508aa1e027b53b4c850 100644 (file)
@@ -20,17 +20,17 @@ msgstr ""
 #---------------
 
 msgid "INF_VERSION"
-msgstr "Version 2.0.0"
+msgstr "Version 2.1.0"
 
 msgid "INF_COPYRIGHT"
-msgstr "  "
+msgstr "Copyright : CEA"
 
 msgid "INF_LICENSE"
 msgstr "  "
 
 #: SALOMEGUI_AboutDlg.cxx:42
 msgid "ABOUT_TLT"
-msgstr "About SALOME"
+msgstr "About PAL/SALOME"
 
 #: QAD_Config.cxx:84
 msgid "MEN_APPNAME"
@@ -38,8 +38,8 @@ msgstr "salome"
 
 #: QAD_Application.cxx:133
 msgid "QAD_Application::APP_DEFAULTTITLE"
-msgstr "SALOME 2.0.0"
+msgstr "PAL/SALOME 2.1.0"
 
 #: QAD_Desktop.cxx:424
 msgid "QAD_Desktop::DESK_DEFAULTTITLE"
-msgstr "SALOME 2.0.0"
+msgstr "PAL/SALOME 2.1.0"
index 3f7bc1c78d4775a90da78d5b4d36666a34a8059a..f3d426d18d24633015ac993cd35a94f151986899 100644 (file)
@@ -91,6 +91,7 @@ EXPORT_HEADERS = \
                  SALOME_NumberFilter.hxx \
                  Handle_SALOME_NumberFilter.hxx \
                  SALOME_DataMapOfIOMapOfInteger.hxx \
+      SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger.hxx \
                  Handle_SALOME_DataMapNodeOfDataMapOfIOMapOfInteger.hxx \
                  SALOMEGUI.h \
                  SALOMEGUI_LoadStudiesDlg.h \
@@ -220,7 +221,7 @@ LIB_CLIENT_IDL = SALOMEDS.idl \
                 SALOME_Exception.idl
 
 CPPFLAGS+=$(QT_INCLUDES) $(PYTHON_INCLUDES) $(OCC_INCLUDES)
-LDFLAGS+=$(QT_MT_LIBS) -lSalomeNS -lqsplitterP -lSalomeLifeCycleCORBA -lOpUtil -lSalomeObject -lEvent
+LDFLAGS+=$(QT_MT_LIBS) -lSalomeNS -lqsplitterP -lSalomeLifeCycleCORBA -lOpUtil -lSalomeObject -lEvent -lSalomePrs
 
 LIBS+= $(PYTHON_LIBS)
 
index dd136e506e506c7f77acc3b2bde9e7bff6ae02af..440c302f3f0d50f629993d4879877a93e5aa4d91 100644 (file)
@@ -22,7 +22,6 @@ using namespace std;
  */
 PyInterp_PyQt::PyInterp_PyQt(): PyInterp_base()
 {
-  initialize();
 }
 
 PyInterp_PyQt::~PyInterp_PyQt()
index e16f1e04193f606bc65a82af07ca3e10c481ce29..08990e6e5559658968c07892cc0ceea050e9097c 100644 (file)
@@ -9,6 +9,7 @@
 //  Module : SALOME
 //  $Header$
 
+
 #include <string>
 #include <vector>
 
index 3f222202750327d04d1bd58c325ff9194d766e77..ac1763f4d810eb166a47bf99a18001743cc8be21 100644 (file)
@@ -72,6 +72,7 @@
 
 #include "SALOMEGUI_CloseDlg.h"
 #include "SALOMEGUI_ActivateComponentDlg.h"
+#include "SALOMEGUI_QtCatchCorbaException.hxx"
 
 #include "SALOME_Event.hxx"
 
@@ -201,7 +202,8 @@ myActiveStudy(0),
 myCntUntitled(0),
 //NRImyHelpWindow(0),
 myDefaultTitle( tr("DESK_DEFAULTTITLE") ),
-myQueryClose( true )
+myQueryClose( true ),
+myAboutToClose( false )
 {
   /* Force reading of user config file */
   QAD_CONFIG->readConfigFile();  
@@ -287,9 +289,9 @@ myQueryClose( true )
     QString resDir;
 
     /* find component icon */
-    QString iconfile = strdup(list_composants[ind].moduleicone) ;
-    QString modulename = strdup(list_composants[ind].modulename) ;
-    QString moduleusername = strdup(list_composants[ind].moduleusername) ;
+    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) ;
 
     //    MESSAGE ( " MODULE = " << modulename )
     //    MESSAGE ( " MODULE icon = " << iconfile )
@@ -388,7 +390,9 @@ const int IdSelectAll = 1004;
 */
 bool QAD_Desktop::eventFilter( QObject* o, QEvent* e )
 {
-  if (e->type() == 2000   ) {
+  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;
   }
@@ -396,9 +400,9 @@ bool QAD_Desktop::eventFilter( QObject* o, QEvent* e )
     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") ) {
+  else if ( e->type() == QEvent::ContextMenu ) {
+    QContextMenuEvent* ce = (QContextMenuEvent*)e;
+    if ( o->inherits("QRenameEdit") ) {
       return TRUE;
     }
     else if ( o->inherits("QLineEdit") ) {
@@ -453,11 +457,8 @@ bool QAD_Desktop::eventFilter( QObject* o, QEvent* e )
   }
   else if ( e->type() == SALOME_EVENT ) { 
     SALOME_Event* aSE = (SALOME_Event*)((QCustomEvent*)e)->data();
-    processEvent( aSE );
-    // Signal the calling thread that the event has been processed
-    aSE->processed();
+    processEvent(aSE);
     ((QCustomEvent*)e)->setData( 0 );
-    delete aSE;
     return TRUE;
   }
   return QMainWindow::eventFilter( o, e );
@@ -468,9 +469,11 @@ bool QAD_Desktop::eventFilter( QObject* o, QEvent* e )
 */
 void QAD_Desktop::processEvent( SALOME_Event* theEvent )
 {
-  if ( !theEvent )
-    return;
-  theEvent->Execute();
+  if(theEvent){
+    theEvent->Execute();
+    // Signal the calling thread that the event has been processed
+    theEvent->processed();
+  }
 }
 
 /*!
@@ -990,13 +993,13 @@ void QAD_Desktop::createActions()
       myCatalogue->GetComponentIconeList();
       
     for (unsigned int ind = 0; ind < list_composants->length(); ind++) {
-      QString aModuleName = strdup(list_composants[ind].modulename) ;
+      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 = strdup(list_composants[ind].moduleusername) ;
+         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() )));
@@ -1412,36 +1415,44 @@ void QAD_Desktop::closeEvent ( QCloseEvent* e )
                                      QAD_NO, QAD_NO ) == QAD_YES;
   }
 
-  if ( doClose ) { 
-    for ( QAD_Application* app = myApps.first(); app; app = myApps.next() ) { 
-      QList<QAD_Study>& studies = app->getStudies();
-      for(QAD_Study* study = studies.first(); 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") );
-             e->ignore();
-             return;
-           }
-           break;
-         case 2:
-         case 3:
-           break;
-         case 0:
-         default: 
-           e->ignore();
+  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") );
-           return;
+           doClose = false;
          }
+         break;
+       case 2:
+       case 3:
+         break;
+       case 0:
+       default: 
+         doClose = false;
+         putInfo( tr("INF_CANCELLED") );
        }
-       study->close();
       }
+      if ( doClose )
+       study->close();
     }
   }
+
   myQueryClose = true;
-  doClose ? e->accept() : e->ignore();
+
+  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();
 }
 
 /*!
@@ -1716,12 +1727,7 @@ void QAD_Desktop::onOpenStudy()
                                      tr("ERR_ERROR"),
                                      tr("ERR_DOC_CANTOPEN") + "\n" + name,
                                      tr("BUT_OK") );
-           } else if (myActiveComp != "") {
-             QApplication::setOverrideCursor( Qt::waitCursor );
-             loadComponentData(mapComponentName[myActiveComp]);
-             openStudy->updateObjBrowser(true);
-             QApplication::restoreOverrideCursor();
-           }
+           } 
            break;
        }
     }
@@ -1738,6 +1744,13 @@ void QAD_Desktop::onOpenStudy()
 
 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) {
@@ -1758,33 +1771,36 @@ bool QAD_Desktop::loadComponentData( const QString& compName )
       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()) {
-    if (!CORBA::is_nil(comp)) {
-      SALOMEDS::Driver_var   driver = SALOMEDS::Driver::_narrow(comp);
-      if (!CORBA::is_nil(driver)) {
-       SALOMEDS::StudyBuilder_var  B = aStudy->NewBuilder();
-       if (!CORBA::is_nil(B)) {
-//       QAD_Operation* op = new QAD_Operation( myActiveStudy );
-//       op->start();
+    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);
-//       op->finish();
-       } else {
+       }
+       catch( const SALOME::SALOME_Exception& ) {
+         // Oops, something went wrong while loading -> return an error
          return false;
        }
-      } else {
-       MESSAGE("loadComponentData(): Driver is null");
-       return false;
-      }
+      } 
     } else {
-      MESSAGE("loadComponentData(): Engine is null");
+      MESSAGE("loadComponentData(): Driver is null");
+      // Incorrect! All components should inherit SALOMEDS::Driver
       return false;
     }
   } else {
     MESSAGE("loadComponentData(): SComponent is null");
-    return false;
+    // Don't return false here, for there might be no data 
+    // for a given component in the study yet
   }
 
   return true;
@@ -2551,7 +2567,9 @@ void QAD_Desktop::onOpenWith()
     if (SCO->FindAttribute(anAttr, "AttributeName")) {
       aName = SALOMEDS::AttributeName::_narrow(anAttr);
       name = aName->Value();
-      SALOME_ModuleCatalog::Acomponent_var Comp = myCatalogue->GetComponent( mapComponentName[name] );
+      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 =
@@ -2562,7 +2580,7 @@ void QAD_Desktop::onOpenWith()
        } 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( strdup(list_type_composants[ind]) );
+           QString compusername = getComponentUserName( (char*)list_type_composants[ind] );
            if ( !compusername.isEmpty() )
              aDlg->addComponent( compusername );
          }
@@ -2622,6 +2640,11 @@ void QAD_Desktop::setSettings()
 */
 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
 
@@ -2694,16 +2717,6 @@ bool QAD_Desktop::loadComponent(QString Component)
   if (myActiveMenus)
     nbToolbars = myActiveMenus->getToolBarList().count();
 
-  // san - avoid loading component GUI library multiple times
-  QString aUserName( getComponentUserName( Component ) );
-  
-  SALOMEGUI* anActiveGUI = getComponentGUI(aUserName);
-  if ( !anActiveGUI )
-    return false;
-
-  /* SETTINGS */
-  anActiveGUI->SetSettings( this, (char*)Component.latin1() );
-
   /* COMPONENT INTERFACE */
   SALOME_ModuleCatalog::Acomponent_ptr aComponent =
     myCatalogue->GetComponent(Component.latin1());
@@ -3012,6 +3025,23 @@ void QAD_Desktop::onComboActiveComponent( const QString & component, bool isLoad
       //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() );
@@ -3024,13 +3054,6 @@ void QAD_Desktop::onComboActiveComponent( const QString & component, bool isLoad
        }
 
        myActiveStudy->Selection( component );
-       if ( !loadComponent(mapComponentName[component]) ) {
-         myCombo->setCurrentItem (0);
-         for ( QToolButton* aButton=myComponentButton.first(); aButton; aButton=myComponentButton.next() ) {
-           aButton->setOn(false);
-         }
-         myActiveComp = "";
-       }
 
        SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
        SALOME_ListIteratorOfListIO It( oldSel->StoredIObjects() );
@@ -3044,10 +3067,13 @@ void QAD_Desktop::onComboActiveComponent( const QString & component, bool isLoad
          
        }
 
-       // Open new component's data in active study if any
-       if(isLoadData) loadComponentData(mapComponentName[component]);
-
        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();
@@ -3132,7 +3158,8 @@ void QAD_Desktop::onButtonActiveComponent( )
  */
 void QAD_Desktop::clearMenus()
 {
-  onActiveStudyChanged();
+  // san - commented as presumably obsolete
+  //  onActiveStudyChanged();
 
   /* menus */
   myMenusList.clear();
@@ -3223,6 +3250,8 @@ 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() ) {
@@ -3328,6 +3357,22 @@ SALOMEGUI* QAD_Desktop::getComponentGUI( const QString& component )
 }
 
 
+/*!
+    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 ) 
@@ -3417,6 +3462,34 @@ void QAD_Desktop::createPopup(QPopupMenu* popup, const QString & theContext,
 
 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);
index 96d3b90897a30f1b03af13197b107ffd4d965c23..83bc083c972ceb6c8f30bb1c09f3831fae75a4d8 100644 (file)
@@ -151,6 +151,7 @@ public:
     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();
@@ -165,6 +166,7 @@ public:
     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,
@@ -194,8 +196,6 @@ protected:
     virtual   void    updateCaption( UpdateCommand );
     virtual   void    updateMenu( UpdateCommand );
 
-    bool              loadComponentData( const QString& );
-
 protected slots:
     virtual void      onNewStudy();
     virtual void      onNewStudy(QAD_Application* app);
@@ -342,6 +342,7 @@ private:
     SALOME_LifeCycleCORBA *                myEnginesLifeCycle;
     QComboBox *                                    myCombo;
     bool                                    myQueryClose;
+    bool                                    myAboutToClose;
     bool                                    _islibso;
 
     ComponentMap                            myComponents;
index 76860b89d524c49033bfbc62af43255261f9e931..d3e1bb230fa65348134eb27106e74e339f094d0a 100644 (file)
@@ -31,15 +31,15 @@ QString QAD_FileDlg::myLastVisitedPath;
 Constructor
 */
 QAD_FileDlg::QAD_FileDlg( QWidget* parent, bool open, bool showQuickDir, bool modal ) :
-QFileDialog( parent, 0, modal ),
+QFileDialogP( parent, 0, modal ),
 myValidator( 0 ),
 myQuickCombo( 0 ),
 myOpen( open )
 {    
   if ( parent->icon() )
-    setIcon( *parent->icon() );       
+    setIcon( *parent->icon() );
   setSizeGripEnabled( true );
-  
+
   if (showQuickDir) {
     // inserting quick dir combo box
     QLabel* lab  = new QLabel(tr("Quick path:"), this);
@@ -176,7 +176,7 @@ void QAD_FileDlg::accept()
 {
 //  mySelectedFile = QFileDialog::selectedFile().simplifyWhiteSpace(); //VSR- 06/12/02
   if ( mode() != ExistingFiles ) {
-    mySelectedFile = QFileDialog::selectedFile(); //VSR+ 06/12/02
+    mySelectedFile = QFileDialogP::selectedFile(); //VSR+ 06/12/02
     addExtension();
   }
 //  mySelectedFile = mySelectedFile.simplifyWhiteSpace(); //VSR- 06/12/02
@@ -187,7 +187,7 @@ void QAD_FileDlg::accept()
   */
   if ( acceptData() ) {
     myLastVisitedPath = dirPath();
-    QFileDialog::accept();        
+    QFileDialogP::accept();        
   }
 }
 
@@ -197,7 +197,7 @@ Closes this dialog and sets the return code to 'Rejected'
 void QAD_FileDlg::reject()
 {
   mySelectedFile = QString::null;
-  QFileDialog::reject();        
+  QFileDialogP::reject();        
 }
 
 /*!
@@ -342,7 +342,9 @@ QString QAD_FileDlg::getFileName( QWidget*           parent,
   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 );        
+
+  fd->setFilters( filters );
+
   if ( validator )
     fd->setValidator( validator );
   fd->exec();
@@ -396,11 +398,11 @@ QString QAD_FileDlg::getExistingDirectory ( QWidget*       parent,
   }
   fd->setMode( DirectoryOnly );
   fd->setFilters(tr("DIRECTORIES_FILTER"));
+
   fd->exec();
   QString dirname = fd->selectedFile();
   delete fd;
   qApp->processEvents();
   return dirname;
-  
 }
 
index e6964280fdb69b7b651ef3bf6d0e8bb208b4b5fd..a604596a592a666b927d4bcc097619513db44c03 100644 (file)
 #ifndef QAD_FILEDIALOG_H
 #define QAD_FILEDIALOG_H
 
-#include <qfiledialog.h>
 #include <qcombobox.h>
+
+#include <qfiledialogP.h>
 #include "QAD.h"
 #include "QAD_FileValidator.h"
 
-class QAD_EXPORT QAD_FileDlg : public QFileDialog
+class QAD_EXPORT QAD_FileDlg : public QFileDialogP
 {
     Q_OBJECT
 
 public:
     QAD_FileDlg( QWidget* parent, bool open, bool showQuickDir = true, bool modal = true );
-    ~QAD_FileDlg();
+    virtual ~QAD_FileDlg();
 
 public:    
     bool               isOpenDlg()    const;    
@@ -48,8 +49,11 @@ public:
                                              const QString& initial,
                                              const QString& caption, 
                                              bool           showQuickDir = true);
+
+protected:
+  virtual bool         acceptData();
+                            
 private:
-    bool               acceptData();
     void               addExtension();
     bool               processPath( const QString& path );
 
@@ -64,7 +68,6 @@ protected:
     QAD_FileValidator* myValidator;        /* file validator      */
     static QString     myLastVisitedPath;  /* last visited path   */
     QComboBox*         myQuickCombo;       /* quick dir combo box */
-
 };
 
 #endif
index f12915a41fe7090d1be3e887ab42698141bae907..0a4c7742648027e2871ef841bed4517c61133427 100644 (file)
@@ -9,15 +9,18 @@
 //  Module : SALOME
 //  $Header$
 
-using namespace std;
 #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) 
index d555fd378d308a0faed878c0e36b14e15b0042b3..b48d624186ed60ac2bc47c192c712aaecae4f45b 100644 (file)
@@ -9,7 +9,6 @@
 //  Module : SALOME
 //  $Header$
 
-using namespace std;
 #include "QAD_ListView.h"
 
 #include <qheader.h>
@@ -19,13 +18,13 @@ using namespace std;
 
 #include "QAD_Desktop.h"
 
-//#include <QAD_Application.h>
-//#include <QAD_Document.h>
-
-
 #include <TColStd_ListIteratorOfListOfInteger.hxx>
 #include <TColStd_ListIteratorOfListOfReal.hxx>
 
+#include "utilities.h"
+
+using namespace std;
+
 //////////////////////////////////////////////////////////////////////
 // QAD_ListView class implementation
 //////////////////////////////////////////////////////////////////////
index 4516e99345fc19fbfa048b397596e0156f3154df..91cc38a5985680873e67a74f818ed4a372e0331b 100644 (file)
@@ -55,6 +55,8 @@
 #include <qtooltip.h>
 #include <qdragobject.h>
 #include <qstringlist.h>
+#include <qmap.h>
+
 using namespace std;
 
 //VRV: porting on Qt 3.0.5
@@ -456,6 +458,35 @@ bool QAD_ObjectBrowser::eventFilter( QObject* o, QEvent* 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
 */
@@ -486,6 +517,18 @@ void QAD_ObjectBrowser::onCreatePopup()
                             this,
                             SLOT( onEditAttribute() ) );
       }
+
+      bool canExpand = false;
+      for ( QListViewItemIterator it( getListView() ); 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
@@ -534,6 +577,16 @@ void QAD_ObjectBrowser::onCreatePopup()
   }
 }
 
+/*!
+  Called on "Expand all" popup menu command
+*/
+void QAD_ObjectBrowser::onExpandAll()
+{
+  for ( QListViewItemIterator it( getListView() ); it.current(); ++it )
+    if ( it.current()->isSelected() )
+      expand( it.current() );  
+}
+
 /*!
   Returns Object Browser list view
 */
@@ -627,7 +680,7 @@ void QAD_ObjectBrowser::Update( SALOMEDS::SObject_ptr SO,
     SALOMEDS::SObject_var             CSO = it->Value();
     SALOMEDS::SObject_var             RefSO;
     QString                           ior = "";
-    QString                           CSOEntry = strdup( CSO->GetID() );
+    QString                           CSOEntry = CORBA::string_dup( CSO->GetID() );
     SALOMEDS::GenericAttribute_var    anAttr;
     SALOMEDS::AttributeName_var       aName;
     SALOMEDS::AttributeComment_var    aCmnt;
@@ -647,17 +700,17 @@ void QAD_ObjectBrowser::Update( SALOMEDS::SObject_ptr SO,
    
     if ( CSO->ReferencedObject(RefSO) && !RefSO->_is_nil() ) {
       
-      QString RefSOEntry = strdup( RefSO->GetID() );
+      QString RefSOEntry = CORBA::string_dup( RefSO->GetID() );
       if (CSO->FindAttribute(anAttr, "AttributeName") || RefSO->FindAttribute(anAttr, "AttributeName")) {
         aName = SALOMEDS::AttributeName::_narrow(anAttr);
         if (RefSO->FindAttribute(anAttr, "AttributeIOR")) {
           anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
-          ior = strdup( anIOR->Value() );
+          ior = CORBA::string_dup( anIOR->Value() );
         }
        valueString = getValueFromObject( RefSO );
-//      AddItem (Item, QString(" * ") + strdup( aName->Value() ), RefSOEntry, ior, 2, CSOEntry);
+//      AddItem (Item, QString(" * ") + CORBA::string_dup( aName->Value() ), RefSOEntry, ior, 2, CSOEntry);
        Item = AddItem(theParentItem, 
-                      QString(" * ") + strdup( aName->Value() ), 
+                      QString(" * ") + CORBA::string_dup( aName->Value() ), 
                       RefSOEntry, 
                       ior, 
                       2, 
@@ -674,12 +727,12 @@ void QAD_ObjectBrowser::Update( SALOMEDS::SObject_ptr SO,
       // getting IOR
       if (CSO->FindAttribute(anAttr, "AttributeIOR"))  {
         anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
-        ior = strdup( anIOR->Value() );
+        ior = CORBA::string_dup( anIOR->Value() );
       }
       // getting Name and adding new Item
       if (CSO->FindAttribute(anAttr, "AttributeName") ) {
         aName = SALOMEDS::AttributeName::_narrow(anAttr);
-        Item = AddItem(theParentItem, strdup( aName->Value() ), CSOEntry, ior, 0, "", valueString);
+        Item = AddItem(theParentItem, CORBA::string_dup( aName->Value() ), CSOEntry, ior, 0, "", valueString);
        myListViewMap[ CSOEntry ].append( Item );
       } 
       else {
@@ -773,9 +826,9 @@ void QAD_ObjectBrowser::Update()
   for (; itcomp->More(); itcomp->Next()) {
     QAD_ObjectBrowserItem*   Item     = 0;
     SALOMEDS::SComponent_var SC       = itcomp->Value();
-    QString                  dataType = strdup( SC->ComponentDataType() );
+    QString                  dataType = CORBA::string_dup( SC->ComponentDataType() );
     QString                  ior      = "";
-    QString                  SCEntry  = strdup( SC->GetID() );
+    QString                  SCEntry  = CORBA::string_dup( SC->GetID() );
 
     SALOMEDS::GenericAttribute_var    anAttr;
     SALOMEDS::AttributeName_var       aName;
@@ -792,7 +845,7 @@ void QAD_ObjectBrowser::Update()
 
     if (SC->FindAttribute(anAttr, "AttributeIOR")) {
       anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
-      ior = strdup( anIOR->Value() );
+      ior = CORBA::string_dup( anIOR->Value() );
     }
 
     bool caseIAPP = false;
@@ -803,7 +856,7 @@ void QAD_ObjectBrowser::Update()
       if ( ShowIAPP.compare("true") == 0 ) {
        if (SC->FindAttribute(anAttr, "AttributeName")) {
           aName = SALOMEDS::AttributeName::_narrow(anAttr);
-         Item = AddItem (myListView, strdup( aName->Value() ), strdup( SCEntry ), ior, 1, "");
+         Item = AddItem (myListView, CORBA::string_dup( aName->Value() ), SCEntry, ior, 1, "");
          myListViewMap[ SCEntry ].append( Item );
        } 
         else {
@@ -817,7 +870,7 @@ void QAD_ObjectBrowser::Update()
       caseIAPP = false;
       if (SC->FindAttribute(anAttr, "AttributeName")) {
         aName = SALOMEDS::AttributeName::_narrow(anAttr);
-       Item = AddItem (myListView, strdup( aName->Value() ), SCEntry, ior, 1, "");
+       Item = AddItem (myListView, CORBA::string_dup( aName->Value() ), SCEntry, ior, 1, "");
        myListViewMap[ SCEntry ].append( Item );
       } 
       else {
@@ -932,7 +985,7 @@ void QAD_ObjectBrowser::UpdateUseCaseBrowser() {
   QAD_ObjectBrowserItem* root = ( QAD_ObjectBrowserItem* )myUseCaseView->firstChild();
   SALOMEDS::UseCaseBuilder_var  UCBuilder = myStudy->GetUseCaseBuilder();
   SALOMEDS::SObject_var SOCurrent = UCBuilder->GetCurrentObject();
-  QString UCName = QString( strdup( UCBuilder->GetName() ) );
+  QString UCName = CORBA::string_dup( UCBuilder->GetName() );
   if ( UCName.isEmpty() )
     UCName = QString( tr( "Root" ) );
   // creating root item if is not yet created
@@ -950,7 +1003,7 @@ void QAD_ObjectBrowser::UpdateUseCaseBrowser() {
   if ( !UCIter->_is_nil() ) {
     for ( ; UCIter->More(); UCIter->Next() ) {
       SALOMEDS::SObject_var UCObject = UCIter->Value();
-      QString UCEntry = strdup( UCObject->GetID() );
+      QString UCEntry = CORBA::string_dup( UCObject->GetID() );
       ucList[ UCEntry ] = UCObject;
     }
   }
@@ -998,7 +1051,7 @@ void QAD_ObjectBrowser::UpdateUCItem( SALOMEDS::SObject_var UCObject, QAD_Object
   SALOMEDS::AttributeTextHighlightColor_var  aTextHighlightColor;
   QString                                    valueString;
   QString                                    ior = "";
-  QString                                    UCEntry = strdup( UCObject->GetID() );
+  QString                                    UCEntry = CORBA::string_dup( UCObject->GetID() );
 
   SALOMEDS::UseCaseBuilder_var               UCBuilder = myStudy->GetUseCaseBuilder();
   SALOMEDS::SObject_var                      SOCurrent = UCBuilder->GetCurrentObject();
@@ -1010,17 +1063,17 @@ void QAD_ObjectBrowser::UpdateUCItem( SALOMEDS::SObject_var UCObject, QAD_Object
 
 //  if ( !bFound ) {
   if ( UCObject->ReferencedObject( RefSO ) && !RefSO->_is_nil() ) {
-    QString RefSOEntry = strdup( RefSO->GetID() );
+    QString RefSOEntry = CORBA::string_dup( RefSO->GetID() );
     if ( UCObject->FindAttribute( anAttr, "AttributeName" ) || RefSO->FindAttribute( anAttr, "AttributeName" ) ) {
       aName = SALOMEDS::AttributeName::_narrow( anAttr );
       if ( RefSO->FindAttribute( anAttr, "AttributeIOR" ) ) {
        anIOR = SALOMEDS::AttributeIOR::_narrow( anAttr );
-       ior = strdup( anIOR->Value() );
+       ior = CORBA::string_dup( anIOR->Value() );
       }
       valueString = getValueFromObject( RefSO );
       if ( !UCSubItem ) {
        UCSubItem = AddItem( UCItem, 
-                            QString( " * " ) + strdup( aName->Value() ), 
+                            QString( " * " ) + CORBA::string_dup( aName->Value() ), 
                             RefSOEntry, 
                             ior, 
                             2, 
@@ -1029,7 +1082,7 @@ void QAD_ObjectBrowser::UpdateUCItem( SALOMEDS::SObject_var UCObject, QAD_Object
        myUseCaseMap[ RefSOEntry ].append( UCSubItem );
       }
       else {
-       UCSubItem->setName( QString( " * " ) + strdup( aName->Value() ) );
+       UCSubItem->setName( QString( " * " ) + CORBA::string_dup( aName->Value() ) );
        UCSubItem->setEntry( RefSOEntry );
        UCSubItem->setIOR( ior );
        UCSubItem->setReference( UCEntry );
@@ -1044,17 +1097,17 @@ void QAD_ObjectBrowser::UpdateUCItem( SALOMEDS::SObject_var UCObject, QAD_Object
     // getting IOR
     if ( UCObject->FindAttribute( anAttr, "AttributeIOR" ) )  {
       anIOR = SALOMEDS::AttributeIOR::_narrow( anAttr );
-      ior = strdup( anIOR->Value() );
+      ior = CORBA::string_dup( anIOR->Value() );
     }
     // getting Name and adding new Item
     if ( UCObject->FindAttribute( anAttr, "AttributeName" ) ) {
       aName = SALOMEDS::AttributeName::_narrow( anAttr );
       if ( !UCSubItem ) {
-       UCSubItem = AddItem( UCItem, strdup( aName->Value() ), UCEntry, ior, 0, "", valueString );
+       UCSubItem = AddItem( UCItem, CORBA::string_dup( aName->Value() ), UCEntry, ior, 0, "", valueString );
        myUseCaseMap[ UCEntry ].append( UCSubItem );
       }
       else {
-       UCSubItem->setName( strdup( aName->Value() ) );
+       UCSubItem->setName( CORBA::string_dup( aName->Value() ) );
        UCSubItem->setEntry( UCEntry );
        UCSubItem->setIOR( ior );
        UCSubItem->setReference( "" );
@@ -1119,7 +1172,7 @@ void QAD_ObjectBrowser::UpdateUCItem( SALOMEDS::SObject_var UCObject, QAD_Object
     if ( !UCIter->_is_nil() ) {
       for ( ; UCIter->More(); UCIter->Next() ) {
        SALOMEDS::SObject_var UCSubObject = UCIter->Value();
-       QString UCSubEntry = strdup( UCSubObject->GetID() );
+       QString UCSubEntry = CORBA::string_dup( UCSubObject->GetID() );
        ucList[ UCSubEntry ] = UCSubObject;
       }
     }
@@ -1298,6 +1351,18 @@ void QAD_ObjectBrowser::showPopupMenu(QListViewItem* theItem)
   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 ) {
@@ -1348,6 +1413,12 @@ void QAD_ObjectBrowser::onSelectedItem()
   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();
@@ -1357,49 +1428,35 @@ void QAD_ObjectBrowser::onSelectedItem()
 
     if ( !theEntry.isEmpty() ) {
       if ( item->isSelected() ) {
-        bool itemAlreadySelected = false;
-       
-        SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
-        for(;It.More();It.Next()) {
-         Handle(SALOME_InteractiveObject) IO = It.Value();
-         if ( strcmp ( IO->getEntry(), theEntry ) == 0 ) {
-           itemAlreadySelected = true;
-           break;
-         }
-        }
-      
-        if (!itemAlreadySelected) {
+        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() ) {
-             Standard_CString datatype = comp->ComponentDataType();
-             newIO = new SALOME_InteractiveObject( strdup(theEntry),
-                                                   datatype,
-                                                   strdup(theName) );
-             newIO->setReference( strdup(theRef) );
+             //Standard_CString datatype = comp->ComponentDataType();
+             const char* datatype = comp->ComponentDataType();
+             //              newIO = new SALOME_InteractiveObject( CORBA::string_dup(theEntry),
+             //                                                    datatype,
+             //                                                    CORBA::string_dup(theName) );
+             newIO = new SALOME_InteractiveObject( theEntry, datatype, theName );
+             newIO->setReference( CORBA::string_dup(theRef) );
             }
          } else {
-           newIO = new SALOME_InteractiveObject( strdup(theEntry),
-                                                 "",
-                                                 strdup(theName) );
-           newIO->setReference( strdup(theRef) );
+           //newIO = new SALOME_InteractiveObject( CORBA::string_dup(theEntry),
+           //                                            "",
+           //                                            CORBA::string_dup(theName) );
+           newIO = new SALOME_InteractiveObject( theEntry, "", theName );
+           newIO->setReference( CORBA::string_dup(theRef) );
          }
           if (!newIO.IsNull()) {
            DeltaPos.Append( newIO );
           } 
         }
-      } else {
-        SALOME_ListIteratorOfListIO It1( Sel->StoredIObjects() );
-        for(;It1.More();It1.Next()) {
-         Handle(SALOME_InteractiveObject) IO = It1.Value();
-         if ( strcmp( IO->getEntry(), item->getEntry() ) == 0 ) {
-           DeltaNeg.Append( IO );
-           break;
-         }
-        }
-      }
+      } else if ( currMap.contains( theEntry ) )
+       DeltaNeg.Append( currMap[theEntry] );
     }
   }
 
@@ -1412,6 +1469,11 @@ void QAD_ObjectBrowser::onSelectedItem()
   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();
 }
@@ -1496,7 +1558,7 @@ QString QAD_ObjectBrowser::getValueFromObject( SALOMEDS::SObject_ptr SO )
   // Table of integer
   if ( SO->FindAttribute( anAttr, "AttributeTableOfInteger" ) ) {
     aTableInt = SALOMEDS::AttributeTableOfInteger::_narrow( anAttr );
-    QString tlt = QString( strdup( aTableInt->GetTitle() ) );
+    QString tlt = QString( aTableInt->GetTitle() );
     if ( !tlt.isEmpty() )
       tlt += " ";
     int nbRows  = aTableInt->GetNbRows() ; 
@@ -1507,7 +1569,7 @@ QString QAD_ObjectBrowser::getValueFromObject( SALOMEDS::SObject_ptr SO )
   // Table of real
   if ( SO->FindAttribute( anAttr, "AttributeTableOfReal" ) ) {
     aTableReal = SALOMEDS::AttributeTableOfReal::_narrow( anAttr );
-    QString tlt = QString( strdup( aTableReal->GetTitle() ) );
+    QString tlt = QString( aTableReal->GetTitle() );
     if ( !tlt.isEmpty() )
       tlt += " ";
     int nbRows  = aTableReal->GetNbRows() ; 
@@ -1518,7 +1580,7 @@ QString QAD_ObjectBrowser::getValueFromObject( SALOMEDS::SObject_ptr SO )
   // Comment
   if ( SO->FindAttribute(anAttr, "AttributeComment") ) {
     aComment = SALOMEDS::AttributeComment::_narrow( anAttr );
-    QString val = QString( strdup( aComment->Value() ) );
+    QString val = QString( aComment->Value() );
     return val;
   }
   return QString::null;
@@ -1744,8 +1806,20 @@ 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();
@@ -1779,14 +1853,14 @@ void QAD_ObjectBrowser::onUseCasePopupMenu( int action )
     if ( ucSelected.count() == 1 ) {
       QAD_ObjectBrowserItem* useCaseItem = ( QAD_ObjectBrowserItem* )( ucSelected.at( 0 ) );
       if ( isRootItem( useCaseItem ) ) {
-       QString name = SALOMEGUI_NameDlg::getName( QAD_Application::getDesktop(), strdup( UCBuilder->GetName() ) );
+       QString name = SALOMEGUI_NameDlg::getName( QAD_Application::getDesktop(), UCBuilder->GetName() );
        if ( !name.isEmpty() ) {
-         bool ok = UCBuilder->SetName( strdup( name.latin1() ) );
+         bool ok = 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(), strdup( useCaseItem->getName() ) );
+       QString name = SALOMEGUI_NameDlg::getName( QAD_Application::getDesktop(), CORBA::string_dup( useCaseItem->getName() ) );
        if ( !name.isEmpty() ) {
          myActiveStudy->renameIObject( Sel->firstIObject(), name );
        }
@@ -1845,9 +1919,20 @@ void QAD_ObjectBrowser::onUseCasePopupMenu( int action )
 */
 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 ) {
-    QAD_Desktop* Desktop     = (QAD_Desktop*) QAD_Application::getDesktop();
-    QAD_Study* myActiveStudy = Desktop->getActiveStudy();
     SALOMEDS::UseCaseBuilder_var UCBuilder = myStudy->GetUseCaseBuilder();
     UCBuilder->AddUseCase( tr( "NEW_OBJECT" ) ); 
     myActiveStudy->updateUseCaseBrowser();
index ef5f940997a2ec25b85f0df095f0c5d4f5cfd66d..fec96c965ea6ae57f5fa4a3dcdbb355ea07c3a95 100644 (file)
@@ -124,6 +124,7 @@ protected slots:
     void                  showPopupMenu(QListViewItem*);
     void                   showUseCasePopupMenu(QListViewItem*);
     
+    void                   onExpandAll();
     void                   onExpanded (QListViewItem*);
     void                   onCollapsed(QListViewItem*);
     void                   onUseCasePopupMenu( int );
index 72e22033ea4058816a10fa161458b08d7e9933a5..f5258e1a05a9b6bf35d6b397129e6f8aaf0fd31b 100644 (file)
@@ -46,6 +46,7 @@
 #include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
 //NRI
 
+#include "utilities.h"
 using namespace std;
 
 
@@ -409,7 +410,6 @@ void QAD_PyEditor::keyPressEvent( QKeyEvent *e )
              _isInHistory = true;
              _currentCommand = text(endLine).remove(0,SIZEPR);
              _currentCommand.truncate( _currentCommand.length() - 1 );
-             SCRUTE(_currentCommand);
            }
          QString previousCommand = myInterp->getPrevious();
          if (previousCommand.compare(BEGIN_HISTORY_PY) != 0)
index fad3df375d4c3e35f8c8975d21c91ad9f841a8a4..611b0e49bd26ac34794eee5de9013ddcdf007f6a 100644 (file)
@@ -10,6 +10,8 @@
 //  $Header$
 
 
+
+
 #include "QAD_PyInterp_mono.h"
 #include "utilities.h"
 
index 7656e6de4ca81f10f5f988cf6384ebe70221ae88..8559ce5fb0595badc69534bd0ff6adfad569977c 100644 (file)
@@ -164,7 +164,10 @@ QAD_RightFrame::QAD_RightFrame(QWidget *theParent,
     return;
   }
 
-  SharedLib.SetName( strdup(ComponentLib) );
+  const Standard_CString aCopyCL = CORBA::string_dup(ComponentLib);
+  SharedLib.SetName( aCopyCL);
+  delete(aCopyCL);
+  
   
   bool ok = SharedLib.DlOpen(OSD_RTLD_LAZY);
   if (!ok) {
@@ -284,3 +287,46 @@ void QAD_RightFrame::unCompressBottom()
     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() );
+}
+
index b92b6eb666b014b4590ef398668bb56c052e697e..8b4a10b9e95095c160da546f4200886b1b90e022 100644 (file)
@@ -55,7 +55,16 @@ class QAD_EXPORT QAD_RightFrame : public QAD_Splitter
   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;
   
index f43c8714f2854510a097ea39e24cf5defe8c6de7..1ad0b2112123565324e16c1a2f647fb4cca0531c 100644 (file)
@@ -389,6 +389,14 @@ 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                                 //
 //=======================================================================//
@@ -648,7 +656,7 @@ QAD_StudyFrame* QAD_Study::createStudyFrame( const QString& title, ViewType theV
                              title, VIEW_OCC,
                              myInterp, myMutex );
     
-    Standard_CString name = strdup(sf->title().latin1());
+    Standard_CString name = CORBA::string_dup(sf->title().latin1());
     anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeName");
     aName = SALOMEDS::AttributeName::_narrow(anAttr);
     aName->SetValue(name);
@@ -820,7 +828,7 @@ bool QAD_Study::undo()
 
     for ( QAD_StudyFrame* sf = myStudyFrames.first(); sf; sf = myStudyFrames.next() ) {
       /* Update Viewer */
-      sf->getRightFrame()->getViewFrame()->undo( myStudy, sf->entry() );
+      sf->getRightFrame()->getViewFrame()->undo( this, sf->entry() );
     }
     updateCaptions();
 
@@ -855,7 +863,7 @@ bool QAD_Study::redo()
 
     /* Update Viewer */
     for ( QAD_StudyFrame* sf = myStudyFrames.first(); sf; sf = myStudyFrames.next() ) {
-      sf->getRightFrame()->getViewFrame()->redo( myStudy, sf->entry() );
+      sf->getRightFrame()->getViewFrame()->redo( this, sf->entry() );
     }
     updateCaptions();
 
@@ -1192,7 +1200,7 @@ void QAD_Study::renameIObject( const Handle(SALOME_InteractiveObject)& IObject,
     SALOMEDS::AttributeName_var    aName;
     anAttr = aStudyBuilder->FindOrCreateAttribute(obj, "AttributeName");
     aName = SALOMEDS::AttributeName::_narrow(anAttr);
-    aName->SetValue(strdup(newName.latin1()));
+    aName->SetValue(newName.latin1());
   }
 
   // VSR 13/03/03 - rename Interactive object 
index 8139e8a5dbfe47b71e9c6b58ed0dde732388349c..4a41ee5d71e27351c349c0871252c33146eeb072 100644 (file)
@@ -83,6 +83,7 @@ public:
   bool            isModified() const;
   bool            isReadOnly() const;
   void            setReadOnly(bool state);
+  bool             isLocked();
   const QString&   getTitle() const;
   int              getStudyId();
   const QString&   getPath() const;
index b54b6dfc0d4d11f2fdfb5c70258bc20a26a040e3..92f5823d6d577c9308f088a2c206662389bcad76 100644 (file)
@@ -31,6 +31,7 @@
   \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"
@@ -133,22 +134,40 @@ void QAD_StudyFrame::closeEvent(QCloseEvent* e)
  */
 void QAD_StudyFrame::compressLeft()
 {
-  mySplitter->compress(myLeftFrm);
+  QSplitterPHandle* h = mySplitter->getHandleAfter(myLeftFrm);
+  if( h ) 
+    h->compressBefore();
 }
 
 void QAD_StudyFrame::compressRight()
 {
-  mySplitter->compress(myRightFrm);  
+  QSplitterPHandle* h = mySplitter->getHandleAfter(myLeftFrm);
+  if( h )
+    h->compressAfter();
 }
 
 void QAD_StudyFrame::unCompressLeft()
 {
-  mySplitter->unCompress(myLeftFrm);
+  QSplitterPHandle* h = mySplitter->getHandleAfter(myLeftFrm);
+  if( h )
+    h->unCompressBefore();
 }
 
 void QAD_StudyFrame::unCompressRight()
 {
-  mySplitter->unCompress(myRightFrm);  
+  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);
 }
 
 /*!
index cdb83befaa85a2d2300ae8e353cb69297384fe9c..ea8e45e82bca86d449b35ce7d3318f437176b28a 100644 (file)
@@ -82,6 +82,9 @@ class QAD_EXPORT QAD_StudyFrame: public QMainWindow
   void                unCompressLeft();
   void                unCompressRight();
 
+  bool                isCompressedLeft() const;
+  bool                isCompressedRight() const;
+  
  signals:
   void                sfStudyFrameActivated( QAD_StudyFrame* );
   void                sfStudyFrameClosing( QAD_StudyFrame*);
index 6fa9053717f09079fc3c6c83bba10b92a28766ca..c22c7a4a8224e785529c5df99c060cc166fffdde 100644 (file)
@@ -26,7 +26,6 @@
 //  Module : SALOME
 //  $Header$
 
-using namespace std;
 #include "QAD.h"
 #include "QAD_ViewFrame.h"
 #include "QAD_Application.h"
@@ -38,6 +37,8 @@ using namespace std;
 #include <qimage.h>
 #include "utilities.h"
 
+using namespace std;
+
 /*!
     Constructor
 */
@@ -69,30 +70,6 @@ void QAD_ViewFrame::cleanup()
 {
 } 
 
-bool QAD_ViewFrame::isInViewer(SALOMEDS::Study_var aStudy,
-                              const char* anEntry, const char* StudyFrameEntry)
-{
-  SALOMEDS::SObject_var RefSO;
-  SALOMEDS::SObject_var SO = aStudy->FindObjectID(StudyFrameEntry);
-  SALOMEDS::ChildIterator_var it = aStudy->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;
-}
-
-//san:T3.13 - it's up to VTKViewer_ViewFrame to implement (or not implement) getRenderer() method. Be careful!
-/*
-vtkRenderer* QAD_ViewFrame::getRenderer()
-{
-  MESSAGE ( "Only redefined  VTKViewer")
-  return NULL;
-}
-*/
-
 /*
    Dumps 3d-Viewer contents into image file
    File format is defined by file's extension; supported formats : PNG, BMP, GIF, JPG
index 48aa8693a719749b9f89076c65da487214476620..119490b634d6c8dc6b44e857fc74c65458cd9325 100644 (file)
 #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 vtkRenderer;
 
-class QAD_EXPORT QAD_ViewFrame : public QMainWindow
+class QAD_EXPORT QAD_ViewFrame : public QMainWindow, public SALOME_View
 {
   Q_OBJECT
 
@@ -53,7 +55,6 @@ public:
 
   virtual ViewType       getTypeView() const = 0; 
   virtual QWidget*       getViewWidget() = 0;
-//  virtual vtkRenderer*   getRenderer();
 
   virtual void           setBackgroundColor( const QColor& ) = 0;
   virtual QColor         backgroundColor() const = 0;
@@ -75,14 +76,8 @@ public:
   virtual bool           isVisible( const Handle(SALOME_InteractiveObject)& IObject ) = 0;
 
   /*  undo/redo management */
-  virtual void           undo(SALOMEDS::Study_var aStudy,
-                             const char* StudyFrameEntry) = 0;
-  virtual void           redo(SALOMEDS::Study_var aStudy,
-                             const char* StudyFrameEntry) = 0;
-
-  static bool           isInViewer(SALOMEDS::Study_var aStudy,
-                                   const char* anEntry,
-                                   const char* StudyFrameEntry);
+  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;
index a843fd12f92630590111fdd4114d5a814268d960..07e568038c3270cec2f52643ab4b78bee459ec65 100644 (file)
@@ -588,6 +588,12 @@ 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
 #---------------
@@ -856,6 +862,9 @@ 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"
 
index 8d95761e962f82effbf2d125faf45098e52cac4b..4b2a35045851b567f7ca5987413663412fd6f7b4 100644 (file)
@@ -42,6 +42,7 @@
 #include "QAD_Resource.h"
 #include "QAD_Tools.h"
 #include "QAD_WaitCursor.h"
+#include "QAD_MessageBox.h"
 
 // QT Includes
 #include <qapplication.h>
@@ -218,7 +219,7 @@ void SALOMEGUI_Application::onStudyShown( QAD_Study* study )
   }
 
   QAD_StudyFrame* sf = myActiveStudy->getActiveStudyFrame();
-  Standard_CString name = strdup(sf->title().latin1());
+  Standard_CString name = CORBA::string_dup(sf->title().latin1());
   
   SALOMEDS::SComponent_var father = aStudy->FindComponent("Interface Applicative");
   SALOMEDS::SObject_var newObj = B->NewObject(father);
@@ -479,61 +480,76 @@ void SALOMEGUI_Application::onDisplay(int id)
 
   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()) {
-    selList.Append(itInit.Value());
+    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 );
   }
-  
-  SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument();
 
-  bool needRepaint = false;
-    
   if (id == QAD_DisplayOnly_Popup_ID) 
     viewFrame->EraseAll();
 
-  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;
-
-    if (!IObject->hasEntry()) continue; 
-
-    SALOMEDS::SObject_var obj = aStudy->FindObjectID(IObject->getEntry());
-    if (!obj->_is_nil()) {
-      SALOMEDS::SComponent_var comp = obj->GetFatherComponent();
-      isComponent = (strcmp(comp->GetID(), obj->GetID()) == 0);
-    }
-
-    // For component -> display 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();
+  // 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());
-
+       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)
+    } 
+  }
+  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)
+  if ( needRepaint )
     viewFrame->Repaint();
 
   myActiveStudy->updateObjBrowser(true);
index 00f6efb08f9dada8ffa8aa8575f29a6181e8256c..9edbd3bb18dc79e8a7f92e94846f8938a639f476 100644 (file)
 //  Module : SALOME
 //  $Header$
 
-using namespace std;
+#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 "SALOMEGUI_Swig.hxx"
-#include "utilities.h"
+
+#include "SALOME_Event.hxx"
 
 #include "SALOME_Selection.h"
 #include "SALOME_InteractiveObject.hxx"
 #include "SALOME_ListIteratorOfListIO.hxx"
 
+#include "utilities.h"
+
+using namespace std;
+
+namespace SALOME{
+  QAD_ViewFrame* GetViewFrame(QAD_Study* theStudy){
+    return theStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame();
+  }
+
+  Handle(SALOME_InteractiveObject) FindIObject(QAD_Study* theStudy, const char *theEntry)
+  {
+    return GetViewFrame(theStudy)->FindIObject(theEntry);
+  }
+}
+
 
 /*!
   Constructor
 */
 SALOMEGUI_Swig::SALOMEGUI_Swig()
-// VSR 06-05-03 : _studyId(0)
 {
   //  MESSAGE("Constructeur");
 }
@@ -62,8 +77,8 @@ SALOMEGUI_Swig::~SALOMEGUI_Swig()
 */
 QAD_Study* SALOMEGUI_Swig::getActiveStudy()
 {
-  QAD_Application* app = QAD_Application::getDesktop()->getActiveApp();
-  if ( app ) return app->getActiveStudy();
+  if(QAD_Application* app = QAD_Application::getDesktop()->getActiveApp()) 
+    return app->getActiveStudy();
   return 0;
 }
 
@@ -72,12 +87,9 @@ QAD_Study* SALOMEGUI_Swig::getActiveStudy()
 */
 void SALOMEGUI_Swig::updateObjBrowser( bool updateSelection )
 {
-  // VSR 06-05-03 ============================================================
-  //QAD_Study* myActiveStudy = QAD_Application::getDesktop()->getActiveStudy();
-  QAD_Study* myActiveStudy = getActiveStudy();
-  if ( !myActiveStudy) return;
-  // end of VSR 06-05-03 =====================================================
-  myActiveStudy->updateObjBrowser( updateSelection );
+  if(QAD_Study* myActiveStudy = getActiveStudy())
+    ProcessVoidEvent(new TVoidMemFun1ArgEvent<QAD_Study,bool>
+                    (myActiveStudy,&QAD_Study::updateObjBrowser,updateSelection));
 }
 
 /*!
@@ -85,21 +97,9 @@ void SALOMEGUI_Swig::updateObjBrowser( bool updateSelection )
 */
 int SALOMEGUI_Swig::getActiveStudyId()
 {
-  // NRI 24-02-03 :
-  //  if (_studyId ==0)
-  //    {
-  //  QAD_Study* myStudy = QAD_Application::getDesktop()->getActiveStudy();
-  //  _name = myStudy->getTitle();
-
-  // VSR 06-05-03 ============================================================
-  // _studyId = QAD_Application::getDesktop()->getActiveStudy()->getStudyId();
-  int _studyId = 0;
-  QAD_Study* myActiveStudy = getActiveStudy();
-  if ( myActiveStudy) _studyId = myActiveStudy->getStudyId();
-  // SCRUTE(_studyId);
-  // end of VSR 06-05-03 =====================================================
-  //    }
-  return _studyId;
+  if(QAD_Study* myActiveStudy = getActiveStudy())
+    return myActiveStudy->getStudyId();
+  return 0;
 }
 
 /*!
@@ -107,18 +107,9 @@ int SALOMEGUI_Swig::getActiveStudyId()
 */
 const char *SALOMEGUI_Swig::getActiveStudyName()
 {
-  // VSR 06-05-03 ============================================================
-  // QAD_Study* myStudy = QAD_Application::getDesktop()->getActiveStudy();
-  // _name = myStudy->getTitle();
-  QString _name = QString::null;
-  QAD_Study* myActiveStudy = getActiveStudy();
-  if ( myActiveStudy) _name = myActiveStudy->getTitle();
-  // end of VSR 06-05-03 =====================================================
-
-  // NRI 24-02-03 :
-  //if (_studyId ==0) 
-  //  getActiveStudyId();
-  return _name.latin1();
+  if(QAD_Study* myActiveStudy = getActiveStudy())
+    return myActiveStudy->getTitle().latin1();
+  return QString::null;
 }
 
 /*!
@@ -141,14 +132,11 @@ const char* SALOMEGUI_Swig::getComponentUserName( const char* ComponentName )
 */
 int SALOMEGUI_Swig::SelectedCount()
 {
-  // VSR 06-05-03 ============================================================
-  //QAD_Study* myStudy = QAD_Application::getDesktop()->getActiveStudy();
-  QAD_Study* myStudy = getActiveStudy();
-  if ( !myStudy) return 0;
-  // end of VSR 06-05-03 =====================================================
-  SALOME_Selection* Sel
-    = SALOME_Selection::Selection( myStudy->getSelection() );
-  return Sel->IObjectCount();
+  if(QAD_Study* myStudy = getActiveStudy()){
+    SALOME_Selection* Sel = SALOME_Selection::Selection(myStudy->getSelection());
+    return Sel->IObjectCount();
+  }
+  return 0;
 }
 
 /*!
@@ -156,68 +144,56 @@ int SALOMEGUI_Swig::SelectedCount()
 */
 const char* SALOMEGUI_Swig::getSelected(int i)
 {
-  // VSR 06-05-03 ============================================================
-  //QAD_Study* myStudy = QAD_Application::getDesktop()->getActiveStudy();
-  QAD_Study* myStudy = getActiveStudy();
-  if ( !myStudy) return "";
-  // end of VSR 06-05-03 =====================================================
-  SALOME_Selection* Sel
-    = SALOME_Selection::Selection( myStudy->getSelection() );
-  SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
-  int index = 0;
-  for(;It.More();It.Next())
-    {
-      Handle(SALOME_InteractiveObject) IObject = It.Value();
-      if ( i == index++ )
-       {
+  if(QAD_Study* myStudy = getActiveStudy()){
+    SALOME_Selection* Sel = SALOME_Selection::Selection( myStudy->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 *Entry)
+void SALOMEGUI_Swig::AddIObject(const char *theEntry)
 {
-  // VSR 06-05-03 ============================================================
-  //QAD_Study* myStudy = QAD_Application::getDesktop()->getActiveStudy();
-  QAD_Study* myStudy = getActiveStudy();
-  if ( !myStudy) return;
-  // end of VSR 06-05-03 =====================================================
-  SALOME_Selection* Sel
-    = SALOME_Selection::Selection( myStudy->getSelection() );
-
-  if ( !IsInCurrentView( Entry ) )
-    return;
-  
-  Handle(SALOME_InteractiveObject) IO = 
-    myStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame()->FindIObject( Entry );
-  Sel->AddIObject( IO );
+  if(QAD_Study* myStudy = getActiveStudy()){
+    SALOME_Selection* aSel = SALOME_Selection::Selection( myStudy->getSelection() );
+    if(IsInCurrentView(theEntry)){
+      Handle(SALOME_InteractiveObject) anIO = SALOME::FindIObject(myStudy,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 *Entry)
+void SALOMEGUI_Swig::RemoveIObject(const char *theEntry)
 {
-  // VSR 06-05-03 ============================================================
-  //QAD_Study* myStudy = QAD_Application::getDesktop()->getActiveStudy();
-  QAD_Study* myStudy = getActiveStudy();
-  if ( !myStudy) return;
-  // end of VSR 06-05-03 =====================================================
-  SALOME_Selection* Sel
-    = SALOME_Selection::Selection( myStudy->getSelection() );
-
-  if ( !IsInCurrentView( Entry ) )
-    return;
-
-  Handle(SALOME_InteractiveObject) IO = 
-    myStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame()->FindIObject( Entry );
-  Sel->RemoveIObject( IO );
+  if(QAD_Study* myStudy = getActiveStudy()){
+    SALOME_Selection* aSel = SALOME_Selection::Selection( myStudy->getSelection() );
+    if(IsInCurrentView(theEntry)){
+      Handle(SALOME_InteractiveObject) anIO = SALOME::FindIObject(myStudy,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));
+    }
+  }
 }
 
 
@@ -226,76 +202,65 @@ void SALOMEGUI_Swig::RemoveIObject(const char *Entry)
 */
 void SALOMEGUI_Swig::ClearIObjects()
 {
-  // VSR 06-05-03 ============================================================
-  //QAD_Study* myStudy = QAD_Application::getDesktop()->getActiveStudy();
-  QAD_Study* myStudy = getActiveStudy();
-  if ( !myStudy) return;
-  // end of VSR 06-05-03 =====================================================
-  SALOME_Selection* Sel
-    = SALOME_Selection::Selection( myStudy->getSelection() );
-  Sel->ClearIObjects();
+  if(QAD_Study* myStudy = getActiveStudy()){
+    SALOME_Selection* aSel = SALOME_Selection::Selection( myStudy->getSelection() );
+    ProcessVoidEvent(new TVoidMemFunEvent<SALOME_Selection>
+                    (aSel,&SALOME_Selection::ClearIObjects));
+  }
 }
 
 /*!
   Display
 */             
-void SALOMEGUI_Swig::Display(const char *Entry)
+void SALOMEGUI_Swig::Display(const char *theEntry)
 {
-  // VSR 06-05-03 ============================================================
-  //QAD_Study* myStudy = QAD_Application::getDesktop()->getActiveStudy();
-  QAD_Study* myStudy = getActiveStudy();
-  if ( !myStudy) return;
-  // end of VSR 06-05-03 =====================================================
-
-  if ( !IsInCurrentView( Entry ) )
-    return;
-
-  Handle(SALOME_InteractiveObject) IO = 
-    myStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame()->FindIObject( Entry );
-
-  myStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame()->Display(IO);
+  if(QAD_Study* myStudy = getActiveStudy()){
+    if(IsInCurrentView(theEntry)){
+      Handle(SALOME_InteractiveObject) anIO = SALOME::FindIObject(myStudy,theEntry);
+      if(anIO.IsNull())        return;
+      QAD_ViewFrame* aViewFrame = SALOME::GetViewFrame(myStudy);
+      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 *Entry)
+void SALOMEGUI_Swig::DisplayOnly(const char *theEntry)
 {
-  // VSR 06-05-03 ============================================================
-  //QAD_Study* myStudy = QAD_Application::getDesktop()->getActiveStudy();
-  QAD_Study* myStudy = getActiveStudy();
-  if ( !myStudy) return;
-  // end of VSR 06-05-03 =====================================================
-
-  if ( !IsInCurrentView( Entry ) )
-    return;
-
-  Handle(SALOME_InteractiveObject) IO = 
-    myStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame()->FindIObject( Entry );
-
-  if ( !IO.IsNull() ) {
-    myStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame()->DisplayOnly(IO);
+  if(QAD_Study* myStudy = getActiveStudy()){
+    if(IsInCurrentView(theEntry)){
+      Handle(SALOME_InteractiveObject) anIO = SALOME::FindIObject(myStudy,theEntry);
+      if(anIO.IsNull())        return;
+      QAD_ViewFrame* aViewFrame = SALOME::GetViewFrame(myStudy);
+      ProcessVoidEvent(new TVoidMemFun1ArgEvent<QAD_ViewFrame,
+                      const Handle(SALOME_InteractiveObject)&,
+                      Handle(SALOME_InteractiveObject)>
+                      (aViewFrame,&QAD_ViewFrame::DisplayOnly,anIO));
+    }
   }
 }
 
 /*!
   Erase
 */
-void SALOMEGUI_Swig::Erase(const char *Entry)
+void SALOMEGUI_Swig::Erase(const char *theEntry)
 {
-  // VSR 06-05-03 ============================================================
-  //QAD_Study* myStudy = QAD_Application::getDesktop()->getActiveStudy();
-  QAD_Study* myStudy = getActiveStudy();
-  if ( !myStudy) return;
-  // end of VSR 06-05-03 =====================================================
-
-  if ( !IsInCurrentView( Entry ) )
-    return;
-
-  Handle(SALOME_InteractiveObject) IO = 
-    myStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame()->FindIObject( Entry );
-
-  myStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame()->Erase(IO);
+  if(QAD_Study* myStudy = getActiveStudy()){
+    if(IsInCurrentView(theEntry)){
+      Handle(SALOME_InteractiveObject) anIO = SALOME::FindIObject(myStudy,theEntry);
+      if(anIO.IsNull())        return;
+      QAD_ViewFrame* aViewFrame = SALOME::GetViewFrame(myStudy);
+      ProcessVoidEvent(new TVoidMemFun2ArgEvent<QAD_ViewFrame,
+                      const Handle(SALOME_InteractiveObject)&,bool,
+                      Handle(SALOME_InteractiveObject)>
+                      (aViewFrame,&QAD_ViewFrame::Erase,anIO,true));
+    }
+  }
 }
 
 /*!
@@ -303,12 +268,11 @@ void SALOMEGUI_Swig::Erase(const char *Entry)
 */
 void SALOMEGUI_Swig::DisplayAll()
 {
-  // VSR 06-05-03 ============================================================
-  //QAD_Study* myStudy = QAD_Application::getDesktop()->getActiveStudy();
-  QAD_Study* myStudy = getActiveStudy();
-  if ( !myStudy) return;
-  // end of VSR 06-05-03 =====================================================
-  myStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame()->DisplayAll();
+  if(QAD_Study* myStudy = getActiveStudy()){
+    QAD_ViewFrame* aViewFrame = SALOME::GetViewFrame(myStudy);
+    ProcessVoidEvent(new TVoidMemFunEvent<QAD_ViewFrame>
+                    (aViewFrame,&QAD_ViewFrame::DisplayAll));
+  }
 }
 
 /*!
@@ -316,66 +280,20 @@ void SALOMEGUI_Swig::DisplayAll()
 */
 void SALOMEGUI_Swig::EraseAll()
 {
-  // VSR 06-05-03 ============================================================
-  //QAD_Study* myStudy = QAD_Application::getDesktop()->getActiveStudy();
-  QAD_Study* myStudy = getActiveStudy();
-  if ( !myStudy) return;
-  // end of VSR 06-05-03 =====================================================
-  SALOME_Selection* Sel 
-    = SALOME_Selection::Selection( myStudy->getSelection() );
-  
-  Sel->ClearIObjects();
-  myStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame()->EraseAll();
+  ClearIObjects();
+  if(QAD_Study* myStudy = getActiveStudy()){
+    QAD_ViewFrame* aViewFrame = SALOME::GetViewFrame(myStudy);
+    ProcessVoidEvent(new TVoidMemFunEvent<QAD_ViewFrame>
+                    (aViewFrame,&QAD_ViewFrame::EraseAll));
+  }
 }
 
 /*!
   Checks if object is displayed in current viewer
 */
-bool SALOMEGUI_Swig::IsInCurrentView(const char *Entry)
+bool SALOMEGUI_Swig::IsInCurrentView(const char *theEntry)
 {
-  // VSR 06-05-03 ============================================================
-  //QAD_Study* myStudy = QAD_Application::getDesktop()->getActiveStudy();
-  QAD_Study* myStudy = getActiveStudy();
-  if ( !myStudy) return false;
-  // end of VSR 06-05-03 =====================================================
-  return myStudy->isInViewer( Entry, myStudy->getActiveStudyFrame()->entry() );
+  if(QAD_Study* myStudy = getActiveStudy())
+    return myStudy->isInViewer( theEntry, myStudy->getActiveStudyFrame()->entry() );
+  return false;
 }
-
-/*!
-  Gets VTK renderer if available
-*/
-//san:T3.13 - move getRenderer() implementation from here to SalomePy.cxx
-/*vtkRenderer *SALOMEGUI_Swig::getRenderer(int viewId)
-{
-  // VSR 06-05-03 ============================================================
-  //QAD_Study* myStudy = QAD_Application::getDesktop()->getActiveStudy();
-  QAD_Application* app = QAD_Application::getDesktop()->getActiveApp();
-  if ( !app ) return NULL;
-  QAD_Study* myStudy = app->getActiveStudy();
-  if ( !myStudy) return NULL;
-  // end of VSR 06-05-03 =====================================================
-  int nbStudyFrames = myStudy->getStudyFramesCount();
-  vtkRenderer *myRenderer = NULL;
-  if (viewId == -1) // find the first frame with VTK viewer & get renderer
-    {
-      int i=0;
-      for(i=0; i<nbStudyFrames; i++)
-       {
-         if ( myStudy->getStudyFrame(i)->getTypeView() == VIEW_VTK )
-           {
-             myRenderer = myStudy->getStudyFrame(i)->getRightFrame()->getViewFrame()->getRenderer();
-             break;
-           }
-       }
-    }
-  else     // get the VTK renderer of a given frame
-    {
-      SCRUTE(viewId);
-      if ((viewId >=0) && (viewId <nbStudyFrames))
-       myRenderer = myStudy->getStudyFrame(viewId)->getRightFrame()->getViewFrame()->getRenderer();
-    }
-  if (myRenderer == NULL) MESSAGE("No VTK Renderer available !");
-  return myRenderer;
-}
-*/
-
index 0af5330a197e01a326078d4902d740e071661aa3..f61d26fd0bd39b83c08245c186b2ad7e7f9677a7 100644 (file)
 
 #include <Standard.hxx>
 
-class vtkRenderer;
+#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
 {
@@ -43,9 +51,6 @@ public:
   SALOMEGUI_Swig();
   ~SALOMEGUI_Swig();
 
-  //san:T3.13 - move getRenderer() implementation from here to SalomePy.cxx
-  //static vtkRenderer* getRenderer(int viewId = -1);
-
   void         updateObjBrowser( bool updateSelection );
   QAD_Study*   getActiveStudy();
   int          getActiveStudyId();
index 07c1b7bdbb322f022944a049cb4285cb8d4506bd..5f0455fcdf12ddb8bb527902499632ec97589618 100644 (file)
@@ -202,16 +202,16 @@ void SALOMEGUI_TableDlg::onOK()
              }
              if ( !bEmptyRow ) {  // Skip rows with no data !!!
                // set row title
-               tblIntAttr->SetRowTitle( nRow+1, rowTitles[ i ].isNull() ? strdup( "" ) : strdup( rowTitles[ i ] ) ); 
+               tblIntAttr->SetRowTitle( nRow+1, rowTitles[ i ].isNull() ? QString( "" ) : QString( rowTitles[ i ] ) ); 
                // set row unit
-               tblIntAttr->SetRowUnit( nRow+1, units[ i ].isNull() ? strdup( "" ) : strdup( units[ i ] ) ); 
+               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() ? strdup( "" ) : strdup( colTitles[ i ] ) );
+               tblIntAttr->SetColumnTitle( i+1, colTitles[ i ].isNull() ? QString( "" ) : QString( colTitles[ i ] ) );
            }
          }
          // title
@@ -247,16 +247,16 @@ void SALOMEGUI_TableDlg::onOK()
              }
              if ( !bEmptyRow ) {  // Skip rows with no data !!!
                // set row title
-               tblRealAttr->SetRowTitle( nRow+1, rowTitles[ i ].isNull() ? strdup( "" ) : strdup( rowTitles[ i ] ) ); 
+               tblRealAttr->SetRowTitle( nRow+1, rowTitles[ i ].isNull() ? QString( "" ) : QString( rowTitles[ i ] ) ); 
                // set row unit
-               tblRealAttr->SetRowUnit( nRow+1, units[ i ].isNull() ? strdup( "" ) : strdup( units[ i ] ) ); 
+               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() ? strdup( "" ) : strdup( colTitles[ i ] ) );
+               tblRealAttr->SetColumnTitle( i+1, colTitles[ i ].isNull() ? QString( "" ) : QString( colTitles[ i ] ) );
            }
          }
          // title
@@ -300,7 +300,7 @@ void SALOMEGUI_TableDlg::initDlg()
       try {
        SALOMEGUI_Table* tbl = myIntTable->getTable();
        // title
-       myIntTable->setTableTitle( strdup( tblIntAttr->GetTitle() ) );
+       myIntTable->setTableTitle( CORBA::string_dup( tblIntAttr->GetTitle() ) );
        // nb of rows & cols
        int nbRows = tblIntAttr->GetNbRows() ; 
        int nbCols = tblIntAttr->GetNbColumns();
@@ -311,7 +311,7 @@ void SALOMEGUI_TableDlg::initDlg()
        SALOMEDS::StringSeq_var rowTitles = tblIntAttr->GetRowTitles();
        for ( i = 0; i < nbRows; i++ ) {
          if ( rowTitles->length() > 0 )
-           strlist.append( strdup( rowTitles[i] ) );
+           strlist.append( CORBA::string_dup( rowTitles[i] ) );
          else
            strlist.append( "" );
        }
@@ -321,7 +321,7 @@ void SALOMEGUI_TableDlg::initDlg()
        SALOMEDS::StringSeq_var colTitles = tblIntAttr->GetColumnTitles();
        for ( i = 0; i < nbCols; i++ ) {
          if ( colTitles->length() > 0 )
-           strlist.append( strdup( colTitles[i] ) );
+           strlist.append( CORBA::string_dup( colTitles[i] ) );
          else
            strlist.append( "" );
        }
@@ -331,7 +331,7 @@ void SALOMEGUI_TableDlg::initDlg()
        SALOMEDS::StringSeq_var rowUnits = tblIntAttr->GetRowUnits();
        if ( rowUnits->length() > 0 ) {
          for ( i = 0; i < nbRows; i++ )
-           strlist.append( strdup( rowUnits[i] ) );
+           strlist.append( CORBA::string_dup( rowUnits[i] ) );
          myIntTable->setUnits( strlist );
        }
        // data
@@ -356,7 +356,7 @@ void SALOMEGUI_TableDlg::initDlg()
       try {
        SALOMEGUI_Table* tbl = myRealTable->getTable();
        // title
-       myRealTable->setTableTitle( strdup( tblRealAttr->GetTitle() ) );
+       myRealTable->setTableTitle( CORBA::string_dup( tblRealAttr->GetTitle() ) );
        // nb of rows & cols
        int nbRows = tblRealAttr->GetNbRows() ; 
        int nbCols = tblRealAttr->GetNbColumns();
@@ -367,7 +367,7 @@ void SALOMEGUI_TableDlg::initDlg()
        SALOMEDS::StringSeq_var rowTitles = tblRealAttr->GetRowTitles();
        for ( i = 0; i < nbRows; i++ ) {
          if ( rowTitles->length() > 0 )
-           strlist.append( strdup( rowTitles[i] ) );
+           strlist.append( CORBA::string_dup( rowTitles[i] ) );
          else
            strlist.append( "" );
        }
@@ -377,7 +377,7 @@ void SALOMEGUI_TableDlg::initDlg()
        SALOMEDS::StringSeq_var colTitles = tblRealAttr->GetColumnTitles();
        for ( i = 0; i < nbCols; i++ ) {
          if ( colTitles->length() > 0 )
-           strlist.append( strdup( colTitles[i] ) );
+           strlist.append( CORBA::string_dup( colTitles[i] ) );
          else
            strlist.append( "" );
        }
@@ -387,7 +387,7 @@ void SALOMEGUI_TableDlg::initDlg()
        SALOMEDS::StringSeq_var rowUnits = tblRealAttr->GetRowUnits();
        if ( rowUnits->length() > 0 ) {
          for ( i = 0; i < nbRows; i++ )
-           strlist.append( strdup( rowUnits[i] ) );
+           strlist.append( CORBA::string_dup( rowUnits[i] ) );
          myRealTable->setUnits( strlist );
        }
         // data
index e118f219db0e788e3f3008768a04c20a80d65d99..760c94eb3ab4092eba7805b37eaa40607e31e46a 100644 (file)
@@ -38,7 +38,7 @@
 #endif
 class Standard_NoSuchObject;
 class SALOME_InteractiveObject;
-class TColStd_MapOfInteger;
+class TColStd_IndexedMapOfInteger;
 class TColStd_MapTransientHasher;
 class SALOME_DataMapOfIOMapOfInteger;
 class SALOME_DataMapNodeOfDataMapOfIOMapOfInteger;
@@ -77,7 +77,7 @@ 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_MapOfInteger& Value() const;
+Standard_EXPORT  const TColStd_IndexedMapOfInteger& Value() const;
 
 
 
index 1fca36e3ebe63a334e502df902dbe5bc7dbe9d89..b45bb6c6d8b9eda36dafa4032baa3a601ed2b3bc 100644 (file)
@@ -33,8 +33,8 @@ using namespace std;
 #ifndef _SALOME_InteractiveObject_HeaderFile
 #include "SALOME_InteractiveObject.hxx"
 #endif
-#ifndef _TColStd_MapOfInteger_HeaderFile
-#include <TColStd_MapOfInteger.hxx>
+#ifndef _TColStd_IndexedMapOfInteger_HeaderFile
+#include <TColStd_IndexedMapOfInteger.hxx>
 #endif
 #ifndef _TColStd_MapTransientHasher_HeaderFile
 #include <TColStd_MapTransientHasher.hxx>
@@ -49,8 +49,8 @@ using namespace std;
 
 #define TheKey Handle_SALOME_InteractiveObject
 #define TheKey_hxx "SALOME_InteractiveObject.hxx"
-#define TheItem TColStd_MapOfInteger
-#define TheItem_hxx <TColStd_MapOfInteger.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
index dc0cbd32d3850ccbe65bf84b496723b60b07ee99..cbfa39192578fffbdfb224c9898e698b3be8efde 100644 (file)
@@ -37,8 +37,8 @@
 #ifndef _Handle_SALOME_InteractiveObject_HeaderFile
 #include <Handle_SALOME_InteractiveObject.hxx>
 #endif
-#ifndef _TColStd_MapOfInteger_HeaderFile
-#include <TColStd_MapOfInteger.hxx>
+#ifndef _TColStd_IndexedMapOfInteger_HeaderFile
+#include <TColStd_IndexedMapOfInteger.hxx>
 #endif
 #ifndef _TCollection_MapNode_HeaderFile
 #include <TCollection_MapNode.hxx>
@@ -47,7 +47,7 @@
 #include <TCollection_MapNodePtr.hxx>
 #endif
 class SALOME_InteractiveObject;
-class TColStd_MapOfInteger;
+class TColStd_IndexedMapOfInteger;
 class TColStd_MapTransientHasher;
 class SALOME_DataMapOfIOMapOfInteger;
 class SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger;
@@ -75,9 +75,9 @@ public:
 //      }
  // Methods PUBLIC
  // 
-Standard_EXPORT inline SALOME_DataMapNodeOfDataMapOfIOMapOfInteger(const Handle(SALOME_InteractiveObject)& K,const TColStd_MapOfInteger& I,const TCollection_MapNodePtr& n);
+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_MapOfInteger& Value() const;
+Standard_EXPORT inline   TColStd_IndexedMapOfInteger& Value() const;
 Standard_EXPORT ~SALOME_DataMapNodeOfDataMapOfIOMapOfInteger();
 
 
@@ -108,15 +108,15 @@ private:
  // Fields PRIVATE
  //
 Handle_SALOME_InteractiveObject myKey;
-TColStd_MapOfInteger myValue;
+TColStd_IndexedMapOfInteger myValue;
 
 
 };
 
 #define TheKey Handle_SALOME_InteractiveObject
 #define TheKey_hxx "SALOME_InteractiveObject.hxx"
-#define TheItem TColStd_MapOfInteger
-#define TheItem_hxx <TColStd_MapOfInteger.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
index 7fefc9c062f0d7a2d6a8c1432c2c72493324540f..d4d843fe0fc97601c35fa54577416763f8b53472 100644 (file)
@@ -34,8 +34,8 @@ using namespace std;
 #ifndef _SALOME_InteractiveObject_HeaderFile
 #include "SALOME_InteractiveObject.hxx"
 #endif
-#ifndef _TColStd_MapOfInteger_HeaderFile
-#include <TColStd_MapOfInteger.hxx>
+#ifndef _TColStd_IndexedMapOfInteger_HeaderFile
+#include <TColStd_IndexedMapOfInteger.hxx>
 #endif
 #ifndef _TColStd_MapTransientHasher_HeaderFile
 #include <TColStd_MapTransientHasher.hxx>
@@ -98,8 +98,8 @@ Standard_Boolean SALOME_DataMapNodeOfDataMapOfIOMapOfInteger::IsKind(const Handl
 Handle_SALOME_DataMapNodeOfDataMapOfIOMapOfInteger::~Handle_SALOME_DataMapNodeOfDataMapOfIOMapOfInteger() {}
 #define TheKey Handle_SALOME_InteractiveObject
 #define TheKey_hxx "SALOME_InteractiveObject.hxx"
-#define TheItem TColStd_MapOfInteger
-#define TheItem_hxx <TColStd_MapOfInteger.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
index 6617df7e0faa870abc9a18471e69318b2e5f273b..0478b82a122683b6597816f1fbd4ac512a81384a 100644 (file)
@@ -45,7 +45,7 @@
 class Standard_DomainError;
 class Standard_NoSuchObject;
 class SALOME_InteractiveObject;
-class TColStd_MapOfInteger;
+class TColStd_IndexedMapOfInteger;
 class TColStd_MapTransientHasher;
 class SALOME_DataMapNodeOfDataMapOfIOMapOfInteger;
 class SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger;
@@ -94,17 +94,17 @@ Standard_EXPORT   void Clear() ;
   Clear();
 }
 
-Standard_EXPORT   Standard_Boolean Bind(const Handle(SALOME_InteractiveObject)& K,const TColStd_MapOfInteger& I) ;
+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_MapOfInteger& Find(const Handle(SALOME_InteractiveObject)& K) const;
- const TColStd_MapOfInteger& operator()(const Handle(SALOME_InteractiveObject)& K) const
+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_MapOfInteger& ChangeFind(const Handle(SALOME_InteractiveObject)& K) ;
-  TColStd_MapOfInteger& operator()(const Handle(SALOME_InteractiveObject)& K) 
+Standard_EXPORT   TColStd_IndexedMapOfInteger& ChangeFind(const Handle(SALOME_InteractiveObject)& K) ;
+  TColStd_IndexedMapOfInteger& operator()(const Handle(SALOME_InteractiveObject)& K) 
 {
   return ChangeFind(K);
 }
index 990e1bad6b83ce5dd2d29cf106357a2f9615bc4a..e55a3e490d1420259ad18052edd7db72143dae94 100644 (file)
@@ -36,8 +36,8 @@ using namespace std;
 #ifndef _SALOME_InteractiveObject_HeaderFile
 #include "SALOME_InteractiveObject.hxx"
 #endif
-#ifndef _TColStd_MapOfInteger_HeaderFile
-#include <TColStd_MapOfInteger.hxx>
+#ifndef _TColStd_IndexedMapOfInteger_HeaderFile
+#include <TColStd_IndexedMapOfInteger.hxx>
 #endif
 #ifndef _TColStd_MapTransientHasher_HeaderFile
 #include <TColStd_MapTransientHasher.hxx>
@@ -52,8 +52,8 @@ using namespace std;
 
 #define TheKey Handle_SALOME_InteractiveObject
 #define TheKey_hxx "SALOME_InteractiveObject.hxx"
-#define TheItem TColStd_MapOfInteger
-#define TheItem_hxx <TColStd_MapOfInteger.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
index 21fa00996faf9c70f42a1accb4a21347b1ecc7dc..74a60fb5e09f3bdf6cad78cfaffb718d4ec30917 100644 (file)
@@ -26,7 +26,6 @@
 //  Module : SALOME
 //  $Header$
 
-using namespace std;
 /*!
   \class SALOME_Selection SALOME_Selection.h
   \brief Selection Mechanism of Interactive Object.
@@ -42,6 +41,15 @@ using namespace std;
 #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()
 {
@@ -245,7 +253,7 @@ int SALOME_Selection::AddIObject(const Handle(SALOME_InteractiveObject)& anObjec
   QAD_Study* myActiveStudy = myDesktop->getActiveStudy();
 
   if ( !IsOk(anObject) ) {
-    MESSAGE ( "The Object not authorized by Filters" )
+    if(MYDEBUG) INFOS ( "The Object not authorized by Filters" )
     myActiveStudy->highlight(anObject,false, update);
     return -1;
   }
@@ -307,13 +315,13 @@ int SALOME_Selection::IObjectCount()
 //!  Returns the first InteractiveObject in the selection.
 Handle(SALOME_InteractiveObject) SALOME_Selection::firstIObject()
 {
-  return myIObjects.First();
+  return myIObjects.Extent() > 0 ? myIObjects.First() : Handle(SALOME_InteractiveObject)();
 }
 
 //! Returns the last InteractiveObject in the selection.
 Handle(SALOME_InteractiveObject) SALOME_Selection::lastIObject()
 {
-  return myIObjects.Last();
+  return myIObjects.Extent() > 0 ? myIObjects.Last() : Handle(SALOME_InteractiveObject)();
 }
 
 /*!
@@ -351,7 +359,7 @@ bool SALOME_Selection::HasIndex( const Handle(SALOME_InteractiveObject)& IObject
   return myMapIOSubIndex.IsBound(IObject);
 }
 
-void SALOME_Selection::GetIndex( const Handle(SALOME_InteractiveObject)& IObject, TColStd_MapOfInteger& theIndex )
+void SALOME_Selection::GetIndex( const Handle(SALOME_InteractiveObject)& IObject, TColStd_IndexedMapOfInteger& theIndex )
 {
   if ( myMapIOSubIndex.IsBound(IObject) ) {
     theIndex = myMapIOSubIndex.Find(IObject);
@@ -368,11 +376,32 @@ bool SALOME_Selection::IsIndexSelected(const Handle(SALOME_InteractiveObject)& I
   if ( !myMapIOSubIndex.IsBound( IObject ) ) {
     return false;
   }
-  TColStd_MapOfInteger& MapIndex = myMapIOSubIndex.ChangeFind( IObject );
+  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, 
@@ -380,36 +409,34 @@ bool SALOME_Selection::AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)&
                                         bool modeShift,
                                         bool update)
 {
-  MESSAGE ( " SALOME_Selection::AddOrRemoveIndex " << index << " - " << modeShift );
+  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_MapOfInteger Empty;
+    TColStd_IndexedMapOfInteger Empty;
     myMapIOSubIndex.Bind( IObject, Empty );
   }
-  TColStd_MapOfInteger& MapIndex = myMapIOSubIndex.ChangeFind( IObject );
+  TColStd_IndexedMapOfInteger& MapIndex = myMapIOSubIndex.ChangeFind( IObject );
 
-  if ( MapIndex.Contains( index )) {
-    if ( modeShift ) {
-      MapIndex.Remove( index );
-      myActiveStudy->highlight( IObject, true, update );
-    }
-  } else {
-    if ( !modeShift )
-      MapIndex.Clear();
+  bool anIsConatains = MapIndex.Contains( index );
 
+  if (anIsConatains)
+    removeIndex( MapIndex, index );
+  
+  if (!modeShift)
+    MapIndex.Clear();
+  
+  if(!anIsConatains)
     MapIndex.Add( index );
-    myActiveStudy->highlight( IObject, true, update );
-    emit currentSelectionChanged();
-    return true;
-  }
 
   if ( MapIndex.IsEmpty() ) {
     myMapIOSubIndex.UnBind( IObject );
     RemoveIObject( IObject, update );
   }
 
+  myActiveStudy->highlight( IObject, true, update );   
+
   emit currentSelectionChanged();
   return false;
 }
@@ -423,40 +450,33 @@ bool SALOME_Selection::AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)&
   QAD_Study* myActiveStudy = myDesktop->getActiveStudy();
   
   if ( !myMapIOSubIndex.IsBound( IObject ) ) {
-    TColStd_MapOfInteger Empty;
+    TColStd_IndexedMapOfInteger Empty;
     myMapIOSubIndex.Bind( IObject, Empty );
   }
-  TColStd_MapOfInteger& MapIndex = myMapIOSubIndex.ChangeFind( IObject );
+  TColStd_IndexedMapOfInteger& MapIndex = myMapIOSubIndex.ChangeFind( IObject );
   TColStd_MapIteratorOfMapOfInteger It;
   It.Initialize(theIndices);
   
-  bool add = true;
-  
-  if (MapIndex.Contains(It.Key()))
-    {
-      if (!modeShift) return add;
-      add = false;
-    }
-  else if (!modeShift)
+  if (!modeShift)
     MapIndex.Clear();
   
-  if (add) 
-    for(;It.More();It.Next())
-      MapIndex.Add(It.Key());
-  else
-    for(;It.More();It.Next())
-      MapIndex.Remove(It.Key());
-  
+  for(;It.More();It.Next())
+    MapIndex.Add(It.Key());
   
+  if ( MapIndex.IsEmpty() ) {
+    myMapIOSubIndex.UnBind( IObject );
+    RemoveIObject( IObject, update );
+  }
+
   myActiveStudy->highlight( IObject, true, update );   
-  if ( MapIndex.IsEmpty() )  myMapIOSubIndex.UnBind( IObject );
+
   emit currentSelectionChanged();
   
-  return add;
+  return !MapIndex.IsEmpty();
 }
 
 bool SALOME_Selection::AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& IObject, 
-                                        const std::vector<int>& theIndices, 
+                                        const TContainerOfId& theIndices, 
                                         bool modeShift,
                                         bool update)
 {
@@ -464,42 +484,63 @@ bool SALOME_Selection::AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)&
   QAD_Study* myActiveStudy = myDesktop->getActiveStudy();
   
   if ( !myMapIOSubIndex.IsBound( IObject ) ) {
-    TColStd_MapOfInteger Empty;
+    TColStd_IndexedMapOfInteger Empty;
     myMapIOSubIndex.Bind( IObject, Empty );
   }
-  TColStd_MapOfInteger& MapIndex = myMapIOSubIndex.ChangeFind( IObject );
+  TColStd_IndexedMapOfInteger& MapIndex = myMapIOSubIndex.ChangeFind( IObject );
       
-  bool add = true;
-  
-  if (MapIndex.Contains(theIndices[0]))
-    {
-      if (!modeShift) return add;
-      add = false;
-    }
-  else if (!modeShift)
+  if (!modeShift)
     MapIndex.Clear();
   
-  if (add) 
-    for (int i=0; i<theIndices.size();i++)
-      MapIndex.Add(theIndices[i]); 
-  else
-    for (int i=0; i<theIndices.size();i++)
-      MapIndex.Remove(theIndices[i]);
-  
-  myActiveStudy->highlight( IObject, true, update );   
-  if ( MapIndex.IsEmpty() )  
+  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 add;
+  return !MapIndex.IsEmpty();
 }
 
 void SALOME_Selection::RemoveIndex( const Handle(SALOME_InteractiveObject)& IObject, int index )
 {
   if ( myMapIOSubIndex.IsBound( IObject ) ) {
-    TColStd_MapOfInteger& MapIndex = myMapIOSubIndex.ChangeFind( IObject );
-    if ( MapIndex.Contains( index ) )
-      MapIndex.Remove( index );
+    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();
+}
index 0058a1984c816667574ee9778300b7781adb58f9..a2e413262be456ce4d3d462b348985c4074b89cc 100644 (file)
@@ -43,7 +43,7 @@
 // Open CASCADE Include
 #include <TColStd_MapOfInteger.hxx>
 
-#include <vector>
+#include <set>
 
 enum Selection_Mode { 
  NodeSelection, 
@@ -96,13 +96,19 @@ public:
        
        bool                        HasIndex( const Handle(SALOME_InteractiveObject)& IObject );
        void                       GetIndex( const Handle(SALOME_InteractiveObject)& IObject, 
-                                            TColStd_MapOfInteger& theIndex );
+                                            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 std::vector<int>& 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();
index a468e9ffe6826e5acc737ee09d6a4f0afebd1128..d876a7350ebe5988a7fc33c85c7d0893d050d832 100644 (file)
@@ -36,16 +36,19 @@ using namespace std;
 #include <SALOMEconfig.h>
 #include CORBA_CLIENT_HEADER(Logger)
 
-SALOME_Logger::Logger_ptr m_pInterfaceLogger; // object reference on Logger server
+#include "utilities.h"
 
-SALOME_Log* SALOME_Log::_singleton = 0;
+// class SALOME_LoggerClient : public SALOME_Log
+// {
+// protected:
+//   SALOME_Logger::Logger_var m_pInterfaceLogger; // object reference on Logger server
+// };
 
-// log line size: if too short, log line is truncated, without crash...
-char SALOME_LogStr[1024]; 
+SALOME_Logger::Logger_ptr m_pInterfaceLogger; // object reference on Logger server
 
-SALOME_Log::SALOME_Log(): ostrstream(SALOME_LogStr,sizeof(SALOME_LogStr))
+SALOME_Log::SALOME_Log()
 {
-  cout << "SALOME_LoggerClient: constructor" << endl;
+  MESSAGE("SALOME_LoggerClient: constructor");
   //get reference on object reference from NS
   //and initialize m_pInterfaceLogger 
 
@@ -86,11 +89,11 @@ SALOME_Log::SALOME_Log(): ostrstream(SALOME_LogStr,sizeof(SALOME_LogStr))
            }  
          catch( CORBA::COMM_FAILURE& )
            {
-             cout<<"SALOME_LoggerClient: CORBA::COMM_FAILURE: Unable to contact the Naming Service"<<endl;
+             MESSAGE("SALOME_LoggerClient: CORBA::COMM_FAILURE: Unable to contact the Naming Service");
            }
           catch(...)
            {
-             cout<<"SALOME_LoggerClient: Unknown exception dealing with Naming Service"<<endl;
+             MESSAGE("SALOME_LoggerClient: Unknown exception dealing with Naming Service");
            }
          
          if(!CORBA::is_nil(inc))
@@ -98,30 +101,30 @@ SALOME_Log::SALOME_Log(): ostrstream(SALOME_LogStr,sizeof(SALOME_LogStr))
              obj = inc->resolve(name);
              m_pInterfaceLogger = SALOME_Logger::Logger::_narrow(obj);
              if (!CORBA::is_nil(m_pInterfaceLogger))
-               cout<<"SALOME_LoggerClient: Logger Server was found"<<endl;
+               MESSAGE("SALOME_LoggerClient: Logger Server was found");
              break;
            }
        }          
     }
   catch (const CosNaming::NamingContext::NotFound&)
     {
-      //       cout << "Caught exception: Naming Service can't found Logger";
+      //       MESSAGE("Caught exception: Naming Service can't found Logger");
     }
   catch (CORBA::COMM_FAILURE&)
     {
-      //       cout << "Caught CORBA::SystemException CommFailure.";
+      //       MESSAGE("Caught CORBA::SystemException CommFailure.");
     }
   catch (CORBA::SystemException&)
     {
-      //       cout << "Caught CORBA::SystemException.";
+      //       MESSAGE("Caught CORBA::SystemException.");
     }
   catch (CORBA::Exception&)
     {
-      //       cout << "Caught CORBA::Exception.";
+      //       MESSAGE("Caught CORBA::Exception.");
     }
   catch (...)
     {
-      //       cout << "Caught unknown exception.";
+      //       MESSAGE("Caught unknown exception.");
     }
   //cerr << "-----SALOME_Trace::SALOME_Trace----"<<endl;
 }
@@ -130,10 +133,10 @@ SALOME_Log::~SALOME_Log()
 {
 }
 
-SALOME_Log* SALOME_Log::Instance()
+SALOME_Log& SALOME_Log::Instance()
 {
-  if (_singleton == 0) _singleton = new SALOME_Log();
-  return _singleton;
+  static SALOME_Log instance;
+  return instance;
 }
 
 void SALOME_Log::putMessage(std::ostream& msg)
index 20a0edfe773dc707c439d73ac614cac8137376a5..d23fcf57111da44f233ad9874f897d6f28accbb8 100644 (file)
@@ -94,7 +94,8 @@ void SALOME_PYQT_GUI::initInterp(int 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 = new PyInterp_PyQt();
+    interp->initialize();
     mapInterp[StudyID] = interp;
   }
   // imports Python GUI module and puts it in _module attribute
@@ -134,6 +135,7 @@ 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));
index f06796eb72e00ec289297ced8f0e15b032e5f128..c997d9fa6b0d949450beec71b309c1003e986131 100644 (file)
@@ -180,8 +180,8 @@ def CheckCopyPaste(theSO, theInfo ,theComponentPaste):
     if theComponentPaste:
         aSObj = theSO.GetFatherComponent()
         theInfo = theInfo + "(paste for component)"
-    if not myStudyManager.Paste(aSObj):
-        raise RuntimeError, "<Paste> for "+theInfo+" returns false"
+    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):
@@ -213,16 +213,24 @@ def FindFileInDataDir(filename):
         
 #--------------------------------------------------------------------------
 # initialise the ORB
-orb = CORBA.ORB_init([''], CORBA.ORB_ID)
+orb = None
+
+while orb == None:
+    orb = CORBA.ORB_init([''], CORBA.ORB_ID)
 
 # create an LifeCycleCORBA instance
 lcc = LifeCycleCORBA(orb)
 
+while lcc._catalog == None:
+    lcc = LifeCycleCORBA(orb)
+
 #create a naming service instance
 naming_service = SALOME_NamingServicePy_i(orb)
 
 # get Study Manager reference
-obj = naming_service.Resolve('myStudyManager')
+obj=None
+while obj == None:
+    obj = naming_service.Resolve('myStudyManager') 
 myStudyManager = obj._narrow(SALOMEDS.StudyManager)
 
 # create new study
@@ -239,3 +247,4 @@ myStudyName = myStudy._get_Name()
 myStudyId = myStudy._get_StudyId()
 print myStudyId
 
+
index 2a8196dc0aaf3d8cb8574ea814e438e515acc535..a1e63a6ccc34720bce76cc2b0078ebb5fd37e276 100644 (file)
@@ -95,7 +95,7 @@ idbox = geompy.addToStudy(box,"box")
 
 subShapeList=geompy.SubShapeAll(box,ShapeTypeFace)
 face=subShapeList[0]
-name = geompy.SubShapeName( face._get_Name(), box._get_Name() )
+name = geompy.SubShapeName(face, box)
 print name
 idface=geompy.addToStudyInFather(box,face,name)
 
@@ -103,7 +103,7 @@ idface=geompy.addToStudyInFather(box,face,name)
 
 subShellList=geompy.SubShapeAll(box,ShapeTypeShell)
 shell = subShellList[0]
-name = geompy.SubShapeName( shell._get_Name(), box._get_Name() )
+name = geompy.SubShapeName(shell, box)
 print name
 idshell=geompy.addToStudyInFather(box,shell,name)
 
@@ -111,7 +111,7 @@ idshell=geompy.addToStudyInFather(box,shell,name)
 
 edgeList = geompy.SubShapeAll(face,ShapeTypeEdge)
 edge=edgeList[0];
-name = geompy.SubShapeName( edge._get_Name(), face._get_Name() )
+name = geompy.SubShapeName(edge, face)
 print name
 idedge=geompy.addToStudyInFather(face,edge,name)
 
index 42aeafdf3a73e460bac6a82d04bb3155bd3c1981..05edf9581a2fed40191ddafe1b9d18b31772ffc6 100644 (file)
@@ -87,7 +87,7 @@ class QAD_EXPORT SUPERVGraph_ViewFrame : public QAD_ViewFrame {
 
 
   /* selection */
-  Handle(SALOME_InteractiveObject) FindIObject(const char* Entry) { };
+  Handle(SALOME_InteractiveObject) FindIObject(const char* Entry) { Handle(SALOME_InteractiveObject) o; return o; };
 
   /* display */                
   void           Display(const Handle(SALOME_InteractiveObject)& IObject, bool immediatly = true){};
index 2072c8e84d02cb3464bcfa7d2497693095fbb50b..01c5872213ed99e30936b984278c4ad25d51c276 100644 (file)
@@ -42,7 +42,8 @@ LIB = libSalomeSession.la
 LIB_SRC=\
        SALOME_Session_i.cxx \
        Session_ServerThread.cxx \
-       Session_ServerLauncher.cxx
+       Session_ServerLauncher.cxx \
+       SALOME_Session_SignalsHandler.cxx
 
 # Executables targets
 BIN = SALOME_Session_Server
@@ -52,7 +53,7 @@ BIN_CLIENT_IDL = SALOMEDS.idl SALOMEDS_Attributes.idl SALOME_Component.idl SALOM
 
 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
+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
 
 
 @CONCLUDE@
index cd9a08d4e24197c6098ed4ed47dbb046f1bb063c..2a8522145276c90c9c6449359ab1951f638ffa23 100644 (file)
@@ -31,7 +31,6 @@
 #include "SALOME_NamingService.hxx"
 #include <iostream>
 #include <unistd.h>
-using namespace std;
 
 #include <qthread.h> 
 #include <qapplication.h>
@@ -46,11 +45,10 @@ using namespace std;
 #include "QAD_Config.h"
 #include "QAD_Tools.h"
 #include "QAD_ResourceMgr.h"
-#include "Utils_CatchSignals.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)
@@ -63,18 +61,14 @@ using namespace std;
 
 #include "Session_ServerLauncher.hxx"
 
+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.
@@ -87,8 +81,17 @@ using namespace std;
  *   - get session state
  */
 
+using namespace std;
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
 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 ) ;
@@ -104,11 +107,7 @@ int main(int argc, char **argv)
 
       SALOME_NamingService *_NS = new SALOME_NamingService(orb);
 
-      Utils_CatchSignals aCatch;
-      aCatch.Activate();
-
       // CORBA Servant Launcher
-
       QMutex _GUIMutex ;
       QWaitCondition _ServerLaunch;
       _GUIMutex.lock();     // to block Launch server thread until wait(mutex)
@@ -117,34 +116,37 @@ int main(int argc, char **argv)
        = new Session_ServerLauncher(argc, argv, orb, poa, &_GUIMutex, &_ServerLaunch);
       myServerLauncher->start();
 
-      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
+      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...");
 
-      INFOS("Session activated, Launch IAPP...");
+       int qappArgc = 1;
+       if ( !_qappl )
+         _qappl = new QApplication(qappArgc, argv );
 
-      int qappArgc = 1;
-      QApplication *_qappl = new QApplication(qappArgc, argv );
-      INFOS("creation QApplication");
-      _GUIMutex.unlock();
+       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_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
-       {
-         
+       else {
          QFileInfo prgInfo(argv[0]);
          QDir prgDir(prgInfo.dirPath(true));
          QAD_CONFIG->setPrgDir(prgDir);        // CWD is program directory
@@ -154,77 +156,76 @@ int main(int argc, char **argv)
          
          _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");
-                 int _ret = _qappl->exec();
-                 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");
+         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");
-                 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();
+               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")+ "\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();
-      aCatch.Deactivate();
     }
   catch (SALOME_Exception& e)
     {
index 89002812778d13903f45145f887d4affe473bb1b..7e6c34c8699a52601fef7e4bcf2fc05330a1b7c4 100644 (file)
@@ -30,7 +30,7 @@
 
 #include "SALOME_Session_i.hxx"
 #include "SALOME_NamingService.hxx"
-#include "SALOME_Session_QThread.hxx"
+#include "SALOME_Event.hxx"
 
 #include "QAD_Application.h"
 #include "QAD_Desktop.h"
@@ -48,7 +48,12 @@ using namespace std;
  */ 
 //=============================================================================
 
-SALOME_Session_i::SALOME_Session_i(int argc, char ** argv, CORBA::ORB_ptr orb, PortableServer::POA_ptr poa, QMutex* GUIMutex)
+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 ;
@@ -57,7 +62,8 @@ SALOME_Session_i::SALOME_Session_i(int argc, char ** argv, CORBA::ORB_ptr orb, P
   _orb = CORBA::ORB::_duplicate(orb) ;
   _poa = PortableServer::POA::_duplicate(poa) ;
   _GUIMutex = GUIMutex;
-  MESSAGE("constructor end");
+  _GUILauncher = GUILauncher;
+  //MESSAGE("constructor end");
 }
 
 //=============================================================================
@@ -68,7 +74,7 @@ SALOME_Session_i::SALOME_Session_i(int argc, char ** argv, CORBA::ORB_ptr orb, P
 
 Engines::Component_ptr SALOME_Session_i::GetVisuComponent()
 {
-  MESSAGE("SALOME_Session_i::GetVisuGen");
+  //MESSAGE("SALOME_Session_i::GetVisuGen");
   typedef Engines::Component_ptr TGetImpl(CORBA::ORB_ptr,
                                         PortableServer::POA_ptr,
                                         SALOME_NamingService*,QMutex*);
@@ -87,7 +93,7 @@ Engines::Component_ptr SALOME_Session_i::GetVisuComponent()
 
 SALOME_Session_i::~SALOME_Session_i()
 {
-  MESSAGE("destructor end"); 
+  //MESSAGE("destructor end"); 
 }
 
 //=============================================================================
@@ -114,7 +120,7 @@ void SALOME_Session_i::NSregister()
     {
       INFOS("Caught unknown exception from Naming Service");
     }
-  MESSAGE("Session registered in Naming Service"); 
+  //MESSAGE("Session registered in Naming Service"); 
 }
 
 //=============================================================================
@@ -126,14 +132,10 @@ void SALOME_Session_i::NSregister()
 
 void SALOME_Session_i::GetInterface()
 {
-  _GUIMutex->lock() ;       // get access to boolean _isGUI
-  //_isGUI = _IAPPThread->running();
-  if(!_isGUI)
-    {
-      _isGUI = TRUE ; 
-      //_IAPPThread->start() ;
-    }
-  _GUIMutex->unlock() ; // release access to boolean _isGUI 
+  if( !QAD_Application::getDesktop() ) {
+    _GUILauncher->wakeAll();
+    MESSAGE("SALOME_Session_i::GetInterface() called, starting GUI...")
+  }
 }
 
 //=============================================================================
@@ -141,12 +143,18 @@ void SALOME_Session_i::GetInterface()
  *  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()
 {
-  qApp->lock();
-  QAD_Application::getDesktop()->closeDesktop( true );
-  qApp->unlock();
+  ProcessVoidEvent( new CloseEvent() );
 }
  
 //=============================================================================
@@ -156,23 +164,29 @@ void SALOME_Session_i::StopSession()
  */ 
 //=============================================================================
 
+class QtLock
+{
+public:
+  QtLock() { if ( qApp ) qApp->lock(); }
+  ~QtLock() { if ( qApp ) qApp->unlock(); }
+};
+
+
 SALOME::StatSession SALOME_Session_i::GetStatSession()
 {
   // update Session state
-  //qApp->lock(); // rollback bug 
   _GUIMutex->lock();    
-  //_isGUI = _IAPPThread->running();
-  _isGUI = 1;
+
   _runningStudies = 0;
-  if (_isGUI)
-    {
-      qApp->lock();
-      if ( QAD_Application::getDesktop() && QAD_Application::getDesktop()->getActiveApp() )
-       _runningStudies = QAD_Application::getDesktop()->getActiveApp()->getStudies().count();
-      qApp->unlock();
-    }
+  {
+    QtLock lock;
+    _isGUI = QAD_Application::getDesktop();
+    if ( _isGUI && QAD_Application::getDesktop()->getActiveApp() )
+      _runningStudies = QAD_Application::getDesktop()->getActiveApp()->getStudies().count();
+  }
+
   _GUIMutex->unlock();
-  //qApp->unlock();
+
   // getting stat info
   SALOME::StatSession_var myStats = new SALOME::StatSession ;
   if (_runningStudies)
@@ -184,3 +198,11 @@ SALOME::StatSession SALOME_Session_i::GetStatSession()
   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;
+}
index 438b93f62aeb2c105f35bb9eeca361ac9980e4a2..b6820e5af22f909533b3d6bef0c0910bbf3f1875 100644 (file)
@@ -41,7 +41,12 @@ 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);
+  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
@@ -58,6 +63,8 @@ public:
 
   //! Register the servant to Naming Service
   void NSregister();
+
+  CORBA::Long GetActiveStudyId();
   
   void ping(){};
 
@@ -70,6 +77,7 @@ protected:
   char **_argv;
   CORBA::Boolean _isGUI ;
   QMutex* _GUIMutex ;
+  QWaitCondition* _GUILauncher;
   int _runningStudies ;
   CORBA::ORB_var _orb;
   PortableServer::POA_var _poa;
index 4f278190b24de39e6c5b94b318bf7c444007cbff..8cbfce4de90f93c958d7ef88163f1da7e2a6f952 100644 (file)
@@ -81,15 +81,14 @@ Session_ServerLauncher::~Session_ServerLauncher()
 
 void Session_ServerLauncher::run()
 {
-  MESSAGE("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...");
+  //MESSAGE("Server Launcher thread free to go...");
    _GUIMutex->unlock();
 
   CheckArgs();
   ActivateAll();
 
-  _ServerLaunch->wakeAll();
   _orb->run();       // this thread wait, during omniORB process events
 }
 
@@ -207,8 +206,8 @@ void Session_ServerLauncher::ActivateAll()
   int argc=1;
   char** argv = new char*[argc];
   argv[0] = "Session";
-  Session_ServerThread* aServerThread
-    = new Session_ServerThread(argc, argv, _orb,_root_poa,_GUIMutex);
+  Session_SessionThread* aServerThread
+    = new Session_SessionThread(argc, argv, _orb,_root_poa,_GUIMutex,_ServerLaunch);
   _serverThreads.push_front(aServerThread);
 
   aServerThread->Init();
index c69b61e4b7576dc438a17974c07be64cb774cf88..886aef9b903390e66d89c6e244e36a38a021ff15 100644 (file)
@@ -80,7 +80,7 @@ Session_ServerThread::Session_ServerThread(int argc,
                                           PortableServer::POA_ptr poa,
                                           QMutex *GUIMutex)
 {
-  MESSAGE("Session_ServerThread Constructor " << argv[0]);
+  //MESSAGE("Session_ServerThread Constructor " << argv[0]);
   _argc = argc;
   _argv = argv;
   _orb = CORBA::ORB::_duplicate(orb);
@@ -99,7 +99,7 @@ Session_ServerThread::Session_ServerThread(int argc,
 
 Session_ServerThread::~Session_ServerThread()
 {
-  MESSAGE("~Session_ServerThread "<< _argv[0]);
+  //MESSAGE("~Session_ServerThread "<< _argv[0]);
 }
 
 //=============================================================================
@@ -416,12 +416,33 @@ void Session_ServerThread::ActivateContainer(int argc,
 
 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) ;
+         = 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)");
index 32ec3e76b0c9ed368b210c3be0c8e8996a732204..b7dfc2c865dba2d774ed9033b4f0dfb2e8763aba 100644 (file)
@@ -60,10 +60,10 @@ protected:
                        char ** argv);
   void ActivateContainer(int argc,
                        char ** argv);
-  void ActivateSession(int argc,
+  virtual void ActivateSession(int argc,
                        char ** argv);
 
-private:
+protected:
   int _argc;
   char ** _argv;
   int _servType;
@@ -73,5 +73,24 @@ private:
   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
 
index 210c4273940dd87f805f6bcb09f2db8f3f3ec543..f14dcade09068e399e3032ab2f71f232c5863b0d 100644 (file)
@@ -31,7 +31,7 @@ using namespace std;
 // function : GetTempDir
 // purpose  : Return a temp directory to store created files like "/tmp/sub_dir/" 
 //============================================================================ 
-char* SALOMEDS_Tool::GetTmpDir()
+std::string SALOMEDS_Tool::GetTmpDir()
 {
   //Find a temporary directory to store a file
 
@@ -83,7 +83,7 @@ char* SALOMEDS_Tool::GetTmpDir()
   OSD_Protection aProtection(OSD_RW, OSD_RWX, OSD_RX, OSD_RX);
   aDir.Build(aProtection);
 
-  return CORBA::string_dup(aTmpDir.ToCString());
+  return aTmpDir.ToCString();
 }
 
 //============================================================================
@@ -105,6 +105,10 @@ void SALOMEDS_Tool::RemoveTemporaryFiles(const char* theDirectory,
     OSD_File anOSDFile(anOSDPath);
     if(!anOSDFile.Exists()) continue;
 
+    OSD_Protection aProtection = anOSDFile.Protection();
+    aProtection.SetUser(OSD_RW);
+    anOSDFile.SetProtection(aProtection);
+
     anOSDFile.Remove();
   }
 
@@ -128,7 +132,9 @@ SALOMEDS_Tool::PutFilesToStream(const char* theFromDirectory,
                                const int theNamesOnly)
 {
   int i, aLength = theFiles.length();
-  if(aLength == 0) return NULL;
+  if(aLength == 0)
+//    return NULL;
+    return (new SALOMEDS::TMPFile);
 
   TCollection_AsciiString aTmpDir(const_cast<char*>(theFromDirectory)); //Get a temporary directory for saved a file
 
@@ -146,7 +152,7 @@ SALOMEDS_Tool::PutFilesToStream(const char* theFromDirectory,
     //Check if the file exists
     
     if (!theNamesOnly) { // mpv 15.01.2003: if only file names must be stroed, then size of files is zero
-      TCollection_AsciiString aFullPath = aTmpDir + strdup(theFiles[i]);   
+      TCollection_AsciiString aFullPath = aTmpDir + CORBA::string_dup(theFiles[i]);   
       OSD_Path anOSDPath(aFullPath);
       OSD_File anOSDFile(anOSDPath);
       if(!anOSDFile.Exists()) continue;
@@ -168,7 +174,9 @@ SALOMEDS_Tool::PutFilesToStream(const char* theFromDirectory,
 
   aBufferSize += 4;      //4 bytes for a number of the files that will be written to the stream;
   unsigned char* aBuffer = new unsigned char[aBufferSize];  
-  if(aBuffer == NULL) return NULL; 
+  if(aBuffer == NULL)
+//    return NULL; 
+    return (new SALOMEDS::TMPFile);
 
   //Initialize 4 bytes of the buffer by 0
   memset(aBuffer, 0, 4); 
@@ -181,7 +189,7 @@ SALOMEDS_Tool::PutFilesToStream(const char* theFromDirectory,
   for(i=0; i<aLength; i++) {
     ifstream *aFile;
     if (!theNamesOnly) { // mpv 15.01.2003: we don't open any file if theNamesOnly = true
-      TCollection_AsciiString aFullPath = aTmpDir + strdup(theFiles[i]);
+      TCollection_AsciiString aFullPath = aTmpDir + CORBA::string_dup(theFiles[i]);
       OSD_Path anOSDPath(aFullPath);
       OSD_File anOSDFile(anOSDPath);
       if(!anOSDFile.Exists()) continue;
@@ -229,7 +237,7 @@ SALOMEDS_Tool::PutFilesToStream(const char* theFromDirectory,
 // function : PutStreamToFile
 // purpose  : converts the stream "theStream" to the files
 //============================================================================
-SALOMEDS::ListOfFileNames* 
+SALOMEDS::ListOfFileNames_var 
 SALOMEDS_Tool::PutStreamToFiles(const SALOMEDS::TMPFile& theStream,
                                const char* theToDirectory,
                                const int theNamesOnly)
@@ -277,28 +285,28 @@ SALOMEDS_Tool::PutStreamToFiles(const SALOMEDS::TMPFile& theStream,
     delete[] aFileName;
   }
 
-  return aFiles._retn();
+  return aFiles;
 }
 
 //============================================================================
 // function : GetNameFromPath
 // purpose  : Returns the name by the path
 //============================================================================
-char* SALOMEDS_Tool::GetNameFromPath(const char* thePath) {
-  if (thePath == NULL) return strdup("");
-  OSD_Path aPath = OSD_Path(TCollection_AsciiString(strdup(thePath)));
+std::string SALOMEDS_Tool::GetNameFromPath(const char* thePath) {
+  if (thePath == NULL) return string("");
+  OSD_Path aPath = OSD_Path(TCollection_AsciiString((char*)thePath));
   TCollection_AsciiString aNameString(aPath.Name());
-  return CORBA::string_dup(aNameString.ToCString());
+  return aNameString.ToCString();
 }
 
 //============================================================================
 // function : GetDirFromPath
 // purpose  : Returns the dir by the path
 //============================================================================
-char* SALOMEDS_Tool::GetDirFromPath(const char* thePath) {
-  if (thePath == NULL) return strdup("");
-  OSD_Path aPath = OSD_Path(TCollection_AsciiString(strdup(thePath)));
+std::string SALOMEDS_Tool::GetDirFromPath(const char* thePath) {
+  if (thePath == NULL) return string("");
+  OSD_Path aPath = OSD_Path(TCollection_AsciiString((char*)thePath));
   TCollection_AsciiString aDirString(aPath.Trek());
   aDirString.ChangeAll('|','/');
-  return CORBA::string_dup(aDirString.ToCString());
+  return aDirString.ToCString();
 }
index c5f8e2260fecd64e31abc38b000cc4c40d2cf460..fed29bf5509497fe361eaf8044f79631aad5ac7c 100644 (file)
 #ifndef __SALOMEDS_Tool_H__
 #define __SALOMEDS_Tool_H__
 
-
+#include <string> 
 
 // IDL headers
-#include <SALOMEDS.hh> 
+#include "SALOMEconfig.h"
+#include CORBA_SERVER_HEADER(SALOMEDS)
 
 class SALOMEDS_Tool                                
 {
+
 public:
  
   // Returns the unique temporary directory, that is defined in SALOME_TMP_DIR if this variable is set
   // otherwise return /tmp/something/ for Unix or c:\something\ for WNT
-  static char* GetTmpDir();
+  static std::string GetTmpDir();
 
  
   // Removes files which are in <theDirectory>, the files for deletion are listed in <theFiles>
@@ -36,17 +38,17 @@ public:
                                             const int theNamesOnly = 0);
 
   // Converts a byte sequence <theStream> to files and places them in <theToDirectory>
-  static SALOMEDS::ListOfFileNames* PutStreamToFiles(const SALOMEDS::TMPFile& theStream,
+  static SALOMEDS::ListOfFileNames_var PutStreamToFiles(const SALOMEDS::TMPFile& theStream,
                                                      const char* theToDirectory,
                                                     const int theNamesOnly = 0);
 
   // Returns the name by the path
   // for an example: if thePath = "/tmp/aaa/doc1.hdf" the function returns "doc1"
-  static char* GetNameFromPath(const char* thePath);
+  static std::string GetNameFromPath(const char* thePath);
 
   // Returns the directory by the path
   // for an example: if thePath = "/tmp/aaa/doc1.hdf" the function returns "/tmp/aaa"
-  static char* GetDirFromPath(const char* thePath);
+  static std::string GetDirFromPath(const char* thePath);
 
 };
 #endif
index abe1d147d33bacb0be2a48aa69e8185f77710bce..43b673a8e95fc63a00e1f0588714ff7b373a8047 100644 (file)
@@ -27,7 +27,6 @@
 //  Module : SALOME
 //  $Header$
 
-using namespace std;
 #include "ToolsGUI_CatalogGeneratorDlg.h"
 
 #include "QAD_Application.h"
@@ -50,6 +49,10 @@ using namespace std;
 #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
@@ -300,7 +303,7 @@ QString ToolsGUI_CatalogGeneratorDlg::getIdlPath()
   QString IDLpath = "";
 
   for (unsigned int ind = 0; ind < list_composants->length();ind++) {
-    QString modulename = strdup(list_composants[ind].modulename) ;
+    QString modulename = CORBA::string_dup(list_composants[ind].modulename) ;
     
     QCString dir;
     if (dir = getenv( modulename + "_ROOT_DIR")) {
index 8fc899ec08a65002ce7626244d943cb61dc63ea1..25eeed28b13e1c5da14709a37b8122322a6d8997 100644 (file)
 #include "Utils_CommException.hxx"
 using namespace std;
 
+static ostream& operator<<(ostream& os, const CORBA::Exception& e)
+{
+  CORBA::Any tmp;
+  tmp<<= e;
+  CORBA::TypeCode_var tc = tmp.type();
+  const char *p = tc->name();
+  os<<"Test blocking exception was catch of the kind : ";
+  if ( *p != '\0' ) {
+    os<<p;
+  } 
+  else  { 
+    os << tc->id();
+  }
+  
+  return os;
+}
+
+
 int main (int argc, char * argv[])
 {
 
@@ -193,11 +211,11 @@ int main (int argc, char * argv[])
   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::SystemException& e) {
+    INFOS("Caught a CORBA::SystemException."<<e)
       }
-  catch(CORBA::Exception&) {
-    INFOS("Caught CORBA::Exception.")
+  catch(CORBA::Exception& e) {
+    INFOS("Caught CORBA::Exception."<<e)
       }
   catch(...) {
     INFOS("Caught unknown exception.")
index df6e8c5efc6ead3217ec3431bd3d1ca23f95ad85..f7f5d5a65967114fb023744f0f9ac1d999402cd5 100644 (file)
@@ -46,7 +46,7 @@ EXPORT_HEADERS= \
        Utils_SINGLETON.hxx \
        Utils_DESTRUCTEUR_GENERIQUE.hxx \
        Utils_ExceptHandlers.hxx \
-       Utils_CatchSignals.h
+       Utils_SignalsHandler.h
 
 EXPORT_PYSCRIPTS = Utils_Identity.py SALOME_utilities.py
 # Libraries targets
@@ -58,7 +58,7 @@ LIB_SRC = OpUtil.cxx Utils_Timer.cxx duplicate.cxx \
        Utils_Identity.cxx Utils_ORB_INIT.cxx \
        Utils_DESTRUCTEUR_GENERIQUE.cxx \
        Utils_ExceptHandlers.cxx \
-       Utils_CatchSignals.cxx
+       Utils_SignalsHandler.cxx
 
 LIB_SERVER_IDL = SALOME_Exception.idl
 
diff --git a/src/Utils/Utils_CatchSignals.cxx b/src/Utils/Utils_CatchSignals.cxx
deleted file mode 100644 (file)
index 5ffc4f9..0000000
+++ /dev/null
@@ -1,236 +0,0 @@
-//  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
-//
-//
-//
-//  File   : Utils_CatchSignals.cxx
-//  Author : Oksana Tchebanova
-//  Module : KERNEL
-//  $Header:
-
-
-#include "Utils_CatchSignals.h"
-#include "utilities.h"
-
-#include <stdexcept>
-
-#define RESERVE_SIZE 100000
-
-static void* theCallBack = NULL;
-static int *myReserve = NULL;
-using namespace std;
-//=======================================================================
-//function : Utils_CatchSignals
-//purpose  : Constructor
-//=======================================================================
-Utils_CatchSignals::Utils_CatchSignals() 
-     :myIsActivated(false)
-{
-  
-  for(int i = 0; i<SIG_MAX_NUM; i++)
-    mySigStates[i] = NULL;
-
-  theCallBack = NULL; 
-}
-
-#ifndef WNT
-
-//================================ UNIX part ==================================================
-
-
-//==============================
-typedef void (ACT_SIGIO_HANDLER)(void) ;
-
-ACT_SIGIO_HANDLER *ADR_ACT_SIGIO_HANDLER = NULL ;
-
-typedef void (* SIG_PFV) (int);
-
-#ifdef SUN
-# include <floatingpoint.h>
-#endif
-
-#ifdef SOLARIS
-# include <floatingpoint.h>
-# include <sys/machsig.h>
-# include <stdlib.h>
-# include <stdio.h>
-#endif
-
-#include <signal.h>
-#include <sys/signal.h>
-
-#ifdef LIN
-# include <stdlib.h>
-# include <stdio.h>
-#else
-# ifdef SA_SIGINFO 
-#   ifndef AIX
-# include <bits/siginfo.h>
-#    endif
-# endif
-#endif
-
-
-#ifdef IRIX
-# include <sigfpe.h>
-# include <sys/siginfo.h>
-#endif 
-
-#include <unistd.h>
-//============================================================================
-//function : Handler 
-//purpose  : univisal handler for signals
-//============================================================================
-static void Handler(const int theSig )
-{
-  if (myReserve) {
-    delete myReserve; 
-    myReserve = NULL;
-  }
-  char aMessage[1000];
-
-#if defined __GNUC__
-  #if __GNUC__ == 2
-    #define __GNUC_2__
-  #endif
-#endif
-#if defined __GNUC_2__
-  const char* message = "La fonction strsignal n'est pas supportée par gcc2.95.4";
-  sprintf (aMessage, "%d signal cautch : %s", theSig, message);
-#else
-  sprintf (aMessage, "%d signal cautch : %s", theSig, strsignal(theSig));
-#endif
-
-
-  MESSAGE("Utils_CatchSignal  Handler :: " << aMessage );
-  if(theCallBack == NULL) {
-    MESSAGE("Utils_CatchSignal  Handler : throw std::runtime_error()");
-    throw (std::runtime_error(aMessage));
-  }
-  else ((void (*)())theCallBack)();  
-}
-//=======================================================================
-//function : TryHandlerReset
-//purpose  : Redefine signal handlers. If the handler of the signal is
-//           set as SIG_IGN. That's why the shells often ignore some 
-//           signal when starting child processes. We keep it.
-//=======================================================================
-static SIG_PFV TryHandlerReset( int theSigNum )
-{
-  if (signal(theSigNum, (SIG_PFV) &Handler) == SIG_IGN)
-    {
-      signal(theSigNum, SIG_IGN);  
-      MESSAGE("signal "<<theSigNum <<" is kept as ignored");
-      return SIG_IGN;
-    } 
-  else return signal(theSigNum, (SIG_PFV) &Handler);
-}
-//=======================================================================
-//function : Activate
-//purpose  : 
-//=======================================================================
-
-void Utils_CatchSignals::Activate() 
-{  
-  if(myIsActivated) return;
-
-  if (myReserve) delete myReserve;
-  myReserve = new int[RESERVE_SIZE];
-
-    
-  mySigStates[0] = TryHandlerReset(SIGHUP);   // ...... floating point exception
-  mySigStates[1] = TryHandlerReset(SIGFPE);   // ...... floating point exception
-  
-  mySigStates[2] = TryHandlerReset(SIGINT);   // ...... interrupt
-  mySigStates[3] = TryHandlerReset(SIGQUIT);  // ...... quit
-  mySigStates[4] = TryHandlerReset(SIGBUS);   // ...... bus error
-  mySigStates[5] = TryHandlerReset(SIGILL);   // ...... illegal instruction
-  mySigStates[6] = TryHandlerReset(SIGTERM);  // ...... termination
-  mySigStates[7] = TryHandlerReset(SIGSEGV);  // ...... segmentation 
-  //mySigStates[8] = TryHandlerReset (SIGABRT); // ...... abort (ANSI).  
-  mySigStates[9] = TryHandlerReset(SIGSTKFLT);// ...... stack fault.  
-
-  myIsActivated = true;
-}
-
-//=======================================================================
-//function : Deactivate
-//purpose  : 
-//=======================================================================
-void Utils_CatchSignals::Deactivate() 
-{
-  if(!myIsActivated) return;
-
-  signal(SIGHUP, (SIG_PFV)mySigStates[0]);   // ...... hangup
-  signal(SIGFPE, (SIG_PFV)mySigStates[1]);   // ...... floating point exception
-  signal(SIGINT, (SIG_PFV)mySigStates[2]);   // ...... interrupt
-  signal(SIGQUIT,(SIG_PFV)mySigStates[3]);   // ...... quit
-  signal(SIGBUS, (SIG_PFV)mySigStates[4]);   // ...... bus error
-  signal(SIGILL, (SIG_PFV)mySigStates[5]);   // ...... illegal instruction
-  signal(SIGTERM,(SIG_PFV)mySigStates[6]);   // ...... illegal instruction
-  signal(SIGSEGV,(SIG_PFV)mySigStates[7]);   // ...... segmentation violation
-  //signal(SIGABRT,(SIG_PFV)mySigStates[8] );  // ...... abort (ANSI).     
-  signal(SIGSTKFLT,(SIG_PFV)mySigStates[9]); // ...... stack fault.  
-
-  myIsActivated = false;
-  delete myReserve;
-  myReserve = NULL;
-}
-#endif // ifndef WNT
-
-//=======================================================================
-//function : SetCallBack
-//purpose  : Sets pointer to (void (*)()
-//=======================================================================
-void Utils_CatchSignals::SetCallBack(const int theAddressHiPart, 
-                                        const int theAddressLowPart) 
-{
-  theCallBack = (void *)((theAddressHiPart << 32 ) + theAddressLowPart); 
-}
-
-//=======================================================================
-//function : UnsetCallBack
-//purpose  : 
-//=======================================================================
-void Utils_CatchSignals::UnsetCallBack()
-{
-  theCallBack = NULL;
-}
-
-//=======================================================================
-//function : Destroy
-//purpose  : 
-//=======================================================================
-void Utils_CatchSignals::Destroy() 
-{
-  if(myIsActivated) Deactivate();
-}
-
-bool Utils_CatchSignals::ReserveMemory()
-{
-  if (!myReserve) myReserve = new int [RESERVE_SIZE];
-  return true;
-}
-
-void Utils_CatchSignals::FreeReserved()
-{
-  if (myReserve) 
-    {delete myReserve ; myReserve = NULL;}
-}
diff --git a/src/Utils/Utils_CatchSignals.h b/src/Utils/Utils_CatchSignals.h
deleted file mode 100644 (file)
index bf45e7b..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-//  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
-//
-//
-//
-//  File   : Utils_CatchSignals.h
-//  Author : Oksana Tchebanova
-//  Module : KERNEL
-//  $Header:
-
-#ifndef _UTILS_CATCHSIGNALS_H_
-#define _UTILS_CATCHSIGNALS_H_
-
-#include <stdio.h>
-#define SIG_MAX_NUM 11 
-
-typedef void (* SIG_PFV) (int);
-
-class Utils_CatchSignals {
-
- public:
-  Utils_CatchSignals();
-  void Destroy() ;
-  ~Utils_CatchSignals()
-    {
-      Destroy();
-    }
-
-  static  void SetCallBack(const int theAddressHiPart,const int theAddressLowPart) ;
-  static  void UnsetCallBack() ;
-  void Activate();
-  void Deactivate() ;
-  bool ReserveMemory();
-  void FreeReserved();
-
-private: 
-
-  SIG_PFV mySigStates[SIG_MAX_NUM];
-  int  myFloatOpWord;
-  bool myIsActivated;
-};
-
-#endif
index 50737af05e9757d8f224dcc4b9c89b75befef29e..dbe9f1ba303f6d08f2450471c2b82beacc0a2d4a 100644 (file)
 //  Module : SALOME
 //  $Header$
 
-using namespace std;
-void Nettoyage( void ) ;
 
 # include <iostream>
-# include "utilities.h"
-# include "Utils_DESTRUCTEUR_GENERIQUE.hxx"
 # include <list>
 extern "C"
 {
 # include <stdlib.h>
 }
 
-static list<DESTRUCTEUR_GENERIQUE_*> *Destructeurs=0 ;
+# include "Utils_DESTRUCTEUR_GENERIQUE.hxx"
+# include "utilities.h"
+void Nettoyage();
 
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
 
+using namespace std;
 
+static list<DESTRUCTEUR_GENERIQUE_*> *Destructeurs=0 ;
 
 /*! \class ATEXIT_
  *
@@ -66,7 +71,7 @@ public :
        ATEXIT_( void )
        {
                ASSERT (Destructeurs==0);
-               MESSAGE("Construction ATEXIT"); // message necessaire pour utiliser logger dans Nettoyage (cf.BUG KERNEL4561)
+               if(MYDEBUG) MESSAGE("Construction ATEXIT"); // message necessaire pour utiliser logger dans Nettoyage (cf.BUG KERNEL4561)
                Destructeurs = new list<DESTRUCTEUR_GENERIQUE_*> ; // Destructeurs alloué dynamiquement (cf. ci-dessous) ,
                                                                   // il est utilisé puis détruit par la fonction Nettoyage
                int cr = atexit( Nettoyage );                      // exécute Nettoyage lors de exit, après la destruction des données statiques !
@@ -75,7 +80,7 @@ public :
 
        ~ATEXIT_( )
        {
-               MESSAGE("Destruction ATEXIT") ;
+               if(MYDEBUG) MESSAGE("Destruction ATEXIT") ;
        }
 };
 
@@ -95,16 +100,16 @@ static ATEXIT_ nettoyage ; /* singleton statique */
 
 void Nettoyage( void )
 {
-       BEGIN_OF("Nettoyage( void )") ;
+       if(MYDEBUG) BEGIN_OF("Nettoyage( void )") ;
        ASSERT(Destructeurs) ;
-       SCRUTE( Destructeurs->size() ) ;
+       if(MYDEBUG) SCRUTE( Destructeurs->size() ) ;
        if( Destructeurs->size() )
        {
                list<DESTRUCTEUR_GENERIQUE_*>::iterator it = Destructeurs->end() ;
 
                do
                {
-                       MESSAGE( "DESTRUCTION d'un SINGLETON") ;
+                       if(MYDEBUG) MESSAGE( "DESTRUCTION d'un SINGLETON");
                        it-- ;
                        DESTRUCTEUR_GENERIQUE_* ptr = *it ;
                        //Destructeurs->remove( *it ) ;
@@ -113,14 +118,14 @@ void Nettoyage( void )
                }while( it!=  Destructeurs->begin() ) ;
 
                Destructeurs->clear() ;
-               SCRUTE( Destructeurs->size() ) ;
+               if(MYDEBUG) SCRUTE( Destructeurs->size() ) ;
                ASSERT( Destructeurs->size()==0 ) ;
                ASSERT( Destructeurs->empty() ) ;
        }
 
        delete Destructeurs;
        Destructeurs=0;
-       END_OF("Nettoyage( void )") ;
+       if(MYDEBUG) END_OF("Nettoyage( void )") ;
        return ;
 }
 
index 4037ebd8c5f4bad2a47660db2bb294aa38eb1480..2e9b095670bdc72d2f860e034703ea04a4e46dfd 100644 (file)
@@ -4,9 +4,10 @@
 //             <ota@localhost.localdomain>
 
 
-#include <Utils_ExceptHandlers.hxx>
+#include "Utils_ExceptHandlers.hxx"
 #include "Utils_CorbaException.hxx"
 #include "Utils_SALOME_Exception.hxx"
+
 #include <SALOMEconfig.h>
 #include CORBA_SERVER_HEADER(SALOME_Exception)
 
index 55558245e2f54d05cc8eb988553421d2fd9811d8..7996ae9221bb70665e17e3c354a4d7c1eca4f0dd 100644 (file)
@@ -30,7 +30,6 @@
 #define Utils_ExceptHandlers_HeaderFile
 
 #include <stdexcept>
-#include <utilities.h>
 
 typedef void (*PVF)();
 
@@ -38,8 +37,8 @@ class Unexpect { //save / retrieve unexpected exceptions treatment
   PVF old;
   public :
     Unexpect( PVF f ) 
-      { old = set_unexpected(f); }
-  ~Unexpect() { set_unexpected(old); }
+      { old = std::set_unexpected(f); }
+  ~Unexpect() { std::set_unexpected(old); }
 };
 
 class Terminate {//save / retrieve terminate function
@@ -47,12 +46,12 @@ class Terminate {//save / retrieve terminate function
   PVF old;
   public :
     Terminate( PVF f ) 
-      { old = set_terminate(f); }
-  ~Terminate() { set_terminate(old); }
+      { old = std::set_terminate(f); }
+  ~Terminate() { std::set_terminate(old); }
 };
 
 #define UNEXPECT_CATCH(FuncName, ExceptionConstructor) \
-void FuncName () {\
+inline void FuncName () {\
    throw ExceptionConstructor (); \
 }
 //Example of the usage 
@@ -72,4 +71,5 @@ void FuncName () {\
 //Definitions :
 extern void SalomeException();
 extern void SALOME_SalomeException();
+
 #endif
index f30cdb03d2dfd1098e3076c823cea605c8e174fb..55bed3bf7409daf4c3c58fd355f449dac09559c9 100644 (file)
@@ -86,9 +86,10 @@ Identity::~Identity(void)
        delete [] (char*)_name ;
        (char*&)_name = NULL ;
 
-       delete [] (char*)_dir ;
-       (char*&)_dir = NULL ;
-
+       //delete [] (char*)_dir ;
+       //(char*&)_dir = NULL ;
+       free((char*)_dir);
+       
        delete [] (char*)_adip ;
        (char*&)_adip = NULL ;
 }
index 9202df72ea405899902149c0cc9bbeac613ecf7a..9ab9c9c3c11a0740842ae31200eb2b7e3a04b882 100644 (file)
 # include <exception>
 # include <iostream>
 
-using namespace std;
-
 # define LOCALIZED(message) #message , __FILE__ , __LINE__
 
-class SALOME_Exception : public exception
+
+class SALOME_Exception : public std::exception
 {
 
 private :
@@ -49,7 +48,7 @@ public :
        SALOME_Exception( const char *text, const char *fileName=0, const unsigned int lineNumber=0 );
        SALOME_Exception( const SALOME_Exception &ex );
        ~SALOME_Exception() throw ();
-       friend ostream & operator<<( ostream &os , const SALOME_Exception &ex );
+       friend std::ostream & operator<<( std::ostream &os , const SALOME_Exception &ex );
        virtual const char *what( void ) const throw () ;
 } ;
 
index 4e06560a00cad19cb745ea2c2ea89974da4f9360..79d4843891e54b56d29957014cce2639135c8f64 100644 (file)
@@ -146,7 +146,7 @@ template <class TYPE> int SINGLETON_<TYPE>::Destruction( void )
                MESSAGE("Destruction du SINGLETON_") ;
 
 
-               list<DESTRUCTEUR_GENERIQUE_ *>::iterator k ;
+               std::list<DESTRUCTEUR_GENERIQUE_ *>::iterator k ;
                for( k=DESTRUCTEUR_GENERIQUE_::Destructeurs.begin() ; k!=DESTRUCTEUR_GENERIQUE_::Destructeurs.end();k++)
                {
                        if ( *k == PtrSingleton->_Instance )
index c2748f6ecb783525412bd5bfcc7ed28f170e8d46..f594aba9be5b2bebdae2d759fc662d2924f67fe6 100644 (file)
@@ -28,6 +28,8 @@
 # include <stream.h>
 using namespace std;
 
+#include "utilities.h"
+
 static struct timezone *tz=(struct timezone*) malloc(sizeof(struct timezone));
 
 #ifndef CLK_TCK
@@ -78,8 +80,8 @@ void Utils_Timer::Stop() {
 void Utils_Timer::Show() {
   bool StopSav = Stopped;
   if (!StopSav) Stop();
-  cout << "CPU user time: "   << Cumul_user  << " seconds " << endl;
-  cout << "CPU system time: " << Cumul_sys   << " seconds " << endl;
+  MESSAGE("CPU user time: "   << Cumul_user  << " seconds ");
+  MESSAGE("CPU system time: " << Cumul_sys   << " seconds ");
   if (!StopSav) Start();
 }
 
@@ -90,5 +92,5 @@ void Utils_Timer::Reset() {
 
 void Utils_Timer::ShowAbsolute(){
     unsigned long Absolute_user = (unsigned long) ((timeval*)RefToCurrentTimeB)->tv_sec ;
-    cout << "Absolute time: "   << Absolute_user  << " seconds " << endl;
+    MESSAGE("Absolute time: "   << Absolute_user  << " seconds ");
 }
index 8633effbd1aec8c1841a11aea47954ed58cbbb03..fa6cff73770f45f7f4b0946588875c67e4af7b15 100644 (file)
@@ -37,6 +37,8 @@
 
 #include  "utilities.h"
 
+using namespace std;
+
 const char* duplicate( const char *const str )
 {
        ASSERT(str!=NULL) ;
index 44ab60836460c408ad920680518838da807906bd..e8297f1f83de1cc9da228fa9dc9109a6a208ee85 100644 (file)
@@ -35,6 +35,7 @@ VPATH=.:@srcdir@:@top_srcdir@/idl
 EXPORT_HEADERS = SALOME_Transform.h \
                 SALOME_TransformFilter.h \
                 SALOME_PassThroughFilter.h \
+                SALOME_ShrinkFilter.h \
                 SALOME_GeometryFilter.h \
                 SALOME_ExtractUnstructuredGrid.h
 
@@ -44,6 +45,7 @@ LIB = libSalomeVTKFilter.la
 LIB_SRC = SALOME_Transform.cxx \
           SALOME_TransformFilter.cxx \
          SALOME_PassThroughFilter.cxx \
+         SALOME_ShrinkFilter.cxx \
          SALOME_GeometryFilter.cxx \
          SALOME_ExtractUnstructuredGrid.cxx
 
index dd9b1b9cd16a0f327103d384f7918b6637e85d74..2cc4930bc25c4bfc7314d0da9b9a0e4770422e81 100644 (file)
@@ -39,7 +39,7 @@
 using namespace std;
 
 #ifdef _DEBUG_
-static int MYDEBUG = 1;
+static int MYDEBUG = 0;
 #else
 static int MYDEBUG = 0;
 #endif
@@ -80,7 +80,7 @@ void SALOME_ExtractUnstructuredGrid::SetStoreMapping(int theStoreMapping){
   this->Modified();
 }
 
-vtkIdType SALOME_ExtractUnstructuredGrid::GetOutId(int theOutId) const{
+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__
@@ -90,7 +90,7 @@ vtkIdType SALOME_ExtractUnstructuredGrid::GetOutId(int theOutId) const{
 #endif
 }
 
-vtkIdType SALOME_ExtractUnstructuredGrid::GetInId(int theInId) const{
+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;
@@ -233,7 +233,7 @@ void SALOME_ExtractUnstructuredGrid::Execute(){
          }
        }
       }
-      if(aNbElems = aConnectivity->GetNumberOfCells()){
+      if((aNbElems = aConnectivity->GetNumberOfCells())){
        vtkIntArray* aCellLocationsArray = vtkIntArray::New();
        aCellLocationsArray->SetNumberOfComponents(1);
        aCellLocationsArray->SetNumberOfTuples(aNbElems);
@@ -322,7 +322,7 @@ void SALOME_ExtractUnstructuredGrid::Execute(){
        }
       }
     }
-    if(aNbElems = aConnectivity->GetNumberOfCells()){
+    if((aNbElems = aConnectivity->GetNumberOfCells())){
       vtkIntArray* aCellLocationsArray = vtkIntArray::New();
       aCellLocationsArray->SetNumberOfComponents(1);
       aCellLocationsArray->SetNumberOfTuples(aNbElems);
index 2e913795e2f92f89200bf9dbfe545227c73f945d..dc3bcc41aa6c424a352c557562d4cc27e8fa52a0 100644 (file)
@@ -57,7 +57,7 @@ public:
   // Remove the cell from the output
   void RegisterCell(vtkIdType theCellId);
   int IsCellsRegistered() { return !myCellIds.empty();}
-  int ClearRegisteredCells() { 
+  void ClearRegisteredCells() { 
     myCellIds.clear();
     Modified();
   }
@@ -65,7 +65,7 @@ public:
   // Remove every cells with the type from the output
   void RegisterCellsWithType(vtkIdType theCellType);
   int IsCellsWithTypeRegistered() { return !myCellTypes.empty();}
-  int ClearRegisteredCellsWithType() { 
+  void ClearRegisteredCellsWithType() { 
     myCellTypes.clear();
     Modified();
   }
@@ -77,8 +77,8 @@ public:
   void SetStoreMapping(int theStoreMapping);
   int GetStoreMapping(){ return myStoreMapping;}
 
-  vtkIdType GetOutId(int theOutId) const;
-  vtkIdType GetInId(int theInId) const;
+  vtkIdType GetInputId(int theOutId) const;
+  vtkIdType GetOutputId(int theInId) const;
 
   typedef std::vector<vtkIdType> TVectorId;
   typedef std::map<vtkIdType,vtkIdType> TMapId;
index c618187501faee8e2cd101994f985474143b23d2..d61f825e034cee9208b5ea11642fefbe329da5ef 100644 (file)
@@ -96,7 +96,7 @@ void SALOME_GeometryFilter::SetStoreMapping(int theStoreMapping){
 }
 
 
-vtkIdType SALOME_GeometryFilter::GetObjId(int theVtkID){
+vtkIdType SALOME_GeometryFilter::GetElemObjId(int theVtkID){
   if(myVTK2ObjIds.empty() || theVtkID > myVTK2ObjIds.size()) return -1;
 #if defined __GNUC_2__
   return myVTK2ObjIds[theVtkID];
@@ -106,17 +106,6 @@ vtkIdType SALOME_GeometryFilter::GetObjId(int theVtkID){
 }
 
 
-SALOME_GeometryFilter::TVectorId SALOME_GeometryFilter::GetVtkId(int theObjID){
-  TVectorId aVect;
-  if(myObj2VTKIds.empty() || theObjID > myObj2VTKIds.size()) return aVect;
-#if defined __GNUC_2__
-  return myObj2VTKIds[theObjID];
-#else
-  return myObj2VTKIds.at(theObjID);
-#endif
-}
-
-
 void SALOME_GeometryFilter::UnstructuredGridExecute()
 {
   vtkUnstructuredGrid *input= (vtkUnstructuredGrid *)this->GetInput();
@@ -243,9 +232,8 @@ void SALOME_GeometryFilter::UnstructuredGridExecute()
   // (Have to compute visibility first for 3D cell boundarys)
   int progressInterval = numCells/20 + 1;
   if(myStoreMapping){
-    myVTK2ObjIds.clear();  myObj2VTKIds.clear(); //apo
+    myVTK2ObjIds.clear();
     myVTK2ObjIds.reserve(numCells);
-    myObj2VTKIds.resize(numCells);
   }
   for (cellId=0, Connectivity->InitTraversal(); 
        Connectivity->GetNextCell(npts,pts); 
@@ -279,7 +267,6 @@ void SALOME_GeometryFilter::UnstructuredGridExecute()
           newCellId = output->InsertNextCell(aCellType,npts,pts);
          if(myStoreMapping){
            myVTK2ObjIds.push_back(cellId); //apo
-           myObj2VTKIds[cellId].push_back(newCellId);
          }
           outputCD->CopyData(cd,cellId,newCellId);
           break;
@@ -289,7 +276,6 @@ void SALOME_GeometryFilter::UnstructuredGridExecute()
           newCellId = output->InsertNextCell(VTK_LINE,npts,pts);
          if(myStoreMapping){
            myVTK2ObjIds.push_back(cellId); //apo
-           myObj2VTKIds[cellId].push_back(newCellId);
          }
           outputCD->CopyData(cd,cellId,newCellId);
           break;
@@ -300,7 +286,6 @@ void SALOME_GeometryFilter::UnstructuredGridExecute()
           newCellId = output->InsertNextCell(aCellType,npts,pts);
          if(myStoreMapping){
            myVTK2ObjIds.push_back(cellId); //apo
-           myObj2VTKIds[cellId].push_back(newCellId);
          }
           outputCD->CopyData(cd,cellId,newCellId);
           break;
@@ -309,7 +294,6 @@ void SALOME_GeometryFilter::UnstructuredGridExecute()
           newCellId = output->InsertNextCell(aCellType,npts,pts);
          if(myStoreMapping){
            myVTK2ObjIds.push_back(cellId); //apo
-           myObj2VTKIds[cellId].push_back(newCellId);
          }
           outputCD->CopyData(cd,cellId,newCellId);
           break;
@@ -318,7 +302,6 @@ void SALOME_GeometryFilter::UnstructuredGridExecute()
           newCellId = output->InsertNextCell(aCellType,npts,pts);
          if(myStoreMapping){
            myVTK2ObjIds.push_back(cellId); //apo
-           myObj2VTKIds[cellId].push_back(newCellId);
          }
          outputCD->CopyData(cd,cellId,newCellId);
           break;
@@ -344,7 +327,6 @@ void SALOME_GeometryFilter::UnstructuredGridExecute()
               newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
              if(myStoreMapping){
                myVTK2ObjIds.push_back(cellId); //apo
-               myObj2VTKIds[cellId].push_back(newCellId);
              }
               outputCD->CopyData(cd,cellId,newCellId);
               }
@@ -373,7 +355,6 @@ void SALOME_GeometryFilter::UnstructuredGridExecute()
               newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
              if(myStoreMapping){
                myVTK2ObjIds.push_back(cellId); //apo
-               myObj2VTKIds[cellId].push_back(newCellId);
              }
               outputCD->CopyData(cd,cellId,newCellId);
               }
@@ -402,7 +383,6 @@ void SALOME_GeometryFilter::UnstructuredGridExecute()
               newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
              if(myStoreMapping){
                myVTK2ObjIds.push_back(cellId); //apo
-               myObj2VTKIds[cellId].push_back(newCellId);
              }
               outputCD->CopyData(cd,cellId,newCellId);
               }
@@ -436,7 +416,6 @@ void SALOME_GeometryFilter::UnstructuredGridExecute()
               newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
              if(myStoreMapping){
                myVTK2ObjIds.push_back(cellId); //apo
-               myObj2VTKIds[cellId].push_back(newCellId);
              }
               outputCD->CopyData(cd,cellId,newCellId);
               }
@@ -470,7 +449,6 @@ void SALOME_GeometryFilter::UnstructuredGridExecute()
               newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
              if(myStoreMapping){
                myVTK2ObjIds.push_back(cellId); //apo
-               myObj2VTKIds[cellId].push_back(newCellId);
              }
               outputCD->CopyData(cd,cellId,newCellId);
               }
@@ -495,15 +473,6 @@ void SALOME_GeometryFilter::UnstructuredGridExecute()
       cout<<myVTK2ObjIds[i]<<", ";
     }
     cout<<"\n";
-    for(int i = 0, iEnd = myObj2VTKIds.size(); i < iEnd; i++){
-      TVectorId& aVectorId = myObj2VTKIds[i];
-      cout<<aVectorId.size()<<": ";
-      for(int j = 0, jEnd = aVectorId.size(); j < jEnd; j++){
-       cout<<aVectorId[j]<<", ";
-      }
-      cout<<"\n";
-    }
-    cout<<"\n";
   }
 
   // Update ourselves and release memory
index bce9d27d76ba13678a5bf124119a741f2c9efcd3..1969aedfe4c494c3658aaf33ee966cad971cfd63 100644 (file)
@@ -44,9 +44,8 @@ public:
   void SetStoreMapping(int theStoreMapping);
   int GetStoreMapping(){ return myStoreMapping;}
 
-  typedef std::vector<vtkIdType> TVectorId;
-  virtual vtkIdType GetObjId(int theVtkID);
-  virtual TVectorId GetVtkId(int theObjID);
+  virtual vtkIdType GetNodeObjId(int theVtkID) { return theVtkID;}
+  virtual vtkIdType GetElemObjId(int theVtkID);
 
 protected:
   SALOME_GeometryFilter();
@@ -59,9 +58,8 @@ private:
   int myShowInside;   
 
   int myStoreMapping;   
+  typedef std::vector<vtkIdType> TVectorId;
   TVectorId myVTK2ObjIds;
-  typedef std::vector<TVectorId> TVecVectorId;
-  TVecVectorId myObj2VTKIds;
 };
 
 #endif
index 40ca16b5263b8511c49a399bc835877aee86bfc7..43786ab25d0bb887e7a021e31f92d837e603f84c 100644 (file)
@@ -39,7 +39,10 @@ EXPORT_HEADERS=  VTKViewer_RenderWindow.h \
                 VTKViewer_ViewFrame.h \
                 VTKViewer_RenderWindowInteractor.h \
                 VTKViewer_InteractorStyleSALOME.h \
-                VTKViewer_Filter.h
+                VTKViewer_Filter.h \
+                VTKViewer_Prs.h \
+                VTKViewer_Trihedron.h \
+                VTKViewer_VectorText.h
                     
 # Libraries targets
 LIB = libVTKViewer.la
@@ -53,7 +56,9 @@ LIB_SRC= VTKViewer.cxx \
         VTKViewer_RectPicker.cxx \
         VTKViewer_CellRectPicker.cxx \
         VTKViewer_Utilities.cxx \
-        VTKViewer_Filter.cxx
+        VTKViewer_Filter.cxx \
+         VTKViewer_Actor.cxx \
+         VTKViewer_Prs.cxx 
 
 LIB_MOC = \
         VTKViewer.h \
@@ -66,9 +71,9 @@ LIB_CLIENT_IDL = SALOMEDS.idl \
                 SALOME_Component.idl \
                 SALOME_Exception.idl
 
-CPPFLAGS+=$(QT_INCLUDES) $(OGL_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES)
-CXXFLAGS+=
-LDFLAGS+=$(VTK_LIBS) $(OGL_LIBS) $(QT_MT_LIBS) -lSalomeGUI
+CPPFLAGS+=$(QT_INCLUDES) $(OGL_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES)
+
+LDFLAGS+=$(VTK_LIBS) $(OGL_LIBS) $(QT_MT_LIBS) -lSalomePrs -lSalomeGUI
 
 @CONCLUDE@
 
index 6e05537cd7092fcb2f9686c0b37270834e1538d7..b2506538bdd111283f4268f192c13d6d0ebe5b23 100644 (file)
@@ -299,7 +299,7 @@ void VTKViewer_CellRectPicker::IncludeActor(vtkProp3D* prop,
          dir[i] = p2[i] - p1[i];
        }
 
-       input->GetCell(curData.cellId, cell2);
+       actor->GetMapper()->GetInput()->GetCell(curData.cellId, cell2);
        result = IntersectCells(cell1, cellData.depth,
                                cell2, curData.depth, dir);
        if (result > 0) {
index d9d9831a8c8ed862c1ab9971f706c26eec526413..f667356b82007c179b478062819a7e06c833eee4 100755 (executable)
@@ -48,11 +48,13 @@ public:
                               VTKViewer_Filter();\r
   virtual                     ~VTKViewer_Filter();\r
 \r
-  bool                        IsValid( SALOME_Actor*, const int theCellId );\r
-  virtual bool                IsValid( const int theCellId ) const = 0;\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
+  \r
 protected:\r
 \r
   SALOME_Actor*               myActor;\r
index d7cbfb5c2fa642648a2390e7fedc3391014dd028..c2ac9c3cc00f51623b2e2a338e27bfec587c727b 100644 (file)
 //  $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 "QAD_Application.h"
 #include "QAD_Desktop.h"
 
-#include "SALOME_Selection.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 <vtkAssemblyNode.h>
+#include <vtkCamera.h>
+#include <vtkRenderer.h>
 #include <vtkPicker.h>
 #include <vtkPointPicker.h>
 #include <vtkCellPicker.h>
 #include <vtkLine.h> 
-#include <vtkUnstructuredGrid.h> 
-#include <vtkExtractEdges.h>
-#include <vtkPolyDataMapper.h>
-#include <vtkDataSetCollection.h>
-#include <vtkImageData.h>
+#include <vtkMapper.h>
+#include <vtkDataSet.h>
+#include <vtkSmartPointer.h>
 
 #include <qapplication.h>
 //VRV: porting on Qt 3.0.5
 
 using namespace std;
 
-extern int SetVisibility(vtkActorCollection* theCollection, int theParam);
-extern int GetVisibility(vtkActorCollection* theCollection);
+
+#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);
@@ -84,25 +152,46 @@ VTKViewer_InteractorStyleSALOME::VTKViewer_InteractorStyleSALOME()
   this->ForcedState = VTK_INTERACTOR_STYLE_CAMERA_NONE;
   loadCursors();
 
-  myPActor = vtkActor::New();
-  myPActor->PickableOff();
-  myPActor->GetProperty()->SetColor(0,1,1);
-  myPActor->GetProperty()->SetLineWidth(5);
-  myPActor->GetProperty()->SetPointSize(5);
+  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) 
 {
-  myPActor->GetProperty()->SetColor(theRed, theGreen, theBlue);
-  myPActor->GetProperty()->SetLineWidth(theWidth);
-  myPActor->GetProperty()->SetPointSize(theWidth);
+  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;
 }
 
 //----------------------------------------------------------------------------
@@ -134,28 +223,18 @@ void VTKViewer_InteractorStyleSALOME::RotateXY(int dx, int dy)
   cam->Elevation(ryf);
   cam->OrthogonalizeViewUp();
   ::ResetCameraClippingRange(this->CurrentRenderer); 
-  this->Interactor->Render();
+  //this->Interactor->Render();
+  myGUIWindow->update();
 }
 
 //----------------------------------------------------------------------------
 void VTKViewer_InteractorStyleSALOME::PanXY(int x, int y, int oldX, int oldY)
 {
   TranslateView(x, y, oldX, oldY);   
-  //vtkRenderWindowInteractor *rwi = this->Interactor;
-  /* VSV Light follows camera: if (this->CurrentLight)
-    {
-      vtkCamera *cam = this->CurrentRenderer->GetActiveCamera();
-      this->CurrentLight->SetPosition(cam->GetPosition());
-      this->CurrentLight->SetFocalPoint(cam->GetFocalPoint());
-      }*/
-    
-  this->Interactor->Render();
+  //this->Interactor->Render();
+  myGUIWindow->update();
 }
 
-//----------------------------------------------------------------------------
-void VTKViewer_InteractorStyleSALOME::ControlLblSize(double aOldScale, double aNewScale) {
-  return;
-}
 
 //----------------------------------------------------------------------------
 void VTKViewer_InteractorStyleSALOME::DollyXY(int dx, int dy)
@@ -174,20 +253,14 @@ void VTKViewer_InteractorStyleSALOME::DollyXY(int dx, int dy)
     aCam->Dolly(zoomFactor);
     ::ResetCameraClippingRange(this->CurrentRenderer);
   }
-  
-  /* VSV Light follows camera: if (this->CurrentLight)
-    {      
-      this->CurrentLight->SetPosition(cam->GetPosition());
-      this->CurrentLight->SetFocalPoint(cam->GetFocalPoint());
-      }*/
-  
-  this->Interactor->Render();
+
+  //this->Interactor->Render();
+  myGUIWindow->update();
 }
 
 //----------------------------------------------------------------------------
 void VTKViewer_InteractorStyleSALOME::SpinXY(int x, int y, int oldX, int oldY)
 {
-  vtkRenderWindowInteractor *rwi = this->Interactor;
   vtkCamera *cam;
 
   if (this->CurrentRenderer == NULL)
@@ -207,7 +280,8 @@ void VTKViewer_InteractorStyleSALOME::SpinXY(int x, int y, int oldX, int oldY)
   cam->Roll(newAngle - oldAngle);
   cam->OrthogonalizeViewUp();
       
-  rwi->Render();
+  //this->Interactor->Render();
+  myGUIWindow->update();
 }
 
 
@@ -253,6 +327,8 @@ void VTKViewer_InteractorStyleSALOME::OnLeftButtonDown(int ctrl, int shift,
   }
   return;
 }
+
+
 //----------------------------------------------------------------------------
 void VTKViewer_InteractorStyleSALOME::OnLeftButtonUp(int vtkNotUsed(ctrl),
                                                     int shift, 
@@ -267,6 +343,7 @@ void VTKViewer_InteractorStyleSALOME::OnLeftButtonUp(int vtkNotUsed(ctrl),
   }
 }
 
+
 //----------------------------------------------------------------------------
 void VTKViewer_InteractorStyleSALOME::OnMiddleButtonDown(int ctrl,
                                                         int shift, 
@@ -297,6 +374,8 @@ void VTKViewer_InteractorStyleSALOME::OnMiddleButtonDown(int ctrl,
       startOperation(VTK_INTERACTOR_STYLE_CAMERA_PAN);
   }
 }
+
+
 //----------------------------------------------------------------------------
 void VTKViewer_InteractorStyleSALOME::OnMiddleButtonUp(int vtkNotUsed(ctrl),
                                                       int shift, 
@@ -311,6 +390,7 @@ void VTKViewer_InteractorStyleSALOME::OnMiddleButtonUp(int vtkNotUsed(ctrl),
   }
 }
 
+
 //----------------------------------------------------------------------------
 void VTKViewer_InteractorStyleSALOME::OnRightButtonDown(int ctrl,
                                                        int shift, 
@@ -357,12 +437,6 @@ void VTKViewer_InteractorStyleSALOME::OnRightButtonUp(int vtkNotUsed(ctrl),
 }
 
 //----------------------------------------------------------------------------
-void VTKViewer_InteractorStyleSALOME::PrintSelf(ostream& os, vtkIndent indent)
-{
-  vtkInteractorStyle::PrintSelf(os,indent);
-
-}
-
 /* XPM */
 const char* imageZoomCursor[] = { 
 "32 32 3 1",
@@ -440,6 +514,8 @@ const char* imageRotateCursor[] = {
 "................................",
 "................................"};
 
+
+//----------------------------------------------------------------------------
 // loads cursors for viewer operations - zoom, pan, etc...
 void VTKViewer_InteractorStyleSALOME::loadCursors()
 {
@@ -453,6 +529,8 @@ void VTKViewer_InteractorStyleSALOME::loadCursors()
   myCursorState     = false;
 }
 
+
+//----------------------------------------------------------------------------
 // event filter - controls mouse and keyboard events during viewer operations
 bool VTKViewer_InteractorStyleSALOME::eventFilter(QObject* object, QEvent* event)
 {
@@ -465,6 +543,8 @@ bool VTKViewer_InteractorStyleSALOME::eventFilter(QObject* object, QEvent* event
   return QObject::eventFilter(object, event);
 }
 
+
+//----------------------------------------------------------------------------
 // starts Zoom operation (e.g. through menu command)
 void VTKViewer_InteractorStyleSALOME::startZoom()
 {
@@ -478,6 +558,8 @@ void VTKViewer_InteractorStyleSALOME::startZoom()
   qApp->installEventFilter(this);
 }
 
+
+//----------------------------------------------------------------------------
 // starts Pan operation (e.g. through menu command)
 void VTKViewer_InteractorStyleSALOME::startPan()
 {
@@ -491,6 +573,7 @@ void VTKViewer_InteractorStyleSALOME::startPan()
   qApp->installEventFilter(this);
 }
 
+//----------------------------------------------------------------------------
 // starts Rotate operation (e.g. through menu command)
 void VTKViewer_InteractorStyleSALOME::startRotate()
 {
@@ -504,6 +587,8 @@ void VTKViewer_InteractorStyleSALOME::startRotate()
   qApp->installEventFilter(this);
 }
 
+
+//----------------------------------------------------------------------------
 // starts Spin operation (e.g. through menu command)
 void VTKViewer_InteractorStyleSALOME::startSpin()
 {
@@ -518,6 +603,8 @@ void VTKViewer_InteractorStyleSALOME::startSpin()
 }
 
 
+
+//----------------------------------------------------------------------------
 // starts Fit Area operation (e.g. through menu command)
 void VTKViewer_InteractorStyleSALOME::startFitArea()
 {
@@ -532,6 +619,7 @@ void VTKViewer_InteractorStyleSALOME::startFitArea()
 }
 
 
+//----------------------------------------------------------------------------
 void  VTKViewer_InteractorStyleSALOME::ViewFitAll() {
   int aTriedronWasVisible = false;
   if(m_Trihedron){
@@ -552,6 +640,7 @@ void  VTKViewer_InteractorStyleSALOME::ViewFitAll() {
 }
 
 
+//----------------------------------------------------------------------------
 // starts Global Panning operation (e.g. through menu command)
 void VTKViewer_InteractorStyleSALOME::startGlobalPan()
 {
@@ -568,26 +657,14 @@ void VTKViewer_InteractorStyleSALOME::startGlobalPan()
   myScale = cam->GetParallelScale();
 
   ViewFitAll();
-  // make fit all
-//   int TriedronWasVisible = false;
-//   if(m_Trihedron){
-//     TriedronWasVisible = 
-//       m_Trihedron->GetVisibility() == VTKViewer_Trihedron::eOn;
-//     if(TriedronWasVisible) m_Trihedron->VisibilityOff();
-//   }
-
-//   ::ResetCamera(this->CurrentRenderer);
-  
-//   if(m_Trihedron)
-//     if(TriedronWasVisible) 
-//       m_Trihedron->VisibilityOn();
 
-  //VTKViewer_RenderWindow* aRW = dynamic_cast<VTKViewer_RenderWindow*>(this->Interactor->GetRenderWindow());
   if (myGUIWindow) myGUIWindow->update();
   
   qApp->installEventFilter(this);
 }
 
+
+//----------------------------------------------------------------------------
 // returns TRUE if needs redrawing
 bool VTKViewer_InteractorStyleSALOME::needsRedrawing()
 {
@@ -598,6 +675,8 @@ bool VTKViewer_InteractorStyleSALOME::needsRedrawing()
          State == VTK_INTERACTOR_STYLE_CAMERA_NONE;
 }
 
+
+//----------------------------------------------------------------------------
 // fits viewer contents to rect
 void VTKViewer_InteractorStyleSALOME::fitRect(const int left, 
                                        const int top, 
@@ -627,18 +706,11 @@ void VTKViewer_InteractorStyleSALOME::fitRect(const int left,
     ::ResetCameraClippingRange(this->CurrentRenderer);
   }
   
-  //vtkRenderWindowInteractor *rwi = this->Interactor;
-  /* VSV Light follows camera: if (this->CurrentLight) {
-    this->CurrentLight->SetPosition(cam->GetPosition());
-    this->CurrentLight->SetFocalPoint(cam->GetFocalPoint());
-    }*/
-  //  rwi->Render();
-  //VTKViewer_RenderWindow* aRW = dynamic_cast<VTKViewer_RenderWindow*>(rwi->GetRenderWindow());
   myGUIWindow->update();
 }
 
 
-
+//----------------------------------------------------------------------------
 // starts viewer operation (!internal usage!)
 void VTKViewer_InteractorStyleSALOME::startOperation(int operation)
 {
@@ -666,6 +738,8 @@ void VTKViewer_InteractorStyleSALOME::startOperation(int operation)
   }
 }
 
+
+//----------------------------------------------------------------------------
 // sets proper cursor for window when viewer operation is activated
 void VTKViewer_InteractorStyleSALOME::setCursor(const int operation)
 {
@@ -705,6 +779,8 @@ void VTKViewer_InteractorStyleSALOME::setCursor(const int operation)
   }
 }
 
+
+//----------------------------------------------------------------------------
 // called when viewer operation started (!put necessary initialization here!)
 void VTKViewer_InteractorStyleSALOME::onStartOperation()
 {
@@ -730,6 +806,8 @@ void VTKViewer_InteractorStyleSALOME::onStartOperation()
   }
 }
 
+
+//----------------------------------------------------------------------------
 // called when viewer operation finished (!put necessary post-processing here!)
 void VTKViewer_InteractorStyleSALOME::onFinishOperation() 
 {
@@ -738,7 +816,6 @@ void VTKViewer_InteractorStyleSALOME::onFinishOperation()
 
   QAD_Study* aActiveStudy = QAD_Application::getDesktop()->getActiveStudy();
   SALOME_Selection* aSel    = SALOME_Selection::Selection( aActiveStudy->getSelection() );
-  vtkRenderWindowInteractor *rwi = this->Interactor;
 
   // VSV: LOD actor activisation
   //  rwi->GetRenderWindow()->SetDesiredUpdateRate(rwi->GetStillUpdateRate());
@@ -759,7 +836,7 @@ void VTKViewer_InteractorStyleSALOME::onFinishOperation()
       if (State == VTK_INTERACTOR_STYLE_CAMERA_FIT) {
         // making fit rect opeation 
         int w, h, x, y;
-        rwi->GetSize(w, h);
+        m_Interactor->GetSize(w, h);
         int x1, y1, x2, y2;
         x1 = rect.left(); 
         y1 = h - rect.top() - 1;
@@ -769,260 +846,114 @@ void VTKViewer_InteractorStyleSALOME::onFinishOperation()
       }
       else {
         if (myPoint == myOtherPoint) {
-        // process point selection
+         // process point selection
           int w, h, x, y;
-          rwi->GetSize(w, h);
+          m_Interactor->GetSize(w, h);
           x = myPoint.x(); 
           y = h - myPoint.y() - 1;
-          vtkActorCollection* listactors = NULL;
+
           this->FindPokedRenderer(x, y);
-         rwi->StartPickCallback();
+         m_Interactor->StartPickCallback();
 
-//       vtkPicker* aPicker = vtkPicker::SafeDownCast(rwi->GetPicker());
-//       if (aPicker)
-//         aPicker->SetTolerance(0.01);
-         
-          rwi->GetPicker()->Pick(x, y, 0.0, this->CurrentRenderer);
+         vtkPicker* aPicker = vtkPicker::SafeDownCast(m_Interactor->GetPicker());
+          aPicker->Pick(x, y, 0.0, this->CurrentRenderer);
     
-          if ( rwi->GetPicker()->IsA("vtkCellPicker") ) {
-            vtkCellPicker* picker;
-            if ( (picker = vtkCellPicker::SafeDownCast(rwi->GetPicker())) ) {
-             int aVtkId = picker->GetCellId();
-             // INFOS ( " CellId : " << aVtkId );
-              if ( aVtkId >= 0 ) {
-                vtkActor* ac = picker->GetActor();
-                if ( ac->IsA("SALOME_Actor") ) {
-                  SALOME_Actor* SActor = SALOME_Actor::SafeDownCast( ac );
-                  INFOS ( " NAME Actor : " << SActor->getName() << ", CellId : " << aVtkId );
-
-                  //Cell selection /////////////////////////////// NB
-                  if ( aSelectionMode == CellSelection ) {
-                    if ( SActor->hasIO() && isValid( SActor, aVtkId, aSelectionMode ) ) {
-                      Handle(SALOME_InteractiveObject) IO = SActor->getIO();
-                      // Look in the current selection
-                      SALOME_ListIteratorOfListIO It(aSel->StoredIObjects());
-                      Standard_Boolean IsSelected = false;
-                      for(;It.More();It.Next()) {
-                        Handle(SALOME_InteractiveObject) IOS = It.Value();
-                        if(IO->isSame(IOS)) {
-                          IsSelected = true;
-                         IO = IOS; //Added by SRN, fix SAL1307
-                          break;
-                       }
-                      }
-
-                     int anObjId = SActor->GetObjId(aVtkId);
-                     std::vector<int> aVtkList;
-                     if (anObjId != -1) {
-                       aVtkList = SActor->GetVtkId(anObjId);
-                     }
-
-                     if (IsSelected) {
-                       // This IO is already in the selection
-                       if (aVtkList.size() > 0)
-                         bool add = aSel->AddOrRemoveIndex( IO, aVtkList, myShiftState, false );
-                       else
-                         bool add = aSel->AddOrRemoveIndex( IO, aVtkId, myShiftState, false );
-                     } else {
-                       if (!myShiftState) {
-                         this->HighlightProp( NULL );
-                         aSel->ClearIObjects();
-                       }
-                       if (aVtkList.size() > 0)
-                         bool add = aSel->AddOrRemoveIndex( IO, aVtkList, myShiftState, false );
-                       else
-                         bool add = aSel->AddOrRemoveIndex( IO, aVtkId, myShiftState, false );
-                       aSel->AddIObject( IO, false );
-                     }
-                    }
-                 }
-                 //Edge, Face, Volume and EdgeOfCell selection ////////////////////////// NB
-                  else if ( aSelectionMode == EdgeSelection || 
-                           aSelectionMode == FaceSelection || 
-                           aSelectionMode == VolumeSelection  ||
-                           aSelectionMode == EdgeOfCellSelection ) {
-                   if ( SActor->hasIO() && isValid( SActor, aVtkId, aSelectionMode ) ) {
-                     Handle(SALOME_InteractiveObject) IO = SActor->getIO();
-                     if (vtkDataSet* UGrid = SActor->GetMapper()->GetInput()) {
-                       if (vtkCell* pickedCell = UGrid->GetCell(aVtkId)) {
-                         bool result = false;
-                         int edgeId = -1;
-                         int anObjId = SActor->GetObjId(aVtkId);
-                         std::vector<int> aVtkList;
-                         if (anObjId > -1)
-                           aVtkList = SActor->GetVtkId(anObjId);
-
-                         if (aSelectionMode == EdgeSelection) {
-                           if ( SActor->GetObjDimension( anObjId ) == 1 )
-                             result = true;
-                         }
-                         else if ( aSelectionMode == FaceSelection ) {
-                           if ( SActor->GetObjDimension( anObjId ) == 2 )
-                             result = true;
-                         }
-                         else if (aSelectionMode == VolumeSelection) {
-                           if ( SActor->GetObjDimension( anObjId ) == 3 )
-                             result = true;
-                         }
-                         else {
-                           float pickPosition[3];
-                           picker->GetPickPosition(pickPosition);
-                           float distMin = 1000000.0, dist = 0;
-                           for (int i = 0, iEnd = pickedCell->GetNumberOfEdges(); i < iEnd; i++){
-                             vtkCell* edge = pickedCell->GetEdge(i);
-                             if (vtkLine* line = vtkLine::SafeDownCast(edge)){
-                               float pcoords[3],closestPoint[3],weights[3];
-                               int subId;
-                               line->EvaluatePosition(pickPosition,closestPoint,subId,pcoords,dist,weights);
-                               if (dist < distMin) {
-                                 distMin = dist;
-                                 edgeId = i;
-                               }
-                             }
-                           }
-                           if (edgeId != -1 || pickedCell->GetCellDimension() == 1) 
-                             result = true;
-                           INFOS("edgeID transformed = "<<edgeId);
-                         }
-                         if (result) {
-                           // Look in the current selection
-                           SALOME_ListIteratorOfListIO It(aSel->StoredIObjects());
-                           Standard_Boolean IsSelected = false;
-                           for(;It.More();It.Next()) {
-                             Handle(SALOME_InteractiveObject) IOS = It.Value();
-                             if(IO->isSame(IOS)) {
-                               IO = IOS; //Added by SRN, fix SAL1307
-                               IsSelected = true;
-                               break;
-                             }
-                           }
-                           if (!myShiftState) {
-                             this->HighlightProp( NULL );
-                             aSel->ClearIObjects();
-                           }
-                           // aSel->SetSelectionMode(EdgeSelection, true);
-                           if (aVtkList.size() > 0)
-                             aSel->AddOrRemoveIndex( IO, aVtkList, true, false);
-                           else
-                             aSel->AddOrRemoveIndex( IO, aVtkId, true, false);
-                           if (edgeId >= 0)
-                             aSel->AddOrRemoveIndex( IO, -edgeId-1, true, true );
-                           aSel->AddIObject( IO, false );
-                         }
-                       }
+         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 {
-               this->HighlightProp( NULL );
-               aSel->ClearIObjects();
-              }
-            }
-          } else if ( rwi->GetPicker()->IsA("vtkPointPicker") ) {
-            vtkPointPicker* picker;
-            if ( (picker = vtkPointPicker::SafeDownCast(rwi->GetPicker())) ) {
-              INFOS ( " PointId : " << picker->GetPointId() );
-              if ( picker->GetPointId() >= 0 ) {
-                vtkActor* ac = picker->GetActor();
-                if ( ac->IsA("SALOME_Actor") ) {
-                  SALOME_Actor* SActor = SALOME_Actor::SafeDownCast( ac );
-                  INFOS ( " NAME Actor : " << SActor->getName() );
-                  if ( SActor->hasIO() ) {
-                    Handle(SALOME_InteractiveObject) IO = SActor->getIO();
-                   /*
-                   if (IO.IsNull()) 
-                     break;
-                   if (aSelActiveCompOnly && 
-                       strcmp(aActiveComponent->ComponentDataType(), 
-                              IO->getComponentDataType()) != 0) {
-                     break;
+               }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();
                    }
-                   */
-                    // Look in the current selection
-                    SALOME_ListIteratorOfListIO It(aSel->StoredIObjects());
-                    Standard_Boolean IsSelected = false;
-                    for(;It.More();It.Next()) {
-                      Handle(SALOME_InteractiveObject) IOS = It.Value();
-                      if(IO->isSame(IOS)) {
-                       IO = IOS; //Added by SRN, fix SAL1307
-                        IsSelected = true;
-                        break;
-                      }
-                    }
-                    if(IsSelected) {
-                      // This IO is already in the selection
-                      bool add = aSel->AddOrRemoveIndex( IO, picker->GetPointId(), myShiftState, false );
-                    } else {
-                      if(!myShiftState) {
-                        this->HighlightProp( NULL );
-                        aSel->ClearIObjects();
-                      }
-                      bool add = aSel->AddOrRemoveIndex( IO, picker->GetPointId(), myShiftState, false );
-                      aSel->AddIObject( IO, false );
-                    }
-                  }
-                } 
-              } else {
-                this->HighlightProp( NULL );
-                aSel->ClearIObjects();
-              } 
-            }
-          } else {
-            vtkPicker* picker;
-            if ( (picker = vtkPicker::SafeDownCast(rwi->GetPicker())) )        {
-              listactors = picker->GetActors();
-            }
-            if ( listactors->GetNumberOfItems() == 0 ) {
-              // No selection clear all
-              this->PropPicked = 0;
-              this->HighlightProp( NULL );
-              aSel->ClearIObjects();
-            } else {
-              vtkActor* ac;
-              listactors->InitTraversal();
-              ac = listactors->GetNextActor();
-              if ( ac->IsA("SALOME_Actor") ) {
-                SALOME_Actor* SActor = SALOME_Actor::SafeDownCast( ac );
-                if ( SActor->hasIO() ) {      
-                  this->PropPicked++;
-                  Handle(SALOME_InteractiveObject) IO = SActor->getIO();
-                  // Look in the current selection
-                  SALOME_ListIteratorOfListIO It(aSel->StoredIObjects());
-                  Standard_Boolean IsSelected = false;
-                  for(;It.More();It.Next()) {
-                    Handle(SALOME_InteractiveObject) IOS = It.Value();
-                    if( IO->isSame(IOS) ) {
-                     IO = IOS; //Added by SRN, fix SAL1307
-                      IsSelected = true;
-                      break;
-                    }
-                  }
-                  if(IsSelected) {
-                    // This IO is already in the selection
-                    if(myShiftState) {
-                      aSel->RemoveIObject(IO);
-                    }
-                  }
-                  else {
-                    if(!myShiftState) {
-                      this->HighlightProp( NULL );
-                      aSel->ClearIObjects();
-                    }
-                    aSel->AddIObject( IO, false );
-                  }
-                }
-              }
-            }
-          }
-         rwi->EndPickCallback();
+                   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
-         SALOMEDS::SComponent_var aActiveComponent = 
-           SALOMEDS::SComponent::_narrow(aActiveStudy->getStudyDocument()->
-                                         FindObject(QAD_Application::getDesktop()->getActiveComponent()));
-         if(aSelActiveCompOnly && aActiveComponent->_is_nil()) return;
-         rwi->StartPickCallback();
+         QString aComponentDataType = QAD_Application::getDesktop()->getComponentDataType();
+         if(aSelActiveCompOnly && aComponentDataType.isEmpty()) return;
+         m_Interactor->StartPickCallback();
 
          if (!myShiftState) {
            this->PropPicked = 0;
@@ -1035,7 +966,7 @@ void VTKViewer_InteractorStyleSALOME::onFinishOperation()
          QRect rect(myPoint, myOtherPoint);
          rect = rect.normalize();
          int w, h, x, y;
-         rwi->GetSize(w, h);
+         m_Interactor->GetSize(w, h);
          int x1, y1, x2, y2;
          x1 = rect.left(); 
          y1 = h - rect.top() - 1;
@@ -1043,70 +974,49 @@ void VTKViewer_InteractorStyleSALOME::onFinishOperation()
          y2 = h - rect.bottom() - 1;
 
          switch (aSelectionMode) {
-         case NodeSelection: // Nodes selection
-           {
-             if (! rwi->GetPicker()->IsA("vtkPointPicker") ) break;
-             vtkPointPicker* aPointPicker = vtkPointPicker::SafeDownCast(rwi->GetPicker());
+         case NodeSelection: {
+           if ( vtkPointPicker* aPointPicker = vtkPointPicker::SafeDownCast(m_Interactor->GetPicker()) ) {
              vtkActorCollection* aListActors = this->CurrentRenderer->GetActors();
              aListActors->InitTraversal();
-             vtkActor* aActor;
-             for (int k = 0; k < aListActors->GetNumberOfItems(); k++) {
-               aActor = aListActors->GetNextActor();
-               if (aActor != NULL) {
-                 if (aActor->GetVisibility() == 0) 
-                   continue;
-                 vtkAbstractMapper3D* aMapper3D = aActor->GetMapper();
-                 if ((aMapper3D != NULL) && (aActor->IsA("SALOME_Actor"))) {
-                   SALOME_Actor* SActor = SALOME_Actor::SafeDownCast(aActor);
-
-                   if ((SActor != NULL) && (SActor->hasIO())) {
-                     Handle(SALOME_InteractiveObject) IO = SActor->getIO();
-                     if (IO.IsNull()) 
-                       continue;
-                     if (aSelActiveCompOnly && 
-                         strcmp(aActiveComponent->ComponentDataType(), 
-                                IO->getComponentDataType()) != 0) {
-                       continue;
-                     }
-
-                     vtkMapper*       aMapper;
-                     vtkVolumeMapper* aVolumeMapper;
-                     vtkDataSet*      aDataSet;
-                     
-                     if ( (aMapper = vtkMapper::SafeDownCast(aMapper3D)) != NULL ) {
-                       aDataSet = aMapper->GetInput();
-                     } else if ((aVolumeMapper = vtkVolumeMapper::SafeDownCast(aMapper3D)) != NULL ){
-                       aDataSet = aVolumeMapper->GetInput();
-                     } else {
-                       continue;
-                     }
-                     if (aDataSet) {
-
-                       std::vector<int> anIndices;
-                       for (int i=0; i < aDataSet->GetNumberOfPoints(); i++) {
-                         float* aPoint;
-                         aPoint = aDataSet->GetPoint(i);
-                         if (IsInRect(aPoint,  x1, y1, x2, y2)) {
-                           float aDisp[3];
-                           ComputeWorldToDisplay(aPoint[0],
-                                                 aPoint[1],
-                                                 aPoint[2], aDisp);
-                           aPointPicker->Pick(aDisp[0], aDisp[1], 0.0, CurrentRenderer);
-
-                           int pid = aPointPicker->GetPointId();
-                           if ( pid >= 0) { // && (!aSel->IsIndexSelected(IO, aPointPicker->GetPointId()))) {
-                             std::vector<int>::iterator found = 
-                               find(anIndices.begin(), anIndices.end(), pid);
-                             if (found == anIndices.end())
-                               anIndices.push_back(pid);
-                           }
+             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();
-                       }
+                     }
+                     if (!anIndices.empty()) {
+                       aSel->AddOrRemoveIndex(IO, anIndices, true, false);
+                       aSel->AddIObject(IO, false);
+                       anIndices.clear();
+                     }else{
+                       aSel->RemoveIObject(IO, false);
                      }
                    }
                  }
@@ -1114,100 +1024,40 @@ void VTKViewer_InteractorStyleSALOME::onFinishOperation()
              }
            }
            break;
+         }
          case CellSelection:
          case EdgeOfCellSelection:
          case EdgeSelection:
          case FaceSelection:
          case VolumeSelection: 
            {
-             VTKViewer_CellRectPicker* picker = VTKViewer_CellRectPicker::New();
+             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();
-             vtkActor* aActor;
              aListActors->InitTraversal();
-             while(aActor = aListActors->GetNextActor()) {
-               if (aActor->IsA("SALOME_Actor")) {
-                 SALOME_Actor* aSActor = SALOME_Actor::SafeDownCast(aActor);
+             while(vtkActor* aActor = aListActors->GetNextActor()) {
+               if (SALOME_Actor* aSActor = SALOME_Actor::SafeDownCast(aActor)) {
                  if (aSActor->hasIO()) {
                    Handle(SALOME_InteractiveObject) aIO = aSActor->getIO();
-                   // INFOS ( " NAME Object : " << aIO->getName() << " from " << aIO->getComponentDataType() );
-                   if (aSelActiveCompOnly &&
-                       strcmp(aActiveComponent->ComponentDataType(), 
-                              aIO->getComponentDataType()) != 0) {
+                   if (aSelActiveCompOnly && aComponentDataType != aIO->getComponentDataType())
                      continue;
-                   }
                    VTKViewer_CellDataSet cellList = picker->GetCellData(aActor);
                    if ( !cellList.empty() ) {
-                     INFOS ( " NAME Actor : " << aSActor->getName() );
-                     std::vector<int> anIndexes;
-                     if (aSelectionMode == CellSelection) {
-                       VTKViewer_CellDataSet::iterator it;
-                       for (it = cellList.begin(); it != cellList.end(); ++it) {
-                         int aCellId = (*it).cellId;
-                         if ( !isValid( aSActor, aCellId, aSelectionMode ) )
-                           continue;
-                                     
-                         int aObjId = aSActor->GetObjId(aCellId);
-                         std::vector<int> aVtkList;
-                         if ( aObjId != -1 )
-                           aVtkList = aSActor->GetVtkId(aObjId);
-                                     
-                         if (aVtkList.size() > 0) {
-                           std::vector<int>::iterator it;
-                           for (it = aVtkList.begin(); it != aVtkList.end(); ++it) {
-                             std::vector<int>::iterator found = 
-                               find(anIndexes.begin(), anIndexes.end(), *it);
-                             if (found == anIndexes.end())
-                               anIndexes.push_back(*it);
-                           }
-                         }
-                         else
-                           anIndexes.push_back(aCellId);
-                       }
-                     }
-                     else {
-                       if ( vtkDataSet* aDataSet = aSActor->GetMapper()->GetInput() ) {
-                         VTKViewer_CellDataSet::iterator it;
-                         for ( it = cellList.begin(); it != cellList.end(); ++it ) {
-                           int aCellId = (*it).cellId;
-                                         
-                           if ( !isValid( aSActor, aCellId, aSelectionMode ) )
-                             continue;
-                                         
-                           int aObjId = aSActor->GetObjId(aCellId);
-                           std::vector<int> aVtkList;
-                           if (aObjId != -1)
-                             aVtkList = aSActor->GetVtkId(aObjId);
-                           bool result = false;
-                           if (vtkCell* aCell = aDataSet->GetCell(aCellId)) {
-                             if ( aSelectionMode == EdgeSelection ) {
-                               if ( aSActor->GetObjDimension( aObjId ) == 1 )
-                                 result = true;
-                             }
-                             else if ( aSelectionMode == FaceSelection ) {
-                               if ( aSActor->GetObjDimension( aObjId ) == 2 )
-                                 result = true;
-                             }
-                             else if ( aSelectionMode == VolumeSelection ) {
-                               if ( aSActor->GetObjDimension( aObjId ) == 3 )
-                                 result = true;
-                             }
-                           }
-                           if ( result ) {
-                             if (aVtkList.size() > 0) {
-                               std::vector<int>::iterator it;
-                               for (it = aVtkList.begin(); it != aVtkList.end(); ++it) {
-                                 std::vector<int>::iterator found =
-                                   find(anIndexes.begin(), anIndexes.end(), *it);
-                                 if (found == anIndexes.end())
-                                   anIndexes.push_back(*it);
-                               }
-                             }
-                             else
-                               anIndexes.push_back(aCellId);
-                           }
+                     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);
                          }
                        }
                      }
@@ -1221,32 +1071,18 @@ void VTKViewer_InteractorStyleSALOME::onFinishOperation()
            break;          
          case ActorSelection: // objects selection
            {
-             VTKViewer_RectPicker* picker = VTKViewer_RectPicker::New();
+             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();
-             vtkActor* aActor;
              SALOME_ListIO aListIO;
              aListActors->InitTraversal();
-             while(aActor = aListActors->GetNextActor()) {
-               if (aActor->IsA("SALOME_Actor")) {
-                 SALOME_Actor* aSActor = SALOME_Actor::SafeDownCast(aActor);
+             while(vtkActor* aActor = aListActors->GetNextActor()) {
+               if (SALOME_Actor* aSActor = SALOME_Actor::SafeDownCast(aActor)) {
                  if (aSActor->hasIO()) {
                    Handle(SALOME_InteractiveObject) aIO = aSActor->getIO();
-                   bool isStored = false;
-                   if (!aListIO.IsEmpty()) {
-                     SALOME_ListIteratorOfListIO It(aListIO);
-                     for(;It.More();It.Next()) {
-                       Handle(SALOME_InteractiveObject) IOS = It.Value();
-                       if( aIO->isSame(IOS) ) {
-                         aIO = IOS; //Added by SRN, fix SAL1307
-                         isStored = true;
-                         break;
-                       }
-                     }
-                   }
-                   if (!isStored)
+                   if (!IsStored(aIO,aListIO))
                      aListIO.Append(aIO);
                  }
                }
@@ -1261,7 +1097,7 @@ void VTKViewer_InteractorStyleSALOME::onFinishOperation()
              }
            } // end case 4
          } //end switch
-         rwi->EndPickCallback();
+         m_Interactor->EndPickCallback();
        }
        aActiveStudy->update3dViewers();
       } 
@@ -1275,7 +1111,7 @@ void VTKViewer_InteractorStyleSALOME::onFinishOperation()
   case VTK_INTERACTOR_STYLE_CAMERA_GLOBAL_PAN: 
     {
       int w, h, x, y;
-      rwi->GetSize(w, h);
+      m_Interactor->GetSize(w, h);
       x = myPoint.x(); 
       y = h - myPoint.y() - 1;
       Place(x, y);
@@ -1352,7 +1188,10 @@ void VTKViewer_InteractorStyleSALOME::onOperation(QPoint mousePos)
 // called when selection mode changed (!put necessary initialization here!)
 void VTKViewer_InteractorStyleSALOME::OnSelectionModeChanged()
 {
-  myPActor->VisibilityOff();
+  
+  myPreSelectionActor->SetVisibility(false);
+  myElemId = myEdgeId = myNodeId = -1;
+  mySelectedActor = NULL;
 }
 
 // called when user moves mouse inside viewer window and there is no active viewer operation 
@@ -1361,216 +1200,121 @@ 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();
-  myPActor->VisibilityOff();
-      
-  vtkRenderWindowInteractor *rwi = this->Interactor;
+
   int w, h, x, y;
-  rwi->GetSize(w, h);
+  m_Interactor->GetSize(w, h);
   x = mousePos.x(); y = h - mousePos.y() - 1;
 
   this->FindPokedRenderer(x,y);
-  rwi->StartPickCallback();
-  rwi->GetPicker()->Pick(x, y, 0.0, this->CurrentRenderer);
-  
-  if (rwi->GetPicker()->IsA("vtkCellPicker")) {
-    vtkCellPicker* picker = vtkCellPicker::SafeDownCast(rwi->GetPicker());
-    int aVtkId = picker->GetCellId();
-    // INFOS ( " Preselected CellId : " << picker->GetCellId() );
-    if ( aVtkId >= 0 ) {
-      vtkActor* ac = picker->GetActor();
-      if ( ac->IsA("SALOME_Actor") ) {
-       SALOME_Actor* SActor = SALOME_Actor::SafeDownCast( ac );
-       // INFOS ( " NAME Actor : " << SActor->getName() );
+  m_Interactor->StartPickCallback();
+  myPreSelectionActor->SetVisibility(false);
 
-       if (rwi->IsA("VTKViewer_RenderWindowInteractor")) {
-         VTKViewer_RenderWindowInteractor* aRWI = 
-           VTKViewer_RenderWindowInteractor::SafeDownCast(rwi);
+  vtkPicker* aPicker = vtkPicker::SafeDownCast(m_Interactor->GetPicker());
+  aPicker->Pick(x, y, 0.0, this->CurrentRenderer);
 
-         //Cell selection //////////////////////////////////// NB
-         if ( aSelectionMode == CellSelection )
-    {
-      if ( SActor->hasIO() && isValid( SActor, aVtkId, CellSelection ) )
-      {
-             int anObjId = SActor->GetObjId(aVtkId);
-             std::vector<int> aVtkList;
-             if (anObjId != -1)
-          aVtkList = SActor->GetVtkId(anObjId);
-
-             if (aVtkList.size() > 0)
-                     aRWI->setCellData(SActor->getIO(), aVtkList, myPActor);
-             else
-          aRWI->setCellData(SActor->getIO(), aVtkId, myPActor);
-
-             this->CurrentRenderer->AddActor(myPActor);
-             myPActor->GetProperty()->SetRepresentationToSurface();
-             myPActor->VisibilityOn();
+  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);
            }
          }
-       
-         //Edge, Face, Volume and EdgeOfCell selection ////////////////////////// NB
-         else if ( aSelectionMode == EdgeSelection || 
-                   aSelectionMode == FaceSelection || 
-                   aSelectionMode == VolumeSelection  ||
-                   aSelectionMode == EdgeOfCellSelection ) {
-           if ( SActor->hasIO() && isValid( SActor, aVtkId, aSelectionMode ) )
-      {
-             if (vtkDataSet* UGrid = SActor->GetMapper()->GetInput()) {
-               if (vtkCell* pickedCell = UGrid->GetCell(aVtkId)) {
-                 bool result = false;
-                 int edgeId = -1;
-                 int anObjId = SActor->GetObjId(aVtkId);
-                 std::vector<int> aVtkList;
-                 if (anObjId > -1)
-                   aVtkList = SActor->GetVtkId(anObjId);
-
-                 if ( aSelectionMode == EdgeSelection ) {
-                   if ( SActor->GetObjDimension( anObjId ) == 1 )
-                     result = true;
-                 }
-                 else if ( aSelectionMode == FaceSelection ) {
-                   if ( SActor->GetObjDimension( anObjId ) == 2 )
-                     result = true;
-                 }
-                 else if ( aSelectionMode == VolumeSelection ) {
-                   if ( SActor->GetObjDimension( anObjId ) == 3 )
-                     result = true;
-                 }
-                 else {
-                   float pickPosition[3];
-                   picker->GetPickPosition(pickPosition);
-                   float distMin = 1000000.0, dist = 0;
-                   for (int i = 0, iEnd = pickedCell->GetNumberOfEdges(); i < iEnd; i++){
-                     vtkCell* edge = pickedCell->GetEdge(i);
-                     if(vtkLine* line = vtkLine::SafeDownCast(edge)){
-                       float pcoords[3],closestPoint[3],weights[3];
-                       int subId;
-                       line->EvaluatePosition(pickPosition,closestPoint,subId,pcoords,dist,weights);
-                       if (dist < distMin) {
-                         distMin = dist;
-                         edgeId = i;
-                       }
-                     }
-                   }
-                   if (edgeId != -1 || pickedCell->GetCellDimension() == 1) 
-                     result = true;
-                   // INFOS("edgeID transformed = "<<edgeId);
-                 }
-                 if (result)
-      {
-                   this->CurrentRenderer->RemoveActor(myPActor);
-                   if (edgeId == -1) {
-                     if (aVtkList.size() > 0)
-                       aRWI->setCellData(SActor->getIO(), aVtkList, myPActor);
-                     else
-                             aRWI->setCellData(SActor->getIO(), aVtkId, myPActor);
-                   }
-                   else
-                     aRWI->setEdgeData(SActor->getIO(), aVtkId, -edgeId-1, myPActor);
-          
-                   this->CurrentRenderer->AddActor(myPActor);
-                   myPActor->GetProperty()->SetRepresentationToSurface();
-                   myPActor->VisibilityOn();
-                 }
-               }
-             }
-           }
+       }
+       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 (rwi->GetPicker()->IsA("vtkPointPicker")) {
-    vtkPointPicker* picker = vtkPointPicker::SafeDownCast(rwi->GetPicker());
-    // INFOS ( " Preselected PointId : " << picker->GetPointId() );
-    if (picker->GetPointId() >= 0) {
-      vtkActor* ac = picker->GetActor();
-      if ( ac->IsA("SALOME_Actor") ) {
-       SALOME_Actor* SActor = SALOME_Actor::SafeDownCast( ac );
-       // INFOS ( " NAME Actor : " << SActor->getName() );
-
-       if (rwi->IsA("VTKViewer_RenderWindowInteractor")) {
-         VTKViewer_RenderWindowInteractor* aRWI = 
-           VTKViewer_RenderWindowInteractor::SafeDownCast(rwi);
-
-         if ( SActor->hasIO() ) {
-           myPActor->VisibilityOff();
-           this->CurrentRenderer->RemoveActor(myPActor);
-           aRWI->setPointData(SActor->getIO(), picker->GetPointId(), myPActor);
-           this->CurrentRenderer->AddActor(myPActor);
-           myPActor->GetProperty()->SetRepresentationToSurface();
-           myPActor->VisibilityOn();
-         }
+  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 ( rwi->GetPicker()->IsA("vtkPicker") ) {
-    vtkPicker* picker = vtkPicker::SafeDownCast(rwi->GetPicker());
-    vtkActor* ac = picker->GetActor();
-    
-    if ( ac != NULL ) {
-      if ( ac->IsA("SALOME_Actor") ) {
-        SALOME_Actor* SActor = SALOME_Actor::SafeDownCast( ac );
-        if ( preview != SActor ) {
-          if ( preview != NULL ) {
-            preview->SetPreSelected( false );
-          }
-         preview = SActor;
+  else if ( vtkPicker* picker = 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();
-
-            SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
-            Standard_Boolean IsSelected = false;
-            for(;It.More();It.Next()) {
-              Handle(SALOME_InteractiveObject) IOS = It.Value();
-              if(IO->isSame(IOS)) {
-                IsSelected = true;
-                break;
-              }
-            }
-
-            if ( !IsSelected ) {
+       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();
-              vtkActor *ac = theActors->GetNextActor();
-              while( ac ) {
-                if ( ac->IsA("SALOME_Actor") ) {
-                  SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac );
-                  if ( anActor->hasIO() ) {
-                    Handle(SALOME_InteractiveObject) IOS = anActor->getIO();
-                    if(IO->isSame(IOS)) {
-                      anActor->SetPreSelected( true );
-                    }
-                  }
-                }
-                ac = theActors->GetNextActor();
-              }
-              // INFOS ( " NAME PREVIEW " << SActor->getName() );
-            }
-          }
-        }
+           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 {
-      preview = NULL;
+      myPreViewActor = NULL;
       vtkActorCollection* theActors = this->CurrentRenderer->GetActors();
       theActors->InitTraversal();
-      vtkActor *ac = theActors->GetNextActor();
-      while( ac ) {
-        if ( ac->IsA("SALOME_Actor") ) {
-          SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac );
+      while( vtkActor *ac = theActors->GetNextActor() ) {
+        if ( SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac ) ) {
           anActor->SetPreSelected( false );
         }
-        ac = theActors->GetNextActor();
       }
     }
   }
-  rwi->EndPickCallback();
-  rwi->Render();
-
+  m_Interactor->EndPickCallback();
+  //m_Interactor->Render();
+  myGUIWindow->update();
+  
   this->LastPos[0] = x;
   this->LastPos[1] = y;
 }
@@ -1594,11 +1338,6 @@ void VTKViewer_InteractorStyleSALOME::Place(const int theX, const int theY)
   cam->SetParallelScale(myScale);
   ::ResetCameraClippingRange(this->CurrentRenderer);
 
-  /* VSV Light follows camera: if (this->CurrentLight) {
-    this->CurrentLight->SetPosition(cam->GetPosition());
-    this->CurrentLight->SetFocalPoint(cam->GetFocalPoint());
-    }*/
-  //VTKViewer_RenderWindow* aRW = dynamic_cast<VTKViewer_RenderWindow*>(this->Interactor->GetRenderWindow());
   if (myGUIWindow) myGUIWindow->update();
 
 }
@@ -1696,58 +1435,64 @@ bool VTKViewer_InteractorStyleSALOME::IsInRect(float* thePoint,
   return ((aPnt[0]>left) && (aPnt[0]<right) && (aPnt[1]>bottom) && (aPnt[1]<top));
 }
 
-void VTKViewer_InteractorStyleSALOME::SetFaceFilter( const Handle(VTKViewer_Filter)& f )
+void  VTKViewer_InteractorStyleSALOME::SetFilter( const Handle(VTKViewer_Filter)& theFilter )
 {
-  myFaceFilter = f;
+  myFilters[ theFilter->GetId() ] = theFilter;
 }
 
-void VTKViewer_InteractorStyleSALOME::RemoveFaceFilter()
+bool  VTKViewer_InteractorStyleSALOME::IsFilterPresent( const int theId )
 {
-  myFaceFilter.Nullify();
+  return myFilters.find( theId ) != myFilters.end();
 }
 
-void VTKViewer_InteractorStyleSALOME::SetEdgeFilter( const Handle(VTKViewer_Filter)& f )
+void  VTKViewer_InteractorStyleSALOME::RemoveFilter( const int theId )
 {
-  myEdgeFilter = f;
+  if ( IsFilterPresent( theId ) )
+    myFilters.erase( theId );
 }
 
-void VTKViewer_InteractorStyleSALOME::RemoveEdgeFilter()
-{
-  myEdgeFilter.Nullify();
-}
 
-bool VTKViewer_InteractorStyleSALOME::isValid( SALOME_Actor*        theActor,
-                                               const int            theId,
-                                               const Selection_Mode theSelMode )
+bool VTKViewer_InteractorStyleSALOME::IsValid( SALOME_Actor* theActor,
+                                               const int     theId,
+                                               const bool    theIsNode )
 {
-  if ( theSelMode != CellSelection &&
-       theSelMode != FaceSelection &&
-       theSelMode != EdgeSelection )
-    return true;
-
-  if ( theSelMode == CellSelection )
+  std::map<int, Handle(VTKViewer_Filter)>::const_iterator anIter;
+  for ( anIter = myFilters.begin(); anIter != myFilters.end(); ++anIter )
   {
-    vtkDataSet* aUGrid = theActor->GetMapper()->GetInput();
-    if ( aUGrid != 0 )
-    {
-      vtkCell* aCell = aUGrid->GetCell( theId );
-      if ( aCell != 0 )
-      {
-        int nbPoints = aCell->GetNumberOfPoints();
-        if ( nbPoints == 2 )
-          return myEdgeFilter.IsNull() || myEdgeFilter->IsValid( theActor, theId );
-        else
-          return myFaceFilter.IsNull() || myFaceFilter->IsValid( theActor, theId );
-
-        return true;
-      }
-    }
-    return false;
+    const Handle(VTKViewer_Filter)& aFilter = anIter->second;
+    if ( theIsNode == aFilter->IsNodeFilter() &&
+         !aFilter->IsValid( theActor, theId ) )
+      return false;
   }
-  else if ( theSelMode == FaceSelection )
-    return myFaceFilter.IsNull() || myFaceFilter->IsValid( theActor, theId );
-  else if ( theSelMode == EdgeSelection )
-    return myEdgeFilter.IsNull() || myEdgeFilter->IsValid( theActor, theId );
-    
   return true;
 }
+
+Handle(VTKViewer_Filter) VTKViewer_InteractorStyleSALOME::GetFilter( const int theId )
+{
+  return IsFilterPresent( theId ) ? myFilters[ theId ] : Handle(VTKViewer_Filter)();
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
index ce55fdfc8d98c4fa1a3f0297e6af914927649afe..851aeafdfc6cddbd827b45ed205e68ea758349e9 100644 (file)
 #define __VTKViewer_InteractorStyleSALOME_h
 
 #include <vtkInteractorStyle.h>
+
+class vtkCell;
+class vtkRenderWindowInteractor;
+
 #include <qobject.h>
 #include <qcursor.h>
-#include "SALOME_Actor.h"
+
 #include "VTKViewer_Filter.h"
-#include "SALOME_Selection.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
@@ -55,14 +62,16 @@ class VTKViewer_InteractorStyleSALOME : public QObject, public vtkInteractorStyl
   // 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);
 
-  vtkTypeMacro(VTKViewer_InteractorStyleSALOME, vtkObject);
-  void PrintSelf(ostream& os, vtkIndent indent);
-
   // 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);
@@ -76,10 +85,14 @@ class VTKViewer_InteractorStyleSALOME : public QObject, public vtkInteractorStyl
 
   void  ViewFitAll();
 
-  void  SetEdgeFilter( const Handle(VTKViewer_Filter)& );
-  void  SetFaceFilter( const Handle(VTKViewer_Filter)& );
-  void  RemoveFaceFilter();
-  void  RemoveEdgeFilter();
+  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 );
+  
 
  protected:
   VTKViewer_InteractorStyleSALOME();
@@ -104,19 +117,21 @@ class VTKViewer_InteractorStyleSALOME : public QObject, public vtkInteractorStyl
                const int left, const int top, 
                const int right, const int bottom);
 
-  bool isValid( SALOME_Actor* theActor, const int theCellId, const Selection_Mode theSelMode );
-
   int State;
   float MotionFactor;
   float RadianToDegree;                 // constant: for conv from deg to rad
   double myScale;
 
-  SALOME_Actor* preview;
-  vtkActor*     myPActor;
+  SALOME_Actor* myPreViewActor;
 
-public:
+  VTKViewer_Actor* myPreSelectionActor;
+  SALOME_Actor* mySelectedActor;
+  int myElemId;
+  int myEdgeId;
+  int myNodeId;
+
+ public:
   bool eventFilter(QObject* object, QEvent* event);
-  void ControlLblSize(double aOldScale, double aNewScale);
   void startZoom();
   void startPan();
   void startGlobalPan();
@@ -124,10 +139,8 @@ public:
   void startFitArea();
   void startSpin();
   bool needsRedrawing();
-  QWidget* getGUIWindow() {return myGUIWindow;}
-  void setGUIWindow(QWidget* theWin) { myGUIWindow = theWin;}
 
-protected:
+ protected:
   void loadCursors();
   void startOperation(int operation);
   void onStartOperation();
@@ -136,7 +149,8 @@ protected:
   void onCursorMove(QPoint mousePos);
   void setCursor(const int operation);
 
-protected:
+
+ protected:
   QCursor                   myDefCursor;
   QCursor                   myPanCursor;
   QCursor                   myZoomCursor;
@@ -150,12 +164,12 @@ protected:
   bool                      myShiftState;
   int                       ForcedState;
   
+  VTKViewer_RenderWindowInteractor* m_Interactor;
+  VTKViewer_ViewFrame*      m_ViewFrame;
   VTKViewer_Trihedron*      m_Trihedron;
-  
   QWidget*                  myGUIWindow;
   
-  Handle(VTKViewer_Filter)  myEdgeFilter;
-  Handle(VTKViewer_Filter)  myFaceFilter;
+  std::map<int, Handle(VTKViewer_Filter)> myFilters;
 
   //  members from old version
   double                    DeltaElevation;
index 9658ef5e52e8506d57dc2e2123c4dd9323d5b4b1..c7d3828a95907295998b1f595ca96eb30bb3f93d 100644 (file)
 //  $Header$
 
 #include "VTKViewer_RenderWindowInteractor.h"
-#include "VTKViewer_RenderWindow.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 "SALOME_Selection.h"
-#include "SALOME_Actor.h"
+#include "VTKViewer_Actor.h"
 
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
 
 // VTK Includes
-#include <vtkAssemblyNode.h>
-#include <vtkActor.h>
-#include <vtkInteractorStyle.h>
 #include <vtkObjectFactory.h>
 #include <vtkPicker.h>
 #include <vtkCellPicker.h>
 #include <vtkPointPicker.h>
-#include <vtkUnstructuredGrid.h>
-#include <vtkPolyDataMapper.h>
-#include <vtkSphereSource.h>
-#include <vtkDataSet.h>
-#include <vtkMaskPoints.h>
-#include <vtkVertex.h>
 #include <vtkRendererCollection.h>
-#include <vtkPolyDataWriter.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 ) {
@@ -74,18 +79,51 @@ VTKViewer_RenderWindowInteractor* VTKViewer_RenderWindowInteractor::New() {
 VTKViewer_RenderWindowInteractor::VTKViewer_RenderWindowInteractor() {
   this->Enabled = 0 ;
   this->mTimer = new QTimer( this ) ;
-  this->displaymode = 0;
+  myDisplayMode = 0;
   myGUIWindow = 0;
-  vtkPicker* thepicker = vtkPicker::New();
-  thepicker->SetTolerance(0);
-  this->SetPicker(thepicker);
+
+  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) {
@@ -132,6 +170,10 @@ void VTKViewer_RenderWindowInteractor::Initialize() {
   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. 
   //
@@ -147,93 +189,83 @@ void VTKViewer_RenderWindowInteractor::Initialize() {
   //
   this->Initialized = 1 ;
 
-  myTolNodes = 0.025;
-  myTolItems = 0.001;
+  return ;
+}
 
-  Cell_Actor = vtkActor::New(); 
-  Cell_Actor->PickableOff();
-  Cell_Actor->GetProperty()->SetColor(1,1,0);
-  Cell_Actor->GetProperty()->SetLineWidth(5);
-  Cell_Actor->GetProperty()->SetRepresentationToSurface();
 
-  Edge_Actor = vtkActor::New(); 
-  Edge_Actor->PickableOff();
-  Edge_Actor->GetProperty()->SetColor(1,0,0);
-  Edge_Actor->GetProperty()->SetLineWidth(5);
-  Edge_Actor->GetProperty()->SetRepresentationToWireframe();
+//----------------------------------------------------------------------------
+void VTKViewer_RenderWindowInteractor::setGUIWindow(QWidget* theWindow){
+  myGUIWindow = theWindow;
+}
 
-  Point_Actor = vtkActor::New(); 
-  Point_Actor->PickableOff();
-  Point_Actor->GetProperty()->SetColor(1,1,0);
-  Point_Actor->GetProperty()->SetPointSize(5);
-  Point_Actor->GetProperty()->SetRepresentationToPoints();
+//----------------------------------------------------------------------------
+void VTKViewer_RenderWindowInteractor::setViewFrame(VTKViewer_ViewFrame* theViewFrame){
+  myViewFrame = theViewFrame;
 
-  return ;
+  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 mode)
+void VTKViewer_RenderWindowInteractor::SetSelectionMode(Selection_Mode theMode)
 {
-  Cell_Actor->VisibilityOff();
-  Edge_Actor->VisibilityOff();
-  Point_Actor->VisibilityOff();
-
-  selectionmode = mode;
-  if ( mode == NodeSelection ) {
-    vtkPointPicker* thepicker = vtkPointPicker::New();
-    thepicker->SetTolerance(myTolNodes);
-    this->SetPicker(thepicker);
-  } else if ( mode == EdgeOfCellSelection ) {
-    vtkCellPicker* thepicker = vtkCellPicker::New();
-    thepicker->SetTolerance(myTolItems);
-    this->SetPicker(thepicker);
-  } else if ( mode == CellSelection || mode == EdgeSelection || 
-             mode == FaceSelection || mode == VolumeSelection ) {
-    vtkCellPicker* thepicker = vtkCellPicker::New();
-    thepicker->SetTolerance(myTolItems); 
-    this->SetPicker(thepicker);
-  } else if ( mode == ActorSelection ) {
-    vtkPicker* thepicker = vtkPicker::New();
-    thepicker->SetTolerance(myTolItems);
-    this->SetPicker(thepicker);
+  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;
   }
 
-  VTKViewer_InteractorStyleSALOME* Style = 0;
-  if (this->InteractorStyle->IsA("VTKViewer_InteractorStyleSALOME"))
-    Style = VTKViewer_InteractorStyleSALOME::SafeDownCast(this->InteractorStyle);
-  else 
-    return;
-  Style->OnSelectionModeChanged();
+  myInteractorStyle->OnSelectionModeChanged();
 }
 
 void VTKViewer_RenderWindowInteractor::SetSelectionProp(const double& theRed, const double& theGreen, 
                                                        const double& theBlue, const int& theWidth) 
 {
-  Cell_Actor->GetProperty()->SetColor(theRed, theGreen, theBlue);
-  Cell_Actor->GetProperty()->SetLineWidth(theWidth);
+  myCellActor->GetProperty()->SetColor(theRed, theGreen, theBlue);
+  myCellActor->GetProperty()->SetLineWidth(theWidth);
 
-  Point_Actor->GetProperty()->SetColor(theRed, theGreen, theBlue);
-  Point_Actor->GetProperty()->SetPointSize(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;
-  if (this->GetPicker()->IsA("vtkPointPicker")) {
-    vtkPointPicker* picker = vtkPointPicker::SafeDownCast(this->GetPicker());
-    picker->SetTolerance(theTolNodes);
-  }
-  else if (this->GetPicker()->IsA("vtkPicker")) {
-    vtkPicker* picker = vtkPicker::SafeDownCast(this->GetPicker());
-    picker->SetTolerance(theTolItems);
-  }
+
+  myBasicPicker->SetTolerance(myTolItems);
+  myCellPicker->SetTolerance(myTolItems);
+  myPointPicker->SetTolerance(myTolNodes);
+
 }
 
 void VTKViewer_RenderWindowInteractor::Enable() {
@@ -391,15 +423,8 @@ void VTKViewer_RenderWindowInteractor::MouseMove(const QMouseEvent *event) {
   if( ! this->Enabled ) {
     return ;
   }
-  VTKViewer_InteractorStyleSALOME* Style = 0;
-  if (this->InteractorStyle->IsA("VTKViewer_InteractorStyleSALOME"))
-    Style = VTKViewer_InteractorStyleSALOME::SafeDownCast(this->InteractorStyle);
-  else {
-    emit RenderWindowModified() ; 
-    return;
-  }
-  Style->OnMouseMove(0, 0, event->x(), event->y()/*this->Size[1] - event->y() - 1*/) ;
-  if (Style->needsRedrawing() )
+  myInteractorStyle->OnMouseMove(0, 0, event->x(), event->y()/*this->Size[1] - event->y() - 1*/) ;
+  if (myInteractorStyle->needsRedrawing() )
     emit RenderWindowModified() ; 
 }
 
@@ -407,84 +432,54 @@ void VTKViewer_RenderWindowInteractor::LeftButtonPressed(const QMouseEvent *even
   if( ! this->Enabled ) {
     return ;
   }
-  VTKViewer_InteractorStyleSALOME* Style = 0;
-  if (this->InteractorStyle->IsA("VTKViewer_InteractorStyleSALOME"))
-    Style = VTKViewer_InteractorStyleSALOME::SafeDownCast(this->InteractorStyle);
-  else 
-    return;
-  Style->OnLeftButtonDown((event->state() & ControlButton), 
-                         (event->state() & ShiftButton), 
-                         event->x(), event->y());
+  myInteractorStyle->OnLeftButtonDown((event->state() & ControlButton), 
+                                     (event->state() & ShiftButton), 
+                                     event->x(), event->y());
 }
 
 void VTKViewer_RenderWindowInteractor::LeftButtonReleased(const QMouseEvent *event) {
   if( ! this->Enabled ) {
     return ;
   }
-  VTKViewer_InteractorStyleSALOME* Style = 0;
-  if (this->InteractorStyle->IsA("VTKViewer_InteractorStyleSALOME"))
-    Style = VTKViewer_InteractorStyleSALOME::SafeDownCast(this->InteractorStyle);
-  else 
-    return;
-  Style->OnLeftButtonUp( (event->state() & ControlButton), 
-                        (event->state() & ShiftButton), 
-                        event->x(), event->y() ) ;
+  myInteractorStyle->OnLeftButtonUp( (event->state() & ControlButton), 
+                                    (event->state() & ShiftButton), 
+                                    event->x(), event->y() ) ;
 }
 
 void VTKViewer_RenderWindowInteractor::MiddleButtonPressed(const QMouseEvent *event) {
   if( ! this->Enabled ) {
     return ;
   }
-  VTKViewer_InteractorStyleSALOME* Style = 0;
-  if (this->InteractorStyle->IsA("VTKViewer_InteractorStyleSALOME"))
-    Style = VTKViewer_InteractorStyleSALOME::SafeDownCast(this->InteractorStyle);
-  else 
-    return;
-  Style->OnMiddleButtonDown((event->state() & ControlButton), 
-                           (event->state() & ShiftButton), 
-                           event->x(), event->y() ) ;
+  myInteractorStyle->OnMiddleButtonDown((event->state() & ControlButton), 
+                                       (event->state() & ShiftButton), 
+                                       event->x(), event->y() ) ;
 }
 
 void VTKViewer_RenderWindowInteractor::MiddleButtonReleased(const QMouseEvent *event) {
   if( ! this->Enabled ) {
     return ;
   }
-  VTKViewer_InteractorStyleSALOME* Style = 0;
-  if (this->InteractorStyle->IsA("VTKViewer_InteractorStyleSALOME"))
-    Style = VTKViewer_InteractorStyleSALOME::SafeDownCast(this->InteractorStyle);
-  else 
-    return;
-  Style->OnMiddleButtonUp( (event->state() & ControlButton), 
-                          (event->state() & ShiftButton), 
-                          event->x(), event->y() ) ;
+  myInteractorStyle->OnMiddleButtonUp( (event->state() & ControlButton), 
+                                      (event->state() & ShiftButton), 
+                                      event->x(), event->y() ) ;
 }
 
 void VTKViewer_RenderWindowInteractor::RightButtonPressed(const QMouseEvent *event) {
   if( ! this->Enabled ) {
     return ;
   }
-  VTKViewer_InteractorStyleSALOME* Style = 0;
-  if (this->InteractorStyle->IsA("VTKViewer_InteractorStyleSALOME"))
-    Style = VTKViewer_InteractorStyleSALOME::SafeDownCast(this->InteractorStyle);
-  else 
-    return;
-  Style->OnRightButtonDown( (event->state() & ControlButton), 
-                           (event->state() & ShiftButton), 
-                           event->x(), event->y() ) ;
+  myInteractorStyle->OnRightButtonDown( (event->state() & ControlButton), 
+                                       (event->state() & ShiftButton), 
+                                       event->x(), event->y() ) ;
 }
 
 void VTKViewer_RenderWindowInteractor::RightButtonReleased(const QMouseEvent *event) {
   if( ! this->Enabled ) {
     return ;
   }
-  VTKViewer_InteractorStyleSALOME* Style = 0;
-  if (this->InteractorStyle->IsA("VTKViewer_InteractorStyleSALOME"))
-    Style = VTKViewer_InteractorStyleSALOME::SafeDownCast(this->InteractorStyle);
-  else 
-    return;
-  Style->OnRightButtonUp( (event->state() & ControlButton), 
-                         (event->state() & ShiftButton), 
-                         event->x(), event->y() ) ;
+  myInteractorStyle->OnRightButtonUp( (event->state() & ControlButton), 
+                                     (event->state() & ShiftButton), 
+                                     event->x(), event->y() ) ;
 }
 
 void VTKViewer_RenderWindowInteractor::ButtonPressed(const QMouseEvent *event) {
@@ -495,112 +490,59 @@ void VTKViewer_RenderWindowInteractor::ButtonReleased(const QMouseEvent *event)
   return ;
 }
 
-void VTKViewer_RenderWindowInteractor::ChangeRepresentationToWireframe(vtkActorCollection* ac)
-{
-  vtkActor* anActor;
-
-  for (ac->InitTraversal(); (anActor = ac->GetNextActor()); ) {
-    if ( anActor->IsA("GEOM_Actor") ) {
-      SALOME_Actor* SALOMEactor = SALOME_Actor::SafeDownCast(anActor);
-      // Specific for GEOM actor
-      if ( SALOMEactor->getDisplayMode() == 1 )
-       SALOMEactor->setDisplayMode(0);
-    } else {
-      anActor->GetProperty()->SetRepresentationToWireframe();
-    }
-  }
-  this->RenderWindow->Render();
-  emit RenderWindowModified() ;
-}
 
 int VTKViewer_RenderWindowInteractor::GetDisplayMode() {
-  return displaymode;
-}
-
-void VTKViewer_RenderWindowInteractor::SetDisplayMode(int mode) {
-  if(mode==0) ChangeRepresentationToWireframe();
-  else ChangeRepresentationToSurface();
-  displaymode = mode;
-}
-
-void VTKViewer_RenderWindowInteractor::SwitchRepresentation(const Handle(SALOME_InteractiveObject)& IObject,
-                                                           bool update) {  
-  vtkRenderer* aren;
-  for (this->RenderWindow->GetRenderers()->InitTraversal(); 
-       (aren = this->RenderWindow->GetRenderers()->GetNextItem()); ) {
-    vtkActorCollection* theActors = aren->GetActors();
-    theActors->InitTraversal();
-    vtkActor *ac = theActors->GetNextActor();
-    while(!(ac==NULL)) {
-      if ( ac->IsA("SALOME_Actor") ) {
-       SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac );
-       if ( anActor->hasIO() ) {
-         if ( IObject->isSame( anActor->getIO() ) ) {
-           if ( anActor->IsA("GEOM_Actor") ) {
-             // GEOM actor
-             if ( anActor->getDisplayMode() == 0 ) anActor->setDisplayMode(1);
-             else anActor->setDisplayMode(0);
-           }
-           else {
-             if(anActor->GetProperty()->GetRepresentation() <= 1)
-               anActor->GetProperty()->SetRepresentationToSurface();
-             else
-               anActor->GetProperty()->SetRepresentationToWireframe(); 
-           }
-         }
-       }
-      }
-      ac = theActors->GetNextActor();
-    }
-  } 
-  if (update) {
-    this->RenderWindow->Render();
-    emit RenderWindowModified() ;
-  }
+  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()
-  // change all actors to wireframe
 {
-  vtkActorCollection *ac;
-  vtkActor *anActor, *aPart;
-  
-  ac = GetRenderer()->GetActors();
-  ChangeRepresentationToWireframe(ac);
+  ChangeRepresentationToWireframe(GetRenderer()->GetActors());
 }
 
+void VTKViewer_RenderWindowInteractor::ChangeRepresentationToSurface()
+{
+  ChangeRepresentationToSurface(GetRenderer()->GetActors());
+}
 
 
-void VTKViewer_RenderWindowInteractor::ChangeRepresentationToSurface(vtkActorCollection* ac)
+void VTKViewer_RenderWindowInteractor::ChangeRepresentationToWireframe(vtkActorCollection* theCollection)
 {
-  vtkActor *anActor, *aPart;
-  
-  for (ac->InitTraversal(); (anActor = ac->GetNextActor()); ) {
-    if ( anActor->IsA("GEOM_Actor") ) {
-      SALOME_Actor* SALOMEactor = SALOME_Actor::SafeDownCast(anActor);
-      // Specific for GEOM actor
-      if ( SALOMEactor->getDisplayMode() == 0 )
-       SALOMEactor->setDisplayMode(1);
-    } else {
-      anActor->GetProperty()->SetRepresentationToSurface();
-    }
-  }
-  this->RenderWindow->Render();
-  emit RenderWindowModified() ;
+  using namespace SALOME::VTK;
+  ForEach<SALOME_Actor>(theCollection,
+                       TSetFunction<SALOME_Actor,int>
+                       (&SALOME_Actor::setDisplayMode,0));
+  emit RenderWindowModified();
 }
 
-void VTKViewer_RenderWindowInteractor::ChangeRepresentationToSurface()
-  // change all actors to "surface" or solid
+void VTKViewer_RenderWindowInteractor::ChangeRepresentationToSurface(vtkActorCollection* theCollection)
 {
-  vtkActorCollection *ac;
-  vtkActor *anActor, *aPart;
-  
-  ac = GetRenderer()->GetActors();
-  ChangeRepresentationToSurface(ac);
+  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();
@@ -608,287 +550,212 @@ vtkRenderer* VTKViewer_RenderWindowInteractor::GetRenderer()
   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()
 {   
-  vtkActorCollection *ac;
-  vtkActor *anActor, *aPart;
-  
-  ac = GetRenderer()->GetActors();
-  for (ac->InitTraversal(); (anActor = ac->GetNextActor()); ) {
-    if ( anActor->IsA("SALOME_Actor") ) {
-      SALOME_Actor* SActor = SALOME_Actor::SafeDownCast( anActor );
-      SActor->SetVisibility(false);
-    }
-  }
+  using namespace SALOME::VTK;
+  ForEach<SALOME_Actor>(GetRenderer()->GetActors(),
+                       TErase());
+
   emit RenderWindowModified() ;
 }
 
+
 void VTKViewer_RenderWindowInteractor::DisplayAll()
-{   
-  vtkActorCollection *ac;
-  vtkActor *anActor, *aPart;
-  
-  ac = GetRenderer()->GetActors();
-  for (ac->InitTraversal(); (anActor = ac->GetNextActor()); ) {
-    if ( anActor->IsA("SALOME_Actor") ) {
-      SALOME_Actor* SActor = SALOME_Actor::SafeDownCast( anActor );
-      SActor->SetVisibility( true );
-    }
-  }
+{ 
+  vtkActorCollection* aCollection = GetRenderer()->GetActors();
+  using namespace SALOME::VTK;
+  ForEach<SALOME_Actor>(aCollection,TSetVisibility<SALOME_Actor>(true));
+
   emit RenderWindowModified() ;
 }
 
-void VTKViewer_RenderWindowInteractor::Erase( SALOME_Actor* SActor, bool update)
+
+void VTKViewer_RenderWindowInteractor::Erase(SALOME_Actor* theActor, bool update)
 {
-  SActor->SetVisibility( false );
+  TErase()(theActor);
 
-  // Erase dependent actors
-  vtkActorCollection* theChildActors = vtkActorCollection::New(); 
-  SActor->GetChildActors(theChildActors);
+  if(update)
+    emit RenderWindowModified();
+}
 
-  theChildActors->InitTraversal();
-  vtkActor *ac = theChildActors->GetNextActor();
-  while(!(ac==NULL)) {
-    ac->SetVisibility( false );
-    ac = theChildActors->GetNextActor();
-  }
 
-  if (update) 
+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();
 }
 
-void VTKViewer_RenderWindowInteractor::Erase(const Handle(SALOME_InteractiveObject)& IObject, bool update)
+
+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;
-  for (this->RenderWindow->GetRenderers()->InitTraversal(); 
-       (aren = this->RenderWindow->GetRenderers()->GetNextItem()); ) {
-    vtkActorCollection* theActors = aren->GetActors();
-    theActors->InitTraversal();
-    vtkActor *ac = theActors->GetNextActor();
-    while(!(ac==NULL)) {
-      if ( ac->IsA("SALOME_Actor") ) {
-       SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac );
-       if ( anActor->hasIO() ) {
-         if ( IObject->isSame( anActor->getIO() ) ) {
-           Erase(anActor, false);
-         }
-       }
-      }
-      ac = theActors->GetNextActor();
-    }
-  } 
-  if (update)
-    emit RenderWindowModified() ;
+  vtkRenderer* aRen = GetRenderer();
+
+  using namespace SALOME::VTK;
+  ForEachIf<SALOME_Actor>(aRen->GetActors(),
+                         TIsSameIObject<SALOME_Actor>(theIObject),
+                         TRemoveAction(aRen));
+
+  if(update)
+    emit RenderWindowModified();
 }
 
-void VTKViewer_RenderWindowInteractor::Remove(const Handle(SALOME_InteractiveObject)& IObject, bool update)
+
+float VTKViewer_RenderWindowInteractor::GetTransparency(const Handle(SALOME_InteractiveObject)& theIObject) 
 {
-  vtkRenderer* aren;
-  for (this->RenderWindow->GetRenderers()->InitTraversal(); 
-       (aren = this->RenderWindow->GetRenderers()->GetNextItem()); ) {
-    vtkActorCollection* theActors = aren->GetActors();
-    theActors->InitTraversal();
-    vtkActor *ac = theActors->GetNextActor();
-    while(!(ac==NULL)) {
-      if ( ac->IsA("SALOME_Actor") ) {
-       SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac );
-       if ( anActor->hasIO() ) {
-         if ( IObject->isSame( anActor->getIO() ) ) {
-           aren->RemoveActor(anActor);
-         }
-       }
-      }
-      ac = theActors->GetNextActor();
-    }
-  } 
-  if (update)
-    emit RenderWindowModified() ;
+  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;
 }
 
-float VTKViewer_RenderWindowInteractor::GetTransparency(const Handle(SALOME_InteractiveObject)& IObject) {
-  vtkRenderer* aren;
-  for (this->RenderWindow->GetRenderers()->InitTraversal(); 
-       (aren = this->RenderWindow->GetRenderers()->GetNextItem()); ) {
-    vtkActorCollection* theActors = aren->GetActors();
-    theActors->InitTraversal();
-    vtkActor *ac = theActors->GetNextActor();
-    while(!(ac==NULL)) {
-      if ( ac->IsA("SALOME_Actor") ) {
-       SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac );
-       if ( anActor->hasIO() ) {
-         if ( IObject->isSame( anActor->getIO() ) ) {
-           if ( anActor->IsA("GEOM_Actor") ) {
-             // GEOM actor
-             return (1-(anActor->GetOpacity()));
-           }
-           else return (1-anActor->GetProperty()->GetOpacity());
-         }
-       }
-      }
-      ac = theActors->GetNextActor();
-    }
-  } 
-  return -1;
-}
-
-void VTKViewer_RenderWindowInteractor::SetTransparency(const Handle(SALOME_InteractiveObject)& IObject, float trans) {
-  vtkRenderer* aren;
-  for (this->RenderWindow->GetRenderers()->InitTraversal(); 
-       (aren = this->RenderWindow->GetRenderers()->GetNextItem()); ) {
-    vtkActorCollection* theActors = aren->GetActors();
-    theActors->InitTraversal();
-    vtkActor *ac = theActors->GetNextActor();
-    while(!(ac==NULL)) {
-      if ( ac->IsA("SALOME_Actor") ) {
-       SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac );
-       if ( anActor->hasIO() ) {
-         if ( IObject->isSame( anActor->getIO() ) ) {
-           if ( anActor->IsA("GEOM_Actor") ) {
-             // GEOM actor
-             anActor->SetOpacity(1-trans);
-           }
-           else anActor->GetProperty()->SetOpacity(1-trans);
-         }
-       }
-      }
-      ac = theActors->GetNextActor();
-    }
-  } 
+
+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* SActor, bool update)
+
+void VTKViewer_RenderWindowInteractor::Display(SALOME_Actor* theActor, bool update)
 {
-  vtkRenderer* aren;
-  for (this->RenderWindow->GetRenderers()->InitTraversal(); 
-       (aren = this->RenderWindow->GetRenderers()->GetNextItem()); ) {
-    aren->AddActor( SActor );
-    SActor->SetVisibility( true );
-  }
+  GetRenderer()->AddActor(theActor);
+  theActor->SetVisibility(true);
 
-  if (update) {
-    Render();
+  if(update)
     emit RenderWindowModified();
-  }
 }
 
-void VTKViewer_RenderWindowInteractor::Display(const Handle(SALOME_InteractiveObject)& IObject, bool update)
+
+void VTKViewer_RenderWindowInteractor::Display(const Handle(SALOME_InteractiveObject)& theIObject, bool update)
 {
-  Standard_Boolean isalreadydisplayed = false;
-
-  vtkRenderer* aren;
-  for (this->RenderWindow->GetRenderers()->InitTraversal(); 
-       (aren = this->RenderWindow->GetRenderers()->GetNextItem()); ) {
-    vtkActorCollection* theActors = aren->GetActors();
-    theActors->InitTraversal();
-    vtkActor *ac = theActors->GetNextActor();
-    while(!(ac==NULL)) {
-      if ( ac->IsA("SALOME_Actor") ) {
-       SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac );
-       if ( anActor->hasIO() ) {
-         if ( IObject->isSame( anActor->getIO() ) ) {
-           anActor->SetVisibility( true );
-         }
-       }
-      }
-      ac = theActors->GetNextActor();
-    }
-  }
-  if (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) {
-//    MESSAGE ( " vtkQGLRenderWindowInteractor::KeyPressed " )
 
-//    if (!QAD_Application::getDesktop()->getActiveComponent().isEmpty()) {
-//      QAD_Application::getDesktop()->onKeyPress( event );
-//    }
-}
+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)& IObject, 
+bool VTKViewer_RenderWindowInteractor::highlight( const Handle(SALOME_InteractiveObject)& theIObject, 
                                                  bool hilight, 
                                                  bool update)
 {
-  VTKViewer_InteractorStyleSALOME* aStyle = 
-    VTKViewer_InteractorStyleSALOME::SafeDownCast(this->InteractorStyle);
-  if(!aStyle) return false;
-  vtkRendererCollection* aRenColl = this->RenderWindow->GetRenderers();
-  aRenColl->InitTraversal();
-  while(vtkRenderer* aRen = this->RenderWindow->GetRenderers()->GetNextItem()){
-      vtkActorCollection* theActors = aRen->GetActors();
-      theActors->InitTraversal();
-      while(vtkActor *anAct = theActors->GetNextActor()) {
-       if(SALOME_Actor* anActor = SALOME_Actor::SafeDownCast(anAct)){
-         if(anActor->hasIO()){
-           if(IObject->isSame(anActor->getIO())){
-             if(anActor->GetMapper() == NULL)
-               return false;
-             //highlight or unhilight actors
-             if(anActor->hasHighlight())
-               anActor->highlight(hilight);
-             else{
-               if(anActor->GetVisibility() == 1 && hilight)
-                 aStyle->HighlightProp(anActor);
-               else if(!hilight)
-                 aStyle->HighlightProp(NULL);
-             }
-           }
-         }
-       }
-      }
-    }
-  if(update){
-    Render();
+  using namespace SALOME::VTK;
+  ForEachIf<SALOME_Actor>(GetRenderer()->GetActors(),
+                         TIsSameIObject<SALOME_Actor>(theIObject),
+                         THighlightAction(myInteractorStyle,hilight));
+
+  if(update)
     emit RenderWindowModified();
-  }
+
   return false;
 }
 
-void VTKViewer_RenderWindowInteractor::Update() {
-  vtkRenderer* aren;
-  for (this->RenderWindow->GetRenderers()->InitTraversal(); 
-       (aren = this->RenderWindow->GetRenderers()->GetNextItem()); ) {
-    vtkActorCollection* theActors = aren->GetActors();
-    theActors->InitTraversal();
-    vtkActor *ac = theActors->GetNextActor();
-
-    while(!(ac==NULL)) {
-      ac->ApplyProperties();
-      //VSV: No in VTK: ac->Update();
-      ac = theActors->GetNextActor();
-    }
-    aren->ResetCamera();
-    emit RenderWindowModified() ;  
+
+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();  
 }
 
 
-bool VTKViewer_RenderWindowInteractor::unHighlightAll(){
-  VTKViewer_InteractorStyleSALOME* aStyle = 
-    VTKViewer_InteractorStyleSALOME::SafeDownCast(this->InteractorStyle);
-  if(aStyle) aStyle->HighlightProp(NULL);
-  vtkRendererCollection* aRenColl = this->RenderWindow->GetRenderers();
-  aRenColl->InitTraversal();
-  while(vtkRenderer* aRen = this->RenderWindow->GetRenderers()->GetNextItem()){
-    vtkActorCollection* theActors = aRen->GetActors();
-    if(theActors->IsItemPresent(Point_Actor)) 
-      aRen->RemoveActor(Point_Actor);
-    if(theActors->IsItemPresent(Edge_Actor)) 
-      aRen->RemoveActor(Edge_Actor); 
-    if(theActors->IsItemPresent(Cell_Actor)) 
-      aRen->RemoveActor(Cell_Actor);
-
-    theActors->InitTraversal();
-    while(vtkActor *anAct = theActors->GetNextActor()) {
-      if(SALOME_Actor* anActor = SALOME_Actor::SafeDownCast(anAct)){
-       if(anActor->hasIO()){
-         //highlight or unhilight actors
-         if(anActor->hasHighlight())
-           anActor->highlight(false);
-       }
-      }
+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;
 }
@@ -897,159 +764,75 @@ bool VTKViewer_RenderWindowInteractor::unHighlightAll(){
 // Color methods
 //-----------------
 
-void VTKViewer_RenderWindowInteractor::SetColor(const Handle(SALOME_InteractiveObject)& IObject,QColor thecolor) {
-  vtkRenderer* aren;
-  for (this->RenderWindow->GetRenderers()->InitTraversal(); 
-       (aren = this->RenderWindow->GetRenderers()->GetNextItem()); ) {
-    vtkActorCollection* theActors = aren->GetActors();
-    theActors->InitTraversal();
-    vtkActor *ac = theActors->GetNextActor();
-    while(!(ac==NULL)) {
-      if ( ac->IsA("SALOME_Actor") ) {
-       SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac );
-       if ( anActor->hasIO() ) {
-         if ( IObject->isSame( anActor->getIO() ) ) {
-           if ( anActor->IsA("GEOM_Actor") ) {
-             // GEOM actor
-             anActor->SetColor(float(thecolor.red())/255,float(thecolor.green())/255,float(thecolor.blue())/255);
-           }
-           else {
-             anActor->GetProperty()->SetColor(float(thecolor.red())/255,float(thecolor.green())/255,float(thecolor.blue())/255);
-           }
-         }
-       }
-      }
-      ac = theActors->GetNextActor();
-    }
-  } 
-}
-
-QColor VTKViewer_RenderWindowInteractor::GetColor(const Handle(SALOME_InteractiveObject)& IObject) {
-  vtkRenderer* aren;
-  QColor emptycolor(0,0,0);
-  for (this->RenderWindow->GetRenderers()->InitTraversal(); 
-       (aren = this->RenderWindow->GetRenderers()->GetNextItem()); ) {
-    vtkActorCollection* theActors = aren->GetActors();
-    theActors->InitTraversal();
-    vtkActor *ac = theActors->GetNextActor();
-    while(!(ac==NULL)) {
-      if ( ac->IsA("SALOME_Actor") ) {
-       SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac );
-       if ( anActor->hasIO() ) {
-         if ( IObject->isSame( anActor->getIO() ) ) {
-           if ( anActor->IsA("GEOM_Actor") ) {
-             // GEOM actor
-             float r,g,b;
-             anActor->GetColor(r,g,b);
-             return QColor(int(r*255),int(g*255),int(b*255));
-           }
-           else {
-             float color[3];
-             anActor->GetProperty()->GetColor(color);   
-             return QColor(int(color[0]*255),int(color[1]*255),int(color[2]*255));
-           }
-         }
-       }
-      }
-      ac = theActors->GetNextActor();
-    }
-  } 
-  return emptycolor;
+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));
 }
 
 
-
-
-bool VTKViewer_RenderWindowInteractor::isInViewer(const Handle(SALOME_InteractiveObject)& IObject)
+QColor VTKViewer_RenderWindowInteractor::GetColor(const Handle(SALOME_InteractiveObject)& theIObject) 
 {
-  vtkRenderer* aren;
-  for (this->RenderWindow->GetRenderers()->InitTraversal(); 
-       (aren = this->RenderWindow->GetRenderers()->GetNextItem()); ) {
-    vtkActorCollection* theActors = aren->GetActors();
-    theActors->InitTraversal();
-    vtkActor *ac = theActors->GetNextActor();
-    while(!(ac==NULL)) {
-      if ( ac->IsA("SALOME_Actor") ) {
-       SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac );
-       if ( anActor->hasIO() ) {
-         if ( IObject->isSame( anActor->getIO() ) ) {
-           //MESSAGE ( " VTKViewer_RenderWindowInteractor::isInViewer = TRUE" )
-           return true;
-         }
-       }
-      }
-      ac = theActors->GetNextActor();
-    }
+  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));
   }
-  //MESSAGE ( " VTKViewer_RenderWindowInteractor::isInViewer = FALSE" )
-  return false;
+  return QColor(0,0,0);
 }
 
-bool VTKViewer_RenderWindowInteractor::isVisible(const Handle(SALOME_InteractiveObject)& IObject)
+
+bool VTKViewer_RenderWindowInteractor::isInViewer(const Handle(SALOME_InteractiveObject)& theIObject)
 {
-  vtkRenderer* aren;
-  for (this->RenderWindow->GetRenderers()->InitTraversal(); 
-       (aren = this->RenderWindow->GetRenderers()->GetNextItem()); ) {
-    vtkActorCollection* theActors = aren->GetActors();
-    theActors->InitTraversal();
-    vtkActor *ac = theActors->GetNextActor();
-    while(!(ac==NULL)) {
-      if ( ac->IsA("SALOME_Actor") ) {
-       SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac );
-       if ( anActor->hasIO() ) {
-         if ( IObject->isSame( anActor->getIO() ) ) {
-           return anActor->GetVisibility();
-         }
-       }
-      }
-      ac = theActors->GetNextActor();
-    }
-  }
-  return false;
+  using namespace SALOME::VTK;
+  SALOME_Actor* anActor = 
+    Find<SALOME_Actor>(GetRenderer()->GetActors(),
+                      TIsSameIObject<SALOME_Actor>(theIObject));
+  return anActor != NULL;
 }
 
-void VTKViewer_RenderWindowInteractor::rename(const Handle(SALOME_InteractiveObject)& IObject, QString newName)
+
+bool VTKViewer_RenderWindowInteractor::isVisible(const Handle(SALOME_InteractiveObject)& theIObject)
 {
-  vtkRenderer* aren;
-  for (this->RenderWindow->GetRenderers()->InitTraversal(); 
-       (aren = this->RenderWindow->GetRenderers()->GetNextItem()); ) {
-    vtkActorCollection* theActors = aren->GetActors();
-    theActors->InitTraversal();
-    vtkActor *ac = theActors->GetNextActor();
-    while(!(ac==NULL)) {
-      if ( ac->IsA("SALOME_Actor") ) {
-       SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac );
-       if ( anActor->hasIO() ) {
-         if ( IObject->isSame( anActor->getIO() ) ) {
-           anActor->setName(strdup(newName));
-         }
-       }
-      }
-      ac = theActors->GetNextActor();
-    }
-  }  
+  using namespace SALOME::VTK;
+  SALOME_Actor* anActor = 
+    Find<SALOME_Actor>(GetRenderer()->GetActors(),
+                      TIsSameIObject<SALOME_Actor>(theIObject));
+  return anActor != NULL && anActor->GetVisibility();
+}
 
-  emit RenderWindowModified() ;
+
+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 Handle(SALOME_InteractiveObject)& IObject, 
-                                                const TColStd_MapOfInteger& MapIndex, 
-                                                VTKViewer_RenderWindowInteractor::TCreateMapperFun theFun,
-                                                vtkActor *theActor, bool hilight, bool update )
+
+//----------------------------------------------------------------------------
+bool VTKViewer_RenderWindowInteractor::highlight(const TColStd_IndexedMapOfInteger& theMapIndex,
+                                                SALOME_Actor* theMapActor, VTKViewer_Actor* theActor,
+                                                TUpdateActor theFun, bool hilight, bool update)
 {
-  if(MapIndex.Extent() == 0) return false;
-  vtkRenderer* aRen = GetRenderer();
-  vtkActorCollection* anActorColl = aRen->GetActors();
-  if ( anActorColl->IsItemPresent(theActor) != 0 ) 
-    aRen->RemoveActor(theActor);
+  if(theMapIndex.Extent() == 0) return false;
   
   if (hilight) {
-    setActorData(IObject, MapIndex, theFun, theActor);
-    aRen->AddActor(theActor);        
-    theActor->VisibilityOn();
+    setActorData(theMapIndex,theMapActor,theActor,theFun);
+    theActor->SetVisibility(true);
   }
   else {
-    theActor->VisibilityOff();
+    theActor->SetVisibility(false);
   }
 
   if(update){
@@ -1060,190 +843,90 @@ bool VTKViewer_RenderWindowInteractor::highlight(const Handle(SALOME_Interactive
   return false;
 }
   
-void VTKViewer_RenderWindowInteractor::setActorData(const Handle(SALOME_InteractiveObject)& IObject,
-                                                   const TColStd_MapOfInteger& MapIndex, 
-                                                   VTKViewer_RenderWindowInteractor::TCreateMapperFun theFun,
-                                                   vtkActor* theActor)
+void VTKViewer_RenderWindowInteractor::setActorData(const TColStd_IndexedMapOfInteger& theMapIndex,
+                                                   SALOME_Actor* theMapActor,
+                                                   VTKViewer_Actor *theActor,
+                                                   TUpdateActor theFun)
 {
-  vtkActorCollection* anActorColl = GetRenderer()->GetActors();
-  anActorColl->InitTraversal();
-  vtkActor *ac = NULL;
-  while ((ac = anActorColl->GetNextActor()) != NULL) {
-    if (ac->IsA("SALOME_Actor")){
-      SALOME_Actor* anActor = SALOME_Actor::SafeDownCast(ac);
-      if (anActor->hasIO()) {
-       if (IObject->isSame(anActor->getIO())) {
-         if (vtkPolyData* aSourcePolyData = anActor->GetPolyDataInput()) {
-           vtkPolyDataMapper* aMapper = vtkPolyDataMapper::New();
-           (*theFun)(aSourcePolyData,aMapper,MapIndex);
-           theActor->SetMapper(aMapper);   
-           aMapper->Delete();
-           break;
-         }
-       }
-      }
-    }
-  }
+  (*theFun)(theMapIndex,theMapActor,theActor);
 }
 
 
-static void CellCreateMapper(vtkPolyData *theSourcePolyData, vtkPolyDataMapper* theMapper, 
-                     const TColStd_MapOfInteger& theMapIndex)
+//----------------------------------------------------------------------------
+static void CellsUpdateActor(const TColStd_IndexedMapOfInteger& theMapIndex,
+                            SALOME_Actor* theMapActor, 
+                            VTKViewer_Actor* theActor)
 {
-  vtkPolyData* aPolyData = vtkPolyData::New();
-  aPolyData->Allocate();
-
-  vtkIdList *ptIds = vtkIdList::New(); 
-  ptIds->Allocate(theSourcePolyData->GetMaxCellSize());
-  //  vtkPolyDataMapper* aMapper = vtkPolyDataMapper::New();
-  aPolyData->SetPoints(theSourcePolyData->GetPoints());
-  TColStd_MapIteratorOfMapOfInteger ite(theMapIndex);
-  int aNbOfParts = theSourcePolyData->GetNumberOfCells();
-  for(; ite.More(); ite.Next()){
-    int aPartId = ite.Key();
-    if(0 > aPartId || aPartId >= aNbOfParts) break;
-    theSourcePolyData->GetCellPoints(aPartId,ptIds);
-    vtkCell* aCell = theSourcePolyData->GetCell(aPartId);
-    aPolyData->InsertNextCell(aCell->GetCellType(),ptIds);
-    for (int i = 0, iEnd = aCell->GetNumberOfEdges(); i < iEnd; i++){
-      vtkCell* anEdgeCell = aCell->GetEdge(i);
-      aPolyData->InsertNextCell(VTK_LINE,anEdgeCell->GetPointIds());
-    }
-  }
-  ptIds->Delete();
-  theMapper->SetInput(aPolyData);  
-  aPolyData->Delete();
+  theActor->MapCells(theMapActor,theMapIndex);
 }
   
-bool VTKViewer_RenderWindowInteractor::highlightCell(const Handle(SALOME_InteractiveObject)& IObject, 
+bool VTKViewer_RenderWindowInteractor::highlightCell(const TColStd_IndexedMapOfInteger& theMapIndex,
+                                                    SALOME_Actor* theMapActor, 
                                                     bool hilight, 
-                                                    const TColStd_MapOfInteger& MapIndex, 
-                                                    bool update )
-{
-  return highlight(IObject,MapIndex,&CellCreateMapper,Cell_Actor,hilight,update);
-}
-  
-void VTKViewer_RenderWindowInteractor::setCellData(const Handle(SALOME_InteractiveObject)& IObject, 
-                                                  const int& theIndex, vtkActor* theActor )
+                                                    bool update)
 {
-  TColStd_MapOfInteger MapIndex; MapIndex.Add(theIndex);
-  return setActorData(IObject,MapIndex,&CellCreateMapper,theActor);
+  return highlight(theMapIndex,theMapActor,myCellActor,&CellsUpdateActor,hilight,update);
 }
   
-void VTKViewer_RenderWindowInteractor::setCellData(const Handle(SALOME_InteractiveObject)& IObject, 
-                                                  const std::vector<int>& theIndexes, vtkActor* theActor )
+void VTKViewer_RenderWindowInteractor::setCellData(const int& theIndex, 
+                                                  SALOME_Actor* theMapActor,
+                                                  VTKViewer_Actor* theActor)
 {
-  TColStd_MapOfInteger MapIndex; 
-  std::vector<int>::const_iterator it;
-  for (it = theIndexes.begin(); it != theIndexes.end(); ++it)
-    MapIndex.Add(*it);
-  return setActorData(IObject,MapIndex,&CellCreateMapper,theActor);
+  TColStd_IndexedMapOfInteger MapIndex; 
+  MapIndex.Add(theIndex);
+  theActor->MapCells(theMapActor,MapIndex);
 }
 
 
-static void PointCreateMapper(vtkPolyData *theSourcePolyData, vtkPolyDataMapper* theMapper, 
-                      const TColStd_MapOfInteger& theMapIndex)
+//----------------------------------------------------------------------------
+static void PointsUpdateActor(const TColStd_IndexedMapOfInteger& theMapIndex,
+                             SALOME_Actor* theMapActor, 
+                             VTKViewer_Actor* theActor)
 {
-  vtkPolyData* aPolyData = vtkPolyData::New();
-  aPolyData->Allocate();
-
-  vtkPoints *aPoints = vtkPoints::New();
-  vtkMaskPoints* aMaskPoints = vtkMaskPoints::New();
-  TColStd_MapIteratorOfMapOfInteger ite(theMapIndex);
-  aPoints->SetNumberOfPoints(theMapIndex.Extent());
-  int aNbOfParts = theSourcePolyData->GetNumberOfPoints();
-  for(int i = 0; ite.More(); ite.Next(),i++){
-    int aPartId = ite.Key();
-    if(0 > aPartId || aPartId >= aNbOfParts) break;
-    aPoints->SetPoint(i,theSourcePolyData->GetPoint(aPartId));
-  }
-  aPolyData->SetPoints(aPoints);
-  aPoints->Delete();
-  aMaskPoints->SetInput(aPolyData);
-  aMaskPoints->SetGenerateVertices(1);
-  aMaskPoints->SetOnRatio(1);
-  theMapper->SetInput(aMaskPoints->GetOutput());  
-  aMaskPoints->Delete();
+  theActor->MapPoints(theMapActor,theMapIndex);
 }
   
-bool VTKViewer_RenderWindowInteractor::highlightPoint(const Handle(SALOME_InteractiveObject)& IObject, 
-                                                     bool hilight, const TColStd_MapOfInteger& MapIndex, 
+bool VTKViewer_RenderWindowInteractor::highlightPoint(const TColStd_IndexedMapOfInteger& theMapIndex,
+                                                     SALOME_Actor* theMapActor, 
+                                                     bool hilight, 
                                                      bool update)
 {
-  return highlight(IObject,MapIndex,&PointCreateMapper,Point_Actor,hilight,update);
+  return highlight(theMapIndex,theMapActor,myPointActor,&PointsUpdateActor,hilight,update);
 }
   
-  
-void VTKViewer_RenderWindowInteractor::setPointData(const Handle(SALOME_InteractiveObject)& IObject, 
-                                                   const int& theIndex, vtkActor* theActor )
+void VTKViewer_RenderWindowInteractor::setPointData(const int& theIndex, 
+                                                   SALOME_Actor* theMapActor,
+                                                   VTKViewer_Actor* theActor)
 {
-  TColStd_MapOfInteger MapIndex; MapIndex.Add(theIndex);
-  return setActorData(IObject,MapIndex,&PointCreateMapper,theActor);
+  TColStd_IndexedMapOfInteger MapIndex; 
+  MapIndex.Add(theIndex);
+  theActor->MapPoints(theMapActor,MapIndex);
 }
 
   
-static void EdgeCreateMapper(vtkPolyData *theSourcePolyData, vtkPolyDataMapper* theMapper, 
-                     const TColStd_MapOfInteger& theMapIndex)
+//----------------------------------------------------------------------------
+static void EdgesUpdateActor(const TColStd_IndexedMapOfInteger& theMapIndex,
+                            SALOME_Actor* theMapActor, 
+                            VTKViewer_Actor* theActor)
 {
-  vtkPolyData* aPolyData = vtkPolyData::New();
-  aPolyData->Allocate();
-
-  vtkIdList *ptIds = vtkIdList::New(); 
-  ptIds->Allocate(theSourcePolyData->GetMaxCellSize());
-  vtkPolyDataMapper* aMapper = vtkPolyDataMapper::New();
-  aPolyData->SetPoints(theSourcePolyData->GetPoints());
-  int aCellId = -1, aCellCounter = 0;
-  for(TColStd_MapIteratorOfMapOfInteger ite(theMapIndex); ite.More(); ite.Next()){
-    if(ite.Key() > 0){
-      aCellId = ite.Key();
-      aCellCounter++;
-    }
-  }
-  if(aCellCounter == 1){
-    vtkCell* aCell = theSourcePolyData->GetCell(aCellId);
-    if(aCell->GetCellType() <= VTK_LINE){
-      aPolyData->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds());
-    }else{
-      TColStd_MapIteratorOfMapOfInteger ite(theMapIndex);
-      int aNbOfParts = aCell->GetNumberOfEdges();
-      for(; ite.More(); ite.Next()){
-       if(ite.Key() < 0){
-         int aPartId = -ite.Key()-1;
-         if(0 > aPartId || aPartId >= aNbOfParts) break;
-         vtkCell* anEdgeCell = aCell->GetEdge(aPartId);
-         aPolyData->InsertNextCell(VTK_LINE,anEdgeCell->GetPointIds());
-       }
-      }
-    }
-  }else{
-    int aNbOfParts = theSourcePolyData->GetNumberOfCells();
-    for(TColStd_MapIteratorOfMapOfInteger ite(theMapIndex); ite.More(); ite.Next()){
-      if(ite.Key() > 0){
-       int aPartId = ite.Key();
-       if(0 > aPartId || aPartId >= aNbOfParts) break;
-       vtkCell* aCell = theSourcePolyData->GetCell(aPartId);
-       aPolyData->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds());
-      }
-    }
-  }
-  ptIds->Delete();
-  theMapper->SetInput(aPolyData);  
-  aPolyData->Delete();
+  theActor->MapEdge(theMapActor,theMapIndex);
 }
   
-
-bool VTKViewer_RenderWindowInteractor::highlightEdge( const Handle(SALOME_InteractiveObject)& IObject, 
-                                                     bool hilight, 
-                                                     const TColStd_MapOfInteger& MapIndex, 
-                                                     bool update )
+bool VTKViewer_RenderWindowInteractor::highlightEdge(const TColStd_IndexedMapOfInteger& theMapIndex,
+                                                    SALOME_Actor* theMapActor, 
+                                                    bool hilight, 
+                                                    bool update)
 {
-  return highlight(IObject,MapIndex,&EdgeCreateMapper,Edge_Actor,hilight,update);
+  return highlight(theMapIndex,theMapActor,myEdgeActor,&EdgesUpdateActor,hilight,update);
 }
   
-void VTKViewer_RenderWindowInteractor::setEdgeData(const Handle(SALOME_InteractiveObject)& IObject, 
-                                                  const int& theCellIndex, const int& theEdgeIndex, 
-                                                  vtkActor* theActor )
+void VTKViewer_RenderWindowInteractor::setEdgeData(const int& theCellIndex, 
+                                                  SALOME_Actor* theMapActor,
+                                                  const int& theEdgeIndex, 
+                                                  VTKViewer_Actor* theActor )
 {
-  TColStd_MapOfInteger MapIndex; MapIndex.Add(theCellIndex); MapIndex.Add(theEdgeIndex);
-  return setActorData(IObject,MapIndex,&EdgeCreateMapper,theActor);
+  TColStd_IndexedMapOfInteger MapIndex; 
+  MapIndex.Add(theCellIndex); 
+  MapIndex.Add(theEdgeIndex);
+  theActor->MapEdge(theMapActor,MapIndex);
 }
index 3a22e676aa2093cbfa04b50c2be6bfaafcc58723..eb4fdb004a6eb78c46c16035b3d4fe0ef5d29f1f 100644 (file)
@@ -33,7 +33,6 @@
 // now we define the C++ class
 
 #include "SALOME_InteractiveObject.hxx"
-#include "SALOME_Actor.h"
 #include "SALOME_Selection.h"
 
 // QT Includes
 #include <TColStd_MapOfInteger.hxx>
 #include <TColStd_MapIteratorOfMapOfInteger.hxx>
 
-class vtkPolyData;
-class vtkPolyDataMapper;
+class vtkPicker;
+class vtkCellPicker;
+class vtkPointPicker;
+class vtkActorCollection;
 
+class SALOME_Actor;
+class VTKViewer_Actor;
+class VTKViewer_ViewFrame;
 class VTKViewer_RenderWindow;
 class VTKViewer_InteractorStyleSALOME;
 
@@ -64,7 +68,8 @@ class VTKViewer_InteractorStyleSALOME;
 class VTK_EXPORT VTKViewer_RenderWindowInteractor : 
   public QObject, public vtkRenderWindowInteractor
 {
-  Q_OBJECT 
+  Q_OBJECT ;
+  friend class VTKViewer_ViewFrame;
 public:
 
   static VTKViewer_RenderWindowInteractor *New() ; 
@@ -129,15 +134,23 @@ public:
   //virtual void EndPickCallback();
   
   /* Selection Management */
-  bool highlightCell(const Handle(SALOME_InteractiveObject)& IObject, bool hilight, 
-                    const TColStd_MapOfInteger& MapIndex, bool immediatly = true );
-  bool highlightEdge(const Handle(SALOME_InteractiveObject)& IObject, bool hilight, 
-                    const TColStd_MapOfInteger& MapIndex, bool immediatly = true ); //NB
-  bool highlightPoint(const Handle(SALOME_InteractiveObject)& IObject, bool hilight, 
-                     const TColStd_MapOfInteger& MapIndex, bool immediatly = true );
+  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);
@@ -147,22 +160,12 @@ public:
                        const double& theBlue = 0, const int& theWidth = 5);
   void SetSelectionTolerance(const double& theTolNodes = 0.025, const double& theTolCell = 0.001);
 
-  void setCellData(const Handle(SALOME_InteractiveObject)& IObject,
-                  const int& theIndex, vtkActor* theActor );
-  void setCellData(const Handle(SALOME_InteractiveObject)& IObject,
-                  const std::vector<int>& theIndexes, vtkActor* theActor );
-  void setEdgeData(const Handle(SALOME_InteractiveObject)& IObject,
-                  const int& theCellIndex, const int& theEdgeIndex, 
-                  vtkActor* theActor ); //NB
-  void setPointData(const Handle(SALOME_InteractiveObject)& IObject, 
-                   const int& theIndex, vtkActor* theActor );
-
   // Displaymode management
   int GetDisplayMode();
   void SetDisplayMode(int);
 
   // Switch representation wireframe/shading
-  void SwitchRepresentation(const Handle(SALOME_InteractiveObject)& IObject, bool update = true);
+  void SetDisplayMode(const Handle(SALOME_InteractiveObject)& IObject, int theMode);
 
   // Change all actors to wireframe or surface
   void ChangeRepresentationToWireframe();
@@ -194,12 +197,24 @@ public:
 
   vtkRenderer* GetRenderer();
 
-  QWidget* getGUIWindow() {return myGUIWindow;}
-  void setGUIWindow(QWidget* theWin) {myGUIWindow = theWin;}
+  void setGUIWindow(QWidget* theWindow);
+
+  void setViewFrame(VTKViewer_ViewFrame* ViewFrame);
   
-  typedef void (*TCreateMapperFun)(vtkPolyData *theSourcePolyData, 
-                                  vtkPolyDataMapper* theMapper, 
-                                  const TColStd_MapOfInteger& theMapIndex);
+  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();
@@ -207,25 +222,29 @@ public:
 
   VTKViewer_InteractorStyleSALOME* myInteractorStyle;
 
-  bool highlight(const Handle(SALOME_InteractiveObject)& IObject, 
-                const TColStd_MapOfInteger& MapIndex, TCreateMapperFun theFun,
-                vtkActor *theActor, bool hilight, bool update );
-  void setActorData(const Handle(SALOME_InteractiveObject)& IObject, 
-                   const TColStd_MapOfInteger& MapIndex, TCreateMapperFun theFun,
-                   vtkActor *theActor );
-
+  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 ;
 
-  //CAI: Display mode
-  int displaymode;
+  int myDisplayMode;
 
   //NRI: Selection mode
-  Selection_Mode selectionmode;
-  vtkActor* Point_Actor;
-  vtkActor* Edge_Actor; //NB
-  vtkActor* Cell_Actor;
+  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];
@@ -259,9 +278,10 @@ public:
   void RenderWindowModified() ;
 
  private:
-  QWidget*     myGUIWindow;  
-  double       myTolNodes;
-  double       myTolItems;
+  VTKViewer_ViewFrame* myViewFrame;  
+  QWidget* myGUIWindow;  
+  double myTolNodes;
+  double myTolItems;
 };
 
 #endif
index 9a278d4a6b764c7419120f4336599f98dec6f58c..17b56a422ded42d8021efa15cccfba26b322bb1f 100644 (file)
@@ -51,22 +51,6 @@ using namespace std;
 
 //==============================================================================
 
-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;
-};
-
 vtkStandardNewMacro(VTKViewer_UnScaledActor);
 
 VTKViewer_UnScaledActor::VTKViewer_UnScaledActor(){}
@@ -99,31 +83,6 @@ void VTKViewer_UnScaledActor::SetSize(int theSize){
 
 //==============================================================================
 
-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;
-};
-
 vtkStandardNewMacro(VTKViewer_LineActor);
 
 vtkCxxSetObjectMacro(VTKViewer_LineActor,LabelActor,VTKViewer_UnScaledActor);
@@ -142,69 +101,15 @@ void VTKViewer_LineActor::Render(vtkRenderer *theRenderer){
 }
 
 //==============================================================================
-
 // 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){
-    //Order of the calls are important
-    theRenderer->AddActor(myLineActor);
-    theRenderer->AddActor(myLabelActor);
-    theRenderer->AddActor(myArrowActor);
-  }
-
-  virtual void SetVisibility(VTKViewer_Trihedron::TVisibility theVis);
-  virtual VTKViewer_Trihedron::TVisibility GetVisibility() { 
-    return myVisibility;
-  }
-
-  virtual void SetCamera(vtkCamera* theCamera){
-    myLabelActor->SetCamera(theCamera);
-  }
-
-  virtual void SetProperty(vtkProperty* theProperty){
-    myLabelActor->SetProperty(theProperty);
-    myArrowActor->SetProperty(theProperty);
-    myLineActor->SetProperty(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;
-};
 
 VTKViewer_Axis::VTKViewer_Axis(){
+  
   // Initialize the Line pipe-line representation
   myLineSource = vtkLineSource::New();
-  myLineSource->SetPoint1(0.0,0.0,0.0);
+  myLineSource->SetPoint1( 0, 0, 0 );
 
   myMapper[0] = vtkPolyDataMapper::New();
   myMapper[0]->SetInput(myLineSource->GetOutput());
@@ -268,8 +173,8 @@ VTKViewer_Axis::~VTKViewer_Axis(){
   // Destroy of the Arrow pipe-line representation
   myLineActor->Delete();
 
-  myMapper[2]->RemoveAllInputs();
-  myMapper[2]->Delete();
+  myMapper[0]->RemoveAllInputs();
+  myMapper[0]->Delete();
 
   myLineSource->Delete();
 }
@@ -305,6 +210,26 @@ void VTKViewer_Axis::SetSize(float theSize){
   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:
index d53a602c32a8b1d23c54f1e87bb8644cdd07e184..169e4734539dc6f27e006646b007422b9d45bd4d 100644 (file)
 #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:
@@ -64,4 +118,43 @@ protected:
   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
index b68158db7374a2b735edf84261a5794d334119d9..f16a93f4cd30b8fba296731c2cd2df49c3d12164 100644 (file)
 #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"
 
 // VTK Includes
 #include <vtkActor.h>
+#include <vtkCamera.h>
 #include <vtkRenderer.h>
 #include <vtkTransform.h>
+#include <vtkActorCollection.h>
+
+#include <TColStd_IndexedMapOfInteger.hxx>
 
 using namespace std;
 
@@ -95,15 +104,19 @@ void VTKViewer_ViewFrame::InitialSetup() {
   
   // Create an interactor.
   m_RWInteractor = VTKViewer_RenderWindowInteractor::New();
-  m_RWInteractor->setGUIWindow(m_RW);
   m_RWInteractor->SetRenderWindow(m_RW->getRenderWindow());
 
   VTKViewer_InteractorStyleSALOME* RWS = VTKViewer_InteractorStyleSALOME::New();
-  RWS->setGUIWindow(m_RW);
   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);
 
@@ -112,18 +125,18 @@ void VTKViewer_ViewFrame::InitialSetup() {
 }
 
 VTKViewer_ViewFrame::~VTKViewer_ViewFrame() {
-  m_Transform->Delete() ;
   // 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();
-  MESSAGE("VTKViewer_ViewFrame::~VTKViewer_ViewFrame()");
+  INFOS("VTKViewer_ViewFrame::~VTKViewer_ViewFrame()");
 }
 
 /*!
@@ -137,43 +150,87 @@ bool VTKViewer_ViewFrame::isTrihedronDisplayed(){
   return m_Triedron->GetVisibility() == VTKViewer_Trihedron::eOn;
 }
 
-void VTKViewer_ViewFrame::onAdjustTrihedron(){   
-  if(!isTrihedronDisplayed()) 
+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){
-    // calculating diagonal of visible props of the renderer
-    float bnd[6];
-    m_Triedron->VisibilityOff();
-    ::ComputeVisiblePropBounds(m_Renderer,bnd);
-    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;
-    float aSize = m_Triedron->GetSize();
-    float aNewSize = aLength*aSizeInPercents/100.0;
+
+  int aVisibleNum = m_Triedron->GetVisibleActorCount( m_Renderer );
+  if ( aVisibleNum || forcedUpdate )
+  {
     // if the new trihedron size have sufficient difference, then apply the value
-    if(fabs(aNewSize-aSize) > aSize*EPS_SIZE || fabs(aNewSize-aSize) > aNewSize*EPS_SIZE){
-      m_Triedron->SetSize(aNewSize);
+    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
 */
@@ -214,7 +271,7 @@ void VTKViewer_ViewFrame::onViewBottom(){
 */
 void VTKViewer_ViewFrame::onViewLeft(){
   vtkCamera* camera = m_Renderer->GetActiveCamera(); 
-  camera->SetPosition(0,1,0);
+  camera->SetPosition(0,-1,0);
   camera->SetViewUp(0,0,1);
   camera->SetFocalPoint(0,0,0);
   onViewFitAll();
@@ -225,7 +282,7 @@ void VTKViewer_ViewFrame::onViewLeft(){
 */
 void VTKViewer_ViewFrame::onViewRight(){
   vtkCamera* camera = m_Renderer->GetActiveCamera();
-  camera->SetPosition(0,-1,0);
+  camera->SetPosition(0,1,0);
   camera->SetViewUp(0,0,1);
   camera->SetFocalPoint(0,0,0);
   onViewFitAll();
@@ -258,17 +315,6 @@ void VTKViewer_ViewFrame::onViewFront(){
 */
 void VTKViewer_ViewFrame::onViewFitAll(){
   m_RWInteractor->GetInteractorStyleSALOME()->ViewFitAll();
-//   int aTriedronWasVisible = isTrihedronDisplayed();
-//   if(m_Triedron->GetVisibleActorCount(m_Renderer)){
-//     m_Triedron->VisibilityOff();
-//     ::ResetCamera(m_Renderer);
-//   }else{
-//     m_Triedron->SetVisibility(VTKViewer_Trihedron::eOnlyLineOn);
-//     ::ResetCamera(m_Renderer,true);
-//   }
-//   if(aTriedronWasVisible) m_Triedron->VisibilityOn();
-//   else m_Triedron->VisibilityOff();
-
   Repaint();
 }
 
@@ -372,31 +418,30 @@ void VTKViewer_ViewFrame::highlight( const Handle(SALOME_InteractiveObject)& IOb
   SALOME_Selection* Sel = SALOME_Selection::Selection( ActiveStudy->getSelection() );
   m_RWInteractor->highlight(IObject, highlight, update);
 
-  switch (Sel->SelectionMode()) {
-  case NodeSelection:
-    if ( Sel->HasIndex( IObject ) ) {
-      TColStd_MapOfInteger MapIndex;
-      Sel->GetIndex( IObject, MapIndex );
-      m_RWInteractor->highlightPoint(IObject, highlight, MapIndex, update);
-    }
-    break;
-  case EdgeOfCellSelection:
-    if ( Sel->HasIndex( IObject ) ) {
-      TColStd_MapOfInteger MapIndex;
-      Sel->GetIndex( IObject, MapIndex );
-      m_RWInteractor->highlightEdge(IObject, highlight, MapIndex, update);
-    }
-    break;
-  case CellSelection:
-  case EdgeSelection:
-  case FaceSelection:
-  case VolumeSelection:
-    if ( Sel->HasIndex( IObject ) ) {
-      TColStd_MapOfInteger MapIndex;
-      Sel->GetIndex( IObject, MapIndex );
-      m_RWInteractor->highlightCell(IObject, highlight, MapIndex, 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;
+      }
     }
-    break;
+  }else{
+    m_RWInteractor->unHighlightSubSelection();
   }
 }
 
@@ -415,170 +460,88 @@ void VTKViewer_ViewFrame::setPopupServer( QAD_Application* App )
   m_RW->setPopupServer( App );
 }
 
-void VTKViewer_ViewFrame::undo(SALOMEDS::Study_var aStudy,
-                              const char* StudyFrameEntry)
+/* selection */
+Handle(SALOME_InteractiveObject) VTKViewer_ViewFrame::FindIObject(const char* theEntry)
 {
-  vtkActorCollection* theActors = m_Renderer->GetActors();
-  theActors->InitTraversal();
-  vtkActor *ac = theActors->GetNextActor();
-  while(!(ac==NULL)) {
-    if ( ac->IsA("SALOME_Actor") ) {
-      SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac );
-      if ( anActor->hasIO() ) {
-       Handle(SALOME_InteractiveObject) IO = anActor->getIO();
-       if ( IO->hasEntry() ) { 
-         /*if (!QAD_ViewFrame::isInViewer(aStudy, IO->getEntry(), StudyFrameEntry)) {
-           m_RWInteractor->Erase(IO);
-           }*/
-       }
-      }
-    }
-    ac = theActors->GetNextActor();
-  }
+  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)();
 }
 
-void VTKViewer_ViewFrame::redo(SALOMEDS::Study_var aStudy,
-                              const char* StudyFrameEntry)
+/* display */          
+void VTKViewer_ViewFrame::Display(const Handle(SALOME_InteractiveObject)& theIObject, bool update)
 {
-  SALOMEDS::SObject_var RefSO;
-  SALOMEDS::SObject_var SO = aStudy->FindObjectID( StudyFrameEntry );
-  SALOMEDS::ChildIterator_var it = aStudy->NewChildIterator(SO);
-  for (; it->More();it->Next()){
-    SALOMEDS::SObject_var CSO= it->Value();
-    if (CSO->ReferencedObject(RefSO)) {
-      vtkActorCollection* theActors = m_Renderer->GetActors();
-      theActors->InitTraversal();
-      vtkActor *ac = theActors->GetNextActor();
-      while(!(ac==NULL)) {
-       if ( ac->IsA("SALOME_Actor") ) {
-         SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac );
-         if ( anActor->hasIO() ) {
-           Handle(SALOME_InteractiveObject) IO = anActor->getIO();
-           if ( IO->hasEntry() ) { 
-             /*if ( strcmp(IO->getEntry(),RefSO->GetID()) == 0 )
-               m_RWInteractor->Display(IO);*/
-           }
-         }
-       }
-       ac = theActors->GetNextActor();
-      }
-    }
-  }
+  QAD_Study* aStudy = QAD_Application::getDesktop()->getActiveStudy();
+  SALOME_Selection* aSel = SALOME_Selection::Selection(aStudy->getSelection());
+
+  m_RWInteractor->Display(theIObject,false);
+  aSel->AddIObject(theIObject,false);
+
+  if(update)
+    Repaint();
 }
 
 
-/* selection */
-Handle(SALOME_InteractiveObject) VTKViewer_ViewFrame::FindIObject(const char* Entry)
-{
-  Handle(SALOME_InteractiveObject) IO;
-  vtkActorCollection* theActors = m_Renderer->GetActors();
-  theActors->InitTraversal();
-  vtkActor *ac = theActors->GetNextActor();
-  while(!(ac==NULL)) {
-    if ( ac->IsA("SALOME_Actor") ) {
-      SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac );
-      if ( anActor->hasIO() ) {
-       IO = anActor->getIO();
-       if ( IO->hasEntry() ) {
-         if ( strcmp( IO->getEntry(), Entry ) == 0 ) {
-           return IO;
-         }
-       }
-      }
-    }
-    ac = theActors->GetNextActor();
+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);
   }
-  return IO;
-}
+};
 
-/* display */          
-void VTKViewer_ViewFrame::Display(const Handle(SALOME_InteractiveObject)& IObject, bool update)
+void VTKViewer_ViewFrame::DisplayOnly(const Handle(SALOME_InteractiveObject)& theIObject)
 {
-  QAD_Study* myStudy = QAD_Application::getDesktop()->getActiveStudy();
-  SALOME_Selection* Sel
-    = SALOME_Selection::Selection( myStudy->getSelection() );
-
-  vtkActorCollection* theActors = m_Renderer->GetActors();
-  theActors->InitTraversal();
-  vtkActor *ac = theActors->GetNextActor();
-  while(!(ac==NULL))
-    {
-      if ( ac->IsA("SALOME_Actor") )
-       {
-         SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac );
-         if ( anActor->hasIO() ) 
-           {
-             Handle(SALOME_InteractiveObject) IO = anActor->getIO();
-             if ( IO->isSame(IObject) )
-               {
-                 m_RWInteractor->Display(IO, false);
-                 Sel->AddIObject(IO, false);
-                 break;
-               }
-           }
-       }
-      ac = theActors->GetNextActor();
-    }
-  if (update)
-    Repaint();
-}
+  QAD_Study* aStudy = QAD_Application::getDesktop()->getActiveStudy();
+  SALOME_Selection* aSel = SALOME_Selection::Selection(aStudy->getSelection());
 
+  aSel->ClearIObjects();
+  m_RWInteractor->EraseAll();
+
+  using namespace SALOME::VTK;
+  ForEachIf<SALOME_Actor>(getRenderer()->GetActors(),
+                         TIsSameIObject<SALOME_Actor>(theIObject),
+                         TDisplayAction(aSel,theIObject));
 
-void VTKViewer_ViewFrame::DisplayOnly(const Handle(SALOME_InteractiveObject)& IObject)
-{
-  QAD_Study* myStudy = QAD_Application::getDesktop()->getActiveStudy();
-  SALOME_Selection* Sel
-    = SALOME_Selection::Selection( myStudy->getSelection() );
-
-  vtkActorCollection* theActors = m_Renderer->GetActors();
-  theActors->InitTraversal();
-  vtkActor *ac = theActors->GetNextActor();
-  while(!(ac==NULL)) {
-    if ( ac->IsA("SALOME_Actor") ) {
-      SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac );
-      if ( anActor->hasIO() ) {
-       Handle(SALOME_InteractiveObject) IO = anActor->getIO();
-       if ( !IO->isSame(IObject) ) {
-         m_RWInteractor->Erase(IO, false);
-         Sel->RemoveIObject(IO, false);
-       } else {
-         anActor->SetVisibility(true);
-         Sel->AddIObject(IO, false);
-       }
-      }
-    }
-    ac = theActors->GetNextActor();
-  }
   Repaint();
 }
 
-void VTKViewer_ViewFrame::Erase(const Handle(SALOME_InteractiveObject)& IObject, bool update)
+
+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* myStudy = QAD_Application::getDesktop()->getActiveStudy();
-  SALOME_Selection* Sel
-    = SALOME_Selection::Selection( myStudy->getSelection() );
-
-  vtkActorCollection* theActors = m_Renderer->GetActors();
-  theActors->InitTraversal();
-  vtkActor *ac = theActors->GetNextActor();
-  while(!(ac==NULL)) 
-    {
-      if ( ac->IsA("SALOME_Actor") )
-       {
-         SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac );
-         if ( anActor->hasIO() )
-           {
-             Handle(SALOME_InteractiveObject) IO = anActor->getIO();
-             if ( IO->isSame( IObject ) ) {
-               m_RWInteractor->Erase(IO, false);
-               Sel->RemoveIObject(IO, false);
-               break;
-             }
-           }
-       }
-      ac = theActors->GetNextActor();
-    }
-  if (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));
+
+  if(update)
     Repaint();
 }
 
@@ -611,14 +574,132 @@ void VTKViewer_ViewFrame::SetScale(double theScale[3]){
   Repaint();
 }
 
-void VTKViewer_ViewFrame::AddActor( SALOME_Actor* theActor, bool update /*=false*/ ){
-  theActor->SetVisibility(true);
+void VTKViewer_ViewFrame::InsertActor( SALOME_Actor* theActor, bool theMoveInternalActors ){
   theActor->AddToRender(m_Renderer);
   theActor->SetTransform(m_Transform);
-  if(update) Repaint();
+  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 update /*=false*/ ){
+void VTKViewer_ViewFrame::RemoveActor( SALOME_Actor* theActor, bool theUpdate /*=false*/ ){
   theActor->RemoveFromRender(m_Renderer);
-  if(update) Repaint();
+  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 );
+      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;
+
+  actors->InitTraversal();
+  vtkActor* actor;
+  while( ( actor = actors->GetNextActor() ) ) {
+    SALOME_Actor* salomeActor = SALOME_Actor::SafeDownCast( actor );
+    if ( salomeActor ) {
+      // just erase the object
+      m_RWInteractor->Erase( salomeActor, forced );
+    }
+  }
+}
+  
+//==========================================================
+/*!
+ *  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() );
 }
index 5547699faffb714c50d91cad05837a62dc88e0e6..7f67e444de6619c25eea69121e1d2a69db2efa9b 100644 (file)
 #include "QAD.h"
 #include "QAD_ViewFrame.h"
 
-#include "VTKViewer_RenderWindowInteractor.h"
-#include "VTKViewer_RenderWindow.h"
-
-// VTK Includes
 class vtkRenderer;
-class vtkTransform;
+
+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;
@@ -72,13 +74,6 @@ class QAD_EXPORT VTKViewer_ViewFrame : public QAD_ViewFrame{
   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);
   
@@ -91,12 +86,22 @@ class QAD_EXPORT VTKViewer_ViewFrame : public QAD_ViewFrame{
   void           Repaint(bool theUpdateTrihedron);
   void           Repaint() { Repaint(true); }
 
+  /* 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();
@@ -115,16 +120,20 @@ class QAD_EXPORT VTKViewer_ViewFrame : public QAD_ViewFrame{
   void           onAdjustTrihedron();
  
  private:
-  double                        m_ViewUp[3];
-  double                        m_ViewNormal[3];
-  
-  void                          InitialSetup();
+  void InitialSetup();
 
-  vtkRenderer*                      m_Renderer;
-  VTKViewer_RenderWindow*           m_RW;
+  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;
+  void InsertActor(SALOME_Actor* theActor, bool theMoveInternalActors = false);
+  void MoveActor(SALOME_Actor* theActor);
+
+  VTKViewer_Trihedron* m_Triedron;  
+  SALOME_Transform* m_Transform;
 };
 #endif