]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
SALOME PAL V1_4_1
authorsmh <smh@opencascade.com>
Fri, 2 Apr 2004 13:11:41 +0000 (13:11 +0000)
committersmh <smh@opencascade.com>
Fri, 2 Apr 2004 13:11:41 +0000 (13:11 +0000)
196 files changed:
bin/VERSION
bin/killSalome.py
bin/orbmodule.py
bin/runNS.sh
bin/runSalome
bin/runSalome.py
doc/Makefile.in
idl/Makefile.in
idl/SALOMEDS.idl
idl/SALOMEDS_Attributes.idl
idl/SALOME_Component.idl
idl/SALOME_ModuleCatalog.idl
salome_adm/Makefile.in
salome_adm/unix/config_files/check_Kernel.m4
salome_adm/unix/config_files/check_cas.m4
salome_adm/unix/make_commence.in
salome_adm/unix/make_conclude.in
salome_adm/unix/make_module.in
src/Container/Container_i.cxx
src/Container/SALOME_Container.cxx
src/Container/SALOME_ContainerPy.py
src/Container/SALOME_Container_i.hxx
src/DataTypeCatalog/SALOME_DataTypeCatalog_impl.cxx
src/GenericObj/SALOME_GenericObj_i.cc
src/HDFPersist/HDFconvert.hxx
src/HDFPersist/HDFexception.hxx
src/LifeCycleCORBA/LifeCycleCORBA.py
src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx
src/Loader/InquireServersQThread.cxx
src/Logger/SALOME_Trace.py
src/MPIContainer/MPIContainer_i.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.hxx
src/ModuleCatalog/SALOME_ModuleCatalog_Server.cxx
src/ModuleCatalog/SALOME_ModuleCatalog_impl.cxx
src/ModuleGenerator/IDLparser.py
src/ModuleGenerator/README
src/NamingService/SALOME_NamingService.cxx
src/OBJECT/SALOME_Actor.cxx
src/OBJECT/SALOME_Actor.h
src/OCCViewer/OCCViewer_ViewFrame.h
src/OCCViewer/OCCViewer_ViewPort3d.cxx
src/Plot2d/Plot2d_ViewFrame.cxx
src/Plot2d/Plot2d_ViewFrame.h
src/Registry/RegistryService.hxx
src/RegistryDisplay/RegWidget.cxx
src/RessourcesCatalog/SALOME_RessourcesCatalog_Server.cxx
src/RessourcesCatalog/SALOME_RessourcesCatalog_impl.cxx
src/SALOMEDS/Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx
src/SALOMEDS/Handle_SALOMEDS_LocalIDAttribute.hxx
src/SALOMEDS/Handle_SALOMEDS_TargetAttribute.hxx
src/SALOMEDS/SALOMEDS_AttributeComment_i.cxx
src/SALOMEDS/SALOMEDS_AttributeComment_i.hxx
src/SALOMEDS/SALOMEDS_AttributeDrawable_i.cxx
src/SALOMEDS/SALOMEDS_AttributeDrawable_i.hxx
src/SALOMEDS/SALOMEDS_AttributeExpandable_i.cxx
src/SALOMEDS/SALOMEDS_AttributeExpandable_i.hxx
src/SALOMEDS/SALOMEDS_AttributeInteger_i.cxx
src/SALOMEDS/SALOMEDS_AttributeInteger_i.hxx
src/SALOMEDS/SALOMEDS_AttributeLocalID_i.cxx
src/SALOMEDS/SALOMEDS_AttributeLocalID_i.hxx
src/SALOMEDS/SALOMEDS_AttributeName_i.cxx
src/SALOMEDS/SALOMEDS_AttributeName_i.hxx
src/SALOMEDS/SALOMEDS_AttributeOpened_i.cxx
src/SALOMEDS/SALOMEDS_AttributeOpened_i.hxx
src/SALOMEDS/SALOMEDS_AttributePersistentRef_i.cxx
src/SALOMEDS/SALOMEDS_AttributePersistentRef_i.hxx
src/SALOMEDS/SALOMEDS_AttributePixMap_i.cxx
src/SALOMEDS/SALOMEDS_AttributePixMap_i.hxx
src/SALOMEDS/SALOMEDS_AttributePythonObject_i.cxx
src/SALOMEDS/SALOMEDS_AttributePythonObject_i.hxx
src/SALOMEDS/SALOMEDS_AttributeReal_i.cxx
src/SALOMEDS/SALOMEDS_AttributeReal_i.hxx
src/SALOMEDS/SALOMEDS_AttributeSelectable_i.cxx
src/SALOMEDS/SALOMEDS_AttributeSelectable_i.hxx
src/SALOMEDS/SALOMEDS_AttributeSequenceOfInteger_i.cxx
src/SALOMEDS/SALOMEDS_AttributeSequenceOfInteger_i.hxx
src/SALOMEDS/SALOMEDS_AttributeSequenceOfReal_i.cxx
src/SALOMEDS/SALOMEDS_AttributeSequenceOfReal_i.hxx
src/SALOMEDS/SALOMEDS_AttributeStudyProperties_i.cxx
src/SALOMEDS/SALOMEDS_AttributeStudyProperties_i.hxx
src/SALOMEDS/SALOMEDS_AttributeTableOfInteger_i.cxx
src/SALOMEDS/SALOMEDS_AttributeTableOfInteger_i.hxx
src/SALOMEDS/SALOMEDS_AttributeTableOfReal_i.cxx
src/SALOMEDS/SALOMEDS_AttributeTableOfReal_i.hxx
src/SALOMEDS/SALOMEDS_AttributeTableOfString_i.cxx
src/SALOMEDS/SALOMEDS_AttributeTableOfString_i.hxx
src/SALOMEDS/SALOMEDS_AttributeTarget_i.cxx
src/SALOMEDS/SALOMEDS_AttributeTextColor_i.cxx
src/SALOMEDS/SALOMEDS_AttributeTextColor_i.hxx
src/SALOMEDS/SALOMEDS_AttributeTextHighlightColor_i.cxx
src/SALOMEDS/SALOMEDS_AttributeTextHighlightColor_i.hxx
src/SALOMEDS/SALOMEDS_AttributeTreeNode_i.cxx
src/SALOMEDS/SALOMEDS_AttributeTreeNode_i.hxx
src/SALOMEDS/SALOMEDS_AttributeUserID_i.cxx
src/SALOMEDS/SALOMEDS_AttributeUserID_i.hxx
src/SALOMEDS/SALOMEDS_BasicAttributeFactory.cxx
src/SALOMEDS/SALOMEDS_DataMapIteratorOfDataMapStringLabel.hxx
src/SALOMEDS/SALOMEDS_DataMapIteratorOfDataMapStringLabel_0.cxx
src/SALOMEDS/SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx
src/SALOMEDS/SALOMEDS_DataMapNodeOfDataMapStringLabel_0.cxx
src/SALOMEDS/SALOMEDS_DataMapStringLabel.hxx
src/SALOMEDS/SALOMEDS_DataMapStringLabel_0.cxx
src/SALOMEDS/SALOMEDS_DrawableAttribute.cxx
src/SALOMEDS/SALOMEDS_ExpandableAttribute.cxx
src/SALOMEDS/SALOMEDS_ExternalFileDef.cxx
src/SALOMEDS/SALOMEDS_FileType.cxx
src/SALOMEDS/SALOMEDS_GenericAttribute_i.cxx
src/SALOMEDS/SALOMEDS_GenericAttribute_i.hxx
src/SALOMEDS/SALOMEDS_LocalIDAttribute.cxx
src/SALOMEDS/SALOMEDS_LocalIDAttribute.hxx
src/SALOMEDS/SALOMEDS_LocalIDAttribute.ixx
src/SALOMEDS/SALOMEDS_LocalIDAttribute.jxx
src/SALOMEDS/SALOMEDS_OpenedAttribute.cxx
src/SALOMEDS/SALOMEDS_PixMapAttribute.cxx
src/SALOMEDS/SALOMEDS_SObject_i.cxx
src/SALOMEDS/SALOMEDS_SObject_i.hxx
src/SALOMEDS/SALOMEDS_SelectableAttribute.cxx
src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.cxx
src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.cxx
src/SALOMEDS/SALOMEDS_StudyBuilder_i.cxx
src/SALOMEDS/SALOMEDS_StudyBuilder_i.hxx
src/SALOMEDS/SALOMEDS_StudyManager_i.cxx
src/SALOMEDS/SALOMEDS_Study_i.cxx
src/SALOMEDS/SALOMEDS_Study_i.hxx
src/SALOMEDS/SALOMEDS_TargetAttribute.cxx
src/SALOMEDS/SALOMEDS_TargetAttribute.hxx
src/SALOMEDS/SALOMEDS_TargetAttribute.ixx
src/SALOMEDS/SALOMEDS_TargetAttribute.jxx
src/SALOMEDS/SALOMEDS_TextColorAttribute.cxx
src/SALOMEDS/SALOMEDS_TextHighlightColorAttribute.cxx
src/SALOMEGUI/CLIENT_msg_en.po
src/SALOMEGUI/PyInterp_base.h
src/SALOMEGUI/QAD_Action.h
src/SALOMEGUI/QAD_Application.cxx
src/SALOMEGUI/QAD_Config.h
src/SALOMEGUI/QAD_Desktop.cxx
src/SALOMEGUI/QAD_Desktop.h
src/SALOMEGUI/QAD_HelpWindow.cxx
src/SALOMEGUI/QAD_ObjectBrowser.cxx
src/SALOMEGUI/QAD_PyEditor.cxx
src/SALOMEGUI/QAD_ResourceMgr.cxx
src/SALOMEGUI/QAD_ViewFrame.h
src/SALOMEGUI/QAD_WaitCursor.h
src/SALOMEGUI/QAD_msg_en.po
src/SALOMEGUI/SALOMEGUI_ActivateComponentDlg.cxx
src/SALOMEGUI/SALOMEGUI_ActivateComponentDlg.h
src/SALOMEGUI/SALOMEGUI_ExternalBrowserDlg.cxx
src/SALOMEGUI/SALOMEGUI_ExternalBrowserDlg.h
src/SALOMEGUI/SALOMEGUI_NameDlg.cxx
src/SALOMEGUI/SALOMEGUI_NameDlg.h
src/SALOMEGUI/SALOMEGUI_OpenWith.cxx
src/SALOMEGUI/SALOMEGUI_OpenWith.h
src/SALOMEGUI/SALOMEGUI_Swig.cxx
src/SALOMEGUI/SALOMEGUI_msg_en.po
src/SALOMEGUI/SALOME_ListIO.hxx
src/SALOMEGUI/SALOME_ListOfFilter.hxx
src/SALOMEGUI/SALOME_Selection.cxx
src/SALOMEGUI/SALOME_Selection.h
src/SALOME_PY/SalomePy.cxx
src/SALOME_PYQT/SALOME_PYQT_GUI.cxx
src/SALOME_SWIG/batchmode_salome.py
src/SALOME_SWIG/salome.py
src/SALOME_SWIG/salome_test.py
src/SUPERVGraph/SUPERVGraph_ViewFrame.cxx
src/SUPERVGraph/SUPERVGraph_ViewFrame.h
src/Session/SALOME_Session_QThread.cxx
src/Session/SALOME_Session_Server.cxx
src/TOOLSGUI/ToolsGUI_CatalogGeneratorDlg.cxx
src/TestContainer/TestContainer.cxx
src/TestContainer/TestLogger.cxx
src/Utils/Makefile.in
src/Utils/Utils_CorbaException.hxx
src/Utils/Utils_ORB_INIT.cxx
src/Utils/Utils_SALOME_Exception.hxx
src/Utils/utilities.h
src/VTKFilter/Makefile.in
src/VTKFilter/SALOME_GeometryFilter.cxx
src/VTKFilter/SALOME_GeometryFilter.h
src/VTKFilter/SALOME_PassThroughFilter.cxx
src/VTKFilter/SALOME_PassThroughFilter.h
src/VTKViewer/Makefile.in
src/VTKViewer/VTKViewer_InteractorStyleSALOME.cxx
src/VTKViewer/VTKViewer_InteractorStyleSALOME.h
src/VTKViewer/VTKViewer_RenderWindow.cxx
src/VTKViewer/VTKViewer_RenderWindowInteractor.cxx
src/VTKViewer/VTKViewer_RenderWindowInteractor.h
src/VTKViewer/VTKViewer_Trihedron.cxx
src/VTKViewer/VTKViewer_Trihedron.h
src/VTKViewer/VTKViewer_Utilities.cxx
src/VTKViewer/VTKViewer_ViewFrame.cxx
src/VTKViewer/VTKViewer_ViewFrame.h

index 037ad6d66619d126cbd2c545d03a0b56210092ec..d0dee5fc90db423ef7a4628d197b00fcde9041ef 100755 (executable)
@@ -1 +1 @@
-THIS IS SALOME - KERNEL VERSION: 1.4.0
+THIS IS SALOME - KERNEL VERSION: 1.4.1
index 814420dfa78e18443994eb6a378d3e319e9e5423..63171b0b9af9426cc5038c200aebf99781979480 100755 (executable)
@@ -1,40 +1,13 @@
 #!/usr/bin/env python
-
-import sys,os,pickle,signal
-
-process_id={}
-
-# -----------------------------------------------------------------------------
-#
-# Fonction d'arrêt de salome
-#
-
-def killSalome():
-   print "arret des serveurs SALOME"
-   for pid, cmd in process_id.items():
-      print "arret du process %s : %s"% (pid, cmd[0])
-      try:
-         os.kill(pid,signal.SIGKILL)
-      except:
-         print "  ------------------ process %s : %s inexistant"% (pid, cmd[0])
-   print "arret du naming service"
-   os.system("killall -9 omniNames")
-   
-# -----------------------------------------------------------------------------
-
-filedict='/tmp/'+os.getenv('USER')+'_SALOME_pidict'
-#filedict='/tmp/'+os.getlogin()+'_SALOME_pidict'
-try:
-   fpid=open(filedict, 'r')
-except:
-   print "le fichier %s des process SALOME n'est pas accessible"% filedict
-   sys.exit(1)
-   
-process_id=pickle.load(fpid)
-fpid.close()
-
-killSalome()
-
-os.remove(filedict)
-
-
+import os, string
+
+from killSalomeWithPort import killSalome
+
+user = os.getenv('USER')
+for file in os.listdir("/tmp"):
+    l = string.split(file, "_")
+    if len(l) >= 4:
+        if file[:len(user)] == user:
+            if l[len(l)-2] == "SALOME" and l[len(l)-1] == "pidict":
+                killSalome(l[len(l)-3])
+    pass
index 1154b010115ea053049afe9ecd91bb3fae8d94eb..a96bc98474421374d75f781c0d150a8916c83177 100755 (executable)
@@ -24,6 +24,7 @@ class NamingServer(Server):
    USER=os.getenv('USER')
    if USER is None:
       USER='anonymous'
+   os.system("mkdir -m 777 -p /tmp/logs")
    LOGDIR="/tmp/logs/" + USER
    os.system("mkdir -m 777 -p " + LOGDIR)
    CMD="runNS.sh > " + LOGDIR + "/salomeNS.log 2>&1"
index 226bc9be63b64c5fc9e9e4cd34fac4b412e4b72a..76b7452bfbf981dd0e62350ade3632d3119ea91a 100755 (executable)
@@ -11,14 +11,15 @@ Username=`/usr/bin/whoami`
 
 # clear log files
 
-mkdir -m 775 ${BaseDir}/logs 
+mkdir -m 777 ${BaseDir}/logs 
 mkdir ${BaseDir}/logs/${Username}
 touch ${BaseDir}/logs/${Username}/dummy
 \rm -f ${BaseDir}/logs/${Username}/omninames* ${BaseDir}/logs/${Username}/dummy ${BaseDir}/logs/${Username}/*.log
 
 echo "Name Service... "
-
-omniNames -start -logdir ${BaseDir}/logs/${Username} &
+aSedCommand="s/ORBInitRef NameService=corbaname::`hostname`:\([[:digit:]]*\)/\1/"
+aPort=`sed -e"$aSedCommand" $OMNIORB_CONFIG`
+omniNames -start $aPort -logdir ${BaseDir}/logs/${Username} &
 
 # In LifeCycleCORBA, FactoryServer is started with rsh on the requested
 #    computer if this Container does not exist. Default is localhost.
index 3a3d0e2d2b9adc7ef988ae204cc3c7365d36abd9..48951369e7becaf5d5a45fddfd91cffb786b758a 100755 (executable)
@@ -1,6 +1,28 @@
-#!/bin/sh
+#!/bin/bash
 
-python -i ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py --gui --modules=GEOM,SMESH,VISU,SUPERV,MED --xterm --containers=cpp,python --killall
+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
+
+if [ $# -ne 0 ] ; then
+    python ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py $* 
+else
+    python ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py
+fi
+
+#python -i ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py --gui --modules=GEOM --xterm --containers=cpp,python --killall
+#python -i ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py --gui --modules=GEOM,SMESH,VISU,SUPERV,MED --xterm --containers=cpp,python --killall
 #python -i ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py --gui --modules=GEOM,SMESH,VISU,SUPERV,MED --logger --xterm
 #python -i ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py --modules=GEOM,SMESH,VISU,SUPERV,MED
 #python -i ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py --help
index b9ccbd48a7e74eda78b7a14d6dc1d9f933597eac..19d91294be52d27e86f35b9f10089bac34824546 100755 (executable)
 #!/usr/bin/env python
 
-usage="""USAGE: runSalome.py [options]
-
-[command line options] :
---help                        : affichage de l'aide
---gui                         : lancement du GUI
---logger                     : redirection des messages dans un fichier
---xterm                              : les serveurs ouvrent une fenêtre xterm et les messages sont affichés dans cette fenêtre
---modules=module1,module2,... : où modulen est le nom d'un module Salome à charger dans le catalogue
---containers=cpp,python,superv: lancement des containers cpp, python et de supervision
---killall                    : arrêt des serveurs de salome
-
- La variable d'environnement <modulen>_ROOT_DIR doit etre préalablement
- positionnée (modulen doit etre en majuscule).
- KERNEL_ROOT_DIR est obligatoire.
-"""
-
+import sys, os, string, glob, time, pickle
+
+### read launch configure xml file and command line options
+import launchConfigureParser
+args = launchConfigureParser.args
+
+### kill servers if it is need
+if args['killall']:
+    import killSalome
+elif args['portkill']:
+    from killSalomeWithPort import killSalome
+    filedict='/tmp/'+os.getenv('USER')+"_"+str(args['port'])+'_'+args['appname'].upper()+'_pidict'
+    try:
+        killSalome(my_port)
+    except:
+        pass
+    pass
+       
 # -----------------------------------------------------------------------------
 #
-# Fonction d'arrêt de salome
+# Fonctions helper pour ajouter des variables d'environnement
 #
 
-def killSalome():
-   print "arret des serveurs SALOME"
-   for pid, cmd in process_id.items():
-      print "arret du process %s : %s"% (pid, cmd[0])
-      try:
-       os.kill(pid,signal.SIGKILL)
-      except:
-         print "  ------------------ process %s : %s inexistant"% (pid, cmd[0])
-   print "arret du naming service"
-   os.system("killall -9 omniNames")
-   
-# -----------------------------------------------------------------------------
-#
-# Fonction message
-#
+def add_path(directory, variable_name):
+    if not os.environ.has_key(variable_name):
+        os.environ[variable_name] = ""
+        pass
+    os.environ[variable_name]=directory + ":" + os.environ[variable_name]
+    if variable_name=="PYTHONPATH":
+        sys.path[:0]=[directory]
 
-def message(code, msg=''):
-    if msg: print msg
-    sys.exit(code)
-
-import sys,os,string,glob,time,signal,pickle,getopt
-
-init_time=os.times()
-opts, args=getopt.getopt(sys.argv[1:], 'hmglxck:', ['help','modules=','gui','logger','xterm','containers=','killall'])
-modules_root_dir={}
-process_id={}
-liste_modules={}
-liste_containers={}
-with_gui=0
-with_logger=0
-with_xterm=0
-
-with_container_cpp=0
-with_container_python=0
-with_container_superv=0
-
-try:
-  for o, a in opts:
-    if o in ('-h', '--help'):
-      print usage
-      sys.exit(1)
-    elif o in ('-g', '--gui'):
-      with_gui=1
-    elif o in ('-l', '--logger'):
-      with_logger=1
-    elif o in ('-x', '--xterm'):
-      with_xterm=1
-    elif o in ('-m', '--modules'):
-      liste_modules = [x.upper() for x in a.split(',')]
-    elif o in ('-c', '--containers'):
-      liste_containers = [x.lower() for x in a.split(',')]
-      for r in liste_containers:
-        if r not in ('cpp', 'python', 'superv'):
-          message(1, 'Invalid -c/--containers option: %s' % a)
-      if 'cpp' in liste_containers:
-          with_container_cpp=1
-      else:
-          with_container_cpp=0
-      if 'python' in liste_containers:
-          with_container_python=1
-      else:
-          with_container_python=0
-      if 'superv' in liste_containers:
-          with_container_superv=1
-      else:
-          with_container_superv=0
-    elif o in ('-k', '--killall'):
-      filedict='/tmp/'+os.getenv('USER')+'_SALOME_pidict'
-      #filedict='/tmp/'+os.getlogin()+'_SALOME_pidict'
-      found = 0
-      try:
-         fpid=open(filedict, 'r')
-        found = 1
-      except:
-         print "le fichier %s des process SALOME n'est pas accessible"% filedict
-
-      if found:
-         process_id=pickle.load(fpid)
-         fpid.close()
-         killSalome()
-        process_id={}
-         os.remove(filedict)
-       
-except getopt.error, msg:
-  print usage
-  sys.exit(1)
 
+init_time = os.times()
 # -----------------------------------------------------------------------------
 #
-# Vérification des variables d'environnement
+# Check variables <module>_ROOT_DIR and set list of used modules (without KERNEL)
+# Add to the PATH-variables modules' specific paths
 #
-try:
-  kernel_root_dir=os.environ["KERNEL_ROOT_DIR"]
-  modules_root_dir["KERNEL"]=kernel_root_dir
-except:
-  print usage
-  sys.exit(1)
-
-for module in liste_modules :
-   try:
-      module=module.upper()
-      module_root_dir=os.environ[module +"_ROOT_DIR"]
-      modules_root_dir[module]=module_root_dir
-   except:
-      print usage
-      sys.exit(1)
-
-# il faut KERNEL en premier dans la liste des modules
-# - l'ordre des modules dans le catalogue sera identique
-# - la liste des modules presents dans le catalogue est exploitée pour charger les modules CORBA python,
-#   il faut charger les modules python du KERNEL en premier
-
-if "KERNEL" in liste_modules:liste_modules.remove("KERNEL")
-liste_modules[:0]=["KERNEL"]
-#print liste_modules
-#print modules_root_dir
-
-os.environ["SALOMEPATH"]=":".join(modules_root_dir.values())
-if "SUPERV" in liste_modules:with_container_superv=1
+modules_list = []
+if args.has_key("modules"):
+    modules_list += args["modules"]
+modules_list[:0] = ["KERNEL"] # KERNEL must be last in the list to locate it at the first place in PATH variables
+modules_list.reverse()
+
+modules_root_dir = {}
+modules_root_dir_list = []
+python_version="python%d.%d" % sys.version_info[0:2]
+
+to_remove_list=[]
+for module in modules_list :
+    module_variable=module.upper()+"_ROOT_DIR"
+    if not os.environ.has_key(module_variable):
+        print "*******************************************************************************"
+        print "*"
+        print "* Environment variable",module_variable,"must be set"
+        print "* Module", module, "will be not available"
+        print "*"
+        print "*******************************************************************************"
+        to_remove_list.append(module)
+        continue
+        pass
+    module_root_dir = os.environ[module_variable]
+    modules_root_dir[module]=module_root_dir
+    modules_root_dir_list[:0] = [module_root_dir]
+    add_path(os.path.join(module_root_dir,"lib",args['appname']), "LD_LIBRARY_PATH")
+    add_path(os.path.join(module_root_dir,"bin",args['appname']), "PATH")
+    if os.path.exists(module_root_dir + "/examples") :
+        add_path(os.path.join(module_root_dir,"examples"), "PYTHONPATH")
+
+for to_remove in to_remove_list:
+    modules_list.remove(to_remove)
+
+while "KERNEL" in modules_list:
+    modules_list.remove("KERNEL")
+    pass
+
+# KERNEL must be last in the list to locate it at the first place in PYTHONPATH variable
+list_modules = modules_list[:] + ["KERNEL"] 
+for module in list_modules:
+    module_root_dir = modules_root_dir[module]
+    add_path(os.path.join(module_root_dir,"bin",args['appname']), "PYTHONPATH")
+    add_path(os.path.join(module_root_dir,"lib",python_version,"site-packages",args['appname']), "PYTHONPATH")
+    add_path(os.path.join(module_root_dir,"lib",args['appname']), "PYTHONPATH")
+    add_path(os.path.join(module_root_dir,"lib",python_version,"site-packages",args['appname'],"shared_modules"), "PYTHONPATH")
+      
+#os.environ["SALOMEPATH"]=":".join(modules_root_dir.values())
+os.environ["SALOMEPATH"]=":".join(modules_root_dir_list)
+if "SUPERV" in modules_list and not 'superv' in args['containers']:
+    args['containers'].append("superv")
+    pass
 
 
 # -----------------------------------------------------------------------------
@@ -149,28 +99,31 @@ if "SUPERV" in liste_modules:with_container_superv=1
 
 class Server:
    CMD=[]
-   if with_xterm:
+   if args['xterm']:
        ARGS=['xterm', '-iconic', '-sb', '-sl', '500', '-e']
    else:
        ARGS=[] 
 
    def run(self):
-      args = self.ARGS+self.CMD
-      #print "args = ", args
-      pid = os.spawnvp(os.P_NOWAIT, args[0], args)
-      process_id[pid]=self.CMD
+       global process_id
+       command = self.ARGS+self.CMD
+       #print "args = ", args
+       pid = os.spawnvp(os.P_NOWAIT, command[0], command)
+       process_id[pid]=self.CMD
 
 class CatalogServer(Server):
    SCMD1=['SALOME_ModuleCatalog_Server','-common']
    SCMD2=['-personal','${HOME}/Salome/resources/CatalogModulePersonnel.xml'] 
 
-   def setpath(self,liste_modules):
+   def setpath(self,modules_list):
       cata_path=[]
-      for module in liste_modules:
+      list_modules = modules_list[:]
+      list_modules.reverse()
+      for module in ["KERNEL"] + list_modules:
           module_root_dir=modules_root_dir[module]
           module_cata=module+"Catalog.xml"
           print "   ", module_cata
-          cata_path.extend(glob.glob(os.path.join(module_root_dir,"share","salome","resources",module_cata)))
+          cata_path.extend(glob.glob(os.path.join(module_root_dir,"share",args['appname'],"resources",module_cata)))
       self.CMD=self.SCMD1 + [string.join(cata_path,':')] + self.SCMD2
 
 class SalomeDSServer(Server):
@@ -180,88 +133,49 @@ class RegistryServer(Server):
    CMD=['SALOME_Registry_Server', '--salome_session','theSession']
 
 class ContainerCPPServer(Server):
-   CMD=['SALOME_Container','FactoryServer','-ORBInitRef','NameService=corbaname::localhost']
+   #CMD=['SALOME_Container','FactoryServer','-ORBInitRef','NameService=corbaname::localhost']
+   CMD=['SALOME_Container','FactoryServer']
 
 class ContainerPYServer(Server):
-   CMD=['SALOME_ContainerPy.py','FactoryServerPy','-ORBInitRef','NameService=corbaname::localhost']
+   #CMD=['SALOME_ContainerPy.py','FactoryServerPy','-ORBInitRef','NameService=corbaname::localhost']
+   CMD=['SALOME_ContainerPy.py','FactoryServerPy']
 
 class ContainerSUPERVServer(Server):
-   CMD=['SALOME_Container','SuperVisionContainer','-ORBInitRef','NameService=corbaname::localhost']
+   #CMD=['SALOME_Container','SuperVisionContainer','-ORBInitRef','NameService=corbaname::localhost']
+   CMD=['SALOME_Container','SuperVisionContainer']
 
 class LoggerServer(Server):
    CMD=['SALOME_Logger_Server', 'logger.log']
 
 class SessionLoader(Server):
    CMD=['SALOME_Session_Loader']
-   if with_container_cpp:
+   if "cpp" in args['containers']:
        CMD=CMD+['CPP']
-   if with_container_python:
+   if "python" in args['containers']:
        CMD=CMD+['PY']
-   if with_container_superv:
+   if "superv" in args['containers']:
        CMD=CMD+['SUPERV']
-   if with_gui:
+   if args['gui']:
        CMD=CMD+['GUI']
 
 class SessionServer(Server):
    CMD=['SALOME_Session_Server']
 
 class NotifyServer(Server):
-   CMD=['notifd','-c','${KERNEL_ROOT_DIR}/share/salome/resources/channel.cfg -DFactoryIORFileName=/tmp/${LOGNAME}_rdifact.ior -DChannelIORFileName=/tmp/${LOGNAME}_rdichan.ior']
-
-# -----------------------------------------------------------------------------
-#
-# Fonction de test
-#
-
-def test(clt):
-   # create an LifeCycleCORBA instance
-   import LifeCycleCORBA 
-   lcc = LifeCycleCORBA.LifeCycleCORBA(clt.orb)
-   med = lcc.FindOrLoadComponent("FactoryServer", "MED")
-   #pycalc = lcc.FindOrLoadComponent("FactoryServerPy", "CalculatorPy")
-
-# -----------------------------------------------------------------------------
-#
-# Fonctions helper pour ajouter des variables d'environnement
-#
-
-def add_path(directory):
-   os.environ["PATH"]=directory + ":" + os.environ["PATH"]
-
-def add_ld_library_path(directory):
-   os.environ["LD_LIBRARY_PATH"]=directory + ":" + os.environ["LD_LIBRARY_PATH"]
-
-def add_python_path(directory):
-   os.environ["PYTHONPATH"]=directory + ":" + os.environ["PYTHONPATH"]
-   sys.path[:0]=[directory]
+    myLogName = os.environ["LOGNAME"]
+    CMD=['notifd','-c',modules_root_dir["KERNEL"]+'/share/salome/resources/channel.cfg', '-DFactoryIORFileName=/tmp/'+myLogName+'_rdifact.ior', '-DChannelIORFileName=/tmp/'+myLogName+'_rdichan.ior']
 
 # -----------------------------------------------------------------------------
 #
 # initialisation des variables d'environnement
 #
 
-python_version="python%d.%d" % sys.version_info[0:2]
-
-#
-# Ajout du chemin d'acces aux executables de KERNEL dans le PATH
-#
-
-add_path(os.path.join(kernel_root_dir,"bin","salome"))
-#print "PATH=",os.environ["PATH"]
-
-#
-# Ajout des modules dans le LD_LIBRARY_PATH
-#
-for module in liste_modules:
-    module_root_dir=modules_root_dir[module]
-    add_ld_library_path(os.path.join(module_root_dir,"lib","salome"))
-
 os.environ["SALOME_trace"]="local"
-if with_logger:
+if args['logger']:
    os.environ["SALOME_trace"]="with_logger"
    locdir=os.environ['PWD']
    libtracedir=os.path.join(locdir,"libSalomeTrace")
-   libtrace = os.path.join(kernel_root_dir,"lib","salome","libSALOMELoggerClient.so.0.0.0")
+   libtrace = os.path.join(modules_root_dir["KERNEL"],"lib",args['appname'],"libSALOMELoggerClient.so.0.0.0")
    libtraceln = os.path.join(libtracedir,"libSALOMELocalTrace.so")
    aCommand = 'rm -rf ' + libtracedir + "; "
    aCommand += 'mkdir ' + libtracedir + "; "
@@ -269,27 +183,30 @@ if with_logger:
    aCommand += 'ln -s ' + libtrace + " " + libtraceln + ".0; "
    aCommand += 'ln -s ' + libtrace + " " + libtraceln + ".0.0.0; "
    os.system(aCommand)
-   add_ld_library_path(libtracedir)
+   add_path(libtracedir, "LD_LIBRARY_PATH")
+
+# set environment for SMESH plugins
+
+if "SMESH" in args["modules"]:
+    os.environ["SMESH_MeshersList"]="StdMeshers"
+    if not os.environ.has_key("SALOME_StdMeshersResources"):
+        os.environ["SALOME_StdMeshersResources"] = modules_root_dir["SMESH"]+"/share/"+args["appname"]+"/resources"
+        pass
+    if args.has_key("SMESH_plugins"):
+        for plugin in args["SMESH_plugins"]:
+            if os.environ.has_key(plugin.upper()+"_ROOT_DIR"):
+                os.environ["SMESH_MeshersList"]=os.environ["SMESH_MeshersList"]+":"+plugin
+                plugin_root = os.environ[plugin.upper()+"_ROOT_DIR"]
+                if not os.environ.has_key("SALOME_"+plugin+"Resources"):
+                    os.environ["SALOME_"+plugin+"Resources"] = plugin_root+"/share/"+args["appname"]+"/resources"
+                add_path(os.path.join(plugin_root,"lib",python_version,"site-packages",args['appname']), "PYTHONPATH")
+                add_path(os.path.join(plugin_root,"lib",args['appname']), "PYTHONPATH")
+                add_path(os.path.join(plugin_root,"lib",args['appname']), "LD_LIBRARY_PATH")
+                add_path(os.path.join(plugin_root,"bin",args['appname']), "PYTHONPATH")
+                add_path(os.path.join(plugin_root,"bin",args['appname']), "PATH")
+        pass
+    pass
    
-#print "LD_LIBRARY_PATH=",os.environ["LD_LIBRARY_PATH"]
-
-#
-# Ajout des modules dans le PYTHONPATH (KERNEL prioritaire, donc en dernier)
-#
-
-liste_modules_reverse=liste_modules[:]
-liste_modules_reverse.reverse()
-#print liste_modules
-#print liste_modules_reverse
-for module in liste_modules_reverse:
-    module_root_dir=modules_root_dir[module]
-    add_python_path(os.path.join(module_root_dir,"bin","salome"))
-    add_python_path(os.path.join(module_root_dir,"lib",python_version,"site-packages","salome"))
-    add_python_path(os.path.join(module_root_dir,"lib","salome"))
-    add_python_path(os.path.join(module_root_dir,"lib",python_version,"site-packages","salome","shared_modules"))
-
-#print "PYTHONPATH=",sys.path
-
 import orbmodule
 
 #
@@ -316,7 +233,7 @@ def startSalome():
   # Lancement Session Loader
   #
 
-  if with_gui:
+  if args['gui']:
      SessionLoader().run()
 
   #
@@ -328,10 +245,13 @@ def startSalome():
   # (non obligatoire) Lancement Logger Server et attente de sa disponibilite dans le naming service
   #
 
-  if with_logger:
+  if args['logger']:
        LoggerServer().run()
        clt.waitLogger("Logger")
 
+  # Notify Server launch
+  #
+  NotifyServer().run()
 
   #
   # Lancement Registry Server
@@ -350,7 +270,7 @@ def startSalome():
   #
 
   cataServer=CatalogServer()
-  cataServer.setpath(liste_modules)
+  cataServer.setpath(modules_list)
   cataServer.run()
 
   #
@@ -364,13 +284,13 @@ def startSalome():
   # Lancement SalomeDS Server
   #
 
-  os.environ["CSF_PluginDefaults"]=os.path.join(kernel_root_dir,"share","salome","resources")
-  os.environ["CSF_SALOMEDS_ResourcesDefaults"]=os.path.join(kernel_root_dir,"share","salome","resources")
+  os.environ["CSF_PluginDefaults"]=os.path.join(modules_root_dir["KERNEL"],"share",args['appname'],"resources")
+  os.environ["CSF_SALOMEDS_ResourcesDefaults"]=os.path.join(modules_root_dir["KERNEL"],"share",args['appname'],"resources")
   SalomeDSServer().run()
 
-  if "GEOM" in liste_modules:
+  if "GEOM" in modules_list:
        print "GEOM OCAF Resources"
-       os.environ["CSF_GEOMDS_ResourcesDefaults"]=os.path.join(modules_root_dir["GEOM"],"share","salome","resources")
+       os.environ["CSF_GEOMDS_ResourcesDefaults"]=os.path.join(modules_root_dir["GEOM"],"share",args['appname'],"resources")
 
 
   #
@@ -400,7 +320,7 @@ def startSalome():
   #
   # Lancement Container C++ local
   #
-  if with_container_cpp:
+  if 'cpp' in args['containers']:
          ContainerCPPServer().run()
 
          #
@@ -413,7 +333,7 @@ def startSalome():
   # Lancement Container Python local
   #
 
-  if with_container_python:
+  if 'python' in args['containers']:
          ContainerPYServer().run()
 
          #
@@ -422,7 +342,7 @@ def startSalome():
        
          clt.waitNS("/Containers/" + theComputer + "/FactoryServerPy")
 
-  if with_container_superv:
+  if 'superv' in args['containers']:
 
        #
        # Lancement Container Supervision local
@@ -453,42 +373,50 @@ def startSalome():
 # -----------------------------------------------------------------------------
 #
 
+process_id = {}
 if __name__ == "__main__":
-   clt=None
-   try:
-      clt = startSalome()
-   except:
-      print
-      print
-      print "--- erreur au lancement Salome ---"
-   
-   #print process_id
-   
-   
-   filedict='/tmp/'+os.getenv('USER')+'_SALOME_pidict'
-   #filedict='/tmp/'+os.getlogin()+'_SALOME_pidict'
-   
-   fpid=open(filedict, 'w')
-   pickle.dump(process_id,fpid)
-   fpid.close()
-   
-   print
-   print "Sauvegarde du dictionnaire des process dans ", filedict
-   print "Pour tuer les process SALOME, executer : python killSalome.py depuis"
-   print "une console, ou bien killSalome() depuis le present interpreteur,"
-   print "s'il n'est pas fermé."
-   print
-   print "runSalome, avec l'option --killall, commence par tuer les process restants d'une execution précédente."
-   print
-   print "Pour lancer uniquement le GUI, executer startGUI() depuis le present interpreteur,"
-   print "s'il n'est pas fermé."
-   
-   #
-   #  Impression arborescence Naming Service
-   #
-   
-   if clt != None:
-     print
-     print " --- registered objects tree in Naming Service ---"
-     clt.showNS()
-   
+    clt=None
+    try:
+        clt = startSalome()
+    except:
+        print
+        print
+        print "--- erreur au lancement Salome ---"
+        
+    #print process_id
+    
+    filedict='/tmp/'+os.getenv('USER')+"_"+str(args['port'])+'_'+args['appname'].upper()+'_pidict'
+    #filedict='/tmp/'+os.getlogin()+'_SALOME_pidict'
+    
+    
+    process_ids = []
+    try:
+        fpid=open(filedict, 'r')
+        process_ids=pickle.load(fpid)
+        fpid.close()
+    except:
+        pass
+    
+    fpid=open(filedict, 'w')
+    process_ids.append(process_id)
+    pickle.dump(process_ids,fpid)
+    fpid.close()
+    
+    print
+    print "Saving of the dictionary of Salome processes in ", filedict
+    print "To kill SALOME processes launch : python killSalome.py from"
+    print "a console or killSalome() from the present interpreter, if it is not closed."
+    print
+    print "runSalome, with --killall option, starts with killing the processes resulting from the previous execution."
+    print
+    print "To launch only GUI only execute startGUI() from the present interpreter,"
+    print "if it is not closed."
+    
+    #
+    #  Impression arborescence Naming Service
+    #
+    
+    if clt != None:
+        print
+        print " --- registered objects tree in Naming Service ---"
+        clt.showNS()
index 2033a4172ea6f102d3d4075289bdde621c9eb889..7295ede75128e9e51b474f63ed9f8d7a128bb3df 100644 (file)
@@ -11,9 +11,11 @@ top_builddir=..
 srcdir=@srcdir@
 VPATH=.:@srcdir@
 
-SUBDIRS=html DevelopersGuide
+SUBDIRS= salome
 
-doc:
+@COMMENCE@
+
+docs:
        @@SETX@; for d in $(SUBDIRS); do        \
           (cd $$d && $(MAKE) $@) || exit 1;    \
        done
@@ -31,3 +33,8 @@ install:
        @@SETX@; for d in $(SUBDIRS); do        \
           (cd $$d && $(MAKE) $@) || exit 1;    \
        done
+
+uninstall:
+       @@SETX@; for d in $(SUBDIRS); do        \
+          (cd $$d && $(MAKE) $@) || exit 1;    \
+       done
index 8033ab2b02cec0396c94c89a3935f89d0ac14481..5d8a1f21d93d1b24abd5d580ed9488d90d742270 100644 (file)
@@ -6,7 +6,7 @@
 top_srcdir=@top_srcdir@
 top_builddir=..
 srcdir=@srcdir@
-VPATH=.:$(srcdir)
+VPATH=.
 
 @COMMENCE@
 
@@ -30,11 +30,14 @@ IDL_FILES = \
 PY_CLIENT_IDL = $(IDL_FILES)
 
 # we copy all idl file in $(top_builddir)/idl
-inc: $(IDL_FILES:%=$(top_builddir)/idl/%)
+inc: $(top_builddir)/idl/salome $(IDL_FILES:%=$(top_builddir)/idl/salome/%)
 
-$(IDL_FILES:%=$(top_builddir)/idl/%):$(top_builddir)/idl/%:%
+$(top_builddir)/idl/salome:
+       mkdir $@
+
+$(IDL_FILES:%=$(top_builddir)/idl/salome/%):$(IDL_FILES:%=$(top_srcdir)/idl/%)
 #      $(CP) $< $@
-       cp -f $< $@
+       cp -f $^ $(top_builddir)/idl/salome
 
 
 lib: pyidl
@@ -46,7 +49,7 @@ pyidl: $(PYTHON_BUILD_SITE) $(IDL_FILES:%.idl=$(PYTHON_BUILD_SITE)/%_idl.py)
 $(PYTHON_BUILD_SITE):
        $(INSTALL) -d  $@
 
-$(PYTHON_BUILD_SITE)/%_idl.py: %.idl
+$(PYTHON_BUILD_SITE)/%_idl.py: $(top_builddir)/idl/salome/%.idl
        $(OMNIORB_IDL) $(OMNIORB_IDLPYFLAGS) -C$(PYTHON_BUILD_SITE) $<
 
 
@@ -54,12 +57,12 @@ $(PYTHON_BUILD_SITE)/%_idl.py: %.idl
 install: install-pyidl install-idl
 
 # create directory $(idldir) and copy idl files into it
-install-idl: $(IDL_FILES)
+install-idl: $(IDL_FILES:%=$(top_builddir)/idl/salome/%)
        $(INSTALL) -d  $(idldir)
-       cp -p $^ $(idldir)
+       cp -p -f $^ $(idldir)
 
 
-install-pyidl: $(IDL_FILES)
+install-pyidl: $(IDL_FILES:%=$(top_builddir)/idl/salome/%)
        $(INSTALL) -d  $(PYTHON_SITE_INSTALL)
        @for file in $^ dummy; do \
          if [ $$file != "dummy" ]; then \
@@ -74,6 +77,6 @@ cleandep:
 
 distclean:
        -$(RM) *.py
-       -$(RM) $(IDL_FILES:%=$(top_builddir)/idl/%)
+       -$(RM) $(IDL_FILES:%=$(top_builddir)/idl/salome/%)
        -$(RM) Makefile
 
index 686297a177b385294053b54bb50d033f99a75147..6184f8fb159447bb4cd70a4fc6063f6588cc76d0 100644 (file)
@@ -196,6 +196,13 @@ during each working session.
 
 */
     SObject       FindObjectID    (in ID aObjectID);
+/*!
+    Allows to create a %SObject by its ID
+    \param aObjectID This parameter defines the ID of the required object
+    \return The created %SObject
+
+*/
+    SObject       CreateObjectID    (in ID aObjectID);
 /*!
     Allows to find a %SObject by IOR of the object belonging to this %SObject.
     \param anObjectName This parameter defines the IOR of the object
@@ -606,6 +613,29 @@ Searches for a definite %SObject with a definite GUID and returns True if it fin
 */
     Callback SetOnRemoveSObject(in Callback theCallback);
 
+/*!
+    Puts name attribute with the given string value to the given %SObject
+
+    \param theSO Existing SObject to set name attribute.
+    \param theValue The value to be set to the name attribute.
+*/
+    void SetName(in SObject theSO, in string theValue) raises (LockProtection);
+
+/*!
+    Puts comment attribute with the given string value to the given %SObject
+
+    \param theSO Existing SObject to set comment attribute.
+    \param theValue The value to be set to the comment attribute.
+*/
+    void SetComment(in SObject theSO, in string theValue) raises (LockProtection);
+
+/*!
+    Puts IOR attribute with the given string value to the given %SObject
+
+    \param theSO Existing SObject to set IOR attribute.
+    \param theValue The value to be set to the IOR attribute.
+*/
+    void SetIOR(in SObject theSO, in string theValue) raises (LockProtection);
   };
 
   //==========================================================================
@@ -817,6 +847,31 @@ Gets the list of open studies
     /return The study containing the given %SObject.
 */
     Study GetStudy();
+
+/*! Gets the CORBA object by its own IOR attribute.
+    Returns nil, if can't.
+
+    /return The CORBA object of the %SObject.
+*/
+    Object GetObject();
+
+/*!
+    Returns the name attribute value of this SObject.
+    Returns empty string if there is no name attribute.
+*/
+    string GetName();
+
+/*!
+    Returns the comment attribute value of this SObject.
+    Returns empty string if there is no comment attribute.
+*/
+    string GetComment();
+
+/*!
+    Returns the IOR attribute value of this SObject.
+    Returns empty string if there is no IOR attribute.
+*/
+    string GetIOR();
   };
 
 
@@ -840,6 +895,14 @@ Gets the list of open studies
    \note <BR>This exception is raised only outside a transaction.
 */
     void CheckLocked() raises (LockProtection);
+
+    string Store();
+
+    void Restore(in string theData);
+
+    string Type();
+
+    SObject GetSObject();
   };
 
 
index 27f1f6dbdcf70322f462f17e75bbc08987ea33cb..42310794f5ebe1a2a86636773e9c7c86c370f459 100644 (file)
@@ -63,6 +63,7 @@ module SALOMEDS
     Attribute allowing to store a real value
 */
  //==========================================================================
+
   interface AttributeReal : GenericAttribute
   {
 /*!
@@ -77,6 +78,7 @@ module SALOMEDS
 <BR><VAR>See also <A href=exemple/Example1.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 */
     void   SetValue(in double value);
+
   };
   //==========================================================================
 /*! \brief Attribute allowing to store an integer value
index ad9be3b06762bab1e8daa8ac0d13ed580da310e1..a18580fe7f4e2bd9b93d3f6d71c646058099d01f 100644 (file)
@@ -83,6 +83,14 @@ module Engines
    Returns True if the %container has been killed
 */
     boolean Kill_impl() ;
+/*!
+   Returns the hostname of the container
+*/
+    string getHostName();
+/*!
+   Returns the PID of the container
+*/
+    long getPID();
   };
 /*! \brief Interface of the %component
 
index 227c6b7e0e77eb45b37f68cf5c8205d433ea0201..61883a91c16c4a6b28ab273262bf444a2c299711 100644 (file)
@@ -74,6 +74,7 @@ This struct contains fields completely defining each service.
     ListOfServicesParameter ServiceinParameter; /*!< List of input parameters of the services.*/
     ListOfServicesParameter ServiceoutParameter; /*!< List of output parameters of the services.*/
     boolean                 Servicebydefault; /*!<True if the service is taken with its defult fields.*/
+    boolean                 TypeOfNode; /*!<True is the service is a factory node. Otherwise, it's a compute node.*/
   } ;
 /*! 
 List of services of the interface.
@@ -229,7 +230,13 @@ Defines the type of the component
 Sets/gets the icone of the component (for IAPP)
 */
     readonly attribute string component_icone;
+
+/*! 
+Sets/gets the implementation type of the component : C++ or Python (for IAPP)
+*/
+    readonly attribute boolean implementation_type;
   } ;
+
 /*! \brief %Module catalog interface
 
 This interface is used for creation of the module catalog in %SALOME application.
index 9a6d45867c1b9d058001ec57e5f638c4cd8e3e4e..cbe47153deaff92c0697fa2a23e53066949410ac 100644 (file)
@@ -5,14 +5,15 @@ srcdir=@srcdir@
 VPATH=.:$(srcdir)/salome_adm
 
 
-all:
-       cp -rf @top_srcdir@/salome_adm @prefix@
+all: resources
 
-install: all
+install:
+       cp -rf @top_srcdir@/salome_adm @prefix@
 
 bin:
 
 resources :
+       cp -rf @top_srcdir@/salome_adm @top_builddir@
 
 inc:
 
index ce2e458c91c3d619c93f61d4080e3ee4d46f0c16..85a53ce1b1d6ec0c075ec8be3371a35bf0badb19 100644 (file)
@@ -10,7 +10,7 @@ AC_CHECKING(for Kernel)
 Kernel_ok=no
 
 AC_ARG_WITH(kernel,
-           [  --with-kernel=DIR               root directory path of KERNEL installation ],
+           [  --with-kernel=DIR               root directory path of KERNEL build or installation],
            KERNEL_DIR="$withval",KERNEL_DIR="")
 
 if test "x$KERNEL_DIR" == "x" ; then
@@ -51,7 +51,7 @@ if test -f ${KERNEL_DIR}/bin/salome/runSalome ; then
 else
    AC_MSG_WARN("Cannot find compiled Kernel module distribution")
 fi
-  
+
 AC_MSG_RESULT(for Kernel: $Kernel_ok)
  
 ])dnl
index 405cefa83b22b858324f68e37bb983715d34d365..eb206598453fe7541e8fff70a0b5a2589e1027a3 100644 (file)
@@ -89,7 +89,7 @@ if test "x$occ_ok" = "xyes"; then
 dnl cascade headers
 
   CPPFLAGS_old="$CPPFLAGS"
-  CPPFLAGS="$CPPFLAGS -DLIN -DLINTEL -DCSFDB -DNO_CXX_EXCEPTION -DNo_exception -I$CASROOT/inc -Wno-deprecated"
+  CPPFLAGS="$CPPFLAGS -DLIN -DLINTEL -DCSFDB -DNO_CXX_EXCEPTION -DNo_exception -DHAVE_CONFIG_H -DHAVE_LIMITS_H -I$CASROOT/inc -Wno-deprecated -DHAVE_WOK_CONFIG_H"
   CXXFLAGS_old="$CXXFLAGS"
   CXXFLAGS="$CXXFLAGS -funsigned-char"
 
@@ -101,7 +101,7 @@ fi
 
 if test "x$occ_ok" = xyes ; then
 
-  CAS_CPPFLAGS="-DOCC_VERSION_MAJOR=$OCC_VERSION_MAJOR -DLIN -DLINTEL -DCSFDB -DNO_CXX_EXCEPTION -DNo_exception -I$CASROOT/inc"
+  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 -DHAVE_WOK_CONFIG_H"
   CAS_CXXFLAGS="-funsigned-char"
 
   AC_MSG_CHECKING(for OpenCascade libraries)
@@ -114,6 +114,7 @@ if test "x$occ_ok" = xyes ; then
   LIBS="$LIBS -L$CASROOT/$casdir/lib -lTKernel"
   AC_CACHE_VAL(salome_cv_lib_occ,[
     AC_TRY_LINK(
+using namespace std;
 #include <Standard_Type.hxx>
 ,   size_t size;
     const Standard_CString aName="toto";
index a970492b1dddd9e14a313595571ebdc60cc41040..72033bdcd7dd38181d5b963ba5013099e98d65f1 100644 (file)
@@ -34,6 +34,10 @@ CXX = @CXX@
 CXXFLAGS = @CXXFLAGS@ 
 CXX_DEPEND_FLAG = @CXX_DEPEND_FLAG@
 
+# BOOST Library
+
+BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
+
 # JAVA
 
 JAVA_INCLUDES = @JAVA_INCLUDES@
@@ -131,7 +135,7 @@ OMNIORB_CXXFLAGS    = @OMNIORB_CXXFLAGS@
 
 OMNIORB_IDL         = @OMNIORB_IDL@
 OMNIORB_IDLCXXFLAGS = @OMNIORB_IDLCXXFLAGS@
-OMNIORB_IDLPYFLAGS  = @OMNIORB_IDLPYFLAGS@ -I$(top_builddir)/idl
+OMNIORB_IDLPYFLAGS  = @OMNIORB_IDLPYFLAGS@ -I$(top_builddir)/salome/idl
 
 OMNIORB_IDL_CLN_H   = @OMNIORB_IDL_CLN_H@
 OMNIORB_IDL_CLN_CXX = @OMNIORB_IDL_CLN_CXX@
@@ -148,7 +152,7 @@ CORBA_INCLUDES    = @CORBA_INCLUDES@
 CORBA_LIBS        = @CORBA_LIBS@
 CORBA_CXXFLAGS    = @CORBA_CXXFLAGS@
 
-IDLCXXFLAGS = -bcxx @IDLCXXFLAGS@ -I$(top_builddir)/idl
+IDLCXXFLAGS = -bcxx @IDLCXXFLAGS@ -I$(top_builddir)/salome/idl
 IDLPYFLAGS  = @IDLPYFLAGS@
 
 IDL = @IDL@
@@ -202,13 +206,13 @@ idldir=${prefix}/idl/salome
 sharedpydir=@libdir@/python$(PYTHON_VERSION)/site-packages/salome/shared_modules
 incmakedir=${prefix}/salome_adm/unix
 
-docdir=$(datadir)/doc
+docdir=${prefix}/doc/salome
 
 #
 # begin of package rules
 #
 
-.PHONY: all lib bin inc resources data doc tests install uninstall dep depend depend_idl cleandep mostlyclean clean distclean
+.PHONY: all lib bin inc resources data docs tests install uninstall dep depend depend_idl cleandep mostlyclean clean distclean
 
 .SUFFIXES: .cxx .cc .c .f .o .lo .idl .py .i .ui .po .qm
 
@@ -251,7 +255,7 @@ ac_cxx_namespaces.m4              check_omniorb.m4   pyembed.m4             \
 ac_cxx_partial_specialization.m4  check_opengl.m4    python.m4         \
 ac_cxx_typename.m4                check_pthreads.m4  check_cas.m4      \
 ac_cc_warnings.m4                 check_qt.m4        check_med2.m4      \
-check_swig.m4 
+check_swig.m4                     check_boost.m4 
 
 $(top_srcdir)/aclocal.m4: $(ACLOCAL_SRC:%=@KERNEL_ROOT_DIR@/salome_adm/unix/config_files/%)
        cd $(top_srcdir) ; aclocal --acdir=adm_local/unix/config_files -I @KERNEL_ROOT_DIR@/salome_adm/unix/config_files
index fe43d0e54706985d1855324cc2066f0be1f4c2ec..b791f484d28cbc6af3e46c0752c957c7cc341270 100644 (file)
@@ -161,7 +161,7 @@ install: $(LIB) $(BIN) $(TEST_PROGS) $(libdir) $(includedir) $(bindir) $(datadir
 # Install exported includes in includedir
        @for f in X $(EXPORT_HEADERS:%=$(srcdir)/%); do                       \
           if test $$f != X; then                                             \
-            (cp -p $$f $(includedir) || exit 1);                             \
+            (cp -p -f $$f $(includedir) || exit 1);                          \
           fi;                                                                \
        done
 
index 983342227ad73788a60c080761f672e3a8219248..2d08f49bad01dab3aadeb91983b0dc88cdc0f814 100644 (file)
@@ -57,11 +57,11 @@ data:
        @if test "X$(top_builddir)" = "X."; then                                                         \
        ((cd examples && $(MAKE) $@) || exit 1);                         \
        fi;
-       
-doc:   
-       @if test "X$(top_builddir)" = "X."; then \
-       ((cd doc && $(MAKE) $@) || exit 1); \
-       fi;     
+# Commented because we need not to make docs when we make BUILD        
+# docs:        
+#      @if test "X$(top_builddir)" = "X."; then \
+#      ((cd doc && $(MAKE) $@) || exit 1); \
+#      fi;     
 
 install: install-resources
        @@SETX@; for d in $(SUBDIRS); do        \
index 05f7c84f8bd39602717fe45a2f742ada8b3cbbd1..91383b16869b89de98f62075fbd0cbc158a55070 100644 (file)
@@ -58,6 +58,7 @@ Engines_Container_i::Engines_Container_i (CORBA::ORB_ptr orb,
                                           int argc , char* argv[] ) :
  _numInstance(0)
 {
+  _pid = (long)getpid();
 
   ActSigIntHandler() ;
 
@@ -124,6 +125,7 @@ Engines_Container_i::Engines_Container_i (CORBA::ORB_ptr orb,
                                          int flag ) 
   : _numInstance(0)
 {
+  _pid = (long)getpid();
   string hostname = GetHostname();
   SCRUTE(hostname);
 
@@ -184,12 +186,12 @@ Engines::Container_ptr Engines_Container_i::start_impl(
     cont += machineName() ;
     cont += "/" ;
     cont += ContainerName;
-    INFOS(machineName() << " start_impl unknown container " << cont.c_str()
+    MESSAGE(machineName() << " start_impl unknown container " << cont.c_str()
           << " try to Resolve" );
     obj = _NS->Resolve( cont.c_str() );
     nilvar = CORBA::is_nil( obj ) ;
     if ( nilvar ) {
-      INFOS(machineName() << " start_impl unknown container "
+      MESSAGE(machineName() << " start_impl unknown container "
             << ContainerName);
     }
   }
@@ -201,7 +203,7 @@ Engines::Container_ptr Engines_Container_i::start_impl(
   }
   if ( !nilvar ) {
     _numInstanceMutex.unlock() ;
-    MESSAGE("start_impl container found without runSession") ;
+    MESSAGE("start_impl container found without new launch") ;
     return Engines::Container::_narrow(obj);
   }
   int i = 0 ;
@@ -209,12 +211,8 @@ Engines::Container_ptr Engines_Container_i::start_impl(
     MESSAGE("           argv" << i << " " << _argv[ i ]) ;
     i++ ;
   }
-//  string shstr( "rsh -n " ) ;
-//  shstr += machineName() ;
-//  shstr += " " ;
-//  shstr += _argv[ 0 ] ;
-//  string shstr( _argv[ 0 ] ) ;
-  string shstr( "./runSession SALOME_Container " ) ;
+  string shstr = string(getenv("KERNEL_ROOT_DIR")) + "/bin/salome/SALOME_Container ";
+//   string shstr( "./runSession SALOME_Container " ) ;
   shstr += ContainerName ;
   if ( _argc == 4 ) {
     shstr += " " ;
@@ -228,38 +226,37 @@ Engines::Container_ptr Engines_Container_i::start_impl(
   MESSAGE("system(" << shstr << ")") ;
   int status = system( shstr.c_str() ) ;
   if (status == -1) {
-    INFOS("Engines_Container_i::start_impl runSession(SALOME_Container) failed (system command status -1)") ;
+    MESSAGE("Engines_Container_i::start_impl SALOME_Container failed (system command status -1)") ;
   }
   else if (status == 217) {
-    INFOS("Engines_Container_i::start_impl runSession(SALOME_Container) failed (system command status 217)") ;
+    MESSAGE("Engines_Container_i::start_impl SALOME_Container failed (system command status 217)") ;
   }
-  INFOS(machineName() << " Engines_Container_i::start_impl runSession(SALOME_Container) done");
-#if 0
-  pid_t pid = fork() ;
-  if ( pid == 0 ) {
-    string anExe( _argv[ 0 ] ) ;
-    anExe += "runSession" ;
-    char * args[ 6 ] ;
-    args[ 0 ] = "runSession" ;
-    args[ 1 ] = "SALOME_Container" ;
-    args[ 2 ] = strdup( ContainerName ) ;
-    args[ 3 ] = strdup( _argv[ 2 ] ) ;
-    args[ 4 ] = strdup( _argv[ 3 ] ) ;
-    args[ 5 ] = NULL ;
-    MESSAGE("execl(" << anExe.c_str() << " , " << args[ 0 ] << " , "
-                     << args[ 1 ] << " , " << args[ 2 ] << " , " << args[ 3 ]
-                     << " , " << args[ 4 ] << ")") ;
-    int status = execv( anExe.c_str() , args ) ;
-    if (status == -1) {
-      INFOS("Engines_Container_i::start_impl execl failed (system command status -1)") ;
-      perror( "Engines_Container_i::start_impl execl error ") ;
-    }
-    else {
-      INFOS(machineName() << " Engines_Container_i::start_impl execl done");
-    }
-    exit(0) ;
-  }
-#endif
+  MESSAGE(machineName() << " Engines_Container_i::start_impl SALOME_Container launch done");
+
+//   pid_t pid = fork() ;
+//   if ( pid == 0 ) {
+//     string anExe( _argv[ 0 ] ) ;
+//     anExe += "runSession" ;
+//     char * args[ 6 ] ;
+//     args[ 0 ] = "runSession" ;
+//     args[ 1 ] = "SALOME_Container" ;
+//     args[ 2 ] = strdup( ContainerName ) ;
+//     args[ 3 ] = strdup( _argv[ 2 ] ) ;
+//     args[ 4 ] = strdup( _argv[ 3 ] ) ;
+//     args[ 5 ] = NULL ;
+//     MESSAGE("execl(" << anExe.c_str() << " , " << args[ 0 ] << " , "
+//                      << args[ 1 ] << " , " << args[ 2 ] << " , " << args[ 3 ]
+//                      << " , " << args[ 4 ] << ")") ;
+//     int status = execv( anExe.c_str() , args ) ;
+//     if (status == -1) {
+//       INFOS("Engines_Container_i::start_impl execl failed (system command status -1)") ;
+//       perror( "Engines_Container_i::start_impl execl error ") ;
+//     }
+//     else {
+//       INFOS(machineName() << " Engines_Container_i::start_impl execl done");
+//     }
+//     exit(0) ;
+//   }
 
   obj = Engines::Container::_nil() ;
   try {
@@ -274,14 +271,14 @@ Engines::Container_ptr Engines_Container_i::start_impl(
       obj = _NS->Resolve(cont.c_str());
       nilvar = CORBA::is_nil( obj ) ;
       if ( nilvar ) {
-        INFOS(count << ". " << machineName()
+        MESSAGE(count << ". " << machineName()
               << " start_impl unknown container " << cont.c_str());
         count -= 1 ;
       }
     }
     _numInstanceMutex.unlock() ;
     if ( !nilvar ) {
-      MESSAGE("start_impl container found after runSession(SALOME_Container)") ;
+      MESSAGE("start_impl container found after new launch of SALOME_Container") ;
     }
     return Engines::Container::_narrow(obj);
   }
@@ -292,7 +289,7 @@ Engines::Container_ptr Engines_Container_i::start_impl(
     INFOS(machineName() << "Caught unknown exception.");
   }
   _numInstanceMutex.unlock() ;
-  MESSAGE("start_impl container not found after runSession(SALOME_Container)") ;
+  MESSAGE("start_impl container not found after new launch of SALOME_Container") ;
   return Engines::Container::_nil() ;
 }
 
@@ -365,7 +362,7 @@ Engines::Component_ptr Engines_Container_i::load_impl( const char* nameToRegiste
     }
   }
   catch (...) {
-    MESSAGE( "Container_i::load_impl catched" ) ;
+    INFOS( "Container_i::load_impl catched" ) ;
   }
 
 //Jr  _numInstanceMutex.lock() ; // lock on the add on handle_map (necessary ?)
@@ -423,7 +420,7 @@ void ActSigIntHandler() {
     exit(0) ;
   }
   else {
-    INFOS(pthread_self() << "SigIntHandler activated") ;
+    MESSAGE(pthread_self() << "SigIntHandler activated") ;
   }
 }
 
@@ -437,7 +434,6 @@ void SigIntHandler(int what , siginfo_t * siginfo ,
           << "              si_pid   " << siginfo->si_pid) ;
   if ( _Sleeping ) {
     _Sleeping = false ;
-    INFOS("SigIntHandler END sleeping.")
     MESSAGE("SigIntHandler END sleeping.") ;
     return ;
   }
@@ -448,16 +444,26 @@ void SigIntHandler(int what , siginfo_t * siginfo ,
     }
     else {
       _Sleeping = true ;
-      INFOS("SigIntHandler BEGIN sleeping.")
       MESSAGE("SigIntHandler BEGIN sleeping.") ;
       int count = 0 ;
       while( _Sleeping ) {
         sleep( 1 ) ;
         count += 1 ;
       }
-      INFOS("SigIntHandler LEAVE sleeping after " << count << " s.")
       MESSAGE("SigIntHandler LEAVE sleeping after " << count << " s.") ;
     }
     return ;
   }
 }
+
+// Get the PID of the Container
+
+long Engines_Container_i::getPID() {
+    return(_pid);
+}
+
+// Get the hostName of the Container
+
+char* Engines_Container_i::getHostName() {
+    return((char*)(GetHostname().c_str()));
+}
index 77a06b9de0584040b723c7b8164e37168fb2b643..921c3ce26c2d3cb362e0164a3a6980dfc17d7299 100644 (file)
@@ -35,6 +35,7 @@
 #include <iostream>
 #include <string>
 #include "utilities.h"
+#include "Utils_CatchSignals.h"
 using namespace std;
 
 #ifdef CHECKTIME
@@ -198,8 +199,12 @@ int main(int argc, char* argv[])
       MESSAGE("SALOME_Registry_Server.cxx - orb->run()");
       timer.ShowAbsolute();
 #endif
+      Utils_CatchSignals aCatch;
+      aCatch.Activate();
+
       orb->run();
 
+      aCatch.Deactivate();
       orb->destroy();
     }
   catch(CORBA::SystemException&)
index 6444ef148dc70a8ef04cb63e819d057d1d57b351..d3d54ae13a63b18b32476673dfd928bd0ee50b96 100755 (executable)
@@ -83,11 +83,12 @@ class SALOME_ContainerPy_i (Engines__POA.Container):
             if container is None:
                 MESSAGE( "SALOME_ContainerPy_i::start_impl " + str(containerName) + ".object exists but is not a Container" )
             else :
-                MESSAGE( "SALOME_ContainerPy_i::start_impl " + str(ContainerName) + ".object found without runSession" )
+                MESSAGE( "SALOME_ContainerPy_i::start_impl " + str(ContainerName) + ".object found without new launch" )
             return container
         #shstr = os.getenv( "PWD" ) + "/"
         #shstr += "runSession ./SALOME_ContainerPy.py "
-        shstr = "runSession SALOME_ContainerPy.py "
+        shstr = os.getenv("KERNEL_ROOT_DIR") + "/bin/salome/SALOME_ContainerPy.py ";
+        #shstr = "runSession SALOME_ContainerPy.py "
         shstr += ContainerName
 
         # mpv: fix for SAL4731 - allways create new file to write log of server
index ee6e460d5e950d7b3ff61c94bd35d205dd3dec3d..bcb57ef2230bd300814a117b0a4c950c6837a004 100644 (file)
@@ -40,6 +40,8 @@
 #include <map>
 #include <string>
 
+using namespace std;
+
 class SALOME_NamingService;
 
 class Engines_Container_i: public POA_Engines::Container,
@@ -70,6 +72,8 @@ public:
   char* machineName();
   void ping();
   bool Kill_impl() ;
+  char* getHostName();
+  long getPID();
 
 protected:
 
@@ -88,6 +92,7 @@ private:
 
   int   _argc ;
   char** _argv ;
+  long _pid;
 
 };
 
index fdcdd0738c94e9a9b7bcc574b76a7f4f7983d6a9..1fb5f45e183ef4fb6c37402f11a2e0cac6267196 100644 (file)
 
 using namespace std;
 #include "SALOME_DataTypeCatalog_impl.hxx"
+#include "Utils_ExceptHandlers.hxx"
 #include <fstream>
 
+UNEXPECT_CATCH(DTC_NotFound, SALOME_DataTypeCatalog::NotFound);
+
 //----------------------------------------------------------------------
 // Function : SALOME_DataTypeCatalogImpl
 // Purpose  : Constructor 
@@ -103,7 +106,7 @@ SALOME_DataTypeCatalogImpl::isDerivedFrom(const char* type_in,
                                          const char* type_out)
                             throw(SALOME_DataTypeCatalog::NotFound)
 {
-  
+  Unexpect aCatch(DTC_NotFound);
   CORBA::Boolean _return_value = false ;
   bool _found_in = false;
   bool _found_out = false;
@@ -143,6 +146,7 @@ char*
 SALOME_DataTypeCatalogImpl::GetDataInterfaceRead(const char* type)
                             throw(SALOME_DataTypeCatalog::NotFound)
 {
+  Unexpect aCatch(DTC_NotFound);
   char* return_value = NULL;
   bool _find = false;
   for (unsigned int ind=0; ind < _datatype_list.size();ind++)
@@ -172,6 +176,7 @@ char*
 SALOME_DataTypeCatalogImpl::GetDataInterfaceWrite(const char* type)
                             throw(SALOME_DataTypeCatalog::NotFound)
 {
+  Unexpect aCatch(DTC_NotFound);
   char* return_value = NULL;
   bool _find = false;
   for (unsigned int ind=0; ind < _datatype_list.size();ind++)
@@ -199,6 +204,8 @@ SALOME_DataTypeCatalogImpl::GetDataInterfaceWrite(const char* type)
 SALOME_DataTypeCatalog::ListOfDataTypeName* 
 SALOME_DataTypeCatalogImpl::GetDataTypeParents(const char* type) throw(SALOME_DataTypeCatalog::NotFound)
 {
+  Unexpect aCatch(DTC_NotFound);
+
   bool _find = false ;
 
   SALOME_DataTypeCatalog::ListOfDataTypeName_var _list_data = 
@@ -347,7 +354,7 @@ SALOME_DataTypeCatalogImpl::_parseArguments(int argc, char **argv,
 
       if (strcmp(argv[ind],"-help") == 0)
        {
-         INFOS( "Usage: " << argv[0] << " -common 'path to data type catalog' -ORBInitRef NameService=corbaname::localhost");
+         MESSAGE( "Usage: " << argv[0] << " -common 'path to data type catalog' -ORBInitRef NameService=corbaname::localhost");
            _return_value = false ;
        }
       if (strcmp(argv[ind],"-common") == 0)
index 93aaa9d8e40bb50005bb3473a7774d51d6a9d551..f0fdad6e0b22160b0431fa2671e536d27a9c2f1f 100644 (file)
@@ -30,7 +30,7 @@
 using namespace SALOME;
 
 GenericObj_i::GenericObj_i(PortableServer::POA_ptr thePOA): myRefCounter(1){
-  INFOS("GenericObj_i::GenericObj_i() - this = "<<this<<
+  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();
@@ -46,13 +46,13 @@ PortableServer::POA_ptr GenericObj_i::_default_POA(){
 
 
 void GenericObj_i::Register(){
-  INFOS("GenericObj_i::Register "<<this<<"; myRefCounter = "<<myRefCounter)
+  MESSAGE("GenericObj_i::Register "<<this<<"; myRefCounter = "<<myRefCounter)
   ++myRefCounter;
 }
 
 
 void GenericObj_i::Destroy(){
-  INFOS("GenericObj_i::Destroy "<<this<<"; myRefCounter = "<<myRefCounter)
+  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 1e3b9c8966ee083ff60f68c103e9b43ff67b617e..c19e679654ca0c6656cfe6733629ee644778d400 100644 (file)
@@ -43,6 +43,8 @@ extern "C"
 #include "HDFfile.hxx"
 #include <string>
 
+using namespace std;
+
 class HDFConvert 
 {
 private:
index b23d321017c6aed7f7e762cd537509d800a80aec..5395341a82345dc2d24013dc38625bdc377035a6 100644 (file)
@@ -27,6 +27,8 @@
 /* Exception */
 #include <iostream>
 
+using namespace std;
+
 class HDFexception
 {
 public :
index 9c683e51fa762d32d7564980b78354e0d0ba8f75..fe19bfdffe2076dbfb39164187782c825f045903 100644 (file)
@@ -98,7 +98,8 @@ class LifeCycleCORBA:
 
     def ComputerPath(self, ComputerName ):
         try:
-            path = self._catalog.GetPathPrefix( ComputerName )
+            #path = self._catalog.GetPathPrefix( ComputerName )
+            path = os.getenv("KERNEL_ROOT_DIR") + "/bin/salome/"
         except SALOME_ModuleCatalog.NotFound, ex:
             path = ""
         return path
@@ -137,14 +138,14 @@ class LifeCycleCORBA:
                 else :
                     rshstr = "rsh -n " + theComputer + " "
                 path = self.ComputerPath( theComputer )
-                if path != "" :
-                    rshstr = rshstr + path + "/../bin/"
-                else :
-                    rshstr = rshstr + os.getenv( "SALOME_ROOT_DIR" ) + "/bin/"
+##                if path != "" :
+##                    rshstr = rshstr + path + "/../bin/"
+##                else :
+##                    rshstr = rshstr + os.getenv( "KERNEL_ROOT_DIR" ) + "/bin/"
                 if theContainer == "FactoryServer" :
-                    rshstr = rshstr + "./runSession ./SALOME_Container "
+                    rshstr = rshstr + path + "SALOME_Container "
                 else :
-                    rshstr = rshstr + "./runSession ./SALOME_ContainerPy.py '"
+                    rshstr = rshstr + path + "SALOME_ContainerPy.py '"
                 rshstr = rshstr + theContainer + " -"
                omniORBcfg = os.getenv( "OMNIORB_CONFIG" )
                 file = os.open( omniORBcfg , os.O_RDONLY )
@@ -177,7 +178,7 @@ class LifeCycleCORBA:
                     return aContainer
             
         return  aContainer       
-        #os.system("rsh -n dm2s0017 /export/home/SALOME_ROOT/bin/runSession SALOME_Container -ORBInitRef NameService=corbaname::dm2s0017:1515")
+        #os.system("rsh -n dm2s0017 /export/home/KERNEL_ROOT/bin/runSession SALOME_Container -ORBInitRef NameService=corbaname::dm2s0017:1515")
 
     #-------------------------------------------------------------------------
 
index 844d024481f9133f89a0fd2891b6365c9d5d44d0..e86b0c0a11ef1c1c4e92ff9302068804f17fab86 100644 (file)
@@ -99,7 +99,7 @@ string SALOME_LifeCycleCORBA::ComputerPath(
     path = Catalog->GetPathPrefix( theComputer );
   }
   catch (SALOME_ModuleCatalog::NotFound&) {
-    MESSAGE("GetPathPrefix(" << theComputer << ") not found!");
+    INFOS("GetPathPrefix(" << theComputer << ") not found!");
     path = "" ;
   }
   SCRUTE( path ) ;
@@ -209,10 +209,10 @@ Engines::Container_var SALOME_LifeCycleCORBA::FindOrStartContainer(
       SCRUTE( rsh );
       int status = system( rsh.c_str() ) ;
       if (status == -1) {
-        INFOS("SALOME_LifeCycleCORBA::StartOrFindContainer rsh failed (system command status -1)") ;
+        MESSAGE("SALOME_LifeCycleCORBA::StartOrFindContainer rsh failed (system command status -1)") ;
       }
       else if (status == 217) {
-        INFOS("SALOME_LifeCycleCORBA::StartOrFindContainer rsh failed (system command status 217)") ;
+        MESSAGE("SALOME_LifeCycleCORBA::StartOrFindContainer rsh failed (system command status 217)") ;
       }
       else {
         int count = 21 ;
@@ -224,7 +224,7 @@ Engines::Container_var SALOME_LifeCycleCORBA::FindOrStartContainer(
           aFactoryServer = FindContainer( FactoryServer.c_str() ) ;
        }
         if ( CORBA::is_nil( aFactoryServer ) ) {
-          INFOS("SALOME_LifeCycleCORBA::StartOrFindContainer rsh failed") ;
+          MESSAGE("SALOME_LifeCycleCORBA::StartOrFindContainer rsh failed") ;
        }
         else if ( strcmp( theComputer.c_str() , GetHostname().c_str() ) ) {
           _FactoryServer = aFactoryServer ;
@@ -367,14 +367,14 @@ Engines::Component_var SALOME_LifeCycleCORBA::FindOrLoad_Component
            }
          catch (SALOME_ModuleCatalog::NotFound&)
            {
-             MESSAGE("GetPathPrefix(" << machine << ") not found!"
+             INFOS("GetPathPrefix(" << machine << ") not found!"
                      << "trying localhost");
              try {
                 path = compoInfo->GetPathPrefix("localhost") ;
                 path += "/" ;
              }
              catch (SALOME_ModuleCatalog::NotFound&) {
-               MESSAGE("GetPathPrefix(localhost) not found!") ;
+               INFOS("GetPathPrefix(localhost) not found!") ;
                 path = "" ;
              }
            }
index b80547c9d3a88deeaa30b38ee4abc622e8da26cb..812a04e8d7de48d19d4e60e0cc3301a378bd68a7 100644 (file)
@@ -50,7 +50,7 @@ static QString findFile( QString filename );
 static QString addSlash( const QString& path );
 
 InquireServersGUI::InquireServersGUI()
-     : QVBox(0, "SFA splash", Qt::WDestructiveClose | Qt::WStyle_Customize | Qt::WStyle_NoBorder )
+     : QVBox(0, "SFA splash", Qt::WDestructiveClose | Qt::WStyle_Customize | Qt::WStyle_NoBorder | WType_TopLevel | WStyle_StaysOnTop | WX11BypassWM  )
 {
   myGUI = false;
   myThread = new InquireServersQThread(this);
index ab30f3379d505bce3e1bfa47c813b6ac5d2f87fa..fd507c7c744e69ecad69862f1571d2a5862af930 100644 (file)
@@ -15,7 +15,8 @@ import time
 import os
 
 trace="local"
-if (os.environ["SALOME_trace"] == "with_logger"):
+if (os.environ.has_key("SALOME_trace")):
+  if (os.environ["SALOME_trace"] == "with_logger"):
     trace="logger"
 
 class SALOME_Trace :
index 8201d24f0bccedbf96587b27031907cca51d6d47..22ba51053497cb1bcafe0af1c44a28c0ec562c31 100644 (file)
@@ -95,8 +95,8 @@ Engines::Component_ptr MPIContainer_i::load_impl(const char* nameToRegister,
   MESSAGE("[" << _numproc << "] absolute_impl_name=" << absolute_impl_name);
   void * handle = dlopen(absolute_impl_name.c_str(), RTLD_LAZY);
   if(!handle){
-    INFOS("[" << _numproc << "] Can't load shared library : " << absolute_impl_name);
-    INFOS("[" << _numproc << "] error dlopen: " << dlerror());
+    MESSAGE("[" << _numproc << "] Can't load shared library : " << absolute_impl_name);
+    MESSAGE("[" << _numproc << "] error dlopen: " << dlerror());
     return Engines::Component::_nil() ;
   }
 
index f35650e424aae48b820a39d744966c8a9dfb80bd..ef5ce55e68248f7155461e853b5dbaada29757d4 100644 (file)
@@ -33,7 +33,7 @@ VPATH=.:@srcdir@
 @COMMENCE@
 
 SUBDIRS = MSG2QM SALOMELocalTrace Logger SALOMELogger Utils PatchQt \
-          GenericObj NamingService Registry \
+          GenericObj MEDWrapper NamingService Registry \
          ModuleCatalog DataTypeCatalog RessourcesCatalog \
           Notification  NOTIFICATION_SWIG \
          Container TestContainer LifeCycleCORBA HDFPersist \
index 35e5c2e3e49beef18b9ef8b721741cd41bb1a4b8..7513f9a669099f7809efe2c34234e7cb9d6a85d3 100644 (file)
@@ -29,6 +29,9 @@
 using namespace std;
 #include "SALOME_ModuleCatalog_Acomponent_impl.hxx"
 
+#include "Utils_ExceptHandlers.hxx"
+UNEXPECT_CATCH(MC_NotFound, SALOME_ModuleCatalog::NotFound);
+
 //----------------------------------------------------------------------
 // Function : SALOME_ModuleCatalog_AcomponentImpl
 // Purpose  : Constructor
@@ -45,7 +48,8 @@ SALOME_ModuleCatalog_AcomponentImpl::SALOME_ModuleCatalog_AcomponentImpl(
                   CORBA::Boolean componentmultistudy,
                   const char* icone,
                   SALOME_ModuleCatalog::ListOfDefInterface list_interfaces,
-                  ListOfPathPrefix pathes)
+                  ListOfPathPrefix pathes,
+                  CORBA::Boolean implementationtype)
 {
   MESSAGE("Component creation")
   // Affect component name
@@ -65,6 +69,9 @@ SALOME_ModuleCatalog_AcomponentImpl::SALOME_ModuleCatalog_AcomponentImpl(
  
  // Affect component multistudy
  _componentmultistudy = componentmultistudy;
+ // Affect component implementation
+ _implementationtype = implementationtype;
 
  // Affect icone
  _icone =new char[strlen(icone)+1];
@@ -125,6 +132,7 @@ SALOME_ModuleCatalog::DefinitionInterface*
 SALOME_ModuleCatalog_AcomponentImpl::GetInterface(const char* interfacename)
                                      throw(SALOME_ModuleCatalog::NotFound)
 {
+  Unexpect aCatch( MC_NotFound );
   SALOME_ModuleCatalog::DefinitionInterface_var _interface = new SALOME_ModuleCatalog::DefinitionInterface;
   SALOME_ModuleCatalog::Service_var _service = new SALOME_ModuleCatalog::Service;
   // Variables initialisation
@@ -184,6 +192,7 @@ SALOME_ModuleCatalog::ListOfServices*
 SALOME_ModuleCatalog_AcomponentImpl::GetServiceList(const char* interfacename)
                                      throw(SALOME_ModuleCatalog::NotFound)
 {
+  Unexpect aCatch( MC_NotFound );
   SALOME_ModuleCatalog::ListOfServices_var _list = new SALOME_ModuleCatalog::ListOfServices;
 
   // Variables initialisation
@@ -235,6 +244,7 @@ SALOME_ModuleCatalog_AcomponentImpl::GetService(const char* interfacename,
                                                const char* servicename) 
                                      throw(SALOME_ModuleCatalog::NotFound)
 {
+  Unexpect aCatch( MC_NotFound );
   SALOME_ModuleCatalog::Service_var _service = new SALOME_ModuleCatalog::Service;
   // Varaibles initialisation
   bool _find = false ;
@@ -287,6 +297,7 @@ SALOME_ModuleCatalog::Service*
 SALOME_ModuleCatalog_AcomponentImpl::GetDefaultService(const char* interfacename) 
                                      throw(SALOME_ModuleCatalog::NotFound)
 {
+  Unexpect aCatch( MC_NotFound );
   SALOME_ModuleCatalog::Service_var _service = new SALOME_ModuleCatalog::Service;
 
   // Variables initialisation
@@ -339,6 +350,7 @@ SALOME_ModuleCatalog_AcomponentImpl::GetPathPrefix(const char* machinename)
                                      throw(SALOME_ModuleCatalog::NotFound)
 {
   MESSAGE("Begin of GetPathPrefix")
+  Unexpect aCatch( MC_NotFound );
   // Variables initialisation
   char* _path = NULL;
   bool _find = false ;
@@ -413,6 +425,15 @@ CORBA::Boolean SALOME_ModuleCatalog_AcomponentImpl::multistudy()
   return _componentmultistudy ;
 }
 
+//----------------------------------------------------------------------
+// Function : implementation type
+// Purpose  : define if a component is implemeted in C++ or Python
+//----------------------------------------------------------------------
+CORBA::Boolean SALOME_ModuleCatalog_AcomponentImpl::implementation_type()
+{
+  return _implementationtype ;
+}
+
 //----------------------------------------------------------------------
 // Function : component_type
 // Purpose  : define the type of the component
@@ -445,6 +466,8 @@ SALOME_ModuleCatalog_AcomponentImpl::_duplicate_service(SALOME_ModuleCatalog::Se
   _service->ServiceName = CORBA::string_dup(service.ServiceName);
   // service by default
   _service->Servicebydefault = service.Servicebydefault;
+  // type of node
+  _service->TypeOfNode = service.TypeOfNode;
 
   // in Parameters service
   unsigned int _length_in_param = service.ServiceinParameter.length();
index 0a7c715d5d4b3c49c890e7723c11de383b64d163..40d202307a860549245806cd84b5d9e2443583ea 100644 (file)
@@ -46,7 +46,8 @@ public:
                                      CORBA::Boolean componentmultistudy,
                                      const char* icone,
                                      SALOME_ModuleCatalog::ListOfDefInterface list_interfaces,
-                                     ListOfPathPrefix pathes);
+                                     ListOfPathPrefix pathes,
+                                     CORBA::Boolean implementationtype);
 
   //! standard destructor
   virtual ~SALOME_ModuleCatalog_AcomponentImpl();
@@ -141,6 +142,12 @@ public:
   */
   virtual char* component_icone();
 
+  //! method to define if a component is implemented in C++ or Python
+  /*!
+    \return true if it's C++ component 
+  */
+  virtual CORBA::Boolean implementation_type();
+
 private :
   char* _component_name ;
   char* _component_user_name ;
@@ -148,6 +155,7 @@ private :
   char* _icone;
   SALOME_ModuleCatalog::ComponentType _componenttype;
   CORBA::Boolean _componentmultistudy;
+  CORBA::Boolean _implementationtype;
   SALOME_ModuleCatalog::ListOfDefInterface _list_interfaces;
   ListOfPathPrefix _pathes ;
   
index 8f8f0e241dc6c2b909af630a0224c2c824496d78..fa8d3f749c929df8da239ede0df45bb36986a40b 100644 (file)
@@ -48,12 +48,15 @@ SALOME_ModuleCatalog_Handler::SALOME_ModuleCatalog_Handler()
   test_component_type = "component-type" ;
   test_component_multistudy="component-multistudy";
   test_component_icone="component-icone" ;
+  test_component_impltype="component-impltype";
 
   test_interface_name = "component-interface-name" ;
   
   test_service_name = "service-name";
   test_defaultservice = "service-by-default";
 
+  test_typeofnode = "type-of-node";
+
   test_inParameter_type="inParameter-type";
   test_inParameter_name="inParameter-name";
   test_inParameter="inParameter";
@@ -189,6 +192,10 @@ bool SALOME_ModuleCatalog_Handler::endElement(const QString&,
   if((qName.compare(QString(test_component_multistudy))==0)) 
     _amodule.Parsercomponentmultistudy = atoi(content.c_str()) ;
 
+   // tag test_component_impltype
+  if((qName.compare(QString(test_component_impltype))==0)) 
+    _amodule.Parsercomponentimpltype = atoi(content.c_str()) ;
+
   // tag test_component_icone
   if((qName.compare(QString(test_component_icone))==0)) 
     _amodule.Parsercomponenticone = content ;
@@ -209,6 +216,10 @@ bool SALOME_ModuleCatalog_Handler::endElement(const QString&,
    if((qName.compare(QString(test_defaultservice))==0))
      _aService.ParserServicebydefault = atoi(content.c_str()) ;
 
+   //tag test_typeofnode
+   if((qName.compare(QString(test_typeofnode))==0))
+     _aService.ParserTypeOfNode = atoi(content.c_str()) ;
+
    // Parameter in
 
    // tag test_inParameter_type
@@ -268,6 +279,7 @@ bool SALOME_ModuleCatalog_Handler::endElement(const QString&,
 
        // Empty temporary structures
        _aService.ParserServiceName = "";
+       _aService.ParserTypeOfNode = 1;
        _aService.ParserServiceinParameter.resize(0);
        _aService.ParserServiceoutParameter.resize(0);
      }
index c12c49cef7c9a83b8dca8839515c98346673d74c..48c9e1cb390db5d7675b797efa1f96ab46d4c5ba 100644 (file)
@@ -115,11 +115,13 @@ private:
   const char* test_component_type ;
   const char* test_component_multistudy ;
   const char* test_component_icone ;
+  const char* test_component_impltype ;
 
   const char* test_interface_name;
 
   const char* test_service_name;
   const char* test_defaultservice;
+  const char* test_typeofnode;
 
   const char* test_inParameter_type;
   const char* test_inParameter_name;
index 236763abb839a78225953a758ce0b64fc2f30701..654b8fb0f6fd436dcbe7a257b56f6e8c93c543fb 100644 (file)
@@ -57,6 +57,7 @@ struct ParserService
   ListOfParserServicesParameter ParserServiceinParameter;
   ListOfParserServicesParameter ParserServiceoutParameter;
   bool                          ParserServicebydefault;
+  bool                          ParserTypeOfNode;
 } ;
 
 typedef vector<ParserService> ListOfParserServices ;
@@ -78,6 +79,7 @@ struct ParserComponent
   string Parsercomponenticone;
   ListOfDefinitionInterface ParserListInterface;
   string Parserconstraint ;
+  bool Parsercomponentimpltype ;
 };
 
 typedef vector<ParserComponent> ListOfParserComponent ;
index c206cc8463dcb7b18facf19dc7c41a7447ea5fb2..85104043aacb1f2c109146872ade4865221be0aa 100644 (file)
@@ -88,7 +88,7 @@ int main(int argc,char **argv)
            }
          catch( CORBA::COMM_FAILURE& )
            {
-             MESSAGE( "Module Catalog Server: CORBA::COMM_FAILURE: Unable to contact the Naming Service" );
+             INFOS( "Module Catalog Server: CORBA::COMM_FAILURE: Unable to contact the Naming Service" );
            }
          if (!CORBA::is_nil(theObj))
            {
@@ -109,11 +109,11 @@ int main(int argc,char **argv)
                            object = inc->resolve(name);}
                          catch(CosNaming::NamingContext::NotFound)
                            {
-                             MESSAGE( "Logger Server wasn't found" );
+                             INFOS( "Logger Server wasn't found" );
                            }
                          catch(...)
                            {
-                             MESSAGE( "Module Catalog Server: Unknown exception" ) ;
+                             INFOS( "Module Catalog Server: Unknown exception" ) ;
                            }
                          if (!CORBA::is_nil(object))
                            {
index 9f912a7d3b4f430c6e9ccfac9a38999c055a39d6..04efd42442a926d82500d38bc78bf89f8a464490 100644 (file)
@@ -399,6 +399,7 @@ SALOME_ModuleCatalogImpl::GetComponent(const char* componentname)
   CORBA::Boolean _componentmultistudy = false ; // default initialisation
   ListOfPathPrefix _pathes ;
   _pathes.resize(0);
+  CORBA::Boolean _implementationtype = true ; // default initialisation
   
 
   bool find = false ;
@@ -464,6 +465,8 @@ SALOME_ModuleCatalogImpl::GetComponent(const char* componentname)
          // get pathes prefix
          _pathes = duplicate_pathes(_personal_path_list);
 
+         // get implementation type
+         _implementationtype = _personal_module_list[ind].Parsercomponentimpltype;
        }
     }
   
@@ -477,7 +480,8 @@ SALOME_ModuleCatalogImpl::GetComponent(const char* componentname)
                                                _componentmultistudy,
                                                _icone,
                                                _list_interfaces,
-                                               _pathes);
+                                               _pathes,
+                                               _implementationtype);
       
       compo = aComponentImpl->_this();
     }
@@ -528,6 +532,9 @@ SALOME_ModuleCatalogImpl::GetComponent(const char* componentname)
              // get component multistudy
              _componentmultistudy = _general_module_list[ind].Parsercomponentmultistudy ;
 
+             // get implementation type
+             _implementationtype = _general_module_list[ind].Parsercomponentimpltype ;
+
              // get component icone
              _icone = CORBA::string_dup(_general_module_list[ind].Parsercomponenticone.c_str());
 
@@ -552,7 +559,8 @@ SALOME_ModuleCatalogImpl::GetComponent(const char* componentname)
                                                    _componentmultistudy,
                                                    _icone,
                                                    _list_interfaces,
-                                                   _pathes);
+                                                   _pathes,
+                                                   _implementationtype);
       
          compo = aComponentImpl->_this();
        }
@@ -623,6 +631,10 @@ SALOME_ModuleCatalogImpl::duplicate_interfaces(ListOfDefinitionInterface list_in
          _list_interfaces[ind].interfaceservicelist[ind1].Servicebydefault =
            list_interface[ind].Parserinterfaceservicelist[ind1].ParserServicebydefault;
 
+         // duplicate type of node
+         _list_interfaces[ind].interfaceservicelist[ind1].TypeOfNode =
+           list_interface[ind].Parserinterfaceservicelist[ind1].ParserTypeOfNode;
+
          // duplicate in Parameters
          unsigned int _length_in_param = list_interface[ind].Parserinterfaceservicelist[ind1].ParserServiceinParameter.size();
          _list_interfaces[ind].interfaceservicelist[ind1].ServiceinParameter.length(_length_in_param);
@@ -740,7 +752,7 @@ SALOME_ModuleCatalogImpl::_parseArguments(int argc, char **argv,
 
       if (strcmp(argv[ind],"-help") == 0)
        {
-         INFOS( "Usage: " << argv[0] << " -common 'path to general catalog' -personal 'path to personal catalog' -ORBInitRef NameService=corbaname::localhost");
+         MESSAGE( "Usage: " << argv[0] << " -common 'path to general catalog' -personal 'path to personal catalog' -ORBInitRef NameService=corbaname::localhost");
            _return_value = false ;
        }
       if (strcmp(argv[ind],"-common") == 0)
index 1743563c6d3b9773ce1666a2d6b5159d95d2023c..09f777f7d53aa3356e24c238f31968e4be5aaf95 100644 (file)
@@ -36,7 +36,8 @@ common_data={"AUTHOR"     : "",
              "COMP_TYPE"  : "",
              "COMP_NAME"  : "",
              "COMP_UNAME" : "",
-             "COMP_MULT"  : ""
+             "COMP_MULT"  : "",
+             "COMP_IMPL"  : ""
              }
 
 nb_components = 0
@@ -237,6 +238,7 @@ class Service(Tree):
         self.addNamedChild('service-version',common_data["VERSION"])
         self.addNamedChild('service-comment', comment)
         self.addNamedChild('service-by-default', "0")
+        self.addNamedChild('type-of-node', "1")
         self.addNamedChild('inParameter-list')
         self.addNamedChild('outParameter-list')
             
@@ -394,6 +396,7 @@ class Component(Tree):
         self.addNamedChild('component-version',    common_data["VERSION"])
         self.addNamedChild('component-comment',    'unknown')
         self.addNamedChild('component-multistudy', common_data["COMP_MULT"])
+        self.addNamedChild('component-impltype', common_data["COMP_IMPL"])
         self.addNamedChild('component-icone',      common_data["ICON"])
         self.addNamedChild('constraint')
         self.addNamedChild('component-interface-list')
@@ -665,6 +668,7 @@ def run(tree, args):
     common_data["COMP_UNAME"] = getParamValue("username",   "",                args)
     common_data["COMP_TYPE"]  = getParamValue("type",       "OTHER",           args)
     common_data["COMP_MULT"]  = getParamValue("multistudy", "1",               args)
+    common_data["COMP_IMPL"]  = getParamValue("impltype",   "1",               args)
 
     print common_data
     
index c5b46c91fc784ed3e7f59af590e61d8af5595aed..34c4a62da6368d612e96e5d6a809f997addcddf3 100644 (file)
@@ -70,8 +70,8 @@ ou <n> vaut 1, 1b, 2, 3, 4, 5
 
 
 Les scripts de test se trouvent dans le repertoire 
-        <SALOME_ROOT>/SALOME/src/ModuleGenerator/tests
+        <KERNEL_SRC>/src/ModuleGenerator/tests
 
 Les fichiers idl servant aux tests se trouvent dans les repertoires 
-        <SALOME_ROOT>/idl
-        <SALOME_ROOT>/SALOME/src/ModuleGenerator/tests
+        <KERNEL_SRC>/idl
+        <KERNEL_SRC>/src/ModuleGenerator/tests
index c4865c196ba759a4d4f49d11eaed14b22d7cf323..6fe58e93c9f4aaae868976edb10da92ae7409646 100644 (file)
@@ -183,7 +183,7 @@ void SALOME_NamingService::Register(CORBA::Object_ptr ObjRef,
                      _temp_context =
                        _current_context->bind_new_context(_context_name);
                      _current_context = _temp_context;
-                     //MESSAGE("This context was'nt created, it's now done");
+                     //INFOS("This context was'nt created, it's now done");
                    }
                }
            }
@@ -456,7 +456,7 @@ bool SALOME_NamingService::Create_Directory(const char* Path)
              _temp_context =
                _current_context->bind_new_context(_context_name);
              _current_context = _temp_context;
-             MESSAGE("This context was'nt created, it's now done");
+             INFOS("This context was'nt created, it's now done");
                }
        }
     }
@@ -563,31 +563,31 @@ bool SALOME_NamingService::Change_Directory(const char* Path)
          _return_code = false;
          CosNaming::Name n = ex.rest_of_name;
          if (ex.why == CosNaming::NamingContext::missing_node)
-           MESSAGE( "Change_Directory() : " << (char *) n[0].id
+           INFOS( "Change_Directory() : " << (char *) n[0].id
                  << " (" << (char *) n[0].kind << ") not found")
          if (ex.why == CosNaming::NamingContext::not_context)
-           MESSAGE("Change_Directory() : " << (char *) n[0].id
+           INFOS("Change_Directory() : " << (char *) n[0].id
                 << " (" << (char *) n[0].kind
                 << ") is not a context" )
          if (ex.why == CosNaming::NamingContext::not_object)
-           MESSAGE( "Change_Directory() : " << (char *) n[0].id
+           INFOS( "Change_Directory() : " << (char *) n[0].id
                 << " (" << (char *) n[0].kind
                 << ") is not an object" )
        }
       catch(CosNaming::NamingContext::CannotProceed&)
        {
          _return_code = false;
-         MESSAGE( "!!!Change_Directory() : CosNaming::NamingContext::CannotProceed" )
+         INFOS( "!!!Change_Directory() : CosNaming::NamingContext::CannotProceed" )
        } 
       catch(CosNaming::NamingContext::InvalidName&) 
        {
          _return_code = false;
-         MESSAGE( "!!!Change_Directory() : CosNaming::NamingContext::InvalidName" )
+         INFOS( "!!!Change_Directory() : CosNaming::NamingContext::InvalidName" )
        }
       catch(CORBA::COMM_FAILURE&)
        {
          _return_code = false;
-         MESSAGE( "!!!Change_Directory() :CORBA::COMM_FAILURE : unable to contact"
+         INFOS( "!!!Change_Directory() :CORBA::COMM_FAILURE : unable to contact"
               << "the naming service")
          throw ServiceUnreachable();
        }
@@ -631,7 +631,7 @@ char* SALOME_NamingService::Current_Directory()
     }
   catch(CORBA::COMM_FAILURE&)
     {
-      MESSAGE("!!!Current_Directory(): CORBA::COMM_FAILURE : unable to contact"
+      INFOS("!!!Current_Directory(): CORBA::COMM_FAILURE : unable to contact"
           << " the naming service" )
       throw ServiceUnreachable();
     }
@@ -685,7 +685,7 @@ void SALOME_NamingService::list()
        }
       catch (ServiceUnreachable&)
        {
-         MESSAGE( "!!!list(): ServiceUnreachable" )
+         INFOS( "!!!list(): ServiceUnreachable" )
          throw ServiceUnreachable(); 
        }
 
@@ -777,28 +777,28 @@ void SALOME_NamingService::Destroy_Name(const char* Path)
        {
          CosNaming::Name n = ex.rest_of_name;
          if (ex.why == CosNaming::NamingContext::missing_node)
-           MESSAGE(  "Destroy_Name() : " << (char *) n[0].id
+           INFOS(  "Destroy_Name() : " << (char *) n[0].id
                  << " (" << (char *) n[0].kind << ") not found" )
          if (ex.why == CosNaming::NamingContext::not_context)
-           MESSAGE( "Destroy_Name() : " << (char *) n[0].id
+           INFOS( "Destroy_Name() : " << (char *) n[0].id
                 << " (" << (char *) n[0].kind
                 << ") is not a context" )
          if (ex.why == CosNaming::NamingContext::not_object)
-           MESSAGE( "Destroy_Name() : " << (char *) n[0].id
+           INFOS( "Destroy_Name() : " << (char *) n[0].id
                 << " ("  << (char *) n[0].kind
                 << ") is not an object" )
        } 
       catch (CosNaming::NamingContext::InvalidName &) 
        {
-         MESSAGE( "!!!Destroy_Name() : CosNaming::NamingContext::InvalidName" )
+         INFOS( "!!!Destroy_Name() : CosNaming::NamingContext::InvalidName" )
        }
       catch (CosNaming::NamingContext::CannotProceed &)
        {
-         MESSAGE( "!!!Destroy_Name(): CosNaming::NamingContext::CannotProceed" )
+         INFOS( "!!!Destroy_Name(): CosNaming::NamingContext::CannotProceed" )
        }
       catch(CORBA::COMM_FAILURE&)
        {
-         MESSAGE( "!!!Destroy_Name() : CORBA::COMM_FAILURE : unable to contact"
+         INFOS( "!!!Destroy_Name() : CORBA::COMM_FAILURE : unable to contact"
               << " the naming service")
          throw ServiceUnreachable();
        }
@@ -821,28 +821,28 @@ void SALOME_NamingService::Destroy_Name(const char* Path)
     {
       CosNaming::Name n = ex.rest_of_name;
       if (ex.why == CosNaming::NamingContext::missing_node)
-       MESSAGE(  "Destroy_Name() : " << (char *) n[0].id
+       INFOS(  "Destroy_Name() : " << (char *) n[0].id
              << " (" << (char *) n[0].kind << ") not found" )
       if (ex.why == CosNaming::NamingContext::not_context)
-       MESSAGE( "Destroy_Name() : " << (char *) n[0].id
+       INFOS( "Destroy_Name() : " << (char *) n[0].id
             << " (" << (char *) n[0].kind
             << ") is not a context" )
       if (ex.why == CosNaming::NamingContext::not_object)
-       MESSAGE( "Destroy_Name() : " << (char *) n[0].id
+       INFOS( "Destroy_Name() : " << (char *) n[0].id
             << " ("  << (char *) n[0].kind
             << ") is not an object" )
     }
   catch(CosNaming::NamingContext::CannotProceed&)
     {
-      MESSAGE( "!!!Destroy_Name() : CosNaming::NamingContext::CannotProceed")
+      INFOS( "!!!Destroy_Name() : CosNaming::NamingContext::CannotProceed")
     } 
   catch(CosNaming::NamingContext::InvalidName&) 
     {
-      MESSAGE( "!!!Destroy_Name() : CosNaming::NamingContext::InvalidName")
+      INFOS( "!!!Destroy_Name() : CosNaming::NamingContext::InvalidName")
     }
   catch(CORBA::COMM_FAILURE&)
     {
-      MESSAGE( "!!!Destroy_Name() :CORBA::COMM_FAILURE : unable to contact" 
+      INFOS( "!!!Destroy_Name() :CORBA::COMM_FAILURE : unable to contact" 
           << " the naming service") 
       throw ServiceUnreachable();
     }
@@ -900,28 +900,28 @@ void SALOME_NamingService::Destroy_Directory(const char* Path)
        {
          CosNaming::Name n = ex.rest_of_name;
          if (ex.why == CosNaming::NamingContext::missing_node)
-           MESSAGE(  "Destroy_Directory() : " << (char *) n[0].id
+           INFOS(  "Destroy_Directory() : " << (char *) n[0].id
                  << " (" << (char *) n[0].kind << ") not found")
          if (ex.why == CosNaming::NamingContext::not_context)
-           MESSAGE( "Destroy_Directory() : " << (char *) n[0].id
+           INFOS( "Destroy_Directory() : " << (char *) n[0].id
                 << " (" << (char *) n[0].kind
                 << ") is not a context" )
          if (ex.why == CosNaming::NamingContext::not_object)
-           MESSAGE( "Destroy_Directory() : " << (char *) n[0].id
+           INFOS( "Destroy_Directory() : " << (char *) n[0].id
                 << " ("  << (char *) n[0].kind
                 << ") is not an object" )
        } 
       catch (CosNaming::NamingContext::InvalidName &) 
        {
-         MESSAGE( "!!!Destroy_Directory() : CosNaming::NamingContext::InvalidName" )
+         INFOS( "!!!Destroy_Directory() : CosNaming::NamingContext::InvalidName" )
        }
       catch (CosNaming::NamingContext::CannotProceed &)
        {
-         MESSAGE("!!!Destroy_Directory(): CosNaming::NamingContext::CannotProceed" )
+         INFOS("!!!Destroy_Directory(): CosNaming::NamingContext::CannotProceed" )
        }
       catch(CORBA::COMM_FAILURE&)
        {
-         MESSAGE( "!!!Destroy_Directory() : CORBA::COMM_FAILURE : unable to contact"
+         INFOS( "!!!Destroy_Directory() : CORBA::COMM_FAILURE : unable to contact"
               << " the naming service" )
          throw ServiceUnreachable();
        }
@@ -944,28 +944,28 @@ void SALOME_NamingService::Destroy_Directory(const char* Path)
     {
       CosNaming::Name n = ex.rest_of_name;
       if (ex.why == CosNaming::NamingContext::missing_node)
-       MESSAGE(  "Destroy_Directory() : " << (char *) n[0].id
+       INFOS(  "Destroy_Directory() : " << (char *) n[0].id
              << " (" << (char *) n[0].kind << ") not found" )
       if (ex.why == CosNaming::NamingContext::not_context)
-       MESSAGE( "Destroy_Directory() : " << (char *) n[0].id
+       INFOS( "Destroy_Directory() : " << (char *) n[0].id
             << " (" << (char *) n[0].kind
             << ") is not a context" )
       if (ex.why == CosNaming::NamingContext::not_object)
-       MESSAGE( "Destroy_Directory() : " << (char *) n[0].id
+       INFOS( "Destroy_Directory() : " << (char *) n[0].id
             << " ("  << (char *) n[0].kind
             << ") is not an object" )
     } 
   catch (CosNaming::NamingContext::InvalidName &) 
     {
-      MESSAGE( "!!!Destroy_Directory() : CosNaming::NamingContext::InvalidName" )
+      INFOS( "!!!Destroy_Directory() : CosNaming::NamingContext::InvalidName" )
     }
   catch (CosNaming::NamingContext::CannotProceed &)
     {
-      MESSAGE( "!!!Destroy_Directory(): CosNaming::NamingContext::CannotProceed" )
+      INFOS( "!!!Destroy_Directory(): CosNaming::NamingContext::CannotProceed" )
     }
   catch(CORBA::COMM_FAILURE&)
     {
-      MESSAGE( "!!!Destroy_Directory() : CORBA::COMM_FAILURE : unable to contact"
+      INFOS( "!!!Destroy_Directory() : CORBA::COMM_FAILURE : unable to contact"
           << " the naming service" )
       throw ServiceUnreachable();
     }
@@ -979,12 +979,12 @@ void SALOME_NamingService::Destroy_Directory(const char* Path)
     }
   catch(CosNaming::NamingContext::NotEmpty&)
     {
-      MESSAGE( "!!!Destroy_Directory() : CosNaming::NamingContext::NoEmpty "
+      INFOS( "!!!Destroy_Directory() : CosNaming::NamingContext::NoEmpty "
           << Path << " is not empty" )
     } 
   catch(CORBA::COMM_FAILURE&)
     {
-      MESSAGE( "!!!Destroy_Directory() :CORBA::COMM_FAILURE : "
+      INFOS( "!!!Destroy_Directory() :CORBA::COMM_FAILURE : "
           << "unable to contact the naming service") 
       throw ServiceUnreachable();
     }
@@ -999,28 +999,28 @@ void SALOME_NamingService::Destroy_Directory(const char* Path)
     {
       CosNaming::Name n = ex.rest_of_name;
       if (ex.why == CosNaming::NamingContext::missing_node)
-       MESSAGE(  "Destroy_Directory() : " << (char *) n[0].id
+       INFOS(  "Destroy_Directory() : " << (char *) n[0].id
              << " (" << (char *) n[0].kind << ") not found" )
       if (ex.why == CosNaming::NamingContext::not_context)
-       MESSAGE( "Destroy_Directory() : " << (char *) n[0].id
+       INFOS( "Destroy_Directory() : " << (char *) n[0].id
             << " (" << (char *) n[0].kind
             << ") is not a context" )
       if (ex.why == CosNaming::NamingContext::not_object)
-       MESSAGE( "Destroy_Directory() : " << (char *) n[0].id
+       INFOS( "Destroy_Directory() : " << (char *) n[0].id
             << " ("  << (char *) n[0].kind
             << ") is not an object" )
     }
   catch(CosNaming::NamingContext::CannotProceed&)
     {
-      MESSAGE( "!!!Destroy_Directory() : CosNaming::NamingContext::CannotProceed")
+      INFOS( "!!!Destroy_Directory() : CosNaming::NamingContext::CannotProceed")
     } 
   catch(CosNaming::NamingContext::InvalidName&) 
     {
-      MESSAGE( "!!!Destroy_Directory() : CosNaming::NamingContext::InvalidName")
+      INFOS( "!!!Destroy_Directory() : CosNaming::NamingContext::InvalidName")
     }
   catch(CORBA::COMM_FAILURE&)
     {
-      MESSAGE( "!!!Destroy_Directory() :CORBA::COMM_FAILURE : unable to contact" 
+      INFOS( "!!!Destroy_Directory() :CORBA::COMM_FAILURE : unable to contact" 
           << " the naming service") 
       throw ServiceUnreachable();
     }
index db7a30cf2e6a18a29302fdb99ac802c823d1222b..31f2c302663b175cb850d5b46a9c7ba5392b08fe 100644 (file)
@@ -33,9 +33,9 @@
 
 #include "SALOME_Actor.h"
 #include "SALOME_Transform.h"
+#include "SALOME_GeometryFilter.h"
 #include "SALOME_TransformFilter.h"
 #include "SALOME_PassThroughFilter.h"
-#include "SALOME_GeometryFilter.h"
  
 // SALOME Includes
 #include "utilities.h"
 #include <vtkObjectFactory.h>
 #include <vtkDataSetMapper.h>
 #include <vtkPolyDataMapper.h>
-#include <vtkTransformPolyDataFilter.h>
-
-// For test
-#include <vtkMapperCollection.h>
-#include "vtkTimerLog.h"
 
 using namespace std;
 
@@ -57,35 +52,91 @@ int SALOME_POINT_SIZE = 3;
 
 vtkStandardNewMacro(SALOME_Actor);
 
+
+SALOME_Actor::SALOME_Actor(){
+  PreviewProperty = NULL;
+  ispreselected = Standard_False;
+  myProperty = vtkProperty::New();
+
+  myRepresentation = 2;
+
+  myIsInfinite = false;
+
+  myStoreMapping = false;
+  myGeomFilter = SALOME_GeometryFilter::New();
+
+  myTransformFilter = SALOME_TransformFilter::New();
+
+  for(int i = 0; i < 6; i++)
+    myPassFilter.push_back(SALOME_PassThroughFilter::New());
+}
+
+
+SALOME_Actor::~SALOME_Actor(){
+  SetPreviewProperty(NULL);
+
+  myGeomFilter->UnRegisterAllOutputs(); 
+  myGeomFilter->Delete();
+
+  myTransformFilter->UnRegisterAllOutputs();
+  myTransformFilter->Delete();
+
+  for(int i = 0, iEnd = myPassFilter.size(); i < iEnd; i++){
+    if(myPassFilter[i]){
+      myPassFilter[i]->UnRegisterAllOutputs(); 
+      myPassFilter[i]->Delete();
+    }
+  }
+
+  myProperty->Delete();
+}
+
+
 void SALOME_Actor::AddToRender(vtkRenderer* theRenderer){
   theRenderer->AddActor(this);
 }
+
 void SALOME_Actor::RemoveFromRender(vtkRenderer* theRenderer){
   theRenderer->RemoveActor(this);
 }
 
 
-vtkPolyData* SALOME_Actor::GetPolyDataInput(){
-  return myPassFilter[3]->GetPolyDataOutput();
+void SALOME_Actor::SetTransform(SALOME_Transform* theTransform){
+  myTransformFilter->SetTransform(theTransform);
 }
 
 void SALOME_Actor::SetMapper(vtkMapper* theMapper){
   if(theMapper){
-    myPassFilter[0]->SetInput(theMapper->GetInput());
-    myPassFilter[1]->SetInput(myPassFilter[0]->GetPolyDataOutput());
-    myTransformFilter->SetInput(myPassFilter[1]->GetPolyDataOutput());
-    myPassFilter[2]->SetInput(myTransformFilter->GetOutput());
-    myPassFilter[3]->SetInput(myPassFilter[2]->GetPolyDataOutput());
+    int anId = 0;
+    myPassFilter.at(anId)->SetInput(theMapper->GetInput());
+    myGeomFilter->SetStoreMapping(myStoreMapping);
+    myGeomFilter->SetInput(myPassFilter.at(anId)->GetOutput());
+
+    anId++;
+    myPassFilter.at(anId)->SetInput(myGeomFilter->GetOutput());
+    myPassFilter.at(anId+1)->SetInput(myPassFilter.at(anId)->GetOutput());
+
+    anId++;
+    myPassFilter.at(anId+1)->SetInput(myPassFilter.at(anId)->GetOutput());
+
+    anId++;
+    myTransformFilter->SetInput(myPassFilter.at(anId)->GetPolyDataOutput());
+
+    anId++;
+    myPassFilter.at(anId)->SetInput(myTransformFilter->GetOutput());
+    myPassFilter.at(anId+1)->SetInput(myPassFilter.at(anId)->GetOutput());
+
+    anId++;
     if(vtkDataSetMapper* aMapper = dynamic_cast<vtkDataSetMapper*>(theMapper))
-      aMapper->SetInput(myPassFilter[3]->GetPolyDataOutput());
+      aMapper->SetInput(myPassFilter.at(anId)->GetOutput());
     else if(vtkPolyDataMapper* aMapper = dynamic_cast<vtkPolyDataMapper*>(theMapper))
-      aMapper->SetInput(myPassFilter[3]->GetPolyDataOutput());
+      aMapper->SetInput(myPassFilter.at(anId)->GetPolyDataOutput());
   }
   vtkLODActor::SetMapper(theMapper);
 }
 
-void SALOME_Actor::SetTransform(SALOME_Transform* theTransform){
-  myTransformFilter->SetTransform(theTransform);
+vtkPolyData* SALOME_Actor::GetPolyDataInput(){
+  return myPassFilter.back()->GetPolyDataOutput();
 }
 
 
@@ -109,47 +160,71 @@ void SALOME_Actor::SetRepresentation(int theMode) {
     GetProperty()->DeepCopy(myProperty);
     break;
   default:
+    break;
     GetProperty()->SetAmbient(1.0);
     GetProperty()->SetDiffuse(0.0);
     GetProperty()->SetSpecular(0.0);
   }
   switch(theMode){
   case 3 : 
-    myPassFilter[0]->SetInside(true);
+    myGeomFilter->SetInside(true);
     GetProperty()->SetRepresentation(1);
     break;
   case 0 : 
     GetProperty()->SetPointSize(SALOME_POINT_SIZE);  
   default :
     GetProperty()->SetRepresentation(theMode);
-    myPassFilter[0]->SetInside(false);
+    myGeomFilter->SetInside(false);
   }
   myRepresentation = theMode;
 }
+
 int SALOME_Actor::GetRepresentation(){ 
   return myRepresentation;
 }
 
-
-SALOME_Actor::SALOME_Actor(){
-  PreviewProperty = NULL;
-  ispreselected = Standard_False;
-  myProperty = vtkProperty::New();
-  myRepresentation = 2;
-  myTransformFilter = SALOME_TransformFilter::New();
-  myPassFilter.push_back(SALOME_PassThroughFilter::New());
-  myPassFilter.push_back(SALOME_PassThroughFilter::New());
-  myPassFilter.push_back(SALOME_PassThroughFilter::New());
-  myPassFilter.push_back(SALOME_PassThroughFilter::New());
-}
-
-SALOME_Actor::~SALOME_Actor(){
-  myTransformFilter->Delete();
-  SetPreviewProperty(NULL);
-  for(int i = 0, iEnd = myPassFilter.size(); i < iEnd; i++)
-    if(myPassFilter[i] != NULL){
-      myPassFilter[i]->UnRegisterAllOutputs(); 
-      myPassFilter[i]->Delete();
+//=================================================================================
+// function : GetObjDimension
+// purpose  : Return object dimension.
+//            Virtual method shoulb be redifined by derived classes
+//=================================================================================
+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();
     }
-  myProperty->Delete();
+  }
+  return 0;
 }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
index 03758fee9870e4aba7bdd4f4d19a6fb239b69348..08a15bd4e17394cf44d8a34a0d420083d6dd0e1f 100644 (file)
 // SALOME Includes
 #include "VTKViewer_Common.h"
 #include "SALOME_InteractiveObject.hxx"
-#ifndef _Handle_SALOME_InteractiveObject_HeaderFile
-#include "Handle_SALOME_InteractiveObject.hxx"
-#endif
-#include <vector.h>
+
+#include <vector>
 
 class SALOME_Transform;
+class SALOME_GeometryFilter;
 class SALOME_TransformFilter;
 class SALOME_PassThroughFilter;
 
@@ -54,22 +53,6 @@ class SALOME_Actor : public vtkLODActor{
 
   vtkTypeMacro(SALOME_Actor,vtkLODActor);
 
-  // Description:
-  // This causes the actor to be rendered. It, in turn, will render the actor`s
-  // property and then mapper.
-  //virtual void Render(vtkRenderer *, vtkMapper *);
-
-  // Description:
-  // This method is used internally by the rendering process.
-  // We overide the superclass method to properly set the estimated render time.
-  //virtual int RenderOpaqueGeometry(vtkViewport *viewport);
-
-  // Description:
-  // Release any graphics resources that are being consumed by this actor.
-  // The parameter window could be used to determine which graphic
-  // resources to release.
-  //virtual void ReleaseGraphicsResources(vtkWindow *);
-
   virtual Standard_Boolean hasIO() { return !myIO.IsNull(); }
   virtual Handle_SALOME_InteractiveObject getIO() { return myIO; } 
   virtual void setIO(const Handle(SALOME_InteractiveObject)& io) { myIO = io; }
@@ -103,10 +86,16 @@ class SALOME_Actor : public vtkLODActor{
   virtual void AddToRender(vtkRenderer* theRenderer); 
   virtual void RemoveFromRender(vtkRenderer* theRenderer);
 
-  virtual vtkPolyData* GetPolyDataInput(); 
+  typedef std::vector<int> TVectorId;
+  virtual int GetObjId(int theVtkID) { return -1;}
+  virtual TVectorId GetVtkId(int theObjID) { return TVectorId();}
+
+  virtual int GetObjDimension( const int theObjId );
+
   virtual void SetMapper(vtkMapper* theMapper); 
-  virtual void SetTransform(SALOME_Transform* theTransform); 
+  virtual vtkPolyData* GetPolyDataInput(); 
 
+  virtual void SetTransform(SALOME_Transform* theTransform); 
   virtual unsigned long int GetMTime();
 
   virtual void SetRepresentation(int theMode);
@@ -114,24 +103,27 @@ class SALOME_Actor : public vtkLODActor{
 
   // 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 false; }
+  virtual bool IsInfinitive() { return myIsInfinite; }
     
  protected:
   vtkProperty         *PreviewProperty;
   Standard_Boolean    ispreselected;
 
-  Handle_SALOME_InteractiveObject myIO;
+  Handle(SALOME_InteractiveObject) myIO;
   Standard_CString myName;
 
   float   m_opacity;
   Standard_Boolean    ishighlighted;
   int myDisplayMode;
+  bool myIsInfinite;
 
-  SALOME_Transform *myTransform;
-  std::vector<SALOME_PassThroughFilter*> myPassFilter;
+  bool myStoreMapping;
+  SALOME_GeometryFilter *myGeomFilter;
   SALOME_TransformFilter *myTransformFilter;
-  vtkProperty *myProperty;
+  std::vector<SALOME_PassThroughFilter*> myPassFilter;
+
   int myRepresentation;
+  vtkProperty *myProperty;
 };
 
 #endif // SALOME_ACTOR_H
index 61125300fdefef6308040352bb5f55e60de50af1..46bdb4af754170a0601ebb7fb42302778c05d17e 100644 (file)
@@ -31,6 +31,7 @@
 
 #include "OCCViewer_ViewPort.h"
 #include "QAD_ViewFrame.h"
+#include "SALOME_Selection.h"
 
 class OCCViewer_Viewer3d;
 class QAD_EXPORT OCCViewer_ViewFrame : public QAD_ViewFrame
@@ -64,7 +65,7 @@ class QAD_EXPORT OCCViewer_ViewFrame : public QAD_ViewFrame
   void              setCursor( const QCursor& );
   QCursor           cursor() const;
 
-  void              SetSelectionMode( int mode ) {};
+  void              SetSelectionMode( Selection_Mode mode ) {};
   
   /*  popup management */
   void              setPopupServer( QAD_Application* );
index 88601ea0bfc73307fdd147b6d4ccf9886589ac3c..1782f87852007455fdf1aa3efc1a624cf2838bb1 100644 (file)
@@ -295,10 +295,11 @@ void OCCViewer_ViewPort3d::setBackgroundColor( const QColor& color)
       myActiveView->SetBackgroundColor( Quantity_TOC_RGB, color.red()/255., 
                                        color.green()/255., color.blue()/255.);
 
+      /* VSR : PAL5420 ---------------------------------------------------
       QAD_CONFIG->addSetting( "OCCViewer:BackgroundColorRed",   color.red() );
       QAD_CONFIG->addSetting( "OCCViewer:BackgroundColorGreen", color.green() );
       QAD_CONFIG->addSetting( "OCCViewer:BackgroundColorBlue",  color.blue() );
-      
+      VSR : PAL5420 --------------------------------------------------- */
       myActiveView->Update();
     }
 }
index b5d094b9fa131ba1c3b581e6b707b465b8d32e8d..a2a03544d8c41f92f392ffed03988d26e8a2a8f3 100644 (file)
@@ -24,6 +24,7 @@
 #include <qtoolbar.h>
 #include <qtoolbutton.h>
 #include <qcursor.h>
+#include <qcolordialog.h>
 #include <qwt_math.h>
 #include <qwt_plot_canvas.h>
 #include <stdlib.h>
@@ -233,6 +234,13 @@ void Plot2d_ViewFrame::createActions()
   fitDataAction->setStatusTip ( tr( "PRP_PLOT2D_FITDATA" ) );
   myActions.insert( FitDataId, fitDataAction );
   connect( fitDataAction, SIGNAL( activated() ), this, SLOT( onFitData() ) );
+
+  // Change background
+  QActionP* changeBGAction = new QActionP ( tr( "TOT_PLOT2D_CHANGE_BACKGROUND"),
+                                           tr( "MEN_PLOT2D_CHANGE_BACKGROUND" ), 0, this );
+  fitDataAction->setStatusTip ( tr( "PRP_PLOT2D_CHANGE_BACKGROUND" ) );
+  myActions.insert( ChangeBackgroundId, changeBGAction );
+  connect( changeBGAction, SIGNAL( activated() ), this, SLOT( onChangeBackground() ) );
 }
 /*!
   Gets window's central widget
@@ -274,6 +282,9 @@ void Plot2d_ViewFrame::onCreatePopup()
     // settings
     myPopup->insertSeparator();
     myActions[ SettingsId ]->addTo( myPopup );
+    // Change background
+    myPopup->insertSeparator();
+    myActions[ ChangeBackgroundId ]->addTo( myPopup );
   }
 }
 /*!
@@ -523,11 +534,59 @@ void Plot2d_ViewFrame::writePreferences()
 */
 QString Plot2d_ViewFrame::getInfo( const QPoint& pnt ) 
 {
-  QString info;
-  info.sprintf( "X : %g\tY : %g",
-               myPlot->invTransform( QwtPlot::xBottom, pnt.x() ),
-               myPlot->invTransform( QwtPlot::yLeft,   pnt.y() ) );
-  info = tr( "INF_COORDINATES" ) + " : " + info;
+  bool xFound = false, yFound = false;
+  double xCoord, yCoord;
+  const QwtScaleDiv* aXscale = myPlot->axisScale( QwtPlot::xBottom );
+  for ( int i = 0; i < aXscale->majCnt(); i++ ) {
+    double majXmark = aXscale->majMark( i );
+    int xmark = myPlot->transform( QwtPlot::xBottom, majXmark );
+    if ( xmark-2 == pnt.x() ) {
+      xCoord = majXmark; 
+      xFound = true;
+      MESSAGE("Plot2d_ViewFrame::getInfo : close maj X mark("<<i<<") = "<<majXmark<<" "<<xmark<<" "<<pnt.x());
+      break;
+    }
+  }
+  if ( !xFound ) {
+    for ( int i = 0; i < aXscale->minCnt(); i++ ) {
+      double minXmark = aXscale->minMark( i );
+      int xmark = myPlot->transform( QwtPlot::xBottom, minXmark );
+      if ( xmark-2 == pnt.x() ) {
+       xCoord = minXmark; 
+       xFound = true;
+       MESSAGE("Plot2d_ViewFrame::getInfo : close min X mark("<<i<<") = "<<minXmark<<" "<<xmark<<" "<<pnt.x());
+       break;
+      }
+    }
+  }  
+  const QwtScaleDiv* aYscale = myPlot->axisScale( QwtPlot::yLeft );
+  for ( int i = 0; i < aYscale->majCnt(); i++ ) {
+    double majYmark = aYscale->majMark( i );
+    int ymark = myPlot->transform( QwtPlot::yLeft, majYmark );
+    if ( ymark-2 == pnt.y() ) {
+      yCoord = majYmark; 
+      yFound = true;
+      break;
+    }
+  }
+  if ( !yFound ) {
+    for ( int i = 0; i < aYscale->minCnt(); i++ ) {
+      double minYmark = aYscale->minMark( i );
+      int ymark = myPlot->transform( QwtPlot::yLeft, minYmark );
+      if ( ymark-2 == pnt.y() ) {
+       yCoord = minYmark; 
+       yFound = true;
+       break;
+      }
+    }
+  }  
+  QString strX = QString::number( xFound ? xCoord : myPlot->invTransform( QwtPlot::xBottom, pnt.x() ) ).stripWhiteSpace();
+  if ( strX == "-0" )
+    strX = "0";
+  QString strY = QString::number( yFound ? yCoord : myPlot->invTransform( QwtPlot::yLeft, pnt.y() ) ).stripWhiteSpace();
+  if ( strY == "-0" )
+    strY = "0";
+  QString info = tr("INF_COORDINATES").arg( strX ).arg( strY );
   return info;
 }
 /*!
@@ -1082,6 +1141,16 @@ void Plot2d_ViewFrame::onFitData()
   }
   delete dlg;
 }
+/*!
+  Change background color
+*/
+void Plot2d_ViewFrame::onChangeBackground()
+{
+  QColor selColor = QColorDialog::getColor ( backgroundColor(), this );        
+  if ( selColor.isValid() ) {
+    setBackgroundColor( selColor );
+  }
+}
 /*!
   Sets curve type
 */
index ee92ee7ba4c325980f7cde14cbf9e78e98ef5136..40e41b35786f1d1200f03a7e1e997abb8caa1bdb 100644 (file)
@@ -15,6 +15,7 @@
 #include "QAD_Action.h"
 #include "Plot2d_Curve.h"
 #include "Plot2d_CurveContainer.h"
+#include "SALOME_Selection.h"
 #include <qmainwindow.h>
 #include <qmap.h>
 #include <qintdict.h>
@@ -34,7 +35,7 @@ class QAD_EXPORT Plot2d_ViewFrame : public QAD_ViewFrame, public QAD_PopupClient
 
   enum { NoOpId, FitAllId, FitAreaId, ZoomId, PanId, DumpId, 
         ModeXLinearId, ModeXLogarithmicId, ModeYLinearId, ModeYLogarithmicId,
-        LegendId, CurvePointsId, CurveLinesId, CurveSplinesId, SettingsId, FitDataId };
+        LegendId, CurvePointsId, CurveLinesId, CurveSplinesId, SettingsId, FitDataId, ChangeBackgroundId };
 public:
   /* Construction/destruction */
   Plot2d_ViewFrame( QWidget* parent, const QString& title = "" );
@@ -44,7 +45,7 @@ public:
   /* inherited */
   ViewType          getTypeView() const { return VIEW_PLOT2D; }
   QWidget*          getViewWidget();
-  void              SetSelectionMode( int mode ) {}
+  void              SetSelectionMode( Selection_Mode mode ) {}
   void              onAdjustTrihedron( ) {}
 
   /* popup management */
@@ -145,6 +146,7 @@ public slots:
   void    onCurves();
   void    onSettings();
   void    onFitData();
+  void    onChangeBackground();
 
 protected slots:
   void    onLegendClicked( long key );
index 0144b59b36797a446f62a71580fd41c28468cf00..3c26d92b73bc50d46fe0ee9bf6d7efc533a81a1e 100644 (file)
@@ -34,6 +34,7 @@
 
 # include <map>
 
+using namespace std;
 
 class RegistryService : public POA_Registry::Components  //, public PortableServer::RefCountServantBase
 {
index afc79eac91563ac13c72a7944330fa4cf611f9a4..c7a16048fff2da2d82fefc7feb17e40e96430070 100644 (file)
@@ -621,8 +621,8 @@ QString findFile( QString filename )
        return fileInfo.filePath();
     }
   }
-  // Try ${SALOME_ROOT_DIR}/share/salome/resources directory
-  cenv = getenv( "SALOME_ROOT_DIR" );
+  // Try ${KERNEL_ROOT_DIR}/share/salome/resources directory
+  cenv = getenv( "KERNEL_ROOT_DIR" );
   if ( cenv ) {
     dir.sprintf( "%s", cenv );
     if ( !dir.isEmpty() ) {
index e9a16146cb778988692de3a3ced950a4e7480154..4275a4924033c6b311a29dcd22bc92af805209cc 100644 (file)
@@ -87,7 +87,7 @@ int main(int argc,char **argv)
            }
          catch( CORBA::COMM_FAILURE& )
            {
-             MESSAGE( "Ressources Catalog: CORBA::COMM_FAILURE: Unable to contact the Naming Service" );
+             INFOS( "Ressources Catalog: CORBA::COMM_FAILURE: Unable to contact the Naming Service" );
            }
          if(!CORBA::is_nil(inc)) 
            {
@@ -103,11 +103,11 @@ int main(int argc,char **argv)
                      }
                      catch(CosNaming::NamingContext::NotFound)
                        { 
-                         MESSAGE( "Ressources Catalog: Logger Server wasn't found" );
+                         INFOS( "Ressources Catalog: Logger Server wasn't found" );
                        }
                      catch(...)
                        { 
-                         MESSAGE( "Ressources Catalog: Unknown exception" );
+                         INFOS( "Ressources Catalog: Unknown exception" );
                        }
                      if (!CORBA::is_nil(object))
                        {
index d0d27774964a6d7cdb9f8b34bc293bef25081a88..cc819e49563ccdce6170ae1893c6262d18abc14e 100644 (file)
@@ -29,6 +29,9 @@ using namespace std;
 #include "SALOME_RessourcesCatalog_impl.hxx"
 #include <fstream>
 
+#include "Utils_ExceptHandlers.hxx"
+UNEXPECT_CATCH(RC_NotFound, SALOME_RessourcesCatalog::NotFound);
+
 //----------------------------------------------------------------------
 // Function : SALOME_RessourcesCatalogImpl
 // Purpose  : Constructor 
@@ -95,6 +98,7 @@ SALOME_RessourcesCatalog::ListOfContainerType*
 SALOME_RessourcesCatalogImpl::GetContainerTypeList(const char* computer) 
                               throw(SALOME_RessourcesCatalog::NotFound)
 {
+  Unexpect aCatch(RC_NotFound);
   MESSAGE("Begin of GetContainerTypeList");
   SALOME_RessourcesCatalog::ListOfContainerType_var _list = 
     new SALOME_RessourcesCatalog::ListOfContainerType;
@@ -149,6 +153,7 @@ SALOME_RessourcesCatalogImpl::GetComputerInfo(const char* computer)
                             throw(SALOME_RessourcesCatalog::NotFound)
 {
   MESSAGE("Begin of GetComputerInfo");
+  Unexpect aCatch(RC_NotFound);
   SALOME_RessourcesCatalog::computer_info_var _computer_info = 
     new SALOME_RessourcesCatalog::computer_info;
 
@@ -253,7 +258,7 @@ SALOME_RessourcesCatalogImpl::_parseArguments(int argc, char **argv,
 
       if (strcmp(argv[ind],"-help") == 0)
        {
-         INFOS( "Usage: " << argv[0] << " -common 'path to ressources catalog' -ORBInitRef NameService=corbaname::localhost");
+         MESSAGE( "Usage: " << argv[0] << " -common 'path to ressources catalog' -ORBInitRef NameService=corbaname::localhost");
            _return_value = false ;
        }
       if (strcmp(argv[ind],"-common") == 0)
index 911d848a248126098cae363f1987cb94bf352807..5da8aeccbd79cd16d6ff9a82e71ef5230bf9de9a 100644 (file)
@@ -24,7 +24,7 @@
 //  File   : Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx
 //  Author : Yves FRICAUD
 //  Module : SALOME
-//  $Header
+//  $Header$
 
 #ifndef _Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel_HeaderFile
 #define _Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel_HeaderFile
index dd2c6f14af97607c035f2c69c524101f2988b75f..dbb2c1c0cc0b2d0571b4a3613cf0f846d42395c1 100644 (file)
@@ -24,7 +24,7 @@
 //  File   : Handle_SALOMEDS_LocalIDAttribute.hxx
 //  Author : Yves FRICAUD
 //  Module : SALOME
-//  $Header
+//  $Header$
 
 #ifndef _Handle_SALOMEDS_LocalIDAttribute_HeaderFile
 #define _Handle_SALOMEDS_LocalIDAttribute_HeaderFile
index 0c6eee09e407e3d3df08a7aca9e5a8b60c6910da..bab3847661109da59a229c7dfa8e59c36d238877 100644 (file)
@@ -24,7 +24,7 @@
 //  File   : Handle_SALOMEDS_TargetAttribute.hxx
 //  Author : Yves FRICAUD
 //  Module : SALOME
-//  $Header
+//  $Header$
 
 #ifndef _Handle_SALOMEDS_TargetAttribute_HeaderFile
 #define _Handle_SALOMEDS_TargetAttribute_HeaderFile
index f967482d801243435675aa8878be2fc7ba18c3b0..3bf3299f264de659b26f01d22206a66ba8d73e68 100644 (file)
@@ -45,3 +45,11 @@ void SALOMEDS_AttributeComment_i::SetValue(const char* value)
   CORBA::String_var Str = CORBA::string_dup(value);
   Handle(TDataStd_Comment)::DownCast(_myAttr)->Set(TCollection_ExtendedString(Str));
 }
+
+char* SALOMEDS_AttributeComment_i::Store() {
+  return Value();
+}
+
+void SALOMEDS_AttributeComment_i::Restore(const char* value) {
+  SetValue(value);
+}
index 9ebeb45fd0e78a88760af204eae8d9976a2144e3..0171acb756522c6829a8b0a573824cd41a9bf527 100644 (file)
@@ -48,7 +48,10 @@ public:
 
   char* Value();
   void SetValue(const char* value);
-  
+
+  char* Store();
+  void Restore(const char*);
+
 };
 
 
index 903d1ead7163d02572bceb3ba467bcca14773885..f21ae9b3bac5cd014db15cf8d499f6ff79d40afc 100644 (file)
@@ -40,3 +40,11 @@ void SALOMEDS_AttributeDrawable_i::SetDrawable(CORBA::Boolean value) {
   if (value != 0) val = 1;
   Handle(TDataStd_Integer)::DownCast(_myAttr)->Set(val);
 }
+
+char* SALOMEDS_AttributeDrawable_i::Store() {
+  return strdup(IsDrawable()?"1":"0");
+}
+
+void SALOMEDS_AttributeDrawable_i::Restore(const char* value) {
+  SetDrawable(value[0] == '1');
+}
index 80c71284faefe8c2727441c4f0af124a66e46c81..6f41440e53fa371d85d08ee5f8070a9c3db4f4f0 100644 (file)
@@ -48,6 +48,10 @@ public:
   ~SALOMEDS_AttributeDrawable_i() {};
   CORBA::Boolean IsDrawable();
   void SetDrawable(CORBA::Boolean value);
+
+  char* Store();
+  void Restore(const char*);
+
 };
 
 
index 1560deeaa55dd5795ce94a4447a8a057624592cb..98a0720cf9373f66644f80aa440b47bd8fadeb31 100644 (file)
@@ -39,3 +39,11 @@ void SALOMEDS_AttributeExpandable_i::SetExpandable(CORBA::Boolean value) {
   if (value != 0) val = 1;
   Handle(TDataStd_Integer)::DownCast(_myAttr)->Set(val);
 }
+
+char* SALOMEDS_AttributeExpandable_i::Store() {
+  return strdup(IsExpandable()?"1":"0");
+}
+
+void SALOMEDS_AttributeExpandable_i::Restore(const char* value) {
+  SetExpandable(value[0] == '1');
+}
index 4ac190956316e03813fb48595c16fd87be7f81a1..0c18dd2eb19160852339d3fb67adcb8ab7f51148 100644 (file)
@@ -48,6 +48,10 @@ public:
   ~SALOMEDS_AttributeExpandable_i() {};
   CORBA::Boolean IsExpandable();
   void SetExpandable(CORBA::Boolean value);
+
+  char* Store();
+  void Restore(const char*);
+
 };
 
 
index d9f013db76ce4b7e51e874d561647b9b00ad2ca4..8d3484709a5ccf54a5bf97cabf6b2816ead52534 100644 (file)
@@ -39,3 +39,15 @@ void SALOMEDS_AttributeInteger_i::SetValue(CORBA::Long value) {
   CheckLocked();
   Handle(TDataStd_Integer)::DownCast(_myAttr)->Set(value);
 }
+
+char* SALOMEDS_AttributeInteger_i::Store() {
+  char* IntVal = new char[25];
+  sprintf(IntVal, "%d", Value());
+  return IntVal;
+}
+
+void SALOMEDS_AttributeInteger_i::Restore(const char* value) {
+  char *err = NULL;
+  CORBA::Long l =  atol(value);
+  SetValue(l);
+}
index 8e2a12f84058f76aa2174b51321f54573adf1d92..be877a73565027dfb3c606191c499fe0d2821372 100644 (file)
@@ -49,6 +49,10 @@ public:
 
   CORBA::Long Value();
   void SetValue(CORBA::Long value);
+
+  char* Store();
+  void Restore(const char*);
+
 };
 
 
index 0ed4628b837102fe5e497fdf727001f46652ee9d..d55ea0d990be1954af0e3889dc94e47c66d6fb54 100644 (file)
@@ -24,7 +24,7 @@
 //  File   : SALOMEDS_AttributeLocalID_i.cxx
 //  Author : Yves FRICAUD
 //  Module : SALOME
-//  $Header
+//  $Header$
 
 using namespace std;
 #include "SALOMEDS_AttributeLocalID_i.hxx"
@@ -38,3 +38,15 @@ void SALOMEDS_AttributeLocalID_i::SetValue(CORBA::Long value) {
   CheckLocked();
   Handle(TDataStd_Integer)::DownCast(_myAttr)->Set(value);
 }
+
+char* SALOMEDS_AttributeLocalID_i::Store() {
+  char* IntVal = new char[25];
+  sprintf(IntVal, "%d", Value());
+  return IntVal;
+}
+
+void SALOMEDS_AttributeLocalID_i::Restore(const char* value) {
+  char *err = NULL;
+  CORBA::Long l =  atol(value);
+  SetValue(l);
+}
index 6340696db5c34df7fb6162d3526890b79ecbc365..7b0d5c1485830ead49e6de066a42164a694ab60b 100644 (file)
@@ -48,6 +48,10 @@ public:
   ~SALOMEDS_AttributeLocalID_i() {};
   CORBA::Long Value();
   void SetValue(CORBA::Long value);
+
+  char* Store();
+  void Restore(const char*);
+
 };
 
 
index 415f71af3fe41d290c388819e22d1982ac559110..e9ce976d42ec4465b7585083fd66883b20b00174 100644 (file)
@@ -42,3 +42,11 @@ void SALOMEDS_AttributeName_i::SetValue(const char* value) {
   CORBA::String_var Str = CORBA::string_dup(value);
   Handle(TDataStd_Name)::DownCast(_myAttr)->Set(TCollection_ExtendedString(Str));
 }
+
+char* SALOMEDS_AttributeName_i::Store() {
+  return Value();
+}
+
+void SALOMEDS_AttributeName_i::Restore(const char* value) {
+  SetValue(value);
+}
index c4c46509d915d28a5a7cd399971f875b6d1b0a9f..d2a149258e69cf1fac9336b4d120aaaed47c2249 100644 (file)
@@ -49,6 +49,10 @@ public:
 
   char* Value();
   void SetValue(const char* value);
+
+  char* Store();
+  void Restore(const char*);
+
 };
 
 
index c202cb0431c6bc5608589c0dbdee4c290e27ceb5..cd4e87f17b70702f7349d72699e62c13e14f0d79 100644 (file)
@@ -39,3 +39,11 @@ void SALOMEDS_AttributeOpened_i::SetOpened(CORBA::Boolean value) {
   if (value != 0) val = 1;
   Handle(TDataStd_Integer)::DownCast(_myAttr)->Set(val);
 }
+
+char* SALOMEDS_AttributeOpened_i::Store() {
+  return strdup(IsOpened()?"1":"0");
+}
+
+void SALOMEDS_AttributeOpened_i::Restore(const char* value) {
+  SetOpened(value[0] == '1');
+}
index a5b08df3e57a99a20c2a639cb61daf9e7dbd64e9..ea75a4990dc0d621ad62a65b145c8632908d93e0 100644 (file)
@@ -48,6 +48,10 @@ public:
   ~SALOMEDS_AttributeOpened_i() {};
   CORBA::Boolean IsOpened();
   void SetOpened(CORBA::Boolean value);
+
+  char* Store();
+  void Restore(const char*);
+
 };
 
 
index 626ad9711e7130e340be59bb225bd03ca823a34b..c8e72e102144a12ddcda8a6a2b3bc3c4b20908b4 100644 (file)
@@ -44,3 +44,11 @@ void SALOMEDS_AttributePersistentRef_i::SetValue(const char* value)
   CORBA::String_var Str = CORBA::string_dup(value);
   Handle(TDataStd_Comment)::DownCast(_myAttr)->Set(TCollection_ExtendedString(Str));
 }
+
+char* SALOMEDS_AttributePersistentRef_i::Store() {
+  return Value();
+}
+
+void SALOMEDS_AttributePersistentRef_i::Restore(const char* value) {
+  SetValue(value);
+}
index 0173a5e46b36b9cbd4553fde09132d22a428b5c8..5d986a15ed262eb6a3a75643275d0c100b0d8462 100644 (file)
@@ -24,7 +24,7 @@
 //  File   : SALOMEDS_AttributePersistentRef_i.hxx
 //  Author : Yves FRICAUD
 //  Module : SALOME
-//  $Header
+//  $Header$
 
 #ifndef SALOMEDS_AttributePersistentRef_i_HeaderFile
 #define SALOMEDS_AttributePersistentRef_i_HeaderFile
@@ -47,6 +47,9 @@ public:
 
   char* Value();
   void SetValue(const char* value);
+
+  char* Store();
+  void Restore(const char*);
   
 };
 
index 5015f16977adc6782f6def36e3a95f021a9df3c0..a34de496705313010cca0f78dddd58f10656037f 100644 (file)
@@ -47,3 +47,11 @@ void SALOMEDS_AttributePixMap_i::SetPixMap(const char* value) {
   CORBA::String_var Str = CORBA::string_dup(value);
   Handle(TDataStd_Comment)::DownCast(_myAttr)->Set(TCollection_ExtendedString(Str));
 }
+
+char* SALOMEDS_AttributePixMap_i::Store() {
+  return GetPixMap();
+}
+
+void SALOMEDS_AttributePixMap_i::Restore(const char* value) {
+  SetPixMap(value);
+}
index 3058b356a01d479d884d13e5867f94547fd0271b..16696a4a5d81e1ecd891c4002a59c02876d490a4 100644 (file)
@@ -24,7 +24,7 @@
 //  File   : SALOMEDS_AttributePixMap_i.hxx
 //  Author : Yves FRICAUD
 //  Module : SALOME
-//  $Header
+//  $Header$
 
 #ifndef SALOMEDS_AttributePixMap_i_HeaderFile
 #define SALOMEDS_AttributePixMap_i_HeaderFile
@@ -48,6 +48,10 @@ public:
   CORBA::Boolean HasPixMap();
   char* GetPixMap();
   void SetPixMap(const char* value);
+
+  char* Store();
+  void Restore(const char*);
+
 };
 
 
index 86f7a1ca49edff7386a51a68a8ffcaebc0256bc1..a02fa874eba13d2403b8cde375c32ec160dceb17 100644 (file)
@@ -30,3 +30,16 @@ char* SALOMEDS_AttributePythonObject_i::GetObject() {
 CORBA::Boolean SALOMEDS_AttributePythonObject_i::IsScript() {
   return Handle(SALOMEDS_PythonObjectAttribute)::DownCast(_myAttr)->IsScript();
 }
+
+char* SALOMEDS_AttributePythonObject_i::Store() {
+  CORBA::String_var aString = GetObject();
+  char* aResult = new char[strlen(aString) + 2];
+  aResult[0] = IsScript()?'s':'n';
+  strcpy(aResult+1, aString);
+  return aResult;
+}
+
+void SALOMEDS_AttributePythonObject_i::Restore(const char* value) {
+  char* aString = strdup(value);
+  SetObject(aString + 1, aString[0]=='s');
+}
index d15d36649989c9e0a171a3b44a648f177264bbd5..1db4b14eacaa83a466669922253bb70e6832cafc 100644 (file)
@@ -34,6 +34,9 @@ public:
   virtual char* GetObject();
   virtual CORBA::Boolean IsScript();
 
+  virtual char* Store();
+  virtual void Restore(const char*);
+
 };
 
 
index fc5611c8e3a9ea28bb8dc1bd37e0f03f2423837b..c87b604865658a359067986694116db9a8323aee 100644 (file)
@@ -38,3 +38,15 @@ void SALOMEDS_AttributeReal_i::SetValue(CORBA::Double value) {
   CheckLocked();
   Handle(TDataStd_Real)::DownCast(_myAttr)->Set(value);
 }
+
+char* SALOMEDS_AttributeReal_i::Store() {
+  char* RealVal = new char[25];
+  sprintf(RealVal, "%f", Value());
+  return RealVal;
+}
+
+void SALOMEDS_AttributeReal_i::Restore(const char* value) {
+  char *err = NULL;
+  CORBA::Double r =  strtod(value, &err);
+  if (err != value) SetValue(r);
+}
index a4399c9f7cc47b535c0823fc8bae8955b0c333cf..42263a1612a7909f6e9b66c327e5cdbbdebdfa79 100644 (file)
@@ -24,7 +24,7 @@
 //  File   : SALOMEDS_AttributeReal_i.hxx
 //  Author : Yves FRICAUD
 //  Module : SALOME
-//  $Header
+//  $Header$
 
 #ifndef SALOMEDS_AttributeReal_i_HeaderFile
 #define SALOMEDS_AttributeReal_i_HeaderFile
@@ -48,6 +48,10 @@ public:
 
   CORBA::Double Value();
   void SetValue(CORBA::Double value);
+
+  char* Store();
+  void Restore(const char*);
+
 };
 
 
index b526f3c997e3c23a0578e7b8b21ff936523e1589..fd9fa7ad2bc7a5399e88137d7933da2f3e43e26d 100644 (file)
@@ -39,3 +39,11 @@ void SALOMEDS_AttributeSelectable_i::SetSelectable(CORBA::Boolean value) {
   if (value != 0) val = 1;
   Handle(TDataStd_Integer)::DownCast(_myAttr)->Set(val);
 }
+
+char* SALOMEDS_AttributeSelectable_i::Store() {
+  return strdup(IsSelectable()?"1":"0");
+}
+
+void SALOMEDS_AttributeSelectable_i::Restore(const char* value) {
+  SetSelectable(value[0] == '1');
+}
index b9936d47b222ef8405df98a8bc5fc35e899a3eff..c844f03bf44fce1a4ce425a93b83dcdac4c943ec 100644 (file)
@@ -48,6 +48,10 @@ public:
   ~SALOMEDS_AttributeSelectable_i() {};
   CORBA::Boolean IsSelectable();
   void SetSelectable(CORBA::Boolean value);
+
+  char* Store();
+  void Restore(const char*);
+
 };
 
 
index 61e08b1bd06b2a31e79a59a3522ed4e7c427c361..703810bc5b3cb72335324173e440eda70b53de7d 100644 (file)
@@ -80,3 +80,30 @@ CORBA::Long SALOMEDS_AttributeSequenceOfInteger_i::Length()
 {
   return Handle(SALOMEDS_SequenceOfIntegerAttribute)::DownCast(_myAttr)->Length();
 }
+
+char* SALOMEDS_AttributeSequenceOfInteger_i::Store() {
+  Handle(SALOMEDS_SequenceOfIntegerAttribute) CasCadeSeq = Handle(SALOMEDS_SequenceOfIntegerAttribute)::DownCast(_myAttr);
+  Standard_Integer aLength = CasCadeSeq->Length();
+  char* aResult = new char[aLength * 25];
+  aResult[0] = 0;
+  Standard_Integer aPosition = 0;
+  for (int i = 1; i <= aLength; i++) {
+    sprintf(aResult + aPosition , "%d ", CasCadeSeq->Value(i));
+    aPosition += strlen(aResult + aPosition);
+  }
+  return aResult;
+}
+
+void SALOMEDS_AttributeSequenceOfInteger_i::Restore(const char* value) {
+  Handle(TColStd_HSequenceOfInteger) CasCadeSeq = new TColStd_HSequenceOfInteger;
+  
+  char* aCopy = strdup(value);
+  char* adr = strtok(aCopy, " ");
+  while (adr) {
+    CORBA::Long l =  atol(adr);
+    CasCadeSeq->Append(l);
+    adr = strtok(NULL, " ");
+  }
+  delete(aCopy);
+  Handle(SALOMEDS_SequenceOfIntegerAttribute)::DownCast(_myAttr)->Assign(CasCadeSeq);
+}
index ee0b71eefed7b1c41371b446b5cd70fe8bd2c9c9..06b24a7c56ad5691cdd18c4936b127f3aba47856 100644 (file)
@@ -55,6 +55,10 @@ public:
   void ChangeValue(CORBA::Long index, CORBA::Long value);
   CORBA::Long Value(CORBA::Short index);
   CORBA::Long Length();
+
+  char* Store();
+  void Restore(const char*);
+
 };
 
 #endif
index 8b48632b28472d113bb83b701a2ced6fe7f1ffbe..d7f480a160c7c86fd72fa6fb241a0fc2bf4001de 100644 (file)
@@ -79,3 +79,32 @@ CORBA::Long SALOMEDS_AttributeSequenceOfReal_i::Length()
 {
   return Handle(SALOMEDS_SequenceOfRealAttribute)::DownCast(_myAttr)->Length();
 }
+
+char* SALOMEDS_AttributeSequenceOfReal_i::Store() {
+  Handle(SALOMEDS_SequenceOfRealAttribute) CasCadeSeq = Handle(SALOMEDS_SequenceOfRealAttribute)::DownCast(_myAttr);
+  Standard_Integer aLength = CasCadeSeq->Length();
+  char* aResult = new char[aLength * 25];
+  aResult[0] = 0;
+  Standard_Integer aPosition = 0;
+  for (int i = 1; i <= aLength; i++) {
+    sprintf(aResult + aPosition , "%f ", CasCadeSeq->Value(i));
+    aPosition += strlen(aResult + aPosition);
+  }
+  return aResult;
+}
+
+void SALOMEDS_AttributeSequenceOfReal_i::Restore(const char* value) {
+  Handle(TColStd_HSequenceOfReal) CasCadeSeq = new TColStd_HSequenceOfReal;
+  
+  char* aCopy = strdup(value);
+  char* adr = strtok(aCopy, " ");
+  char *err = NULL;
+  while (adr) {
+    CORBA::Double r =  strtod(adr, &err);
+    if (err == adr) break;
+    else CasCadeSeq->Append(r);
+    adr = strtok(NULL, " ");
+  }
+  delete(aCopy);
+  Handle(SALOMEDS_SequenceOfRealAttribute)::DownCast(_myAttr)->Assign(CasCadeSeq);
+}
index ded1a3584cab7711e927367cfd58fb907d3142b5..044fbc460a75bce48d3a3871079b9d8f0fd9f2ce 100644 (file)
@@ -54,6 +54,9 @@ public:
   void ChangeValue(CORBA::Long index, CORBA::Double value);
   CORBA::Double Value(CORBA::Short index);
   CORBA::Long Length();
+
+  char* Store();
+  void Restore(const char*);
 };
 
 
index 1646f3db4398b0cda7098434d0d828cfd116f1be..9b2b8912c8f29a590098a3e65dd049e76d104ac9 100644 (file)
@@ -22,8 +22,7 @@ using namespace std;
 void SALOMEDS_AttributeStudyProperties_i::SetUserName(const char* theName) {
   CheckLocked();
   Handle(SALOMEDS_StudyPropertiesAttribute) aProp = Handle(SALOMEDS_StudyPropertiesAttribute)::DownCast(_myAttr);
-  CORBA::String_var Str = CORBA::string_dup(theName);
-  aProp->SetFirstName(TCollection_ExtendedString(Str));
+  aProp->SetFirstName(TCollection_ExtendedString(strdup(theName)));
 }
 
 char* SALOMEDS_AttributeStudyProperties_i::GetUserName() {
@@ -112,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(CORBA::string_dup(theName));
+  aProp->SetUserName(strdup(theName));
   aProp->SetModificationDate((int)theMinute, (int)theHour, (int)theDay, (int)theMonth, (int)theYear);
 }
 void SALOMEDS_AttributeStudyProperties_i::GetModificationsList(SALOMEDS::StringSeq_out theNames,
@@ -153,3 +152,80 @@ void SALOMEDS_AttributeStudyProperties_i::GetModificationsList(SALOMEDS::StringS
       (*theYears)[a] = aYears->Value(a + 1 + ((theWithCreator)?0:1));
     }
 }
+
+char* SALOMEDS_AttributeStudyProperties_i::Store() {
+  Handle(TColStd_HSequenceOfExtendedString) aNames;
+  Handle(TColStd_HSequenceOfInteger) aMinutes, aHours, aDays, aMonths, aYears;
+  Handle(SALOMEDS_StudyPropertiesAttribute) aProp = Handle(SALOMEDS_StudyPropertiesAttribute)::DownCast(_myAttr);
+  aNames = aProp->GetUserNames();
+  aProp->GetModificationDates(aMinutes, aHours, aDays, aMonths, aYears);
+
+  int aLength, anIndex;
+  for(aLength = 0, anIndex = aNames->Length(); anIndex > 0; anIndex--) aLength += aNames->Value(anIndex).Length() + 1;
+
+  char* aProperty = new char[3 + aLength + 12 * aNames->Length()];
+
+  sprintf(aProperty,"%c%c", strlen(GetCreationMode())?GetCreationMode()[0]:'0', IsLocked()?'l':'u');
+
+  aLength = aNames->Length();
+  int a = 2;
+  for(anIndex = 1; anIndex  <= aLength; anIndex++) {
+    sprintf(&(aProperty[a]),"%2d%2d%2d%2d%4d%s",
+           (int)(aMinutes->Value(anIndex)),
+           (int)(aHours->Value(anIndex)),
+           (int)(aDays->Value(anIndex)),
+           (int)(aMonths->Value(anIndex)),
+           (int)(aYears->Value(anIndex)),
+           (char*)(TCollection_AsciiString(aNames->Value(anIndex)).ToCString()));
+    a = strlen(aProperty);
+    aProperty[a++] = 1;
+  }
+  aProperty[a] = 0;
+  return aProperty;
+}
+
+void SALOMEDS_AttributeStudyProperties_i::Restore(const char* value) {
+  char* aCopy = strdup(value);
+  if (aCopy[0] == 'f') SetCreationMode("from scratch");
+  else if (aCopy[0] == 'c') SetCreationMode("copy from");
+  else SetCreationMode("none");
+
+  int anIndex;
+  for(anIndex = 2; anIndex + 2 < strlen(value) ;) {
+    char str[10];
+    Standard_Integer aMinute, aHour, aDay, aMonth, aYear;
+    str[0] = aCopy[anIndex++];
+    str[1] = aCopy[anIndex++];
+    str[2] = 0;
+    aMinute = atoi(str);
+    str[0] = aCopy[anIndex++];
+    str[1] = aCopy[anIndex++];
+    aHour =  atoi(str);
+    str[0] = aCopy[anIndex++];
+    str[1] = aCopy[anIndex++];
+    aDay =  atoi(str);
+    str[0] = aCopy[anIndex++];
+    str[1] = aCopy[anIndex++];
+    aMonth =  atoi(str);
+    str[0] = aCopy[anIndex++];
+    str[1] = aCopy[anIndex++];
+    str[2] = aCopy[anIndex++];
+    str[3] = aCopy[anIndex++];
+    str[4] = 0;
+    aYear = atoi(str);
+    
+    int aNameSize;
+    for(aNameSize = 0; aCopy[anIndex+aNameSize]!=1; aNameSize++);
+    char *aName = new char[aNameSize+1];
+    strncpy(aName, &(aCopy[anIndex]), aNameSize);
+    aName[aNameSize] = 0;
+    SetModification(aName, aMinute,aHour,aDay,aMonth,aYear);
+    delete(aName);
+    anIndex += aNameSize + 1;
+  }
+  if (aCopy[1] == 'l') {
+    SetLocked(Standard_True);
+  }
+  SetModified(0);
+  delete(aCopy);
+}
index 95d30cb658a1936fdfb3fb5ae152e244c08d3cb8..2d7ebeb3b6fcc194d7d88dc101c5e9ee42c07b5f 100644 (file)
@@ -53,6 +53,10 @@ public:
                                    SALOMEDS::LongSeq_out theMonths,
                                    SALOMEDS::LongSeq_out theYears,
                                    CORBA::Boolean theWithCreator);
+
+  char* Store();
+  void Restore(const char*);
+
 };
 
 
index f80457bb6614ff91ce1c41d689e8a0333d0037e1..df037e5252e7bb42379eb97f8f4dbd5855eddfd0 100644 (file)
@@ -15,12 +15,17 @@ using namespace std;
 #include <TColStd_HSequenceOfInteger.hxx>
 #include <Standard_Failure.hxx>
 #include <Standard_ErrorHandler.hxx>
+#include "Utils_ExceptHandlers.hxx"
 
+#include <stdexcept>
 #include <strstream>
 #include <string>
 
 #define SEPARATOR '\1'
 
+UNEXPECT_CATCH(ATI_IncorrectIndex, SALOMEDS::AttributeTableOfInteger::IncorrectIndex);
+UNEXPECT_CATCH(ATI_IncorrectArgumentLength, SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength);
+
 static TCollection_ExtendedString getUnit(TCollection_ExtendedString theString)
 {
   TCollection_ExtendedString aString(theString);
@@ -57,6 +62,7 @@ char* SALOMEDS_AttributeTableOfInteger_i::GetTitle() {
 void SALOMEDS_AttributeTableOfInteger_i::SetRowTitle(CORBA::Long theIndex, const char* theTitle)
      throw (SALOMEDS::AttributeTableOfInteger::IncorrectIndex)
 {
+  Unexpect aCatch (ATI_IncorrectIndex);
   CheckLocked();
   Handle(SALOMEDS_TableOfIntegerAttribute) aTable = Handle(SALOMEDS_TableOfIntegerAttribute)::DownCast(_myAttr);
   if (theIndex <= 0 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfInteger::IncorrectIndex();
@@ -74,6 +80,7 @@ void SALOMEDS_AttributeTableOfInteger_i::SetRowTitle(CORBA::Long theIndex, const
 void SALOMEDS_AttributeTableOfInteger_i::SetRowTitles(const SALOMEDS::StringSeq& theTitles)
      throw (SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength)
 {
+  Unexpect aCatch (ATI_IncorrectArgumentLength);
   CheckLocked();
   Handle(SALOMEDS_TableOfIntegerAttribute) aTable = Handle(SALOMEDS_TableOfIntegerAttribute)::DownCast(_myAttr);
   if (theTitles.length() != aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength();
@@ -94,6 +101,7 @@ SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfInteger_i::GetRowTitles() {
 void SALOMEDS_AttributeTableOfInteger_i::SetColumnTitle(CORBA::Long theIndex, const char* theTitle)
      throw (SALOMEDS::AttributeTableOfInteger::IncorrectIndex)
 {
+  Unexpect aCatch (ATI_IncorrectIndex);
   CheckLocked();
   Handle(SALOMEDS_TableOfIntegerAttribute) aTable = Handle(SALOMEDS_TableOfIntegerAttribute)::DownCast(_myAttr);
   if (theIndex <= 0 || theIndex > aTable->GetNbColumns()) throw SALOMEDS::AttributeTableOfInteger::IncorrectIndex();
@@ -104,6 +112,7 @@ void SALOMEDS_AttributeTableOfInteger_i::SetColumnTitle(CORBA::Long theIndex, co
 void SALOMEDS_AttributeTableOfInteger_i::SetColumnTitles(const SALOMEDS::StringSeq& theTitles)
      throw (SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength)
 {
+  Unexpect aCatch(ATI_IncorrectArgumentLength);
   CheckLocked();
   Handle(SALOMEDS_TableOfIntegerAttribute) aTable = Handle(SALOMEDS_TableOfIntegerAttribute)::DownCast(_myAttr);
   if (theTitles.length() != aTable->GetNbColumns()) throw SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength();
@@ -125,6 +134,7 @@ SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfInteger_i::GetColumnTitles() {
 void SALOMEDS_AttributeTableOfInteger_i::SetRowUnit(CORBA::Long theIndex, const char* theUnit)
      throw (SALOMEDS::AttributeTableOfInteger::IncorrectIndex)
 {
+ Unexpect aCatch (ATI_IncorrectIndex);
   CheckLocked();
   Handle(SALOMEDS_TableOfIntegerAttribute) aTable = Handle(SALOMEDS_TableOfIntegerAttribute)::DownCast(_myAttr);
   if (theIndex <= 0 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfInteger::IncorrectIndex();
@@ -139,6 +149,7 @@ void SALOMEDS_AttributeTableOfInteger_i::SetRowUnit(CORBA::Long theIndex, const
 void SALOMEDS_AttributeTableOfInteger_i::SetRowUnits(const SALOMEDS::StringSeq& theUnits)
      throw (SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength)
 {
+  Unexpect aCatch (ATI_IncorrectArgumentLength);
   CheckLocked();
   Handle(SALOMEDS_TableOfIntegerAttribute) aTable = Handle(SALOMEDS_TableOfIntegerAttribute)::DownCast(_myAttr);
   if (theUnits.length() != aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength();
@@ -166,6 +177,7 @@ CORBA::Long SALOMEDS_AttributeTableOfInteger_i::GetNbColumns() {
 void SALOMEDS_AttributeTableOfInteger_i::AddRow(const SALOMEDS::LongSeq& theData)
      throw (SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength)
 {
+  Unexpect aCatch(ATI_IncorrectArgumentLength);
   CheckLocked();
   Handle(SALOMEDS_TableOfIntegerAttribute) aTable = Handle(SALOMEDS_TableOfIntegerAttribute)::DownCast(_myAttr);
   
@@ -182,6 +194,7 @@ void SALOMEDS_AttributeTableOfInteger_i::AddRow(const SALOMEDS::LongSeq& theData
 void SALOMEDS_AttributeTableOfInteger_i::SetRow(CORBA::Long theRow, const SALOMEDS::LongSeq& theData)
      throw (SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength, SALOMEDS::AttributeTableOfInteger::IncorrectIndex)
 {
+  Unexpect aCatch(ATI_IncorrectArgumentLength);
   CheckLocked();
   Handle(SALOMEDS_TableOfIntegerAttribute) aTable = Handle(SALOMEDS_TableOfIntegerAttribute)::DownCast(_myAttr);
   
@@ -198,6 +211,7 @@ void SALOMEDS_AttributeTableOfInteger_i::SetRow(CORBA::Long theRow, const SALOME
 SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfInteger_i::GetRow(CORBA::Long theRow)
      throw (SALOMEDS::AttributeTableOfInteger::IncorrectIndex)
 {
+  Unexpect aCatch(ATI_IncorrectIndex);
   Handle(SALOMEDS_TableOfIntegerAttribute) aTable = Handle(SALOMEDS_TableOfIntegerAttribute)::DownCast(_myAttr);
   if (theRow <= 0 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfInteger::IncorrectIndex();
 
@@ -213,6 +227,7 @@ SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfInteger_i::GetRow(CORBA::Long theRow
 void SALOMEDS_AttributeTableOfInteger_i::AddColumn(const SALOMEDS::LongSeq& theData)
      throw (SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength)
 {
+  Unexpect aCatch(ATI_IncorrectArgumentLength);
   CheckLocked();
   Handle(SALOMEDS_TableOfIntegerAttribute) aTable = Handle(SALOMEDS_TableOfIntegerAttribute)::DownCast(_myAttr);
   
@@ -229,6 +244,7 @@ void SALOMEDS_AttributeTableOfInteger_i::AddColumn(const SALOMEDS::LongSeq& theD
 void SALOMEDS_AttributeTableOfInteger_i::SetColumn(CORBA::Long theColumn, const SALOMEDS::LongSeq& theData)
      throw (SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength, SALOMEDS::AttributeTableOfInteger::IncorrectIndex)
 {
+  Unexpect aCatch(ATI_IncorrectArgumentLength);
   CheckLocked();
   Handle(SALOMEDS_TableOfIntegerAttribute) aTable = Handle(SALOMEDS_TableOfIntegerAttribute)::DownCast(_myAttr);
   
@@ -245,6 +261,7 @@ void SALOMEDS_AttributeTableOfInteger_i::SetColumn(CORBA::Long theColumn, const
 SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfInteger_i::GetColumn(CORBA::Long theColumn)
      throw (SALOMEDS::AttributeTableOfInteger::IncorrectIndex)
 {
+  Unexpect aCatch(ATI_IncorrectIndex);
   Handle(SALOMEDS_TableOfIntegerAttribute) aTable = Handle(SALOMEDS_TableOfIntegerAttribute)::DownCast(_myAttr);
   if (theColumn <= 0 || theColumn > aTable->GetNbColumns()) throw SALOMEDS::AttributeTableOfInteger::IncorrectIndex();
 
@@ -260,6 +277,7 @@ SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfInteger_i::GetColumn(CORBA::Long the
 void SALOMEDS_AttributeTableOfInteger_i::PutValue(CORBA::Long theValue, CORBA::Long theRow, CORBA::Long theColumn)
      throw (SALOMEDS::AttributeTableOfInteger::IncorrectIndex)
 {
+  Unexpect aCatch(ATI_IncorrectIndex);
   CheckLocked();
   Handle(SALOMEDS_TableOfIntegerAttribute) aTable = Handle(SALOMEDS_TableOfIntegerAttribute)::DownCast(_myAttr);
 
@@ -278,6 +296,7 @@ CORBA::Boolean SALOMEDS_AttributeTableOfInteger_i::HasValue(CORBA::Long theRow,
 CORBA::Long SALOMEDS_AttributeTableOfInteger_i::GetValue(CORBA::Long theRow, CORBA::Long theColumn)
      throw (SALOMEDS::AttributeTableOfInteger::IncorrectIndex)
 {
+  Unexpect aCatch(ATI_IncorrectIndex);
   Handle(SALOMEDS_TableOfIntegerAttribute) aTable = Handle(SALOMEDS_TableOfIntegerAttribute)::DownCast(_myAttr);
   if (theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfInteger::IncorrectIndex();
 
@@ -341,3 +360,20 @@ SALOMEDS::TMPFile*  SALOMEDS_AttributeTableOfInteger_i::SaveToFile()
   return aStreamFile._retn();
 }
 
+char* SALOMEDS_AttributeTableOfInteger_i::Store() {
+  Handle(SALOMEDS_TableOfIntegerAttribute) aTable = Handle(SALOMEDS_TableOfIntegerAttribute)::DownCast(_myAttr);
+
+  ostrstream ostr;
+  aTable->ConvertToString(ostr);
+  string aString = ostr.rdbuf()->str();
+
+  CORBA::String_var aBuffer = CORBA::string_dup(aString.c_str());
+  return aBuffer._retn();
+}
+
+void SALOMEDS_AttributeTableOfInteger_i::Restore(const char* value) {
+  Handle(SALOMEDS_TableOfIntegerAttribute) aTable = Handle(SALOMEDS_TableOfIntegerAttribute)::DownCast(_myAttr);
+
+  istrstream aStream(value, strlen(value));
+  aTable->RestoreFromString(aStream);
+}
index c26bf5d9f98ecdf49917bb5bba94379153f93c88..6b3ca5238be6df314781b0bb805929cf913a04a3 100644 (file)
@@ -75,6 +75,10 @@ public:
 
   virtual bool ReadFromFile(const SALOMEDS::TMPFile& theStream);
   virtual SALOMEDS::TMPFile* SaveToFile();
+
+  virtual char* Store();
+  virtual void Restore(const char*);
+
 };
 
 #endif
index 432f42e5e4d54e09bde487c2e6fc478deef7045f..cb06a664f23271e31d45e085df1864f89d5a4953 100644 (file)
@@ -19,6 +19,10 @@ using namespace std;
 #include <strstream>
 #include <string>
 
+#include "Utils_ExceptHandlers.hxx"
+UNEXPECT_CATCH(ATR_IncorrectIndex, SALOMEDS::AttributeTableOfReal::IncorrectIndex);
+UNEXPECT_CATCH(ATR_IncorrectArgumentLength, SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength);
+
 #define SEPARATOR '\1'
 
 static TCollection_ExtendedString getUnit(TCollection_ExtendedString theString)
@@ -57,6 +61,7 @@ char* SALOMEDS_AttributeTableOfReal_i::GetTitle() {
 void SALOMEDS_AttributeTableOfReal_i::SetRowTitle(CORBA::Long theIndex, const char* theTitle)
      throw (SALOMEDS::AttributeTableOfReal::IncorrectIndex)
 {
+  Unexpect aCatch (ATR_IncorrectIndex);
   CheckLocked();
   Handle(SALOMEDS_TableOfRealAttribute) aTable = Handle(SALOMEDS_TableOfRealAttribute)::DownCast(_myAttr);
   if (theIndex <= 0 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfReal::IncorrectIndex();
@@ -74,6 +79,7 @@ void SALOMEDS_AttributeTableOfReal_i::SetRowTitle(CORBA::Long theIndex, const ch
 void SALOMEDS_AttributeTableOfReal_i::SetRowTitles(const SALOMEDS::StringSeq& theTitles)
      throw (SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength)
 {
+  Unexpect aCatch (ATR_IncorrectArgumentLength);
   CheckLocked();
   Handle(SALOMEDS_TableOfRealAttribute) aTable = Handle(SALOMEDS_TableOfRealAttribute)::DownCast(_myAttr);
   if (theTitles.length() != aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength();
@@ -94,6 +100,7 @@ SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfReal_i::GetRowTitles() {
 void SALOMEDS_AttributeTableOfReal_i::SetColumnTitle(CORBA::Long theIndex, const char* theTitle)
      throw (SALOMEDS::AttributeTableOfReal::IncorrectIndex)
 {
+  Unexpect aCatch (ATR_IncorrectIndex);
   CheckLocked();
   Handle(SALOMEDS_TableOfRealAttribute) aTable = Handle(SALOMEDS_TableOfRealAttribute)::DownCast(_myAttr);
   if (theIndex <= 0 || theIndex > aTable->GetNbColumns()) throw SALOMEDS::AttributeTableOfReal::IncorrectIndex();
@@ -104,6 +111,7 @@ void SALOMEDS_AttributeTableOfReal_i::SetColumnTitle(CORBA::Long theIndex, const
 void SALOMEDS_AttributeTableOfReal_i::SetColumnTitles(const SALOMEDS::StringSeq& theTitles)
      throw (SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength)
 {
+  Unexpect aCatch(ATR_IncorrectArgumentLength);
   CheckLocked();
   Handle(SALOMEDS_TableOfRealAttribute) aTable = Handle(SALOMEDS_TableOfRealAttribute)::DownCast(_myAttr);
   if (theTitles.length() != aTable->GetNbColumns()) throw SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength();
@@ -125,6 +133,7 @@ SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfReal_i::GetColumnTitles() {
 void SALOMEDS_AttributeTableOfReal_i::SetRowUnit(CORBA::Long theIndex, const char* theUnit)
      throw (SALOMEDS::AttributeTableOfReal::IncorrectIndex)
 {
+  Unexpect aCatch (ATR_IncorrectIndex);
   CheckLocked();
   Handle(SALOMEDS_TableOfRealAttribute) aTable = Handle(SALOMEDS_TableOfRealAttribute)::DownCast(_myAttr);
   if (theIndex <= 0 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfReal::IncorrectIndex();
@@ -139,6 +148,7 @@ void SALOMEDS_AttributeTableOfReal_i::SetRowUnit(CORBA::Long theIndex, const cha
 void SALOMEDS_AttributeTableOfReal_i::SetRowUnits(const SALOMEDS::StringSeq& theUnits)
      throw (SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength)
 {
+  Unexpect aCatch (ATR_IncorrectArgumentLength);
   CheckLocked();
   Handle(SALOMEDS_TableOfRealAttribute) aTable = Handle(SALOMEDS_TableOfRealAttribute)::DownCast(_myAttr);
   if (theUnits.length() != aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength();
@@ -167,6 +177,7 @@ CORBA::Long SALOMEDS_AttributeTableOfReal_i::GetNbColumns() {
 void SALOMEDS_AttributeTableOfReal_i::AddRow(const SALOMEDS::DoubleSeq& theData)
      throw (SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength)
 {
+  Unexpect aCatch(ATR_IncorrectArgumentLength);
   CheckLocked();
   Handle(SALOMEDS_TableOfRealAttribute) aTable = Handle(SALOMEDS_TableOfRealAttribute)::DownCast(_myAttr);
   
@@ -178,6 +189,7 @@ void SALOMEDS_AttributeTableOfReal_i::AddRow(const SALOMEDS::DoubleSeq& theData)
 void SALOMEDS_AttributeTableOfReal_i::SetRow(CORBA::Long theRow, const SALOMEDS::DoubleSeq& theData)
      throw (SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength, SALOMEDS::AttributeTableOfReal::IncorrectIndex)
 {
+  Unexpect aCatch(ATR_IncorrectArgumentLength);
   CheckLocked();
   Handle(SALOMEDS_TableOfRealAttribute) aTable = Handle(SALOMEDS_TableOfRealAttribute)::DownCast(_myAttr);
   
@@ -189,6 +201,7 @@ void SALOMEDS_AttributeTableOfReal_i::SetRow(CORBA::Long theRow, const SALOMEDS:
 SALOMEDS::DoubleSeq* SALOMEDS_AttributeTableOfReal_i::GetRow(CORBA::Long theRow)
      throw (SALOMEDS::AttributeTableOfReal::IncorrectIndex)
 {
+  Unexpect aCatch(ATR_IncorrectIndex);
   Handle(SALOMEDS_TableOfRealAttribute) aTable = Handle(SALOMEDS_TableOfRealAttribute)::DownCast(_myAttr);
   if (theRow <= 0 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfReal::IncorrectIndex();
 
@@ -204,6 +217,7 @@ SALOMEDS::DoubleSeq* SALOMEDS_AttributeTableOfReal_i::GetRow(CORBA::Long theRow)
 void SALOMEDS_AttributeTableOfReal_i::AddColumn(const SALOMEDS::DoubleSeq& theData)
      throw (SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength)
 {
+  Unexpect aCatch(ATR_IncorrectArgumentLength);
   CheckLocked();
   Handle(SALOMEDS_TableOfRealAttribute) aTable = Handle(SALOMEDS_TableOfRealAttribute)::DownCast(_myAttr);
   
@@ -215,6 +229,7 @@ void SALOMEDS_AttributeTableOfReal_i::AddColumn(const SALOMEDS::DoubleSeq& theDa
 void SALOMEDS_AttributeTableOfReal_i::SetColumn(CORBA::Long theColumn, const SALOMEDS::DoubleSeq& theData)
      throw (SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength, SALOMEDS::AttributeTableOfReal::IncorrectIndex)
 {
+  Unexpect aCatch(ATR_IncorrectArgumentLength);
   CheckLocked();
   Handle(SALOMEDS_TableOfRealAttribute) aTable = Handle(SALOMEDS_TableOfRealAttribute)::DownCast(_myAttr);
   
@@ -226,6 +241,7 @@ void SALOMEDS_AttributeTableOfReal_i::SetColumn(CORBA::Long theColumn, const SAL
 SALOMEDS::DoubleSeq* SALOMEDS_AttributeTableOfReal_i::GetColumn(CORBA::Long theColumn)
      throw (SALOMEDS::AttributeTableOfReal::IncorrectIndex)
 {
+  Unexpect aCatch(ATR_IncorrectIndex);
   Handle(SALOMEDS_TableOfRealAttribute) aTable = Handle(SALOMEDS_TableOfRealAttribute)::DownCast(_myAttr);
   if (theColumn <= 0 || theColumn > aTable->GetNbColumns()) throw SALOMEDS::AttributeTableOfReal::IncorrectIndex();
 
@@ -241,6 +257,7 @@ SALOMEDS::DoubleSeq* SALOMEDS_AttributeTableOfReal_i::GetColumn(CORBA::Long theC
 void SALOMEDS_AttributeTableOfReal_i::PutValue(CORBA::Double theValue, CORBA::Long theRow, CORBA::Long theColumn)
      throw (SALOMEDS::AttributeTableOfReal::IncorrectIndex)
 {
+  Unexpect aCatch(ATR_IncorrectIndex);
   CheckLocked();
   Handle(SALOMEDS_TableOfRealAttribute) aTable = Handle(SALOMEDS_TableOfRealAttribute)::DownCast(_myAttr);
 
@@ -254,6 +271,7 @@ CORBA::Boolean SALOMEDS_AttributeTableOfReal_i::HasValue(CORBA::Long theRow, COR
 CORBA::Double SALOMEDS_AttributeTableOfReal_i::GetValue(CORBA::Long theRow, CORBA::Long theColumn)
      throw (SALOMEDS::AttributeTableOfReal::IncorrectIndex)
 {
+  Unexpect aCatch(ATR_IncorrectIndex);
   Handle(SALOMEDS_TableOfRealAttribute) aTable = Handle(SALOMEDS_TableOfRealAttribute)::DownCast(_myAttr);
   if (theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfReal::IncorrectIndex();
 
@@ -320,3 +338,20 @@ SALOMEDS::TMPFile*  SALOMEDS_AttributeTableOfReal_i::SaveToFile()
   return aStreamFile._retn();
 }
 
+char* SALOMEDS_AttributeTableOfReal_i::Store() {
+  Handle(SALOMEDS_TableOfRealAttribute) aTable = Handle(SALOMEDS_TableOfRealAttribute)::DownCast(_myAttr);
+
+  ostrstream ostr;
+  aTable->ConvertToString(ostr);
+  string aString = ostr.rdbuf()->str();
+
+  CORBA::String_var aBuffer = CORBA::string_dup(aString.c_str());
+  return aBuffer._retn();
+}
+
+void SALOMEDS_AttributeTableOfReal_i::Restore(const char* value) {
+  Handle(SALOMEDS_TableOfRealAttribute) aTable = Handle(SALOMEDS_TableOfRealAttribute)::DownCast(_myAttr);
+
+  istrstream aStream(value, strlen(value));
+  aTable->RestoreFromString(aStream);
+}
index 63ba28ccb05354d8161abee9aff72527eba4fffe..a3e8056b8cfd8e8581bce47bab3fee45404fdb98 100644 (file)
@@ -75,6 +75,10 @@ public:
 
   virtual bool ReadFromFile(const SALOMEDS::TMPFile& theStream);
   virtual SALOMEDS::TMPFile* SaveToFile();
+
+  virtual char* Store();
+  virtual void Restore(const char*);
+
 };
 
 #endif
index 262cdce8d479a8fef833ed3f8834f9ee686a81e0..b77322d31c8db996a22dd51aa8eca4b3ce684bc1 100644 (file)
@@ -22,6 +22,10 @@ using namespace std;
 #include <strstream>
 #include <string>
 
+#include "Utils_ExceptHandlers.hxx"
+UNEXPECT_CATCH(ATS_IncorrectIndex, SALOMEDS::AttributeTableOfString::IncorrectIndex);
+UNEXPECT_CATCH(ATS_IncorrectArgumentLength, SALOMEDS::AttributeTableOfString::IncorrectArgumentLength);
+
 #define SEPARATOR '\1'
 
 static TCollection_ExtendedString getUnit(TCollection_ExtendedString theString)
@@ -60,6 +64,7 @@ char* SALOMEDS_AttributeTableOfString_i::GetTitle() {
 void SALOMEDS_AttributeTableOfString_i::SetRowTitle(CORBA::Long theIndex, const char* theTitle)
      throw (SALOMEDS::AttributeTableOfString::IncorrectIndex)
 {
+  Unexpect aCatch(ATS_IncorrectIndex);
   CheckLocked();
   Handle(SALOMEDS_TableOfStringAttribute) aTable = Handle(SALOMEDS_TableOfStringAttribute)::DownCast(_myAttr);
   if (theIndex <= 0 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfString::IncorrectIndex();
@@ -77,6 +82,7 @@ void SALOMEDS_AttributeTableOfString_i::SetRowTitle(CORBA::Long theIndex, const
 void SALOMEDS_AttributeTableOfString_i::SetRowTitles(const SALOMEDS::StringSeq& theTitles)
      throw (SALOMEDS::AttributeTableOfString::IncorrectArgumentLength)
 {
+  Unexpect aCatch(ATS_IncorrectArgumentLength);
   CheckLocked();
   Handle(SALOMEDS_TableOfStringAttribute) aTable = Handle(SALOMEDS_TableOfStringAttribute)::DownCast(_myAttr);
   if (theTitles.length() != aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfString::IncorrectArgumentLength();
@@ -97,6 +103,7 @@ SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfString_i::GetRowTitles() {
 void SALOMEDS_AttributeTableOfString_i::SetColumnTitle(CORBA::Long theIndex, const char* theTitle)
      throw (SALOMEDS::AttributeTableOfString::IncorrectIndex)
 {
+  Unexpect aCatch(ATS_IncorrectIndex);
   CheckLocked();
   Handle(SALOMEDS_TableOfStringAttribute) aTable = Handle(SALOMEDS_TableOfStringAttribute)::DownCast(_myAttr);
   if (theIndex <= 0 || theIndex > aTable->GetNbColumns()) throw SALOMEDS::AttributeTableOfString::IncorrectIndex();
@@ -107,6 +114,7 @@ void SALOMEDS_AttributeTableOfString_i::SetColumnTitle(CORBA::Long theIndex, con
 void SALOMEDS_AttributeTableOfString_i::SetColumnTitles(const SALOMEDS::StringSeq& theTitles)
      throw (SALOMEDS::AttributeTableOfString::IncorrectArgumentLength)
 {
+  Unexpect aCatch(ATS_IncorrectArgumentLength);
   CheckLocked();
   Handle(SALOMEDS_TableOfStringAttribute) aTable = Handle(SALOMEDS_TableOfStringAttribute)::DownCast(_myAttr);
   if (theTitles.length() != aTable->GetNbColumns()) throw SALOMEDS::AttributeTableOfString::IncorrectArgumentLength();
@@ -128,6 +136,7 @@ SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfString_i::GetColumnTitles() {
 void SALOMEDS_AttributeTableOfString_i::SetRowUnit(CORBA::Long theIndex, const char* theUnit)
      throw (SALOMEDS::AttributeTableOfString::IncorrectIndex)
 {
+  Unexpect aCatch(ATS_IncorrectIndex);
   CheckLocked();
   Handle(SALOMEDS_TableOfStringAttribute) aTable = Handle(SALOMEDS_TableOfStringAttribute)::DownCast(_myAttr);
   if (theIndex <= 0 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfString::IncorrectIndex();
@@ -142,6 +151,7 @@ void SALOMEDS_AttributeTableOfString_i::SetRowUnit(CORBA::Long theIndex, const c
 void SALOMEDS_AttributeTableOfString_i::SetRowUnits(const SALOMEDS::StringSeq& theUnits)
      throw (SALOMEDS::AttributeTableOfString::IncorrectArgumentLength)
 {
+  Unexpect aCatch(ATS_IncorrectArgumentLength);
   CheckLocked();
   Handle(SALOMEDS_TableOfStringAttribute) aTable = Handle(SALOMEDS_TableOfStringAttribute)::DownCast(_myAttr);
   if (theUnits.length() != aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfString::IncorrectArgumentLength();
@@ -170,6 +180,7 @@ CORBA::Long SALOMEDS_AttributeTableOfString_i::GetNbColumns() {
 void SALOMEDS_AttributeTableOfString_i::AddRow(const SALOMEDS::StringSeq& theData)
      throw (SALOMEDS::AttributeTableOfString::IncorrectArgumentLength)
 {
+  Unexpect aCatch(ATS_IncorrectArgumentLength);
   CheckLocked();
   Handle(SALOMEDS_TableOfStringAttribute) aTable = Handle(SALOMEDS_TableOfStringAttribute)::DownCast(_myAttr);
   
@@ -181,6 +192,7 @@ void SALOMEDS_AttributeTableOfString_i::AddRow(const SALOMEDS::StringSeq& theDat
 void SALOMEDS_AttributeTableOfString_i::SetRow(CORBA::Long theRow, const SALOMEDS::StringSeq& theData)
      throw (SALOMEDS::AttributeTableOfString::IncorrectArgumentLength, SALOMEDS::AttributeTableOfString::IncorrectIndex)
 {
+  Unexpect aCatch(ATS_IncorrectArgumentLength);
   CheckLocked();
   Handle(SALOMEDS_TableOfStringAttribute) aTable = Handle(SALOMEDS_TableOfStringAttribute)::DownCast(_myAttr);
   
@@ -192,6 +204,7 @@ void SALOMEDS_AttributeTableOfString_i::SetRow(CORBA::Long theRow, const SALOMED
 SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfString_i::GetRow(CORBA::Long theRow)
      throw (SALOMEDS::AttributeTableOfString::IncorrectIndex)
 {
+  Unexpect aCatch(ATS_IncorrectIndex);
   Handle(SALOMEDS_TableOfStringAttribute) aTable = Handle(SALOMEDS_TableOfStringAttribute)::DownCast(_myAttr);
   if (theRow <= 0 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfString::IncorrectIndex();
 
@@ -207,6 +220,7 @@ SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfString_i::GetRow(CORBA::Long theRo
 void SALOMEDS_AttributeTableOfString_i::AddColumn(const SALOMEDS::StringSeq& theData)
      throw (SALOMEDS::AttributeTableOfString::IncorrectArgumentLength)
 {
+  Unexpect aCatch(ATS_IncorrectArgumentLength);
   CheckLocked();
   Handle(SALOMEDS_TableOfStringAttribute) aTable = Handle(SALOMEDS_TableOfStringAttribute)::DownCast(_myAttr);
   
@@ -218,6 +232,7 @@ void SALOMEDS_AttributeTableOfString_i::AddColumn(const SALOMEDS::StringSeq& the
 void SALOMEDS_AttributeTableOfString_i::SetColumn(CORBA::Long theColumn, const SALOMEDS::StringSeq& theData)
      throw (SALOMEDS::AttributeTableOfString::IncorrectArgumentLength, SALOMEDS::AttributeTableOfString::IncorrectIndex)
 {
+  Unexpect aCatch(ATS_IncorrectArgumentLength);
   CheckLocked();
   Handle(SALOMEDS_TableOfStringAttribute) aTable = Handle(SALOMEDS_TableOfStringAttribute)::DownCast(_myAttr);
   
@@ -229,6 +244,7 @@ void SALOMEDS_AttributeTableOfString_i::SetColumn(CORBA::Long theColumn, const S
 SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfString_i::GetColumn(CORBA::Long theColumn)
      throw (SALOMEDS::AttributeTableOfString::IncorrectIndex)
 {
+  Unexpect aCatch(ATS_IncorrectIndex);
   Handle(SALOMEDS_TableOfStringAttribute) aTable = Handle(SALOMEDS_TableOfStringAttribute)::DownCast(_myAttr);
   if (theColumn <= 0 || theColumn > aTable->GetNbColumns()) throw SALOMEDS::AttributeTableOfString::IncorrectIndex();
 
@@ -244,6 +260,7 @@ SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfString_i::GetColumn(CORBA::Long th
 void SALOMEDS_AttributeTableOfString_i::PutValue(const char* theValue, CORBA::Long theRow, CORBA::Long theColumn)
      throw (SALOMEDS::AttributeTableOfString::IncorrectIndex)
 {
+  Unexpect aCatch(ATS_IncorrectIndex);
   CheckLocked();
   Handle(SALOMEDS_TableOfStringAttribute) aTable = Handle(SALOMEDS_TableOfStringAttribute)::DownCast(_myAttr);
   char* aValue = CORBA::string_dup(theValue);
@@ -258,6 +275,7 @@ CORBA::Boolean SALOMEDS_AttributeTableOfString_i::HasValue(CORBA::Long theRow, C
 char* SALOMEDS_AttributeTableOfString_i::GetValue(CORBA::Long theRow, CORBA::Long theColumn)
      throw (SALOMEDS::AttributeTableOfString::IncorrectIndex)
 {
+  Unexpect aCatch(ATS_IncorrectIndex);
   Handle(SALOMEDS_TableOfStringAttribute) aTable = Handle(SALOMEDS_TableOfStringAttribute)::DownCast(_myAttr);
   if (theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfString::IncorrectIndex();
 
@@ -316,3 +334,20 @@ SALOMEDS::TMPFile*  SALOMEDS_AttributeTableOfString_i::SaveToFile()
   return aStreamFile._retn();
 }
 
+char* SALOMEDS_AttributeTableOfString_i::Store() {
+  Handle(SALOMEDS_TableOfStringAttribute) aTable = Handle(SALOMEDS_TableOfStringAttribute)::DownCast(_myAttr);
+
+  ostrstream ostr;
+  aTable->ConvertToString(ostr);
+  string aString = ostr.rdbuf()->str();
+
+  CORBA::String_var aBuffer = CORBA::string_dup(aString.c_str());
+  return aBuffer._retn();
+}
+
+void SALOMEDS_AttributeTableOfString_i::Restore(const char* value) {
+  Handle(SALOMEDS_TableOfStringAttribute) aTable = Handle(SALOMEDS_TableOfStringAttribute)::DownCast(_myAttr);
+
+  istrstream aStream(value, strlen(value));
+  aTable->RestoreFromString(aStream);
+}
index 0368c59c5fdd92cb8030ccdecdda347e6cfcc072..f3a87deeabc1130f08dd4781beaac5861b1dcece 100644 (file)
@@ -74,6 +74,10 @@ public:
 
   virtual bool ReadFromFile(const SALOMEDS::TMPFile& theStream);
   virtual SALOMEDS::TMPFile* SaveToFile();
+
+  char* Store();
+  void Restore(const char*);
+
 };
 
 #endif
index f5f35cc7ba1bc9da8f08015e65503781370ba99b..1d14121c12467a257664307ccef0fd6b79c5c89f 100644 (file)
@@ -24,7 +24,7 @@
 //  File   : SALOMEDS_AttributeTarget_i.cxx
 //  Author : Yves FRICAUD
 //  Module : SALOME
-//  $Header
+//  $Header$
 
 using namespace std;
 #include "SALOMEDS_AttributeTarget_i.hxx"
index 0f040990c55162ec8d56487ac0c23841b07729ee..cf63ff0d97d16341fb1ddcce1b38770d2505bf51 100644 (file)
@@ -55,3 +55,20 @@ void SALOMEDS_AttributeTextColor_i::SetTextColor(const SALOMEDS::Color& value) {
   anArray->SetValue(3, value.B);
   Handle(SALOMEDS_TextColorAttribute)::DownCast(_myAttr)->ChangeArray(anArray);
 }
+
+char* SALOMEDS_AttributeTextColor_i::Store() {
+  SALOMEDS::Color aColor = TextColor();
+  char *Val = new char[75];
+  sprintf(Val, "%f %f %f", (float)aColor.R, (float)aColor.G, (float)aColor.B);
+  return Val;
+}
+
+void SALOMEDS_AttributeTextColor_i::Restore(const char* value) {
+  SALOMEDS::Color aColor;
+  float r, g, b;
+  sscanf(value, "%f %f %f", &r, &g, &b);
+  aColor.R = r;
+  aColor.G = g;
+  aColor.B = b;
+  SetTextColor(aColor);
+}
index f03c98b9e9ddf4f74e204e88a7666e7a900e7149..46b50ff12dc3c0938daa4ff5ca2223c9d32f6ee7 100644 (file)
@@ -24,7 +24,7 @@
 //  File   : SALOMEDS_AttributeTextColor_i.hxx
 //  Author : Yves FRICAUD
 //  Module : SALOME
-//  $Header
+//  $Header$
 
 #ifndef SALOMEDS_AttributeTextColor_i_HeaderFile
 #define SALOMEDS_AttributeTextColor_i_HeaderFile
@@ -48,6 +48,10 @@ public:
 
   SALOMEDS::Color TextColor();
   void SetTextColor(const SALOMEDS::Color& value);
+
+  char* Store();
+  void Restore(const char*);
+
 };
 
 
index 9ba430ba897524b118378b059a0ffab0b703f4f5..0995ac90a6133cbf50216a74c14c67bc963cdcf2 100644 (file)
@@ -55,3 +55,20 @@ void SALOMEDS_AttributeTextHighlightColor_i::SetTextHighlightColor(const SALOMED
   anArray->SetValue(3, value.B);
   Handle(SALOMEDS_TextHighlightColorAttribute)::DownCast(_myAttr)->ChangeArray(anArray);
 }
+
+char* SALOMEDS_AttributeTextHighlightColor_i::Store() {
+  SALOMEDS::Color aColor = TextHighlightColor();
+  char *Val = new char[75];
+  sprintf(Val, "%f %f %f", (float)aColor.R, (float)aColor.G, (float)aColor.B);
+  return Val;
+}
+
+void SALOMEDS_AttributeTextHighlightColor_i::Restore(const char* value) {
+  SALOMEDS::Color aColor;
+  float r, g, b;
+  sscanf(value, "%f %f %f", &r, &g, &b);
+  aColor.R = r;
+  aColor.G = g;
+  aColor.B = b;
+  SetTextHighlightColor(aColor);
+}
index 2b7e487dcc2140af489159292f24f2f6fb5266f6..2ca180ffe3775f41a424e07c4a46678894be50e2 100644 (file)
@@ -24,7 +24,7 @@
 //  File   : SALOMEDS_AttributeTextHighlightColor_i.hxx
 //  Author : Yves FRICAUD
 //  Module : SALOME
-//  $Header
+//  $Header$
 
 #ifndef SALOMEDS_AttributeTextHighlightColor_i_HeaderFile
 #define SALOMEDS_AttributeTextHighlightColor_i_HeaderFile
@@ -48,6 +48,10 @@ public:
 
   SALOMEDS::Color TextHighlightColor();
   void SetTextHighlightColor(const SALOMEDS::Color& value);
+
+  char* Store();
+  void Restore(const char*);
+
 };
 
 
index 11d326b5c7b4b73550a7e002a59586981a8dd480..6e575f1310ff8b49f490d352e8159e49c5457041 100644 (file)
 //  File   : SALOMEDS_AttributeTreeNode_i.cxx
 //  Author : Yves FRICAUD
 //  Module : SALOME
-//  $Header
+//  $Header$
 
 using namespace std;
 #include "SALOMEDS_AttributeTreeNode_i.hxx"
 #include "SALOMEDS_SObject_i.hxx"
 #include "utilities.h"
+#include <TDocStd_Document.hxx>
+#include <TDF_Tool.hxx>
 
 static Handle(TDataStd_TreeNode) GetNode(SALOMEDS::AttributeTreeNode_ptr value,
                                         const Handle(TDataStd_TreeNode)& aNode) {
@@ -182,3 +184,56 @@ char* SALOMEDS_AttributeTreeNode_i::Label() {
   TDF_Tool::Entry(_myAttr->Label(),aLabelName);
   return CORBA::String_var(CORBA::string_dup(aLabelName.ToCString()))._retn();
 }
+
+char* SALOMEDS_AttributeTreeNode_i::Store() {
+  char* aStr[4];
+
+  if (HasFather()) aStr[0] = GetFather()->Label(); else aStr[0] = "!";
+  if (HasPrevious()) aStr[1] = GetPrevious()->Label(); else aStr[1] = "!";
+  if (HasNext()) aStr[2] = GetNext()->Label(); else aStr[2] = "!";
+  if (HasFirst()) aStr[3] = GetFirst()->Label(); else aStr[3] = "!";
+
+  int aLength = 4;
+  aLength += strlen(aStr[0]) + strlen(aStr[1]) + strlen(aStr[2]) + strlen(aStr[3]);
+  CORBA::String_var aResult = new char[aLength];
+  sprintf(aResult, "%s %s %s %s", aStr[0], aStr[1], aStr[2], aStr[3]);
+  return aResult._retn();
+}
+
+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* adr = strtok(aCopy, " ");
+  
+  TDF_Label aLabel;
+  Handle(TDataStd_TreeNode) aDepNode;
+
+  if (adr && adr[0] != '!') {
+    TDF_Tool::Label(DF, adr, aLabel, 1);
+    if (!aLabel.FindAttribute(aNode->ID(), aDepNode)) aDepNode = TDataStd_TreeNode::Set(aLabel, aNode->ID());
+    aNode->SetFather(aDepNode);
+  }
+
+  adr = strtok(NULL, " ");
+  if (adr && adr[0] != '!') {
+    TDF_Tool::Label(DF, adr, aLabel, 1);
+    if (!aLabel.FindAttribute(aNode->ID(), aDepNode)) aDepNode = TDataStd_TreeNode::Set(aLabel, aNode->ID());
+    aNode->SetPrevious(aDepNode);
+  }
+
+  adr = strtok(NULL, " ");
+  if (adr && adr[0] != '!') {
+    TDF_Tool::Label(DF, adr, aLabel, 1);
+    if (!aLabel.FindAttribute(aNode->ID(), aDepNode)) aDepNode = TDataStd_TreeNode::Set(aLabel, aNode->ID());
+    aNode->SetNext(aDepNode);
+  }
+
+  adr = strtok(NULL, " ");
+  if (adr && adr[0] != '!') {
+    TDF_Tool::Label(DF, adr, aLabel, 1);
+    if (!aLabel.FindAttribute(aNode->ID(), aDepNode)) aDepNode = TDataStd_TreeNode::Set(aLabel, aNode->ID());
+    aNode->SetFirst(aDepNode);
+  }
+}
index c8bda02dc64c312f9b277745a0f5d2d7a3b9c365..14e134b275fd0fd2abbb707b5bd537b5e76ef45e 100644 (file)
@@ -71,6 +71,10 @@ public:
   CORBA::Boolean IsFather(SALOMEDS::AttributeTreeNode_ptr value);
   CORBA::Boolean IsChild(SALOMEDS::AttributeTreeNode_ptr value);
   char* Label();
+
+  char* Store();
+  void Restore(const char*);
+
 };
 
 #endif
index 632d95beb9e6a3317e475200ca4fab4a9d1d9c21..b7fa64a41b9fd4fc3369f6a727b91a15c938749d 100644 (file)
@@ -24,7 +24,7 @@
 //  File   : SALOMEDS_AttributeName_i.cxx
 //  Author : Yves FRICAUD
 //  Module : SALOME
-//  $Header
+//  $Header$
 
 using namespace std;
 #include "SALOMEDS_AttributeUserID_i.hxx"
@@ -43,3 +43,10 @@ void SALOMEDS_AttributeUserID_i::SetValue(const char* value) {
   CORBA::String_var Str = CORBA::string_dup(value);
   Handle(TDataStd_UAttribute)::DownCast(_myAttr)->SetID(Standard_GUID(Standard_CString(Str)));
 }
+
+char* SALOMEDS_AttributeUserID_i::Store() {
+  return "";
+}
+
+void SALOMEDS_AttributeUserID_i::Restore(const char* value) {
+}
index 662d21ecad3adadcea79b709fc479fd15e4ac23f..e080658af56e7a985450235dd187a42f29cf326f 100644 (file)
@@ -54,6 +54,10 @@ public:
     static Standard_GUID SALOMEDS_DefaultUserAttributeID ("FFFFFFFF-D9CD-11d6-945D-1050DA506788");
     return SALOMEDS_DefaultUserAttributeID;
   }
+
+  char* Store();
+  void Restore(const char*);
+
 };
 
 
index bd83af147d6b99f0b659e487c85428da0e4d2e0b..707c40e10151dffd3f3cc5fa9fdd585af9b75381 100644 (file)
@@ -38,16 +38,17 @@ using namespace std;
 SALOMEDS_BasicAttribute_i* BasicAttributeFactory::Create(const char* type)
     throw (SALOME_Exception)
 {
-  if (!strcmp(type,"AttReal"))
-    {  
-      SALOMEDS_AttReal_i *A = new SALOMEDS_AttReal_i();
-      return A;
-    }
-  else if(!strcmp(type,"AttLong"))
-    {
-      SALOMEDS_AttLong_i *A = new SALOMEDS_AttLong_i();
-      return A;
-    }
-  else throw(SALOME_Exception(LOCALIZED("bad attribute type name")));
-
+  try {
+    if (!strcmp(type,"AttReal"))
+      {  
+       SALOMEDS_AttReal_i *A = new SALOMEDS_AttReal_i();
+       return A;
+      }
+    else if(!strcmp(type,"AttLong"))
+      {
+       SALOMEDS_AttLong_i *A = new SALOMEDS_AttLong_i();
+       return A;
+      }
+    else throw(SALOME_Exception(LOCALIZED("bad attribute type name")));
+  } catch (...) {throw(SALOME_Exception(LOCALIZED("Unexpected exception was caught")));}
 }
index 21605525382911de6e10c5fe812464310d0d153e..98c011e2744079c44035bc78668cf42b41ff2cd8 100644 (file)
@@ -24,7 +24,7 @@
 //  File   : SALOMEDS_DataMapIteratorOfDataMapStringLabel.hxx
 //  Author : Yves FRICAUD
 //  Module : SALOME
-//  $Header
+//  $Header$
 
 #ifndef _SALOMEDS_DataMapIteratorOfDataMapStringLabel_HeaderFile
 #define _SALOMEDS_DataMapIteratorOfDataMapStringLabel_HeaderFile
index 080f4b79d48ca2d9c19fda6e563738ff0876019f..1473d66c57876e5746bcc2aad9dcd80e0933edcc 100644 (file)
@@ -24,7 +24,7 @@
 //  File   : SALOMEDS_DataMapIteratorOfDataMapStringLabel_0.cxx
 //  Author : Yves FRICAUD
 //  Module : SALOME
-//  $Header
+//  $Header$
 
 using namespace std;
 #include "SALOMEDS_DataMapIteratorOfDataMapStringLabel.hxx"
index 175205a6ebb186c114952dc615c8a2d1b1119fbe..5fa7a9f17071e703d3399e53079326cc14470d23 100644 (file)
@@ -24,7 +24,7 @@
 //  File   : SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx
 //  Author : Yves FRICAUD
 //  Module : SALOME
-//  $Header
+//  $Header$
 
 #ifndef _SALOMEDS_DataMapNodeOfDataMapStringLabel_HeaderFile
 #define _SALOMEDS_DataMapNodeOfDataMapStringLabel_HeaderFile
index 2b063d4793412ae9152bd3678bedea9b7ae49af8..401a2b77ec6b5bc24b81fe46b48f4394b13698e5 100644 (file)
@@ -24,7 +24,7 @@
 //  File   : Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel_0.cxx
 //  Author : Yves FRICAUD
 //  Module : SALOME
-//  $Header
+//  $Header$
 
 using namespace std;
 #include "SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx"
index ef2ddbdffe60254561173ba612f0650972ea9e4d..7de27e8e1deccd40457e96f03b636fbe7a5f8f1c 100644 (file)
@@ -24,7 +24,7 @@
 //  File   : SALOMEDS_DataMapStringLabel.hxx
 //  Author : Yves FRICAUD
 //  Module : SALOME
-//  $Header
+//  $Header$
 
 #ifndef _SALOMEDS_DataMapStringLabel_HeaderFile
 #define _SALOMEDS_DataMapStringLabel_HeaderFile
index 4befe2030eebd461e8fa95577b2e31ef0ccbea46..76dab0d3bb27cc2d01c18e47850c7210abd4bcec 100644 (file)
@@ -24,7 +24,7 @@
 //  File   : SALOMEDS_DataMapStringLabel_0.cxx
 //  Author : Yves FRICAUD
 //  Module : SALOME
-//  $Header
+//  $Header$
 
 using namespace std;
 #include "SALOMEDS_DataMapStringLabel.hxx"
index 62bed2f1b9f3afdce81220e2f7338d3b2912f80c..8d72f6a6a1d136794c5947b2871a71f8df7c7efa 100644 (file)
@@ -24,7 +24,7 @@
 //  File   : SALOMEDS_DrawableAttribute.cxx
 //  Author : Yves FRICAUD
 //  Module : SALOME
-//  $Header:  
+//  $Header$
 
 using namespace std;
 #include "SALOMEDS_DrawableAttribute.ixx"
index ad3cc3c5d409bcab830503c3fb5b282415149c5a..b20dd9c1001349553a8f609b5601a33e8f68873b 100644 (file)
@@ -24,7 +24,7 @@
 //  File   : SALOMEDS_ExpandableAttribute.cxx
 //  Author : Yves FRICAUD
 //  Module : SALOME
-//  $Header:  
+//  $Header$
 
 using namespace std;
 #include "SALOMEDS_ExpandableAttribute.ixx"
index 2e07b0106d0b0347392d1c1b437720119025d4e9..3b5af83990df0f122b49dca707f74197575cb948 100644 (file)
@@ -24,7 +24,7 @@
 //  File   : SALOMEDS_ExternalFileDef.cxx
 //  Author : Yves FRICAUD
 //  Module : SALOME
-//  $Header
+//  $Header$
 
 #include "SALOMEDS_ExternalFileDef.ixx"
 #include <TDataStd_Comment.hxx>
index 515bbc5513a4a62018b0e9d4d8b7c83a05c756e0..a26ebe3f4a3346e2a5a2f46c010b39713788c726 100644 (file)
@@ -24,7 +24,7 @@
 //  File   : SALOMEDS_FileType.cxx
 //  Author : Yves FRICAUD
 //  Module : SALOME
-//  $Header
+//  $Header$
 
 #include "SALOMEDS_FileType.ixx"
 #include <TDataStd_Comment.hxx>
index d3fc65e30d6ba44b0549b9106819195b67a3836c..27d6d5fdda559177c3cfeb15acb60746a86cdd71 100644 (file)
 //  $Header$
 
 using namespace std;
+
+#include <TDataStd_TreeNode.hxx>
+#include <TDataStd_UAttribute.hxx>
+
+#include "SALOMEDS_AttributeDrawable_i.hxx"
+#include "SALOMEDS_AttributeSelectable_i.hxx"
+#include "SALOMEDS_AttributeOpened_i.hxx"
+#include "SALOMEDS_AttributeTextColor_i.hxx"
+#include "SALOMEDS_AttributeTextHighlightColor_i.hxx"
+#include "SALOMEDS_AttributePixMap_i.hxx"
+#include "SALOMEDS_AttributeExpandable_i.hxx"
+#include "SALOMEDS_AttributeLocalID_i.hxx"
+#include "SALOMEDS_AttributeTarget_i.hxx"
+#include "SALOMEDS_AttributeTableOfInteger_i.hxx"
+#include "SALOMEDS_AttributeTableOfReal_i.hxx"
+#include "SALOMEDS_AttributeTableOfString_i.hxx"
+#include "SALOMEDS_AttributeStudyProperties_i.hxx"
+#include "SALOMEDS_AttributePythonObject_i.hxx"
+#include "SALOMEDS_AttributeTreeNode_i.hxx"
+#include "SALOMEDS_AttributeUserID_i.hxx"
+#include "SALOMEDS_AttributeExternalFileDef_i.hxx"
+#include "SALOMEDS_AttributeFileType_i.hxx"
 #include "SALOMEDS_StudyBuilder_i.hxx"
 
+#include "SALOMEDS_SequenceOfRealAttribute.hxx"
+#include "SALOMEDS_SequenceOfIntegerAttribute.hxx"
+#include "SALOMEDS_IORAttribute.hxx"
+#include "SALOMEDS_PersRefAttribute.hxx"
+#include "SALOMEDS_DrawableAttribute.hxx"
+#include "SALOMEDS_SelectableAttribute.hxx"
+#include "SALOMEDS_ExpandableAttribute.hxx"
+#include "SALOMEDS_OpenedAttribute.hxx"
+#include "SALOMEDS_TextColorAttribute.hxx"
+#include "SALOMEDS_TextHighlightColorAttribute.hxx"
+#include "SALOMEDS_PixMapAttribute.hxx"
+#include "SALOMEDS_LocalIDAttribute.hxx"
+#include "SALOMEDS_PythonObjectAttribute.hxx"
+#include "SALOMEDS_TargetAttribute.hxx"
+#include "SALOMEDS_StudyPropertiesAttribute.hxx"
+#include "SALOMEDS_TableOfIntegerAttribute.hxx"
+#include "SALOMEDS_TableOfRealAttribute.hxx"
+#include "SALOMEDS_TableOfStringAttribute.hxx"
+#include "SALOMEDS_ExternalFileDef.hxx"
+#include "SALOMEDS_FileType.hxx"
+#include "Utils_ExceptHandlers.hxx"
+#define RegisteredAttributes 26
+
+UNEXPECT_CATCH(GALockProtection, SALOMEDS::GenericAttribute::LockProtection);
+
+const char AttributesTypeNames[RegisteredAttributes][30] = {
+  "AttributeReal", "AttributeInteger",
+  "AttributeSequenceOfReal", "AttributeSequenceOfInteger",
+  "AttributeName", "AttributeComment",
+  "AttributeIOR", "AttributePersistentRef",
+  "AttributeDrawable", "AttributeSelectable",
+  "AttributeExpandable", "AttributeOpened",
+  "AttributeTextColor", "AttributeTextHighlightColor", "AttributePixMap",
+  "AttributeTreeNode", "AttributeLocalID",
+  "AttributeTarget",
+  "AttributeTableOfInteger", "AttributeTableOfReal", "AttributeTableOfString",
+  "AttributeStudyProperties",
+  "AttributePythonObject",
+  "AttributeUserID",
+  "ExternalFileDef", "FileType"
+};
+
+const Standard_GUID AttributesGUIDs[RegisteredAttributes] = {
+  TDataStd_Real::GetID(), TDataStd_Integer::GetID(),
+  SALOMEDS_SequenceOfRealAttribute::GetID(), SALOMEDS_SequenceOfIntegerAttribute::GetID(),
+  TDataStd_Name::GetID(), TDataStd_Comment::GetID(),
+  SALOMEDS_IORAttribute::GetID(), SALOMEDS_PersRefAttribute::GetID(),
+  SALOMEDS_DrawableAttribute::GetID(), SALOMEDS_SelectableAttribute::GetID(),
+  SALOMEDS_ExpandableAttribute::GetID(), SALOMEDS_OpenedAttribute::GetID(),
+  SALOMEDS_TextColorAttribute::GetID(), SALOMEDS_TextHighlightColorAttribute::GetID(), SALOMEDS_PixMapAttribute::GetID(),
+  TDataStd_TreeNode::GetDefaultTreeID(), SALOMEDS_LocalIDAttribute::GetID(),
+  SALOMEDS_TargetAttribute::GetID(),
+  SALOMEDS_TableOfIntegerAttribute::GetID(), SALOMEDS_TableOfRealAttribute::GetID(), SALOMEDS_TableOfStringAttribute::GetID(),
+  SALOMEDS_StudyPropertiesAttribute::GetID(),
+  SALOMEDS_PythonObjectAttribute::GetID(),
+  Standard_GUID("FFFFFFFF-D9CD-11d6-945D-1050DA506788"),
+  SALOMEDS_ExternalFileDef::GetID(), SALOMEDS_FileType::GetID()
+};
+
 void SALOMEDS_GenericAttribute_i::CheckLocked() throw (SALOMEDS::GenericAttribute::LockProtection) {
+  Unexpect aCatch(GALockProtection);
   if (!_myAttr.IsNull() && _myAttr->IsValid() && !CORBA::is_nil(_myOrb)) {
     Handle(SALOMEDS_IORAttribute) Att;
     if (_myAttr->Label().Root().FindAttribute(SALOMEDS_IORAttribute::GetID(),Att)){
@@ -20,12 +102,107 @@ void SALOMEDS_GenericAttribute_i::CheckLocked() throw (SALOMEDS::GenericAttribut
       char* IOR = CORBA::string_dup(ch.ToCString());
       CORBA::Object_var obj = _myOrb->string_to_object(IOR);
       SALOMEDS::Study_ptr aStudy = SALOMEDS::Study::_narrow(obj);
-      //       ASSERT(!CORBA::is_nil(aStudy));
+//     ASSERT(!CORBA::is_nil(aStudy));
       if (aStudy->NewBuilder()->HasOpenCommand()) return;
       if (aStudy->GetProperties()->IsLocked()) {
-       //        INFOS("Locked document modification !!!");
+//       MESSAGE("Locked document modification !!!");
        throw SALOMEDS::GenericAttribute::LockProtection();
       }
     }
   }
 }
+
+SALOMEDS::SObject_ptr SALOMEDS_GenericAttribute_i::GetSObject() {
+  if (_myAttr.IsNull() || _myAttr->Label().IsNull()) return SALOMEDS::SObject::_nil();
+  SALOMEDS_SObject_i *  so_servant = new SALOMEDS_SObject_i (_myAttr->Label(),_myOrb);
+  SALOMEDS::SObject_var so = SALOMEDS::SObject::_narrow(so_servant->_this()); 
+  return so._retn();
+}
+
+Standard_GUID SALOMEDS_GenericAttribute_i::GetGUID(const char* theType) {
+  Standard_Integer i;
+  for(i = 0; i < RegisteredAttributes; i++) {
+    if (strcmp(AttributesTypeNames[i], theType) == 0) return AttributesGUIDs[i];
+  }
+
+  if (strncmp(theType, "AttributeTreeNodeGUID",21) == 0) {
+    char* aGUIDString = new char[40];
+    sprintf(aGUIDString, &(theType[21]));
+    Standard_GUID aGUID = Standard_GUID(aGUIDString); // create tree node GUID by name
+    delete(aGUIDString);
+    return aGUID;
+  }
+  return Standard_GUID();
+}
+
+char* SALOMEDS_GenericAttribute_i::Type() {
+  if (_myAttr.IsNull()) return "";
+  int i;
+  for(i = 0; i < RegisteredAttributes; i++) {
+    if (_myAttr->ID() == AttributesGUIDs[i]) {
+      CORBA::String_var aString(AttributesTypeNames[i]);
+      return aString._retn();
+    }
+  }
+  Handle(TDataStd_TreeNode) aNode = Handle(TDataStd_TreeNode)::DownCast(_myAttr);
+  if (!aNode.IsNull()) {
+    char* aNodeName = new char[60];
+    char aGUID[40];
+    aNode->ID().ToCString(aGUID);
+    sprintf(aNodeName, "AttributeTreeNodeGUID%s",aGUID);
+    return aNodeName;
+  }
+
+  Handle(TDataStd_UAttribute) aUAttr = Handle(TDataStd_UAttribute)::DownCast(_myAttr);
+  if (!aUAttr.IsNull()) {
+    char* aUAttrName = new char[60];
+    char aGUID[40];
+    aUAttr->ID().ToCString(aGUID);
+    sprintf(aUAttrName, "AttributeUserID_%s",aGUID); 
+    return aUAttrName;
+  }
+
+  return "";
+}
+
+SALOMEDS::GenericAttribute_ptr SALOMEDS_GenericAttribute_i::CreateAttribute(CORBA::ORB_ptr theOrb,
+                                                                           const Handle(TDF_Attribute)& theAttr) {
+
+  __ReturnCORBAAttribute(TDataStd_Real, AttributeReal);
+  __ReturnCORBAAttribute(TDataStd_Integer, AttributeInteger);
+  __ReturnCORBAAttribute(SALOMEDS_SequenceOfRealAttribute, AttributeSequenceOfReal);
+  __ReturnCORBAAttribute(SALOMEDS_SequenceOfIntegerAttribute, AttributeSequenceOfInteger);
+  __ReturnCORBAAttribute(TDataStd_Name, AttributeName);
+  __ReturnCORBAAttribute(TDataStd_Comment, AttributeComment);
+  __ReturnCORBAAttribute(SALOMEDS_IORAttribute, AttributeIOR);
+  __ReturnCORBAAttribute(SALOMEDS_PersRefAttribute, AttributePersistentRef);
+  __ReturnCORBAAttribute(SALOMEDS_DrawableAttribute, AttributeDrawable);
+  __ReturnCORBAAttribute(SALOMEDS_SelectableAttribute, AttributeSelectable);
+  __ReturnCORBAAttribute(SALOMEDS_ExpandableAttribute, AttributeExpandable);
+  __ReturnCORBAAttribute(SALOMEDS_OpenedAttribute, AttributeOpened);
+  __ReturnCORBAAttribute(SALOMEDS_TextColorAttribute, AttributeTextColor);
+  __ReturnCORBAAttribute(SALOMEDS_TextHighlightColorAttribute, AttributeTextHighlightColor);
+  __ReturnCORBAAttribute(SALOMEDS_PixMapAttribute, AttributePixMap);
+  __ReturnCORBAAttribute(SALOMEDS_LocalIDAttribute, AttributeLocalID);
+  __ReturnCORBAAttribute(SALOMEDS_TargetAttribute, AttributeTarget);
+  __ReturnCORBAAttribute(SALOMEDS_TableOfIntegerAttribute, AttributeTableOfInteger);
+  __ReturnCORBAAttribute(SALOMEDS_TableOfRealAttribute, AttributeTableOfReal);
+  __ReturnCORBAAttribute(SALOMEDS_TableOfStringAttribute, AttributeTableOfString);
+  __ReturnCORBAAttribute(SALOMEDS_StudyPropertiesAttribute, AttributeStudyProperties);
+  __ReturnCORBAAttribute(SALOMEDS_PythonObjectAttribute, AttributePythonObject);
+  __ReturnCORBAAttribute(SALOMEDS_ExternalFileDef, AttributeExternalFileDef);
+  __ReturnCORBAAttribute(SALOMEDS_FileType, AttributeFileType);
+
+  Handle(TDataStd_TreeNode) aNode = Handle(TDataStd_TreeNode)::DownCast(theAttr);
+  if (!aNode.IsNull()) {
+    SALOMEDS_AttributeTreeNode_i* Attr = new SALOMEDS_AttributeTreeNode_i(aNode, theOrb); \
+    return Attr->AttributeTreeNode::_this(); \
+  }
+
+  Handle(TDataStd_UAttribute) aUAttr = Handle(TDataStd_UAttribute)::DownCast(theAttr);
+  if (!aUAttr.IsNull()) {
+    SALOMEDS_AttributeUserID_i* Attr = new SALOMEDS_AttributeUserID_i(aUAttr, theOrb); \
+    return Attr->AttributeUserID::_this(); \
+  }
+  return SALOMEDS::GenericAttribute::_nil();
+}
index 6d404b71942d8590f927665a9d94742a9d746be1..2ea8c97fe54b166a3d31fe3a3012520ac7abfbf2 100644 (file)
@@ -34,7 +34,6 @@
 #include CORBA_SERVER_HEADER(SALOMEDS)
 #include <TDF_Attribute.hxx>
 #include "SALOMEDS_SObject_i.hxx"
-#include "SALOMEDS_IORAttribute.hxx"
 
 class SALOMEDS_GenericAttribute_i: public POA_SALOMEDS::GenericAttribute,
                                   public PortableServer::RefCountServantBase {
@@ -45,16 +44,51 @@ public:
   SALOMEDS_GenericAttribute_i() {};
   
   void CheckLocked() throw (SALOMEDS::GenericAttribute::LockProtection);
+
+  char* Store() {return "";};
+
+  void Restore(const char*) {};
   
-  ~SALOMEDS_GenericAttribute_i() {};
+  char* Type();
 
-//  CORBA::Boolean  GetPtr(SALOMEDS::SObject_out so) {
-//    SALOMEDS_SObject_i* sob_impl = new  SALOMEDS_SObject_i(_myAttr->Label(), _myOrb);
-//    SALOMEDS::SObject_var sob = sob_impl->_this();
-//    return sob._retn();
-//  };
+  SALOMEDS::SObject_ptr GetSObject();
+
+  ~SALOMEDS_GenericAttribute_i() {};
 
+  static Standard_GUID GetGUID(const char* theType);
 
+  static SALOMEDS::GenericAttribute_ptr CreateAttribute(CORBA::ORB_ptr theOrb, const Handle(TDF_Attribute)& theAttr);
 };
 
+// defines for creation attributes objects
+
+//cout<<"*** Create new CORBA attribute for "<<#CORBA_Name<<endl;
+#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;
+#define __FindOrCreateAttribute(OCAF_Name, CORBA_Name) if (strcmp(aTypeOfAttribute, #CORBA_Name) == 0) { \
+    Handle(OCAF_Name) anAttr; \
+    if (!Lab.FindAttribute(OCAF_Name::GetID(), anAttr)) { \
+      anAttr = new OCAF_Name; \
+      Lab.AddAttribute(anAttr); \
+    } \
+    SALOMEDS_##CORBA_Name##_i* Attr = new SALOMEDS_##CORBA_Name##_i(anAttr, _orb); \
+    return Attr->CORBA_Name::_this(); \
+  }
+
+//cout<<"Create New Attribute "<<#CORBA_Name<<endl;
+#define __FindOrCreateAttributeLocked(OCAF_Name, CORBA_Name) if (strcmp(aTypeOfAttribute, #CORBA_Name) == 0) { \
+    Handle(OCAF_Name) anAttr; \
+    if (!Lab.FindAttribute(OCAF_Name::GetID(), anAttr)) { \
+      CheckLocked(); \
+      anAttr = new OCAF_Name; \
+      Lab.AddAttribute(anAttr); \
+    } \
+    SALOMEDS_##CORBA_Name##_i* Attr = new SALOMEDS_##CORBA_Name##_i(anAttr, _orb); \
+    return Attr->CORBA_Name::_this(); \
+  }
+
 #endif
index 9f8ece15c4a1e6324e68abc4aa80820457071875..f38360b4a696b8f0b6aef09c4093d88e97792e85 100644 (file)
@@ -24,7 +24,7 @@
 //  File   : SALOMEDS_LocalIDAttribute.cxx
 //  Author : Yves FRICAUD
 //  Module : SALOME
-//  $Header:  
+//  $Header$
 
 using namespace std;
 #include "SALOMEDS_LocalIDAttribute.ixx"
index 6729106edc10fe923d471cbb3ad59b0d33599378..0e930f04fd0d8d4635fdb1253fd1e857494a6924 100644 (file)
@@ -24,7 +24,7 @@
 //  File   : SALOMEDS_LocalIDAttribute.hxx
 //  Author : Yves FRICAUD
 //  Module : SALOME
-//  $Header
+//  $Header$
 
 #ifndef _SALOMEDS_LocalIDAttribute_HeaderFile
 #define _SALOMEDS_LocalIDAttribute_HeaderFile
index f50e7b9c30eecabb022f517bd83f9ba8eb279218..56d6d331b5d340d9db65ba49a11dda921dd301d5 100644 (file)
@@ -24,7 +24,7 @@
 //  File   : SALOMEDS_LocalIDAttribute.ixx
 //  Author : Yves FRICAUD
 //  Module : SALOME
-//  $Header
+//  $Header$
 
 #include "SALOMEDS_LocalIDAttribute.jxx"
 
index aa12fd1080c707bfe6fcbe805c1eeb5d6c43ddca..fc43ec07d6f7df428183c98c641ade7d1749473f 100644 (file)
@@ -24,7 +24,7 @@
 //  File   : SALOMEDS_LocalIDAttribute.jxx
 //  Author : Yves FRICAUD
 //  Module : SALOME
-//  $Header
+//  $Header$
 
 #ifndef _Standard_GUID_HeaderFile
 #include <Standard_GUID.hxx>
index d59512cdf8a52ed98b6254477056a7b088921100..fc074bf13ef420efe88f9e3dd401698af2dee79b 100644 (file)
@@ -24,7 +24,7 @@
 //  File   : SALOMEDS_OpenedAttribute.cxx
 //  Author : Yves FRICAUD
 //  Module : SALOME
-//  $Header:  
+//  $Header$
 
 using namespace std;
 #include "SALOMEDS_OpenedAttribute.ixx"
index 3fde4f60e595d279b96e94ace14e8866c9ccbdf2..fa84b61802443c60e7831b62b8e78a0e5fad0510 100644 (file)
@@ -24,7 +24,7 @@
 //  File   : SALOMEDS_PixMapAttribute.cxx
 //  Author : Yves FRICAUD
 //  Module : SALOME
-//  $Header
+//  $Header$
 
 using namespace std;
 #include "SALOMEDS_PixMapAttribute.ixx"
index e10791ded1314e1f0f4f2fceab03a046425796b9..c202a0921dcfa75755b115b6f85e7bad70a34638 100644 (file)
@@ -31,129 +31,10 @@ using namespace std;
 #include "SALOMEDS_SObject_i.hxx"
 //SALOMEDS Headers
 #include "SALOMEDS_SComponent_i.hxx"
+#include "SALOMEDS_GenericAttribute_i.hxx"
 #include "SALOMEDS_IORAttribute.hxx"
-#include "SALOMEDS_PersRefAttribute.hxx"
-#include "SALOMEDS_SequenceOfRealAttribute.hxx"
-#include "SALOMEDS_SequenceOfIntegerAttribute.hxx"
-#include "SALOMEDS_TableOfRealAttribute.hxx"
-#include "SALOMEDS_TableOfIntegerAttribute.hxx"
-#include "SALOMEDS_IORAttribute.hxx"
-#include "SALOMEDS_PersRefAttribute.hxx"
-#include "SALOMEDS_StudyPropertiesAttribute.hxx"
-#include "SALOMEDS_PythonObjectAttribute.hxx"
-#include "SALOMEDS_AttributePersistentRef_i.hxx"
-#include "SALOMEDS_AttributeIOR_i.hxx"
-#include "SALOMEDS_AttributeComment_i.hxx"
-#include "SALOMEDS_AttributeExternalFileDef_i.hxx"
-#include "SALOMEDS_AttributeFileType_i.hxx"
-#include "SALOMEDS_AttributeName_i.hxx"
-#include "SALOMEDS_AttributeSequenceOfInteger_i.hxx"
-#include "SALOMEDS_AttributeSequenceOfReal_i.hxx"
-#include "SALOMEDS_AttributeInteger_i.hxx"
-#include "SALOMEDS_AttributeReal_i.hxx"
-#include "SALOMEDS_AttributeDrawable_i.hxx"
-#include "SALOMEDS_AttributeSelectable_i.hxx"
-#include "SALOMEDS_AttributeExpandable_i.hxx"
-#include "SALOMEDS_AttributeOpened_i.hxx"
-#include "SALOMEDS_AttributeTextColor_i.hxx"
-#include "SALOMEDS_AttributeTextHighlightColor_i.hxx"
-#include "SALOMEDS_AttributePixMap_i.hxx"
-#include "SALOMEDS_AttributeTreeNode_i.hxx"
-#include "SALOMEDS_AttributeLocalID_i.hxx"
-#include "SALOMEDS_AttributeUserID_i.hxx"
-#include "SALOMEDS_AttributeTarget_i.hxx"
-#include "SALOMEDS_AttributeTableOfInteger_i.hxx"
-#include "SALOMEDS_AttributeTableOfReal_i.hxx"
-#include "SALOMEDS_AttributeTableOfString_i.hxx"
-#include "SALOMEDS_AttributeStudyProperties_i.hxx"
-#include "SALOMEDS_AttributePythonObject_i.hxx"
 #include <TDF_AttributeIterator.hxx>
 
-//============================================================================
-/*! Function : ReturnGUIDForAttribute
- *  Purpose  : 
- */
-//============================================================================
-
-Standard_GUID  
-SALOMEDS_SObject_i::ReturnGUIDForAttribute(const char* aTypeOfAttribute)
-{
-   Standard_GUID TypeID;
-  
-   if      (strcmp(aTypeOfAttribute, "AttributeReal") == 0 )               return TDataStd_Real::GetID();
-   else if (strcmp(aTypeOfAttribute, "AttributeInteger") == 0 )            return TDataStd_Integer::GetID();
-   else if (strcmp(aTypeOfAttribute, "AttributeSequenceOfReal") == 0 )     return SALOMEDS_SequenceOfRealAttribute::GetID();
-   else if (strcmp(aTypeOfAttribute, "AttributeSequenceOfInteger") == 0 )  return SALOMEDS_SequenceOfIntegerAttribute::GetID();
-   else if (strcmp(aTypeOfAttribute, "AttributeName") == 0 )               return TDataStd_Name::GetID();
-   else if (strcmp(aTypeOfAttribute, "AttributeComment") == 0 )            return TDataStd_Comment::GetID();
-   else if (strcmp(aTypeOfAttribute, "AttributeExternalFileDef") == 0 )    return SALOMEDS_ExternalFileDef::GetID();
-   else if (strcmp(aTypeOfAttribute, "AttributeFileType") == 0 )           return SALOMEDS_FileType::GetID();
-   else if (strcmp(aTypeOfAttribute, "AttributeIOR") == 0 )                return SALOMEDS_IORAttribute::GetID();
-   else if (strcmp(aTypeOfAttribute, "AttributePersistentRef") == 0 )      return SALOMEDS_PersRefAttribute::GetID();
-   else if (strcmp(aTypeOfAttribute, "AttributeDrawable") == 0 )           return SALOMEDS_DrawableAttribute::GetID();
-   else if (strcmp(aTypeOfAttribute, "AttributeSelectable") == 0 )         return SALOMEDS_SelectableAttribute::GetID();
-   else if (strcmp(aTypeOfAttribute, "AttributeExpandable") == 0 )         return SALOMEDS_ExpandableAttribute::GetID();
-   else if (strcmp(aTypeOfAttribute, "AttributeOpened") == 0 )             return SALOMEDS_OpenedAttribute::GetID();
-   else if (strcmp(aTypeOfAttribute, "AttributeTextColor") == 0 )          return SALOMEDS_TextColorAttribute::GetID();
-   else if (strcmp(aTypeOfAttribute, "AttributeTextHighlightColor") == 0 ) return SALOMEDS_TextHighlightColorAttribute::GetID();
-   else if (strcmp(aTypeOfAttribute, "AttributePixMap") == 0 )             return SALOMEDS_PixMapAttribute::GetID();
-   else if (strcmp(aTypeOfAttribute, "AttributeTreeNode") == 0 )           return TDataStd_TreeNode::GetDefaultTreeID();
-   else if (strcmp(aTypeOfAttribute, "AttributeLocalID") == 0 )            return SALOMEDS_LocalIDAttribute::GetID();
-   else if (strcmp(aTypeOfAttribute, "AttributeTarget") == 0 )             return SALOMEDS_TargetAttribute::GetID();
-   else if (strcmp(aTypeOfAttribute, "AttributeTableOfInteger") == 0 )     return SALOMEDS_TableOfIntegerAttribute::GetID();
-   else if (strcmp(aTypeOfAttribute, "AttributeTableOfReal") == 0 )        return SALOMEDS_TableOfRealAttribute::GetID();
-   else if (strcmp(aTypeOfAttribute, "AttributeTableOfString") == 0 )      return SALOMEDS_TableOfStringAttribute::GetID();
-   else if (strcmp(aTypeOfAttribute, "AttributeStudyProperties") == 0 )    return SALOMEDS_StudyPropertiesAttribute::GetID();
-   else if (strcmp(aTypeOfAttribute, "AttributePythonObject") == 0 )       return SALOMEDS_PythonObjectAttribute::GetID();
-   else if (strcmp(aTypeOfAttribute, "AttributeUserID") == 0 )             return SALOMEDS_AttributeUserID_i::DefaultID();
-   else if (strncmp(aTypeOfAttribute,"AttributeTreeNodeGUID",21) == 0) {
-     char* aGUIDString = new char[40];
-     sprintf(aGUIDString, &(aTypeOfAttribute[21]));
-     Standard_GUID aGUID = Standard_GUID(aGUIDString); // create tree node GUID by name
-     delete(aGUIDString);
-     return aGUID;
-   }
-   else Standard_NoSuchObject::Raise("SALOMEDS_SObject_i::ReturnGUIDForAttribute");
-}
-
-//============================================================================
-/*! Function : AttributeIDToType
- *  Purpose  : 
- */
-//============================================================================
-char* SALOMEDS_SObject_i::AttributeIDToType(Standard_GUID ID)
-{
-  if      (ID == TDataStd_Name::GetID())                        return "AttributeName";
-  else if (ID == TDataStd_Comment::GetID())                     return "AttributeComment";
-  else if (ID == SALOMEDS_ExternalFileDef::GetID())             return "AttributeExternalFileDef";
-  else if (ID == SALOMEDS_FileType::GetID())                    return "AttributeFileType";
-  else if (ID == SALOMEDS_IORAttribute::GetID())                return "AttributeIOR"; 
-  else if (ID == SALOMEDS_PersRefAttribute::GetID())            return "AttributePersistentRef";
-  else if (ID == TDataStd_Real::GetID())                        return "AttributeReal";
-  else if (ID == TDataStd_Integer::GetID())                     return "AttributeInteger";
-  else if (ID == SALOMEDS_SequenceOfRealAttribute::GetID())     return "AttributeSequenceOfReal";
-  else if (ID == SALOMEDS_SequenceOfIntegerAttribute::GetID())  return "AttributeSequenceOfInteger";
-  else if (ID == SALOMEDS_DrawableAttribute::GetID())           return "AttributeDrawable";
-  else if (ID == SALOMEDS_SelectableAttribute::GetID())         return "AttributeSelectable";
-  else if (ID == SALOMEDS_ExpandableAttribute::GetID())         return "AttributeExpandable";
-  else if (ID == SALOMEDS_OpenedAttribute::GetID())             return "AttributeOpened";
-  else if (ID == SALOMEDS_TextColorAttribute::GetID())          return "AttributeTextColor";
-  else if (ID == SALOMEDS_TextHighlightColorAttribute::GetID()) return "AttributeTextHighlightColor";
-  else if (ID == SALOMEDS_PixMapAttribute::GetID())             return "AttributePixMap";
-  else if (ID == TDataStd_TreeNode::GetDefaultTreeID())         return "AttributeTreeNode";
-  else if (ID == SALOMEDS_LocalIDAttribute::GetID())            return "AttributeLocalID";
-  else if (ID == SALOMEDS_TargetAttribute::GetID())             return "AttributeTarget";
-  else if (ID == SALOMEDS_TableOfIntegerAttribute::GetID())     return "AttributeTableOfInteger";
-  else if (ID == SALOMEDS_TableOfRealAttribute::GetID())        return "AttributeTableOfReal";
-  else if (ID == SALOMEDS_TableOfStringAttribute::GetID())      return "AttributeTableOfString";
-  else if (ID == SALOMEDS_StudyPropertiesAttribute::GetID())    return "AttributeStudyProperties";
-  else if (ID == SALOMEDS_PythonObjectAttribute::GetID())       return "AttributePythonObject";
-  else if (ID == SALOMEDS_AttributeUserID_i::DefaultID())       return "AttributeUserID";
-  // 08.01.2003 mpv: this method must be called only for attributes with constant GUID
-  else Standard_NoSuchObject::Raise("SALOMEDS_SObject_i::AttributeIDToType");
-}
-
-
 //============================================================================
 /*! Function : constructor
  *  Purpose  : 
@@ -244,7 +125,7 @@ SALOMEDS::Study_ptr SALOMEDS_SObject_i::GetStudy()
     ASSERT(!CORBA::is_nil(Study));
     return SALOMEDS::Study::_duplicate(Study); //return Study = abort...
   }
-  INFOS("Problem GetStudy");
+  MESSAGE("Problem GetStudy");
   return SALOMEDS::Study::_nil();
 }
 
@@ -257,139 +138,11 @@ CORBA::Boolean SALOMEDS_SObject_i::FindAttribute (SALOMEDS::GenericAttribute_out
                                                  const char* aTypeOfAttribute)
 {
   Handle(TDF_Attribute) anAttr;
-  Standard_Boolean found = _lab.FindAttribute(SALOMEDS_SObject_i::ReturnGUIDForAttribute(aTypeOfAttribute), anAttr);
-  if (found) {
-    if (strcmp(aTypeOfAttribute, "AttributeReal") == 0 )  {
-      SALOMEDS_AttributeReal_i* Attr = new SALOMEDS_AttributeReal_i(Handle(TDataStd_Real)::DownCast(anAttr), _orb);
-      anAttribute = Attr->AttributeReal::_this();
-      return Standard_True;
-    }
-    else if (strcmp(aTypeOfAttribute, "AttributeInteger") == 0 )  {
-      SALOMEDS_AttributeInteger_i* Attr = new SALOMEDS_AttributeInteger_i(Handle(TDataStd_Integer)::DownCast(anAttr), _orb);
-      anAttribute = Attr->AttributeInteger::_this();
-      return Standard_True;
-    }
-    else if (strcmp(aTypeOfAttribute, "AttributeSequenceOfReal") == 0 )  {
-      SALOMEDS_AttributeSequenceOfReal_i* Attr = new SALOMEDS_AttributeSequenceOfReal_i(Handle(SALOMEDS_SequenceOfRealAttribute)::DownCast(anAttr), _orb);
-      anAttribute = Attr->AttributeSequenceOfReal::_this();
-      return Standard_True;
-    }
-    else if (strcmp(aTypeOfAttribute, "AttributeSequenceOfInteger") == 0 )  {
-      SALOMEDS_AttributeSequenceOfInteger_i* Attr = new SALOMEDS_AttributeSequenceOfInteger_i(Handle(SALOMEDS_SequenceOfIntegerAttribute)::DownCast(anAttr), _orb);
-      anAttribute = Attr->AttributeSequenceOfInteger::_this();
-      return Standard_True;
-    }
-    else if (strcmp(aTypeOfAttribute, "AttributeName") == 0 ) {
-      SALOMEDS_AttributeName_i* Attr = new SALOMEDS_AttributeName_i(Handle(TDataStd_Name)::DownCast(anAttr), _orb);
-      anAttribute = Attr->AttributeName::_this();
-      return Standard_True;
-    }
-    else if (strcmp(aTypeOfAttribute, "AttributeComment") == 0 ) {
-      SALOMEDS_AttributeComment_i* Attr = new SALOMEDS_AttributeComment_i(Handle(TDataStd_Comment)::DownCast(anAttr), _orb);
-      anAttribute = Attr->AttributeComment::_this();
-      return Standard_True;
-    }
-    else if (strcmp(aTypeOfAttribute, "AttributeExternalFileDef") == 0 ) {
-      SALOMEDS_AttributeExternalFileDef_i* Attr = new SALOMEDS_AttributeExternalFileDef_i(Handle(SALOMEDS_ExternalFileDef)::DownCast(anAttr), _orb);
-      anAttribute = Attr->AttributeExternalFileDef::_this();
-      return Standard_True;
-    }
-    else if (strcmp(aTypeOfAttribute, "AttributeFileType") == 0 ) {
-      SALOMEDS_AttributeFileType_i* Attr = new SALOMEDS_AttributeFileType_i(Handle(SALOMEDS_FileType)::DownCast(anAttr), _orb);
-      anAttribute = Attr->AttributeFileType::_this();
-      return Standard_True;
-    }
-    else if (strcmp(aTypeOfAttribute, "AttributeIOR") == 0 ) {
-      SALOMEDS_AttributeIOR_i* Attr = new SALOMEDS_AttributeIOR_i(Handle(SALOMEDS_IORAttribute)::DownCast(anAttr), _orb);
-      anAttribute = Attr->AttributeIOR::_this();
-      return Standard_True;
-    }
-    else if (strcmp(aTypeOfAttribute, "AttributePersistentRef") == 0 )  {
-      SALOMEDS_AttributePersistentRef_i* Attr = new SALOMEDS_AttributePersistentRef_i(Handle(SALOMEDS_PersRefAttribute)::DownCast(anAttr), _orb);
-      anAttribute = Attr->AttributePersistentRef::_this();
-      return Standard_True;
-    }
-    else if (strcmp(aTypeOfAttribute, "AttributeDrawable") == 0 )  {
-      SALOMEDS_AttributeDrawable_i* Attr = new SALOMEDS_AttributeDrawable_i(Handle(SALOMEDS_DrawableAttribute)::DownCast(anAttr), _orb);
-      anAttribute = Attr->AttributeDrawable::_this();
-      return Standard_True;
-    }
-    else if (strcmp(aTypeOfAttribute, "AttributeSelectable") == 0 )  {
-      SALOMEDS_AttributeSelectable_i* Attr= new SALOMEDS_AttributeSelectable_i(Handle(SALOMEDS_SelectableAttribute)::DownCast(anAttr), _orb);
-      anAttribute = Attr->AttributeSelectable::_this();
-      return Standard_True;
-    }
-    else if (strcmp(aTypeOfAttribute, "AttributeExpandable") == 0 )  {
-      SALOMEDS_AttributeExpandable_i* Attr = new SALOMEDS_AttributeExpandable_i(Handle(SALOMEDS_ExpandableAttribute)::DownCast(anAttr), _orb);
-      anAttribute = Attr->AttributeExpandable::_this();
-      return Standard_True;
-    }
-    else if (strcmp(aTypeOfAttribute, "AttributeOpened") == 0 )  {
-      SALOMEDS_AttributeOpened_i* Attr= new SALOMEDS_AttributeOpened_i(Handle(SALOMEDS_OpenedAttribute)::DownCast(anAttr), _orb);
-      anAttribute = Attr->AttributeOpened::_this();
-      return Standard_True;
-    }
-    else if (strcmp(aTypeOfAttribute, "AttributeTextColor") == 0 )  {
-      SALOMEDS_AttributeTextColor_i* Attr= new SALOMEDS_AttributeTextColor_i(Handle(SALOMEDS_TextColorAttribute)::DownCast(anAttr), _orb);
-      anAttribute = Attr->AttributeTextColor::_this();
-      return Standard_True;
-    }
-    else if (strcmp(aTypeOfAttribute, "AttributeTextHighlightColor") == 0 )  {
-      SALOMEDS_AttributeTextHighlightColor_i* Attr= new SALOMEDS_AttributeTextHighlightColor_i(Handle(SALOMEDS_TextHighlightColorAttribute)::DownCast(anAttr), _orb);
-      anAttribute = Attr->AttributeTextHighlightColor::_this();
-      return Standard_True;
-    }
-    else if (strcmp(aTypeOfAttribute, "AttributePixMap") == 0 )  {
-      SALOMEDS_AttributePixMap_i* Attr= new SALOMEDS_AttributePixMap_i(Handle(SALOMEDS_PixMapAttribute)::DownCast(anAttr), _orb);
-      anAttribute = Attr->AttributePixMap::_this();
-      return Standard_True;
-    }
-    else if (strncmp(aTypeOfAttribute, "AttributeTreeNode",17) == 0 )  {
-      SALOMEDS_AttributeTreeNode_i* Attr= new SALOMEDS_AttributeTreeNode_i(Handle(TDataStd_TreeNode)::DownCast(anAttr), _orb);
-      anAttribute = Attr->AttributeTreeNode::_this();
-      return Standard_True;
-    }
-    else if (strcmp(aTypeOfAttribute, "AttributeLocalID") == 0 )  {
-      SALOMEDS_AttributeLocalID_i* Attr= new SALOMEDS_AttributeLocalID_i(Handle(SALOMEDS_LocalIDAttribute)::DownCast(anAttr), _orb);
-      anAttribute = Attr->AttributeLocalID::_this();
-      return Standard_True;
-    }
-    else if (strncmp(aTypeOfAttribute, "AttributeUserID",15) == 0 )  {
-      SALOMEDS_AttributeUserID_i* Attr= new SALOMEDS_AttributeUserID_i(Handle(TDataStd_UAttribute)::DownCast(anAttr), _orb);
-      anAttribute = Attr->AttributeUserID::_this();
-      return Standard_True;
-    }
-    else if (strcmp(aTypeOfAttribute, "AttributeTarget") == 0 )  {
-      SALOMEDS_AttributeTarget_i* Attr= new SALOMEDS_AttributeTarget_i(Handle(SALOMEDS_TargetAttribute)::DownCast(anAttr), _orb);
-      anAttribute = Attr->AttributeTarget::_this();
-      return Standard_True;
-    }
-    else if (strcmp(aTypeOfAttribute, "AttributeTableOfInteger") == 0 )  {
-      SALOMEDS_AttributeTableOfInteger_i* Attr = new SALOMEDS_AttributeTableOfInteger_i(Handle(SALOMEDS_TableOfIntegerAttribute)::DownCast(anAttr), _orb);
-      anAttribute = Attr->AttributeTableOfInteger::_this();
-      return Standard_True;
-    }
-    else if (strcmp(aTypeOfAttribute, "AttributeTableOfReal") == 0 )  {
-      SALOMEDS_AttributeTableOfReal_i* Attr = new SALOMEDS_AttributeTableOfReal_i(Handle(SALOMEDS_TableOfRealAttribute)::DownCast(anAttr), _orb);
-      anAttribute = Attr->AttributeTableOfReal::_this();
-      return Standard_True;
-    }
-    else if (strcmp(aTypeOfAttribute, "AttributeTableOfString") == 0 )  {
-      SALOMEDS_AttributeTableOfString_i* Attr = new SALOMEDS_AttributeTableOfString_i(Handle(SALOMEDS_TableOfStringAttribute)::DownCast(anAttr), _orb);
-      anAttribute = Attr->AttributeTableOfString::_this();
-      return Standard_True;
-    }
-    else if (strcmp(aTypeOfAttribute, "AttributeStudyProperties") == 0 )  {
-      SALOMEDS_AttributeStudyProperties_i* Attr = new SALOMEDS_AttributeStudyProperties_i(Handle(SALOMEDS_StudyPropertiesAttribute)::DownCast(anAttr), _orb);
-      anAttribute = Attr->AttributeStudyProperties::_this();
-      return Standard_True;
-    }
-    else if (strcmp(aTypeOfAttribute, "AttributePythonObject") == 0 )  {
-      SALOMEDS_AttributePythonObject_i* Attr = new SALOMEDS_AttributePythonObject_i(Handle(SALOMEDS_PythonObjectAttribute)::DownCast(anAttr), _orb);
-      anAttribute = Attr->AttributePythonObject::_this();
-      return Standard_True;
-    }
-  } else return Standard_False;
+  if (_lab.FindAttribute(SALOMEDS_GenericAttribute_i::GetGUID(aTypeOfAttribute), anAttr)) {
+    anAttribute = SALOMEDS::GenericAttribute::_duplicate(SALOMEDS_GenericAttribute_i::CreateAttribute(_orb, anAttr));
+    return Standard_True;
+  }
+  return Standard_False;
 }
 
 //============================================================================
@@ -402,126 +155,16 @@ SALOMEDS::ListOfAttributes* SALOMEDS_SObject_i::GetAllAttributes()
 {
   Standard_Integer NumAttr = _lab.NbAttributes();
   SALOMEDS::ListOfAttributes_var SeqOfAttr = new SALOMEDS::ListOfAttributes;
-  SeqOfAttr->length(NumAttr);
+  //SeqOfAttr->length(NumAttr);
   if (NumAttr != 0) {
     Standard_Integer i = 0;
     for(TDF_AttributeIterator iter(_lab);iter.More();iter.Next()) {
       Handle(TDF_Attribute) anAttr = iter.Value();
-      SALOMEDS::GenericAttribute_var anAttribute;
-      if (ReturnGUIDForAttribute("AttributeReal") == anAttr->ID()) {
-        SALOMEDS_AttributeReal_i* Attr= new SALOMEDS_AttributeReal_i(Handle(TDataStd_Real)::DownCast(anAttr), _orb);
-        anAttribute = Attr->AttributeReal::_this();
-      } 
-      else if (ReturnGUIDForAttribute("AttributeInteger") == anAttr->ID()) {
-        SALOMEDS_AttributeInteger_i* Attr= new SALOMEDS_AttributeInteger_i(Handle(TDataStd_Integer)::DownCast(anAttr), _orb);
-        anAttribute = Attr->AttributeInteger::_this();
-      } 
-      else if (ReturnGUIDForAttribute("AttributeSequenceOfReal") == anAttr->ID()) {
-        SALOMEDS_AttributeSequenceOfReal_i* Attr= new SALOMEDS_AttributeSequenceOfReal_i(Handle(SALOMEDS_SequenceOfRealAttribute)::DownCast(anAttr), _orb);
-        anAttribute = Attr->AttributeSequenceOfReal::_this();
-      } 
-      else if (ReturnGUIDForAttribute("AttributeSequenceOfInteger") == anAttr->ID()) {
-        SALOMEDS_AttributeSequenceOfInteger_i* Attr= new SALOMEDS_AttributeSequenceOfInteger_i(Handle(SALOMEDS_SequenceOfIntegerAttribute)::DownCast(anAttr), _orb);
-        anAttribute = Attr->AttributeSequenceOfInteger::_this();
-      } 
-      else if (ReturnGUIDForAttribute("AttributeName") == anAttr->ID()) {
-        SALOMEDS_AttributeName_i* Attr= new SALOMEDS_AttributeName_i(Handle(TDataStd_Name)::DownCast(anAttr), _orb);
-        anAttribute = Attr->AttributeName::_this();
-      } 
-      else if (ReturnGUIDForAttribute("AttributeComment") == anAttr->ID()) {
-        SALOMEDS_AttributeComment_i* Attr= new SALOMEDS_AttributeComment_i(Handle(TDataStd_Comment)::DownCast(anAttr), _orb);
-        anAttribute = Attr->AttributeComment::_this();
-      } 
-      else if (ReturnGUIDForAttribute("AttributeExternalFileDef") == anAttr->ID()) {
-        SALOMEDS_AttributeExternalFileDef_i* Attr= new SALOMEDS_AttributeExternalFileDef_i(Handle(SALOMEDS_ExternalFileDef)::DownCast(anAttr), _orb);
-        anAttribute = Attr->AttributeExternalFileDef::_this();
-      } 
-      else if (ReturnGUIDForAttribute("AttributeFileType") == anAttr->ID()) {
-        SALOMEDS_AttributeFileType_i* Attr= new SALOMEDS_AttributeFileType_i(Handle(SALOMEDS_FileType)::DownCast(anAttr), _orb);
-        anAttribute = Attr->AttributeFileType::_this();
-      } 
-      else if (ReturnGUIDForAttribute("AttributeIOR") == anAttr->ID()) {
-        SALOMEDS_AttributeIOR_i* Attr= new SALOMEDS_AttributeIOR_i(Handle(SALOMEDS_IORAttribute)::DownCast(anAttr), _orb);
-        anAttribute = Attr->AttributeIOR::_this();
-      } 
-      else if (ReturnGUIDForAttribute("AttributePersistentRef") == anAttr->ID()) {
-        SALOMEDS_AttributePersistentRef_i* Attr= new SALOMEDS_AttributePersistentRef_i(Handle(SALOMEDS_PersRefAttribute)::DownCast(anAttr), _orb);
-        anAttribute = Attr->AttributePersistentRef::_this();
+      SALOMEDS::GenericAttribute_var anAttribute = SALOMEDS_GenericAttribute_i::CreateAttribute(_orb, anAttr);
+      if (!CORBA::is_nil(anAttribute)) {
+       SeqOfAttr->length(++i);
+       SeqOfAttr[i - 1] = anAttribute;
       }
-      else if (ReturnGUIDForAttribute("AttributeDrawable") == anAttr->ID()) {
-        SALOMEDS_AttributeDrawable_i* Attr= new SALOMEDS_AttributeDrawable_i(Handle(SALOMEDS_DrawableAttribute)::DownCast(anAttr), _orb);
-        anAttribute = Attr->AttributeDrawable::_this();
-      } 
-      else if (ReturnGUIDForAttribute("AttributeSelectable") == anAttr->ID()) {
-        SALOMEDS_AttributeSelectable_i* Attr= new SALOMEDS_AttributeSelectable_i(Handle(SALOMEDS_SelectableAttribute)::DownCast(anAttr), _orb);
-        anAttribute = Attr->AttributeSelectable::_this();
-      } 
-      else if (ReturnGUIDForAttribute("AttributeExpandable") == anAttr->ID()) {
-        SALOMEDS_AttributeExpandable_i* Attr= new SALOMEDS_AttributeExpandable_i(Handle(SALOMEDS_ExpandableAttribute)::DownCast(anAttr), _orb);
-        anAttribute = Attr->AttributeExpandable::_this();
-      } 
-      else if (ReturnGUIDForAttribute("AttributeOpened") == anAttr->ID()) {
-        SALOMEDS_AttributeOpened_i* Attr= new SALOMEDS_AttributeOpened_i(Handle(SALOMEDS_OpenedAttribute)::DownCast(anAttr), _orb);
-        anAttribute = Attr->AttributeOpened::_this();
-      } 
-      else if (ReturnGUIDForAttribute("AttributeTextColor") == anAttr->ID()) {
-        SALOMEDS_AttributeTextColor_i* Attr= new SALOMEDS_AttributeTextColor_i(Handle(SALOMEDS_TextColorAttribute)::DownCast(anAttr), _orb);
-        anAttribute = Attr->AttributeTextColor::_this();
-      } 
-      else if (ReturnGUIDForAttribute("AttributeTextHighlightColor") == anAttr->ID()) {
-        SALOMEDS_AttributeTextHighlightColor_i* Attr= new SALOMEDS_AttributeTextHighlightColor_i(Handle(SALOMEDS_TextHighlightColorAttribute)::DownCast(anAttr), _orb);
-        anAttribute = Attr->AttributeTextHighlightColor::_this();
-      } 
-      else if (ReturnGUIDForAttribute("AttributePixMap") == anAttr->ID()) {
-        SALOMEDS_AttributePixMap_i* Attr= new SALOMEDS_AttributePixMap_i(Handle(SALOMEDS_PixMapAttribute)::DownCast(anAttr), _orb);
-        anAttribute = Attr->AttributePixMap::_this();
-      } 
-      else if (ReturnGUIDForAttribute("AttributeTreeNode") == anAttr->ID()) {
-        SALOMEDS_AttributeTreeNode_i* Attr= new SALOMEDS_AttributeTreeNode_i(Handle(TDataStd_TreeNode)::DownCast(anAttr), _orb);
-        anAttribute = Attr->AttributeTreeNode::_this();
-      } 
-      else if (ReturnGUIDForAttribute("AttributeLocalID") == anAttr->ID()) {
-        SALOMEDS_AttributeLocalID_i* Attr= new SALOMEDS_AttributeLocalID_i(Handle(SALOMEDS_LocalIDAttribute)::DownCast(anAttr), _orb);
-        anAttribute = Attr->AttributeLocalID::_this();
-      } 
-      else if (ReturnGUIDForAttribute("AttributeTarget") == anAttr->ID()) {
-        SALOMEDS_AttributeTarget_i* Attr= new SALOMEDS_AttributeTarget_i(Handle(SALOMEDS_TargetAttribute)::DownCast(anAttr), _orb);
-        anAttribute = Attr->AttributeTarget::_this();
-      } 
-      else if (ReturnGUIDForAttribute("AttributeTableOfInteger") == anAttr->ID()) {
-        SALOMEDS_AttributeTableOfInteger_i* Attr= new SALOMEDS_AttributeTableOfInteger_i(Handle(SALOMEDS_TableOfIntegerAttribute)::DownCast(anAttr), _orb);
-        anAttribute = Attr->AttributeTableOfInteger::_this();
-      } 
-      else if (ReturnGUIDForAttribute("AttributeTableOfReal") == anAttr->ID()) {
-        SALOMEDS_AttributeTableOfReal_i* Attr= new SALOMEDS_AttributeTableOfReal_i(Handle(SALOMEDS_TableOfRealAttribute)::DownCast(anAttr), _orb);
-        anAttribute = Attr->AttributeTableOfReal::_this();
-      } 
-      else if (ReturnGUIDForAttribute("AttributeTableOfString") == anAttr->ID()) {
-        SALOMEDS_AttributeTableOfString_i* Attr= new SALOMEDS_AttributeTableOfString_i(Handle(SALOMEDS_TableOfStringAttribute)::DownCast(anAttr), _orb);
-        anAttribute = Attr->AttributeTableOfString::_this();
-      } 
-      else if (ReturnGUIDForAttribute("AttributeStudyProperties") == anAttr->ID()) {
-        SALOMEDS_AttributeStudyProperties_i* Attr= new SALOMEDS_AttributeStudyProperties_i(Handle(SALOMEDS_StudyPropertiesAttribute)::DownCast(anAttr), _orb);
-        anAttribute = Attr->AttributeStudyProperties::_this();
-      } 
-      else if (ReturnGUIDForAttribute("AttributePythonObject") == anAttr->ID()) {
-        SALOMEDS_AttributePythonObject_i* Attr= new SALOMEDS_AttributePythonObject_i(Handle(SALOMEDS_PythonObjectAttribute)::DownCast(anAttr), _orb);
-        anAttribute = Attr->AttributePythonObject::_this();
-      } 
-      else if (!Handle(TDataStd_UAttribute)::DownCast(anAttr).IsNull()) {
-        SALOMEDS_AttributeUserID_i* Attr= new SALOMEDS_AttributeUserID_i(Handle(TDataStd_UAttribute)::DownCast(anAttr), _orb);
-        anAttribute = Attr->AttributeUserID::_this();
-      } 
-      else if (!Handle(TDataStd_TreeNode)::DownCast(anAttr).IsNull()) {
-        SALOMEDS_AttributeTreeNode_i* Attr= new SALOMEDS_AttributeTreeNode_i(Handle(TDataStd_TreeNode)::DownCast(anAttr), _orb);
-        anAttribute = Attr->AttributeTreeNode::_this();
-      } else {
-       // references attributes, for an example, never returns
-       continue;
-      }
-
-      SeqOfAttr[i] =  anAttribute;
-      i++;
     }
   }
   return SeqOfAttr._retn();
@@ -589,3 +232,64 @@ CORBA::Short SALOMEDS_SObject_i::Tag()
 {
   return _lab.Tag();
 }
+
+//============================================================================
+/*! Function :
+ *  Purpose  : 
+ */
+//============================================================================
+CORBA::Object_ptr SALOMEDS_SObject_i::GetObject()
+{
+  CORBA::Object_ptr obj = CORBA::Object::_nil();
+  try {
+    Handle(SALOMEDS_IORAttribute) Att;
+    if (_lab.FindAttribute(SALOMEDS_IORAttribute::GetID(),Att)) {
+      TCollection_AsciiString ch(Att->Get());
+      char* IOR = CORBA::string_dup(ch.ToCString());
+      obj = _orb->string_to_object(IOR);
+    }
+  } catch(...) {}
+  return obj;
+}
+
+//============================================================================
+/*! Function :
+ *  Purpose  : 
+ */
+//============================================================================
+char* SALOMEDS_SObject_i::GetName() {
+  CORBA::String_var aStr;
+  Handle(TDataStd_Name) aName;
+  if (_lab.FindAttribute(TDataStd_Name::GetID(), aName)) {
+    aStr = CORBA::string_dup(TCollection_AsciiString(aName->Get()).ToCString());
+  }
+  return aStr._retn();
+}
+
+//============================================================================
+/*! Function :
+ *  Purpose  : 
+ */
+//============================================================================
+char* SALOMEDS_SObject_i::GetComment() {
+  CORBA::String_var aStr;
+  Handle(TDataStd_Comment) aComment;
+  if (_lab.FindAttribute(TDataStd_Comment::GetID(), aComment)) {
+    aStr = CORBA::string_dup(TCollection_AsciiString(aComment->Get()).ToCString());
+  }
+  return aStr._retn();
+}
+
+//============================================================================
+/*! Function :
+ *  Purpose  : 
+ */
+//============================================================================
+char* SALOMEDS_SObject_i::GetIOR() {
+  CORBA::String_var aStr;
+  Handle(SALOMEDS_IORAttribute) anIOR;
+  if (_lab.FindAttribute(SALOMEDS_IORAttribute::GetID(), anIOR)) {
+    aStr = CORBA::string_dup(TCollection_AsciiString(anIOR->Get()).ToCString());
+  }
+  return aStr._retn();
+}
index be22a90b20bfa83b0911ec66342572cf51fea67f..fa0fa58dc6edc89fd589c6830910b0b1f06ecb9d 100644 (file)
@@ -80,12 +80,16 @@ public:
   virtual void  Name(const char*);
   virtual SALOMEDS::ListOfAttributes* GetAllAttributes();
 
+  virtual CORBA::Object_ptr GetObject();
+
+  virtual char* GetName();
+  virtual char* GetComment();
+  virtual char* GetIOR();
 
   virtual CORBA::Short Tag();
 
   static char* AttributeIDToType(Standard_GUID);
   
   static Standard_GUID           ReturnGUIDForAttribute(const char* aTypeOfAttribute);
-
 };
 #endif
index 241792584449218b9e0e6c8b7b2f84354cd29311..40b179eca082117ca2d6b03cf1e21b424ac7ba9d 100644 (file)
@@ -24,7 +24,7 @@
 //  File   : SALOMEDS_SelectableAttribute.cxx
 //  Author : Yves FRICAUD
 //  Module : SALOME
-//  $Header:  
+//  $Header$
 
 using namespace std;
 #include "SALOMEDS_SelectableAttribute.ixx"
index 51bdda48ae24530cf037643bd21759c0255f754b..ed256eb0a9b2cd01d6c54f47f1b341df460f7240 100644 (file)
@@ -24,7 +24,7 @@
 //  File   : SALOMEDS_SequenceOfIntegerAttribute.cxx
 //  Author : Yves FRICAUD
 //  Module : SALOME
-//  $Header
+//  $Header$
 
 using namespace std;
 #include "SALOMEDS_SequenceOfIntegerAttribute.ixx"
index 9e3cf84e9289a1c3f28d715161597ff6c258a6d1..9c8d3516d2c410d8ac28b0c0219eb8ff9cb64c6a 100644 (file)
@@ -24,7 +24,7 @@
 //  File   : SALOMEDS_SequenceOfRealAttribute.cxx
 //  Author : Yves FRICAUD
 //  Module : SALOME
-//  $Header
+//  $Header$
 
 using namespace std;
 #include "SALOMEDS_SequenceOfRealAttribute.ixx"
index d3cb87809a69c2f03bbb04b00a4583976ee5f3c9..df8bf416c675b9c81fa7d472a08c3395cc865b2a 100644 (file)
@@ -38,11 +38,14 @@ using namespace std;
 #include "SALOMEDS_TargetAttribute.hxx"
 #include "SALOMEDS_StudyPropertiesAttribute.hxx"
 #include "SALOMEDS_PythonObjectAttribute.hxx"
+#include "SALOMEDS_ExternalFileDef.hxx"
+#include "SALOMEDS_FileType.hxx"
 #include <TDF_ChildIterator.hxx>
 #include <TDF_Label.hxx>
 #include <TDataStd_Name.hxx>
 #include <TDataStd_Comment.hxx>
 #include <TDataStd_UAttribute.hxx>
+#include <TDataStd_Real.hxx>
 #include <TDF_Tool.hxx>
 #include <TDF_Reference.hxx>
 #include <TDF_Data.hxx>
@@ -50,9 +53,9 @@ using namespace std;
 #include <TDF_ListIteratorOfAttributeList.hxx>
 #include "SALOMEDS_AttributePersistentRef_i.hxx"
 #include "SALOMEDS_AttributeIOR_i.hxx"
-#include "SALOMEDS_AttributeComment_i.hxx"
 #include "SALOMEDS_AttributeExternalFileDef_i.hxx"
 #include "SALOMEDS_AttributeFileType_i.hxx"
+#include "SALOMEDS_AttributeComment_i.hxx"
 #include "SALOMEDS_AttributeName_i.hxx"
 #include "SALOMEDS_AttributeSequenceOfInteger_i.hxx"
 #include "SALOMEDS_AttributeSequenceOfReal_i.hxx"
@@ -76,6 +79,7 @@ using namespace std;
 #include "SALOMEDS_AttributePythonObject_i.hxx"
 #include "SALOMEDS_Tool.hxx"
 #include "Utils_CorbaException.hxx"
+#include "Utils_ExceptHandlers.hxx"
 
 #include <HDFOI.hxx>
 #include <stdlib.h> 
@@ -84,6 +88,8 @@ using namespace std;
 #define DIRECTORYID 16661
 #define FILELOCALID 26662 
 
+UNEXPECT_CATCH(SBSalomeException, SALOME::SALOME_Exception);
+UNEXPECT_CATCH(SBLockProtection, SALOMEDS::StudyBuilder::LockProtection);
 //============================================================================
 /*! Function : constructor
  *  Purpose  :
@@ -126,8 +132,8 @@ SALOMEDS_StudyBuilder_i::NewComponent(const char* DataType)
   imax++;
   TDF_Label NL = L.FindChild(imax);
 
-//   TDataStd_Comment::Set(NL,Standard_CString(DataType));
-  TDataStd_Comment::Set(NL,Standard_CString(strdup(DataType)));
+   TDataStd_Comment::Set(NL,Standard_CString(DataType));
+   //  TDataStd_Comment::Set(NL,Standard_CString(CORBA::string_dup(DataType)));
 
   SALOMEDS_SComponent_i *  so_servant = new SALOMEDS_SComponent_i (NL,_orb);
   SALOMEDS::SComponent_var so;
@@ -151,12 +157,12 @@ void SALOMEDS_StudyBuilder_i::DefineComponentInstance(SALOMEDS::SComponent_ptr a
   TDF_Label Lab;
   ASSERT(!CORBA::is_nil(aComponent));
   CORBA::String_var compid = aComponent->GetID();
-  TDF_Tool::Label(_doc->GetData(),strdup(compid),Lab);
+  TDF_Tool::Label(_doc->GetData(),compid,Lab);
 
   //add IOR definition 
   ASSERT(!CORBA::is_nil(IOR));
   CORBA::String_var iorstr = _orb->object_to_string(IOR);
-  SALOMEDS_IORAttribute::Set(Lab,strdup(iorstr),_orb);
+  SALOMEDS_IORAttribute::Set(Lab,(char*)iorstr,_orb);
   
 }
 
@@ -189,7 +195,7 @@ SALOMEDS_StudyBuilder_i::NewObject(SALOMEDS::SObject_ptr theFatherObject)
   
   ASSERT(!CORBA::is_nil(theFatherObject));
   CORBA::String_var fatherid = theFatherObject->GetID();
-  TDF_Tool::Label(_doc->GetData(),strdup(fatherid),Lab);
+  TDF_Tool::Label(_doc->GetData(),fatherid,Lab);
 
   //Create a new label
   //YFR DEBUG : 13/02/2002  TDF_Label NewLab = Lab.NewChild();
@@ -224,7 +230,7 @@ SALOMEDS_StudyBuilder_i::NewObjectToTag(SALOMEDS::SObject_ptr theFatherObject,
 
   ASSERT(!CORBA::is_nil(theFatherObject));
   CORBA::String_var fatherid = theFatherObject->GetID();
-  TDF_Tool::Label(_doc->GetData(),strdup(fatherid),Lab);
+  TDF_Tool::Label(_doc->GetData(),fatherid,Lab);
   //Create or find label
   TDF_Label NewLab = Lab.FindChild(atag,1);
 
@@ -259,7 +265,7 @@ void SALOMEDS_StudyBuilder_i::RemoveObject(SALOMEDS::SObject_ptr anObject)
 
   Handle(SALOMEDS_IORAttribute) anAttr; // postponed removing of CORBA objects
   if (Lab.FindAttribute(SALOMEDS_IORAttribute::GetID(), anAttr))
-    SALOMEDS_Study_i::GetStudy(_doc->Main(), _orb)->AddPostponed(strdup(TCollection_AsciiString(anAttr->Get()).ToCString()));
+    SALOMEDS_Study_i::GetStudy(_doc->Main(), _orb)->AddPostponed(TCollection_AsciiString(anAttr->Get()).ToCString());
 
   Lab.ForgetAllAttributes();
 }
@@ -286,9 +292,9 @@ void SALOMEDS_StudyBuilder_i::RemoveObjectWithChildren(SALOMEDS::SObject_ptr anO
   }
   Handle(SALOMEDS_IORAttribute) anAttr; // postponed removing of CORBA objects
   if (Lab.FindAttribute(SALOMEDS_IORAttribute::GetID(), anAttr))
-    SALOMEDS_Study_i::GetStudy(_doc->Main(), _orb)->AddPostponed(strdup(TCollection_AsciiString(anAttr->Get()).ToCString()));
+    SALOMEDS_Study_i::GetStudy(_doc->Main(), _orb)->AddPostponed(TCollection_AsciiString(anAttr->Get()).ToCString());
 
-  TDF_ChildIterator it(Lab);
+  TDF_ChildIterator it(Lab, Standard_True);
   for(;it.More();it.Next()) {
     TDF_Label aLabel = it.Value();
     if (aLabel.FindAttribute(TDF_Reference::GetID(), aReference)) {
@@ -298,7 +304,7 @@ void SALOMEDS_StudyBuilder_i::RemoveObjectWithChildren(SALOMEDS::SObject_ptr anO
     }
     Handle(SALOMEDS_IORAttribute) anAttr; // postponed removing of CORBA objects
     if (aLabel.FindAttribute(SALOMEDS_IORAttribute::GetID(), anAttr))
-      SALOMEDS_Study_i::GetStudy(_doc->Main(), _orb)->AddPostponed(strdup(TCollection_AsciiString(anAttr->Get()).ToCString()));
+      SALOMEDS_Study_i::GetStudy(_doc->Main(), _orb)->AddPostponed(TCollection_AsciiString(anAttr->Get()).ToCString());
   }
 
   Lab.ForgetAllAttributes(Standard_True);
@@ -337,7 +343,7 @@ static void  Translate_persistentID_to_IOR(TDF_Label                  Lab,
 
       CORBA::String_var ior_string = driver->LocalPersistentIDToIOR(so, persistent_string, isMultiFile, isASCII);
 
-      TCollection_ExtendedString value(strdup(ior_string )); 
+      TCollection_ExtendedString value(ior_string); 
       SALOMEDS_IORAttribute::Set (current,value,orb); 
       
       //TCollection_AsciiString anEntry;TDF_Tool::Entry (current,anEntry); //SRN: No use here
@@ -358,17 +364,18 @@ static void  Translate_persistentID_to_IOR(TDF_Label                  Lab,
 void SALOMEDS_StudyBuilder_i::LoadWith(SALOMEDS::SComponent_ptr anSCO, 
                                       SALOMEDS::Driver_ptr aDriver) throw(SALOME::SALOME_Exception)
 {
+  Unexpect aCatch(SBSalomeException);
   TDF_Label Lab;
   ASSERT(!CORBA::is_nil(anSCO));
   CORBA::String_var scoid = anSCO->GetID();
-  TDF_Tool::Label(_doc->GetData(),strdup(scoid),Lab);
+  TDF_Tool::Label(_doc->GetData(),scoid,Lab);
   Handle(TDF_Attribute) Att;
-
+  
   //Find the current Url of the study  
   if (_doc->Main().FindAttribute(SALOMEDS_PersRefAttribute::GetID(),Att)) {
     int aLocked = anSCO->GetStudy()->GetProperties()->IsLocked();
     if (aLocked) anSCO->GetStudy()->GetProperties()->SetLocked(false);
-
+    
     TCollection_ExtendedString Res = Handle(TDataStd_Comment)::DownCast(Att)->Get();
     
     Handle(TDataStd_Comment) type;
@@ -377,7 +384,7 @@ void SALOMEDS_StudyBuilder_i::LoadWith(SALOMEDS::SComponent_ptr anSCO,
       DataType = type->Get();
     else 
       MESSAGE("No Data Type");
-
+    
     // associate the driver to the SComponent
     ASSERT(!CORBA::is_nil(aDriver));
     // mpv 06.03.2003: SAL1927 - if component data if already loaded, it is not necessary to do it again
@@ -386,9 +393,9 @@ void SALOMEDS_StudyBuilder_i::LoadWith(SALOMEDS::SComponent_ptr anSCO,
       return;
     }
     DefineComponentInstance (anSCO, aDriver);
-
+    
     TCollection_AsciiString aHDFPath(Res);
-
+    
     char* aHDFUrl;
     bool isASCII = false;
     if (HDFascii::isASCII(aHDFPath.ToCString())) {
@@ -398,12 +405,12 @@ void SALOMEDS_StudyBuilder_i::LoadWith(SALOMEDS::SComponent_ptr anSCO,
       sprintf(aHDFUrl, "%shdf_from_ascii.hdf", aResultPath);
       delete(aResultPath);
     } else {
-      aHDFUrl = strdup(aHDFPath.ToCString());
+      aHDFUrl = CORBA::string_dup(aHDFPath.ToCString());
     }
 
     //Open the Study HDF file 
     HDFfile *hdf_file = new HDFfile(aHDFUrl); 
-
+    
     char aMultifileState[2];
     char ASCIIfileState[2];
     try {
@@ -413,7 +420,7 @@ void SALOMEDS_StudyBuilder_i::LoadWith(SALOMEDS::SComponent_ptr anSCO,
       hdf_group->OpenOnDisk();
       HDFgroup *hdf_sco_group = new HDFgroup(scoid, hdf_group);
       hdf_sco_group->OpenOnDisk();
-
+       
       SALOMEDS::TMPFile_var aStreamFile;
       if (hdf_sco_group->ExistInternalObject("FILE_STREAM")) {
        HDFdataset *hdf_dataset = new HDFdataset("FILE_STREAM", hdf_sco_group);
@@ -430,11 +437,11 @@ void SALOMEDS_StudyBuilder_i::LoadWith(SALOMEDS::SComponent_ptr anSCO,
       HDFdataset *multifile_hdf_dataset = new HDFdataset("MULTIFILE_STATE", hdf_sco_group);
       multifile_hdf_dataset->OpenOnDisk();
       multifile_hdf_dataset->ReadFromDisk(aMultifileState);
-
+      
       HDFdataset *ascii_hdf_dataset = new HDFdataset("ASCII_STATE", hdf_sco_group);
       ascii_hdf_dataset->OpenOnDisk();
       ascii_hdf_dataset->ReadFromDisk(ASCIIfileState);
-
+      
       // set path without file name from URL 
       int aFileNameSize = Res.Length();
       char* aDir = new char[aFileNameSize];
@@ -444,24 +451,24 @@ void SALOMEDS_StudyBuilder_i::LoadWith(SALOMEDS::SComponent_ptr anSCO,
          aDir[aCounter+1] = 0;
          break;
        }
-
+      
       CORBA::Boolean aResult = (ASCIIfileState[0]=='A')?
        aDriver->LoadASCII(anSCO, aStreamFile.in(), aDir, aMultifileState[0]=='M'):
-       aDriver->Load(anSCO, aStreamFile.in(), aDir, aMultifileState[0]=='M');
+         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] = strdup(&(aHDFUrl[strlen(SALOMEDS_Tool::GetDirFromPath(aHDFUrl))]));
+         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 HDFexception("Unable to load component");
       }
-
+      
       delete(aDir);
 
       multifile_hdf_dataset->CloseOnDisk();
@@ -474,22 +481,22 @@ void SALOMEDS_StudyBuilder_i::LoadWith(SALOMEDS::SComponent_ptr anSCO,
       hdf_group = 0;
       hdf_file->CloseOnDisk();
       delete hdf_file;
-
+      
       if (isASCII) {
        SALOMEDS::ListOfFileNames_var aFilesToRemove = new SALOMEDS::ListOfFileNames;
        aFilesToRemove->length(1);
-       aFilesToRemove[0] = strdup(&(aHDFUrl[strlen(SALOMEDS_Tool::GetDirFromPath(aHDFUrl))]));
+       aFilesToRemove[0] = CORBA::string_dup(&(aHDFUrl[strlen(SALOMEDS_Tool::GetDirFromPath(aHDFUrl))]));
        SALOMEDS_Tool::RemoveTemporaryFiles(SALOMEDS_Tool::GetDirFromPath(aHDFUrl), aFilesToRemove, true);
       }
       delete aHDFUrl;
     }
     catch (HDFexception) {
-      MESSAGE("No persistent file Name");
+      INFOS("No persistent file Name");
       delete hdf_file;
       if (isASCII) {
        SALOMEDS::ListOfFileNames_var aFilesToRemove = new SALOMEDS::ListOfFileNames;
        aFilesToRemove->length(1);
-       aFilesToRemove[0] = strdup(&(aHDFUrl[strlen(SALOMEDS_Tool::GetDirFromPath(aHDFUrl))]));
+       aFilesToRemove[0] = CORBA::string_dup(&(aHDFUrl[strlen(SALOMEDS_Tool::GetDirFromPath(aHDFUrl))]));
        SALOMEDS_Tool::RemoveTemporaryFiles(SALOMEDS_Tool::GetDirFromPath(aHDFUrl), aFilesToRemove, true);
       }
       delete aHDFUrl;
@@ -500,10 +507,10 @@ void SALOMEDS_StudyBuilder_i::LoadWith(SALOMEDS::SComponent_ptr anSCO,
     try {
       Translate_persistentID_to_IOR (Lab,aDriver,_orb, aMultifileState[0]=='M', ASCIIfileState[0] == 'A');
     } catch (SALOME::SALOME_Exception) {
-      MESSAGE("Can't translate PersRef to IOR");
+      INFOS("Can't translate PersRef to IOR");
       if (aLocked) anSCO->GetStudy()->GetProperties()->SetLocked(true);
       THROW_SALOME_CORBA_EXCEPTION("Unable to convert component persistent data to the transient",SALOME::BAD_PARAM);
-//        throw HDFexception("Unable to load component data");
+      //        throw HDFexception("Unable to load component data");
     }
     if (aLocked) anSCO->GetStudy()->GetProperties()->SetLocked(true);
   } else
@@ -521,234 +528,54 @@ void SALOMEDS_StudyBuilder_i::Load(SALOMEDS::SObject_ptr sco)
   MESSAGE ( "This function is not yet implemented");
 }
 
-//============================================================================
-/*! Function : AddAttribute
- *  Purpose  : 
- */
-//============================================================================
-/*
-void SALOMEDS_StudyBuilder_i::AddAttribute(SALOMEDS::SObject_ptr anObject, 
-                                          SALOMEDS::AttributeType aType, 
-                                          const char * AttributeValue )
-{
-  TDF_Label Lab;
-  ASSERT(!CORBA::is_nil(anObject));
-  CORBA::String_var anobid = anObject->GetID();
-  TDF_Tool::Label(_doc->GetData(),strdup(anobid),Lab);
-  
-  TCollection_ExtendedString Value(strdup(AttributeValue)); 
-
-  Standard_GUID ID = SALOMEDS_SObject_i::TypeToAttributeID(aType);
-
-  if      (ID == TDataStd_Name::GetID())             TDataStd_Name::Set            (Lab,Value); 
-  else if (ID == TDataStd_Comment::GetID())          TDataStd_Comment::Set         (Lab,Value); 
-  else if (ID == SALOMEDS_IORAttribute::GetID())     SALOMEDS_IORAttribute::Set    (Lab,Value); 
-  else if (ID == SALOMEDS_PersRefAttribute::GetID()) SALOMEDS_PersRefAttribute::Set(Lab,Value); 
-}
-*/
 //============================================================================
 /*! Function : FindOrCreateAttribute
  *  Purpose  : Add attribute of given type to SObject, if there is attribute of such type, returns
  *  existing one
  */
 //============================================================================
-
 SALOMEDS::GenericAttribute_ptr SALOMEDS_StudyBuilder_i::FindOrCreateAttribute(SALOMEDS::SObject_ptr anObject, 
                                                                              const char* aTypeOfAttribute)
 {
   TDF_Label Lab;
   ASSERT(!CORBA::is_nil(anObject));
   CORBA::String_var anobid = anObject->GetID();
-  TDF_Tool::Label(_doc->GetData(),strdup(anobid),Lab);
-
-  if (strcmp(aTypeOfAttribute, "AttributeReal") == 0 ) {
-    Handle(TDataStd_Real) anAttr;
-    if (!Lab.FindAttribute(TDataStd_Real::GetID(), anAttr)) {
-      CheckLocked();
-      anAttr = new TDataStd_Real;
-      Lab.AddAttribute(anAttr); 
-    }
-    SALOMEDS_AttributeReal_i* aRealAttr = new SALOMEDS_AttributeReal_i(anAttr, _orb);
-    SALOMEDS::AttributeReal_var aRA = aRealAttr->AttributeReal::_this();
-    return  aRA._retn();
-  }
-  else if (strcmp(aTypeOfAttribute, "AttributeInteger") == 0 ) {
-    Handle(TDataStd_Integer) anAttr;
-    if (!Lab.FindAttribute(TDataStd_Integer::GetID(), anAttr)) {
-      CheckLocked();
-      anAttr = new TDataStd_Integer;
-      Lab.AddAttribute(anAttr); 
-    }
-    SALOMEDS_AttributeInteger_i* aIntAttr = new SALOMEDS_AttributeInteger_i(anAttr, _orb);
-    SALOMEDS::AttributeInteger_var aIA = aIntAttr->AttributeInteger::_this();
-    return  aIA._retn();
-  }
-  else if (strcmp(aTypeOfAttribute, "AttributeSequenceOfReal") == 0 ) {
-    Handle(SALOMEDS_SequenceOfRealAttribute) anAttr;
-    if (!Lab.FindAttribute(SALOMEDS_SequenceOfRealAttribute::GetID(), anAttr)) {
-      CheckLocked();
-      anAttr = new SALOMEDS_SequenceOfRealAttribute;
-      Lab.AddAttribute(anAttr); 
-    }
-    SALOMEDS_AttributeSequenceOfReal_i* aSeqRealAttr = new SALOMEDS_AttributeSequenceOfReal_i(anAttr, _orb);
-    SALOMEDS::AttributeSequenceOfReal_var aSRA = aSeqRealAttr->AttributeSequenceOfReal::_this();
-    return  aSRA._retn();
-  }
-  else if (strcmp(aTypeOfAttribute, "AttributeSequenceOfInteger") == 0 ) {
-    Handle(SALOMEDS_SequenceOfIntegerAttribute) anAttr;
-    if (!Lab.FindAttribute(SALOMEDS_SequenceOfIntegerAttribute::GetID(), anAttr)) {
-      CheckLocked();
-      anAttr = new SALOMEDS_SequenceOfIntegerAttribute;
-      Lab.AddAttribute(anAttr); 
-    }
-    SALOMEDS_AttributeSequenceOfInteger_i* aSeqIntegerAttr = new SALOMEDS_AttributeSequenceOfInteger_i(anAttr, _orb);
-    SALOMEDS::AttributeSequenceOfInteger_var aSIA = aSeqIntegerAttr->AttributeSequenceOfInteger::_this();
-    return  aSIA._retn();
-  }
-  else if (strcmp(aTypeOfAttribute, "AttributeName") == 0 ) {
-    Handle(TDataStd_Name) anAttr;
-    if (!Lab.FindAttribute(TDataStd_Name::GetID(), anAttr)) {
-      CheckLocked();
-      anAttr = new TDataStd_Name;
-      Lab.AddAttribute(anAttr); 
-    }
-    SALOMEDS_AttributeName_i* aNameAttr = new SALOMEDS_AttributeName_i(anAttr, _orb);
-    SALOMEDS::AttributeName_var aSNA = aNameAttr->AttributeName::_this();
-    return  aSNA._retn();
-  }
-  else if (strcmp(aTypeOfAttribute, "AttributeComment") == 0 ) {
-    Handle(TDataStd_Comment) anAttr;
-    if (!Lab.FindAttribute(TDataStd_Comment::GetID(), anAttr)) {
-      CheckLocked();
-      anAttr = new TDataStd_Comment;
-      Lab.AddAttribute(anAttr); 
-    }
-    SALOMEDS_AttributeComment_i* aCommentAttr = new SALOMEDS_AttributeComment_i(anAttr, _orb);
-    SALOMEDS::AttributeComment_var aCA = aCommentAttr->AttributeComment::_this();
-    return  aCA._retn();
-  }
-  else if (strcmp(aTypeOfAttribute, "AttributeExternalFileDef") == 0 ) {
-    Handle(SALOMEDS_ExternalFileDef) anAttr;
-    if (!Lab.FindAttribute(SALOMEDS_ExternalFileDef::GetID(), anAttr)) {
-      anAttr = new SALOMEDS_ExternalFileDef;
-      Lab.AddAttribute(anAttr); 
-    }
-    SALOMEDS_AttributeExternalFileDef_i* anExternalFileDefAttr = new SALOMEDS_AttributeExternalFileDef_i(anAttr, _orb);
-    SALOMEDS::AttributeExternalFileDef_var aCA = anExternalFileDefAttr->AttributeExternalFileDef::_this();
-    return  aCA._retn();
-  }
-  else if (strcmp(aTypeOfAttribute, "AttributeFileType") == 0 ) {
-    Handle(SALOMEDS_FileType) anAttr;
-    if (!Lab.FindAttribute(SALOMEDS_FileType::GetID(), anAttr)) {
-      anAttr = new SALOMEDS_FileType;
-      Lab.AddAttribute(anAttr); 
-    }
-    SALOMEDS_AttributeFileType_i* anFileTypeAttr = new SALOMEDS_AttributeFileType_i(anAttr, _orb);
-    SALOMEDS::AttributeFileType_var aCA = anFileTypeAttr->AttributeFileType::_this();
-    return  aCA._retn();
-  }
-  else if (strcmp(aTypeOfAttribute, "AttributeIOR") == 0 ) {
-    Handle(SALOMEDS_IORAttribute) anAttr;
-    if (!Lab.FindAttribute(SALOMEDS_IORAttribute::GetID(), anAttr)) {
-      CheckLocked();
-      anAttr = new SALOMEDS_IORAttribute;
-      Lab.AddAttribute(anAttr); 
-    }
-    SALOMEDS_AttributeIOR_i* aIORAttr = new SALOMEDS_AttributeIOR_i(anAttr, _orb);
-    SALOMEDS::AttributeIOR_var aIA = aIORAttr->AttributeIOR::_this();
-    return  aIA._retn();
-  }
-  else if (strcmp(aTypeOfAttribute, "AttributePersistentRef") == 0 ) {
-    Handle(SALOMEDS_PersRefAttribute) anAttr;
-    if (!Lab.FindAttribute(SALOMEDS_PersRefAttribute::GetID(), anAttr)) {
-      anAttr = new SALOMEDS_PersRefAttribute;
-      Lab.AddAttribute(anAttr); 
-    }
-    SALOMEDS_AttributePersistentRef_i* aPerRefAttr = new SALOMEDS_AttributePersistentRef_i(anAttr, _orb);
-    SALOMEDS::AttributePersistentRef_var aPRA = aPerRefAttr->AttributePersistentRef::_this();
-    return  aPRA._retn();
-  }
-  else if (strcmp(aTypeOfAttribute, "AttributeDrawable") == 0 ) {
-    Handle(SALOMEDS_DrawableAttribute) anAttr;
-    if (!Lab.FindAttribute(SALOMEDS_DrawableAttribute::GetID(), anAttr)) {
-      anAttr = new SALOMEDS_DrawableAttribute;
-      Lab.AddAttribute(anAttr); 
-    }
-    SALOMEDS_AttributeDrawable_i* aDrawableAttr = new SALOMEDS_AttributeDrawable_i(anAttr, _orb);
-    SALOMEDS::AttributeDrawable_var aDrawA = aDrawableAttr->AttributeDrawable::_this();
-    return  aDrawA._retn();
-  }
-  else if (strcmp(aTypeOfAttribute, "AttributeSelectable") == 0 ) {
-    Handle(SALOMEDS_SelectableAttribute) anAttr;
-    if (!Lab.FindAttribute(SALOMEDS_SelectableAttribute::GetID(), anAttr)) {
-      anAttr = new SALOMEDS_SelectableAttribute;
-      Lab.AddAttribute(anAttr); 
-    }
-    SALOMEDS_AttributeSelectable_i* aSelectableAttr = new SALOMEDS_AttributeSelectable_i(anAttr, _orb);
-    SALOMEDS::AttributeSelectable_var aSelA = aSelectableAttr->AttributeSelectable::_this();
-    return  aSelA._retn();
-  }
-  else if (strcmp(aTypeOfAttribute, "AttributeExpandable") == 0 ) {
-    Handle(SALOMEDS_ExpandableAttribute) anAttr;
-    if (!Lab.FindAttribute(SALOMEDS_ExpandableAttribute::GetID(), anAttr)) {
-      anAttr = new SALOMEDS_ExpandableAttribute;
-      Lab.AddAttribute(anAttr); 
-    }
-    SALOMEDS_AttributeExpandable_i* aExpandableAttr = new SALOMEDS_AttributeExpandable_i(anAttr, _orb);
-    SALOMEDS::AttributeExpandable_var aExpA = aExpandableAttr->AttributeExpandable::_this();
-    return  aExpA._retn();
-  }
-  else if (strcmp(aTypeOfAttribute, "AttributeOpened") == 0 ) {
-    Handle(SALOMEDS_OpenedAttribute) anAttr;
-    if (!Lab.FindAttribute(SALOMEDS_OpenedAttribute::GetID(), anAttr)) {
-      anAttr = new SALOMEDS_OpenedAttribute;
-      Lab.AddAttribute(anAttr); 
-    }
-    SALOMEDS_AttributeOpened_i* aOpenedAttr = new SALOMEDS_AttributeOpened_i(anAttr, _orb);
-    SALOMEDS::AttributeOpened_var aOpenA = aOpenedAttr->AttributeOpened::_this();
-    return  aOpenA._retn();
-  }
-  else if (strcmp(aTypeOfAttribute, "AttributeTextColor") == 0 ) {
-    Handle(SALOMEDS_TextColorAttribute) anAttr;
-    if (!Lab.FindAttribute(SALOMEDS_TextColorAttribute::GetID(), anAttr)) {
-      CheckLocked();
-      anAttr = new SALOMEDS_TextColorAttribute;
-      Lab.AddAttribute(anAttr); 
-    }
-    SALOMEDS_AttributeTextColor_i* aTextColorAttr = new SALOMEDS_AttributeTextColor_i(anAttr, _orb);
-    SALOMEDS::AttributeTextColor_var aTCA = aTextColorAttr->AttributeTextColor::_this();
-    return  aTCA._retn();
-  }
-  else if (strcmp(aTypeOfAttribute, "AttributeTextHighlightColor") == 0 ) {
-    Handle(SALOMEDS_TextHighlightColorAttribute) anAttr;
-    if (!Lab.FindAttribute(SALOMEDS_TextHighlightColorAttribute::GetID(), anAttr)) {
-      CheckLocked();
-      anAttr = new SALOMEDS_TextHighlightColorAttribute;
-      Lab.AddAttribute(anAttr); 
-    }
-    SALOMEDS_AttributeTextHighlightColor_i* aTextHighlightColorAttr = new SALOMEDS_AttributeTextHighlightColor_i(anAttr, _orb);
-    SALOMEDS::AttributeTextHighlightColor_var aTHCA = aTextHighlightColorAttr->AttributeTextHighlightColor::_this();
-    return  aTHCA._retn();
-  }
-  else if (strcmp(aTypeOfAttribute, "AttributePixMap") == 0 ) {
-    Handle(SALOMEDS_PixMapAttribute) anAttr;
-    if (!Lab.FindAttribute(SALOMEDS_PixMapAttribute::GetID(), anAttr)) {
-      CheckLocked();
-      anAttr = new SALOMEDS_PixMapAttribute;
-      Lab.AddAttribute(anAttr); 
-    }
-    SALOMEDS_AttributePixMap_i* aPixMapAttr = new SALOMEDS_AttributePixMap_i(anAttr, _orb);
-    SALOMEDS::AttributePixMap_var aPMA = aPixMapAttr->AttributePixMap::_this();
-    return  aPMA._retn();
-  }
-  else if (strncmp(aTypeOfAttribute, "AttributeTreeNode",17) == 0 ) {
+  TDF_Tool::Label(_doc->GetData(),anobid,Lab);
+
+  __FindOrCreateAttributeLocked(TDataStd_Real, AttributeReal)
+  __FindOrCreateAttributeLocked(TDataStd_Integer, AttributeInteger)
+  __FindOrCreateAttributeLocked(SALOMEDS_SequenceOfRealAttribute, AttributeSequenceOfReal)
+  __FindOrCreateAttributeLocked(SALOMEDS_SequenceOfIntegerAttribute, AttributeSequenceOfInteger)
+  __FindOrCreateAttributeLocked(TDataStd_Name, AttributeName)
+  __FindOrCreateAttributeLocked(TDataStd_Comment, AttributeComment)
+  __FindOrCreateAttributeLocked(SALOMEDS_IORAttribute, AttributeIOR)
+  __FindOrCreateAttributeLocked(SALOMEDS_PixMapAttribute, AttributePixMap)
+  __FindOrCreateAttributeLocked(SALOMEDS_LocalIDAttribute, AttributeLocalID)
+  __FindOrCreateAttributeLocked(SALOMEDS_TableOfIntegerAttribute, AttributeTableOfInteger)
+  __FindOrCreateAttributeLocked(SALOMEDS_TableOfRealAttribute, AttributeTableOfReal)
+  __FindOrCreateAttributeLocked(SALOMEDS_TableOfStringAttribute, AttributeTableOfString)
+  __FindOrCreateAttributeLocked(SALOMEDS_PythonObjectAttribute, AttributePythonObject)
+
+  __FindOrCreateAttribute(SALOMEDS_PersRefAttribute, AttributePersistentRef)
+  __FindOrCreateAttribute(SALOMEDS_DrawableAttribute, AttributeDrawable)
+  __FindOrCreateAttribute(SALOMEDS_SelectableAttribute, AttributeSelectable)
+  __FindOrCreateAttribute(SALOMEDS_ExpandableAttribute, AttributeExpandable)
+  __FindOrCreateAttribute(SALOMEDS_OpenedAttribute, AttributeOpened)
+  __FindOrCreateAttribute(SALOMEDS_TextColorAttribute, AttributeTextColor)
+  __FindOrCreateAttribute(SALOMEDS_TextHighlightColorAttribute, AttributeTextHighlightColor)
+  __FindOrCreateAttribute(SALOMEDS_TargetAttribute, AttributeTarget)
+  __FindOrCreateAttribute(SALOMEDS_StudyPropertiesAttribute, AttributeStudyProperties)
+  __FindOrCreateAttribute(SALOMEDS_ExternalFileDef, AttributeExternalFileDef)
+  __FindOrCreateAttribute(SALOMEDS_FileType, AttributeFileType)
+
+  if (strncmp(aTypeOfAttribute, "AttributeTreeNode",17) == 0 ) {
     Standard_GUID aTreeNodeGUID;
-    if (strcmp(aTypeOfAttribute, "AttributeTreeNode") == 0) 
+    if (strcmp(aTypeOfAttribute, "AttributeTreeNode") == 0) {
       aTreeNodeGUID = TDataStd_TreeNode::GetDefaultTreeID();
-    else {
+    else {
       char* aGUIDString = new char[40];
       sprintf(aGUIDString, &(aTypeOfAttribute[21]));
-      Standard_GUID aGUID = Standard_GUID(aGUIDString); // create tree node GUID by name
+      aTreeNodeGUID = Standard_GUID(aGUIDString); // create tree node GUID by name
       delete(aGUIDString);
     }
     Handle(TDataStd_TreeNode) anAttr;
@@ -757,98 +584,19 @@ SALOMEDS::GenericAttribute_ptr SALOMEDS_StudyBuilder_i::FindOrCreateAttribute(SA
       anAttr = TDataStd_TreeNode::Set(Lab, aTreeNodeGUID);
     }
     SALOMEDS_AttributeTreeNode_i* aTreeNodeAttr = new SALOMEDS_AttributeTreeNode_i(anAttr, _orb);
-    SALOMEDS::AttributeTreeNode_var aTNA = aTreeNodeAttr->AttributeTreeNode::_this();
-    return  aTNA._retn();
+    return aTreeNodeAttr->AttributeTreeNode::_this();
   }
-  else if (strncmp(aTypeOfAttribute, "AttributeUserID",15) == 0 ) {
+
+  if (strncmp(aTypeOfAttribute, "AttributeUserID",15) == 0 ) {
     Handle(TDataStd_UAttribute) anAttr;
     if (!Lab.FindAttribute(SALOMEDS_AttributeUserID_i::DefaultID(), anAttr)) {
       CheckLocked();
       anAttr = TDataStd_UAttribute::Set(Lab, SALOMEDS_AttributeUserID_i::DefaultID());
     }
     SALOMEDS_AttributeUserID_i* aUAttr = new SALOMEDS_AttributeUserID_i(anAttr, _orb);
-    SALOMEDS::AttributeUserID_var aUA = aUAttr->AttributeUserID::_this();
-    return  aUA._retn();
-  }
-  else if (strcmp(aTypeOfAttribute, "AttributeLocalID") == 0 ) {
-    Handle(SALOMEDS_LocalIDAttribute) anAttr;
-    if (!Lab.FindAttribute(SALOMEDS_LocalIDAttribute::GetID(), anAttr)) {
-      CheckLocked();
-      anAttr = new SALOMEDS_LocalIDAttribute;
-      Lab.AddAttribute(anAttr); 
-    }
-    SALOMEDS_AttributeLocalID_i* aLIDAttr = new SALOMEDS_AttributeLocalID_i(anAttr, _orb);
-    SALOMEDS::AttributeLocalID_var aLIDA = aLIDAttr->AttributeLocalID::_this();
-    return  aLIDA._retn();
-  }
-  else if (strcmp(aTypeOfAttribute, "AttributeTarget") == 0 ) {
-    Handle(SALOMEDS_TargetAttribute) anAttr;
-    if (!Lab.FindAttribute(SALOMEDS_TargetAttribute::GetID(), anAttr)) {
-      anAttr = new SALOMEDS_TargetAttribute;
-      Lab.AddAttribute(anAttr); 
-    }
-    SALOMEDS_AttributeTarget_i* aLIDAttr = new SALOMEDS_AttributeTarget_i(anAttr, _orb);
-    SALOMEDS::AttributeTarget_var aLIDA = aLIDAttr->AttributeTarget::_this();
-    return  aLIDA._retn();
-  }
-  else if (strcmp(aTypeOfAttribute, "AttributeTableOfInteger") == 0 ) {
-    Handle(SALOMEDS_TableOfIntegerAttribute) anAttr;
-    if (!Lab.FindAttribute(SALOMEDS_TableOfIntegerAttribute::GetID(), anAttr)) {
-      CheckLocked();
-      anAttr = new SALOMEDS_TableOfIntegerAttribute;
-      Lab.AddAttribute(anAttr); 
-    }
-    SALOMEDS_AttributeTableOfInteger_i* aTabIntegerAttr = new SALOMEDS_AttributeTableOfInteger_i(anAttr, _orb);
-    SALOMEDS::AttributeTableOfInteger_var aTIA = aTabIntegerAttr->AttributeTableOfInteger::_this();
-    return  aTIA._retn();
-  }
-  else if (strcmp(aTypeOfAttribute, "AttributeTableOfReal") == 0 ) {
-    Handle(SALOMEDS_TableOfRealAttribute) anAttr;
-    if (!Lab.FindAttribute(SALOMEDS_TableOfRealAttribute::GetID(), anAttr)) {
-      CheckLocked();
-      anAttr = new SALOMEDS_TableOfRealAttribute;
-      Lab.AddAttribute(anAttr); 
-    }
-    SALOMEDS_AttributeTableOfReal_i* aTabRealAttr = new SALOMEDS_AttributeTableOfReal_i(anAttr, _orb);
-    SALOMEDS::AttributeTableOfReal_var aTRA = aTabRealAttr->AttributeTableOfReal::_this();
-    return  aTRA._retn();
-  }
-  else if (strcmp(aTypeOfAttribute, "AttributeTableOfString") == 0 ) {
-    Handle(SALOMEDS_TableOfStringAttribute) anAttr;
-    if (!Lab.FindAttribute(SALOMEDS_TableOfStringAttribute::GetID(), anAttr)) {
-      CheckLocked();
-      anAttr = new SALOMEDS_TableOfStringAttribute;
-      Lab.AddAttribute(anAttr); 
-    }
-    SALOMEDS_AttributeTableOfString_i* aTabStringAttr = new SALOMEDS_AttributeTableOfString_i(anAttr, _orb);
-    SALOMEDS::AttributeTableOfString_var aTRA = aTabStringAttr->AttributeTableOfString::_this();
-    return  aTRA._retn();
-  }
-  else if (strcmp(aTypeOfAttribute, "AttributeStudyProperties") == 0 ) {
-    Handle(SALOMEDS_StudyPropertiesAttribute) anAttr;
-    if (!Lab.FindAttribute(SALOMEDS_StudyPropertiesAttribute::GetID(), anAttr)) {
-      CheckLocked();
-      if (!Lab.FindAttribute(SALOMEDS_StudyPropertiesAttribute::GetID(), anAttr)) {
-       anAttr = new SALOMEDS_StudyPropertiesAttribute;
-       Lab.AddAttribute(anAttr); 
-       anAttr->SetModified(0);
-      }
-    }
-    SALOMEDS_AttributeStudyProperties_i* aStPropAttr = new SALOMEDS_AttributeStudyProperties_i(anAttr, _orb);
-    SALOMEDS::AttributeStudyProperties_var aSPA = aStPropAttr->AttributeStudyProperties::_this();
-    return  aSPA._retn();
-  }
-  else if (strcmp(aTypeOfAttribute, "AttributePythonObject") == 0 ) {
-    Handle(SALOMEDS_PythonObjectAttribute) anAttr;
-    if (!Lab.FindAttribute(SALOMEDS_PythonObjectAttribute::GetID(), anAttr)) {
-      CheckLocked();
-      anAttr = new SALOMEDS_PythonObjectAttribute;
-      Lab.AddAttribute(anAttr); 
-    }
-    SALOMEDS_AttributePythonObject_i* aPObjAttr = new SALOMEDS_AttributePythonObject_i(anAttr, _orb);
-    SALOMEDS::AttributePythonObject_var aPOA = aPObjAttr->AttributePythonObject::_this();
-    return  aPOA._retn();
+    return aUAttr->AttributeUserID::_this();
   }
+  return SALOMEDS::GenericAttribute::_nil();
 }
 
 //============================================================================
@@ -864,141 +612,13 @@ CORBA::Boolean SALOMEDS_StudyBuilder_i::FindAttribute(SALOMEDS::SObject_ptr anOb
   TDF_Label Lab;
   ASSERT(!CORBA::is_nil(anObject));
   CORBA::String_var anobid = anObject->GetID();
-  TDF_Tool::Label(_doc->GetData(),strdup(anobid),Lab);
+  TDF_Tool::Label(_doc->GetData(),anobid,Lab);
   Handle(TDF_Attribute) anAttr;
-  Standard_Boolean found = Lab.FindAttribute(SALOMEDS_SObject_i::ReturnGUIDForAttribute(aTypeOfAttribute), anAttr);
-  if (found) {
-    if (strcmp(aTypeOfAttribute, "AttributeReal") == 0 )  {
-      SALOMEDS_AttributeReal_i* Attr= new SALOMEDS_AttributeReal_i(Handle(TDataStd_Real)::DownCast(anAttr), _orb);
-      anAttribute = Attr->AttributeReal::_this();
-      return Standard_True;
-    }
-    else if (strcmp(aTypeOfAttribute, "AttributeInteger") == 0 )  {
-      SALOMEDS_AttributeInteger_i* Attr= new SALOMEDS_AttributeInteger_i(Handle(TDataStd_Integer)::DownCast(anAttr), _orb);
-      anAttribute = Attr->AttributeInteger::_this();
-      return Standard_True;
-    }
-    else if (strcmp(aTypeOfAttribute, "AttributeSequenceOfReal") == 0 )  {
-      SALOMEDS_AttributeSequenceOfReal_i* Attr= new SALOMEDS_AttributeSequenceOfReal_i(Handle(SALOMEDS_SequenceOfRealAttribute)::DownCast(anAttr), _orb);
-      anAttribute = Attr->AttributeSequenceOfReal::_this();
-      return Standard_True;
-    }
-    else if (strcmp(aTypeOfAttribute, "AttributeSequenceOfInteger") == 0 )  {
-      SALOMEDS_AttributeSequenceOfInteger_i* Attr= new SALOMEDS_AttributeSequenceOfInteger_i(Handle(SALOMEDS_SequenceOfIntegerAttribute)::DownCast(anAttr), _orb);
-      anAttribute = Attr->AttributeSequenceOfInteger::_this();
-      return Standard_True;
-    }
-    else if (strcmp(aTypeOfAttribute, "AttributeName") == 0 ) {
-      SALOMEDS_AttributeName_i* Attr= new SALOMEDS_AttributeName_i(Handle(TDataStd_Name)::DownCast(anAttr), _orb);
-      anAttribute = Attr->AttributeName::_this();
-      return Standard_True;
-    }
-    else if (strcmp(aTypeOfAttribute, "AttributeComment") == 0 ) {
-      SALOMEDS_AttributeComment_i* Attr= new SALOMEDS_AttributeComment_i(Handle(TDataStd_Comment)::DownCast(anAttr), _orb);
-      anAttribute = Attr->AttributeComment::_this();
-      return Standard_True;
-    }
-    else if (strcmp(aTypeOfAttribute, "AttributeExternalFileDef") == 0 ) {
-      SALOMEDS_AttributeExternalFileDef_i* Attr= new SALOMEDS_AttributeExternalFileDef_i(Handle(SALOMEDS_ExternalFileDef)::DownCast(anAttr), _orb);
-      anAttribute = Attr->AttributeExternalFileDef::_this();
-      return Standard_True;
-    }
-    else if (strcmp(aTypeOfAttribute, "AttributeFileType") == 0 ) {
-      SALOMEDS_AttributeFileType_i* Attr= new SALOMEDS_AttributeFileType_i(Handle(SALOMEDS_FileType)::DownCast(anAttr), _orb);
-      anAttribute = Attr->AttributeFileType::_this();
-      return Standard_True;
-    }
-    else if (strcmp(aTypeOfAttribute, "AttributeIOR") == 0 ) {
-      SALOMEDS_AttributeIOR_i* Attr= new SALOMEDS_AttributeIOR_i(Handle(SALOMEDS_IORAttribute)::DownCast(anAttr), _orb);
-      anAttribute = Attr->AttributeIOR::_this();
-      return Standard_True;
-    }
-    else if (strcmp(aTypeOfAttribute, "AttributePersistentRef") == 0 )  {
-      SALOMEDS_AttributePersistentRef_i* Attr= new SALOMEDS_AttributePersistentRef_i(Handle(SALOMEDS_PersRefAttribute)::DownCast(anAttr), _orb);
-      anAttribute = Attr->AttributePersistentRef::_this();
-      return Standard_True;
-    }
-    else if (strcmp(aTypeOfAttribute, "AttributeDrawable") == 0 )  {
-      SALOMEDS_AttributeDrawable_i* Attr= new SALOMEDS_AttributeDrawable_i(Handle(SALOMEDS_DrawableAttribute)::DownCast(anAttr), _orb);
-      anAttribute = Attr->AttributeDrawable::_this();
-      return Standard_True;
-    }
-    else if (strcmp(aTypeOfAttribute, "AttributeSelectable") == 0 )  {
-      SALOMEDS_AttributeSelectable_i* Attr= new SALOMEDS_AttributeSelectable_i(Handle(SALOMEDS_SelectableAttribute)::DownCast(anAttr), _orb);
-      anAttribute = Attr->AttributeSelectable::_this();
-      return Standard_True;
-    }
-    else if (strcmp(aTypeOfAttribute, "AttributeExpandable") == 0 )  {
-      SALOMEDS_AttributeExpandable_i* Attr= new SALOMEDS_AttributeExpandable_i(Handle(SALOMEDS_ExpandableAttribute)::DownCast(anAttr), _orb);
-      anAttribute = Attr->AttributeExpandable::_this();
-      return Standard_True;
-    }
-    else if (strcmp(aTypeOfAttribute, "AttributeOpened") == 0 )  {
-      SALOMEDS_AttributeOpened_i* Attr= new SALOMEDS_AttributeOpened_i(Handle(SALOMEDS_OpenedAttribute)::DownCast(anAttr), _orb);
-      anAttribute = Attr->AttributeOpened::_this();
-      return Standard_True;
-    }
-    else if (strcmp(aTypeOfAttribute, "AttributeTextColor") == 0 )  {
-      SALOMEDS_AttributeTextColor_i* Attr= new SALOMEDS_AttributeTextColor_i(Handle(SALOMEDS_TextColorAttribute)::DownCast(anAttr), _orb);
-      anAttribute = Attr->AttributeTextColor::_this();
-      return Standard_True;
-    }
-    else if (strcmp(aTypeOfAttribute, "AttributeTextHighlightColor") == 0 )  {
-      SALOMEDS_AttributeTextHighlightColor_i* Attr= new SALOMEDS_AttributeTextHighlightColor_i(Handle(SALOMEDS_TextHighlightColorAttribute)::DownCast(anAttr), _orb);
-      anAttribute = Attr->AttributeTextHighlightColor::_this();
-      return Standard_True;
-    }
-    else if (strcmp(aTypeOfAttribute, "AttributePixMap") == 0 )  {
-      SALOMEDS_AttributePixMap_i* Attr= new SALOMEDS_AttributePixMap_i(Handle(SALOMEDS_PixMapAttribute)::DownCast(anAttr), _orb);
-      anAttribute = Attr->AttributePixMap::_this();
-      return Standard_True;
-    }
-    else if (strncmp(aTypeOfAttribute, "AttributeTreeNode",17) == 0 )  {
-      SALOMEDS_AttributeTreeNode_i* Attr= new SALOMEDS_AttributeTreeNode_i(Handle(TDataStd_TreeNode)::DownCast(anAttr), _orb);
-      anAttribute = Attr->AttributeTreeNode::_this();
-      return Standard_True;
-    }
-    else if (strncmp(aTypeOfAttribute, "AttributeUserID",15) == 0 )  {
-      SALOMEDS_AttributeUserID_i* Attr= new SALOMEDS_AttributeUserID_i(Handle(TDataStd_UAttribute)::DownCast(anAttr), _orb);
-      anAttribute = Attr->AttributeUserID::_this();
-      return Standard_True;
-    }
-    else if (strcmp(aTypeOfAttribute, "AttributeLocalID") == 0 )  {
-      SALOMEDS_AttributeLocalID_i* Attr= new SALOMEDS_AttributeLocalID_i(Handle(SALOMEDS_LocalIDAttribute)::DownCast(anAttr), _orb);
-      anAttribute = Attr->AttributeLocalID::_this();
-      return Standard_True;
-    }
-    else if (strcmp(aTypeOfAttribute, "AttributeTarget") == 0 )  {
-      SALOMEDS_AttributeTarget_i* Attr= new SALOMEDS_AttributeTarget_i(Handle(SALOMEDS_TargetAttribute)::DownCast(anAttr), _orb);
-      anAttribute = Attr->AttributeTarget::_this();
-      return Standard_True;
-    }
-    else if (strcmp(aTypeOfAttribute, "AttributeTableOfInteger") == 0 )  {
-      SALOMEDS_AttributeTableOfInteger_i* Attr= new SALOMEDS_AttributeTableOfInteger_i(Handle(SALOMEDS_TableOfIntegerAttribute)::DownCast(anAttr), _orb);
-      anAttribute = Attr->AttributeTableOfInteger::_this();
-      return Standard_True;
-    }
-    else if (strcmp(aTypeOfAttribute, "AttributeTableOfReal") == 0 )  {
-      SALOMEDS_AttributeTableOfReal_i* Attr= new SALOMEDS_AttributeTableOfReal_i(Handle(SALOMEDS_TableOfRealAttribute)::DownCast(anAttr), _orb);
-      anAttribute = Attr->AttributeTableOfReal::_this();
-      return Standard_True;
-    }
-    else if (strcmp(aTypeOfAttribute, "AttributeTableOfString") == 0 )  {
-      SALOMEDS_AttributeTableOfString_i* Attr= new SALOMEDS_AttributeTableOfString_i(Handle(SALOMEDS_TableOfStringAttribute)::DownCast(anAttr), _orb);
-      anAttribute = Attr->AttributeTableOfString::_this();
-      return Standard_True;
-    }
-    else if (strcmp(aTypeOfAttribute, "AttributeStudyProperties") == 0 )  {
-      SALOMEDS_AttributeStudyProperties_i* Attr= new SALOMEDS_AttributeStudyProperties_i(Handle(SALOMEDS_StudyPropertiesAttribute)::DownCast(anAttr), _orb);
-      anAttribute = Attr->AttributeStudyProperties::_this();
-      return Standard_True;
-    }
-    else if (strcmp(aTypeOfAttribute, "AttributePythonObject") == 0 )  {
-      SALOMEDS_AttributePythonObject_i* Attr= new SALOMEDS_AttributePythonObject_i(Handle(SALOMEDS_PythonObjectAttribute)::DownCast(anAttr), _orb);
-      anAttribute = Attr->AttributePythonObject::_this();
-      return Standard_True;
-    }
-  } else return Standard_False;
+  if (Lab.FindAttribute(SALOMEDS_GenericAttribute_i::GetGUID(aTypeOfAttribute), anAttr)) {
+    anAttribute = SALOMEDS::GenericAttribute::_duplicate(SALOMEDS_GenericAttribute_i::CreateAttribute(_orb, anAttr));
+    return Standard_True;
+  }
+  return Standard_False;
 }
 
 //============================================================================
@@ -1014,16 +634,16 @@ void SALOMEDS_StudyBuilder_i::RemoveAttribute(SALOMEDS::SObject_ptr anObject,
   TDF_Label Lab;
   ASSERT(!CORBA::is_nil(anObject));
   CORBA::String_var anobid = anObject->GetID();
-  TDF_Tool::Label(_doc->GetData(),strdup(anobid),Lab);
+  TDF_Tool::Label(_doc->GetData(),anobid,Lab);
   
   if (strcmp(aTypeOfAttribute, "AttributeIOR") == 0) { // postponed removing of CORBA objects
     Handle(SALOMEDS_IORAttribute) anAttr;
     if (Lab.FindAttribute(SALOMEDS_IORAttribute::GetID(), anAttr))
-      SALOMEDS_Study_i::GetStudy(_doc->Main(), _orb)->AddPostponed(strdup(TCollection_AsciiString(anAttr->Get()).ToCString()));
+      SALOMEDS_Study_i::GetStudy(_doc->Main(), _orb)->AddPostponed(TCollection_AsciiString(anAttr->Get()).ToCString());
     else return;
   }
 
-  Lab.ForgetAttribute (SALOMEDS_SObject_i::ReturnGUIDForAttribute(aTypeOfAttribute));
+  Lab.ForgetAttribute (SALOMEDS_GenericAttribute_i::GetGUID(aTypeOfAttribute));
 }
 
 //============================================================================
@@ -1039,16 +659,16 @@ SALOMEDS_StudyBuilder_i::Addreference(SALOMEDS::SObject_ptr me,
   TDF_Label Lab;
   ASSERT(!CORBA::is_nil(me));
   CORBA::String_var meid = me->GetID();
-  TDF_Tool::Label(_doc->GetData(),strdup(meid),Lab);  
+  TDF_Tool::Label(_doc->GetData(),meid,Lab);  
   TDF_Label RefLab;
   ASSERT(!CORBA::is_nil(theReferencedObject));
   CORBA::String_var roid = theReferencedObject->GetID();
-  TDF_Tool::Label(_doc->GetData(),strdup(roid),RefLab);
+  TDF_Tool::Label(_doc->GetData(),roid,RefLab);
   TDF_Reference::Set(Lab,RefLab);
 
   SALOMEDS_TargetAttribute::Set(RefLab)->Append(Lab);
 
-  if(!CORBA::is_nil(_callbackOnRemove)) _callbackOnRemove->OnRemoveSObject(me);
+  if(!CORBA::is_nil(_callbackOnRemove) && Lab.IsDescendant(_doc->Main())) _callbackOnRemove->OnRemoveSObject(me);
 }
 
 
@@ -1130,7 +750,7 @@ void SALOMEDS_StudyBuilder_i::SetGUID(SALOMEDS::SObject_ptr anObject, const char
   TDF_Label aLabel;
   ASSERT(!CORBA::is_nil(anObject));
   CORBA::String_var anEntry = anObject->GetID();
-  TDF_Tool::Label(_doc->GetData(), strdup(anEntry), aLabel);
+  TDF_Tool::Label(_doc->GetData(), anEntry, aLabel);
   TDataStd_UAttribute::Set(aLabel, (char*)theGUID);
 }
 
@@ -1144,7 +764,7 @@ bool SALOMEDS_StudyBuilder_i::IsGUID(SALOMEDS::SObject_ptr anObject, const char*
   TDF_Label aLabel;
   ASSERT(!CORBA::is_nil(anObject));
   CORBA::String_var anEntry = anObject->GetID();
-  TDF_Tool::Label(_doc->GetData(), strdup(anEntry), aLabel);
+  TDF_Tool::Label(_doc->GetData(), anEntry, aLabel);
   return aLabel.IsAttribute((char*)theGUID);
 }
 
@@ -1174,13 +794,14 @@ void SALOMEDS_StudyBuilder_i::NewCommand()
 //============================================================================
 void SALOMEDS_StudyBuilder_i::CommitCommand() throw (SALOMEDS::StudyBuilder::LockProtection)
 {
+  Unexpect aCatch(SBLockProtection);
   Handle(SALOMEDS_StudyPropertiesAttribute) anAttr;
   if (!_doc->Main().FindAttribute(SALOMEDS_StudyPropertiesAttribute::GetID(), anAttr)) {
     anAttr = new SALOMEDS_StudyPropertiesAttribute;
     _doc->Main().AddAttribute(anAttr);
   }
   if (anAttr->IsLocked() && !anAttr->IsLockChanged(true)) {
-    INFOS("Locked document modification !!!");
+    MESSAGE("Locked document modification !!!");
     AbortCommand();
     throw SALOMEDS::StudyBuilder::LockProtection();
   } else {
@@ -1222,13 +843,14 @@ void SALOMEDS_StudyBuilder_i::AbortCommand()
 //============================================================================
 void SALOMEDS_StudyBuilder_i::Undo() throw (SALOMEDS::StudyBuilder::LockProtection)
 {
+  Unexpect aCatch(SBLockProtection);
   Handle(SALOMEDS_StudyPropertiesAttribute) anAttr;
   if (!_doc->Main().FindAttribute(SALOMEDS_StudyPropertiesAttribute::GetID(), anAttr)) {
     anAttr = new SALOMEDS_StudyPropertiesAttribute;
     _doc->Main().AddAttribute(anAttr);
     }
   if (anAttr->IsLocked()) {
-    INFOS("Locked document modification !!!");
+    MESSAGE("Locked document modification !!!");
     throw SALOMEDS::StudyBuilder::LockProtection();
   } else {
     SALOMEDS_Study_i::GetStudy(_doc->Main(), _orb)->UndoPostponed(1);
@@ -1244,21 +866,22 @@ void SALOMEDS_StudyBuilder_i::Undo() throw (SALOMEDS::StudyBuilder::LockProtecti
 //============================================================================
 void SALOMEDS_StudyBuilder_i::Redo() throw (SALOMEDS::StudyBuilder::LockProtection)
 {
-   Handle(SALOMEDS_StudyPropertiesAttribute) anAttr;
-    if (!_doc->Main().FindAttribute(SALOMEDS_StudyPropertiesAttribute::GetID(), anAttr)) {
-      anAttr = new SALOMEDS_StudyPropertiesAttribute;
-      _doc->Main().AddAttribute(anAttr);
-    }
-
+  Unexpect aCatch(SBLockProtection);
+  Handle(SALOMEDS_StudyPropertiesAttribute) anAttr;
+  if (!_doc->Main().FindAttribute(SALOMEDS_StudyPropertiesAttribute::GetID(), anAttr)) {
+    anAttr = new SALOMEDS_StudyPropertiesAttribute;
+    _doc->Main().AddAttribute(anAttr);
+  }
+  
   if (anAttr->IsLocked()) {
-    INFOS("Locked document modification !!!");
+    MESSAGE("Locked document modification !!!");
     throw SALOMEDS::StudyBuilder::LockProtection();
   } else {
     _doc->Redo();
     SALOMEDS_Study_i::GetStudy(_doc->Main(), _orb)->UndoPostponed(-1);
     anAttr->SetModified(anAttr->GetModified()+1);
   }
-}
+ }
 
 //============================================================================
 /*! Function : GetAvailableUndos
@@ -1325,12 +948,72 @@ SALOMEDS::Callback_ptr SALOMEDS_StudyBuilder_i::SetOnRemoveSObject(SALOMEDS::Cal
   return aRet;
 }
 
+//============================================================================
+/*! Function : CheckLocked
+ *  Purpose  : 
+ */
+//============================================================================
 void SALOMEDS_StudyBuilder_i::CheckLocked() throw (SALOMEDS::StudyBuilder::LockProtection) {
+  Unexpect aCatch(SBLockProtection);
   if (_doc->HasOpenCommand()) return;
   Handle(SALOMEDS_StudyPropertiesAttribute) anAttr;
   if (!_doc->Main().FindAttribute(SALOMEDS_StudyPropertiesAttribute::GetID(), anAttr)) {
     anAttr = new SALOMEDS_StudyPropertiesAttribute;
     _doc->Main().AddAttribute(anAttr);
-  }
+    }
   if (anAttr->IsLocked()) throw SALOMEDS::StudyBuilder::LockProtection();
 }
+
+//============================================================================
+/*! Function : SetName
+ *  Purpose  : 
+ */
+//============================================================================
+void SALOMEDS_StudyBuilder_i::SetName(SALOMEDS::SObject_ptr theSO, const char* theValue)
+     throw(SALOMEDS::StudyBuilder::LockProtection)
+{
+  Unexpect aCatch(SBLockProtection);
+  CheckLocked();
+  //Find label
+  TDF_Label aLabel;
+  ASSERT(!CORBA::is_nil(theSO));
+  CORBA::String_var aSOID = theSO->GetID();
+  TDF_Tool::Label(_doc->GetData(), aSOID, aLabel);
+  TDataStd_Name::Set(aLabel, (char*)theValue);
+}
+
+//============================================================================
+/*! Function : SetComment
+ *  Purpose  : 
+ */
+//============================================================================
+void SALOMEDS_StudyBuilder_i::SetComment(SALOMEDS::SObject_ptr theSO, const char* theValue)
+ throw(SALOMEDS::StudyBuilder::LockProtection)
+{
+  Unexpect aCatch(SBLockProtection);
+  CheckLocked();
+   //Find label
+  TDF_Label aLabel;
+  ASSERT(!CORBA::is_nil(theSO));
+  CORBA::String_var aSOID = theSO->GetID();
+  TDF_Tool::Label(_doc->GetData(), aSOID, aLabel);
+  TDataStd_Comment::Set(aLabel, (char*)theValue);
+}
+
+//============================================================================
+/*! Function : SetIOR
+ *  Purpose  : 
+ */
+//============================================================================
+void SALOMEDS_StudyBuilder_i::SetIOR(SALOMEDS::SObject_ptr theSO, const char* theValue)
+ throw(SALOMEDS::StudyBuilder::LockProtection)
+{
+  Unexpect aCatch(SBLockProtection);
+  CheckLocked();
+  //Find label
+  TDF_Label aLabel;
+  ASSERT(!CORBA::is_nil(theSO));
+  CORBA::String_var aSOID = theSO->GetID();
+  TDF_Tool::Label(_doc->GetData(), aSOID, aLabel);
+  SALOMEDS_IORAttribute::Set(aLabel, TCollection_ExtendedString((char*)theValue), _orb);
+}
index f282e4e97ec140382c8978579c520b5f8edd98d6..9b668f4024a3ad0d41769e9321c0bee1fc1290bd 100644 (file)
@@ -142,5 +142,9 @@ public:
 
   virtual SALOMEDS::Callback_ptr SetOnAddSObject(SALOMEDS::Callback_ptr theCallback);
   virtual SALOMEDS::Callback_ptr SetOnRemoveSObject(SALOMEDS::Callback_ptr theCallback);
+
+  virtual void SetName(SALOMEDS::SObject_ptr theSO, const char* theValue) throw(SALOMEDS::StudyBuilder::LockProtection);
+  virtual void SetComment(SALOMEDS::SObject_ptr theSO, const char* theValue) throw(SALOMEDS::StudyBuilder::LockProtection);
+  virtual void SetIOR(SALOMEDS::SObject_ptr theSO, const char* theValue) throw(SALOMEDS::StudyBuilder::LockProtection);
 };
 #endif
index ba14acbf02c176f2c122267262f05f4187b42299..8c8daa9c76f2e468f212c3e70d8c891f54ffa912 100644 (file)
@@ -78,6 +78,11 @@ using namespace std;
 
 #include <SALOME_GenericObj_i.hh>
 
+#include "Utils_ExceptHandlers.hxx"
+
+UNEXPECT_CATCH(SalomeException,SALOME::SALOME_Exception);
+UNEXPECT_CATCH(LockProtection, SALOMEDS::StudyBuilder::LockProtection);
+
 #define USE_CASE_LABEL_ID             "0:2"
 #define AUTO_SAVE_GUID                "128268A3-71C9-4036-89B1-F81BD6A4FCF2"
 #define AUTO_SAVE_TAG                 "0:8"
@@ -85,286 +90,37 @@ using namespace std;
 //===========================================================================
 //Function : LoadAttributes
 //===========================================================================
-static void ReadAttributes(Handle(TDF_Data)& DF,
-                          TDF_Label& Lab, 
+static void ReadAttributes(SALOMEDS::Study_ptr theStudy,
+                          SALOMEDS::SObject_ptr aSO,
                           HDFdataset* hdf_dataset)
 {
   hdf_dataset->OpenOnDisk();
-  
-  if (hdf_dataset->GetType() == HDF_STRING) {
-
-    if (!strncmp(hdf_dataset->GetName(),"AttributeTreeNode",17)) {
-      MESSAGE("Create a Attribute :     AttributeTreeNode");
-      char current_strings[5][hdf_dataset->GetSize()/5];
-      hdf_dataset->ReadFromDisk(current_strings);
-
-      MESSAGE("Create an Attribute :     AttributeTreeNode"); 
-      Standard_GUID aGUID(current_strings[4]);
-      Handle(TDataStd_TreeNode) aNewNode = TDataStd_TreeNode::Set(Lab,aGUID);
-      TDF_Label aLabel;
-      Handle(TDataStd_TreeNode) aNode;
-      if (current_strings[0][0]) {
-        TDF_Tool::Label(DF,current_strings[0],aLabel,1);
-        if (!aLabel.FindAttribute(aGUID,aNode)) aNode = TDataStd_TreeNode::Set(aLabel,aGUID);
-        aNewNode->SetFather(aNode);
-      }
-      if (current_strings[1][0]) {
-        TDF_Tool::Label(DF,current_strings[1],aLabel,1);
-       if (!aLabel.FindAttribute(aGUID,aNode)) aNode = TDataStd_TreeNode::Set(aLabel,aGUID);
-        aNewNode->SetPrevious(aNode);
-      }
-      if (current_strings[2][0]) {
-        TDF_Tool::Label(DF,current_strings[2],aLabel,1);
-        if (!aLabel.FindAttribute(aGUID,aNode)) aNode = TDataStd_TreeNode::Set(aLabel,aGUID);
-        aNewNode->SetNext(aNode);
-      }
-      if (current_strings[3][0]) {
-        TDF_Tool::Label(DF,current_strings[3],aLabel,1);
-        if (!aLabel.FindAttribute(aGUID,aNode)) aNode = TDataStd_TreeNode::Set(aLabel,aGUID);
-        aNewNode->SetFirst(aNode);
-      }
-    } else {
 
-      int size =  hdf_dataset->GetSize();
-      char* current_string = new char[size];
-      hdf_dataset->ReadFromDisk(current_string);
+  SALOMEDS::GenericAttribute_var anAttr;
 
-      if (!strcmp(hdf_dataset->GetName(),"COMPONENTDATATYPE")) {      
-        MESSAGE("Create a OCAF Attribute :    COMPONENTDATATYPE");
-        TDataStd_Comment::Set         (Lab,current_string); 
-      }
-      else if (!strcmp(hdf_dataset->GetName(),"AttributeComment")) {
-        MESSAGE("Create an Attribute :     AttributeComment"); 
-        TDataStd_Comment::Set         (Lab,current_string); 
-      }
-      else if (!strcmp(hdf_dataset->GetName(),"AttributeName")) {
-        MESSAGE("Create an  Attribute :     AttributeName");       
-        TDataStd_Name::Set            (Lab,current_string);
-      }
-      else if (!strcmp(hdf_dataset->GetName(),"AttributePersistentRef")) { 
-        MESSAGE("Create an Attribute :     AttributePersistentRef"); 
-        SALOMEDS_PersRefAttribute::Set(Lab,current_string);
-      }
-      else if (!strcmp(hdf_dataset->GetName(),"Reference")) {
-        MESSAGE("Create a OCAF Attribute :     Reference"); 
-        TDF_Label RefLab;
-        TDF_Tool::Label(DF,current_string,RefLab,1);
-        TDF_Reference::Set(Lab,RefLab);
-       SALOMEDS_TargetAttribute::Set(RefLab)->Append(Lab);
-      }
-      else if (!strcmp(hdf_dataset->GetName(),"AttributeReal")) {
-        MESSAGE("Create a Attribute :     AttributeReal");
-        char * err = NULL;
-        CORBA::Double r =  strtod(current_string, &err);
-        SCRUTE(r);
-        if (err == current_string) {
-         MESSAGE("AtttributeReal : conversion impossible");
-        }
-        else TDataStd_Real::Set (Lab,r);
-      }
-      else if (!strcmp(hdf_dataset->GetName(),"AttributeInteger")) {
-        MESSAGE("Create a Attribute :     AttributeInteger");
-        CORBA::Long r =  atol(current_string);
-        SCRUTE(r);
-        TDataStd_Integer::Set (Lab,r);
-      }
-      else if (!strcmp(hdf_dataset->GetName(),"AttributePixMap")) {
-        MESSAGE("Create an  Attribute :     AttributePixMap");       
-        SALOMEDS_PixMapAttribute::Set (Lab,current_string);
-      }
-      else if (!strcmp(hdf_dataset->GetName(),"AttributeDrawable")) {
-        MESSAGE("Create a Attribute :     DrawableAttribute");
-        CORBA::Long r =  atol(current_string);
-        SCRUTE(r);
-        SALOMEDS_DrawableAttribute::Set (Lab,r);
-      }
-      else if (!strcmp(hdf_dataset->GetName(),"AttributeSelectable")) {
-        MESSAGE("Create a Attribute :     AttributeSelectable");
-        CORBA::Long r =  atol(current_string);
-        SCRUTE(r);
-        SALOMEDS_SelectableAttribute::Set (Lab,r);
-      }
-      else if (!strcmp(hdf_dataset->GetName(),"AttributeExpandable")) {
-        MESSAGE("Create a Attribute :     AttributeExpandable");
-        CORBA::Long r =  atol(current_string);
-        SCRUTE(r);
-        SALOMEDS_ExpandableAttribute::Set (Lab,r);
-      }
-      else if (!strcmp(hdf_dataset->GetName(),"AttributeOpened")) {
-        MESSAGE("Create a Attribute :     AttributeOpened");
-        CORBA::Long r =  atol(current_string);
-        SCRUTE(r);
-        SALOMEDS_OpenedAttribute::Set (Lab,r);
-      }
-      else if (!strcmp(hdf_dataset->GetName(),"AttributeLocalID")) {
-        MESSAGE("Create a Attribute :     AttributeLocalID");
-        CORBA::Long r =  atol(current_string);
-        SCRUTE(r);
-        SALOMEDS_LocalIDAttribute::Set (Lab,r);
-      }
-      else if (!strncmp(hdf_dataset->GetName(),"AttributeUserID",15)) {
-        MESSAGE("Create an  Attribute :     AttributeUserID");       
-        TDataStd_UAttribute::Set       (Lab,Standard_GUID(current_string));
-      }
-      else if (!strcmp(hdf_dataset->GetName(),"AttributeTableOfInteger")) {
-       MESSAGE("Create a Attribute :     AttributeTableOfInteger");
-       int size = hdf_dataset->GetSize();
-       Handle(SALOMEDS_TableOfIntegerAttribute) Attr = SALOMEDS_TableOfIntegerAttribute::Set(Lab);
-       unsigned char* aBuffer = new unsigned char[size];
-       if(aBuffer == NULL) throw HDFexception("Unable to open dataset AttributeTableOfInteger");
-       hdf_dataset->ReadFromDisk(aBuffer);
-       SALOMEDS::TMPFile_var aTMPFile = new SALOMEDS::TMPFile(size, size, aBuffer, 1);
-       istrstream aStream((char*)&aTMPFile[0], aTMPFile->length());
-       Attr->RestoreFromString(aStream);
-      }
-      else if (!strcmp(hdf_dataset->GetName(),"AttributeTableOfReal")) {
-       MESSAGE("Create a Attribute :     AttributeTableOfReal");
-       int size = hdf_dataset->GetSize();
-       Handle(SALOMEDS_TableOfRealAttribute) Attr = SALOMEDS_TableOfRealAttribute::Set(Lab);
-       unsigned char* aBuffer = new unsigned char[size];
-       if(aBuffer == NULL) throw HDFexception("Unable to open dataset AttributeTableOfReal");
-       hdf_dataset->ReadFromDisk(aBuffer);
-       SALOMEDS::TMPFile_var aTMPFile = new SALOMEDS::TMPFile(size, size, aBuffer, 1);
-       istrstream aStream((char*)&aTMPFile[0], aTMPFile->length());
-       Attr->RestoreFromString(aStream);
-      }
-      else if (!strcmp(hdf_dataset->GetName(),"AttributeTableOfString")) {
-       MESSAGE("Create a Attribute :     AttributeTableOfString");
-       int size = hdf_dataset->GetSize();
-       Handle(SALOMEDS_TableOfStringAttribute) Attr = SALOMEDS_TableOfStringAttribute::Set(Lab);
-       unsigned char* aBuffer = new unsigned char[size];
-       if(aBuffer == NULL) throw HDFexception("Unable to open dataset AttributeTableOfString");
-       hdf_dataset->ReadFromDisk(aBuffer);
-       SALOMEDS::TMPFile_var aTMPFile = new SALOMEDS::TMPFile(size, size, aBuffer, 1);
-       istrstream aStream((char*)&aTMPFile[0], aTMPFile->length());
-       Attr->RestoreFromString(aStream);
-      }
-      else if (!strcmp(hdf_dataset->GetName(),"AttributeStudyProperties")) {
-        MESSAGE("Create an  Attribute :     AttributeStudyProperties");     
-//     MESSAGE("current string :"<<current_string);
-        Handle(SALOMEDS_StudyPropertiesAttribute) aProp = SALOMEDS_StudyPropertiesAttribute::Set (Lab);
-       switch (current_string[0]) {
-       case 'f': aProp->SetCreationMode(1);break;
-       case 'c': aProp->SetCreationMode(2);break;
-       }
+  char* current_string = new char[hdf_dataset->GetSize()];
+  hdf_dataset->ReadFromDisk(current_string);
 
-       int anIndex;
-       for(anIndex = 2; anIndex + 2 < size ;) {
-         char str[10];
-         Standard_Integer aMinute, aHour, aDay, aMonth, aYear;
-         str[0] = current_string[anIndex++];
-         str[1] = current_string[anIndex++];
-         str[2] = 0;
-         aMinute = atoi(str);
-         str[0] = current_string[anIndex++];
-         str[1] = current_string[anIndex++];
-         aHour =  atoi(str);
-         str[0] = current_string[anIndex++];
-         str[1] = current_string[anIndex++];
-         aDay =  atoi(str);
-         str[0] = current_string[anIndex++];
-         str[1] = current_string[anIndex++];
-         aMonth =  atoi(str);
-         str[0] = current_string[anIndex++];
-         str[1] = current_string[anIndex++];
-         str[2] = current_string[anIndex++];
-         str[3] = current_string[anIndex++];
-         str[4] = 0;
-         aYear = atoi(str);
-         aProp->SetModificationDate(aMinute,aHour,aDay,aMonth,aYear);
-
-         int aNameSize;
-         for(aNameSize = 0; current_string[anIndex+aNameSize]!=1; aNameSize++);
-         char *aName = new char[aNameSize+1];
-         strncpy(aName, &(current_string[anIndex]), aNameSize);
-         aName[aNameSize] = 0;
-         aProp->SetUserName(TCollection_ExtendedString(aName));
-         delete(aName);
-         anIndex += aNameSize + 1;
-         if (current_string[1] == 'l') {
-           aProp->SetLocked(Standard_True);
-           aProp->IsLockChanged(true);
-         }
-         aProp->SetModified(0);
-       }
-      }
-      else if (!strcmp(hdf_dataset->GetName(),"AttributePythonObject")) {
-        MESSAGE("Create an  Attribute :     AttributePythonObject");       
-       Handle(SALOMEDS_PythonObjectAttribute) anObj = SALOMEDS_PythonObjectAttribute::Set(Lab);
-       Standard_Boolean aScript = (current_string[0] == 's')?Standard_True:Standard_False;
-       anObj->SetObject((char *)(current_string+1), aScript);
-      }
-      else {
-        MESSAGE(hdf_dataset->GetName());
-        MESSAGE("LoadAttributes: unknown types");
-      }
-    }
-  }
-  if (hdf_dataset->GetType() == HDF_FLOAT64) {
-    if (!strcmp(hdf_dataset->GetName(),"AttributeSequenceOfReal")) {
-      MESSAGE("Create a Attribute :     AttributeSequenceOfReal");
-      int size = hdf_dataset->GetSize();
-      hdf_float64* val = new hdf_float64[size];
-      hdf_dataset->ReadFromDisk(val);
-      Handle(TColStd_HSequenceOfReal) SeqReal = new TColStd_HSequenceOfReal;
-      for (Standard_Integer i = 0; i < size; i++) {
-        SeqReal->Append(val[i]);
-//          MESSAGE( val[i] << " restored"   );
-      }
-      SALOMEDS_SequenceOfRealAttribute::Set (Lab);
-      Handle(SALOMEDS_SequenceOfRealAttribute) Attr;
-      Handle(TDF_Attribute) Att;
-      Lab.FindAttribute(SALOMEDS_SequenceOfRealAttribute::GetID(),Att);
-      Attr = Handle(SALOMEDS_SequenceOfRealAttribute)::DownCast(Att);
-      Attr->Assign(SeqReal);
-    } else
-    if (!strcmp(hdf_dataset->GetName(),"AttributeTextColor")) {
-      MESSAGE("Create a Attribute :     AttributeTextColor");
-      hdf_float64 val[3];
-      hdf_dataset->ReadFromDisk(val);
-      Handle(SALOMEDS_TextColorAttribute) TC = new SALOMEDS_TextColorAttribute;
-      Lab.AddAttribute(TC); 
-      TC->SetValue(1, val[0]);
-      TC->SetValue(2, val[1]);
-      TC->SetValue(3, val[2]);
-    } else
-    if (!strcmp(hdf_dataset->GetName(),"AttributeTextHighlightColor")) {
-      MESSAGE("Create a Attribute :     AttributeTextHighlightColor");
-      hdf_float64 val[3];
-      hdf_dataset->ReadFromDisk(val);
-      Handle(SALOMEDS_TextHighlightColorAttribute) TC = new SALOMEDS_TextHighlightColorAttribute;
-      Lab.AddAttribute(TC); 
-      TC->SetValue(1, val[0]);
-      TC->SetValue(2, val[1]);
-      TC->SetValue(3, val[2]);
-    }else {
-      MESSAGE(hdf_dataset->GetName());
-      MESSAGE("LoadAttributes: unknown types");
-    }
+  if (!strcmp(hdf_dataset->GetName(),"COMPONENTDATATYPE")) {
+    anAttr = theStudy->NewBuilder()->FindOrCreateAttribute(aSO, "AttributeComment");
+  } else if (!strcmp(hdf_dataset->GetName(),"Reference")) {
+    theStudy->NewBuilder()->Addreference(aSO, theStudy->CreateObjectID(current_string));
+    delete(current_string);
+    hdf_dataset->CloseOnDisk();
+    return;
+  } else {
+    MESSAGE("Read attribute "<<hdf_dataset->GetName())
+    anAttr = theStudy->NewBuilder()->FindOrCreateAttribute(aSO, hdf_dataset->GetName());
   }
-  if (hdf_dataset->GetType() == HDF_INT32) {
-    if (!strcmp(hdf_dataset->GetName(),"AttributeSequenceOfInteger")) {
-      MESSAGE("Create a OCAF Attribute :     AttributeSequenceOfInteger");
-      int size = hdf_dataset->GetSize();
-      hdf_int32* val = new hdf_int32[size];
-      hdf_dataset->ReadFromDisk(val);
-      Handle(TColStd_HSequenceOfInteger) SeqInt = new TColStd_HSequenceOfInteger;
-      for (Standard_Integer i = 0; i < size; i++) {
-        SeqInt->Append(val[i]);
-//          MESSAGE( val[i] << " restored"   );
-      }
-      SALOMEDS_SequenceOfIntegerAttribute::Set (Lab);
-      Handle(SALOMEDS_SequenceOfIntegerAttribute) Attr;
-      Handle(TDF_Attribute) Att;
-      Lab.FindAttribute(SALOMEDS_SequenceOfIntegerAttribute::GetID(),Att);
-      Attr = Handle(SALOMEDS_SequenceOfIntegerAttribute)::DownCast(Att);
-      Attr->Assign(SeqInt);
-    } 
-    else {
-      MESSAGE(hdf_dataset->GetName());
-      MESSAGE("LoadAttributes: unknown types");
-    }
+
+  if (!CORBA::is_nil(anAttr)) {
+    anAttr->Restore(current_string);
+    MESSAGE("Restoring attribute "<<hdf_dataset->GetName()<<" by string '"<<current_string<<"' done")
+  } else {
+    MESSAGE(hdf_dataset->GetName());
+    MESSAGE("LoadAttributes: unknown types");
   }
+  delete(current_string);
   hdf_dataset->CloseOnDisk();
 }
 
@@ -414,18 +170,18 @@ static void Translate_IOR_to_persistentID (SALOMEDS::Study_ptr        study,
 //============================================================================
 //Function : BuildlTree
 //============================================================================
-static void BuildTree  (Handle(TDF_Data)& DF,HDFgroup* hdf_current_group)
+static void BuildTree (SALOMEDS::Study_ptr theStudy,HDFgroup* hdf_current_group)
 {
   hdf_current_group->OpenOnDisk();
   
-  TDF_Label Lab;
-  Standard_CString Entry = hdf_current_group->GetName();
+  SALOMEDS::SObject_var aSO;
+  char* Entry = hdf_current_group->GetName();
   if (strcmp(Entry,"STUDY_STRUCTURE") == 0) {
     MESSAGE("find the root of the document");
-    Lab =  DF->Root().FindChild(1,Standard_True);
+    aSO = theStudy->CreateObjectID("0:1");
   }
   else {
-    TDF_Tool::Label  (DF,Entry,Lab,1);
+    aSO = theStudy->CreateObjectID(Entry);
     MESSAGE("BuildTree : Create a new label"<<Entry);
   }
   char name[HDF_NAME_MAX_LEN+1];
@@ -439,14 +195,14 @@ static void BuildTree  (Handle(TDF_Data)& DF,HDFgroup* hdf_current_group)
     if  (type == HDF_DATASET) {
       MESSAGE("--> Dataset: Internal Object Name : " << name);
       HDFdataset* new_dataset = new HDFdataset(name,hdf_current_group);
-      ReadAttributes   (DF,Lab,new_dataset);      
+      ReadAttributes(theStudy,aSO,new_dataset);      
       new_dataset = 0; // will be deleted by father destructor
 
     }
     else if (type == HDF_GROUP)   {
       MESSAGE( "--> Group: Internal Object Name : " << name);
       HDFgroup* new_group = new HDFgroup(name,hdf_current_group);
-      BuildTree (DF,new_group);
+      BuildTree (theStudy, new_group);
       new_group = 0; // will be deleted by father destructor
     }
   }
@@ -544,6 +300,7 @@ SALOMEDS::Study_ptr SALOMEDS_StudyManager_i::NewStudy(const char* study_name)
 SALOMEDS::Study_ptr  SALOMEDS_StudyManager_i::Open(const char* aUrl)
      throw(SALOME::SALOME_Exception)
 {
+  Unexpect aCatch(SalomeException);
   MESSAGE("Begin of SALOMEDS_StudyManager_i::Open");
   // open the HDFFile 
   HDFfile *hdf_file =0;         
@@ -611,7 +368,7 @@ SALOMEDS::Study_ptr  SALOMEDS_StudyManager_i::Open(const char* aUrl)
   Handle(TDF_Data) DF = Doc->GetData();
 
   try {
-    BuildTree (DF,hdf_group_study_structure);
+    BuildTree (Study,hdf_group_study_structure);
   }
   catch (HDFexception)
     {
@@ -819,369 +576,33 @@ SALOMEDS_StudyManager_i::GetStudyByID(CORBA::Short aStudyID)
  */
 //============================================================================
 static void SaveAttributes(SALOMEDS::SObject_ptr SO, HDFgroup *hdf_group_sobject) {
-  HDFdataset *hdf_dataset = 0;
+  int a;
   hdf_size size[1];
-  hdf_int32 name_len = 0;
-  SALOMEDS::GenericAttribute_var SObj;
-  if(SO->FindAttribute(SObj, "AttributeComment"))
-    {
-      SALOMEDS::AttributeComment_var Comment = SALOMEDS::AttributeComment::_narrow(SObj);
-        CORBA::String_var Val = Comment->Value();
-        name_len = (hdf_int32) strlen(Val);
-        size[0] = name_len +1 ; 
-        hdf_dataset = new HDFdataset("AttributeComment",hdf_group_sobject,HDF_STRING,size,1);
-        hdf_dataset->CreateOnDisk();
-        hdf_dataset->WriteOnDisk(Val);
-        MESSAGE("attribute comment " <<  Val << " wrote on file");
-        hdf_dataset->CloseOnDisk();
-        hdf_dataset=0; //will be deleted by hdf_sco_group destructor
-      }
-  // Attribute  SALOMEDS::PersistentRef
-  if(SO->FindAttribute(SObj, "AttributePersistentRef"))
-    {
-      SALOMEDS::AttributePersistentRef_var PersRef = SALOMEDS::AttributePersistentRef::_narrow(SObj);
-        CORBA::String_var Val = PersRef->Value();
-        name_len = (hdf_int32) strlen(Val);
-        size[0] = name_len +1 ; 
-        hdf_dataset = new HDFdataset("AttributePersistentRef",hdf_group_sobject,HDF_STRING,size,1);
-        hdf_dataset->CreateOnDisk();
-        hdf_dataset->WriteOnDisk(Val);
-        MESSAGE("attribute persistentref " <<  Val << " wrote on file");
-        hdf_dataset->CloseOnDisk();
-        hdf_dataset=0; //will be deleted by hdf_sco_group destructor
-      }
-  // Attribute  SALOMEDS::Name
-  if(SO->FindAttribute(SObj, "AttributeName"))
-    {
-      SALOMEDS::AttributeName_var NameRef = SALOMEDS::AttributeName::_narrow(SObj);
-        CORBA::String_var Val = NameRef->Value();
-        name_len = (hdf_int32) strlen(Val);
-        size[0] = name_len +1 ; 
-        hdf_dataset = new HDFdataset("AttributeName",hdf_group_sobject,HDF_STRING,size,1);
-        hdf_dataset->CreateOnDisk();
-        hdf_dataset->WriteOnDisk(Val);
-        MESSAGE("attribute name " <<  Val << " wrote on file");
-        hdf_dataset->CloseOnDisk();
-        hdf_dataset=0; //will be deleted by hdf_sco_group destructor
-      }
-  if(SO->FindAttribute(SObj, "AttributeReal"))
-    {
-      char RealVal[25];
-      SALOMEDS::AttributeReal_var RealRef = SALOMEDS::AttributeReal::_narrow(SObj);
-      sprintf(RealVal, "%f", RealRef->Value());
-      name_len = (hdf_int32) strlen(RealVal);
-      size[0] = name_len +1 ; 
-      hdf_dataset = new HDFdataset("AttributeReal",hdf_group_sobject,HDF_STRING,size,1);
-      hdf_dataset->CreateOnDisk();
-      hdf_dataset->WriteOnDisk(RealVal);
-      MESSAGE("attribute Real " <<  RealVal << " wrote on file");
-      hdf_dataset->CloseOnDisk();
-      hdf_dataset=0; //will be deleted by hdf_sco_group destructor
-    }
-  if(SO->FindAttribute(SObj, "AttributeInteger"))
-    {
-      char IntVal[25];
-      SALOMEDS::AttributeInteger_var IntRef = SALOMEDS::AttributeInteger::_narrow(SObj);
-      sprintf(IntVal, "%d", IntRef->Value());
-      name_len = (hdf_int32) strlen(IntVal);
-      size[0] = name_len +1 ; 
-      hdf_dataset = new HDFdataset("AttributeInteger",hdf_group_sobject,HDF_STRING,size,1);
-      hdf_dataset->CreateOnDisk();
-      hdf_dataset->WriteOnDisk(IntVal);
-      MESSAGE("attribute Real " <<  IntVal << " wrote on file");
-      hdf_dataset->CloseOnDisk();
-      hdf_dataset=0; //will be deleted by hdf_sco_group destructor
-    }    
-  
-  if(SO->FindAttribute(SObj, "AttributeSequenceOfReal"))
-    {
-      SALOMEDS::AttributeSequenceOfReal_var RealSeq = SALOMEDS::AttributeSequenceOfReal::_narrow(SObj);
-        size[0] = RealSeq->Length();
-        SALOMEDS::DoubleSeq_var DS = RealSeq->CorbaSequence();
-        hdf_dataset = new HDFdataset("AttributeSequenceOfReal",hdf_group_sobject,HDF_FLOAT64,size,1);
-        hdf_dataset->CreateOnDisk();
-        hdf_float64 *data = new hdf_float64[RealSeq->Length()];
-        for (Standard_Integer i = 0; i < RealSeq->Length(); i++) {
-          MESSAGE("Value =  " << i << " = " << DS[i]  << " wrote on file");
-          data[i] = DS[i];
-        }
-        hdf_dataset->WriteOnDisk(data);
-        //               delete data;
-        hdf_dataset->CloseOnDisk();
-        hdf_dataset=0; //will be deleted by hdf_sco_group destructor
-      }
-  if(SO->FindAttribute(SObj, "AttributeSequenceOfInteger"))
-    {
-      SALOMEDS::AttributeSequenceOfInteger_var IntSeq = SALOMEDS::AttributeSequenceOfInteger::_narrow(SObj);
-        size[0] = IntSeq->Length();
-        SALOMEDS::LongSeq_var LS = IntSeq->CorbaSequence();
-        hdf_dataset = new HDFdataset("AttributeSequenceOfInteger",hdf_group_sobject,HDF_INT32,size,1);
-        hdf_dataset->CreateOnDisk();
-        hdf_int32 *data = new hdf_int32[IntSeq->Length()];
-        for (Standard_Integer i = 0; i < IntSeq->Length(); i++) {
-          MESSAGE("Value =  " << i << " = " << LS[i]  << " wrote on file");
-          data[i] = LS[i];
-        }
-        hdf_dataset->WriteOnDisk(data);
-        hdf_dataset->CloseOnDisk();
-        //               delete data;
-        hdf_dataset=0; //will be deleted by hdf_sco_group destructor
-      }
-    if(SO->FindAttribute(SObj, "AttributeDrawable"))
-    {
-      char IntVal[25];
-      SALOMEDS::AttributeDrawable_var DrRef = SALOMEDS::AttributeDrawable::_narrow(SObj);
-      sprintf(IntVal, "%d", DrRef->IsDrawable());
-      name_len = (hdf_int32) strlen(IntVal);
-      size[0] = name_len +1 ; 
-      hdf_dataset = new HDFdataset("AttributeDrawable",hdf_group_sobject,HDF_STRING,size,1);
-      hdf_dataset->CreateOnDisk();
-      hdf_dataset->WriteOnDisk(IntVal);
-      MESSAGE("attribute Drawable " <<  IntVal << " wrote on file");
-      hdf_dataset->CloseOnDisk();
-      hdf_dataset=0; //will be deleted by hdf_sco_group destructor
-    }    
-  if(SO->FindAttribute(SObj, "AttributeSelectable"))
-    {
-      char IntVal[25];
-      SALOMEDS::AttributeSelectable_var SelRef = SALOMEDS::AttributeSelectable::_narrow(SObj);
-      sprintf(IntVal, "%d", SelRef->IsSelectable());
-      name_len = (hdf_int32) strlen(IntVal);
-      size[0] = name_len +1 ; 
-      hdf_dataset = new HDFdataset("AttributeSelectable",hdf_group_sobject,HDF_STRING,size,1);
-      hdf_dataset->CreateOnDisk();
-      hdf_dataset->WriteOnDisk(IntVal);
-      MESSAGE("attribute Selectable " <<  IntVal << " wrote on file");
-      hdf_dataset->CloseOnDisk();
-      hdf_dataset=0; //will be deleted by hdf_sco_group destructor
-    }    
-  if(SO->FindAttribute(SObj, "AttributeExpandable"))
-    {
-      char IntVal[25];
-      SALOMEDS::AttributeExpandable_var ExRef = SALOMEDS::AttributeExpandable::_narrow(SObj);
-      sprintf(IntVal, "%d", ExRef->IsExpandable());
-      name_len = (hdf_int32) strlen(IntVal);
-      size[0] = name_len +1 ; 
-      hdf_dataset = new HDFdataset("AttributeExpandable",hdf_group_sobject,HDF_STRING,size,1);
-      hdf_dataset->CreateOnDisk();
-      hdf_dataset->WriteOnDisk(IntVal);
-      MESSAGE("attribute Expandable " <<  IntVal << " wrote on file");
-      hdf_dataset->CloseOnDisk();
-      hdf_dataset=0; //will be deleted by hdf_sco_group destructor
-    }    
-  if(SO->FindAttribute(SObj, "AttributeOpened"))
-    {
-      char IntVal[25];
-      SALOMEDS::AttributeOpened_var OpRef = SALOMEDS::AttributeOpened::_narrow(SObj);
-      sprintf(IntVal, "%d", OpRef->IsOpened());
-      name_len = (hdf_int32) strlen(IntVal);
-      size[0] = name_len +1 ; 
-      hdf_dataset = new HDFdataset("AttributeOpened",hdf_group_sobject,HDF_STRING,size,1);
-      hdf_dataset->CreateOnDisk();
-      hdf_dataset->WriteOnDisk(IntVal);
-      MESSAGE("attribute Opened " <<  IntVal << " wrote on file");
-      hdf_dataset->CloseOnDisk();
-      hdf_dataset=0; //will be deleted by hdf_sco_group destructor
-    }    
-  if(SO->FindAttribute(SObj, "AttributeTextColor"))
-    {
-      SALOMEDS::AttributeTextColor_var TextRef = SALOMEDS::AttributeTextColor::_narrow(SObj);
-      size[0] = 3;
-      hdf_float64 data[3];
-      SALOMEDS::Color C = TextRef->TextColor();
-      data[0] = C.R;
-      data[1] = C.G;
-      data[2] = C.B;
-      hdf_dataset = new HDFdataset("AttributeTextColor",hdf_group_sobject,HDF_FLOAT64,size,1);
-      hdf_dataset->CreateOnDisk();
-      hdf_dataset->WriteOnDisk(data);
-      MESSAGE("attribute  AttributeTextColor wrote on file");
-      hdf_dataset->CloseOnDisk();
-      hdf_dataset=0; //will be deleted by hdf_sco_group destructor
-    }    
-    if(SO->FindAttribute(SObj, "AttributeTextHighlightColor"))
-    {
-      SALOMEDS::AttributeTextHighlightColor_var TextRef = SALOMEDS::AttributeTextHighlightColor::_narrow(SObj);
-      size[0] = 3;
-      hdf_float64 data[3];
-      SALOMEDS::Color C = TextRef->TextHighlightColor();
-      data[0] = C.R;
-      data[1] = C.G;
-      data[2] = C.B;
-      hdf_dataset = new HDFdataset("AttributeTextHighlightColor",hdf_group_sobject,HDF_FLOAT64,size,1);
-      hdf_dataset->CreateOnDisk();
-      hdf_dataset->WriteOnDisk(data);
-      MESSAGE("attribute  AttributeTextHighlightColor wrote on file");
-      hdf_dataset->CloseOnDisk();
-      hdf_dataset=0; //will be deleted by hdf_sco_group destructor
-    }    
-  if(SO->FindAttribute(SObj, "AttributePixMap"))
-    {
-      SALOMEDS::AttributePixMap_var PMRef = SALOMEDS::AttributePixMap::_narrow(SObj);
-      if (PMRef->HasPixMap()) {
-       CORBA::String_var Val = PMRef->GetPixMap();
-       name_len = (hdf_int32) strlen(Val);
-       size[0] = name_len +1 ; 
-       hdf_dataset = new HDFdataset("AttributePixMap",hdf_group_sobject,HDF_STRING,size,1);
-       hdf_dataset->CreateOnDisk();
-       hdf_dataset->WriteOnDisk(Val);
-          MESSAGE("attribute PixMap " <<  Val << " wrote on file");
-       hdf_dataset->CloseOnDisk();
-       hdf_dataset=0; //will be deleted by hdf_sco_group destructor
-      }
-    }
-  if(SO->FindAttribute(SObj, "AttributeLocalID"))
-    {
-      char IntVal[25];
-      SALOMEDS::AttributeLocalID_var LIDRef = SALOMEDS::AttributeLocalID::_narrow(SObj);
-      sprintf(IntVal, "%d", LIDRef->Value());
-      name_len = (hdf_int32) strlen(IntVal);
-      size[0] = name_len +1 ; 
-      hdf_dataset = new HDFdataset("AttributeLocalID",hdf_group_sobject,HDF_STRING,size,1);
-      hdf_dataset->CreateOnDisk();
-      hdf_dataset->WriteOnDisk(IntVal);
-      hdf_dataset->CloseOnDisk();
-      hdf_dataset=0; //will be deleted by hdf_sco_group destructor
-      MESSAGE("attribute  AttributeLocalID wrote on file");
-    }    
-  if(SO->FindAttribute(SObj, "AttributeTableOfInteger"))
-    {
-      SALOMEDS::AttributeTableOfInteger_var IntTab = SALOMEDS::AttributeTableOfInteger::_narrow(SObj);
-      SALOMEDS::TMPFile_var aStream = IntTab->SaveToFile();
-      
-      hdf_size aHDFSize[1];
-      aHDFSize[0] = aStream->length();
-      
-      HDFdataset *hdf_dataset = new HDFdataset("AttributeTableOfInteger",hdf_group_sobject, HDF_STRING, aHDFSize, 1);
-      hdf_dataset->CreateOnDisk();
-      hdf_dataset->WriteOnDisk((unsigned char*) &aStream[0]);  //Save the stream in the HDF file
-      hdf_dataset->CloseOnDisk();
-      hdf_dataset=0; //will be deleted by hdf_sco_group destructor
-      
-      MESSAGE("attribute  AttributeTableOfInteger wrote on file");
-    }
-  if(SO->FindAttribute(SObj, "AttributeTableOfReal"))
-    {
-      SALOMEDS::AttributeTableOfReal_var RealTab = SALOMEDS::AttributeTableOfReal::_narrow(SObj);
-      SALOMEDS::TMPFile_var aStream = RealTab->SaveToFile();
-      
-      hdf_size aHDFSize[1];
-      aHDFSize[0] = aStream->length();
-      
-      HDFdataset *hdf_dataset = new HDFdataset("AttributeTableOfReal",hdf_group_sobject, HDF_STRING, aHDFSize, 1);
-      hdf_dataset->CreateOnDisk();
-      hdf_dataset->WriteOnDisk((unsigned char*) &aStream[0]);  //Save the stream in the HDF file
-      hdf_dataset->CloseOnDisk();
-      hdf_dataset=0; //will be deleted by hdf_sco_group destructor
-
-      MESSAGE("attribute  AttributeTableOfReal wrote on file")
-    }
-  if(SO->FindAttribute(SObj, "AttributeTableOfString"))
-    {
-      SALOMEDS::AttributeTableOfString_var StrTab = SALOMEDS::AttributeTableOfString::_narrow(SObj);
-      SALOMEDS::TMPFile_var aStream = StrTab->SaveToFile();
-      
-      hdf_size aHDFSize[1];
-      aHDFSize[0] = aStream->length();
-      
-      HDFdataset *hdf_dataset = new HDFdataset("AttributeTableOfString",hdf_group_sobject, HDF_STRING, aHDFSize, 1);
-      hdf_dataset->CreateOnDisk();
-      hdf_dataset->WriteOnDisk((unsigned char*) &aStream[0]);  //Save the stream in the HDF file
-      hdf_dataset->CloseOnDisk();
-      hdf_dataset=0; //will be deleted by hdf_sco_group destructor
-
-      MESSAGE("attribute  AttributeTableOfString wrote on file")
-    }
-  if(SO->FindAttribute(SObj, "AttributePythonObject"))
-    {
-      SALOMEDS::AttributePythonObject_var anObj = SALOMEDS::AttributePythonObject::_narrow(SObj);
-      char* aSeq = CORBA::string_dup(anObj->GetObject());
-      int aLen = strlen(aSeq);
-      char* aString = new char[aLen+2];
-      aString[0] = anObj->IsScript()?'s':'n';
-      for(int i = 0; i < aLen; i++) aString[i+1] = aSeq[i];
-      aString[aLen+1] = 0;
-      size[0] = aLen+2 ; 
-      hdf_dataset = new HDFdataset("AttributePythonObject",hdf_group_sobject,HDF_STRING,size,1);
-      hdf_dataset->CreateOnDisk();
-      hdf_dataset->WriteOnDisk(aString);
-      hdf_dataset->CloseOnDisk();
-      hdf_dataset=0; //will be deleted by hdf_sco_group destructor
-      MESSAGE("attribute  AttributePythonObject wrote on file");
-    }    
-
-// Reference
-  SALOMEDS::SObject_var RefSO;
-  if(SO->ReferencedObject(RefSO))
-    {
-      CORBA::String_var attribute_reference = strdup(RefSO->GetID());
-      name_len = (hdf_int32) strlen(attribute_reference);
-      size[0] = name_len +1 ; 
-      hdf_dataset = new HDFdataset("Reference",hdf_group_sobject,HDF_STRING,size,1);
-      hdf_dataset->CreateOnDisk();
-      hdf_dataset->WriteOnDisk(attribute_reference);
-      MESSAGE("attribute reference " <<  attribute_reference << " wrote on file");
-      hdf_dataset->CloseOnDisk();
-      hdf_dataset =0; // will be deleted by father hdf object destructor
-    }
-
-// TreeNodeAttributes with not constant GUID
   SALOMEDS::ListOfAttributes_var anAttrList = SO->GetAllAttributes();
-  int anIndex, aLength = anAttrList->length();
-  for(anIndex = 0; anIndex<aLength; anIndex++) {
-    SALOMEDS::AttributeUserID_var UAttr = SALOMEDS::AttributeUserID::_narrow(anAttrList[anIndex]);
-    if (!UAttr->_is_nil()) {
-      char* Val = UAttr->Value();
-      name_len = (hdf_int32) strlen(Val);
-      size[0] = name_len + 1;
-      char* aDataSetName = new char[60];
-      sprintf(aDataSetName, "AttributeUserID_%s",Val);
-      hdf_dataset = new HDFdataset(aDataSetName,hdf_group_sobject,HDF_STRING,size,1);
-      hdf_dataset->CreateOnDisk();
-      hdf_dataset->WriteOnDisk(Val);
-      MESSAGE("attribute UesrID " <<  Val << " wrote on file");
-      hdf_dataset->CloseOnDisk();
-      hdf_dataset=0; //will be deleted by hdf_sco_group destructor
-      delete(aDataSetName);
-      continue;
-    }
+  for(a = anAttrList->length() - 1; a >= 0; a--) {
+    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());
+    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;
+    hdf_dataset=0; //will be deleted by hdf_sco_group destructor
+  }
 
-    SALOMEDS::AttributeTreeNode_var TNRef = SALOMEDS::AttributeTreeNode::_narrow(anAttrList[anIndex]);
-    if (!TNRef->_is_nil()) {
-      hdf_size TNsize[2];
-      int maxSize,index;
-      CORBA::String_var Val[5];
-      
-      if (TNRef->HasFather()) Val[0] = TNRef->GetFather()->Label(); else Val[0] = "\0";
-      maxSize = strlen(Val[0]);
-      if (TNRef->HasPrevious()) Val[1] = TNRef->GetPrevious()->Label(); else Val[1] = "\0";
-      maxSize = Max(maxSize,strlen(Val[1]));
-      if (TNRef->HasNext()) Val[2] = TNRef->GetNext()->Label(); else Val[2] = "\0";
-      maxSize = Max(maxSize,strlen(Val[2]));
-      if (TNRef->HasFirst()) Val[3] = TNRef->GetFirst()->Label(); else Val[3] = "\0";
-      maxSize = Max(maxSize,strlen(Val[3]));
-      Val[4] = TNRef->GetTreeID();
-      maxSize = Max(maxSize,strlen(Val[4]));
-      
-      TNsize[0]=5;
-      TNsize[1]=maxSize+1;
-      char Data[5][maxSize+1];
-      for(index=0;index<5;index++) {
-       strcpy(Data[index],Val[index]);
-       for(int a = strlen(Data[index]) + 1; a < maxSize; a++) Data[index][a] = ' '; // mpv: for ASCII format
-      }
-      
-      char* aDataSetName = new char[60];
-      sprintf(aDataSetName, "AttributeTreeNodeGUID%s",TNRef->GetTreeID());
-      hdf_dataset = new HDFdataset(aDataSetName,hdf_group_sobject,HDF_STRING,TNsize,2);
-      hdf_dataset->CreateOnDisk();
-      hdf_dataset->WriteOnDisk(Data);
-      hdf_dataset->CloseOnDisk();
-      hdf_dataset=0; //will be deleted by hdf_sco_group destructor
-      MESSAGE("attribute AttributeTreeNode with various GUID wrote on file:");
-      MESSAGE(aDataSetName);
-      delete(aDataSetName);
-    }
+  // 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());
+    size[0] = strlen(attribute_reference) + 1 ; 
+    HDFdataset *hdf_dataset = new HDFdataset("Reference",hdf_group_sobject,HDF_STRING,size,1);
+    hdf_dataset->CreateOnDisk();
+    hdf_dataset->WriteOnDisk(attribute_reference);
+    hdf_dataset->CloseOnDisk();
+    hdf_dataset =0; // will be deleted by father hdf object destructor
   }
 }
 
@@ -1570,7 +991,7 @@ void SALOMEDS_StudyManager_i::_SaveObject(SALOMEDS::Study_ptr aStudy,
       SALOMEDS::SObject_var SO = itchild->Value();
 
       // mpv: don't save empty labels
-      if (SO->GetAllAttributes()->length() == 0) {
+      if (SO->GetAllAttributes()->length() == 0 && !SO->ReferencedObject(RefSO)) {
        SALOMEDS::ChildIterator_var subchild = aStudy->NewChildIterator(SC);
        if (!subchild->More()) {
          continue;
@@ -1578,7 +999,8 @@ void SALOMEDS_StudyManager_i::_SaveObject(SALOMEDS::Study_ptr aStudy,
        subchild->InitEx(true);
        bool anEmpty = true;
        for (; subchild->More() && anEmpty; subchild->Next()) 
-         if (subchild->Value()->GetAllAttributes()->length() != 0) anEmpty = false;
+         if (subchild->Value()->GetAllAttributes()->length() != 0 ||
+              subchild->Value()->ReferencedObject(RefSO)) anEmpty = false;
        if (anEmpty) {
          continue;
        }
@@ -1916,6 +1338,7 @@ TDF_Label SALOMEDS_StudyManager_i::PasteLabel(const SALOMEDS::Study_ptr theDesti
 SALOMEDS::SObject_ptr SALOMEDS_StudyManager_i::Paste(SALOMEDS::SObject_ptr theObject)
      throw(SALOMEDS::StudyBuilder::LockProtection)
 {
+  Unexpect aCatch(LockProtection);
   SALOMEDS::Study_var aStudy = theObject->GetStudy();
 
   // if study is locked, then paste can't be done
index ed98968e84807c471e040e5c042d386e987495fd..be15994347673fc38892da5a5296114cb5d3b016 100644 (file)
@@ -226,7 +226,25 @@ SALOMEDS::SObject_ptr SALOMEDS_Study_i::FindObjectID(const char* anObjectID)
 {
   // Convert aSO->GetID in TDF_Label.
   TDF_Label Lab;
-  TDF_Tool::Label(_doc->GetData(), strdup(anObjectID), Lab);
+  TDF_Tool::Label(_doc->GetData(), (char*)anObjectID, Lab);
+  
+  if (Lab.IsNull()) return SALOMEDS::SObject::_nil();
+  SALOMEDS_SObject_i *  so_servant = new SALOMEDS_SObject_i (Lab,_orb);
+  SALOMEDS::SObject_var so = SALOMEDS::SObject::_narrow(so_servant->_this()); 
+  return so;
+
+}
+
+//============================================================================
+/*! Function : CreateObjectID
+ *  Purpose  : Creates an Object with ID = anObjectID
+ */
+//============================================================================
+SALOMEDS::SObject_ptr SALOMEDS_Study_i::CreateObjectID(const char* anObjectID)
+{
+  // Convert aSO->GetID in TDF_Label.
+  TDF_Label Lab;
+  TDF_Tool::Label(_doc->GetData(), (char*)anObjectID, Lab, Standard_True);
   
   if (Lab.IsNull()) return SALOMEDS::SObject::_nil();
   SALOMEDS_SObject_i *  so_servant = new SALOMEDS_SObject_i (Lab,_orb);
@@ -336,7 +354,7 @@ SALOMEDS::SObject_ptr SALOMEDS_Study_i::FindObjectIOR(const char* anObjectIOR)
          RefSO =  _FindObjectIOR(SC,anObjectIOR, _find);
       }
   }
-  if (!RefSO->_is_nil()) INFOS("SALOMEDS_Study_i::FindObjectIOR: found label with old methods");
+  if (!RefSO->_is_nil()) MESSAGE("SALOMEDS_Study_i::FindObjectIOR: found label with old methods");
 
   return RefSO;
 }
@@ -649,7 +667,7 @@ SALOMEDS::ChildIterator_ptr SALOMEDS_Study_i::NewChildIterator(SALOMEDS::SObject
 {
   //Convert aSO->GetID in TDF_Label.
   TDF_Label Lab;
-  TDF_Tool::Label(_doc->GetData(), strdup(aSO->GetID()), Lab);
+  TDF_Tool::Label(_doc->GetData(), aSO->GetID(), Lab);
 
   //Create iterator
   SALOMEDS_ChildIterator_i* it_servant = new SALOMEDS_ChildIterator_i(Lab,_orb);
@@ -887,7 +905,7 @@ SALOMEDS::Study_ptr SALOMEDS_Study_i::GetStudy(const TDF_Label theLabel, CORBA::
     ASSERT(!CORBA::is_nil(aStudy));
     return SALOMEDS::Study::_duplicate(aStudy);
   } else {
-    INFOS("GetStudy: Problem to get study");
+    MESSAGE("GetStudy: Problem to get study");
   }
   return SALOMEDS::Study::_nil();
 }
@@ -1013,7 +1031,7 @@ void SALOMEDS_Study_i::AddPostponed(const char* theIOR) {
     if (!CORBA::is_nil(obj)) {
       SALOME::GenericObj_var aGeneric = SALOME::GenericObj::_narrow(obj) ;
       if (!CORBA::is_nil(aGeneric)) {
-       TCollection_AsciiString anIOR(strdup(theIOR));
+       TCollection_AsciiString anIOR((char*)theIOR);
        anIOR.Prepend("d");
        myPostponedIORs.Append(anIOR); // add prefix: deleted
        myNbPostponed.SetValue(myNbPostponed.Length(), myNbPostponed.Last() + 1);
@@ -1029,7 +1047,7 @@ void SALOMEDS_Study_i::AddCreatedPostponed(const char* theIOR) {
     if (!CORBA::is_nil(obj)) {
       SALOME::GenericObj_var aGeneric = SALOME::GenericObj::_narrow(obj) ;
       if (!CORBA::is_nil(aGeneric)) {
-       TCollection_AsciiString anIOR(strdup(theIOR));
+       TCollection_AsciiString anIOR((char*)theIOR);
        anIOR.Prepend("c");
        myPostponedIORs.Append(anIOR); // add prefix: created
        myNbPostponed.SetValue(myNbPostponed.Length(), myNbPostponed.Last() + 1);
@@ -1059,7 +1077,7 @@ void SALOMEDS_Study_i::RemovePostponed(const CORBA::Long theUndoLimit) {
     for(anIndex = anOld + 1; anIndex <= aNew; anIndex++) {
       TCollection_AsciiString anIOR = myPostponedIORs(anIndex);
       if (anIOR.Value(1) == 'c') {
-       CORBA::Object_var obj = _orb->string_to_object(strdup(anIOR.Split(1).ToCString()));
+       CORBA::Object_var obj = _orb->string_to_object(anIOR.Split(1).ToCString());
        SALOME::GenericObj_var aGeneric = SALOME::GenericObj::_narrow(obj);
        if (!CORBA::is_nil(aGeneric)) aGeneric->Destroy();
       }
@@ -1077,7 +1095,7 @@ void SALOMEDS_Study_i::RemovePostponed(const CORBA::Long theUndoLimit) {
     for(anIndex = 1; anIndex <= anOld; anIndex++) {
       TCollection_AsciiString anIOR = myPostponedIORs(anIndex);
       if (anIOR.Value(1) == 'd') {
-       CORBA::Object_var obj = _orb->string_to_object(strdup(anIOR.Split(1).ToCString()));
+       CORBA::Object_var obj = _orb->string_to_object(anIOR.Split(1).ToCString());
        SALOME::GenericObj_var aGeneric = SALOME::GenericObj::_narrow(obj);
        if (!CORBA::is_nil(aGeneric)) aGeneric->Destroy();
       }
@@ -1090,7 +1108,7 @@ void SALOMEDS_Study_i::RemovePostponed(const CORBA::Long theUndoLimit) {
     TDF_ChildIDIterator anIter(_doc->GetData()->Root(), SALOMEDS_IORAttribute::GetID(), Standard_True);
     for(; anIter.More(); anIter.Next()) {
       Handle(SALOMEDS_IORAttribute) anAttr = Handle(SALOMEDS_IORAttribute)::DownCast(anIter.Value());
-      CORBA::String_var anIOR = strdup(TCollection_AsciiString(anAttr->Get()).ToCString());
+      CORBA::String_var anIOR = CORBA::string_dup(TCollection_AsciiString(anAttr->Get()).ToCString());
       try {
        CORBA::Object_var obj = _orb->string_to_object(anIOR);
        SALOME::GenericObj_var aGeneric = SALOME::GenericObj::_narrow(obj);
index be93b95f99a698c325fb9ba3895415447b071466..ad314b4972af87cf784c6f35a49bfaed7f4beb96 100644 (file)
@@ -149,6 +149,13 @@ public:
   */  
   virtual SALOMEDS::SObject_ptr FindObjectID(const char* anObjectID);
 
+  //! method to Create an Object with ID = anObjectID 
+  /*!
+    \param anObjectID char* arguments
+    \return SObject_ptr arguments, the object found
+  */  
+  virtual SALOMEDS::SObject_ptr CreateObjectID(const char* anObjectID);
+
   //! method to Find an Object with ID = anObjectIOR 
   /*!
     \param anObjectIOR char* arguments
@@ -261,7 +268,6 @@ public:
   */
   virtual void  URL(const char* url);
 
-
   virtual CORBA::Short StudyId();
   virtual void  StudyId(CORBA::Short id);
 
index a043b9610a2483fa6068879ae07db2a7984dd9ff..004fd69730542957f50a03b369bd426c61d10777 100644 (file)
@@ -24,7 +24,7 @@
 //  File   : SALOMEDS_TargetAttribute.cxx
 //  Author : Yves FRICAUD
 //  Module : SALOME
-//  $Header:  
+//  $Header$
 
 using namespace std;
 #include "SALOMEDS_TargetAttribute.ixx"
index ef6af76261d6bb29645c00bbfecb0d3648b270c6..8b63cb886490390124c5955cc96762d070f446dd 100644 (file)
@@ -24,7 +24,7 @@
 //  File   : SALOMEDS_TargetAttribute.hxx
 //  Author : Yves FRICAUD
 //  Module : SALOME
-//  $Header
+//  $Header$
 
 #ifndef _SALOMEDS_TargetAttribute_HeaderFile
 #define _SALOMEDS_TargetAttribute_HeaderFile
index a777e0f53ee7eec660c057430555b0143c5c173c..7fac6a9e10d9d2f06915ff20210dd40ff65d3334 100644 (file)
@@ -24,7 +24,7 @@
 //  File   : SALOMEDS_TargetAttribute.ixx
 //  Author : Yves FRICAUD
 //  Module : SALOME
-//  $Header
+//  $Header$
 
 #include "SALOMEDS_TargetAttribute.jxx"
 
index 56d2fb15457dab616241161d383ceb4d38128e87..eff35ad6a3dce18d3ee4331c3e2d4ce0e7b3f8be 100644 (file)
@@ -24,7 +24,7 @@
 //  File   : SALOMEDS_TargetAttribute.jxx
 //  Author : Yves FRICAUD
 //  Module : SALOME
-//  $Header
+//  $Header$
 
 #ifndef _Standard_GUID_HeaderFile
 #include <Standard_GUID.hxx>
index c264f94b3a577a09349709fef0014543184b79aa..89b033e6e71c1bc51ee0f0740ef071f145262177 100644 (file)
@@ -24,7 +24,7 @@
 //  File   : SALOMEDS_TextColorAttribute.cxx
 //  Author : Yves FRICAUD
 //  Module : SALOME
-//  $Header
+//  $Header$
 
 using namespace std;
 #include "SALOMEDS_TextColorAttribute.ixx"
index 4194d1353272ec2e1c808a7449e311b24c0f5b2d..ccc3c70a8fe6380db4175a22909738327a268e14 100644 (file)
@@ -24,7 +24,7 @@
 //  File   : SALOMEDS_TextHighlightColorAttribute.cxx
 //  Author : Yves FRICAUD
 //  Module : SALOME
-//  $Header
+//  $Header$
 
 using namespace std;
 #include "SALOMEDS_TextHighlightColorAttribute.ixx"
index e20546601cf47dc23bbe639b126244d89fe31990..b70fcfcfc10af4eca3d2125b587ba3b901e0e20f 100644 (file)
@@ -20,17 +20,17 @@ msgstr ""
 #---------------
 
 msgid "INF_VERSION"
-msgstr "Version 1.3.0"
+msgstr "Version 1.4.1"
 
 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 1.3.0"
+msgstr "PAL/SALOME 1.4.1"
 
 #: QAD_Desktop.cxx:424
 msgid "QAD_Desktop::DESK_DEFAULTTITLE"
-msgstr "SALOME 1.3.0"
+msgstr "PAL/SALOME 1.4.1"
index 48781e85f815407638cb4cdefcbf7cc4bfab31ea..1e4ac5fea7d0fb9d48e5d6c4983bd221e98ad342 100644 (file)
 #ifndef _PYINTERP_BASE_H_
 #define _PYINTERP_BASE_H_
 
-using namespace std;
 #include <iostream>
 #include <Python.h>
 #include <list>
 #include <string>
 
+using namespace std;
+
 #define TOP_HISTORY_PY "--- top of history ---"
 #define BEGIN_HISTORY_PY "--- begin of history ---"
 
index 0a82f62b679d805583d1654b2349cc73f0b9258a..5dcea8c4523cbe5383ae2229e11ddb7782c10930 100644 (file)
@@ -37,19 +37,19 @@ class ActionMap {
      ActionMap() {}
      ~ActionMap() 
      { 
-       QMapIterator<unsigned int, QActionP*> it;
+       QMapIterator<int, QActionP*> it;
        for ( it = myMap.begin(); it != myMap.end(); it++ ) delete (QActionP*)it.data();
        myMap.clear();
      }
-     bool isEmpty()                                           { return myMap.isEmpty(); }
-     void insert( const unsigned int id, QActionP* action )   { myMap[id] = action;     }
-     QActionP* at( const unsigned int id )                    { return myMap[id];       }
+     bool isEmpty()                                  { return myMap.isEmpty(); }
+     void insert( const int id, QActionP* action )   { myMap[id] = action;     }
+     QActionP* at( const int id )                    { return myMap[id];       }
      void clear()                                             { myMap.clear();          }
-     QActionP*& operator[] (const unsigned int id)            { return myMap[id];       }
-     bool hasAction( const unsigned int id )                  { return myMap.contains(id); }
+     QActionP*& operator[] (const int id)            { return myMap[id];       }
+     bool hasAction( const int id )                  { return myMap.contains(id); }
 
  private:
-     QMap<unsigned int, QActionP*> myMap;
+     QMap<int, QActionP*> myMap;
 
 };
 
index 439362886164eb87beb35a7239e62b78b4c572a6..99e1eca15db0b47a63525f9d05da0d8dd4ca752e 100644 (file)
@@ -1243,11 +1243,13 @@ void QAD_Application::onStudyActivated(QAD_Study* study)
   
   myActiveStudy = study;
 
-  /* notification */
-  onActiveStudyChanged( oldActiveStudy, myActiveStudy );
-  
+  // VSR : call app activate before informing modules that active study is changed ===>
   /* application activated */
   emit appActivated( this );
+
+  /* notification */
+  onActiveStudyChanged( oldActiveStudy, myActiveStudy );
+  // VSR : call app activate before informing modules that active study is changed <===
 }
 
 /*!
@@ -1257,8 +1259,8 @@ void QAD_Application::onStudyDeactivated(QAD_Study* study)
 {
   //  MESSAGE ("QAD_Application::onStudyDeactivated init. "); 
   QAD_ASSERT_DEBUG_ONLY ( myActiveStudy == study );
-  myActiveStudy->onStudyDeactivated();
-  myActiveStudy = 0;
+  if ( study )
+    study->onStudyDeactivated();
   //  MESSAGE ("QAD_Application::onStudyDeactivated done. "); 
 }
 
index 24baa207bf1eeb21518c20f7add1d2c0bd5a9724..e5b202a97d907a0589f7ed1e1e36ceed885e54e3 100644 (file)
@@ -55,9 +55,9 @@ public:
   /** Gets directory of the local configuration file. */
   QDir           getConfigDir() const { return configDir; }
 
-  /** Sets directory of SALOME_ROOT. */
+  /** Sets directory of KERNEL_ROOT. */
   void           setPrgDir(QDir _prgDir) { prgDir=_prgDir; }
-  /** Gets directory of SALOME_ROOT. */
+  /** Gets directory of KERNEL_ROOT. */
   QDir           getPrgDir() const { return prgDir; }
 
   bool           createConfigFile( bool overwrite=false );
index 2c911191725392f94702531c3de640564910a1d3..c113b87cc5c7c4a522a6d535c24ae93c73d505f4 100644 (file)
@@ -61,7 +61,7 @@ using namespace std;
 #include "SALOMEGUI_TrihedronSizeDlg.h"
 #include "SALOMEGUI_ExternalBrowserDlg.h"
 #include "SALOMEGUI_LoadStudiesDlg.h"
-#include "SALOME_Selection.h"
+//#include "SALOME_Selection.h"
 #include "SALOME_InteractiveObject.hxx"
 #include "SALOME_ListIteratorOfListIO.hxx"
 #include "SALOMEGUI_AboutDlg.h"
@@ -94,6 +94,8 @@ using namespace std;
 #include <qdatetime.h>
 #include <qthread.h>
 
+#include <qstringlist.h>
+
 #if QT_VERSION > 300
   #include <qlistbox.h>
   #include <qregexp.h>
@@ -313,10 +315,8 @@ myQueryClose( true )
          tr("INF_RESOURCES");
        //QMessageBox::warning( this, tr("WRN_WARNING"), errMsg, tr ("BUT_OK") );
       }
-
-    if ( !QString(list_composants[ind].modulename).isEmpty() )
-      myCombo->insertItem( strdup(list_composants[ind].moduleusername) );
-
+    if ( ( resDir || moduleusername == "Salome" ) && !modulename.isEmpty() ) // VSR: Force "Salome" component to appear in the combo box
+      myCombo->insertItem( moduleusername );
   }
 
   myCombo->adjustSize();
@@ -352,6 +352,7 @@ QAD_Desktop::~QAD_Desktop ()
   //NRI : SAL2214
   myNewViewPopup.clear();
   //NRI : SAL2214
+  myHelpContentsModulePopup.clear();
   myToolsPopup.clear();
   myPrefPopup.clear();
   myStdActions.clear();
@@ -583,9 +584,16 @@ void QAD_Desktop::createActions()
     exitAction->addTo( &myFilePopup );
     myStdActions.insert ( FileExitId, exitAction );
  
+    QAD_ASSERT( connect( &myFilePopup, SIGNAL(highlighted( int )), 
+                        this, SLOT(onFilePopupStatusText( int )) ));
+    
+
     /* 'Edit' actions : provided by application only */
     myEditPos = 0;
 
+    QAD_ASSERT( connect( &myEditPopup, SIGNAL(highlighted( int )), 
+                        this, SLOT(onEditPopupStatusText( int )) ));
+
     /* 'View' actions */
     /* toolbars popup menu */
     myViewPopup.insertItem( tr("MEN_DESK_VIEW_TOOLBARS"), &myToolBarsPopup );
@@ -627,6 +635,9 @@ void QAD_Desktop::createActions()
 
     myViewPos = myViewPopup.count();
 
+    QAD_ASSERT( connect( &myViewPopup, SIGNAL(highlighted( int )), 
+                        this, SLOT(onViewPopupStatusText( int )) ));
+
     /* Parse xml file */
     QAD_ResourceMgr* resMgr = QAD_Desktop::createResourceManager();
     if ( resMgr ) {
@@ -934,17 +945,46 @@ void QAD_Desktop::createActions()
     /* 'Help' actions
      */
     /* contents */
-    QActionP* helpContentsAction = new QActionP( "", tr("MEN_DESK_HELP_CONTENTS"), Key_F1, this );
-    helpContentsAction->setStatusTip ( tr("PRP_DESK_HELP_CONTENTS") );
-    QAD_ASSERT(connect( helpContentsAction, SIGNAL(activated()),
-                       this, SLOT( onHelpContents() )));
-    helpContentsAction->addTo( &myHelpPopup );
-    myStdActions.insert( HelpContentsId , helpContentsAction );
+    // MZN : Commented
+    // QActionP* helpContentsAction = new QActionP( "", tr("MEN_DESK_HELP_CONTENTS"), Key_F1, this );
+    // helpContentsAction->setStatusTip ( tr("PRP_DESK_HELP_CONTENTS") );
+//     QAD_ASSERT(connect( helpContentsAction, SIGNAL(activated()),
+//                     this, SLOT( onHelpContents() )));
+//     helpContentsAction->addTo( &myHelpPopup );
+//     myStdActions.insert( HelpContentsId , helpContentsAction );
                                
-    id = myHelpPopup.insertSeparator();
+//     id = myHelpPopup.insertSeparator();
                                                   
     /* GUI contents */
-    // NRI : Temporary commented
+    myHelpPopup.insertItem( tr("MEN_DESK_HELP_MODULECONTENTS"), &myHelpContentsModulePopup, HelpContentsModuleId);
+    bool toEnable = false;
+    
+    CORBA::Object_var objVarN = myNameService->Resolve("/Kernel/ModulCatalog");
+    myCatalogue  = SALOME_ModuleCatalog::ModuleCatalog::_narrow(objVarN);
+    
+    SALOME_ModuleCatalog::ListOfIAPP_Affich_var list_composants =
+      myCatalogue->GetComponentIconeList();
+      
+    for (unsigned int ind = 0; ind < list_composants->length(); ind++) {
+      QString aModuleName = strdup(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) ;
+         if ( aModuleUserName == "Salome" )  aModuleUserName = "Kernel" ;
+         QActionP* moduleHelpAction = new QActionP( "", aModuleUserName + " Help" , 0, this, aModuleName);
+         QAD_ASSERT(connect( moduleHelpAction, SIGNAL(activated()), this, SLOT(onHelpContentsModule() )));
+         moduleHelpAction->addTo( &myHelpContentsModulePopup );
+         if (!toEnable) toEnable = true;
+       }
+      }
+    }
+    
+    myHelpContentsModulePopup.setEnabled(toEnable);
+              
+   // NRI : Temporary commented
 
 //     QActionP* helpContentsActionGUI = new QActionP( "", tr("MEN_DESK_HELP_GUICONTENTS"), 0, this );
 //     helpContentsActionGUI->setStatusTip ( tr("PRP_DESK_HELP_GUICONTENTS") );
@@ -953,13 +993,22 @@ void QAD_Desktop::createActions()
 //     helpContentsActionGUI->addTo( &myHelpPopup );
 //     myStdActions.insert( HelpContentsId , helpContentsActionGUI );
 
+    
     /* TUI contents */
+    /*
     QActionP* helpContentsActionTUI = new QActionP( "", tr("MEN_DESK_HELP_TUICONTENTS"), 0, this );
     helpContentsActionTUI->setStatusTip ( tr("PRP_DESK_HELP_TUICONTENTS") );
     QAD_ASSERT(connect( helpContentsActionTUI, SIGNAL(activated()),
                        this, SLOT( onHelpContentsTUI() )));
     helpContentsActionTUI->addTo( &myHelpPopup );
     myStdActions.insert( HelpContentsId , helpContentsActionTUI );                                                
+    */
+
+
+    // Provide status tip for Module help menu item
+    QAD_ASSERT( connect( &myHelpPopup, SIGNAL(highlighted( int )), this,
+                        SLOT(onHelpModulePopupStatusText( int )) ));
+       
 
     /* search */
 //    QActionP* helpSearchAction = new QActionP( "", tr("MEN_DESK_HELP_SEARCH"), 0, this );
@@ -1800,15 +1849,7 @@ bool QAD_Desktop::onSaveAsStudy( QAD_Study* study )
 */
 bool QAD_Desktop::onCloseStudy()
 {
-  bool close = this->onCloseStudy ( myActiveStudy, true );
-  if ( close && !myXmlHandler->myIdList.IsEmpty() ) {
-    clearMenus();
-    myActiveComp = "";
-    myCombo->setCurrentItem (0);
-    for ( QToolButton* aButton=myComponentButton.first(); aButton; aButton=myComponentButton.next() ) {
-      aButton->setOn(false);
-    }
-  }
+  bool close = this->onCloseStudy ( getActiveStudy(), true );
   return close;
 }
 
@@ -1859,6 +1900,7 @@ bool QAD_Desktop::onCloseStudy( QAD_Study* study, bool ask )
   /* close active component */
   if (!myXmlHandler->myIdList.IsEmpty())
     {
+      deactivateComponent();
       clearMenus();
       myActiveComp="";
       myCombo->setCurrentItem (0);
@@ -1962,10 +2004,10 @@ void QAD_Desktop::onSelectionMode()
 {
   const QActionP* obj = (QActionP*) sender();
   
-  int SelectionMode = 4;
+  Selection_Mode SelectionMode = ActorSelection;
 
   if ( obj == myStdActions.at(SelectionActorId) ) {
-    SelectionMode = 4;
+    SelectionMode = ActorSelection;
     if ( obj->isOn() ) {
       myStdActions.at(SelectionCellId)->setOn(false);
       myStdActions.at(SelectionEdgeId)->setOn(false);
@@ -1974,7 +2016,7 @@ void QAD_Desktop::onSelectionMode()
       myStdActions.at(SelectionActorId)->setOn(true);
 
   } else if ( obj == myStdActions.at(SelectionCellId) ) {
-    SelectionMode = 3
+    SelectionMode = CellSelection
     if ( obj->isOn() ) {
       myStdActions.at(SelectionActorId)->setOn(false);
       myStdActions.at(SelectionEdgeId)->setOn(false);
@@ -1983,7 +2025,7 @@ void QAD_Desktop::onSelectionMode()
       myStdActions.at(SelectionActorId)->setOn(true);
       
   } else if ( obj == myStdActions.at(SelectionEdgeId) ) {
-    SelectionMode = 2;    
+    SelectionMode = EdgeOfCellSelection;    
     if ( obj->isOn() ) {
       myStdActions.at(SelectionActorId)->setOn(false);
       myStdActions.at(SelectionCellId)->setOn(false);
@@ -1992,7 +2034,7 @@ void QAD_Desktop::onSelectionMode()
       myStdActions.at(SelectionActorId)->setOn(true);
       
   } else if ( obj == myStdActions.at(SelectionPointId) ) {
-    SelectionMode = 1;
+    SelectionMode = NodeSelection;
     if ( obj->isOn() ) {
       myStdActions.at(SelectionEdgeId)->setOn(false);
       myStdActions.at(SelectionCellId)->setOn(false);
@@ -2011,10 +2053,10 @@ void QAD_Desktop::onSelectionMode()
 /*!
     Called on 'View\Selection Mode'
 */
-void QAD_Desktop::SetSelectionMode(int mode, bool activeCompOnly)
+void QAD_Desktop::SetSelectionMode(Selection_Mode mode, bool activeCompOnly)
 {
   switch (mode) {
-  case 1:
+  case NodeSelection:
     {
       myStdActions.at(SelectionEdgeId)->setOn(false);
       myStdActions.at(SelectionCellId)->setOn(false);
@@ -2022,7 +2064,7 @@ void QAD_Desktop::SetSelectionMode(int mode, bool activeCompOnly)
       myStdActions.at(SelectionPointId)->setOn(true);
       break;
     }
-  case 2:
+  case EdgeOfCellSelection:
     {
       myStdActions.at(SelectionActorId)->setOn(false);
       myStdActions.at(SelectionCellId)->setOn(false);
@@ -2030,15 +2072,18 @@ void QAD_Desktop::SetSelectionMode(int mode, bool activeCompOnly)
       myStdActions.at(SelectionEdgeId)->setOn(true);
       break;
     }
-  case 3:
-    {
+  case CellSelection:
+  case EdgeSelection:
+  case FaceSelection:
+  case VolumeSelection:
+   {
       myStdActions.at(SelectionActorId)->setOn(false);
       myStdActions.at(SelectionEdgeId)->setOn(false);
       myStdActions.at(SelectionPointId)->setOn(false);
       myStdActions.at(SelectionCellId)->setOn(true);
       break;
     }
-  case 4:
+  case ActorSelection:
     {
       myStdActions.at(SelectionCellId)->setOn(false);
       myStdActions.at(SelectionEdgeId)->setOn(false);
@@ -2128,6 +2173,16 @@ private:
   
 };
 
+// Provide status tip for GUI help menu item
+
+void QAD_Desktop::onHelpModulePopupStatusText(int id)
+{
+  int Id = myHelpPopup.idAt( 0 ); // HelpContentsModuleId
+  //  MESSAGE ( "myHelpContentsModulePopup : " << id << "-" << Id)
+  if (id == Id)
+    putInfo("Shows the help contents of each module");
+}
+
 /*!
     Called on 'help\contents'
 */
@@ -2158,41 +2213,42 @@ void QAD_Desktop::onHelpContents()
 }
 
 /*!
-    Called on 'help\GUI Reference'
+    Called on 'Module Help Reference'
 */
-void QAD_Desktop::onHelpContentsGUI()
-{
-//   QCString dir;
-//   QString root;
-//   QString homeDir;
+void QAD_Desktop::onHelpContentsModule()
+{ 
+  const QActionP* obj = (QActionP*) sender();
   
-//   if ( (dir = getenv("KERNEL_ROOT_DIR")) ) {
-//     root = QAD_Tools::addSlash( QAD_Tools::addSlash(dir) + "doc" );
-//     root = QAD_Tools::addSlash( root + "guihtml" );
-//     root = QAD_Tools::addSlash( root + "guihtml" );
-//     if ( QFileInfo( root + "salomedoc.html" ).exists() ) {
-//       homeDir = root;
-//     }
-//   }
-//   if ( root.isEmpty() ) {
-//     if ( QFileInfo( "/usr/local/doc/guihtml/salomedoc.html" ).exists() ) {
-//       homeDir = "/usr/local/doc/guihtml/";
-//     }
-//   }
-//   if ( root.isEmpty() ) 
-//     root = "./doc/";
-//   QString helpFile = QFileInfo( homeDir + "salomedoc.html" ).absFilePath(); 
-//   QString anApp = QAD_CONFIG->getSetting("ExternalBrowser:Application");
-//   QString aParams = QAD_CONFIG->getSetting("ExternalBrowser:Parameters");
+  QString aComponentName = obj->name();
+  QString aFileName = aComponentName + "_index.html";
+
+  QCString dir;
+  QString root;
+  QString homeDir;
+  if (dir = getenv( aComponentName + "_ROOT_DIR")) {
+    root = QAD_Tools::addSlash( QAD_Tools::addSlash(dir) +  QAD_Tools::addSlash("doc") +  QAD_Tools::addSlash("salome") );
+    if ( QFileInfo( root + aFileName ).exists() ) {
+      homeDir = root;
+    } else {
+      QMessageBox::warning( this, tr("WRN_WARNING"), 
+                           QString( "%1"+ aFileName + " doesn't exist." ).arg(root), tr ("BUT_OK") );
+      return;
+    }
+  }
+
+  QString helpFile = QFileInfo( homeDir + aFileName ).absFilePath();   
+  QString anApp = QAD_CONFIG->getSetting("ExternalBrowser:Application");
+  QString aParams = QAD_CONFIG->getSetting("ExternalBrowser:Parameters");
    
-//   RunBrowser* rs = new RunBrowser(anApp, aParams, helpFile);
-//   rs->start();
-    
+  RunBrowser* rs = new RunBrowser(anApp, aParams, helpFile);
+  rs->start();
 }
 
 /*!
     Called on 'help\TUI Reference'
 */
+
+/* Commented
 void QAD_Desktop::onHelpContentsTUI()
 {
   if (myActiveComp == "")
@@ -2202,16 +2258,18 @@ void QAD_Desktop::onHelpContentsTUI()
   QString root;
   QString homeDir;
   if (dir = getenv( getComponentName( myActiveComp ) + "_ROOT_DIR")) {
-    root = QAD_Tools::addSlash( QAD_Tools::addSlash(dir) + QAD_Tools::addSlash("share")  + QAD_Tools::addSlash("salome")  + QAD_Tools::addSlash("doc") + "html" );
+    root = QAD_Tools::addSlash( QAD_Tools::addSlash(dir) + QAD_Tools::addSlash("doc") + "html" );
     if ( QFileInfo( root + "index.html" ).exists() ) {
       homeDir = root;
-    } else {
+    } else if (QFileInfo( root + "html/index.html" ).exists())
+      homeDir = root + QAD_Tools::addSlash("html");
+    else {
       QMessageBox::warning( this, tr("WRN_WARNING"), 
                            QString( "%1index.html doesn't exist." ).arg(root), tr ("BUT_OK") );
       return;
     }
   }
-
+  
   QString helpFile = QFileInfo( homeDir + "index.html" ).absFilePath(); 
   
   QString anApp = QAD_CONFIG->getSetting("ExternalBrowser:Application");
@@ -2220,6 +2278,8 @@ void QAD_Desktop::onHelpContentsTUI()
   RunBrowser* rs = new RunBrowser(anApp, aParams, helpFile);
   rs->start();
 }
+*/
+
 
 // /*!
 //     Called on 'help\search'
@@ -2359,10 +2419,10 @@ void QAD_Desktop::onWindowPopupAboutToShow()
 */
 void QAD_Desktop::onWindowsPopupStatusText( int id )
 {
-    int cascadeId = myWindowPopup.idAt( 0 );
-    int tileId = myWindowPopup.idAt( 1 );
+    int cascadeId = myWindowPopup.idAt( 1 );
+    int tileId = myWindowPopup.idAt( 2 );
     if ( id == cascadeId || id == tileId )
-       return;
+      return;
     putInfo( tr("PRP_DESK_WINDOW_ACTIVATE") );
 }
 
@@ -2478,7 +2538,9 @@ 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++) {
-           aDlg->addComponent( strdup(list_type_composants[ind]) );
+           QString compusername = getComponentUserName( strdup(list_type_composants[ind]) );
+           if ( !compusername.isEmpty() )
+             aDlg->addComponent( compusername );
          }
          
          int retVal = aDlg->exec();
@@ -2771,7 +2833,8 @@ bool QAD_Desktop::loadComponent(QString Component)
 
 QString QAD_Desktop::changeXmlInputSourceData(QString theData, QString theComponent) 
 {
-  if ( theComponent=="Supervision" ) {
+  //  MESSAGE ( " changeXmlInputSourceData : " << theComponent.latin1() )
+  if ( theComponent=="SUPERV" ) {
     //Supervision main menu item
     int aItemId = 300;
     int aPosId = 3;
@@ -2780,7 +2843,7 @@ QString QAD_Desktop::changeXmlInputSourceData(QString theData, QString theCompon
     theData = theData.replace( QRegExp(aStrOld), aStrNew );
   }
   
-  if ( theComponent == "Visu" ) {
+  if ( theComponent == "VISU" ) {
     //Visualization main menu item
     int aItemId = 401;
     int aPosId = 3;
@@ -2833,44 +2896,44 @@ QString QAD_Desktop::changeXmlInputSourceData(QString theData, QString theCompon
     theData = theData.replace( QRegExp(aStrOld), aStrNew );
 
     //Numbering main menu item
-    aItemId = 80;
-    aPosId = 7;
-    aStrOld = createString( aItemId, aPosId );
-    aStrNew = createString( aItemId, aPosId+1 );
-    theData = theData.replace( QRegExp(aStrOld), aStrNew );
+//     aItemId = 80;
+//     aPosId = 7;
+//     aStrOld = createString( aItemId, aPosId );
+//     aStrNew = createString( aItemId, aPosId+1 );
+//     theData = theData.replace( QRegExp(aStrOld), aStrNew );
   }
   
-  if ( theComponent == "Geometry" ) {
+  if ( theComponent == "GEOM" ) {
     //New Entity main menu item
-    int aItemId = 70;
+    int aItemId = 40;
     int aPosId = 3;
     QString aStrOld = createString( aItemId, aPosId );
     QString aStrNew = createString( aItemId, aPosId+1 );
     theData = theData.replace( QRegExp(aStrOld), aStrNew );
 
     //Operations main menu item
-    aItemId = 40;
+    aItemId = 50;
     aPosId = 4;
     aStrOld = createString( aItemId, aPosId );
     aStrNew = createString( aItemId, aPosId+1 );
     theData = theData.replace( QRegExp(aStrOld), aStrNew );
 
     //Repair main menu item
-    aItemId = 50;
+    aItemId = 60;
     aPosId = 5;
     aStrOld = createString( aItemId, aPosId );
     aStrNew = createString( aItemId, aPosId+1 );
     theData = theData.replace( QRegExp(aStrOld), aStrNew );
 
     //Measures main menu item
-    aItemId = 60;
+    aItemId = 70;
     aPosId = 6;
     aStrOld = createString( aItemId, aPosId );
     aStrNew = createString( aItemId, aPosId+1 );
     theData = theData.replace( QRegExp(aStrOld), aStrNew );
   }
 
-  if ( theComponent == "Med" ) {
+  if ( theComponent == "MED" ) {
     //MED main menu item
     int aItemId = 90;
     int aPosId = 3;
@@ -3012,6 +3075,9 @@ void QAD_Desktop::onComboActiveComponent( const QString & component, bool isLoad
 {
   if (myActiveStudy != 0) {
     if (myActiveComp.compare(component)!=0) {
+      // deactivate previous component
+      deactivateComponent();
+
       if (!myXmlHandler->myIdList.IsEmpty()) clearMenus();
       if ( myCombo->currentText() != component )
        myCombo->setCurrentText( component );
@@ -3075,8 +3141,13 @@ void QAD_Desktop::onComboActiveComponent( const QString & component, bool isLoad
       }
     }
   } else if (component.compare(QString("Salome"))!= 0) {
-  
-      SALOMEGUI_ActivateComponentDlg aDlg( this );
+
+      QPixmap pm;
+      for ( QToolButton* aButton=myComponentButton.first(); aButton; aButton=myComponentButton.next() ) {
+       if ( aButton->textLabel().compare( component ) == 0 )
+         pm = aButton->iconSet().pixmap();
+      }
+      SALOMEGUI_ActivateComponentDlg aDlg( this, component, pm );
       int res = aDlg.exec();
       
       switch ( res )
@@ -3239,39 +3310,52 @@ void QAD_Desktop::definePopup(QString & theContext,
   }
 }
 
+
 /*!
-    Create popup
+    Copy popup menu [ static ]
 */
-void QAD_Desktop::createPopup(QPopupMenu* popupFather, QPopupMenu* popup,
-                             QString text, int popupID, bool separator)
-{
-  QMenuItem* item = popup->findItem(popupID);
-  if (item) {
-    QPopupMenu* popupChild = item->popup();
-    if ( popupChild ) {
-      QPopupMenu* newPopup = new QPopupMenu;
-      int count = popupChild->count();
-      // add items at the top of <popupFather>
-      for (int i = count - 1; i >= 0; i--) {
-       int j = popupChild->idAt(i);
-       QString text = popupChild->text(j);
-       createPopup( newPopup, popupChild, text, j);
+static void makePopup( QPopupMenu* popup, QPopupMenu* fromPopup, QAD_Desktop* receiver ) 
+{
+  // safe check
+  if ( !popup || !fromPopup ) 
+    return;
+  // iterator through all popup items
+  for ( int i = fromPopup->count()-1; i >= 0; i-- ) {
+    int cmdId = fromPopup->idAt( i );
+    QMenuItem* item = fromPopup->findItem( cmdId );
+    if ( item ) {
+      // if item is a separator
+      if ( item->isSeparator() ) {
+       popup->insertSeparator( 0 );
+      }
+      else {
+       QIconSet* iconSet = item->iconSet();
+       QKeySequence accel = fromPopup->accel( cmdId );
+
+       QPopupMenu* popupChild = item->popup();
+       // if item is a popup
+       if ( popupChild && popupChild != fromPopup ) {
+         QPopupMenu* newPopup = new QPopupMenu( popup );
+         if ( iconSet ) 
+           popup->insertItem( *iconSet, item->text(), newPopup, cmdId, 0 );
+         else
+           popup->insertItem( item->text(), newPopup, cmdId, 0 );
+         makePopup( newPopup, popupChild, receiver );
+       }
+       // if item is a command
+       else {
+         if ( iconSet ) 
+           popup->insertItem( *iconSet, item->text(), cmdId, 0 );
+         else
+           popup->insertItem( item->text(), cmdId, 0 );
+         popup->connectItem( cmdId, receiver, SLOT( onDispatch( int ) ) );
+       }
+       popup->setAccel( accel, cmdId );
       }
-      popupFather->insertItem(popup->text(popupID),
-                             newPopup, popupID, 0);
-    } else {
-      if ( !text.isNull() ) {
-       popupFather->insertItem(popup->text(popupID),
-                               this,
-                               SLOT( onDispatch(int) ), 0, popupID, 0);// try adding item at the top
-      } /*else if ( separator ) 
-       popupFather->insertTearOffHandle(-1, 0);*/
-      else
-       popupFather->insertSeparator(0);
     }
   }
 }
-
+    
 /*!
     Create popup
 */
@@ -3280,34 +3364,8 @@ void QAD_Desktop::createPopup(QPopupMenu* popup, const QString & theContext,
 {
   if ( !myActiveComp.isEmpty() && 
        getOperatorMenus()->createPopupMenu(theContext,theParent,theObject) != NULL ) {
-    QPopupMenu* aPopup = getOperatorMenus()->createPopupMenu(theContext,theParent,theObject)->getPopup();
-    int count = aPopup->count();
-
-    //for (int i = 0; i < count; i++) {
-    for (int i = count - 1; i >= 0; i--) {
-      int id = aPopup->idAt(i);
-      QString text = aPopup->text(id);
-      //QString mes("Inserting popup menu item loaded from XML: ");
-      //mes += text;
-      //MESSAGE ( mes.latin1() )
-      if (i==0)
-       popup->insertItem(aPopup->text(id),
-                         this,
-                         SLOT( onDispatch(int) ), 0, id, 0);// try adding item at the top
-      else
-       createPopup( popup, aPopup, text, id);
-    }
-  } //else {
-    //QString mes("Popup does not exist for given (Context = ");
-    //mes += theContext;
-    //mes += ", Parent = ";
-    //mes += theParent;
-    //mes += ", Object = ";
-    //mes += theObject;
-    //MESSAGE (mes.latin1())
-      //popup->clear();
-  //}
-
+    makePopup( popup, getOperatorMenus()->createPopupMenu(theContext,theParent,theObject)->getPopup(), this );
+  }
   // IAPP Popup 
   // Should be moved to SALOMEGUI_Application::onCreatePopup()...
   if ( myActiveComp.isEmpty() ) {
@@ -3327,10 +3385,11 @@ void QAD_Desktop::createPopup(QPopupMenu* popup, const QString & theContext,
       }
     } 
   }
+
 }
 
 typedef bool activeStudyChanged(QAD_Desktop*);
+typedef void deactivate();
 
 void QAD_Desktop::onActiveStudyChanged()
 {
@@ -3343,6 +3402,17 @@ void QAD_Desktop::onActiveStudyChanged()
   }
 }
 
+void QAD_Desktop::deactivateComponent()
+{
+  if (!myActiveComp.isEmpty()) {
+    OSD_Function osdF = mySharedLibrary.DlSymb("deactivate");
+    if ( osdF != NULL ) {
+      deactivate (*f1) = (void (*)()) osdF;
+      (*f1)();
+    }  
+  }
+}
+
 typedef bool customP(QAD_Desktop*, QPopupMenu*, const QString & theContext,
                     const QString & theParent, const QString & theObject);
 /*!
@@ -3577,6 +3647,7 @@ void QAD_Desktop::onViewerOCC()
   QColor c = QColorDialog::getColor( color, QAD_Application::getDesktop() );
 
   if (c.isValid()) {
+    /* VSR : PAL5420 ---------------------------------------------------
     if ( myActiveApp ) {
       QList<QAD_Study>& studies = myActiveApp->getStudies();
       for ( QAD_Study* study = studies.first(); study; study = studies.next() )  {
@@ -3589,6 +3660,7 @@ void QAD_Desktop::onViewerOCC()
        }
       }
     }
+    VSR : PAL5420 --------------------------------------------------- */
     QAD_CONFIG->addSetting( "OCCViewer:BackgroundColorRed",   c.red() );
     QAD_CONFIG->addSetting( "OCCViewer:BackgroundColorGreen", c.green() );
     QAD_CONFIG->addSetting( "OCCViewer:BackgroundColorBlue",  c.blue() );
@@ -3612,6 +3684,7 @@ void QAD_Desktop::onGraphSupervisor()
   QColor c = QColorDialog::getColor( color, QAD_Application::getDesktop() );
 
   if (c.isValid()) {
+    /* VSR : PAL5420 ---------------------------------------------------
     if ( myActiveApp ) {
       QList<QAD_Study>& studies = myActiveApp->getStudies();
       for ( QAD_Study* study = studies.first(); study; study = studies.next() )  {
@@ -3624,7 +3697,7 @@ void QAD_Desktop::onGraphSupervisor()
        }
       }
     }
-    
+    VSR : PAL5420 --------------------------------------------------- */
     QAD_CONFIG->addSetting( "SUPERVGraph:BackgroundColorRed",   c.red() );
     QAD_CONFIG->addSetting( "SUPERVGraph:BackgroundColorGreen", c.green() );
     QAD_CONFIG->addSetting( "SUPERVGraph:BackgroundColorBlue",  c.blue() );
@@ -3648,6 +3721,7 @@ void QAD_Desktop::onViewerVTK()
   QColor c = QColorDialog::getColor( color, QAD_Application::getDesktop() );
 
   if (c.isValid()) {
+    /* VSR : PAL5420 ---------------------------------------------------
     if ( myActiveApp ) {
       QList<QAD_Study>& studies = myActiveApp->getStudies();
       for ( QAD_Study* study = studies.first(); study; study = studies.next() )  {
@@ -3660,7 +3734,7 @@ void QAD_Desktop::onViewerVTK()
        }
       }
     }
-    
+    VSR : PAL5420 --------------------------------------------------- */
     QAD_CONFIG->addSetting( "VTKViewer:BackgroundColorRed",   c.red() );
     QAD_CONFIG->addSetting( "VTKViewer:BackgroundColorGreen", c.green() );
     QAD_CONFIG->addSetting( "VTKViewer:BackgroundColorBlue",  c.blue() );
@@ -3680,12 +3754,13 @@ void QAD_Desktop::onPlot2d()
     color = QColor( bgRed, bgGreen, bgBlue );
   }
   else {
-    color = QColor(0, 0, 0);  
+    color = QColor(255, 255, 255);  
   }
 
   color = QColorDialog::getColor( color, QAD_Application::getDesktop() );
 
   if ( color.isValid() ) {
+    /* VSR : PAL5420 ---------------------------------------------------
     if ( myActiveApp ) {
       QList<QAD_Study>& studies = myActiveApp->getStudies();
       for ( QAD_Study* study = studies.first(); study; study = studies.next() )  {
@@ -3698,6 +3773,7 @@ void QAD_Desktop::onPlot2d()
        }
       }
     }
+    VSR : PAL5420 --------------------------------------------------- */
     QStringList bgData; 
     bgData.append( QString::number( color.red() ) );
     bgData.append( QString::number( color.green() ) );
@@ -3818,6 +3894,85 @@ void QAD_Desktop::onUndoLevel()
   }
 }
 
+/* Update status bar for File menu items */
+void QAD_Desktop::onFilePopupStatusText( int id )
+{
+  QString component = getActiveComponent();
+  
+  if (component != "") {
+    //one of the modules is active now
+    int importId = myFilePopup.idAt(8);
+    int exportId = myFilePopup.idAt(9);
+   
+    if (component == getComponentUserName("SMESH") || component == getComponentUserName("GEOM")) {
+      if (id == importId)
+       putInfo( tr("PRP_DESK_FILE_IMPORT") );
+      if (id == exportId)
+       putInfo( tr("PRP_DESK_FILE_EXPORT") );
+    }
+    if (component == getComponentUserName("VISU")) {
+      if (id == importId)
+       putInfo( tr("PRP_DESK_FILE_IMPORTMED") );
+      if (id == exportId)
+       putInfo( tr("PRP_DESK_FILE_IMPORTTABLE") );
+    }
+    if (component == getComponentUserName("SUPERV")) {
+      if (id == importId)
+       putInfo( tr("PRP_DESK_FILE_IMPORTDF") );
+      if (id == exportId)
+       putInfo( tr("PRP_DESK_FILE_EXPORTDF") );
+    }
+  }
+}
+
+/* Update status bar for Edit menu items */
+void QAD_Desktop::onEditPopupStatusText( int id )
+{
+  QString component = getActiveComponent();
+  
+  if (component != "") {
+    //one of the modules is active now
+   
+    if (component == getComponentUserName("SMESH") || component == getComponentUserName("GEOM") ) {
+      int deleteId = myEditPopup.idAt(5);
+      if (id == deleteId)
+       putInfo( tr("PRP_DESK_EDIT_DELETE") );
+    }
+    if (component == getComponentUserName("SUPERV") ) {
+      int newDFId = myEditPopup.idAt(5);
+      int modifyDFId = myEditPopup.idAt(6);
+      if (id == newDFId)
+       putInfo( tr("PRP_DESK_EDIT_NEWDF") );
+      if (id == modifyDFId)
+       putInfo( tr("PRP_DESK_EDIT_MODIFYDF") );
+    }
+  }
+}
+
+/* Update status bar for View menu items */
+void QAD_Desktop::onViewPopupStatusText( int id )
+{
+  QString component = getActiveComponent();
+  
+  if (component != "") {
+    //one of the modules is active now
+    int DispModeId = myViewPopup.idAt(2);
+    
+    if (component == getComponentUserName("GEOM")) {
+      if (id == DispModeId)
+       putInfo( tr("PRP_DESK_VIEW_DISPLAYMODE") );
+    }
+    if (component == getComponentUserName("SMESH")) {
+      int updateId = myViewPopup.idAt(4);
+
+      if (id == DispModeId)
+       putInfo( tr("PRP_DESK_VIEW_DISPLAYMODE") );
+      if (id == updateId)
+       putInfo( tr("PRP_DESK_VIEW_UPDATE") );
+    }
+  }
+}
+
 /*********************************************************************
 ** Class: AppSelectionDlg
 ** Descr: Dialog for the selection of the application when several
index 56f8a79072ea4c9ed7a1cf66b606ee0c06853ce7..2f1fab179bb927b90c44b686851432f9e3797946 100644 (file)
@@ -39,6 +39,7 @@
 
 #include "SALOME_NamingService.hxx"
 #include "SALOME_LifeCycleCORBA.hxx"
+#include "SALOME_Selection.h"
 
 // IDL Headers 
 #include <SALOMEconfig.h>
@@ -71,7 +72,7 @@ class QAD_EXPORT QAD_Desktop : public QMainWindow
 protected:
   //NRI - unused - :  enum ComponentType {GEOM, MESH, SOLVER, DATA, VISU, OTHER} ;
 
-  enum {  FileNewId = 0, FileOpenId, FileLoadId, FileCloseId, FileSaveId, FileSaveAsId, FilePropsId, FileExitId,
+  enum {  FileNewId = -1000, FileOpenId, FileLoadId, FileCloseId, FileSaveId, FileSaveAsId, FilePropsId, FileExitId,
          ViewStatusBarId,
          SelectionPointId, SelectionEdgeId, SelectionCellId, SelectionActorId,
          PrefViewerOCCId, PrefViewerVTKId, PrefGraphSupervisorId, PrefViewerPlot2dId,
@@ -86,7 +87,8 @@ protected:
          WindowNew3dId, ViewOCCId, ViewVTKId, ViewPlot2dId,
          //NRI : SAL2214
          WindowCascadeId, WindowTileId, 
-         HelpContentsId, HelpSearchId, HelpWhatsThisId, HelpAboutId };
+         HelpContentsId, HelpContentsModuleId,
+         HelpSearchId, HelpWhatsThisId, HelpAboutId };
   enum UpdateCommand { ActivateApp, DeactivateApp };
 
     /* Desktop can be created only by application */
@@ -114,16 +116,13 @@ public:
     void     definePopup(QString & theContext,
                         QString & theParent, 
                         QString & theObject );
-
-    void     createPopup(QPopupMenu* popupFather, QPopupMenu* popup,
-                        QString text, int popupID, bool separator = false);
     void     createPopup(QPopupMenu* popup, const QString & theContext,
                         const QString & theParent, const QString & theObject );
     void     customPopup(QPopupMenu* popup, const QString & theContext,
                         const QString & theParent, const QString & theObject);
 
     /* selection mode */
-    void SetSelectionMode(int mode, bool activeCompOnly = false);
+    void SetSelectionMode(Selection_Mode mode, bool activeCompOnly = false);
 
     /* desktop */
     void             showDesktop();
@@ -155,6 +154,7 @@ public:
     bool             loadComponent(QString);
     QString           changeXmlInputSourceData(QString theData, QString theComponent);
     void             activateComponent(const QString& theName, bool isLoadData = true);
+    void              deactivateComponent();
     void              createStudy();
 
     void              setSettings();
@@ -220,6 +220,11 @@ protected slots:
     virtual void      onWindowPopupAboutToShow();
     void             onWindowsPopupActivated( int id );
     void             onWindowsPopupStatusText( int id );
+    void              onHelpModulePopupStatusText(int id);
+    
+    void              onFilePopupStatusText( int id );
+    void              onEditPopupStatusText( int id );
+    void              onViewPopupStatusText( int id );
 
     void             onSelectionMode();
 
@@ -245,8 +250,8 @@ protected slots:
     void             onDeactivateApp(QAD_Application* app);
 
     void             onHelpContents();
-    void             onHelpContentsGUI();
-    void             onHelpContentsTUI();
+    void             onHelpContentsModule();
+    /*    void       onHelpContentsTUI(); */
 /*    void           onHelpSearch(); */
     void             onHelpAbout();
 
@@ -285,11 +290,13 @@ protected:
   //NRI : SAL2214
     QPopupMenu       myNewViewPopup;
   //NRI : SAL2214
+    QPopupMenu       myHelpContentsModulePopup;
+
     QPopupMenu       myToolsPopup;
     QPopupMenu       myPrefPopup;
     QPopupMenu       mySelectionModePopup;
     QPopupMenu       myWindowPopup;        /* not customized by an application */
-
+    
     ActionMap         myStdActions;        /* default actions */
     QToolBar*        myStdToolBar;         /* standard toolbar */
     QStatusBar*              myStatusBar;          /* the only status bar */
index d715bf5df5ea07b0e3d1155fa34c16e6a9c71332..8f4322541dce4b608b4f58d40972fb5392b0e86a 100644 (file)
@@ -111,9 +111,9 @@ QAD_HelpWindow::QAD_HelpWindow()
 
   /*
   // look for index.html and set homeDir
-  // 1. $(SALOME_ROOT_DIR)/doc/index.html
-  // 2. $(SALOME_ROOT_DIR)/doc/html/index.html
-  // 3. $(SALOME_ROOT_DIR)/doc/html/html/index.html
+  // 1. $(KERNEL_ROOT_DIR)/doc/index.html
+  // 2. $(KERNEL_ROOT_DIR)/doc/html/index.html
+  // 3. $(KERNEL_ROOT_DIR)/doc/html/html/index.html
   // 4. /usr/local/doc/html/index.html
 
   QCString dir;
index d72f4c9d3a6413a8a31e94e5f81036d2c9ea8f6a..079462ef3261ac4524fe44bbd4e952ed0406612a 100644 (file)
@@ -717,9 +717,12 @@ void QAD_ObjectBrowser::Update( SALOMEDS::SObject_ptr SO,
              QString msg;
              QAD_ResourceMgr* resMgr = QAD_Desktop::createResourceManager();
              if ( resMgr ) {
-               if(resMgr->loadResources( QString(aFatherName->Value()) + "GUI", msg )) {
-                 QPixmap icon ( resMgr->loadPixmap( QString(aFatherName->Value()) + "GUI",
-                                                    tr(aPixmap->GetPixMap()) /*tr( "ICON_OBJBROWSER_" + theComponent )*/ ));
+               //if(resMgr->loadResources( QString(aFatherName->Value()) + "GUI", msg )) {
+               if( resMgr->loadResources( QAD_Application::getDesktop()->getComponentName( QString( aFatherName->Value() ) ), msg ) ) {
+                 QPixmap icon ( resMgr->loadPixmap( QAD_Application::getDesktop()->getComponentName( QString( aFatherName->Value() ) ),
+                                                   tr( aPixmap->GetPixMap() )  /*tr( "ICON_OBJBROWSER_" + theComponent )*/ ) );
+                 //QPixmap icon ( resMgr->loadPixmap( QString(aFatherName->Value()) + "GUI",
+                 //tr(aPixmap->GetPixMap()) /*tr( "ICON_OBJBROWSER_" + theComponent )*/ ));
                  Item->setPixmap( 0, icon );
                }
              }
index 4dd3aa333701ef2d3f0601943dcab112beaeb1f1..a125e4fa75526f2b26e9ef39ec81d6b35dea04dd 100644 (file)
@@ -216,7 +216,7 @@ void QAD_PyEditor::mouseReleaseEvent ( QMouseEvent * e )
 */
   void QAD_PyEditor::dropEvent (QDropEvent *e)
 {
-  INFOS("dropEvent : not handled");
+  MESSAGE("dropEvent : not handled");
 }
 
 /*!
index d116c7b33a1108d75134342ad2dac403f3e6fa3f..f6e5b6e8feb1b3290a4e61fa1bf0194eb906e382 100644 (file)
@@ -56,6 +56,7 @@ static const char* RES_DOCS     = "docs";
 static const char* RES_PIXMAPS  = "icons";
 static const char* RES_STRINGS  = "strings";
 static const char* RES_LANGUAGE = "language";
+static const char* RES_FILES    = "resources";
 
 static const char* SEPARATOR    = ":";
 
@@ -125,8 +126,11 @@ bool QAD_ResourceMgr::loadResources( const char* prefix, QString &msg )
     */
     QString resDirs = collectDirs( prefix );
     conf.insert( RES_DIR, new QString( resDirs ) );
-    QString fileConfig = path( CONFIG_FILE, prefix, 0 ) ;
+    QString fileConfig = QString( prefix ) + QString( "." ) + QString( CONFIG_FILE );
+    fileConfig = path( fileConfig, prefix, 0 ) ;
     //MESSAGE("QAD_ResourceMgr::loadresources : config : "<<fileConfig);
+    if ( fileConfig.isEmpty() )
+      fileConfig = path( CONFIG_FILE, prefix, 0 ) ;
     if ( !fileConfig.isEmpty() ) {
       QFile configFile( fileConfig );
       if ( !configFile.exists() || !configFile.open( IO_ReadOnly ) ) {
@@ -168,20 +172,37 @@ bool QAD_ResourceMgr::loadResources( const char* prefix, QString &msg )
     bool bLoadString = false;
     bool bLoadImages = false;
 
-    QStringList dirList = QStringList::split( SEPARATOR, resDirs, false ); // skip empty entries
-    for ( int i = dirList.count()-1; i >= 0; i-- ) {
-      QString dir = dirList[ i ];
-      QString fileString = QAD_Tools::addSlash( dir ) + stFile;
-      QString fileImage  = QAD_Tools::addSlash( dir ) + imagesFile;
+    QStringList resFiles = conf[ RES_FILES ] ? QStringList::split( SEPARATOR, *( conf[ RES_FILES ] ), false ) : QStringList();
+    
+    // first load main module's resources
+    QString fileString = path( stFile, prefix, 0 );
+    QString fileImage  = path( imagesFile, prefix, 0 );
+    
+    if ( !fileString.isEmpty() && settings->load( fileString ) ) {
+      bLoadString = true;
+    }
+    if ( !fileImage.isEmpty() && settings->load( fileImage ) ) {
+      bLoadImages = true;
+    }
+
+    // then load additional module's resources if any are given
+    for ( int j = 0; j < resFiles.count(); j++ ) {
+      QString stFileAdd = resFiles[j] + "_msg_" +  *( conf[ RES_LANGUAGE ] ) + ".qm" ;
+      QString imagesFileAdd = resFiles[j] + "_" + RES_PIXMAPS + ".qm";
+      if ( conf[ RES_STRINGS ] && !conf[ RES_STRINGS ]->isEmpty() )
+       stFileAdd = QAD_Tools::addSlash( *conf[ RES_STRINGS ] ) + stFileAdd;
+      if ( conf[ RES_PIXMAPS ] && !conf[ RES_PIXMAPS ]->isEmpty() )
+       imagesFileAdd = QAD_Tools::addSlash( *conf[ RES_PIXMAPS ] ) + imagesFileAdd;
       
-      if ( settings->load( fileString ) ) {
-       bLoadString = true;
-      }
-      if ( settings->load( fileImage ) ) {
-       bLoadImages = true;
-      }
+      QString fileStringAdd = path( stFileAdd, prefix, 0 );
+      QString fileImageAdd  = path( imagesFileAdd, prefix, 0 );
+      
+      if ( !fileStringAdd.isEmpty() )
+       settings->load( fileStringAdd );
+      if ( !fileImageAdd.isEmpty() )
+       settings->load( fileImageAdd );
     }
-    
+
     if ( !bLoadString ) {
       QString warnMsg;
       warnMsg.sprintf( "String resources for module %s not found.\n"
@@ -241,14 +262,14 @@ QString QAD_ResourceMgr::resources( const char* prefix ) const
   can be situated
   The order is following : 
   - <prefix>_ROOT_DIR/share/salome/resources directory
-  - CSF_<prefix>Resources env.var directory ( or directory list )
+  - SALOME_<prefix>Resources env.var directory ( or directory list )
   - ${HOME}/.salome/resources directory
   - KERNEL_ROOT_DIR/share/salome/resources directory
 */
 QString QAD_ResourceMgr::collectDirs( const QString& prefix ) const
 {
   QString dirList;
-  QCString envVar( "CSF_" );
+  QCString envVar;
   QString dir;
   char* cenv;
   
@@ -270,9 +291,9 @@ QString QAD_ResourceMgr::collectDirs( const QString& prefix ) const
     }
   }
 
-  // Try CSF_<prefix>Resources env.var directory ( or directory list )
+  // Try SALOME_<prefix>Resources env.var directory ( or directory list )
   if ( !prefix.isEmpty() ) {
-    envVar = QCString( "CSF_" ) + prefix.latin1() + QCString( "Resources" );
+    envVar = QCString( "SALOME_" ) + prefix.latin1() + QCString( "Resources" );
     cenv = getenv( ( const char* ) envVar );
     if ( cenv ) {
       dir.sprintf( "%s", cenv );
@@ -357,8 +378,6 @@ QString QAD_ResourceMgr::findFile( const QString& filename, const char* prefix )
 */
 QString QAD_ResourceMgr::path( const QString& filename, const char* prefix, const char* key ) const
 {   
-  QString filePath;
-
   ResourceSettings* rs = myRes[ prefix ];
   if ( rs ) {
     StringDict& conf = rs->config();
@@ -369,22 +388,20 @@ QString QAD_ResourceMgr::path( const QString& filename, const char* prefix, cons
       for ( int i = 0; i < dirList.count(); i++ ) {
        QString dir = dirList[ i ];
        dir = QAD_Tools::addSlash( dir );
-       if ( key ) {
-         QString* where = conf[ key ];
-         if ( where )
-           dir = dir + QAD_Tools::addSlash( *where );
+       if ( key && conf[ key ] ) {
+         dir = dir + QString( *( conf[ key ] ) );
+         dir = QAD_Tools::addSlash( dir );
        }
        dir = dir + filename;
        QFileInfo fileInfo( dir );
        if ( fileInfo.isFile() && fileInfo.exists() ) {
-         filePath = fileInfo.filePath();
-         break;
+         return fileInfo.filePath();
        }
       }
     }
   }
   //MESSAGE("QAD_ResourceMgr::path : <"<<filename.latin1()<<"> : "<<filePath.latin1()) ;
-  return filePath;
+  return QString::null;
 }
 
 /*!
index b894bb703e1819a88b631ffa27e52da86eea74b5..48aa8693a719749b9f89076c65da487214476620 100644 (file)
@@ -33,6 +33,7 @@
 #include "QAD_Application.h"
 #include "QAD_StudyFrame.h"
 #include "SALOME_InteractiveObject.hxx"
+#include "SALOME_Selection.h"
 
 // QT Include
 #include <qmainwindow.h>
@@ -57,7 +58,7 @@ public:
   virtual void           setBackgroundColor( const QColor& ) = 0;
   virtual QColor         backgroundColor() const = 0;
 
-  virtual void           SetSelectionMode( int mode ) = 0;
+  virtual void           SetSelectionMode( Selection_Mode mode ) = 0;
   
   virtual void           onAdjustTrihedron() = 0; 
 
index 3d33a2f7083ea8728bc87de3e7a8887b27aeb72d..2f5dbe6d9384debead621c123f063834be439f57 100644 (file)
 class QAD_EXPORT QAD_WaitCursor {
  public:
 // constructor
-     QAD_WaitCursor() : myStarted(false) { start(); }
+     QAD_WaitCursor() : myStarted( false ), myDepth( 1 ) { start(); }
 // destructor
-     ~QAD_WaitCursor()   { stop();  }
+     ~QAD_WaitCursor()   { if ( !myStarted ) { myDepth--; start(); } else { QApplication::restoreOverrideCursor(); } }
 
 // sets WAIT cursor if not set yet
-     void    start()     { if (!myStarted) { QApplication::setOverrideCursor(Qt::waitCursor); myStarted = true; } }
+     void    start()     { if ( !myStarted ) { while( myDepth-- ) QApplication::setOverrideCursor( Qt::waitCursor ); myStarted = true; } myDepth = 0; }
 // clears WAIT cursor if set
-     void    stop()      { if (myStarted)  { QApplication::restoreOverrideCursor(); myStarted = false; } } 
+     void    stop()      { if ( myStarted )  { while( QApplication::overrideCursor() ) { QApplication::restoreOverrideCursor(); myDepth++; } myStarted = false; } } 
 // returns true if WAIT cursor is active
      bool    isStarted() { return myStarted; }
 
  private:
      bool  myStarted;
+     int   myDepth;
 };
 
 #endif
index e845d78e42aa0bc7980fd1e0c3e7f8c0af4b560b..57fafb7b229e24bf586d0077765d124275357878 100644 (file)
@@ -176,8 +176,8 @@ msgid "QAD_Desktop::MEN_DESK_HELP_CONTENTS"
 msgstr "&Contents"
 
 #: QAD_Desktop.cxx:265
-msgid "QAD_Desktop::MEN_DESK_HELP_GUICONTENTS"
-msgstr "&GUI Reference"
+msgid "QAD_Desktop::MEN_DESK_HELP_MODULECONTENTS"
+msgstr "&Module Help"
 
 #: QAD_Desktop.cxx:265
 msgid "QAD_Desktop::MEN_DESK_HELP_TUICONTENTS"
index 7e326d0836a80a6b1c4660ea525c0b6702a2f55a..42859b842f481474a47a4110ac9e8c780908a818 100644 (file)
 using namespace std;
 #include "SALOMEGUI_ActivateComponentDlg.h"
 
+#include <qframe.h>
+#include <qlabel.h>
 #include <qpushbutton.h>
-#include <qhbuttongroup.h>
-#include <qlayout.h> 
-#include <qlabel.h> 
-#include <qmessagebox.h>
+#include <qlayout.h>
+#include <qpixmap.h>
 
+static const char* const default_icon[] = { 
+"48 48 17 1",
+". c None",
+"# c #161e4c",
+"b c #1d3638",
+"e c #2f585b",
+"i c #345b5e",
+"c c #386266",
+"g c #3f7477",
+"d c #4d8589",
+"m c #519099",
+"o c #6abbc1",
+"a c #70c9d3",
+"f c #79ddea",
+"n c #7adff2",
+"k c #7ce2f4",
+"j c #993550",
+"h c #d84b71",
+"l c #ef537d",
+"................................................",
+"................................................",
+"................................................",
+"................................................",
+"................................................",
+"................########.########.########......",
+"...............#aaaaaa###aaaaaa###aaaaaa##......",
+"..............#aaaaaa#b#aaaaaa#b#aaaaaa#c#......",
+".............########b########b########cc#......",
+".............#dddddd#b#dddddd#b#dddddd#cc#......",
+"...........########d########d########d#cc#......",
+"..........#aaaaaa###aaaaaa###aaaaaa##d#cc#......",
+".........#aaaaaa#b#aaaaaa#b#aaaaaa#c#d#cc#......",
+"........########b########e########cc#d#c#.......",
+"........#dddddd#b#dddddd#e#ffffff#cc#d####......",
+"......########d########d########f#cc###g##......",
+".....#aaaaaa###aaaaaa###hhhhhh##f#cc#gg#c#......",
+"....#aaaaaa#b#aaaaaa#i#hhhhhh#j#f#cc###cc#......",
+"...########b########i########jj#f#c#gg#cc#......",
+"...#kkkkkk#b#kkkkkk#i#llllll#jj#f####g#cc#......",
+"...#kkkkkk#b#kkkkkk#i#llllll#jj###m##g#cc#......",
+"...#knnkkk#b#kkkkkk#i#llllll#jj#mm#c#g#cc#......",
+"...#knnkkk#b#kkkkkk#i#llllll#jj###cc#g#c#.......",
+"...#kkkkkk#b#kkkkkk#i#llllll#j#dd#cc#g####......",
+"...#kkkkkk###kkkkkk###llllll####d#cc###g##......",
+"...########g########g########o##d#cc#gg#c#......",
+"....#gggggg#b#gggggg#b#oooooo#c#d#cc###cc#......",
+"...########b########b########cc#d#c#gg#cc#......",
+"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc#d####g#cc#......",
+"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc###g##g#cc#......",
+"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc#gg#c#g#cc#......",
+"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc###cc#g#c#.......",
+"...#kkkkkk#b#kkkkkk#b#kkkkkk#c#gg#cc#g##........",
+"...#kkkkkk###kkkkkk###kkkkkk####g#cc###.........",
+"...########g########g########g##g#cc#...........",
+"....#gggggg#b#gggggg#b#gggggg#c#g#cc#...........",
+"...########b########b########cc#g#c#............",
+"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc#g##.............",
+"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc###..............",
+"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc#................",
+"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc#................",
+"...#kkkkkk#b#kkkkkk#b#kkkkkk#c#.................",
+"...#kkkkkk###kkkkkk###kkkkkk##..................",
+"...########.########.########...................",
+"................................................",
+"................................................",
+"................................................",
+"................................................"};
 
-SALOMEGUI_ActivateComponentDlg::SALOMEGUI_ActivateComponentDlg ( QWidget * parent, const char * name, bool modal, WFlags f )
-     : QDialog ( parent, "", TRUE,  WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+//==============================================================================================================================
+/*!
+ *  SALOMEGUI_ActivateComponentDlg::SALOMEGUI_ActivateComponentDlg
+ *
+ *  Constructor
+ */
+//==============================================================================================================================
+SALOMEGUI_ActivateComponentDlg::SALOMEGUI_ActivateComponentDlg ( QWidget * parent, const QString& component, const QPixmap icon )
+     : QDialog ( parent, "ActivateModuleDlg", true,  WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
 {
-  setSizeGripEnabled ( TRUE ) ;
+  QPixmap defaultIcon( ( const char** ) default_icon );
   setCaption( tr( "CAPTION" ) );
+  setSizeGripEnabled( TRUE );
+  
+  QGridLayout* ActivateModuleDlgLayout = new QGridLayout( this ); 
+  ActivateModuleDlgLayout->setMargin( 11 ); ActivateModuleDlgLayout->setSpacing( 6 );
 
-  QVBoxLayout* m_vbL = new QVBoxLayout( this );
-  m_vbL->setMargin( 11 ); m_vbL->setSpacing( 6 );
-
-  QLabel* m_lIcon  = new QLabel (this, "m_lDescr");
-  QPixmap pm = QMessageBox::standardIcon( QMessageBox::Information );
-  m_lIcon->setPixmap( pm );
-  m_lIcon->setScaledContents( false );
-  m_lIcon->setAlignment( Qt::AlignCenter );
-
-  QLabel* m_lDescr = new QLabel (this, "m_lDescr");
-  m_lDescr->setText ( tr ("ActivateComponent_DESCRIPTION") );
-  m_lDescr->setAlignment( Qt::AlignCenter );
-  m_lDescr->setMinimumHeight( m_lDescr->sizeHint().height()*5 );
-  m_lDescr->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
+  // Module's name and icon
+  myComponentFrame = new QFrame( this, "myComponentFrame" );
+  myComponentFrame->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Expanding ) );
+  myComponentFrame->setMinimumHeight( 100 );
+  myComponentFrame->setFrameStyle( QFrame::Box | QFrame::Sunken );
+  
+  QGridLayout* myComponentFrameLayout = new QGridLayout( myComponentFrame ); 
+  myComponentFrameLayout->setMargin( 11 ); myComponentFrameLayout->setSpacing( 6 );
 
-  QHBoxLayout* m_hl1 = new QHBoxLayout();
-  m_hl1->setMargin( 0 ); m_hl1->setSpacing( 6 );
-  m_hl1->addWidget( m_lIcon );
-  m_hl1->addWidget( m_lDescr );
+  // --> icon
+  myComponentIcon = new QLabel( myComponentFrame, "myComponentIcon" );
+  myComponentIcon->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
+  myComponentIcon->setPixmap( !icon.isNull() ? icon : defaultIcon );
+  myComponentIcon->setScaledContents( false );
+  myComponentIcon->setAlignment( AlignCenter );
+  // --> name
+  myComponentLab = new QLabel( component, myComponentFrame, "myComponentLab" );
+  QFont fnt = myComponentLab->font(); fnt.setBold( TRUE ); myComponentLab->setFont( fnt ); 
+  myComponentLab->setAlignment( AlignCenter );
 
-  m_pb1 = new QPushButton( tr ("NEW"), this );
-  m_pb2 = new QPushButton( tr ("OPEN"),      this );
-  m_pb3 = new QPushButton( tr ("LOAD"),     this );
-  m_pb4 = new QPushButton( tr ("CANCEL"),     this );
+  myComponentFrameLayout->addWidget( myComponentIcon, 0, 0 );
+  myComponentFrameLayout->addWidget( myComponentLab,  0, 1 );
 
-  QGridLayout* m_hl2 = new QGridLayout();
-  m_hl2->setMargin( 0 ); m_hl2->setSpacing( 6 );
-  m_hl2->addWidget( m_pb1, 0, 0 );
-  m_hl2->addWidget( m_pb2, 0, 1 );
-  m_hl2->addWidget( m_pb3, 0, 2 );
-  m_hl2->addColSpacing( 3, 10 );
-  m_hl2->setColStretch( 3, 5 );
-  m_hl2->addWidget( m_pb4, 0, 4 );
+  // Info
+  QVBoxLayout* infoLayout = new QVBoxLayout();
+  infoLayout->setMargin( 0 ); infoLayout->setSpacing( 6 );
+  
+  // --> top line
+  QFrame* myLine1 = new QFrame( this, "myLine1" );
+  myLine1->setFrameStyle( QFrame::HLine | QFrame::Plain );
+  // --> info label  
+  myInfoLabel = new QLabel( tr ("ActivateComponent_DESCRIPTION"), this, "myInfoLabel" );
+  myInfoLabel->setAlignment( AlignCenter );
+  // --> bottom line
+  QFrame*  myLine2 = new QFrame( this, "myLine2" );
+  myLine2->setFrameStyle( QFrame::HLine | QFrame::Plain );
   
-  m_vbL->addLayout( m_hl1 );
-  m_vbL->addLayout( m_hl2 );
+  infoLayout->addStretch();
+  infoLayout->addWidget( myLine1 );
+  infoLayout->addWidget( myInfoLabel );
+  infoLayout->addWidget( myLine2 );
+  infoLayout->addStretch();
+  
+  // Buttons
+  QHBoxLayout* btnLayout = new QHBoxLayout(); 
+  btnLayout->setMargin( 0 ); btnLayout->setSpacing( 6 );
+  
+  // --> New
+  myNewBtn = new QPushButton( tr( "NEW" ), this, "myNewBtn" );
+  myNewBtn->setDefault( true ); myNewBtn->setAutoDefault( true );
+  // --> Open
+  myOpenBtn = new QPushButton( tr( "OPEN" ), this, "myOpenBtn" );
+  myOpenBtn->setAutoDefault( true );
+  // --> Load
+  myLoadBtn = new QPushButton( tr( "LOAD" ), this, "myLoadBtn" );
+  myLoadBtn->setAutoDefault( true );
+  // --> Cancel
+  myCancelBtn = new QPushButton( tr( "CANCEL" ), this, "myCancelBtn" );
+  myCancelBtn->setAutoDefault( true );
+  
+  btnLayout->addWidget( myNewBtn );
+  btnLayout->addWidget( myOpenBtn );
+  btnLayout->addWidget( myLoadBtn );
+  btnLayout->addStretch();
+  btnLayout->addSpacing( 70 );
+  btnLayout->addStretch();
+  btnLayout->addWidget( myCancelBtn );
+
+  ActivateModuleDlgLayout->addWidget(          myComponentFrame, 0,    0    );
+  ActivateModuleDlgLayout->addLayout(          infoLayout,       0,    1    );
+  ActivateModuleDlgLayout->addMultiCellLayout( btnLayout,        1, 1, 0, 1 );
 
-  connect( m_pb1, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) );
-  connect( m_pb2, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) );
-  connect( m_pb3, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) );
-  connect( m_pb4, SIGNAL( clicked() ), this, SLOT( reject() ) );
+  // signals and slots connections
+  connect( myNewBtn,    SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) );
+  connect( myOpenBtn,   SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) );
+  connect( myLoadBtn,   SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) );
+  connect( myCancelBtn, SIGNAL( clicked() ), this, SLOT( reject() ) );
 }
 
+//==============================================================================================================================
+/*!
+ *  SALOMEGUI_ActivateComponentDlg::onButtonClicked
+ *
+ *  Buttons slot
+ */
+//==============================================================================================================================
 void SALOMEGUI_ActivateComponentDlg::onButtonClicked()
 {
   QPushButton* btn = ( QPushButton* )sender();
-  if ( btn == m_pb1 )
+  if ( btn == myNewBtn )
     done( 1 );
-  if ( btn == m_pb2 )
+  if ( btn == myOpenBtn )
     done( 2 );
-  if ( btn == m_pb3 )
+  if ( btn == myLoadBtn )
     done( 3 );
 }
index 17544d0a242c2339c470c6f520033b91e93b19bd..878cb9d08c3b489d46d86dfc2452efd90876f738 100644 (file)
 #define SALOMEGUI_ActivateComponentDlg_H
 
 #include <qdialog.h> 
+#include <qpixmap.h>
+
+class QFrame;
+class QLabel;
+class QPushButton;
 
 class SALOMEGUI_ActivateComponentDlg: public QDialog
 {
   Q_OBJECT
 
 public:
-  SALOMEGUI_ActivateComponentDlg ( QWidget * parent = 0, const char * name = 0, bool modal = FALSE, WFlags f = 0 ) ;
+  SALOMEGUI_ActivateComponentDlg ( QWidget* parent, const QString& component, const QPixmap icon = QPixmap() ) ;
   ~SALOMEGUI_ActivateComponentDlg ( ) { };
 
 private slots:
   void onButtonClicked();
 
 private:
-  QPushButton* m_pb1;
-  QPushButton *m_pb2;
-  QPushButton *m_pb3;
-  QPushButton *m_pb4;
+    QFrame*      myComponentFrame;
+    QLabel*      myComponentLab;
+    QLabel*      myComponentIcon;
+    QLabel*      myInfoLabel;
+    QPushButton* myNewBtn;
+    QPushButton* myOpenBtn;
+    QPushButton* myLoadBtn;
+    QPushButton* myCancelBtn;
 };
 
 #endif
index 9ad17ddc1508c942b8e4fdf6241c076599c7c7e1..2cb58f8580f1530eec0f8d54b1c582ef53a0c71d 100644 (file)
@@ -1,7 +1,7 @@
 //  File   : SALOMEGUI_ExternalBrowserDlg.cxx
 //  Author : Nichael ZORIN
 //  Module : SALOME
-//  $Header: /dn05/salome/CVS/SALOME_ROOT/SALOME/src/SALOMEGUI/SALOMEGUI_ExternalBrowserDlg.cxx
+//  $Header$
 
 using namespace std;
 #include "SALOMEGUI_ExternalBrowserDlg.h"
index 95156994bf452eee812a7162ea1c8693db828c07..f92b559c44a5e0a17a612d99bad003c7d735826d 100644 (file)
@@ -1,7 +1,7 @@
 //  File   : SALOMEGUI_ExternalBrowserDlg.h
 //  Author : Michael Zorin
 //  Module : SALOME
-//  $Header: /dn05/salome/CVS/SALOME_ROOT/SALOME/src/SALOMEGUI/SALOMEGUI_ExternalBrowserDlg.h
+//  $Header$
 
 #ifndef SALOMEGUI_EXTERNAL_BROWSER_DLG_H
 #define SALOMEGUI_EXTERNAL_BROWSER_DLG_H
index 35d4b476fc1e6a541d03af5a735b441bdd50e672..841e42f9bf7d71f07d2893d913e003fd807c5cb7 100644 (file)
@@ -97,7 +97,8 @@ SALOMEGUI_NameDlg::~SALOMEGUI_NameDlg()
 void SALOMEGUI_NameDlg::setName( const QString& name )
 {
   myLineEdit->setText( name );
-  myLineEdit->selectAll();
+  myLineEdit->end(false);
+  myLineEdit->home(true);
 }
 
 /*!
@@ -108,6 +109,13 @@ QString SALOMEGUI_NameDlg::name()
   return myLineEdit->text();
 }
 
+void SALOMEGUI_NameDlg::accept()
+{
+  if ( name().stripWhiteSpace().isEmpty() )
+    return;
+  QDialog::accept();
+}
+
 /*!
   Creates modal <Rename> dialog and returns name entered [ static ]
 */
index 42ec8382db7d616452af02068036bc18015f82b5..23fa03eb2a25805888b2a114d17aec3e5ac6d6d6 100644 (file)
@@ -34,6 +34,9 @@ public:
     
   static QString  getName( QWidget* parent = 0, const QString& oldName = QString::null );
     
+protected slots:
+  void accept();
+  
 private:
   QPushButton*    myButtonOk;
   QPushButton*    myButtonCancel;
index 77cde23402ba8829a9286926e38601b6e94580e1..1638bdbb9219bb88ed69be660a5bd9f9db7927f2 100644 (file)
@@ -92,6 +92,7 @@ SALOMEGUI_OpenWith::SALOMEGUI_OpenWith(QWidget* parent,  const char* name)
   connect( buttonOk,      SIGNAL( clicked() ),          this, SLOT( accept() ) );
   connect( buttonCancel,  SIGNAL( clicked() ),          this, SLOT( reject() ) );
   connect( ListComponent, SIGNAL( selectionChanged() ), this, SLOT( onSelectionChanged() ));
+  connect( ListComponent, SIGNAL( doubleClicked( QListBoxItem* ) ), this, SLOT( onDoubleClickEvent( QListBoxItem* ) ));
 
   updateButtonState();
 }
@@ -135,3 +136,9 @@ void SALOMEGUI_OpenWith:: updateButtonState()
   buttonOk->setEnabled( ListComponent->currentItem() >=0 && 
                        ListComponent->currentItem() < ListComponent->count() ) ;
 }
+
+void SALOMEGUI_OpenWith::onDoubleClickEvent( QListBoxItem* item )
+{
+  if ( item )
+    accept();
+}
index 961dcb8d417931b8ba67daf91a024f2e5ff5a85c..b71ac6e08dd764aad49736469876339ec36b8f31 100644 (file)
@@ -32,6 +32,7 @@
 #include <qdialog.h>
 
 class QListBox;
+class QListBoxItem;
 class QCheckBox;
 class QPushButton;
 
@@ -49,10 +50,11 @@ public:
   
 protected slots:
   void      onSelectionChanged();
+  void      onDoubleClickEvent( QListBoxItem* item );
 
 protected:
   void      updateButtonState();
-
 protected:
   QListBox*    ListComponent;
   QCheckBox*   AllwaysCheckBox; 
index 7103d349a1c6adf0411515b557e821c5301a45a8..00f6efb08f9dada8ffa8aa8575f29a6181e8256c 100644 (file)
@@ -374,7 +374,7 @@ bool SALOMEGUI_Swig::IsInCurrentView(const char *Entry)
       if ((viewId >=0) && (viewId <nbStudyFrames))
        myRenderer = myStudy->getStudyFrame(viewId)->getRightFrame()->getViewFrame()->getRenderer();
     }
-  if (myRenderer == NULL) INFOS("No VTK Renderer available !");
+  if (myRenderer == NULL) MESSAGE("No VTK Renderer available !");
   return myRenderer;
 }
 */
index 311b6075fe9ac8a5243e94995d8d056ba09951cd..e050c3f4b5da1b5f572e5580f877bb27f5a82b23 100644 (file)
@@ -646,9 +646,15 @@ msgid "MEN_PLOT2D_SETTINGS"
 msgstr "&Settings"
 msgid "PRP_PLOT2D_SETTINGS"
 msgstr "Setups view properties"
+msgid "TOT_PLOT2D_CHANGE_BACKGROUND"
+msgstr "Change background"
+msgid "MEN_PLOT2D_CHANGE_BACKGROUND"
+msgstr "Change background..."
+msgid "PRP_PLOT2D_CHANGE_BACKGROUND"
+msgstr "Change background color"
 
 msgid "INF_COORDINATES"
-msgstr "Coordinates"
+msgstr "Coordinates: X : %1, Y : %2"
 
 msgid "SALOMEGUI_SetupCurveDlg::TLT_SETUP_CURVE"
 msgstr "Setup Curve"
@@ -694,7 +700,7 @@ msgid "SALOMEGUI_ActivateComponentDlg::CANCEL"
 msgstr "&Cancel"
 
 msgid "SALOMEGUI_ActivateComponentDlg::ActivateComponent_DESCRIPTION"
-msgstr "You need to create, open or load study before."
+msgstr "Create, open or load study."
 
 msgid "SALOMEGUI_HELP_TITLE"
 msgstr "SALOME Help"
index 861a7ac6340b3907fa51ef9bc2c3263005e414a3..e028e243ffa487872790ca787572baa45fcf72d1 100644 (file)
@@ -90,8 +90,10 @@ Standard_EXPORT   void Clear() ;
 Standard_EXPORT   Standard_Boolean IsEmpty() const;
 Standard_EXPORT   void Prepend(const Handle(SALOME_InteractiveObject)& I) ;
 Standard_EXPORT   void Prepend(SALOME_ListIO& Other) ;
+Standard_EXPORT   void Prepend(const Handle(SALOME_InteractiveObject)& I, SALOME_ListIteratorOfListIO& It) ;
 Standard_EXPORT   void Append(const Handle(SALOME_InteractiveObject)& I) ;
 Standard_EXPORT   void Append(SALOME_ListIO& Other) ;
+Standard_EXPORT   void Append(const Handle(SALOME_InteractiveObject)& I, SALOME_ListIteratorOfListIO& It) ;
 Standard_EXPORT   Handle_SALOME_InteractiveObject& First() const;
 Standard_EXPORT   Handle_SALOME_InteractiveObject& Last() const;
 Standard_EXPORT   void RemoveFirst() ;
index 7b4b9c2ac1727a2c4fe42779ccd1751db44b352c..1024a21597d8cd354c447ea56ba6bb37ebbd3731 100644 (file)
@@ -94,8 +94,10 @@ Standard_EXPORT   void Clear() ;
 Standard_EXPORT inline   Standard_Boolean IsEmpty() const;
 Standard_EXPORT   void Prepend(const Handle(SALOME_Filter)& I) ;
 Standard_EXPORT   void Prepend(SALOME_ListOfFilter& Other) ;
+Standard_EXPORT   void Prepend(const Handle(SALOME_Filter)& I, SALOME_ListIteratorOfListOfFilter& It) ;
 Standard_EXPORT   void Append(const Handle(SALOME_Filter)& I) ;
 Standard_EXPORT   void Append(SALOME_ListOfFilter& Other) ;
+Standard_EXPORT   void Append(const Handle(SALOME_Filter)& I, SALOME_ListIteratorOfListOfFilter& It) ;
 Standard_EXPORT   Handle_SALOME_Filter& First() const;
 Standard_EXPORT   Handle_SALOME_Filter& Last() const;
 Standard_EXPORT   void RemoveFirst() ;
index 3e79a6c6d99060ac9b45703810c97e832cbac06a..21fa00996faf9c70f42a1accb4a21347b1ecc7dc 100644 (file)
@@ -41,6 +41,8 @@ using namespace std;
 #include "QAD_Desktop.h"
 #include "utilities.h"
 
+#include <TColStd_MapIteratorOfMapOfInteger.hxx>
+
 static QList<SALOME_Selection>&  SALOME_Sel_GetSelections()
 {
   static QList<SALOME_Selection> Selections;
@@ -59,7 +61,7 @@ SALOME_Selection::SALOME_Selection(const QString& aName) :
 {
   myFilters.Clear();
   myIObjects.Clear();
-  mySelectionMode = 4; /*Actor*/
+  mySelectionMode = ActorSelection; /*4*/
   mySelActiveCompOnly = false;
   
   QAD_Desktop* aDesktop = QAD_Application::getDesktop();
@@ -328,13 +330,13 @@ bool SALOME_Selection::IsOk(const Handle(SALOME_InteractiveObject)& anObj)
   return true;
 }
 
-void SALOME_Selection::SetSelectionMode(int mode, bool activeCompOnly)
+void SALOME_Selection::SetSelectionMode(Selection_Mode mode, bool activeCompOnly)
 {
   mySelectionMode = mode;
   mySelActiveCompOnly = activeCompOnly;
 }
 
-int SALOME_Selection::SelectionMode()
+Selection_Mode SALOME_Selection::SelectionMode()
 {
   return mySelectionMode;
 }
@@ -378,7 +380,7 @@ bool SALOME_Selection::AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)&
                                         bool modeShift,
                                         bool update)
 {
-  MESSAGE ( " SALOME_Selection::AddOrRemoveIndex " << index << " - " << modeShift )
+  MESSAGE ( " SALOME_Selection::AddOrRemoveIndex " << index << " - " << modeShift );
   QAD_Desktop*   myDesktop = (QAD_Desktop*) QAD_Application::getDesktop();
   QAD_Study* myActiveStudy = myDesktop->getActiveStudy();
 
@@ -412,6 +414,86 @@ bool SALOME_Selection::AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)&
   return false;
 }
 
+bool SALOME_Selection::AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& IObject, 
+                                        const TColStd_MapOfInteger& theIndices, 
+                                        bool modeShift,
+                                        bool update)
+{
+  QAD_Desktop*   myDesktop = (QAD_Desktop*) QAD_Application::getDesktop();
+  QAD_Study* myActiveStudy = myDesktop->getActiveStudy();
+  
+  if ( !myMapIOSubIndex.IsBound( IObject ) ) {
+    TColStd_MapOfInteger Empty;
+    myMapIOSubIndex.Bind( IObject, Empty );
+  }
+  TColStd_MapOfInteger& 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)
+    MapIndex.Clear();
+  
+  if (add) 
+    for(;It.More();It.Next())
+      MapIndex.Add(It.Key());
+  else
+    for(;It.More();It.Next())
+      MapIndex.Remove(It.Key());
+  
+  
+  myActiveStudy->highlight( IObject, true, update );   
+  if ( MapIndex.IsEmpty() )  myMapIOSubIndex.UnBind( IObject );
+  emit currentSelectionChanged();
+  
+  return add;
+}
+
+bool SALOME_Selection::AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& IObject, 
+                                        const std::vector<int>& theIndices, 
+                                        bool modeShift,
+                                        bool update)
+{
+  QAD_Desktop*   myDesktop = (QAD_Desktop*) QAD_Application::getDesktop();
+  QAD_Study* myActiveStudy = myDesktop->getActiveStudy();
+  
+  if ( !myMapIOSubIndex.IsBound( IObject ) ) {
+    TColStd_MapOfInteger Empty;
+    myMapIOSubIndex.Bind( IObject, Empty );
+  }
+  TColStd_MapOfInteger& MapIndex = myMapIOSubIndex.ChangeFind( IObject );
+      
+  bool add = true;
+  
+  if (MapIndex.Contains(theIndices[0]))
+    {
+      if (!modeShift) return add;
+      add = false;
+    }
+  else 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() )  
+    myMapIOSubIndex.UnBind( IObject );
+  emit currentSelectionChanged();
+  
+  return add;
+}
+
 void SALOME_Selection::RemoveIndex( const Handle(SALOME_InteractiveObject)& IObject, int index )
 {
   if ( myMapIOSubIndex.IsBound( IObject ) ) {
index 6c0eca8a65ece1dc62978323bb5d93fb7c1c6e01..0058a1984c816667574ee9778300b7781adb58f9 100644 (file)
 // Open CASCADE Include
 #include <TColStd_MapOfInteger.hxx>
 
+#include <vector>
+
+enum Selection_Mode { 
+ NodeSelection, 
+ CellSelection,
+ EdgeOfCellSelection,
+ EdgeSelection, 
+ FaceSelection, 
+ VolumeSelection, 
+ ActorSelection };
+
 class SALOME_Selection : public QObject
 {
   Q_OBJECT
     
 public:
+
        SALOME_Selection(const QString& aName);
        ~SALOME_Selection();
 
@@ -78,8 +90,8 @@ public:
        bool                       IsOk( const Handle(SALOME_InteractiveObject)& IObject ) ;
 
 
-       void                       SetSelectionMode(int mode, bool activeCompOnly = false);
-       int                        SelectionMode();
+       void                       SetSelectionMode(Selection_Mode mode, bool activeCompOnly = false);
+       Selection_Mode             SelectionMode();
         bool                       IsSelectActiveCompOnly() const;
        
        bool                        HasIndex( const Handle(SALOME_InteractiveObject)& IObject );
@@ -87,6 +99,8 @@ public:
                                             TColStd_MapOfInteger& theIndex );
        
        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 );
        void                        RemoveIndex( const Handle(SALOME_InteractiveObject)& IObject, int index );
        bool                        IsIndexSelected(const Handle(SALOME_InteractiveObject)& IObject, int index);
 
@@ -100,7 +114,7 @@ private:
 
        SALOME_DataMapOfIOMapOfInteger myMapIOSubIndex;
 
-       int                   mySelectionMode;
+       Selection_Mode        mySelectionMode;
         bool                  mySelActiveCompOnly;
 };
 
index 4946923240b74d38e2457de8306bc9f3e227723d..017c546470270ffd23e42b5515bb92ca3a77616e 100644 (file)
@@ -125,7 +125,7 @@ void initlibSalomePy()
       if ((viewId >=0) && (viewId <nbStudyFrames))
        renderer = ((VTKViewer_ViewFrame*)myStudy->getStudyFrame(viewId)->getRightFrame()->getViewFrame())->getRenderer();
     }
-  if (renderer == NULL) INFOS("No VTK Renderer available !");
+  if (renderer == NULL) MESSAGE("No VTK Renderer available !");
   //san:T3.13 - move getRenderer() implementation here
 
   MESSAGE("---");
index 6d6e6b92a95cc66a1cf53bb62af5695977a260e5..dc3ff8b41aa8401801426d1725c5e1490c3f2df0 100644 (file)
@@ -90,7 +90,7 @@ static void initInterp(int StudyID)
   module=PyImport_ImportModule((char*)_moduleName.c_str());
   if(module == NULL)
     {
-      INFOS ( " Problem... " );
+      MESSAGE ( " Problem... " );
       PyErr_Print();
       interp->quit();
       return;
index 463aff9be6c2d591178304af84c9e6fe76226c04..a6a7753edbc2d3d0eec57a67963534077a74e632 100644 (file)
@@ -57,14 +57,30 @@ class SalomeGUI(SALOMEGUI_Swig):
     #--------------------------------------------------------------------------
 
 def IDToObject(id):
+    myObj = None
     mySO = myStudy.FindObjectID(id);
-    print id
-    Builder = myStudy.NewBuilder()
-    anAttr = Builder.FindOrCreateAttribute(mySO, "AttributeIOR")
-    AtIOR = anAttr._narrow(SALOMEDS.AttributeIOR)
-    myObj = orb.string_to_object(AtIOR.Value())
+    if mySO is not None:
+        ok, anAttr = mySO.FindAttribute("AttributeIOR")
+        if ok:
+            AtIOR = anAttr._narrow(SALOMEDS.AttributeIOR)
+            if AtIOR.Value() != "":
+                myObj = orb.string_to_object(AtIOR.Value())
     return myObj
 
+def ObjectToSObject(obj):
+    mySO = None
+    if obj is not None:
+        ior =  orb.object_to_string(obj)
+        if ior != "":
+            mySO = myStudy.FindObjectIOR(ior)
+    return mySO
+
+def ObjectToID(obj):
+    mySO = ObjectToSObject(obj)
+    if mySO:
+        return mySO.GetID()
+    return ""
+
 def IDToSObject(id):
     mySO = myStudy.FindObjectID(id);
     return mySO
index 92a99f11f2b1e3e4de6d6634c8092a2e45753c3d..9d45865db4dcbee1c1ce40609c671a340de07534 100644 (file)
@@ -99,13 +99,30 @@ class SalomeGUI(SALOMEGUI_Swig):
     #--------------------------------------------------------------------------
 
 def IDToObject(id):
+    myObj = None
     mySO = myStudy.FindObjectID(id);
-    Builder = myStudy.NewBuilder()
-    anAttr = Builder.FindOrCreateAttribute(mySO, "AttributeIOR")
-    AtIOR = anAttr._narrow(SALOMEDS.AttributeIOR)
-    myObj = orb.string_to_object(AtIOR.Value())
+    if mySO is not None:
+        ok, anAttr = mySO.FindAttribute("AttributeIOR")
+        if ok:
+            AtIOR = anAttr._narrow(SALOMEDS.AttributeIOR)
+            if AtIOR.Value() != "":
+                myObj = orb.string_to_object(AtIOR.Value())
     return myObj
 
+def ObjectToSObject(obj):
+    mySO = None
+    if obj is not None:
+        ior =  orb.object_to_string(obj)
+        if ior != "":
+            mySO = myStudy.FindObjectIOR(ior)
+    return mySO
+
+def ObjectToID(obj):
+    mySO = ObjectToSObject(obj)
+    if mySO:
+        return mySO.GetID()
+    return ""
+
 def IDToSObject(id):
     mySO = myStudy.FindObjectID(id);
     return mySO
index 31b7f308f475f09679164ac33cc48f63d99b9dca..6fa96a9f7691bf4862ff97258ee5dbd75c2ad358 100644 (file)
@@ -59,6 +59,8 @@ print
 print "=============  Test SMESH  ============================="
 print
 
+import StdMeshers
+
 comp = catalog.GetComponent("SMESH")
 if comp is None:
        raise RuntimeError,"Component SMESH not found in Module Catalog."
@@ -68,11 +70,11 @@ if comp is None:
        raise RuntimeError,"Component MED not found in Module Catalog."
 
 import SMESH
-import smeshpy
 
 geom = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM")
 myBuilder = salome.myStudy.NewBuilder()
 
+smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH")
 smeshgui = salome.ImportComponentGUI("SMESH")
 smeshgui.Init(salome.myStudyId);
 
@@ -113,138 +115,107 @@ name = geompy.SubShapeName( edge._get_Name(), face._get_Name() )
 print name
 idedge=geompy.addToStudyInFather(face,edge,name)
 
-# ---- launch SMESH, init a Mesh with the box
-gen=smeshpy.smeshpy()
-mesh=gen.Init(idbox)
 
-idmesh = smeshgui.AddNewMesh( salome.orb.object_to_string(mesh) )
-smeshgui.SetName(idmesh, "Meshbox");
-smeshgui.SetShape(idbox, idmesh);
+# ---- SMESH 
 
 # ---- create Hypothesis
 
 print "-------------------------- create Hypothesis"
 print "-------------------------- LocalLength"
-hyp1=gen.CreateHypothesis("LocalLength")
-hypLen1 = hyp1._narrow(SMESH.SMESH_LocalLength)
+hypLen1 = smesh.CreateHypothesis( "LocalLength", "libStdMeshersEngine.so" )
 hypLen1.SetLength(100)
 print hypLen1.GetName()
 print hypLen1.GetId()
 print hypLen1.GetLength()
 
-idlength = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypLen1) );
-smeshgui.SetName(idlength, "Local_Length_100");
+smeshgui.SetName(salome.ObjectToID(hypLen1), "Local_Length_100")
 
 print "-------------------------- NumberOfSegments"
-hyp2=gen.CreateHypothesis("NumberOfSegments")
-hypNbSeg1=hyp2._narrow(SMESH.SMESH_NumberOfSegments)
+hypNbSeg1= smesh.CreateHypothesis( "NumberOfSegments", "libStdMeshersEngine.so" )
 hypNbSeg1.SetNumberOfSegments(7)
 print hypNbSeg1.GetName()
 print hypNbSeg1.GetId()
 print hypNbSeg1.GetNumberOfSegments()
 
-idseg = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypNbSeg1) );
-smeshgui.SetName(idseg, "NumberOfSegments_7");
+smeshgui.SetName(salome.ObjectToID(hypNbSeg1), "NumberOfSegments_7")
 
 print "-------------------------- MaxElementArea"
-hyp3=gen.CreateHypothesis("MaxElementArea")
-hypArea1=hyp3._narrow(SMESH.SMESH_MaxElementArea)
+hypArea1 = smesh.CreateHypothesis( "MaxElementArea", "libStdMeshersEngine.so" )
 hypArea1.SetMaxElementArea(2500)
 print hypArea1.GetName()
 print hypArea1.GetId()
 print hypArea1.GetMaxElementArea()
 
-idarea1 = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypArea1) );
-smeshgui.SetName(idarea1, "MaxElementArea_2500");
+smeshgui.SetName(salome.ObjectToID(hypArea1), "MaxElementArea_2500")
 
 print "-------------------------- MaxElementArea"
-hyp3=gen.CreateHypothesis("MaxElementArea")
-hypArea2=hyp3._narrow(SMESH.SMESH_MaxElementArea)
+hypArea2 = smesh.CreateHypothesis( "MaxElementArea", "libStdMeshersEngine.so" )
 hypArea2.SetMaxElementArea(500)
 print hypArea2.GetName()
 print hypArea2.GetId()
 print hypArea2.GetMaxElementArea()
 
-idarea2 = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypArea2) );
-smeshgui.SetName(idarea2, "MaxElementArea_500");
+smeshgui.SetName(salome.ObjectToID(hypArea2), "MaxElementArea_500")
 
 print "-------------------------- Regular_1D"
-alg1=gen.CreateHypothesis("Regular_1D")
-algo1=alg1._narrow(SMESH.SMESH_Algo)
-listHyp=algo1.GetCompatibleHypothesis()
+algoReg = smesh.CreateHypothesis( "Regular_1D", "libStdMeshersEngine.so" )
+listHyp=algoReg.GetCompatibleHypothesis()
 for hyp in listHyp:
     print hyp
-algoReg=alg1._narrow(SMESH.SMESH_Regular_1D)
 print algoReg.GetName()
 print algoReg.GetId()
 
-idreg = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(algoReg) );
-smeshgui.SetName(idreg, "Regular_1D");
+smeshgui.SetName(salome.ObjectToID(algoReg), "Regular_1D" )
 
 print "-------------------------- MEFISTO_2D"
-alg2=gen.CreateHypothesis("MEFISTO_2D")
-algo2=alg2._narrow(SMESH.SMESH_Algo)
-listHyp=algo2.GetCompatibleHypothesis()
+algoMef = smesh.CreateHypothesis( "MEFISTO_2D", "libStdMeshersEngine.so" )
+listHyp=algoMef.GetCompatibleHypothesis()
 for hyp in listHyp:
     print hyp
-algoMef=alg2._narrow(SMESH.SMESH_MEFISTO_2D)
 print algoMef.GetName()
 print algoMef.GetId()
 
-idmef = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(algoMef) );
-smeshgui.SetName(idmef, "MEFISTO_2D");
+smeshgui.SetName(salome.ObjectToID(algoMef), "MEFISTO_2D" )
+
+# ---- add hypothesis to box
+
+print "-------------------------- add hypothesis to box"
+box=salome.IDToObject(idbox)
+mesh = smesh.CreateMesh(box)
+
+smeshgui.SetName( salome.ObjectToID(mesh), "MeshBox" );
+
+ret=mesh.AddHypothesis(box,algoReg)
+print ret
+ret=mesh.AddHypothesis(box,algoMef)
+print ret
+
+
+ret=mesh.AddHypothesis(box,hypNbSeg1)
+print ret
+ret=mesh.AddHypothesis(box,hypArea1)
+print ret
+
 
 # ---- add hypothesis to edge
 
 print "-------------------------- add hypothesis to edge"
 edge=salome.IDToObject(idedge)
-submesh=mesh.GetElementsOnShape(edge)
+submesh=mesh.GetSubMesh(edge, "SubMeshEdge")
+
 ret=mesh.AddHypothesis(edge,algoReg)
 print ret
 ret=mesh.AddHypothesis(edge,hypLen1)
 print ret
 
-idsm1 = smeshgui.AddSubMeshOnShape( idmesh,
-                                    idedge,
-                                    salome.orb.object_to_string(submesh),
-                                    ShapeTypeEdge )
-smeshgui.SetName(idsm1, "SubMeshEdge")
-smeshgui.SetAlgorithms( idsm1, idreg );
-smeshgui.SetHypothesis( idsm1, idlength );
-
 print "-------------------------- add hypothesis to face"
 face=salome.IDToObject(idface)
-submesh=mesh.GetElementsOnShape(face)
-ret=mesh.AddHypothesis(face,hypArea2)
-print ret
-
-idsm2 = smeshgui.AddSubMeshOnShape( idmesh,
-                                    idface,
-                                    salome.orb.object_to_string(submesh),
-                                    ShapeTypeFace )
-smeshgui.SetName(idsm2, "SubMeshFace")
-smeshgui.SetHypothesis( idsm2, idarea2 );
+submesh   = mesh.GetSubMesh(face, "SubMeshFace")
 
-# ---- add hypothesis to box
-
-print "-------------------------- add hypothesis to box"
-box=salome.IDToObject(idbox)
-submesh=mesh.GetElementsOnShape(box)
-ret=mesh.AddHypothesis(box,algoReg)
-print ret
-ret=mesh.AddHypothesis(box,hypNbSeg1)
-print ret
-ret=mesh.AddHypothesis(box,algoMef)
-print ret
-ret=mesh.AddHypothesis(box,hypArea1)
+ret=mesh.AddHypothesis(face,hypArea2)
 print ret
 
-smeshgui.SetAlgorithms( idmesh, idreg );
-smeshgui.SetHypothesis( idmesh, idseg );
-smeshgui.SetAlgorithms( idmesh, idmef );
-smeshgui.SetHypothesis( idmesh, idarea1 );
-
-gen.Compute(mesh, idbox)
+smesh.Compute(mesh, box)
 sg.updateObjBrowser(1);
 
 print
@@ -460,8 +431,8 @@ import VISU
 
 import visu_gui
 
-medFile = "pointe.med"
-medFile = os.getenv('KERNEL_ROOT_DIR') + '/examples/' + medFile
+medFileName = "pointe.med"
+medFile = os.getenv('KERNEL_ROOT_DIR') + '/examples/' + medFileName
 print "Load ", medFile
 
 studyCurrent = salome.myStudyName
@@ -473,10 +444,11 @@ try:
     if os.access(medFile, os.R_OK) :
        if not os.access(medFile, os.W_OK) :
               import random
-              medFileNew = "/tmp/" + str(random.randint(0,1000000)) + "_" + medfile
+              medFileNew = "/tmp/" + str(random.randint(0,1000000)) + "_" + medFileName
               print " -- Copy " + medFile + " to " + medFileNew
               os.system("cp "+ medFile + " " + medFileNew)
               medFile = medFileNew
+              os.system("chmod 755 " + medFile)
 
        if os.access(medFile, os.W_OK) :
            med_comp.readStructFileWithFieldType(medFile,studyCurrent)
index 01fa60ce26cbf4ab7f2cccd8a2c5fcde6d1c84e8..7a73fff3efa17bd3f579fd9221624fd2fb1a5b22 100644 (file)
@@ -249,7 +249,7 @@ QColor SUPERVGraph_ViewFrame::backgroundColor() const
 }
 
 
-void SUPERVGraph_ViewFrame::SetSelectionMode( int mode )
+void SUPERVGraph_ViewFrame::SetSelectionMode( Selection_Mode mode )
 {
   MESSAGE ( "SUPERVGraph_ViewFrame::SetSelectionMode" )
 }
index 8c62cc436096492c2dcfc4ef079f19af9620b1b1..42aeafdf3a73e460bac6a82d04bb3155bd3c1981 100644 (file)
@@ -34,6 +34,7 @@
 #include "QAD_Application.h"
 
 #include "SALOME_InteractiveObject.hxx"
+#include "SALOME_Selection.h" 
 
 class QAD_EXPORT SUPERVGraph_View: public QWidget, public QAD_PopupClientServer{
   Q_OBJECT;
@@ -62,7 +63,7 @@ class QAD_EXPORT SUPERVGraph_ViewFrame : public QAD_ViewFrame {
   void                           setBackgroundColor( const QColor& );
   QColor                         backgroundColor() const;
   
-  void                           SetSelectionMode( int mode );
+  void                           SetSelectionMode( Selection_Mode mode );
 
   void                           onAdjustTrihedron( );
   
index 8531be10fc1e303a8a0adeb9e5bdf8f293d46a42..9229ba2741372b5e9688a48eca9ed00f70844b53 100644 (file)
@@ -44,7 +44,8 @@ using namespace std;
 #include "QAD_ResourceMgr.h"
 #include <qlabel.h>
 
-
+#include "Utils_CatchSignals.h"
+#include "Utils_CorbaException.hxx"
 #include <SALOMEconfig.h>
 #include CORBA_SERVER_HEADER(SALOMEDS)
 
@@ -63,24 +64,24 @@ SALOME_Session_QThread::SALOME_Session_QThread(int argc, char ** argv) : QThread
   _NS = 0 ;
 } ;
 
+
 //=============================================================================
 /*! run
  *  Creates one QApplication for the all the session life.
  *  Executes the Qt main window of the GUI on a separate thread
  */
 //=============================================================================
-
 void SALOME_Session_QThread::run()
 {
   if (_qappl == 0)
     {
       _qappl = new QApplication(_argc, _argv );
-      INFOS("creation QApplication");
+      MESSAGE("creation QApplication");
     }
 
   QAD_ASSERT ( QObject::connect(_qappl, SIGNAL(lastWindowClosed()), _qappl, SLOT(quit()) ) );
   _mw = new SALOMEGUI_Application ( "MDTV-Standard", "HDF", "hdf" );
-  INFOS("creation SALOMEGUI_Application");
+  MESSAGE("creation SALOMEGUI_Application");
   
   if ( !SALOMEGUI_Application::addToDesktop ( _mw, _NS ) )
     {
@@ -100,26 +101,59 @@ void SALOME_Session_QThread::run()
 
       _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")
+         MESSAGE("run(): starting the main event loop");
          _ret = _qappl->exec();
          break;
        }
+       catch (SALOME::SALOME_Exception& e) {
+         INFOS("run(): SALOME::SALOME_Exception is caught");
+         QApplication::restoreOverrideCursor();
+         QAD_MessageBox::error1 ( (QWidget*)QAD_Application::getDesktop(),
+                                 QObject::tr("ERR_ERROR"), 
+                                 QObject::tr("ERR_APP_EXCEPTION")+ QObject::tr(" SALOME::SALOME_Exception is caught") ,
+                                 QObject::tr("BUT_OK") );
+         
+       }
        catch(SALOMEDS::StudyBuilder::LockProtection&) {
-         MESSAGE("run(): An attempt to modify a locked study has not been handled by QAD_Operation")
+         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("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(...) {
-         MESSAGE("run(): An exception has been caught")
+         INFOS("run(): An exception has been caught")
          QApplication::restoreOverrideCursor();
          QAD_MessageBox::error1 ( (QWidget*)QAD_Application::getDesktop(),
                               QObject::tr("ERR_ERROR"), 
@@ -127,7 +161,8 @@ void SALOME_Session_QThread::run()
                               QObject::tr("BUT_OK") );
        }
       }
-
+      
+      aCatch.Deactivate();
       QString confMsg = "Settings create $HOME/." + QObject::tr("MEN_APPNAME") + "/" + QObject::tr("MEN_APPNAME") + ".conf";
       MESSAGE (confMsg )
       QAD_CONFIG->createConfigFile(true);
index 2b00367c27fd2e68b62b9e2b4aed275d87a00817..5294abd9410b3d920f40d78bf2512d68c0e1bdc2 100644 (file)
@@ -103,7 +103,7 @@ int main(int argc, char **argv)
          }
        catch( CORBA::COMM_FAILURE& )
          {
-           MESSAGE( "Session Server: CORBA::COMM_FAILURE: Unable to contact the Naming Service" );
+           INFOS( "Session Server: CORBA::COMM_FAILURE: Unable to contact the Naming Service" );
          }
        if(!CORBA::is_nil(inc))
          {
@@ -119,11 +119,11 @@ int main(int argc, char **argv)
                        object = inc->resolve(name);
                      }
                    catch(CosNaming::NamingContext::NotFound)
-                     { MESSAGE( "Session Server: Logger Server wasn't found" );
+                     { INFOS( "Session Server: Logger Server wasn't found" );
                      }
                    catch(...)
                      {
-                       MESSAGE( "Session Server: Unknown exception" ); 
+                       INFOS( "Session Server: Unknown exception" ); 
                      }
                    if (!CORBA::is_nil(object))
                      {
index 5c774aa8e58845af76da12b9978305152a9a5f8b..557ca8fb1fdb849b0d3e2aecf2e7a1c15ee6af3f 100644 (file)
@@ -123,8 +123,6 @@ ToolsGUI_CatalogGeneratorDlg::ToolsGUI_CatalogGeneratorDlg( QWidget* parent, con
   myVersionEdit->setMinimumSize( myMinimumSize );
   QStringList aList = QStringList::split(QRegExp("\\s+"),tr( "INF_VERSION" ));
   myVersionEdit->setText(aList.last());
-  QDoubleValidator *validator = new QDoubleValidator(myVersionEdit);
-  myVersionEdit->setValidator(validator);
 
   myPngEdit = new QLineEdit(supplGrp , "myCompIcon" );
   myPngEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
index d1f1c35bb430b6df0e797f0be58204b03a527ecd..d80c8f924a919612b4bf84e3691efa6cbe589bff 100644 (file)
@@ -98,7 +98,7 @@ int main (int argc, char * argv[])
            }
          catch( CORBA::COMM_FAILURE& )
            {
-             MESSAGE( "Test Container: CORBA::COMM_FAILURE: Unable to contact the Naming Service" )
+             INFOS( "Test Container: CORBA::COMM_FAILURE: Unable to contact the Naming Service" )
                }
          if(!CORBA::is_nil(inc))
            {
@@ -115,11 +115,11 @@ int main (int argc, char * argv[])
                          }
                        catch(CosNaming::NamingContext::NotFound)
                          {
-                           MESSAGE( "Test Container: Logger Server wasn't found" );
+                           INFOS( "Test Container: Logger Server wasn't found" );
                          }
                        catch(...)
                          {
-                           MESSAGE( "Test Container: Unknown exception" );
+                           INFOS( "Test Container: Unknown exception" );
                          }
                        if (!CORBA::is_nil(object))
                          {
@@ -147,14 +147,14 @@ int main (int argc, char * argv[])
     
       for (int iter = 0; iter < 3 ; iter++)
        {
-         INFOS("----------------------------------------------------" << iter);   
-          string dirn = getenv("SALOME_ROOT_DIR");
+         MESSAGE("----------------------------------------------------" << iter);   
+          string dirn = getenv("KERNEL_ROOT_DIR");
           dirn += "/lib/salome/libSalomeTestComponentEngine.so";
           obj = iGenFact->load_impl("SalomeTestComponent",dirn.c_str());
          m1 = Engines::TestComponent::_narrow(obj);
-         INFOS("recup m1");
+         MESSAGE("recup m1");
          SCRUTE(m1->instanceName());
-         INFOS("Coucou " << m1->Coucou(1L));
+         MESSAGE("Coucou " << m1->Coucou(1L));
          iGenFact->remove_impl(m1) ;
          //iGenFact->finalize_removal() ; // unpredictable results ...
           sleep(5);
index a844dc7a758b48bee5b0fe19d6647808e27f15e3..8b73720de009de979c819988f9fbf330d93860db 100644 (file)
@@ -36,7 +36,7 @@ using namespace std;
 
 int main (int argc, char * argv[])
 {
-  INFOS("It's OK");
+  MESSAGE("It's OK");
   return 0;
 }
 
index 86ebc70efd27ab429b48388e04df32a8c1eb2d4e..fbbd1527fdb6c617c4518b3783ca3bd35f261578 100644 (file)
@@ -45,7 +45,9 @@ EXPORT_HEADERS= \
        Utils_ORB_INIT.hxx \
        Utils_Identity.hxx \
        Utils_SINGLETON.hxx \
-       Utils_DESTRUCTEUR_GENERIQUE.hxx
+       Utils_DESTRUCTEUR_GENERIQUE.hxx \
+       Utils_ExceptHandlers.hxx \
+       Utils_CatchSignals.h
 
 EXPORT_PYSCRIPTS = Utils_Identity.py SALOME_utilities.py
 # Libraries targets
@@ -55,9 +57,13 @@ LIB_SRC = OpUtil.cxx Utils_Timer.cxx duplicate.cxx \
        Utils_CommException.cxx \
        Utils_SALOME_Exception.cxx \
        Utils_Identity.cxx Utils_ORB_INIT.cxx \
-       Utils_DESTRUCTEUR_GENERIQUE.cxx
+       Utils_DESTRUCTEUR_GENERIQUE.cxx \
+       Utils_ExceptHandlers.cxx \
+       Utils_CatchSignals.cxx
 
-LDFLAGS+= 
+LIB_SERVER_IDL = SALOME_Exception.idl
+
+LDFLAGS+= -lSALOMELocalTrace
 
 @CONCLUDE@
 
index 8bffa2d18f4fdbbf3914c68530d8b68757d53476..d785f16d103250a0c33228c917b93dcceeff5136 100644 (file)
                 throw SALOME::SALOME_Exception(ExDescription); \
               }
 
+#include <ostream.h>
+//Dump the CORBA exception type.
+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<<"CORBA Exception was catch of the kind : ";
+  if ( *p != '\0' ) {
+    os<<p;
+  } 
+  else  { 
+    os << tc->id();
+  }
+  
+  return os;
+}
 #endif
index 0da127b344b0d6dc5b776e0feff7cc261f1d4a8f..bd8e5965f849adf03597e556088f85b08951b369 100644 (file)
@@ -49,21 +49,24 @@ ORB_INIT::~ORB_INIT()
 
 CORBA::ORB_var &ORB_INIT::operator() ( int argc , char **argv ) throw( CommException )
 {
-       if ( CORBA::is_nil( _orb ) )
-       {
-               try
-               {
-                 //              const char* options[][2] = { { "giopMaxMsgSize", "104857600" }, { 0, 0 } };
-                 //              _orb = CORBA::ORB_init( argc , argv , "omniORB4", options) ;
-                 _orb = CORBA::ORB_init( argc , argv ) ;
-                 //set GIOP message size equal to 50Mb for transferring brep shapes as 
-                 //sequence of bytes using C++ streams
-                 omniORB::MaxMessageSize(100*1024*1024);
-               }
-               catch( const CORBA::Exception &ex )
-               {
-                       throw CommException( "Unable to create an ORB connexion" ) ;
-               }
-       }
-       return _orb ;
+  try {
+    if ( CORBA::is_nil( _orb ) )
+      {
+       try
+         {
+           //            const char* options[][2] = { { "giopMaxMsgSize", "104857600" }, { 0, 0 } };
+           //            _orb = CORBA::ORB_init( argc , argv , "omniORB4", options) ;
+           _orb = CORBA::ORB_init( argc , argv ) ;
+           //set GIOP message size equal to 50Mb for transferring brep shapes as 
+           //sequence of bytes using C++ streams
+           omniORB::MaxMessageSize(100*1024*1024);
+         }
+       catch( const CORBA::Exception &ex )
+         {
+           throw CommException( "Unable to create an ORB connexion" ) ;
+         }
+      }
+    return _orb ;
+  } catch ( CommException& e) {throw e;}
+  catch (...) { throw CommException( "ORB_INIT::operator() : Unknown exception was caught" ) ;}
 }
index f7e9a3a67c546a5ef96f434226c7fe8e60c53938..d368ed867c2f68f85ba22ae57230f74bb1918df0 100644 (file)
 #if !defined( __Utils_SALOME_Exception_hxx__ )
 #define __Utils_SALOME_Exception_hxx__
 
-using namespace std;
 # include <exception>
 # include <iostream>
 
+using namespace std;
+
 # define LOCALIZED(message) #message , __FILE__ , __LINE__
 
 class SALOME_Exception : public exception
index 015e84e58f0fd9263c47337d1e5ebad366078980..91a5be11c09fc21ebb6f9666e97c52683e995107 100644 (file)
@@ -37,8 +37,8 @@
 
 /* ---  INFOS is always defined (without _DEBUG_): to be used for warnings, with release version --- */
 
-#define INFOS(msg)    {SLog.putMessage(SLog<<__FILE__<<" ["<<__LINE__<<"] : "<<msg<<endl);}
-#define PYSCRIPT(msg) {SLog.putMessage(SLog<<"---PYSCRIPT--- "<<msg<<endl);}
+#define INFOS(msg)    {SLog.putMessage(SLog<<__FILE__<<" ["<<__LINE__<<"] : "<<msg<<endl<<ends);}
+#define PYSCRIPT(msg) {SLog.putMessage(SLog<<"---PYSCRIPT--- "<<msg<<endl<<ends);}
 
 /* --- To print date and time of compilation of current source --- */
 
@@ -63,7 +63,7 @@
                                           SLog<<__FILE__<<" ["<< __LINE__<<"] : "\
                                           << "COMPILED with " << COMPILER \
                                           << ", " << __DATE__ \
-                                          << " at " << __TIME__ <<endl); }
+                                          << " at " << __TIME__ <<endl<<ends); }
 
 #ifdef _DEBUG_
 
index 3d848bd0d2a923b5d75603b634840ce4460cf2d1..44ab60836460c408ad920680518838da807906bd 100644 (file)
@@ -35,7 +35,8 @@ VPATH=.:@srcdir@:@top_srcdir@/idl
 EXPORT_HEADERS = SALOME_Transform.h \
                 SALOME_TransformFilter.h \
                 SALOME_PassThroughFilter.h \
-                SALOME_GeometryFilter.h
+                SALOME_GeometryFilter.h \
+                SALOME_ExtractUnstructuredGrid.h
 
 # Libraries targets
 
@@ -43,7 +44,8 @@ LIB = libSalomeVTKFilter.la
 LIB_SRC = SALOME_Transform.cxx \
           SALOME_TransformFilter.cxx \
          SALOME_PassThroughFilter.cxx \
-         SALOME_GeometryFilter.cxx
+         SALOME_GeometryFilter.cxx \
+         SALOME_ExtractUnstructuredGrid.cxx
 
 # Executables targets
 
@@ -51,6 +53,6 @@ BIN =
 BIN_SRC        = 
 
 CPPFLAGS+= $(VTK_INCLUDES)
-LDFLAGS+= $(VTK_LIBS)
+LDFLAGS+= $(VTK_LIBS) -lOpUtil
 
 @CONCLUDE@
index 1bf6904bef0e20b44c09c831d1119c685b1d0786..432b34a5498747a2d61aee4caf59ecba0e4be759 100644 (file)
@@ -24,7 +24,7 @@
 //  File   : SALOME_GeometryFilter.cxx
 //  Author : Michael ZORIN
 //  Module : SALOME
-//  $Header: /dn05/salome/CVS/SALOME_ROOT/SALOME/src/OBJECT/SALOME_GeometryFilter.cxx
+//  $Header$
 
 #include "SALOME_GeometryFilter.h"
 
 #include <vtkVoxel.h>
 #include <vtkWedge.h>
 
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+static int MYDEBUGWITHFILES = 0;
+#else
+static int MYDEBUG = 0;
+static int MYDEBUGWITHFILES = 0;
+#endif
+
 vtkCxxRevisionMacro(SALOME_GeometryFilter, "$Revision$");
 vtkStandardNewMacro(SALOME_GeometryFilter);
 
 
-SALOME_GeometryFilter::SALOME_GeometryFilter(): myShowInside(0)
+SALOME_GeometryFilter::SALOME_GeometryFilter(): 
+  myShowInside(0),
+  myStoreMapping(0)
 {}
 
+
 SALOME_GeometryFilter::~SALOME_GeometryFilter()
 {}
 
+
 void SALOME_GeometryFilter::Execute()
 {
   vtkDataSet *input= this->GetInput();
@@ -71,6 +83,26 @@ void SALOME_GeometryFilter::Execute()
     vtkGeometryFilter::Execute();
 }
 
+
+void SALOME_GeometryFilter::SetStoreMapping(int theStoreMapping){
+  myStoreMapping = theStoreMapping;
+  this->Modified();
+}
+
+
+vtkIdType SALOME_GeometryFilter::GetObjId(int theVtkID){
+  if(myVTK2ObjIds.empty() || theVtkID > myVTK2ObjIds.size()) return -1;
+  return myVTK2ObjIds.at(theVtkID);
+}
+
+
+SALOME_GeometryFilter::TVectorId SALOME_GeometryFilter::GetVtkId(int theObjID){
+  TVectorId aVect;
+  if(myObj2VTKIds.empty() || theObjID > myObj2VTKIds.size()) return aVect;
+  return myObj2VTKIds.at(theObjID);
+}
+
+
 void SALOME_GeometryFilter::UnstructuredGridExecute()
 {
   vtkUnstructuredGrid *input= (vtkUnstructuredGrid *)this->GetInput();
@@ -95,7 +127,7 @@ void SALOME_GeometryFilter::UnstructuredGridExecute()
   vtkIdType newCellId;
   int faceId, *faceVerts, numFacePts;
   float *x;
-  int PixelConvert[4];
+  int PixelConvert[4], aNewPts[VTK_CELL_SIZE];
   // ghost cell stuff
   unsigned char  updateLevel = (unsigned char)(output->GetUpdateGhostLevel());
   unsigned char  *cellGhostLevels = 0;  
@@ -150,14 +182,15 @@ void SALOME_GeometryFilter::UnstructuredGridExecute()
 
   outputCD->CopyAllocate(cd,numCells,numCells/2);
 
-  Verts = vtkCellArray::New();
-  Verts->Allocate(numCells/4+1,numCells);
-  Lines = vtkCellArray::New();
-  Lines->Allocate(numCells/4+1,numCells);
-  Polys = vtkCellArray::New();
-  Polys->Allocate(numCells/4+1,numCells);
-  Strips = vtkCellArray::New();
-  Strips->Allocate(numCells/4+1,numCells);
+  output->Allocate(numCells/4+1,numCells);
+  //Verts = vtkCellArray::New();
+  //Verts->Allocate(numCells/4+1,numCells);
+  //Lines = vtkCellArray::New();
+  //Lines->Allocate(numCells/4+1,numCells);
+  //Polys = vtkCellArray::New();
+  //Polys->Allocate(numCells/4+1,numCells);
+  //Strips = vtkCellArray::New();
+  //Strips->Allocate(numCells/4+1,numCells);
   
   // Loop over the cells determining what's visible
   if (!allVisible)
@@ -195,6 +228,11 @@ void SALOME_GeometryFilter::UnstructuredGridExecute()
   // Loop over all cells now that visibility is known
   // (Have to compute visibility first for 3D cell boundarys)
   int progressInterval = numCells/20 + 1;
+  if(myStoreMapping){
+    myVTK2ObjIds.clear();  myObj2VTKIds.clear(); //apo
+    myVTK2ObjIds.reserve(numCells);
+    myObj2VTKIds.resize(numCells);
+  }
   for (cellId=0, Connectivity->InitTraversal(); 
        Connectivity->GetNextCell(npts,pts); 
        cellId++)
@@ -216,45 +254,62 @@ void SALOME_GeometryFilter::UnstructuredGridExecute()
       {
       //special code for nonlinear cells - rarely occurs, so right now it
       //is slow.
-      switch (input->GetCellType(cellId))
+      vtkIdType aCellType = input->GetCellType(cellId);
+      switch (aCellType)
         {
         case VTK_EMPTY_CELL:
           break;
 
         case VTK_VERTEX:
         case VTK_POLY_VERTEX:
-          newCellId = Verts->InsertNextCell(npts,pts);
+          newCellId = output->InsertNextCell(aCellType,npts,pts);
+         if(myStoreMapping){
+           myVTK2ObjIds.push_back(cellId); //apo
+           myObj2VTKIds[cellId].push_back(newCellId);
+         }
           outputCD->CopyData(cd,cellId,newCellId);
           break;
 
         case VTK_LINE: 
         case VTK_POLY_LINE:
-          newCellId = Lines->InsertNextCell(npts,pts);
+          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;
 
         case VTK_TRIANGLE:
         case VTK_QUAD:
         case VTK_POLYGON:
-          newCellId = Polys->InsertNextCell(npts,pts);
+          newCellId = output->InsertNextCell(aCellType,npts,pts);
+         if(myStoreMapping){
+           myVTK2ObjIds.push_back(cellId); //apo
+           myObj2VTKIds[cellId].push_back(newCellId);
+         }
           outputCD->CopyData(cd,cellId,newCellId);
           break;
 
         case VTK_TRIANGLE_STRIP:
-          newCellId = Strips->InsertNextCell(npts,pts);
+          newCellId = output->InsertNextCell(aCellType,npts,pts);
+         if(myStoreMapping){
+           myVTK2ObjIds.push_back(cellId); //apo
+           myObj2VTKIds[cellId].push_back(newCellId);
+         }
           outputCD->CopyData(cd,cellId,newCellId);
           break;
 
         case VTK_PIXEL:
-          newCellId = Polys->InsertNextCell(npts);
-          for ( i=0; i < npts; i++)
-            {
-            Polys->InsertCellPoint(pts[PixelConvert[i]]);
-            }
-          outputCD->CopyData(cd,cellId,newCellId);
+          newCellId = output->InsertNextCell(aCellType,npts,pts);
+         if(myStoreMapping){
+           myVTK2ObjIds.push_back(cellId); //apo
+           myObj2VTKIds[cellId].push_back(newCellId);
+         }
+         outputCD->CopyData(cd,cellId,newCellId);
           break;
 
-        case VTK_TETRA:
+        case VTK_TETRA: {
           for (faceId = 0; faceId < 4; faceId++)
             {
             faceIds->Reset();
@@ -263,21 +318,26 @@ void SALOME_GeometryFilter::UnstructuredGridExecute()
             faceIds->InsertNextId(pts[faceVerts[1]]);
             faceIds->InsertNextId(pts[faceVerts[2]]);
             numFacePts = 3;
+           aCellType = VTK_TRIANGLE;
             input->GetCellNeighbors(cellId, faceIds, cellIds);
             if ( cellIds->GetNumberOfIds() <= 0 || myShowInside == 1 ||
                  (!allVisible && !cellVis[cellIds->GetId(0)]) )
               {
-              newCellId = Polys->InsertNextCell(numFacePts);
               for ( i=0; i < numFacePts; i++)
                 {
-                Polys->InsertCellPoint(pts[faceVerts[i]]);
+                aNewPts[i] = pts[faceVerts[i]];
                 }
+              newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+             if(myStoreMapping){
+               myVTK2ObjIds.push_back(cellId); //apo
+               myObj2VTKIds[cellId].push_back(newCellId);
+             }
               outputCD->CopyData(cd,cellId,newCellId);
               }
             }
           break;
-
-        case VTK_VOXEL:
+       }
+        case VTK_VOXEL: {
           for (faceId = 0; faceId < 6; faceId++)
             {
             faceIds->Reset();
@@ -287,21 +347,26 @@ void SALOME_GeometryFilter::UnstructuredGridExecute()
             faceIds->InsertNextId(pts[faceVerts[2]]);
             faceIds->InsertNextId(pts[faceVerts[3]]);
             numFacePts = 4;
+           aCellType = VTK_QUAD;
             input->GetCellNeighbors(cellId, faceIds, cellIds);
             if ( cellIds->GetNumberOfIds() <= 0 || myShowInside == 1 || 
                  (!allVisible && !cellVis[cellIds->GetId(0)]) )
               {
-              newCellId = Polys->InsertNextCell(numFacePts);
               for ( i=0; i < numFacePts; i++)
                 {
-                Polys->InsertCellPoint(pts[faceVerts[PixelConvert[i]]]);
+                aNewPts[i] = pts[faceVerts[PixelConvert[i]]];
                 }
+              newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+             if(myStoreMapping){
+               myVTK2ObjIds.push_back(cellId); //apo
+               myObj2VTKIds[cellId].push_back(newCellId);
+             }
               outputCD->CopyData(cd,cellId,newCellId);
               }
             }
           break;
-
-        case VTK_HEXAHEDRON:
+       }
+        case VTK_HEXAHEDRON: {
           for (faceId = 0; faceId < 6; faceId++)
             {
             faceIds->Reset();
@@ -311,21 +376,26 @@ void SALOME_GeometryFilter::UnstructuredGridExecute()
             faceIds->InsertNextId(pts[faceVerts[2]]);
             faceIds->InsertNextId(pts[faceVerts[3]]);
             numFacePts = 4;
+           aCellType = VTK_QUAD;
             input->GetCellNeighbors(cellId, faceIds, cellIds);
             if ( cellIds->GetNumberOfIds() <= 0 || myShowInside == 1 ||
                  (!allVisible && !cellVis[cellIds->GetId(0)]) )
               {
-              newCellId = Polys->InsertNextCell(numFacePts);
               for ( i=0; i < numFacePts; i++)
                 {
-                Polys->InsertCellPoint(pts[faceVerts[i]]);
+                aNewPts[i] = pts[faceVerts[i]];
                 }
+              newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+             if(myStoreMapping){
+               myVTK2ObjIds.push_back(cellId); //apo
+               myObj2VTKIds[cellId].push_back(newCellId);
+             }
               outputCD->CopyData(cd,cellId,newCellId);
               }
             }
           break;
-
-        case VTK_WEDGE:
+       }
+        case VTK_WEDGE: {
           for (faceId = 0; faceId < 5; faceId++)
             {
             faceIds->Reset();
@@ -334,26 +404,32 @@ void SALOME_GeometryFilter::UnstructuredGridExecute()
             faceIds->InsertNextId(pts[faceVerts[1]]);
             faceIds->InsertNextId(pts[faceVerts[2]]);
             numFacePts = 3;
+           aCellType = VTK_TRIANGLE;
             if (faceVerts[3] >= 0)
               {
               faceIds->InsertNextId(pts[faceVerts[3]]);
               numFacePts = 4;
+             aCellType = VTK_QUAD;
               }
             input->GetCellNeighbors(cellId, faceIds, cellIds);
             if ( cellIds->GetNumberOfIds() <= 0 || myShowInside == 1 || 
                  (!allVisible && !cellVis[cellIds->GetId(0)]) )
               {
-              newCellId = Polys->InsertNextCell(numFacePts);
               for ( i=0; i < numFacePts; i++)
                 {
-                Polys->InsertCellPoint(pts[faceVerts[i]]);
+                aNewPts[i] = pts[faceVerts[i]];
                 }
+              newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+             if(myStoreMapping){
+               myVTK2ObjIds.push_back(cellId); //apo
+               myObj2VTKIds[cellId].push_back(newCellId);
+             }
               outputCD->CopyData(cd,cellId,newCellId);
               }
             }
           break;
-
-        case VTK_PYRAMID:
+       }
+        case VTK_PYRAMID: {
           for (faceId = 0; faceId < 5; faceId++)
             {
             faceIds->Reset();
@@ -362,104 +438,70 @@ void SALOME_GeometryFilter::UnstructuredGridExecute()
             faceIds->InsertNextId(pts[faceVerts[1]]);
             faceIds->InsertNextId(pts[faceVerts[2]]);
             numFacePts = 3;
+           aCellType = VTK_TRIANGLE;
             if (faceVerts[3] >= 0)
               {
               faceIds->InsertNextId(pts[faceVerts[3]]);
               numFacePts = 4;
+             aCellType = VTK_QUAD;
               }
             input->GetCellNeighbors(cellId, faceIds, cellIds);
             if ( cellIds->GetNumberOfIds() <= 0 || myShowInside == 1 || 
                  (!allVisible && !cellVis[cellIds->GetId(0)]) )
               {
-              newCellId = Polys->InsertNextCell(numFacePts);
               for ( i=0; i < numFacePts; i++)
                 {
-                Polys->InsertCellPoint(pts[faceVerts[i]]);
+                aNewPts[i] = pts[faceVerts[i]];
                 }
+              newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+             if(myStoreMapping){
+               myVTK2ObjIds.push_back(cellId); //apo
+               myObj2VTKIds[cellId].push_back(newCellId);
+             }
               outputCD->CopyData(cd,cellId,newCellId);
               }
             }
           break;
-
+       }
         //Quadratic cells
         case VTK_QUADRATIC_EDGE:
         case VTK_QUADRATIC_TRIANGLE:
         case VTK_QUADRATIC_QUAD:
         case VTK_QUADRATIC_TETRA:
         case VTK_QUADRATIC_HEXAHEDRON:
-          {
-          vtkGenericCell *cell = vtkGenericCell::New();
-          input->GetCell(cellId,cell);
-          vtkIdList *pts = vtkIdList::New();  
-          vtkPoints *coords = vtkPoints::New();
-          vtkIdList *cellIds = vtkIdList::New();
-          vtkIdType newCellId;
-
-          if ( cell->GetCellDimension() == 1 )
-            {
-            cell->Triangulate(0,pts,coords);
-            for (i=0; i < pts->GetNumberOfIds(); i+=2)
-              {
-              newCellId = Lines->InsertNextCell(2);
-              Lines->InsertCellPoint(pts->GetId(i));
-              Lines->InsertCellPoint(pts->GetId(i+1));
-              outputCD->CopyData(cd,cellId,newCellId);
-              }
-            }
-          else if ( cell->GetCellDimension() == 2 )
-            {
-            cell->Triangulate(0,pts,coords);
-            for (i=0; i < pts->GetNumberOfIds(); i+=3)
-              {
-              newCellId = Lines->InsertNextCell(2);
-              Polys->InsertCellPoint(pts->GetId(i));
-              Polys->InsertCellPoint(pts->GetId(i+1));
-              Polys->InsertCellPoint(pts->GetId(i+2));
-              outputCD->CopyData(cd,cellId,newCellId);
-              }
-            } 
-          else //3D nonlinear cell
-            {
-            vtkCell *face;
-            for (int j=0; j < cell->GetNumberOfFaces(); j++)
-              {
-              face = cell->GetFace(j);
-              input->GetCellNeighbors(cellId, face->PointIds, cellIds);
-              if ( cellIds->GetNumberOfIds() <= 0)
-                {
-                face->Triangulate(0,pts,coords);
-                for (i=0; i < pts->GetNumberOfIds(); i+=3)
-                  {
-                  newCellId = Lines->InsertNextCell(2);
-                  Polys->InsertCellPoint(pts->GetId(i));
-                  Polys->InsertCellPoint(pts->GetId(i+1));
-                  Polys->InsertCellPoint(pts->GetId(i+2));
-                  outputCD->CopyData(cd,cellId,newCellId);
-                  }
-                }
-              }
-            } //3d cell
-          cellIds->Delete();
-          coords->Delete();
-          pts->Delete();
-          cell->Delete();
-          }
+          
           break; //done with quadratic cells
           
         } //switch
       } //if visible
     } //for all cells
   
+  if(MYDEBUG && myStoreMapping){
+    for(int i = 0, iEnd = myVTK2ObjIds.size(); i < iEnd; i++){
+      cout<<myVTK2ObjIds[i]<<", ";
+    }
+    cout<<"\n";
+    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
   //
-  output->SetVerts(Verts);
-  Verts->Delete();
-  output->SetLines(Lines);
-  Lines->Delete();
-  output->SetPolys(Polys);
-  Polys->Delete();
-  output->SetStrips(Strips);
-  Strips->Delete();
+  //output->SetVerts(Verts);
+  //Verts->Delete();
+  //output->SetLines(Lines);
+  //Lines->Delete();
+  //output->SetPolys(Polys);
+  //Polys->Delete();
+  //output->SetStrips(Strips);
+  //Strips->Delete();
   
   output->Squeeze();
 
index f6edf6b78f5421e0a62fc125cd09cc4eb965dc9c..bce9d27d76ba13678a5bf124119a741f2c9efcd3 100644 (file)
 //  File   : SALOME_GeometryFilter.h
 //  Author : Michael ZORIN
 //  Module : SALOME
-//  $Header: /dn05/salome/CVS/SALOME_ROOT/SALOME/src/OBJECT/SALOME_GeometryFilter.h
+//  $Header$
 
 
 #ifndef __SALOME_GeometryFilter_h
 #define __SALOME_GeometryFilter_h
 
 #include <vtkGeometryFilter.h>
+#include <vector>
 
 class SALOME_GeometryFilter : public vtkGeometryFilter 
 {
@@ -40,6 +41,13 @@ public:
   void SetInside(int theShowInside);
   int GetInside();
 
+  void SetStoreMapping(int theStoreMapping);
+  int GetStoreMapping(){ return myStoreMapping;}
+
+  typedef std::vector<vtkIdType> TVectorId;
+  virtual vtkIdType GetObjId(int theVtkID);
+  virtual TVectorId GetVtkId(int theObjID);
+
 protected:
   SALOME_GeometryFilter();
   ~SALOME_GeometryFilter();
@@ -48,7 +56,12 @@ protected:
   void UnstructuredGridExecute();
     
 private:
-  int myShowInside;      
+  int myShowInside;   
+
+  int myStoreMapping;   
+  TVectorId myVTK2ObjIds;
+  typedef std::vector<TVectorId> TVecVectorId;
+  TVecVectorId myObj2VTKIds;
 };
 
 #endif
index 3557b625984babe34f9df957b0cff027704e0596..f1ee7c5e90de3cd617ef21a2c48bd1f3d54ca6d7 100644 (file)
 
 
 #include "SALOME_PassThroughFilter.h"
-#include "SALOME_GeometryFilter.h"
 
+#include <vtkCellData.h>
+#include <vtkDataSet.h>
 #include <vtkObjectFactory.h>
-#include <vtkPointSet.h>
 #include <vtkPointData.h>
-#include <vtkCellData.h>
-#include <vtkPoints.h>
-#include <vtkMatrix4x4.h>
-
-using namespace std;
 
+vtkCxxRevisionMacro(SALOME_PassThroughFilter, "$Revision$");
 vtkStandardNewMacro(SALOME_PassThroughFilter);
 
-SALOME_PassThroughFilter::SALOME_PassThroughFilter(){
-  this->vtkProcessObject::SetNthInput(0, NULL);
-  myGeomFilter = SALOME_GeometryFilter::New();
-}
-
-SALOME_PassThroughFilter::~SALOME_PassThroughFilter(){
-  myGeomFilter->Delete();
-}
-
-void SALOME_PassThroughFilter::Execute(){
+void SALOME_PassThroughFilter::Execute()
+{
   vtkDataSet *input = static_cast<vtkDataSet*>(this->GetInput());
   vtkDataSet *output = static_cast<vtkDataSet*>(this->GetOutput());
+
+  // This has to be here because it initialized all field datas.
   output->CopyStructure( input );
+  
+  // Pass all. (data object's field data is passed by the
+  // superclass after this method)
   output->GetPointData()->PassData( input->GetPointData() );
   output->GetCellData()->PassData( input->GetCellData() );
-}
-
 
-void SALOME_PassThroughFilter::SetInput(vtkDataSet *input){
-  myGeomFilter->SetInput(input);
-  vtkDataSet *oldInput = this->GetInput();
-  if(oldInput != NULL)
-    if(input == NULL || oldInput->GetDataObjectType() != input->GetDataObjectType()){
-      vtkWarningMacro("Changing input type.  Deleting output");
-      this->SetOutput(NULL);
-    }
-  if (input != NULL && this->vtkSource::GetOutput(0) == NULL){
-    this->vtkSource::SetNthOutput(0, input->NewInstance());
-    this->Outputs[0]->ReleaseData();
-    this->Outputs[0]->Delete();
-  }
-  this->vtkProcessObject::SetNthInput(0, input);
 }
-vtkPolyData *SALOME_PassThroughFilter::GetPolyDataOutput() {
-  vtkDataSet *ds = this->GetOutput();
-  if(!ds) return NULL;
-  if(ds->GetDataObjectType() == VTK_POLY_DATA) return (vtkPolyData *)ds;
-  myGeomFilter->SetInput(this->GetOutput());
-  return myGeomFilter->GetOutput();
-}
-
 
-void SALOME_PassThroughFilter::SetInside(int theShowInside){
-  myGeomFilter->SetInside(theShowInside);
-  Modified();
-}
-int SALOME_PassThroughFilter::GetInside(){
-  return myGeomFilter->GetInside();
+void SALOME_PassThroughFilter::PrintSelf(ostream& os, vtkIndent indent)
+{
+  this->Superclass::PrintSelf(os,indent);
 }
index 51e1124e59edb463f7f814a66e9971f739615f32..bc625a8d337222dbf57a58f1a90ebaebff7bf135 100644 (file)
 
 #include <vtkDataSetToDataSetFilter.h>
 
-class SALOME_GeometryFilter;
-
-class SALOME_PassThroughFilter : public vtkDataSetToDataSetFilter{
- public:
-  vtkTypeMacro(SALOME_PassThroughFilter,vtkDataSetToDataSetFilter);
+class SALOME_PassThroughFilter : public vtkDataSetToDataSetFilter
+{
+public:
+  vtkTypeRevisionMacro(SALOME_PassThroughFilter,vtkDataSetToDataSetFilter);
+  void PrintSelf(ostream& os, vtkIndent indent);
+
+  // Description:
+  // Create a new SALOME_PassThroughFilter.
   static SALOME_PassThroughFilter *New();
 
-  void SetInput(vtkDataSet *input);
-  vtkPolyData *GetPolyDataOutput();
 
-  void SetInside(int theShowInside);
-  int GetInside();
+protected:
 
- protected:
-  SALOME_PassThroughFilter();
-  virtual ~SALOME_PassThroughFilter();
-  void Execute();
+  SALOME_PassThroughFilter() {};
+  virtual ~SALOME_PassThroughFilter() {};
 
-  SALOME_GeometryFilter* myGeomFilter;
+  void Execute();
 
- private:
+private:
   SALOME_PassThroughFilter(const SALOME_PassThroughFilter&);  // Not implemented.
   void operator=(const SALOME_PassThroughFilter&);  // Not implemented.
 };
index 0733c58b9711ee4cb49890f8b6832c9a956f1c00..40ca16b5263b8511c49a399bc835877aee86bfc7 100644 (file)
@@ -38,7 +38,8 @@ VPATH=.:@srcdir@:$(top_builddir)/inc:$(top_builddir)/idl
 EXPORT_HEADERS=  VTKViewer_RenderWindow.h \
                 VTKViewer_ViewFrame.h \
                 VTKViewer_RenderWindowInteractor.h \
-                VTKViewer_InteractorStyleSALOME.h 
+                VTKViewer_InteractorStyleSALOME.h \
+                VTKViewer_Filter.h
                     
 # Libraries targets
 LIB = libVTKViewer.la
@@ -49,7 +50,10 @@ LIB_SRC= VTKViewer.cxx \
         VTKViewer_InteractorStyleSALOME.cxx \
         VTKViewer_Trihedron.cxx \
         VTKViewer_VectorText.cxx \
-        VTKViewer_Utilities.cxx
+        VTKViewer_RectPicker.cxx \
+        VTKViewer_CellRectPicker.cxx \
+        VTKViewer_Utilities.cxx \
+        VTKViewer_Filter.cxx
 
 LIB_MOC = \
         VTKViewer.h \
index 329e055acb0f731bdfec14ebdcfef92737bc510b..8e6319976d4f76168a64b60f9b10be3d747cdbb0 100644 (file)
 //  $Header$
 
 #include "VTKViewer_InteractorStyleSALOME.h"
+#include "VTKViewer_RenderWindowInteractor.h"
 #include "VTKViewer_RenderWindow.h"
 #include "VTKViewer_Utilities.h"
 #include "VTKViewer_Trihedron.h"
+#include "VTKViewer_RectPicker.h"
+#include "VTKViewer_CellRectPicker.h"
 
 #include "QAD_Config.h"
 #include "QAD_Application.h"
@@ -52,7 +55,6 @@
 #include <vtkPolyDataMapper.h>
 #include <vtkDataSetCollection.h>
 #include <vtkImageData.h>
-#include <vtkFollower.h>
 
 #include <qapplication.h>
 //VRV: porting on Qt 3.0.5
@@ -61,6 +63,8 @@
 #endif
 //VRV: porting on Qt 3.0.5
 
+#include "utilities.h"
+
 using namespace std;
 
 extern int SetVisibility(vtkActorCollection* theCollection, int theParam);
@@ -78,6 +82,12 @@ VTKViewer_InteractorStyleSALOME::VTKViewer_InteractorStyleSALOME()
   this->RadianToDegree = 180.0 / vtkMath::Pi();
   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);
 }
 
 //----------------------------------------------------------------------------
@@ -85,6 +95,15 @@ VTKViewer_InteractorStyleSALOME::~VTKViewer_InteractorStyleSALOME()
 {
 }
 
+//----------------------------------------------------------------------------
+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);
+}
+
 //----------------------------------------------------------------------------
 void VTKViewer_InteractorStyleSALOME::setTriedron(VTKViewer_Trihedron* theTrihedron){
   m_Trihedron = theTrihedron;
@@ -515,8 +534,7 @@ void VTKViewer_InteractorStyleSALOME::startFitArea()
 void  VTKViewer_InteractorStyleSALOME::ViewFitAll() {
   int aTriedronWasVisible = false;
   if(m_Trihedron){
-    aTriedronWasVisible = 
-      m_Trihedron->GetVisibility() == VTKViewer_Trihedron::eOn;
+    aTriedronWasVisible = m_Trihedron->GetVisibility() == VTKViewer_Trihedron::eOn;
     if(aTriedronWasVisible) m_Trihedron->VisibilityOff();
   }
 
@@ -529,6 +547,7 @@ void  VTKViewer_InteractorStyleSALOME::ViewFitAll() {
   }
   if(aTriedronWasVisible) m_Trihedron->VisibilityOn();
   else m_Trihedron->VisibilityOff();
+  ::ResetCameraClippingRange(CurrentRenderer);
 }
 
 
@@ -723,7 +742,7 @@ void VTKViewer_InteractorStyleSALOME::onFinishOperation()
   // VSV: LOD actor activisation
   //  rwi->GetRenderWindow()->SetDesiredUpdateRate(rwi->GetStillUpdateRate());
 
-  int aSelectionMode = aSel->SelectionMode();
+  Selection_Mode aSelectionMode = aSel->SelectionMode();
   bool aSelActiveCompOnly = aSel->IsSelectActiveCompOnly();
 
   switch (State) {
@@ -767,16 +786,17 @@ void VTKViewer_InteractorStyleSALOME::onFinishOperation()
           if ( rwi->GetPicker()->IsA("vtkCellPicker") ) {
             vtkCellPicker* picker;
             if ( (picker = vtkCellPicker::SafeDownCast(rwi->GetPicker())) ) {
-             MESSAGE ( " CellId : " << picker->GetCellId() );
-              if ( picker->GetCellId() >= 0 ) {
+             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 );
-                  MESSAGE ( " NAME Actor : " << SActor->getName() );
+                  INFOS ( " NAME Actor : " << SActor->getName() << ", CellId : " << aVtkId );
 
-                  //Cell selection //////////////////////////////////// NB
-                  if ( aSelectionMode == 3 ) {
-                    if ( SActor->hasIO() ) {
+                  //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());
@@ -789,91 +809,135 @@ void VTKViewer_InteractorStyleSALOME::onFinishOperation()
                           break;
                        }
                       }
-                     if(IsSelected) {
-                        // This IO is already in the selection
-                       //if(shift) {
-                         bool add = aSel->AddOrRemoveIndex( IO, picker->GetCellId(), myShiftState, false );
-                         //Sel->RemoveIObject(IO);
-                       //}
+
+                     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();
-                        }
-                        bool add = aSel->AddOrRemoveIndex( IO, picker->GetCellId(), myShiftState, false );
-                        aSel->AddIObject( IO, false );
+                       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 selection ////////////////////////// NB
-                  else if ( aSelectionMode == 2 ) {
-                    if(SActor->hasIO()){
-                      Handle(SALOME_InteractiveObject) IO = SActor->getIO();
-                      float pickPosition[3],pcoords[3],closestPoint[3],weights[3],dist1=1000000.0,dist2=0;
-                      int subId,edgeId=-10,pickedID,result;
-                      pickedID = picker->GetCellId();
-                      picker->GetPickPosition(pickPosition);
-                     if (vtkDataSet* UGrid = SActor->GetMapper()->GetInput()){
-                       if (vtkCell* pickedCell = UGrid->GetCell(pickedID)){
-                         edgeId = -1;
-                         for (int i = 0, iEnd = pickedCell->GetNumberOfEdges(); i < iEnd; i++){
-                           vtkCell* edge = pickedCell->GetEdge(i);
-                           if(vtkLine* line = vtkLine::SafeDownCast(edge)){
-                             result = line->EvaluatePosition(pickPosition,closestPoint,subId,pcoords,dist2,weights);
-                             if (dist2 < dist1) {
-                               dist1  = dist2;
-                               edgeId = i;
+                 //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);
                          }
-                         MESSAGE("edgeID transformed = "<<edgeId);
-                         // 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 (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 );
                          }
-                         if(!myShiftState) {
-                           this->HighlightProp( NULL );
-                           aSel->ClearIObjects();
-                         }
-                         aSel->SetSelectionMode(2, true);
-                         bool add = aSel->AddOrRemoveIndex( IO, pickedID, true, false);
-                         if(edgeId >= 0)
-                           add = aSel->AddOrRemoveIndex( IO, -edgeId-1, true, true );
-                         aSel->AddIObject( IO, false );
                        }
                      }
                    }
                  }
-                } else {
-                  this->HighlightProp( NULL );
-                  aSel->ClearIObjects();
                 }
+             } else {
+               this->HighlightProp( NULL );
+               aSel->ClearIObjects();
               }
             }
           } else if ( rwi->GetPicker()->IsA("vtkPointPicker") ) {
             vtkPointPicker* picker;
             if ( (picker = vtkPointPicker::SafeDownCast(rwi->GetPicker())) ) {
-              MESSAGE ( " PointId : " << picker->GetPointId() );
+              INFOS ( " PointId : " << picker->GetPointId() );
               if ( picker->GetPointId() >= 0 ) {
                 vtkActor* ac = picker->GetActor();
                 if ( ac->IsA("SALOME_Actor") ) {
                   SALOME_Actor* SActor = SALOME_Actor::SafeDownCast( ac );
-                  MESSAGE ( " NAME Actor : " << SActor->getName() );
+                  INFOS ( " NAME Actor : " << SActor->getName() );
                   if ( SActor->hasIO() ) {
                     Handle(SALOME_InteractiveObject) IO = SActor->getIO();
-/*                 if (IO.IsNull()) 
+                   /*
+                   if (IO.IsNull()) 
                      break;
                    if (aSelActiveCompOnly && 
-                       strcmp(aActiveComponent->ComponentDataType(), IO->getComponentDataType()) != 0) {
+                       strcmp(aActiveComponent->ComponentDataType(), 
+                              IO->getComponentDataType()) != 0) {
                      break;
-                   }*/
+                   }
+                   */
                     // Look in the current selection
                     SALOME_ListIteratorOfListIO It(aSel->StoredIObjects());
                     Standard_Boolean IsSelected = false;
@@ -949,13 +1013,13 @@ void VTKViewer_InteractorStyleSALOME::onFinishOperation()
                 }
               }
             }
-           rwi->EndPickCallback();
           }
+         rwi->EndPickCallback();
         } else {
           //processing rectangle selection
-         SALOMEDS::SComponent_var aActiveComponent = SALOMEDS::SComponent::
-           _narrow(aActiveStudy->getStudyDocument()->
-                   FindObject(QAD_Application::getDesktop()->getActiveComponent()));
+         SALOMEDS::SComponent_var aActiveComponent = 
+           SALOMEDS::SComponent::_narrow(aActiveStudy->getStudyDocument()->
+                                         FindObject(QAD_Application::getDesktop()->getActiveComponent()));
          if(aSelActiveCompOnly && aActiveComponent->_is_nil()) return;
          rwi->StartPickCallback();
 
@@ -966,7 +1030,7 @@ void VTKViewer_InteractorStyleSALOME::onFinishOperation()
          }
 
          // Compute bounds
-         vtkCamera *cam = this->CurrentRenderer->GetActiveCamera();
+         //      vtkCamera *cam = this->CurrentRenderer->GetActiveCamera();
          QRect rect(myPoint, myOtherPoint);
          rect = rect.normalize();
          int w, h, x, y;
@@ -978,7 +1042,7 @@ void VTKViewer_InteractorStyleSALOME::onFinishOperation()
          y2 = h - rect.bottom() - 1;
 
          switch (aSelectionMode) {
-         case 1: // Nodes selection
+         case NodeSelection: // Nodes selection
            {
              if (! rwi->GetPicker()->IsA("vtkPointPicker") ) break;
              vtkPointPicker* aPointPicker = vtkPointPicker::SafeDownCast(rwi->GetPicker());
@@ -999,7 +1063,8 @@ void VTKViewer_InteractorStyleSALOME::onFinishOperation()
                      if (IO.IsNull()) 
                        continue;
                      if (aSelActiveCompOnly && 
-                              strcmp(aActiveComponent->ComponentDataType(), IO->getComponentDataType()) != 0) {
+                         strcmp(aActiveComponent->ComponentDataType(), 
+                                IO->getComponentDataType()) != 0) {
                        continue;
                      }
 
@@ -1015,6 +1080,8 @@ void VTKViewer_InteractorStyleSALOME::onFinishOperation()
                        continue;
                      }
                      if (aDataSet) {
+
+                       std::vector<int> anIndices;
                        for (int i=0; i < aDataSet->GetNumberOfPoints(); i++) {
                          float* aPoint;
                          aPoint = aDataSet->GetPoint(i);
@@ -1024,12 +1091,21 @@ void VTKViewer_InteractorStyleSALOME::onFinishOperation()
                                                  aPoint[1],
                                                  aPoint[2], aDisp);
                            aPointPicker->Pick(aDisp[0], aDisp[1], 0.0, CurrentRenderer);
-                           if ( aPointPicker->GetPointId() >= 0) { // && (!aSel->IsIndexSelected(IO, aPointPicker->GetPointId()))) {
-                             aSel->AddOrRemoveIndex(IO, aPointPicker->GetPointId(), true, false);
-                             aSel->AddIObject(IO, false);
-                           }
+
+                           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);
+                           }
                          }
                        }
+                       if (!anIndices.empty()) {
+                         aSel->AddOrRemoveIndex(IO, anIndices, true, false);
+                         aSel->AddIObject(IO, false);
+                         anIndices.clear();
+                       }
                      }
                    }
                  }
@@ -1037,91 +1113,140 @@ void VTKViewer_InteractorStyleSALOME::onFinishOperation()
              }
            }
            break;
-         case 2: // edges selection
-         case 3: // triangles selection
+         case CellSelection:
+         case EdgeOfCellSelection:
+         case EdgeSelection:
+         case FaceSelection:
+         case VolumeSelection: 
            {
-             aSel->SetSelectionMode(aSelectionMode,true);
-             if (!rwi->GetPicker()->IsA("vtkCellPicker") ) break;
-             vtkCellPicker* aCellPicker = vtkCellPicker::SafeDownCast(rwi->GetPicker());
-             vtkActorCollection* aListActors = this->CurrentRenderer->GetActors();
-             aListActors->InitTraversal();
+             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;
-             for (int k = 0, kEnd = aListActors->GetNumberOfItems(); k < kEnd; k++){
-               vtkActor* aActor = aListActors->GetNextActor();
-               if (vtkActor* aActor = aListActors->GetNextActor()){
-                 if (aActor->GetVisibility() == 0) continue;
-                 if(SALOME_Actor* SActor = SALOME_Actor::SafeDownCast(aActor)) {
-                   if(SActor->hasIO()) {
-                     Handle(SALOME_InteractiveObject) IO = SActor->getIO();
-                     if(IO.IsNull()) continue;
-                     if(aSelActiveCompOnly) {
-                       if(strcmp(aActiveComponent->ComponentDataType(),IO->getComponentDataType()) != 0)
-                         continue;
+             aListActors->InitTraversal();
+             while(aActor = aListActors->GetNextActor()) {
+               if (aActor->IsA("SALOME_Actor")) {
+                 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) {
+                     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);
+                       }
                      }
-                     if(vtkDataSet* aDataSet = SActor->GetMapper()->GetInput()){
-                       for(int i = 0, iEnd = aDataSet->GetNumberOfCells(); i < iEnd; i++){
-                         if(vtkCell* aCell = aDataSet->GetCell(i)){
-                           if(IsInRect(aCell,  x1, y1, x2, y2)){
-                             float* aBounds = aCell->GetBounds();
-                             float aCenter[3];
-                             aCenter[0] =(aBounds[0] + aBounds[1])/2; // Center X
-                             aCenter[1] =(aBounds[2] + aBounds[3])/2; // Center Y
-                             aCenter[2] =(aBounds[4] + aBounds[5])/2; // Center Z
-                             float aDisp[3];
-                             ComputeWorldToDisplay(aCenter[0],aCenter[1],aCenter[2],aDisp);
-                             aCellPicker->Pick(aDisp[0], aDisp[1], 0.0, CurrentRenderer);
-                             if(aCellPicker->GetCellId() >= 0 && !aSel->IsIndexSelected(IO,aCellPicker->GetCellId())){
-                               aSel->AddOrRemoveIndex( IO, aCellPicker->GetCellId(), true, false);
-                               aSel->AddIObject( IO, false );
+                     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);
+                           }
                          }
                        }
                      }
+                     aSel->AddOrRemoveIndex(aIO, anIndexes, true, false);
+                     aSel->AddIObject(aIO, false);
                    }
                  }
                }
              }
            }
-           break;
-         case 4: // objects selection
+           break;          
+         case ActorSelection: // objects selection
            {
-             vtkActorCollection* aListActors = this->CurrentRenderer->GetActors();
-             aListActors->InitTraversal();
+             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;
-             for (int k = 0; k < aListActors->GetNumberOfItems(); k++) {
-               aActor = aListActors->GetNextActor();
-               if (aActor) {
-                 if (aActor->GetVisibility() == 0) 
-                   continue;
-                 if ( aActor->IsA("SALOME_Actor") ) {
-                   SALOME_Actor* aSActor = SALOME_Actor::SafeDownCast(aActor);
-                   if ( aSActor->hasIO() && IsInRect(aSActor, x1, y1, x2, y2)) {   
-                     Handle(SALOME_InteractiveObject) aIO = aSActor->getIO();
-                     if (aIO.IsNull())
-                       continue;
-                     if (aSelActiveCompOnly && 
-                              strcmp(aActiveComponent->ComponentDataType(), aIO->getComponentDataType()) != 0) {
-                       continue;
-                     }
-                     if (aListIO.IsEmpty()) {
-                       aListIO.Append( aIO );
-                     } else {
-                       SALOME_ListIteratorOfListIO It(aListIO);
-                       bool isStored = false;
-                       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;
-                         }
+             aListActors->InitTraversal();
+             while(aActor = aListActors->GetNextActor()) {
+               if (aActor->IsA("SALOME_Actor")) {
+                 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)
-                         aListIO.Append( aIO );
                      }
                    }
+                   if (!isStored)
+                     aListIO.Append(aIO);
                  }
                }
              }
@@ -1223,12 +1348,21 @@ void VTKViewer_InteractorStyleSALOME::onOperation(QPoint mousePos)
   this->LastPos[1] = h - mousePos.y() - 1;
 }
 
+// called when selection mode changed (!put necessary initialization here!)
+void VTKViewer_InteractorStyleSALOME::OnSelectionModeChanged()
+{
+  myPActor->VisibilityOff();
+}
+
 // called when user moves mouse inside viewer window and there is no active viewer operation 
 // (!put necessary processing here!)
 void VTKViewer_InteractorStyleSALOME::onCursorMove(QPoint mousePos) {
   // processing highlighting
-  QAD_Study* myActiveStudy = QAD_Application::getDesktop()->getActiveStudy();
-  SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+  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;
@@ -1238,8 +1372,140 @@ void VTKViewer_InteractorStyleSALOME::onCursorMove(QPoint mousePos) {
   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() );
+
+       if (rwi->IsA("VTKViewer_RenderWindowInteractor")) {
+         VTKViewer_RenderWindowInteractor* aRWI = 
+           VTKViewer_RenderWindowInteractor::SafeDownCast(rwi);
+
+         //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();
+           }
+         }
+       
+         //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();
+                 }
+               }
+             }
+           }
+         }
+       }
+      }
+    }
+  }
+  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->GetPicker()->IsA("vtkPicker") ) {
+       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 ( rwi->GetPicker()->IsA("vtkPicker") ) {
     vtkPicker* picker = vtkPicker::SafeDownCast(rwi->GetPicker());
     vtkActor* ac = picker->GetActor();
     
@@ -1282,7 +1548,7 @@ void VTKViewer_InteractorStyleSALOME::onCursorMove(QPoint mousePos) {
                 }
                 ac = theActors->GetNextActor();
               }
-              // MESSAGE ( " NAME PREVIEW " << SActor->getName() );
+              // INFOS ( " NAME PREVIEW " << SActor->getName() );
             }
           }
         }
@@ -1301,6 +1567,9 @@ void VTKViewer_InteractorStyleSALOME::onCursorMove(QPoint mousePos) {
       }
     }
   }
+  rwi->EndPickCallback();
+  rwi->Render();
+
   this->LastPos[0] = x;
   this->LastPos[1] = y;
 }
@@ -1425,3 +1694,59 @@ 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 )
+{
+  myFaceFilter = f;
+}
+
+void VTKViewer_InteractorStyleSALOME::RemoveFaceFilter()
+{
+  myFaceFilter.Nullify();
+}
+
+void VTKViewer_InteractorStyleSALOME::SetEdgeFilter( const Handle(VTKViewer_Filter)& f )
+{
+  myEdgeFilter = f;
+}
+
+void VTKViewer_InteractorStyleSALOME::RemoveEdgeFilter()
+{
+  myEdgeFilter.Nullify();
+}
+
+bool VTKViewer_InteractorStyleSALOME::isValid( SALOME_Actor*        theActor,
+                                               const int            theId,
+                                               const Selection_Mode theSelMode )
+{
+  if ( theSelMode != CellSelection &&
+       theSelMode != FaceSelection &&
+       theSelMode != EdgeSelection )
+    return true;
+
+  if ( theSelMode == CellSelection )
+  {
+    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;
+  }
+  else if ( theSelMode == FaceSelection )
+    return myFaceFilter.IsNull() || myFaceFilter->IsValid( theActor, theId );
+  else if ( theSelMode == EdgeSelection )
+    return myEdgeFilter.IsNull() || myEdgeFilter->IsValid( theActor, theId );
+    
+  return true;
+}
index 62438e91e2d4fd16f0af7bdcf0c7c42a57601aeb..ce55fdfc8d98c4fa1a3f0297e6af914927649afe 100644 (file)
@@ -33,6 +33,8 @@
 #include <qobject.h>
 #include <qcursor.h>
 #include "SALOME_Actor.h"
+#include "VTKViewer_Filter.h"
+#include "SALOME_Selection.h"
 
 class VTKViewer_Trihedron;
 
@@ -55,6 +57,8 @@ class VTKViewer_InteractorStyleSALOME : public QObject, public vtkInteractorStyl
   static VTKViewer_InteractorStyleSALOME *New();
 
   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);
@@ -68,8 +72,15 @@ class VTKViewer_InteractorStyleSALOME : public QObject, public vtkInteractorStyl
   void OnRightButtonDown(int ctrl, int shift, int x, int y);
   void OnRightButtonUp  (int ctrl, int shift, int x, int y);
 
+  void OnSelectionModeChanged();
+
   void  ViewFitAll();
 
+  void  SetEdgeFilter( const Handle(VTKViewer_Filter)& );
+  void  SetFaceFilter( const Handle(VTKViewer_Filter)& );
+  void  RemoveFaceFilter();
+  void  RemoveEdgeFilter();
+
  protected:
   VTKViewer_InteractorStyleSALOME();
   ~VTKViewer_InteractorStyleSALOME();
@@ -93,12 +104,15 @@ 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;
 
 public:
   bool eventFilter(QObject* object, QEvent* event);
@@ -123,26 +137,30 @@ protected:
   void setCursor(const int operation);
 
 protected:
-  QCursor      myDefCursor;
-  QCursor      myPanCursor;
-  QCursor      myZoomCursor;
-  QCursor      myRotateCursor;
-  QCursor      mySpinCursor;
-  QCursor      myHandCursor;
-  QCursor      myGlobalPanCursor;
-  QPoint       myPoint;
-  QPoint       myOtherPoint;
-  bool         myCursorState;
-  bool         myShiftState;
-  int ForcedState;
-  VTKViewer_Trihedron* m_Trihedron;  
-
-  QWidget*     myGUIWindow;
+  QCursor                   myDefCursor;
+  QCursor                   myPanCursor;
+  QCursor                   myZoomCursor;
+  QCursor                   myRotateCursor;
+  QCursor                   mySpinCursor;
+  QCursor                   myHandCursor;
+  QCursor                   myGlobalPanCursor;
+  QPoint                    myPoint;
+  QPoint                    myOtherPoint;
+  bool                      myCursorState;
+  bool                      myShiftState;
+  int                       ForcedState;
+  
+  VTKViewer_Trihedron*      m_Trihedron;
+  
+  QWidget*                  myGUIWindow;
+  
+  Handle(VTKViewer_Filter)  myEdgeFilter;
+  Handle(VTKViewer_Filter)  myFaceFilter;
 
   //  members from old version
-  double DeltaElevation;
-  double DeltaAzimuth;
-  int LastPos[2];
+  double                    DeltaElevation;
+  double                    DeltaAzimuth;
+  int                       LastPos[2];
 };
 
 #endif
index 7712ec01e3c700e8543b58c8122eb4006d4e5e23..46e3dba3f6085e15f3d82125a985b9c28e3534f3 100644 (file)
@@ -194,8 +194,10 @@ void VTKViewer_RenderWindow::onChangeBackgroundColor()
   QColor selColor = QColorDialog::getColor ( QColor(int(backint[0]*255), int(backint[1]*255), int(backint[2]*255)), NULL );    
   if ( selColor.isValid() ) {
     theRenderer->SetBackground( selColor.red()/255., selColor.green()/255., selColor.blue()/255. ); 
+    /* VSR : PAL5420 ---------------------------------------------------
     QAD_CONFIG->addSetting( "VTKViewer:BackgroundColorRed",   selColor.red() );
     QAD_CONFIG->addSetting( "VTKViewer:BackgroundColorGreen", selColor.green() );
     QAD_CONFIG->addSetting( "VTKViewer:BackgroundColorBlue",  selColor.blue() );
+    VSR : PAL5420 --------------------------------------------------- */
   }
 }
index 2e4ce4b961dcb5fb8b46b4256e109f7f83cc8b8d..9658ef5e52e8506d57dc2e2123c4dd9323d5b4b1 100644 (file)
@@ -33,7 +33,7 @@
 #include "QAD_Application.h"
 #include "QAD_Desktop.h"
 
-#include "SALOME_Selection.h"
+//#include "SALOME_Selection.h"
 #include "SALOME_Actor.h"
 
 #include <stdio.h>
@@ -147,6 +147,9 @@ void VTKViewer_RenderWindowInteractor::Initialize() {
   //
   this->Initialized = 1 ;
 
+  myTolNodes = 0.025;
+  myTolItems = 0.001;
+
   Cell_Actor = vtkActor::New(); 
   Cell_Actor->PickableOff();
   Cell_Actor->GetProperty()->SetColor(1,1,0);
@@ -175,32 +178,63 @@ void VTKViewer_RenderWindowInteractor::SetInteractorStyle(vtkInteractorObserver
 }
 
 
-void VTKViewer_RenderWindowInteractor::SetSelectionMode(int mode)
+void VTKViewer_RenderWindowInteractor::SetSelectionMode(Selection_Mode mode)
 {
   Cell_Actor->VisibilityOff();
   Edge_Actor->VisibilityOff();
   Point_Actor->VisibilityOff();
 
   selectionmode = mode;
-  if ( mode == 1 ) {
+  if ( mode == NodeSelection ) {
     vtkPointPicker* thepicker = vtkPointPicker::New();
-    //    thepicker->SetTolerance(0.001);
+    thepicker->SetTolerance(myTolNodes);
     this->SetPicker(thepicker);
-  } else if ( mode == 2 ) {
+  } else if ( mode == EdgeOfCellSelection ) {
     vtkCellPicker* thepicker = vtkCellPicker::New();
-    thepicker->SetTolerance(0.001);
+    thepicker->SetTolerance(myTolItems);
     this->SetPicker(thepicker);
-  } else if ( mode == 3 ) {
+  } else if ( mode == CellSelection || mode == EdgeSelection || 
+             mode == FaceSelection || mode == VolumeSelection ) {
     vtkCellPicker* thepicker = vtkCellPicker::New();
-    thepicker->SetTolerance(0.001); 
+    thepicker->SetTolerance(myTolItems); 
     this->SetPicker(thepicker);
-  } else if ( mode == 4 ) {
+  } else if ( mode == ActorSelection ) {
     vtkPicker* thepicker = vtkPicker::New();
-    thepicker->SetTolerance(0.001);
+    thepicker->SetTolerance(myTolItems);
     this->SetPicker(thepicker);
   }
+
+  VTKViewer_InteractorStyleSALOME* Style = 0;
+  if (this->InteractorStyle->IsA("VTKViewer_InteractorStyleSALOME"))
+    Style = VTKViewer_InteractorStyleSALOME::SafeDownCast(this->InteractorStyle);
+  else 
+    return;
+  Style->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);
+
+  Point_Actor->GetProperty()->SetColor(theRed, theGreen, theBlue);
+  Point_Actor->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);
+  }
+}
 
 void VTKViewer_RenderWindowInteractor::Enable() {
   //
@@ -604,13 +638,31 @@ void VTKViewer_RenderWindowInteractor::DisplayAll()
   emit RenderWindowModified() ;
 }
 
+void VTKViewer_RenderWindowInteractor::Erase( SALOME_Actor* SActor, bool update)
+{
+  SActor->SetVisibility( false );
+
+  // Erase dependent actors
+  vtkActorCollection* theChildActors = vtkActorCollection::New(); 
+  SActor->GetChildActors(theChildActors);
+
+  theChildActors->InitTraversal();
+  vtkActor *ac = theChildActors->GetNextActor();
+  while(!(ac==NULL)) {
+    ac->SetVisibility( false );
+    ac = theChildActors->GetNextActor();
+  }
+
+  if (update) 
+    emit RenderWindowModified();
+}
+
 void VTKViewer_RenderWindowInteractor::Erase(const Handle(SALOME_InteractiveObject)& IObject, bool update)
 {
   vtkRenderer* aren;
   for (this->RenderWindow->GetRenderers()->InitTraversal(); 
        (aren = this->RenderWindow->GetRenderers()->GetNextItem()); ) {
     vtkActorCollection* theActors = aren->GetActors();
-    vtkActorCollection* theChildActors = vtkActorCollection::New(); 
     theActors->InitTraversal();
     vtkActor *ac = theActors->GetNextActor();
     while(!(ac==NULL)) {
@@ -618,21 +670,12 @@ void VTKViewer_RenderWindowInteractor::Erase(const Handle(SALOME_InteractiveObje
        SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac );
        if ( anActor->hasIO() ) {
          if ( IObject->isSame( anActor->getIO() ) ) {
-           anActor->SetVisibility( false );
-           anActor->GetChildActors(theChildActors);
+           Erase(anActor, false);
          }
        }
       }
       ac = theActors->GetNextActor();
     }
-
-    // Erase dependent actors
-    theChildActors->InitTraversal();
-    ac = theChildActors->GetNextActor();
-    while(!(ac==NULL)) {
-      ac->SetVisibility( false );
-      ac = theChildActors->GetNextActor();
-    }
   } 
   if (update)
     emit RenderWindowModified() ;
@@ -828,14 +871,14 @@ bool VTKViewer_RenderWindowInteractor::unHighlightAll(){
   aRenColl->InitTraversal();
   while(vtkRenderer* aRen = this->RenderWindow->GetRenderers()->GetNextItem()){
     vtkActorCollection* theActors = aRen->GetActors();
-    theActors->InitTraversal();
     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);
-    vtkActor *anActor = theActors->GetNextActor();
+
+    theActors->InitTraversal();
     while(vtkActor *anAct = theActors->GetNextActor()) {
       if(SALOME_Actor* anActor = SALOME_Actor::SafeDownCast(anAct)){
        if(anActor->hasIO()){
@@ -995,43 +1038,54 @@ bool VTKViewer_RenderWindowInteractor::highlight(const Handle(SALOME_Interactive
                                                 vtkActor *theActor, bool hilight, bool update )
 {
   if(MapIndex.Extent() == 0) return false;
-  vtkRenderer* aRen;
-  this->RenderWindow->GetRenderers()->InitTraversal();
-  for (; aRen = this->RenderWindow->GetRenderers()->GetNextItem(); ) {
-    vtkActorCollection* anActorColl = aRen->GetActors();
-    if ( anActorColl->IsItemPresent(theActor) != 0 ) 
-      aRen->RemoveActor(theActor);
-    anActorColl->InitTraversal();
-    vtkActor *ac = NULL;
-    for(; (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();
-             if(anActorColl->IsItemPresent(theActor) == 0) 
-               aRen->AddActor(theActor);             
-             if(hilight)
-               theActor->VisibilityOn();
-             else
-               theActor->VisibilityOff();
-             break;
-           }
-         }
-       }
-      }
-    }
+  vtkRenderer* aRen = GetRenderer();
+  vtkActorCollection* anActorColl = aRen->GetActors();
+  if ( anActorColl->IsItemPresent(theActor) != 0 ) 
+    aRen->RemoveActor(theActor);
+  
+  if (hilight) {
+    setActorData(IObject, MapIndex, theFun, theActor);
+    aRen->AddActor(theActor);        
+    theActor->VisibilityOn();
+  }
+  else {
+    theActor->VisibilityOff();
   }
+
   if(update){
     this->RenderWindow->Render();  
     emit RenderWindowModified() ;
   }
+
   return false;
 }
+  
+void VTKViewer_RenderWindowInteractor::setActorData(const Handle(SALOME_InteractiveObject)& IObject,
+                                                   const TColStd_MapOfInteger& MapIndex, 
+                                                   VTKViewer_RenderWindowInteractor::TCreateMapperFun theFun,
+                                                   vtkActor* theActor)
+{
+  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;
+         }
+       }
+      }
+    }
+  }
+}
+
 
 static void CellCreateMapper(vtkPolyData *theSourcePolyData, vtkPolyDataMapper* theMapper, 
                      const TColStd_MapOfInteger& theMapIndex)
@@ -1041,7 +1095,7 @@ static void CellCreateMapper(vtkPolyData *theSourcePolyData, vtkPolyDataMapper*
 
   vtkIdList *ptIds = vtkIdList::New(); 
   ptIds->Allocate(theSourcePolyData->GetMaxCellSize());
-  vtkPolyDataMapper* aMapper = vtkPolyDataMapper::New();
+  //  vtkPolyDataMapper* aMapper = vtkPolyDataMapper::New();
   aPolyData->SetPoints(theSourcePolyData->GetPoints());
   TColStd_MapIteratorOfMapOfInteger ite(theMapIndex);
   int aNbOfParts = theSourcePolyData->GetNumberOfCells();
@@ -1068,6 +1122,23 @@ bool VTKViewer_RenderWindowInteractor::highlightCell(const Handle(SALOME_Interac
 {
   return highlight(IObject,MapIndex,&CellCreateMapper,Cell_Actor,hilight,update);
 }
+  
+void VTKViewer_RenderWindowInteractor::setCellData(const Handle(SALOME_InteractiveObject)& IObject, 
+                                                  const int& theIndex, vtkActor* theActor )
+{
+  TColStd_MapOfInteger MapIndex; MapIndex.Add(theIndex);
+  return setActorData(IObject,MapIndex,&CellCreateMapper,theActor);
+}
+  
+void VTKViewer_RenderWindowInteractor::setCellData(const Handle(SALOME_InteractiveObject)& IObject, 
+                                                  const std::vector<int>& theIndexes, vtkActor* 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);
+}
 
 
 static void PointCreateMapper(vtkPolyData *theSourcePolyData, vtkPolyDataMapper* theMapper, 
@@ -1101,6 +1172,14 @@ bool VTKViewer_RenderWindowInteractor::highlightPoint(const Handle(SALOME_Intera
 {
   return highlight(IObject,MapIndex,&PointCreateMapper,Point_Actor,hilight,update);
 }
+  
+  
+void VTKViewer_RenderWindowInteractor::setPointData(const Handle(SALOME_InteractiveObject)& IObject, 
+                                                   const int& theIndex, vtkActor* theActor )
+{
+  TColStd_MapOfInteger MapIndex; MapIndex.Add(theIndex);
+  return setActorData(IObject,MapIndex,&PointCreateMapper,theActor);
+}
 
   
 static void EdgeCreateMapper(vtkPolyData *theSourcePolyData, vtkPolyDataMapper* theMapper, 
@@ -1160,3 +1239,11 @@ bool VTKViewer_RenderWindowInteractor::highlightEdge( const Handle(SALOME_Intera
 {
   return highlight(IObject,MapIndex,&EdgeCreateMapper,Edge_Actor,hilight,update);
 }
+  
+void VTKViewer_RenderWindowInteractor::setEdgeData(const Handle(SALOME_InteractiveObject)& IObject, 
+                                                  const int& theCellIndex, const int& theEdgeIndex, 
+                                                  vtkActor* theActor )
+{
+  TColStd_MapOfInteger MapIndex; MapIndex.Add(theCellIndex); MapIndex.Add(theEdgeIndex);
+  return setActorData(IObject,MapIndex,&EdgeCreateMapper,theActor);
+}
index e5fa4088529c8953db29d6d2f77083117cc0e8e7..3a22e676aa2093cbfa04b50c2be6bfaafcc58723 100644 (file)
@@ -34,6 +34,7 @@
 
 #include "SALOME_InteractiveObject.hxx"
 #include "SALOME_Actor.h"
+#include "SALOME_Selection.h"
 
 // QT Includes
 #include <qobject.h>
@@ -141,8 +142,20 @@ public:
   bool isVisible( const Handle(SALOME_InteractiveObject)& IObject);
   void rename(const Handle(SALOME_InteractiveObject)& IObject, QString newName);
 
-
-  void SetSelectionMode(int mode);
+  void SetSelectionMode(Selection_Mode mode);
+  void SetSelectionProp(const double& theRed = 1, const double& theGreen = 1,
+                       const double& theBlue = 0, const int& theWidth = 5);
+  void SetSelectionTolerance(const double& theTolNodes = 0.025, const double& theTolCell = 0.001);
+
+  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();
@@ -167,6 +180,7 @@ public:
   void Display(const Handle(SALOME_InteractiveObject)& IObject, bool immediatly=true);
 
   void Display( SALOME_Actor* SActor, bool immediatly = true );
+  void Erase( SALOME_Actor* SActor, bool immediatly = true );
 
   // Transparency
   void SetTransparency(const Handle(SALOME_InteractiveObject)& IObject,float trans);
@@ -196,6 +210,9 @@ public:
   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 );
 
   // Timer used during various mouse events to figure 
   // out mouse movements. 
@@ -205,7 +222,7 @@ public:
   int displaymode;
 
   //NRI: Selection mode
-  int selectionmode;
+  Selection_Mode selectionmode;
   vtkActor* Point_Actor;
   vtkActor* Edge_Actor; //NB
   vtkActor* Cell_Actor;
@@ -243,6 +260,8 @@ public:
 
  private:
   QWidget*     myGUIWindow;  
+  double       myTolNodes;
+  double       myTolItems;
 };
 
 #endif
index be2d1889461fefb4f683091820e869289107415f..9a278d4a6b764c7419120f4336599f98dec6f58c 100644 (file)
@@ -63,6 +63,7 @@ public:
 
 protected:
   VTKViewer_UnScaledActor();
+  ~VTKViewer_UnScaledActor(){}
   int mySize;
 };
 
@@ -82,8 +83,12 @@ void VTKViewer_UnScaledActor::Render(vtkRenderer *theRenderer){
     float aWinDiag = sqrt(float(aSize[0]*aSize[0]+aSize[1]*aSize[1]));
     vtkDataSet* aDataSet = GetMapper()->GetInput();
     float aLength = aDataSet->GetLength();
+    float aPrecision = 1.0E-3;
+    float anOldScale = GetScale()[0];
     float aScale = mySize*aWorldDiag/aWinDiag/aLength*sqrt(float(aSize[0])/float(aSize[1]));
-    SetScale(aScale);
+    if(fabs(aScale - anOldScale)/aScale > aPrecision){
+      SetScale(aScale);
+    }
   }
   vtkFollower::Render(theRenderer);
 }
@@ -94,6 +99,50 @@ 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);
+vtkCxxSetObjectMacro(VTKViewer_LineActor,ArrowActor,VTKViewer_UnScaledActor);
+
+void VTKViewer_LineActor::Render(vtkRenderer *theRenderer){
+  if(LabelActor && LabelActor->GetVisibility()){
+    LabelActor->Modified();
+    LabelActor->Render(theRenderer);
+  }
+  if(ArrowActor && ArrowActor->GetVisibility()){
+    ArrowActor->Modified();
+    ArrowActor->Render(theRenderer);
+  }
+  vtkFollower::Render(theRenderer);
+}
+
+//==============================================================================
+
 // The base class for concreate Axis
 // Its only duty is to give correct initialization and destruction
 //   of its pipe-lines
@@ -106,9 +155,10 @@ protected:
   vtkTypeMacro(VTKViewer_Axis,vtkObject);
   
   virtual void AddToRender(vtkRenderer* theRenderer){
+    //Order of the calls are important
+    theRenderer->AddActor(myLineActor);
     theRenderer->AddActor(myLabelActor);
     theRenderer->AddActor(myArrowActor);
-    theRenderer->AddActor(myLineActor);
   }
 
   virtual void SetVisibility(VTKViewer_Trihedron::TVisibility theVis);
@@ -140,7 +190,8 @@ protected:
   VTKViewer_Trihedron::TVisibility myVisibility;
   float myDir[3], myRot[3];
 
-  vtkActor *myLineActor;
+  VTKViewer_LineActor *myLineActor;
+  //vtkActor *myLineActor;
   VTKViewer_UnScaledActor *myArrowActor;
   VTKViewer_UnScaledActor *myLabelActor;
 
@@ -158,7 +209,7 @@ VTKViewer_Axis::VTKViewer_Axis(){
   myMapper[0] = vtkPolyDataMapper::New();
   myMapper[0]->SetInput(myLineSource->GetOutput());
 
-  myLineActor = vtkActor::New();
+  myLineActor = VTKViewer_LineActor::New();
   myLineActor->SetMapper(myMapper[0]);
   myLineActor->PickableOff();
 
@@ -176,6 +227,8 @@ VTKViewer_Axis::VTKViewer_Axis(){
   myArrowActor->SetSize(aArrowActorSize);
   myArrowActor->PickableOff();
 
+  myLineActor->SetArrowActor(myArrowActor);
+
   // Initialize the Label pipe-line representation
   myVectorText = VTKViewer_VectorText::New();
 
@@ -187,6 +240,9 @@ VTKViewer_Axis::VTKViewer_Axis(){
   static int aLabelActorSize = 12;
   myLabelActor->SetSize(aLabelActorSize);
   myLabelActor->PickableOff();
+  //myLabelActor->DebugOn();
+
+  myLineActor->SetLabelActor(myLabelActor);
 
   // Initialise visibility param.
   myVisibility = VTKViewer_Trihedron::eOn;
@@ -379,12 +435,3 @@ int VTKViewer_Trihedron::GetVisibleActorCount(vtkRenderer* theRenderer){
   //SetVisibility(aVis);
   return aCount;
 }
-
-void VTKViewer_Trihedron::Render(vtkRenderer* theRenderer){
-  for(int i = 0; i < 3; i++)
-    {
-      myAxis[i]->GetLabel()->Render(theRenderer);
-      myAxis[i]->GetArrow()->Render(theRenderer);
-    }
-}
-
index 056ea158f23f74d47b2650f98838a80ced7faa39..d53a602c32a8b1d23c54f1e87bb8644cdd07e184 100644 (file)
@@ -58,8 +58,6 @@ class VTKViewer_Trihedron : public vtkObject{
 
   virtual int GetVisibleActorCount(vtkRenderer* theRenderer);
   
-  virtual void  Render(vtkRenderer *theRenderer);
-  
 protected:
   vtkActorCollection* myPresent;
   VTKViewer_Axis* myAxis[3];
index ce64a1e4c835805881ebf4cf3a151932dfd494cb..b8b61997f5b29f0c66785ec5343b0ee608d9dae0 100644 (file)
@@ -52,7 +52,7 @@ void ResetCamera(vtkRenderer* theRenderer, int theUsingZeroFocalPoint){
     if ( theRenderer->GetActiveCamera() != NULL )
       theRenderer->GetActiveCamera()->GetViewPlaneNormal(vn);
     else{
-      INFOS("Trying to reset non-existant camera");
+      MESSAGE("Trying to reset non-existant camera");
       return;
     }
     
index 8f9e8e286b1f39d0388a8f6c3a64b3c39fc8bf18..b68158db7374a2b735edf84261a5794d334119d9 100644 (file)
@@ -34,7 +34,6 @@
 
 #include "SALOME_Transform.h"
 #include "SALOME_TransformFilter.h"
-#include "SALOME_PassThroughFilter.h"
 #include "SALOME_GeometryFilter.h"
 
 #include "QAD_Settings.h"
@@ -168,10 +167,10 @@ void VTKViewer_ViewFrame::onAdjustTrihedron(){
     float aSize = m_Triedron->GetSize();
     float aNewSize = aLength*aSizeInPercents/100.0;
     // 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)
+    if(fabs(aNewSize-aSize) > aSize*EPS_SIZE || fabs(aNewSize-aSize) > aNewSize*EPS_SIZE){
       m_Triedron->SetSize(aNewSize);
+    }
   }
-  m_Triedron->Render(m_Renderer);
   ::ResetCameraClippingRange(m_Renderer);
 }
 
@@ -350,7 +349,7 @@ QColor VTKViewer_ViewFrame::backgroundColor() const
 }
 
 
-void VTKViewer_ViewFrame::SetSelectionMode( int mode )
+void VTKViewer_ViewFrame::SetSelectionMode( Selection_Mode mode )
 {
   m_RWInteractor->SetSelectionMode( mode );
 }
@@ -371,31 +370,33 @@ void VTKViewer_ViewFrame::highlight( const Handle(SALOME_InteractiveObject)& IOb
 {
   QAD_Study* ActiveStudy = QAD_Application::getDesktop()->getActiveStudy();
   SALOME_Selection* Sel = SALOME_Selection::Selection( ActiveStudy->getSelection() );
-  if ( Sel->SelectionMode() == 4 )
-    m_RWInteractor->highlight(IObject, highlight, update);
-  else if ( Sel->SelectionMode() == 3 ) {
-    m_RWInteractor->highlight(IObject, highlight, update);
+  m_RWInteractor->highlight(IObject, highlight, update);
+
+  switch (Sel->SelectionMode()) {
+  case NodeSelection:
     if ( Sel->HasIndex( IObject ) ) {
       TColStd_MapOfInteger MapIndex;
       Sel->GetIndex( IObject, MapIndex );
-      m_RWInteractor->highlightCell(IObject, highlight, MapIndex, update);
+      m_RWInteractor->highlightPoint(IObject, highlight, MapIndex, update);
     }
-  } 
-  else if ( Sel->SelectionMode() == 2 ) {
-    m_RWInteractor->highlight(IObject, highlight, update);
+    break;
+  case EdgeOfCellSelection:
     if ( Sel->HasIndex( IObject ) ) {
       TColStd_MapOfInteger MapIndex;
       Sel->GetIndex( IObject, MapIndex );
       m_RWInteractor->highlightEdge(IObject, highlight, MapIndex, update);
     }
-  }
-  else if ( Sel->SelectionMode() == 1 ) {
-    m_RWInteractor->highlight(IObject, highlight, update);
+    break;
+  case CellSelection:
+  case EdgeSelection:
+  case FaceSelection:
+  case VolumeSelection:
     if ( Sel->HasIndex( IObject ) ) {
       TColStd_MapOfInteger MapIndex;
       Sel->GetIndex( IObject, MapIndex );
-      m_RWInteractor->highlightPoint(IObject, highlight, MapIndex, update);
+      m_RWInteractor->highlightCell(IObject, highlight, MapIndex, update);
     }
+    break;
   }
 }
 
@@ -621,5 +622,3 @@ void VTKViewer_ViewFrame::RemoveActor( SALOME_Actor* theActor, bool update /*=fa
   theActor->RemoveFromRender(m_Renderer);
   if(update) Repaint();
 }
-
-
index 83fc35ab1feb680b404e48efa4dded7804bfc75c..5547699faffb714c50d91cad05837a62dc88e0e6 100644 (file)
@@ -58,7 +58,7 @@ class QAD_EXPORT VTKViewer_ViewFrame : public QAD_ViewFrame{
   void                           setBackgroundColor( const QColor& );
   QColor                         backgroundColor() const;
   
-  void                           SetSelectionMode( int mode );
+  void                           SetSelectionMode( Selection_Mode mode );
 
   /*  popup management */
   void                           setPopupServer( QAD_Application* );