From: prascle Date: Mon, 24 Nov 2003 17:48:21 +0000 (+0000) Subject: PR: included tag V1_3_0 X-Git-Tag: PRAS_br1_1_3_0 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2FPRAS_br1;p=modules%2Fkernel.git PR: included tag V1_3_0 --- diff --git a/INSTALL b/INSTALL index 357a972b8..7879c9772 100644 --- a/INSTALL +++ b/INSTALL @@ -1 +1,4 @@ -This is the version 1.2.1 of KERNEL +This is the version 1.3.0 of KERNEL + +Previous versions : + - 1.2.1 diff --git a/Makefile.in b/Makefile.in index 52b547b1e..2aeee3a55 100644 --- a/Makefile.in +++ b/Makefile.in @@ -14,7 +14,7 @@ VPATH=.:@srcdir@:@top_srcdir@/bin:@top_srcdir@/resources:./bin:@top_srcdir@/idl @COMMENCE@ -SUBDIRS = idl src salome_adm +SUBDIRS = idl src examples salome_adm RESOURCES_FILES = \ back.xpm \ diff --git a/bin/VERSION b/bin/VERSION index 713d5372c..42b1f7f00 100755 --- a/bin/VERSION +++ b/bin/VERSION @@ -1 +1 @@ -THIS IS SALOME PRO - KERNEL VERSION: 1.2.1 +THIS IS SALOME - KERNEL VERSION: 1.3.0 diff --git a/bin/runSalome b/bin/runSalome index a41903406..218805ed9 100755 --- a/bin/runSalome +++ b/bin/runSalome @@ -1,13 +1,5 @@ #!/bin/sh -export KERNEL_ROOT_DIR=/Salome2/KERNEL_install - -export GEOM_ROOT_DIR=/Salome2/GEOM_install -export MED_ROOT_DIR=/Salome2/MED_install -export SMESH_ROOT_DIR=/Salome2/SMESH_install -export SUPERV_ROOT_DIR=/Salome2/SUPERV_install -export VISU_ROOT_DIR=/Salome2/VISU_install - python -i runSalome.py --gui --modules=GEOM,SMESH,VISU,SUPERV,MED --xterm --containers=python --killall #python -i runSalome.py --gui --modules=GEOM,SMESH,VISU,SUPERV,MED --logger --xterm #python -i runSalome.py --modules=GEOM,SMESH,VISU,SUPERV,MED diff --git a/bin/runSalome.py b/bin/runSalome.py index 67cacf59d..ee152afae 100755 --- a/bin/runSalome.py +++ b/bin/runSalome.py @@ -300,7 +300,8 @@ def startSalome(): # Lancement Session Loader # - SessionLoader().run() + if with_gui: + SessionLoader().run() # # Initialisation ORB et Naming Service @@ -374,11 +375,12 @@ def startSalome(): import SALOME session=clt.waitNS("/Kernel/Session",SALOME.Session) - + + theComputer = os.getenv("HOSTNAME") computerSplitName = theComputer.split('.') theComputer = computerSplitName[0] - + # # Lancement Container C++ local # @@ -404,11 +406,12 @@ def startSalome(): clt.waitNS("/Containers/" + theComputer + "/FactoryServerPy") - # - # Lancement Container Supervision local - # - if with_container_superv: + + # + # Lancement Container Supervision local + # + ContainerSUPERVServer().run() # @@ -425,7 +428,7 @@ def startSalome(): #session.GetInterface() end_time = os.times() - + print print "Start SALOME, elpased time : %5.1f seconds"% (end_time[4] - init_time[4]) return clt diff --git a/doc/DevelopersGuide/Makefile.in b/doc/DevelopersGuide/Makefile.in index 03e3387ad..fc731be0a 100644 --- a/doc/DevelopersGuide/Makefile.in +++ b/doc/DevelopersGuide/Makefile.in @@ -1,11 +1,29 @@ - -# -* Makefile *- +# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +# # -# Author : Patrick GOLDBRONN (CEA) -# Date : 30/11/2001 -# $Header$ # -# source path +# File : Makefile.in +# Author : Patrick GOLDBRONN (CEA) +# Module : doc +# $Header$ + top_srcdir=@top_srcdir@ top_builddir=../.. srcdir=@srcdir@ diff --git a/doc/html/INPUT/HTML/Logger.html b/doc/html/INPUT/HTML/Logger.html index 83cfa74dd..1a73901c0 100644 --- a/doc/html/INPUT/HTML/Logger.html +++ b/doc/html/INPUT/HTML/Logger.html @@ -10,5 +10,9 @@
void putMessage ( in string message )
putMessage ( message )
+ +
void ping ( )
+
ping ( )
+
diff --git a/doc/html/INPUT/HTML/SALOMEDS.html b/doc/html/INPUT/HTML/SALOMEDS.html index 7a9c3d9e7..52291faa3 100644 --- a/doc/html/INPUT/HTML/SALOMEDS.html +++ b/doc/html/INPUT/HTML/SALOMEDS.html @@ -271,10 +271,18 @@
Save ( aStudy, theMultiFile )
+
void SaveASCII ( in Study aStudy, in boolean theMultiFile )
+
SaveASCII ( aStudy, theMultiFile )
+ +
void SaveAs ( in URL aUrl, in Study aStudy, in boolean theMultiFile )
SaveAs ( aUrl, aStudy, theMultiFile )
+
void SaveAsASCII ( in URL aUrl, in Study aStudy, in boolean theMultiFile )
+
SaveAsASCII ( aUrl, aStudy, theMultiFile )
+ +
ListOfOpenStudies GetOpenStudies ( )
return_value = GetOpenStudies ( )
@@ -539,10 +547,18 @@
return_value = Save ( theComponent, theURL, isMultiFile )
+
TMPFile SaveASCII ( in SComponent theComponent, in string theURL, in boolean isMultiFile )
+
return_value = SaveASCII ( theComponent, theURL, isMultiFile )
+ +
boolean Load ( in SComponent theComponent, in TMPFile theStream, in string theURL, in boolean isMultiFile )
return_value = Load ( theComponent, theStream, theURL, isMultiFile )
+
boolean LoadASCII ( in SComponent theComponent, in TMPFile theStream, in string theURL, in boolean isMultiFile )
+
return_value = LoadASCII ( theComponent, theStream, theURL, isMultiFile )
+ +
void Close ( in SComponent aSComponent )
Close ( aSComponent )
@@ -551,12 +567,12 @@
return_value = ComponentDataType ( )
-
string IORToLocalPersistentID ( in SObject theSObject, in string IORString, in boolean isMultiFile )
-
return_value = IORToLocalPersistentID ( theSObject, IORString, isMultiFile )
+
string IORToLocalPersistentID ( in SObject theSObject, in string IORString, in boolean isMultiFile, in boolean isASCII )
+
return_value = IORToLocalPersistentID ( theSObject, IORString, isMultiFile, isASCII )
-
string LocalPersistentIDToIOR ( in SObject theSObject, in string aLocalPersistentID, in boolean isMultiFile )
-
return_value = LocalPersistentIDToIOR ( theSObject, aLocalPersistentID, isMultiFile )
+
string LocalPersistentIDToIOR ( in SObject theSObject, in string aLocalPersistentID, in boolean isMultiFile, in boolean isASCII )
+
return_value = LocalPersistentIDToIOR ( theSObject, aLocalPersistentID, isMultiFile, isASCII )
boolean CanPublishInStudy ( in Object theIOR )
diff --git a/doc/html/INPUT/HTML/SALOME_Component.html b/doc/html/INPUT/HTML/SALOME_Component.html index 8bb1d3341..045775117 100644 --- a/doc/html/INPUT/HTML/SALOME_Component.html +++ b/doc/html/INPUT/HTML/SALOME_Component.html @@ -70,5 +70,9 @@
boolean Resume_impl ( )
return_value = Resume_impl ( )
+ +
long CpuUsed_impl ( )
+
return_value = CpuUsed_impl ( )
+
diff --git a/doc/html/INPUT/HTML/SALOME_Session.html b/doc/html/INPUT/HTML/SALOME_Session.html index 2b92ed086..804a067a9 100644 --- a/doc/html/INPUT/HTML/SALOME_Session.html +++ b/doc/html/INPUT/HTML/SALOME_Session.html @@ -11,7 +11,7 @@
GetInterface ( )
-
VISU_Gen GetVisuGen ( )
+
Component GetVisuGen ( )
return_value = GetVisuGen ( )
diff --git a/doc/html/INPUT/doxyfile b/doc/html/INPUT/doxyfile index 7d216e70c..537e1c9df 100755 --- a/doc/html/INPUT/doxyfile +++ b/doc/html/INPUT/doxyfile @@ -3,7 +3,7 @@ #--------------------------------------------------------------------------- # General configuration options #--------------------------------------------------------------------------- -PROJECT_NAME = "SALOME PRO v.1.2" +PROJECT_NAME = "SALOME v.1.3.0" PROJECT_NUMBER = id#1.1 OUTPUT_DIRECTORY = ../ OUTPUT_LANGUAGE = English @@ -61,7 +61,11 @@ INPUT = ../../../share/salome/idl/SALOME_ModuleCatalog.idl \ ../../../share/salome/idl/SALOME_Exception.idl \ ../../../share/salome/idl/SALOMEDS_Attributes.idl \ ../../../share/salome/idl/SALOME_Session.idl \ - ../../../share/salome/idl/SALOME_Component.idl + ../../../share/salome/idl/SALOME_Component.idl \ + ../../../share/salome/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx \ + ../../../share/salome/src/NamingService/SALOME_NamingService.hxx \ + ../../../share/salome/src/NamingService/SALOME_NamingService.cxx \ + ../../../share/salome/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx FILE_PATTERNS = RECURSIVE = NO EXCLUDE = @@ -101,11 +105,11 @@ GENERATE_HTMLHELP = NO CHM_FILE = HHC_LOCATION = GENERATE_CHI = NO -BINARY_TOC = NO -TOC_EXPAND = NO -DISABLE_INDEX = NO +BINARY_TOC = YES +TOC_EXPAND = YES +DISABLE_INDEX = YES ENUM_VALUES_PER_LINE = 4 -GENERATE_TREEVIEW = NO +GENERATE_TREEVIEW = YES TREEVIEW_WIDTH = 250 #--------------------------------------------------------------------------- # configuration options related to the LaTeX output diff --git a/doc/html/INPUT/sources/Application-About.png b/doc/html/INPUT/sources/Application-About.png index 80e0bcb06..7b58330d5 100755 Binary files a/doc/html/INPUT/sources/Application-About.png and b/doc/html/INPUT/sources/Application-About.png differ diff --git a/doc/html/INPUT/sources/Application-About1.jpg b/doc/html/INPUT/sources/Application-About1.jpg index b8f2cfb6d..cf7ab8ba0 100755 Binary files a/doc/html/INPUT/sources/Application-About1.jpg and b/doc/html/INPUT/sources/Application-About1.jpg differ diff --git a/doc/html/INPUT/sources/application.gif b/doc/html/INPUT/sources/application.gif index 10da488d2..0b05d5c18 100644 Binary files a/doc/html/INPUT/sources/application.gif and b/doc/html/INPUT/sources/application.gif differ diff --git a/doc/html/INPUT/sources/application.jpg b/doc/html/INPUT/sources/application.jpg index 6d3b6a0a8..a6979ab99 100755 Binary files a/doc/html/INPUT/sources/application.jpg and b/doc/html/INPUT/sources/application.jpg differ diff --git a/doc/html/INPUT/sources/bg_salomepro.gif b/doc/html/INPUT/sources/bg_salomepro.gif deleted file mode 100755 index 677b70468..000000000 Binary files a/doc/html/INPUT/sources/bg_salomepro.gif and /dev/null differ diff --git a/doc/html/INPUT/sources/doxygen.css b/doc/html/INPUT/sources/doxygen.css deleted file mode 100755 index 6e2c772fe..000000000 --- a/doc/html/INPUT/sources/doxygen.css +++ /dev/null @@ -1,49 +0,0 @@ -H1 { text-align: center; } -CAPTION { font-weight: bold } -A.qindex {} -A.qindexRef {} -A.el { text-decoration: none; font-weight: bold } -A.elRef { font-weight: bold } -A.code { text-decoration: none; font-weight: normal; color: #4444ee } -A.codeRef { font-weight: normal; color: #4444ee } -A:hover { text-decoration: none; background-color: lightblue } -DL.el { margin-left: -1cm } -DIV.fragment { width: 100%; border: none; background-color: #CCCCCC } -DIV.ah { background-color: #CCCCCC; font-weight: bold; color: #ffffff; margin-bottom: 3px; margin-top: 3px } -TD.md { background-color: lightblue; font-weight: bold; } -TD.mdname1 { background-color: lightblue; font-weight: bold; color: #602020; } -TD.mdname { background-color: lightblue; font-weight: bold; color: #602020; width: 600px; } -DIV.groupHeader { margin-left: 16px; margin-top: 12px; margin-bottom: 6px; font-weight: bold } -DIV.groupText { margin-left: 16px; font-style: italic; font-size: smaller } -BODY { background: url(sources/bg_salomepro.gif) } -TD.indexkey { - background-color: #CCCCCC; - font-weight: bold; - padding-right : 10px; - padding-top : 2px; - padding-left : 10px; - padding-bottom : 2px; - margin-left : 0px; - margin-right : 0px; - margin-top : 2px; - margin-bottom : 2px -} -TD.indexvalue { - background-color: #CCCCCC; - font-style: italic; - padding-right : 10px; - padding-top : 2px; - padding-left : 10px; - padding-bottom : 2px; - margin-left : 0px; - margin-right : 0px; - margin-top : 2px; - margin-bottom : 2px -} -span.keyword { color: #008000 } -span.keywordtype { color: #604020 } -span.keywordflow { color: #e08000 } -span.comment { color: #800000 } -span.preprocessor { color: #806020 } -span.stringliteral { color: #002080 } -span.charliteral { color: #008080 } diff --git a/doc/html/Makefile.in b/doc/html/Makefile.in index f7fe30037..1e8ae14d7 100644 --- a/doc/html/Makefile.in +++ b/doc/html/Makefile.in @@ -9,6 +9,7 @@ top_srcdir=@top_srcdir@ top_builddir=../.. +root_srcdir=@ROOT_SRCDIR@ srcdir=@srcdir@ VPATH=.:@srcdir@ doxygen=@DOXYGEN@ @@ -18,11 +19,11 @@ doxygen=@DOXYGEN@ doc: cp -fr $(srcdir)/INPUT ./; \ cd INPUT; \ - sed 's|../../../share/salome|../$(top_srcdir)|' doxyfile > doxyfile1; \ + sed 's|../../../share/salome|$(root_srcdir)|' ./doxyfile > ./doxyfile1; \ mv -f doxyfile1 doxyfile; \ $(doxygen) ./doxyfile; \ cd ..; \ - cp -f $(srcdir)/INPUT/sources/doxygen.css ./html/doxygen.css + cp -fr $(srcdir)/INPUT/sources/static/*.* ./html/ cp -fr $(srcdir)/INPUT/sources/ html/ cp -fr $(srcdir)/INPUT/exemple/ html/ cp -fr $(srcdir)/INPUT/HTML/ html/ diff --git a/idl/Logger.idl b/idl/Logger.idl index d58070da2..c30b5e22f 100644 --- a/idl/Logger.idl +++ b/idl/Logger.idl @@ -16,6 +16,7 @@ module SALOME_Logger { //put message into one special place for all servers using Logger oneway void putMessage (in string message); + void ping (); }; }; diff --git a/idl/SALOMEDS.idl b/idl/SALOMEDS.idl index 5fcb8c16a..ed5f15d54 100644 --- a/idl/SALOMEDS.idl +++ b/idl/SALOMEDS.idl @@ -9,7 +9,7 @@ // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software @@ -24,347 +24,7 @@ // $Header$ /*! \mainpage - \image html Application-About.png - -*/ -/*! \page page1 Mapping of IDL definitions to Python language. -\section Intro Introduction -%SALOME PRO is a distributed client/server application using the Common Object Request Broker Architecture (CORBA). -CORBA architecture uses the Interface Definition Language (IDL), which specifies interfaces between CORBA objects. So with help of IDL -CORBA's language independence is ensured . Because interfaces described in IDL can be mapped to the most of currently used programming languages, CORBA applications and components are thus -independent of the language(s) used to implement them. In other words, a client written in C++ can communicate with a server written in Java, which in turn can communicate with -another server written in COBOL, and so forth. - -One important thing to remember about IDL is that it is not an implementation language. That is, applications can't be written in IDL. The sole purpose of IDL is to define interfaces; -providing implementations for these interfaces is performed using some other language. - -This page contains an abridged reference manual for mapping of IDL definitions to Python language. It will be useful for Python programmers who are not familiar -with IDL language. All examples are taken from %SALOME PRO source files. -The complete version of Python Language Mapping Specification can be found here. - -
CONTENTS: -- \ref subsection1 -- \ref subsection2 -- \ref subsection3 -- \ref subsection4 -- \ref subsection5 -- \ref subsection6 -- \ref subsection7 - -\subsection subsection1 Using Scoped Names - -Python implements a module concept that is similar to the IDL scoping mechanisms, -except that it does not allow for nested modules. In addition, Python requires each -object to be implemented in a module; globally visible objects are not supported. - -Because of these constraints, scoped names are translated into Python using the -following rules: - -• An IDL module mapped into a Python module. Modules containing modules are -mapped to packages (i.e., directories with an __init__ module containing all -definitions excluding the nested modules). An implementation can chose to map toplevel -definitions (including the module CORBA) to modules in an implementationdefined -package, to allow concurrent installations of different CORBA runtime -libraries. In that case, the implementation must provide additional modules so that -toplevel modules can be used without importing them from a package. - -• For all other scopes, a Python class is introduced that contains all the definitions -inside this scope. - -• Other global definitions (except modules) appear in a module whose name is -implementation dependent. Implementations are encouraged to use the name of the -IDL file when defining the name of that module. - -For instance, - -\verbatim -module SALOMEDS { - interface StudyManager { - void Close(in Study aStudy); - }; -}; -\endverbatim - -would introduce a module SALOMEDS.py, which contains the following definitions: - -\verbatim -# module SALOMEDS.py -class StudyManager: - def _Close(self,aStudy): - pass #interfaces are discussed later -\endverbatim - -To avoid conflicts, IDL names that are also Python identifiers are prefixed with an underscore (‘_’). - -\subsection subsection2 Mapping for Template and Array Types - -Both the bounded and the unbounded string type of IDL are mapped to the Python -string type. Wide strings are represented by an implementation-defined type with the -following properties: - -• For the wide string X and the integer n, X[n] returns the nth character, which is a -wide string of length 1. - -• len(X) returns the number of characters of wide string X. - -• CORBA.wstr(c) returns a wide character with the code point c in an -implementation-defined encoding. - -• X+Y returns the concatenation of wide strings X and Y. - -• CORBA.word(CORBA.wstr(c)) == c - -The sequence template is mapped to sequence objects (e.g., tuples or lists). -Applications should not assume that values of a sequence type are mutable. Sequences -and arrays of octets and characters are mapped to the string type for efficiency reasons. - -For example, given the IDL definitions - -\verbatim -module SALOMEDS { - typedef sequence StringSeq; - - interface AttributeTableOfInteger : GenericAttribute { - - void SetRowTitles(in StringSeq theTitles) raises(IncorrectArgumentLength); - }; -}; -\endverbatim - -a client could invoke the operation - -\verbatim -print My_AttributeTableOfInteger.SetRowTitles(["X","F"]) -\endverbatim - -Array types are mapped like sequence templates. The application in this example also expects an -IncorrectArgumentLength exception if it passes sequences that violate the bounds constraint or -arrays of wrong size. - -Another example with arrays. The following IDL definition - -\verbatim -module SALOMEDS { - typedef sequence ListOfAttributes; - interface SObject { - ListOfAttributes GetAllAttributes(); - }; -}; -\endverbatim - -is equal to - -\verbatim -import SALOMEDS - -attributes=[] - -attributes = My_SObject.GetAllAttributes() - -length = len(attributes) - -print "Attributes number = ", length -print attributes -\endverbatim - -\subsection subsection3 Mapping for Objects and Operations - -A CORBA object reference is represented as a Python object at run-time. This object -provides all the operations that are available on the interface of the object. Although -this specification does not mandate the use of classes for stub objects, the following -discussion uses classes to indicate the interface. - -The nil object is represented by None. - -If an operation expects parameters of the IDL Object type, any Python object -representing an object reference might be passed as actual argument. - -If an operation expects a parameter of an abstract interface, either an object -implementing that interface, or a value supporting this interface may be passed as -actual argument. The semantics of abstract values then define whether the argument is -passed by value or by reference. - -Operations of an interface map to methods available on the object references. -Parameters with a parameter attribute of in or inout -are passed from left to right tothe method, skipping out parameters. -The return value of a method depends on the number of out parameters -and the return type. If the operation returns a value, this -value forms the first result value. All inout or out -parameters form consecutive result values. The method result depends then on the number -of result values: - -• If there is no result value, the method returns None. - -• If there is exactly one result value, it is returned as a single value. - -• If there is more than one result value, all of them are packed into a tuple, and this -tuple is returned. - -Assuming the IDL definition - -\verbatim -module SALOMEDS{ - interface StudyBuilder{ - boolean FindAttribute ( in SObject anObject, - out GenericAttribute anAttribute, - in string aTypeOfAttribute ); - }; -}; -\endverbatim - -a client could write - -\verbatim -from SALOMEDS import StudyBuilder; -my_StudyBuilder=... - - res,A=my_StudyBuilder.FindAttribute(Sobj, "AttributeSequenceOfReal") -\endverbatim - -In this example A corresponds to the return value anAttribute and -res to the boolean return value. - -If an interface defines an attribute name, for example, the attribute is mapped into an -operation _get_name. If the attribute is not readonly, there is an -additional operation _set_name. - -The IDL definition - -\verbatim -module SALOMEDS{ - interface Study{ - attribute string Name; - }; -}; -\endverbatim - -is equal to the following - -\verbatim -from SALOMEDS import Study -My_Study=... - Name=My_Study._get_name(); - Name=My_Study._set_name(); -\endverbatim - -\subsection subsection4 Narrowing Object References - -Python objects returned from CORBA operations or pseudo-operations (such as -string_to_object) might have a dynamic type, which is more specific than the -static type as defined in the operation signature. - -Since there is no efficient and reliable way of automatically creating the most specific -type, explicit narrowing is necessary. To narrow an object reference A to an interface -class AttributeSequenceOfReal, the client can use the following operation - -\verbatim -A = A._narrow(SALOMEDS.AttributeSequenceOfReal) -\endverbatim - -\subsection subsection5 Mapping for Exceptions - -An IDL exception is translated into a Python class derived from -CORBA.UserException. System exceptions are derived from CORBA.SystemException. -Both base classes are derived from CORBA.Exception. The parameters of the -exception are mapped in the same way as the fields of a struct definition. When -raising an exception, a new instance of the class is created; the constructor -expects the exception parameters. For example, the definition - -\verbatim -module SALOMEDS{ - interface StudyBuilder{ - exception LockProtection {}; - void CommitCommand() raises(LockProtection); - }; -}; -\endverbatim - -could be used caught as - -\verbatim -from SALOMEDS import StudyBuilder; -my_StudyBuilder=... -try: - my_StudyBuilder.CommitCommand(); -except StudyBuilder.LockProtection,value: - print "Error! Study is locked for modifications" -\endverbatim - - -\subsection subsection6 Mapping for Enumeration Types - -An enumeration is mapped into a number of constant objects in the name space where -the enumeration is defined. An application may only test for equivalence of two -enumeration values, and not assume that they behave like numbers. -For example, the definition - -\verbatim -module VISU { - interface PrsObject{ - - enum PrsObjType{ TCURVE, TTABLE, TMESH, TCONTAINER, - TSCALARMAP, TISOSURFACE, TDEFORMEDSHAPE, - TCUTPLANES, TVECTORS }; - }; -}; -\endverbatim - -introduces the objects - -\verbatim -from VISU import PrsObject -VISU.PrsObjType.TCURVE,VISU.PrsObjType.TTABLE,VISU.PrsObjType.TMESH,VISU.PrsObjType.TCONTAINER, -VISU.PrsObjType.TSCALARMAP,VISU.PrsObjType.TISOSURFACE,VISU.PrsObjType.TDEFORMEDSHAPE,VISU.PrsObjType.TCUTPLANES, -VISU.PrsObjType.TVECTORS -\endverbatim - -\subsection subsection7 Mapping for Structured Types - -An IDL struct definition is mapped into a Python class or type. For each field in the -struct, there is a corresponding attribute in the class with the same name as the field. -The constructor of the class expects the field values, from left to right. -For example, the IDL definition - -\verbatim -struct SDate { - short Second; - short Minute; - short Hour; - short Day; - short Month; - short Year; - }; -\endverbatim - -could be used in the Python statements - -\verbatim -Date=SDate(30, 12, 15, 26, 1, 79) -print Date.Second,Date.Minute,Date.Hour,Date.Day,Date.Month,Date.Year -\endverbatim -*/ -/*! \page page2 Mapping of SALOME IDL definitions to Python language. - - - - %SALOME STUDY module - - Mapping of %SALOMEDS functions - - Mapping of SALOMEDS_Attributes functions - - %SAlOME KERNEL module - - Mapping of %Med_Gen functions - - Mapping of %SALOME_Session functions - - Mapping of %SALOME_ModuleCatalog functions - - Mapping of %SALOME_Exception functions - - Mapping of %SALOME_Component functions - - %SALOME MED component - - Mapping of %Med functions - - %SALOME SUPERVISION module - - Mapping of %SUPERV functions - - %SALOME %VISU module - - Mapping of %VISU_Gen functions - -*/ - -/*! \defgroup Study SALOME STUDY module + \image html Application-About.png */ /*! @@ -377,7 +37,7 @@ print Date.Second,Date.Minute,Date.Hour,Date.Day,Date.Month,Date.Year #include "SALOME_Exception.idl" -/*! \ingroup Study +/*! This package contains the interfaces used for creation, managment and modification of the %Study */ @@ -400,7 +60,10 @@ module SALOMEDS /*! IOR of the study in %SALOME application */ typedef string SalomeReference; -/*! List of names of open studies in a %SALOME session + +/*! List of the names of studies which are currently open in this %SALOME session. +Since %SALOME is a multi-study application, it allows to open a lot of studies +during each working session. */ typedef sequence ListOfOpenStudies; /*! List of file names @@ -436,10 +99,12 @@ module SALOMEDS interface UseCaseIterator; interface UseCaseBuilder; interface Callback; + /*! List of attributes */ typedef sequence ListOfAttributes; -/*! Exception indicating that this feature hasn't been implemented + +/*! Exception indicating that this feature hasn't been implemented. */ exception NotImplemented {}; @@ -489,7 +154,7 @@ module SALOMEDS */ typedef sequence ListOfSObject; /*! - Gets a persistent reference to the %Study. + Gets the persistent reference to the %Study. */ PersistentReference GetPersistentReference(); /*! @@ -901,24 +566,35 @@ module SALOMEDS Closes the study. */ void Close(in Study aStudy); -/*! \brief Saving the study +/*! \brief Saving the study in a HDF file (or files). Saves the study. + \param theMultiFile If this parameter is True the study will be saved in several files.
See also an example of this method usage in batchmode of %SALOME application. */ void Save(in Study aStudy, in boolean theMultiFile); +/*! \brief Saving the study in a ASCII file (or files). + Saves the study in a ASCII format. + \param theMultiFile If this parameter is True the study will be saved in several files. +*/ void SaveASCII(in Study aStudy, in boolean theMultiFile); -/*! \brief Saving the study in a file +/*! \brief Saving the study in a specified HDF file (or files). + + Saves the study in a specified file (or files). + \param theMultiFile If this parameter is True the study will be saved in several files. - Saves the study in a specified file.
See also an example of this method usage in batchmode of %SALOME application. */ void SaveAs(in URL aUrl, // if the file already exists in Study aStudy, in boolean theMultiFile); // overwrite (as option) +/*! \brief Saving the study in a specified ASCII file (or files). + Saves the study in a specified ASCII file (or files). + \param theMultiFile If this parameter is True the study will be saved in several files. +*/ void SaveAsASCII(in URL aUrl, // if the file already exists in Study aStudy, in boolean theMultiFile); // overwrite (as option) @@ -1039,8 +715,7 @@ module SALOMEDS //========================================================================== /*! \brief %Generic attribute interface - %Generic attribute is a base interface for all attributes which inherit - its methods. + %Generic attribute is a base interface for all attributes which can be assigned to the SObjects created in the study. */ //========================================================================== interface GenericAttribute @@ -1063,6 +738,7 @@ module SALOMEDS //========================================================================== /*! \brief %SComponent interface + The %SComponent interface establishes in the study a permanent assocition to the Components integrated into %SALOME platform. The %SComponent interface is a specialization of the %SObject interface. It inherits the most of its methods from the %SObject interface. */ @@ -1240,7 +916,7 @@ Activates the %UseCaseIterator. If allLevels is True the Iterator is }; //========================================================================== //========================================================================== -/*! \brief The callback interface +/*! \brief The callback interface The %StudyBuilder can be created with the method NewBuilder. While invocation of this method a new object of the class Callback is created and this object is assigned to the newly created Builder as callback which should be called when adding and removing of the ojects. @@ -1367,5 +1043,5 @@ Activates the %UseCaseIterator. If allLevels is True the Iterator is }; }; - + #endif diff --git a/idl/SALOME_Component.idl b/idl/SALOME_Component.idl index 085bf919b..391112dfd 100644 --- a/idl/SALOME_Component.idl +++ b/idl/SALOME_Component.idl @@ -25,7 +25,7 @@ #ifndef _SALOME_COMPONENT_IDL_ #define _SALOME_COMPONENT_IDL_ -/*! \ingroup Kernel +/*! This is a package of interfaces used for connecting new components to %SALOME application. It also contains a set of interfaces used for management of %MED component in %SALOME application. @@ -37,7 +37,7 @@ module Engines /*! \brief Interface of the %Container This interface defines the process of loading and registration - of new components in SALOME application + of new components in %SALOME application */ interface Container { diff --git a/idl/SALOME_Exception.idl b/idl/SALOME_Exception.idl index 6c559445b..c310e9de4 100644 --- a/idl/SALOME_Exception.idl +++ b/idl/SALOME_Exception.idl @@ -24,25 +24,31 @@ // $Header$ /*! \file SALOME_Exception.idl This file contains the objects defining the main exception used -in %SALOME application. +in %SALOME application. The idl SALOME_Exception provides a generic CORBA exception for SALOME, + with an attribute that gives an exception type,a message, plus optional source file name and line number. +This idl is intended to serve for all user CORBA exceptions raised in SALOME code, as IDL specification +does not support exception inheritance. So, all the user CORBA exceptions from SALOME could be +handled in a single catch. + */ #ifndef _SALOME_EXCEPTION_IDL_ #define _SALOME_EXCEPTION_IDL_ /*! -Module SALOME regroups all idl definitions for SALOME Kernel +Module %SALOME regroups all idl definitions for %SALOME Kernel component */ module SALOME { /*! -This enumeration contains the elements indicating the type of the exception. +This enumeration contains the elements indicating the type of the exception +which can be raised during %SALOME session. */ enum ExceptionType { COMM, /*!< Communication problem */ BAD_PARAM, /*!< Bad User parameters */ - INTERNAL_ERROR /*!< SALOME Bug, irrecoverable */ + INTERNAL_ERROR /*!< Application level problem, irrecoverable */ }; /*! This struct contains a set of fields defining the structure of the exception. diff --git a/idl/SALOME_ModuleCatalog.idl b/idl/SALOME_ModuleCatalog.idl index 3f6bfaefb..d3ac7ecee 100644 --- a/idl/SALOME_ModuleCatalog.idl +++ b/idl/SALOME_ModuleCatalog.idl @@ -27,14 +27,15 @@ creation of the catalog of components in %SALOME application */ -/*! \ingroup Kernel +/*! The main package of interfaces used for creation of the module catalog in %SALOME application. */ module SALOME_ModuleCatalog { // Type Definitions /*! -This enumeration contains a set of definitions of %SALOME modules. +This enumeration contains a set of definitions of the components integrated +into %SALOME application. */ enum ComponentType { GEOM, /*! /dev/null + if test $? = 0 ; then + OCC_VERSION_MAJOR=`grep "define OCC_VERSION_MAJOR" $ff | awk '{i=3 ; print $i}'` + fi + fi fi if test "x$occ_ok" = "xyes"; then @@ -92,7 +101,7 @@ fi if test "x$occ_ok" = xyes ; then - CAS_CPPFLAGS="-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 -I$CASROOT/inc" CAS_CXXFLAGS="-funsigned-char" AC_MSG_CHECKING(for OpenCascade libraries) @@ -103,7 +112,6 @@ if test "x$occ_ok" = xyes ; then CXXFLAGS="$CXXFLAGS $CAS_CXXFLAGS" LIBS_old="$LIBS" LIBS="$LIBS -L$CASROOT/$casdir/lib -lTKernel" - AC_CACHE_VAL(salome_cv_lib_occ,[ AC_TRY_LINK( #include @@ -125,16 +133,18 @@ if test "x$occ_ok" = xno ; then AC_MSG_WARN(Opencascade libraries not found) else AC_MSG_RESULT(yes) - CAS_KERNEL="-L$CASROOT/$casdir/lib -lTKernel -lTKMath" - CAS_OCAF="-L$CASROOT/$casdir/lib -lPTKernel -lTKCAF -lFWOSPlugin -lTKPShape -lTKPCAF -lTKStdSchema -lTKShapeSchema -lPAppStdPlugin -lTKPAppStd -lTKCDF" + CAS_LDPATH="-L$CASROOT/$casdir/lib " + CAS_KERNEL="$CAS_LDPATH -lTKernel -lTKMath" + CAS_OCAF="$CAS_LDPATH -lPTKernel -lTKCAF -lFWOSPlugin -lTKPShape -lTKPCAF -lTKStdSchema -lTKShapeSchema -lPAppStdPlugin -lTKPAppStd -lTKCDF" dnl CAS_VIEWER="-L$CASROOT/$casdir/lib -lTKOpenGl -lTKV3d -lTKV2d -lTKService" - CAS_VIEWER="-L$CASROOT/$casdir/lib -lTKOpenGl -lTKV3d -lTKService" + CAS_VIEWER="$CAS_LDPATH -lTKOpenGl -lTKV3d -lTKService" # CAS_MODELER="-L$CASROOT/$casdir/lib -lTKG2d -lTKG3d -lTKGeomBase -lTKBRep -lTKGeomAlgo -lTKTopAlgo -lTKPrim -lTKBool -lTKHLR -lTKFillet -lTKFeat -lTKOffset" - CAS_MODELER="-L$CASROOT/$casdir/lib -lTKG2d -lTKG3d -lTKGeomBase -lTKBRep -lTKGeomAlgo -lTKTopAlgo -lTKPrim -lTKBool -lTKHLR -lTKFillet -lTKOffset" + CAS_MODELER="$CAS_LDPATH -lTKG2d -lTKG3d -lTKGeomBase -lTKBRep -lTKGeomAlgo -lTKTopAlgo -lTKPrim -lTKBool -lTKHLR -lTKFillet -lTKOffset" dnl CAS_DATAEXCHANGE="-L$CASROOT/$casdir/lib -lTKXSBase -lTKIGES -lTKSTEP -lTKShHealing -lTKShHealingStd -lTKSTL -lTKVRML " - CAS_DATAEXCHANGE="-L$CASROOT/$casdir/lib -lTKXSBase -lTKIGES -lTKSTEP -lTKShHealing -lTKShHealingStd" - CAS_LDFLAGS="$CAS_KERNEL $CAS_OCAF $CAS_VIEWER $CAS_MODELER $CAS_DATAEXCHANGE" - + CAS_DATAEXCHANGE="$CAS_LDPATH -lTKXSBase -lTKIGES -lTKSTEP -lTKShHealing -lTKShHealingStd" + CAS_LDFLAGS="$CAS_KERNEL $CAS_OCAF $CAS_VIEWER $CAS_MODELER $CAS_DATAEXCHANGE" + + fi AC_LANG_RESTORE diff --git a/salome_adm/unix/make_commence.in b/salome_adm/unix/make_commence.in index d5e8ecc61..a970492b1 100644 --- a/salome_adm/unix/make_commence.in +++ b/salome_adm/unix/make_commence.in @@ -100,12 +100,18 @@ MED2_MT_LIBS=@MED2_MT_LIBS@ OCC_INCLUDES=@CAS_CPPFLAGS@ OCC_CXXFLAGS=@CAS_CXXFLAGS@ -OCC_KERNEL_LIBS=@CAS_KERNEL@ -OCC_OCAF_LIBS=@CAS_OCAF@ -OCC_VIEWER_LIBS=@CAS_VIEWER@ -OCC_MODELER_LIBS=@CAS_MODELER@ -OCC_DATAEXCHANGE_LIBS=@CAS_DATAEXCHANGE@ -OCC_LIBS=@CAS_LDFLAGS@ +#OCC_KERNEL_LIBS=@CAS_KERNEL@ +#OCC_OCAF_LIBS=@CAS_OCAF@ +#OCC_VIEWER_LIBS=@CAS_VIEWER@ +#OCC_MODELER_LIBS=@CAS_MODELER@ +#OCC_DATAEXCHANGE_LIBS=@CAS_DATAEXCHANGE@ +#OCC_LIBS=@CAS_LDFLAGS@ +CAS_KERNEL=@CAS_KERNEL@ +CAS_OCAF=@CAS_OCAF@ +CAS_VIEWER=@CAS_VIEWER@ +CAS_MODELER=@CAS_MODELER@ +CAS_DATAEXCHANGE=@CAS_DATAEXCHANGE@ +CAS_LDPATH=@CAS_LDPATH@ # MPICH MPICH_INCLUDES=@MPICH_INCLUDES@ @@ -162,6 +168,8 @@ CXXFLAGS+= $(CORBA_CXXFLAGS) #LDFLAGS+= $(CORBA_LIBS) LIBS+=$(CORBA_LIBS) +DOXYGEN = @DOXYGEN@ + ## Shared libraries LT_STATIC_EXEC=@LT_STATIC_EXEC@ DYNAMIC_DIRS=@DYNAMIC_DIRS@ @@ -200,7 +208,7 @@ docdir=$(datadir)/doc # begin of package rules # -.PHONY: all lib bin inc resources tests install uninstall dep depend depend_idl cleandep mostlyclean clean distclean +.PHONY: all lib bin inc resources data doc tests install uninstall dep depend depend_idl cleandep mostlyclean clean distclean .SUFFIXES: .cxx .cc .c .f .o .lo .idl .py .i .ui .po .qm @@ -211,6 +219,7 @@ all: $(MAKE) lib $(MAKE) bin $(MAKE) resources + $(MAKE) data # # add target to build administrative files diff --git a/salome_adm/unix/make_module.in b/salome_adm/unix/make_module.in index 315ad68e7..983342227 100644 --- a/salome_adm/unix/make_module.in +++ b/salome_adm/unix/make_module.in @@ -53,6 +53,15 @@ resources: $(RESOURCES_FILES:%=$(top_builddir)/share/salome/resources/%) $(RESOURCES_FILES:%=$(top_builddir)/share/salome/resources/%): $(top_builddir)/share/salome/resources/% : % cp -f $< $@ +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; install: install-resources @@SETX@; for d in $(SUBDIRS); do \ diff --git a/src/Container/Component_i.cxx b/src/Container/Component_i.cxx index 400072d0f..09d463416 100644 --- a/src/Container/Component_i.cxx +++ b/src/Container/Component_i.cxx @@ -35,6 +35,7 @@ using namespace std; #include "utilities.h" extern bool _Sleeping ; +static Engines_Component_i * theEngines_Component ; Engines_Component_i::Engines_Component_i() { @@ -47,8 +48,10 @@ Engines_Component_i::Engines_Component_i(CORBA::ORB_ptr orb, const char *instanceName, const char *interfaceName, bool notif) : - _instanceName(instanceName), _interfaceName(interfaceName), - _myConnexionToRegistry(0), _ThreadId(0) , _graphName("") , _nodeName("") { + _instanceName(instanceName), + _interfaceName(interfaceName), + _myConnexionToRegistry(0), + _ThreadId(0) , _ThreadCpuUsed(0) , _Executed(false) , _graphName("") , _nodeName("") { MESSAGE("Component constructor with instanceName "<< _instanceName); _orb = CORBA::ORB::_duplicate(orb); _poa = PortableServer::POA::_duplicate(poa); @@ -71,8 +74,7 @@ Engines_Component_i::Engines_Component_i(CORBA::ORB_ptr orb, : _instanceName(instanceName), _interfaceName(interfaceName), _myConnexionToRegistry(0), - _ThreadId(0) -{ + _ThreadId(0) , _ThreadCpuUsed(0) , _Executed(false) , _graphName("") , _nodeName("") { // MESSAGE("Component constructor with instanceName "<< _instanceName); _orb = CORBA::ORB::_duplicate(orb); _poa = PortableServer::POA::_duplicate(poa); @@ -134,11 +136,13 @@ PortableServer::ObjectId * Engines_Component_i::getId() void Engines_Component_i::beginService(const char *serviceName) { - MESSAGE("Send BeginService notification for " << serviceName << endl + MESSAGE(pthread_self() << "Send BeginService notification for " << serviceName << endl << "Component instance : " << _instanceName << endl << endl); _ThreadId = pthread_self() ; _StartUsed = 0 ; _StartUsed = CpuUsed_impl() ; + _ThreadCpuUsed = 0 ; + _Executed = true ; _serviceName = serviceName ; if ( pthread_setcanceltype( PTHREAD_CANCEL_ASYNCHRONOUS , NULL ) ) { perror("pthread_setcanceltype ") ; @@ -148,15 +152,17 @@ void Engines_Component_i::beginService(const char *serviceName) perror("pthread_setcancelstate ") ; exit(0) ; } - MESSAGE("Return from BeginService for " << serviceName - << " ThreadId " << _ThreadId - << " _graphName " << _graphName << " _nodeName " << _nodeName ); +// MESSAGE(pthread_self() << " Return from BeginService for " << serviceName +// << " ThreadId " << _ThreadId << " StartUsed " << _StartUsed +// << " _graphName " << _graphName << " _nodeName " << _nodeName ); } void Engines_Component_i::endService(const char *serviceName) { - MESSAGE("Send EndService notification for " << serviceName << endl - << "Component instance : " << _instanceName << endl << endl); + _ThreadCpuUsed = CpuUsed_impl() ; + MESSAGE(pthread_self() << " Send EndService notification for " << serviceName << endl + << " Component instance : " << _instanceName << " StartUsed " << _StartUsed << " _ThreadCpuUsed " + << _ThreadCpuUsed << endl << endl); _ThreadId = 0 ; } @@ -176,7 +182,7 @@ char* Engines_Component_i::nodeName() { return CORBA::string_dup( _nodeName.c_str() ) ; } -bool Killer( int ThreadId , int signum ) { +bool Engines_Component_i::Killer( int ThreadId , int signum ) { if ( ThreadId ) { if ( signum == 0 ) { if ( pthread_cancel( ThreadId ) ) { @@ -184,7 +190,7 @@ bool Killer( int ThreadId , int signum ) { return false ; } else { - MESSAGE("Killer : ThreadId " << ThreadId << " pthread_canceled") ; + MESSAGE(pthread_self() << "Killer : ThreadId " << ThreadId << " pthread_canceled") ; } } else { @@ -193,7 +199,7 @@ bool Killer( int ThreadId , int signum ) { return false ; } else { - MESSAGE("Killer : ThreadId " << ThreadId << " pthread_killed(" + MESSAGE(pthread_self() << "Killer : ThreadId " << ThreadId << " pthread_killed(" << signum << ")") ; } } @@ -202,12 +208,12 @@ bool Killer( int ThreadId , int signum ) { } bool Engines_Component_i::Kill_impl() { - MESSAGE("Engines_Component_i::Kill_i() pthread_t "<< pthread_self() - << " pid " << getpid() << " instanceName " - << _instanceName.c_str() << " interface " << _interfaceName.c_str() - << " machineName " << GetHostname().c_str()<< " _id " << hex << _id - << dec << " _ThreadId " << _ThreadId << " this " << hex << this - << dec ) ; +// MESSAGE("Engines_Component_i::Kill_i() pthread_t "<< pthread_self() +// << " pid " << getpid() << " instanceName " +// << _instanceName.c_str() << " interface " << _interfaceName.c_str() +// << " machineName " << GetHostname().c_str()<< " _id " << hex << _id +// << dec << " _ThreadId " << _ThreadId << " this " << hex << this +// << dec ) ; bool RetVal = false ; if ( _ThreadId > 0 && pthread_self() != _ThreadId ) { RetVal = Killer( _ThreadId , 0 ) ; @@ -268,21 +274,68 @@ bool Engines_Component_i::Resume_impl() { } +void SetCpuUsed() { + theEngines_Component->SetCurCpu() ; +} +void Engines_Component_i::SetCurCpu() { + _ThreadCpuUsed = CpuUsed() ; +// MESSAGE(pthread_self() << " Engines_Component_i::SetCurCpu() _ThreadCpuUsed " << _ThreadCpuUsed) ; +} + #include #include #include -long Engines_Component_i::CpuUsed_impl() { +long Engines_Component_i::CpuUsed() { + long cpu = 0 ; struct rusage usage ; - long cpu ; - if ( getrusage( RUSAGE_SELF , &usage ) == -1 ) { - perror("GraphBase::CpuUsed") ; - return 0 ; + if ( _ThreadId || _Executed ) { + if ( getrusage( RUSAGE_SELF , &usage ) == -1 ) { + perror("Engines_Component_i::CpuUsed") ; + return 0 ; + } + cpu = usage.ru_utime.tv_sec - _StartUsed ; +// cout << pthread_self() << " Engines_Component_i::CpuUsed " << " " << _serviceName +// << usage.ru_utime.tv_sec << " - " << _StartUsed << " = " << cpu << endl ; + } + else { +// cout << pthread_self() << "Engines_Component_i::CpuUsed _ThreadId " << _ThreadId << " " << _serviceName +// << " _StartUsed " << _StartUsed << endl ; + } + return cpu ; +} + +long Engines_Component_i::CpuUsed_impl() { + long cpu = 0 ; + if ( _ThreadId || _Executed ) { + if ( _ThreadId > 0 ) { + if ( pthread_self() != _ThreadId ) { + if ( _Sleeping ) { + } + else { +// Get Cpu in the appropriate thread with that object !... + theEngines_Component = this ; + Killer( _ThreadId ,SIGUSR1 ) ; + } + cpu = _ThreadCpuUsed ; + } + else { + _ThreadCpuUsed = CpuUsed() ; + cpu = _ThreadCpuUsed ; +// cout << pthread_self() << " Engines_Component_i::CpuUsed_impl " << _serviceName << " " << cpu +// << endl ; + } + } + else { + cpu = _ThreadCpuUsed ; +// cout << pthread_self() << " Engines_Component_i::CpuUsed_impl " << _serviceName << " " << cpu +// << endl ; + } + } + else { +// cout << pthread_self() << "Engines_Component_i::CpuUsed_impl _ThreadId " << _ThreadId << " " +// << _serviceName << " _StartUsed " << _StartUsed << endl ; } -// return usage.ru_utime.__time_t tv_sec ; - cout << "CpuUsed " << usage.ru_utime.tv_sec << " " << usage.ru_utime.tv_usec << " " - << usage.ru_stime.tv_sec << " " << usage.ru_stime.tv_usec << endl ; - cpu = usage.ru_utime.tv_sec - _StartUsed ; return cpu ; } diff --git a/src/Container/Container_i.cxx b/src/Container/Container_i.cxx index 9cef646b8..05f7c84f8 100644 --- a/src/Container/Container_i.cxx +++ b/src/Container/Container_i.cxx @@ -296,16 +296,14 @@ Engines::Container_ptr Engines_Container_i::start_impl( return Engines::Container::_nil() ; } -Engines::Component_ptr Engines_Container_i::load_impl - (const char* nameToRegister, - const char* componentName) -{ - BEGIN_OF("Container_i::load_impl"); +Engines::Component_ptr Engines_Container_i::load_impl( const char* nameToRegister, + const char* componentName ) { _numInstanceMutex.lock() ; // lock on the instance number + BEGIN_OF( "Container_i::load_impl " << componentName ) ; _numInstance++ ; char _aNumI[12]; - sprintf(_aNumI,"%d",_numInstance) ; + sprintf( _aNumI , "%d" , _numInstance ) ; string _impl_name = componentName; string _nameToRegister = nameToRegister; @@ -313,17 +311,16 @@ Engines::Component_ptr Engines_Container_i::load_impl //SCRUTE(instanceName); //string absolute_impl_name = _library_path + "lib" + _impl_name + ".so"; - string absolute_impl_name(_impl_name); - // SCRUTE(absolute_impl_name); + string absolute_impl_name( _impl_name ) ; + SCRUTE(absolute_impl_name); void* handle; - handle = dlopen(absolute_impl_name.c_str(), RTLD_LAZY); - if (!handle) - { - INFOS("Can't load shared library : " << absolute_impl_name); - INFOS("error dlopen: " << dlerror()); - _numInstanceMutex.unlock() ; - return Engines::Component::_nil() ; - } + handle = dlopen( absolute_impl_name.c_str() , RTLD_LAZY ) ; + if ( !handle ) { + INFOS("Can't load shared library : " << absolute_impl_name); + INFOS("error dlopen: " << dlerror()); + _numInstanceMutex.unlock() ; + return Engines::Component::_nil() ; + } string factory_name = _nameToRegister + string("Engine_factory"); // SCRUTE(factory_name) ; @@ -334,61 +331,47 @@ Engines::Component_ptr Engines_Container_i::load_impl PortableServer::ObjectId *, const char *, const char *) ; -// typedef PortableServer::ObjectId * (*FACTORY_FUNCTION_SUPERV) -// (CORBA::ORB_ptr, -// PortableServer::POA_ptr, -// PortableServer::ObjectId *, -// const char *, -// const char * , -// int , char ** ) ; - FACTORY_FUNCTION Component_factory = (FACTORY_FUNCTION) dlsym(handle, factory_name.c_str()); -// FACTORY_FUNCTION_SUPERV Component_factory_superv = (FACTORY_FUNCTION_SUPERV) Component_factory ; - -// PortableServer::ObjectId * (*Component_factory) (CORBA::ORB_ptr, -// PortableServer::POA_ptr, -// PortableServer::ObjectId *, -// const char *, -// const char *) = -// (PortableServer::ObjectId * (*) (CORBA::ORB_ptr, -// PortableServer::POA_ptr, -// PortableServer::ObjectId *, -// const char *, -// const char *)) -// dlsym(handle, factory_name.c_str()); char *error ; - if ((error = dlerror()) != NULL) - { + if ( (error = dlerror() ) != NULL) { INFOS("Can't resolve symbol: " + factory_name); SCRUTE(error); _numInstanceMutex.unlock() ; return Engines::Component::_nil() ; } - // Instanciate required CORBA object - PortableServer::ObjectId * id ; -// if ( factory_name == "SupervisionEngine_factory" ) { // for Python ... -// id = (Component_factory_superv) (_orb, _poa, _id, instanceName.c_str(), -// _nameToRegister.c_str(), _argc , _argv ); -// } -// else { - id = (Component_factory) (_orb, _poa, _id, instanceName.c_str(), - _nameToRegister.c_str()); -// } + string component_registerName = _containerName + "/" + _nameToRegister; + Engines::Component_var iobject = Engines::Component::_nil() ; + try { + CORBA::Object_var obj = _NS->Resolve( component_registerName.c_str() ) ; + if ( CORBA::is_nil( obj ) ) { +// Instanciate required CORBA object + PortableServer::ObjectId * id ; + id = (Component_factory) ( _orb, _poa, _id, instanceName.c_str() , + _nameToRegister.c_str() ) ; // get reference from id - CORBA::Object_var o = _poa->id_to_reference(*id); - Engines::Component_var iobject = Engines::Component::_narrow(o) ; + obj = _poa->id_to_reference(*id); + iobject = Engines::Component::_narrow( obj ) ; // _numInstanceMutex.lock() ; // lock on the add on handle_map (necessary ?) // register the engine under the name containerName.dir/nameToRegister.object - string component_registerName = _containerName + "/" + _nameToRegister; - _NS->Register(iobject, component_registerName.c_str()) ; + _NS->Register( iobject , component_registerName.c_str() ) ; + MESSAGE( "Container_i::load_impl " << component_registerName.c_str() << " bound" ) ; + } + else { // JR : No ReBind !!! + MESSAGE( "Container_i::load_impl " << component_registerName.c_str() << " already bound" ) ; + iobject = Engines::Component::_narrow( obj ) ; + } + } + catch (...) { + MESSAGE( "Container_i::load_impl catched" ) ; + } //Jr _numInstanceMutex.lock() ; // lock on the add on handle_map (necessary ?) handle_map[instanceName] = handle; + END_OF("Container_i::load_impl"); _numInstanceMutex.unlock() ; -// END_OF("Container_i::load_impl"); return Engines::Component::_duplicate(iobject); } @@ -435,18 +418,20 @@ void ActSigIntHandler() { struct sigaction SigIntAct ; SigIntAct.sa_sigaction = &SigIntHandler ; SigIntAct.sa_flags = SA_SIGINFO ; - if ( sigaction( SIGINT , &SigIntAct, NULL ) ) { + if ( sigaction( SIGINT | SIGUSR1 , &SigIntAct, NULL ) ) { perror("SALOME_Container main ") ; exit(0) ; } else { - INFOS("SigIntHandler activated") ; + INFOS(pthread_self() << "SigIntHandler activated") ; } } +void SetCpuUsed() ; + void SigIntHandler(int what , siginfo_t * siginfo , void * toto ) { - MESSAGE("SigIntHandler what " << what << endl + MESSAGE(pthread_self() << "SigIntHandler what " << what << endl << " si_signo " << siginfo->si_signo << endl << " si_code " << siginfo->si_code << endl << " si_pid " << siginfo->si_pid) ; @@ -458,16 +443,21 @@ void SigIntHandler(int what , siginfo_t * siginfo , } else { ActSigIntHandler() ; - _Sleeping = true ; - INFOS("SigIntHandler BEGIN sleeping.") - MESSAGE("SigIntHandler BEGIN sleeping.") ; - int count = 0 ; - while( _Sleeping ) { - sleep( 1 ) ; - count += 1 ; + if ( siginfo->si_signo == SIGUSR1 ) { + SetCpuUsed() ; + } + 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.") ; } - INFOS("SigIntHandler LEAVE sleeping after " << count << " s.") - MESSAGE("SigIntHandler LEAVE sleeping after " << count << " s.") ; return ; } } diff --git a/src/Container/SALOME_ComponentPy.py b/src/Container/SALOME_ComponentPy.py index 1ac2e3cfc..004d6eded 100755 --- a/src/Container/SALOME_ComponentPy.py +++ b/src/Container/SALOME_ComponentPy.py @@ -40,6 +40,8 @@ from libNOTIFICATION import * from SALOME_utilities import * +from thread import * + #============================================================================= #define an implementation of the component interface @@ -66,6 +68,8 @@ class SALOME_ComponentPy_i (Engines__POA.Component): self._nodeName = '' self._ThreadId = 0 self._StartUsed = 0 + self._ThreadCpuUsed = 0 + self._Executed = 0 naming_service = SALOME_NamingServicePy_i(self._orb) Component_path = "/Containers/" + os.getenv( "HOSTNAME" ) + "/" + self._containerName + "/" + self._interfaceName @@ -127,15 +131,21 @@ class SALOME_ComponentPy_i (Engines__POA.Component): #------------------------------------------------------------------------- def beginService(self , serviceName ): - MESSAGE( "Send BeginService notification for " + str(serviceName) + "for graph/node" + str(self._graphName) + str(self._nodeName) ) + MESSAGE( "Send BeginService notification for " + str(serviceName) + " for graph/node " + str(self._graphName) + " " + str(self._nodeName) ) MESSAGE( "Component instance : " + str ( self._instanceName ) ) + self._serviceName = str(serviceName) + self._ThreadId = get_ident() self._StartUsed = 0 self._StartUsed = self.CpuUsed_impl() + self._ThreadCpuUsed = 0 + self._Executed = 1 + MESSAGE( "SALOME_ComponentPy_i::beginService _StartUsed " + str( self._ThreadId ) + " " + str( self._StartUsed ) ) + #------------------------------------------------------------------------- def endService(self , serviceName ): - MESSAGE( "Send EndService notification for " + str(serviceName) + "for graph/node" + str(self._graphName) + str(self._nodeName) ) + MESSAGE( "Send EndService notification for " + str( self._ThreadId ) + " " + str(serviceName) + " for graph/node " + str(self._graphName) + " " + str(self._nodeName) + " CpuUsed " + str( self.CpuUsed_impl() ) ) MESSAGE( "Component instance : " + str(self._instanceName) ) #------------------------------------------------------------------------- @@ -183,10 +193,16 @@ class SALOME_ComponentPy_i (Engines__POA.Component): #------------------------------------------------------------------------- def CpuUsed_impl(self): - cpu = time.clock() - cpuL = int(cpu) - self._StartUsed - print "SALOME_ComponentPy_i::CpuUsed_impl ",cpuL,type(cpuL) - return cpuL + if ( self._ThreadId | self._Executed ) : + if self._ThreadId == get_ident() : + cpu = time.clock() + self._ThreadCpuUsed = int(cpu) - self._StartUsed + MESSAGE( "SALOME_ComponentPy_i::CpuUsed_impl " + self._serviceName + " " + str( int(cpu) ) + " - " + str( self._StartUsed ) + " = " + str( self._ThreadCpuUsed ) ) + return self._ThreadCpuUsed + MESSAGE( "SALOME_ComponentPy_i::CpuUsed_impl " + self._serviceName + " " + str( self._ThreadCpuUsed ) ) + return self._ThreadCpuUsed + MESSAGE( "SALOME_ComponentPy_i::CpuUsed_impl self._StartUsed " + self._serviceName + " " + str(self._StartUsed) ) + return 0 #------------------------------------------------------------------------- diff --git a/src/Container/SALOME_Component_i.hxx b/src/Container/SALOME_Component_i.hxx index a5d462b65..fc537d1c8 100644 --- a/src/Container/SALOME_Component_i.hxx +++ b/src/Container/SALOME_Component_i.hxx @@ -79,10 +79,13 @@ public: void Names( const char * graphName , const char * nodeName ) ; char * graphName() ; char * nodeName() ; + bool Killer( int ThreadId , int signum ); bool Kill_impl(); bool Stop_impl(); bool Suspend_impl(); bool Resume_impl(); + void SetCurCpu() ; + long CpuUsed() ; long CpuUsed_impl() ; protected: @@ -102,6 +105,8 @@ protected: private: pthread_t _ThreadId ; long _StartUsed ; + long _ThreadCpuUsed ; + bool _Executed ; }; #endif diff --git a/src/Container/SALOME_Container.cxx b/src/Container/SALOME_Container.cxx index 3914a57f3..ce8c05628 100644 --- a/src/Container/SALOME_Container.cxx +++ b/src/Container/SALOME_Container.cxx @@ -32,7 +32,7 @@ using namespace std; # include "Utils_ORB_INIT.hxx" # include "Utils_SINGLETON.hxx" - +#include "SALOME_NamingService.hxx" #include "SALOME_Container_i.hxx" #include #include @@ -67,21 +67,87 @@ int main(int argc, char* argv[]) CORBA::ORB_var &orb = init( argc , argv ) ; // Obtain a reference to the root POA. - CORBA::Object_var obj = orb->resolve_initial_references("RootPOA"); - PortableServer::POA_var root_poa = PortableServer::POA::_narrow(obj); - // obtain the root poa manager - PortableServer::POAManager_var pman = root_poa->the_POAManager(); - + // + long TIMESleep = 250000000; + int NumberOfTries = 40; + int a; + timespec ts_req; + ts_req.tv_nsec=TIMESleep; + ts_req.tv_sec=0; + timespec ts_rem; + ts_rem.tv_nsec=0; + ts_rem.tv_sec=0; + CosNaming::NamingContext_var inc; + PortableServer::POA_var root_poa; + CORBA::Object_var theObj; + CORBA::Object_var obj; + CORBA::Object_var object; + SALOME_Logger::Logger_var log; + SALOME_NamingService &naming = *SINGLETON_::Instance() ; + int CONTAINER=0; + const char * Env = getenv("USE_LOGGER"); + int EnvL =0; + if ((Env!=NULL) && (strlen(Env))) + EnvL=1; + + CosNaming::Name name; + name.length(1); + name[0].id=CORBA::string_dup("Logger"); + PortableServer::POAManager_var pman; + for (int i = 1; i<=NumberOfTries; i++){ + if (i!=1) + a=nanosleep(&ts_req,&ts_rem); + try{ + obj = orb->resolve_initial_references("RootPOA"); + if(!CORBA::is_nil(obj)) + root_poa = PortableServer::POA::_narrow(obj); + if(!CORBA::is_nil(root_poa)) + pman = root_poa->the_POAManager(); + if(!CORBA::is_nil(orb)) + theObj = orb->resolve_initial_references("NameService"); + if (!CORBA::is_nil(theObj)) + inc = CosNaming::NamingContext::_narrow(theObj); + } + catch( CORBA::COMM_FAILURE& ) + { + MESSAGE( "Container: CORBA::COMM_FAILURE: Unable to contact the Naming Service" ) + } + if(!CORBA::is_nil(inc)) { + MESSAGE( "Container: Naming Service was found" ) + if(EnvL==1){ + for(int j=1; j<=NumberOfTries; j++){ + if (j!=1) + a=nanosleep(&ts_req, &ts_rem); + try{ + object = inc->resolve(name); + } + catch(CosNaming::NamingContext::NotFound){ MESSAGE( "Container: Logger Server wasn't found" ) } + catch(...){ MESSAGE( "Container: Unknown exception" ) } + if (!CORBA::is_nil(object)) + log = SALOME_Logger::Logger::_narrow(object); + if (!CORBA::is_nil(log)){ + MESSAGE( "Container: Logger Server was found" ) + log->ping(); + CONTAINER=1; + break; + } + }} + } + if ((CONTAINER==1)||((EnvL==0)&&(!CORBA::is_nil(inc)))) + break; + } + + // // define policy objects PortableServer::ImplicitActivationPolicy_var implicitActivation = root_poa->create_implicit_activation_policy(PortableServer::NO_IMPLICIT_ACTIVATION) ; - // default = NO_IMPLICIT_ACTIVATION + // default = NO_IMPLICIT_ACTIVATION PortableServer::ThreadPolicy_var threadPolicy = root_poa->create_thread_policy(PortableServer::ORB_CTRL_MODEL) ; - // default = ORB_CTRL_MODEL, other choice SINGLE_THREAD_MODEL - + // default = ORB_CTRL_MODEL, other choice SINGLE_THREAD_MODEL + // create policy list CORBA::PolicyList policyList; policyList.length(2); diff --git a/src/DataTypeCatalog/SALOME_DataTypeCatalog_Server.cxx b/src/DataTypeCatalog/SALOME_DataTypeCatalog_Server.cxx index e9b4de72f..95c4ce6a1 100644 --- a/src/DataTypeCatalog/SALOME_DataTypeCatalog_Server.cxx +++ b/src/DataTypeCatalog/SALOME_DataTypeCatalog_Server.cxx @@ -31,23 +31,86 @@ using namespace std; #include "SALOME_NamingService.hxx" #include "SALOME_DataTypeCatalog_impl.hxx" #include "utilities.h" - +# include "Utils_SINGLETON.hxx" int main(int argc,char **argv) { try { CosNaming::NamingContext_var _rootContext, catalogContext; - // initialize the ORB - CORBA::ORB_ptr orb = CORBA::ORB_init (argc, argv); - // initialize POA + // + long TIMESleep = 250000000; + int NumberOfTries = 40; + int a; + timespec ts_req; + ts_req.tv_nsec=TIMESleep; + ts_req.tv_sec=0; + timespec ts_rem; + ts_rem.tv_nsec=0; + ts_rem.tv_sec=0; + CosNaming::NamingContext_var inc; + PortableServer::POA_var poa; + CORBA::Object_var theObj; + CORBA::Object_var obj; + CORBA::Object_var object; + SALOME_Logger::Logger_var log; + int DATA_TYPE_CATALOG=0; + const char * Env = getenv("USE_LOGGER"); + int EnvL =0; + if ((Env!=NULL) && (strlen(Env))) + EnvL=1; + CosNaming::Name name; + name.length(1); + name[0].id=CORBA::string_dup("Logger"); + PortableServer::POAManager_var mgr; + + for (int i = 1; i<=NumberOfTries; i++){ + if (i!=1) + a=nanosleep(&ts_req,&ts_rem); + try{ + obj = orb->resolve_initial_references("RootPOA"); + if(!CORBA::is_nil(obj)) + poa = PortableServer::POA::_narrow(obj); + if(!CORBA::is_nil(poa)) + mgr = poa->the_POAManager(); + if(!CORBA::is_nil(orb)) + theObj = orb->resolve_initial_references("NameService"); + if (!CORBA::is_nil(theObj)) + inc = CosNaming::NamingContext::_narrow(theObj);} + catch( CORBA::COMM_FAILURE& ) + { + MESSAGE( "Data Type Catalog: CORBA::COMM_FAILURE: Unable to contact the Naming Service" ) + } + if(!CORBA::is_nil(inc)) { + MESSAGE( "Data Type Catalog: Naming Service was found" ) + if(EnvL==1){ + CORBA::ORB_var orb1 = CORBA::ORB_init(argc,argv) ; + SALOME_NamingService &NS = *SINGLETON_::Instance() ; + NS.init_orb( orb1 ) ; + for(int j=1; j<=NumberOfTries; j++){ + if (j!=1) + a=nanosleep(&ts_req, &ts_rem); + try{ + object = inc->resolve(name);} + catch(CosNaming::NamingContext::NotFound){ MESSAGE( "Data Type Catalog: Logger Server wasn't found" ) } + catch(...){ MESSAGE( "Data Type Catalog: Unknown exception" ) } + if (!CORBA::is_nil(object)) + log = SALOME_Logger::Logger::_narrow(object); + if (!CORBA::is_nil(log)){ + MESSAGE( "Data Type Catalog: Logger Server was found" ) + log->ping(); + DATA_TYPE_CATALOG=1; + break; + } + + }} + } + if ((DATA_TYPE_CATALOG==1)||((EnvL==0)&&(!CORBA::is_nil(inc)))) + break; + } - CORBA::Object_var poaobj = orb->resolve_initial_references ("RootPOA"); - - PortableServer::POA_var poa = PortableServer::POA::_narrow (poaobj); - PortableServer::POAManager_var mgr = poa->the_POAManager(); - + // // Active catalog SALOME_DataTypeCatalogImpl* Catalogue_i = new SALOME_DataTypeCatalogImpl(argc, argv); @@ -70,7 +133,7 @@ int main(int argc,char **argv) poa->destroy(1,1); - } + } catch(CORBA::SystemException&) { INFOS("Caught CORBA::SystemException.") } diff --git a/src/HDFPersist/HDFattrCreate.c b/src/HDFPersist/HDFattrCreate.c index 9d4b3dc54..e3e176b66 100644 --- a/src/HDFPersist/HDFattrCreate.c +++ b/src/HDFPersist/HDFattrCreate.c @@ -55,7 +55,11 @@ hdf_idt HDFattrCreate(hdf_idt pid,char *name,hdf_type type, size_t size) break; case HDF_INT32 : +#ifdef PCLINUX + type_hdf = H5T_STD_I32BE; +#else type_hdf = H5T_NATIVE_INT; +#endif break; case HDF_INT64 : diff --git a/src/HDFPersist/HDFattrRead.c b/src/HDFPersist/HDFattrRead.c index 464e9c2a9..25474b9a7 100644 --- a/src/HDFPersist/HDFattrRead.c +++ b/src/HDFPersist/HDFattrRead.c @@ -42,8 +42,12 @@ hdf_err HDFattrRead(hdf_idt id,void *val) { hdf_err ret = -1; hdf_idt type_hdf; - + if ((type_hdf = H5Aget_type(id)) >= 0) { +#ifdef PCLINUX + if ((H5Tget_class(type_hdf) == H5T_INTEGER) && (H5Tget_size(type_hdf) == 4)) + type_hdf = H5T_NATIVE_INT; +#endif ret = H5Aread(id, type_hdf, val); } diff --git a/src/HDFPersist/HDFattrWrite.c b/src/HDFPersist/HDFattrWrite.c index b1dbea588..61d378427 100644 --- a/src/HDFPersist/HDFattrWrite.c +++ b/src/HDFPersist/HDFattrWrite.c @@ -41,15 +41,30 @@ Module : SALOME hdf_err HDFattrWrite(hdf_idt id, void *val) { hdf_idt type_id; - hdf_type type; - hdf_class_type hdf_type; int ret = 0; +#ifdef PCLINUX + int isI32BE = 0; +#endif if ((type_id = H5Aget_type(id)) < 0) return -1; +#ifdef PCLINUX + if((H5Tget_class(type_id) == H5T_INTEGER) && (H5Tget_size(type_id) == 4)) { + isI32BE = 1; /* See HDFattrCreate */ + if (H5Tconvert(H5T_NATIVE_INT,H5T_STD_I32BE,1,(void *)val,NULL,NULL) < 0) + return -1; + } +#endif + ret = H5Awrite(id,type_id, val); + +#ifdef PCLINUX + if (isI32BE && (H5Tconvert(H5T_STD_I32BE,H5T_NATIVE_INT,1,(void *)val,NULL,NULL) < 0)) + return -1; +#endif + H5Tclose(type_id); return ret; diff --git a/src/HDFPersist/HDFdatasetCreate.c b/src/HDFPersist/HDFdatasetCreate.c index dd4772525..70e8ddd50 100644 --- a/src/HDFPersist/HDFdatasetCreate.c +++ b/src/HDFPersist/HDFdatasetCreate.c @@ -59,7 +59,11 @@ hdf_idt HDFdatasetCreate(hdf_idt pid,char *name,hdf_type type, break; case HDF_INT32 : +#ifdef PCLINUX + type_hdf = H5T_STD_I32BE; +#else type_hdf = H5T_NATIVE_INT; +#endif break; case HDF_INT64 : diff --git a/src/HDFPersist/HDFdatasetGetType.c b/src/HDFPersist/HDFdatasetGetType.c index 9cc4bbd6a..722849d1a 100644 --- a/src/HDFPersist/HDFdatasetGetType.c +++ b/src/HDFPersist/HDFdatasetGetType.c @@ -34,14 +34,12 @@ HDFdatasetGetType(hdf_idt id) { hdf_idt type_id; hdf_type type; - hdf_class_type hdf_type; hdf_size_type size; if ((type_id = H5Dget_type(id)) < 0) return HDF_NONE; - hdf_type = H5Tget_class(type_id); - switch (hdf_type) + switch (H5Tget_class(type_id)) { case H5T_INTEGER : size = H5Tget_size(type_id); diff --git a/src/HDFPersist/HDFdatasetRead.c b/src/HDFPersist/HDFdatasetRead.c index 7cb951b8d..0c89c3902 100644 --- a/src/HDFPersist/HDFdatasetRead.c +++ b/src/HDFPersist/HDFdatasetRead.c @@ -46,8 +46,12 @@ hdf_err HDFdatasetRead(hdf_idt id, void *val) if ((datatype = H5Dget_type(id)) < 0) return -1; - if ((ret = H5Dread(id,datatype,H5S_ALL,H5S_ALL, - H5P_DEFAULT, val)) < 0) +#ifdef PCLINUX + if ((H5Tget_class(datatype) == H5T_INTEGER) && (H5Tget_size(datatype) == 4)) + datatype = H5T_NATIVE_INT; +#endif + + if ((ret = H5Dread(id,datatype,H5S_ALL,H5S_ALL,H5P_DEFAULT, val)) < 0) return -1; return 0; diff --git a/src/HDFPersist/HDFdatasetWrite.c b/src/HDFPersist/HDFdatasetWrite.c index f48c6a27c..07dbefdd9 100644 --- a/src/HDFPersist/HDFdatasetWrite.c +++ b/src/HDFPersist/HDFdatasetWrite.c @@ -42,13 +42,32 @@ hdf_err HDFdatasetWrite(hdf_idt id, void *val) { hdf_idt datatype; hdf_err ret; +#ifdef PCLINUX + int isI32BE = 0; + int size; +#endif if ((datatype = H5Dget_type(id)) < 0) return -1; - if ((ret = H5Dwrite(id,datatype,H5S_ALL,H5S_ALL, - H5P_DEFAULT, val)) < 0) +#ifdef PCLINUX + if((H5Tget_class(datatype) == H5T_INTEGER) && (H5Tget_size(datatype) == 4)) { + isI32BE = 1; /* See HDFdatasetCreate */ + size = (int)HDFdatasetGetSize(id) / 4; + if(size == 0) + return -1; + if(H5Tconvert(H5T_NATIVE_INT, H5T_STD_I32BE, size, (void *)val, NULL, NULL) < 0) + return -1; + } +#endif + + if ((ret = H5Dwrite(id, datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, val)) < 0) + return -1; + +#ifdef PCLINUX + if (isI32BE && (H5Tconvert(H5T_STD_I32BE, H5T_NATIVE_INT, size, (void *)val, NULL, NULL) < 0)) return -1; +#endif return 0; } diff --git a/src/HDFPersist/Makefile.in b/src/HDFPersist/Makefile.in index 3baa03bd9..6fe8916d2 100644 --- a/src/HDFPersist/Makefile.in +++ b/src/HDFPersist/Makefile.in @@ -96,7 +96,7 @@ LIB_SRC = \ #BIN = test9 test8 CPPFLAGS+=$(OCC_INCLUDES) $(HDF5_INCLUDES) -DPCLINUX -LDFLAGS+= $(OCC_LIBS) $(HDF5_LIBS) +LDFLAGS+= $(CAS_LDPATH) -lTKernel $(HDF5_LIBS) @CONCLUDE@ diff --git a/src/Loader/InquireServersQThread.cxx b/src/Loader/InquireServersQThread.cxx index 4fa67e651..b80547c9d 100644 --- a/src/Loader/InquireServersQThread.cxx +++ b/src/Loader/InquireServersQThread.cxx @@ -547,7 +547,7 @@ QString findFile( QString filename ) QString dir; char* cenv; - // Try ${SALOME_ROOT_DIR}/share/salome/resources directory + // Try ${KERNEL_ROOT_DIR}/share/salome/resources directory cenv = getenv( "KERNEL_ROOT_DIR" ); if ( cenv ) { dir.sprintf( "%s", cenv ); @@ -592,40 +592,6 @@ QString findFile( QString filename ) return fileInfo.filePath(); } } - // Try ${SALOME_SITE_DIR}/share/salome/resources directory - cenv = getenv( "SALOME_SITE_DIR" ); - if ( cenv ) { - dir.sprintf( "%s", cenv ); - if ( !dir.isEmpty() ) { - dir = addSlash(dir) ; - dir = dir + "share" ; - dir = addSlash(dir) ; - dir = dir + "salome" ; - dir = addSlash(dir) ; - dir = dir + "resources" ; - dir = addSlash(dir) ; - QFileInfo fileInfo( dir + filename ); - if ( fileInfo.isFile() && fileInfo.exists() ) - return fileInfo.filePath(); - } - } - // Try ${SALOME_ROOT_DIR}/share/salome/resources directory - cenv = getenv( "SALOME_ROOT_DIR" ); - if ( cenv ) { - dir.sprintf( "%s", cenv ); - if ( !dir.isEmpty() ) { - dir = addSlash(dir) ; - dir = dir + "share" ; - dir = addSlash(dir) ; - dir = dir + "salome" ; - dir = addSlash(dir) ; - dir = dir + "resources" ; - dir = addSlash(dir) ; - QFileInfo fileInfo( dir + filename ); - if ( fileInfo.isFile() && fileInfo.exists() ) - return fileInfo.filePath(); - } - } return filename; } QString addSlash( const QString& path ) diff --git a/src/Logger/SALOME_Logger_Server.cxx b/src/Logger/SALOME_Logger_Server.cxx index 3d40b45f7..c3f7acce1 100644 --- a/src/Logger/SALOME_Logger_Server.cxx +++ b/src/Logger/SALOME_Logger_Server.cxx @@ -11,7 +11,9 @@ using namespace std; #include #include "SALOME_Logger_Server.hxx" - +#include +#include +#include omni_mutex Logger::myLock; ///////////////////////////////////////////////////////////////////// @@ -49,6 +51,11 @@ void Logger::putMessage(const char* message) myLock.unlock(); } +void Logger::ping() +{ + cout<<" Logger::ping() pid "<< getpid()< 2) @@ -59,51 +66,73 @@ int main(int argc, char **argv) try { //Initialize the ORB - CORBA::ORB_var orb = CORBA::ORB_init(argc,argv) ; - - CORBA::Object_var obj = orb->resolve_initial_references("RootPOA") ; - PortableServer::POA_var poa = PortableServer::POA::_narrow(obj) ; - - // NB. You can activate the POA before or after - // activating objects in that POA. - PortableServer::POAManager_var pman = poa->the_POAManager(); - pman->activate(); - + long TIMESleep = 250000000; + int NumberOfTries = 40; + int a; + timespec ts_req; + ts_req.tv_nsec=TIMESleep; + ts_req.tv_sec=0; + timespec ts_rem; + ts_rem.tv_nsec=0; + ts_rem.tv_sec=0; + CosNaming::NamingContext_var inc; + CORBA::ORB_var orb; + SALOME_Logger::Logger_var myLoggerRef; + CORBA::Object_var theObj; Logger* myLogger; + CORBA::Object_var obj; + PortableServer::POA_var poa; + PortableServer::POAManager_var pman; + orb = CORBA::ORB_init(argc,argv) ; + for (int i = 1; i<=NumberOfTries; i++){ + if (i!=1) + a=nanosleep(&ts_req,&ts_rem); + obj = orb->resolve_initial_references("RootPOA") ; + if(!CORBA::is_nil(obj)) + poa = PortableServer::POA::_narrow(obj) ; + pman = poa->the_POAManager(); + // NB. You can activate the POA before or after + // activating objects in that POA. + + // This activates the object in the root POA (by default), and + // returns a reference to it. + //NB. You can't use SALOME_NamingService class because it uses MESSAGE macro + //Otherwise, you will get segmentation fault. + //Get initial naming context + try{ + if(!CORBA::is_nil(orb)) + theObj = orb->resolve_initial_references("NameService"); + //Narrow to NamingContext + if (!CORBA::is_nil(theObj)){ + inc = CosNaming::NamingContext::_narrow(theObj); + } + }catch(CORBA::COMM_FAILURE&) + { + cout<<"Logger Server: CORBA::COMM_FAILURE: Unable to contact the Naming Service"<_this(); - - //NB. You can't use SALOME_NamingService class because it uses MESSAGE macro - //Otherwise, you will get segmentation fault. - - //Get initial naming context - CORBA::Object_var theObj = orb->resolve_initial_references("NameService"); - //Narrow to NamingContext - CosNaming::NamingContext_var inc = CosNaming::NamingContext::_narrow(theObj); - + myLoggerRef = myLogger->_this(); CosNaming::Name name; name.length(1); name[0].id = CORBA::string_dup("Logger"); - inc->bind(name,myLoggerRef); - myLogger->_remove_ref(); - + pman->activate(); orb->run() ; - orb->destroy() ; } catch(CORBA::COMM_FAILURE& ex) { cerr << "Caught system exception COMM_FAILURE -- unable to contact the " - << "object." << endl; + << "object." << endl; } catch(CORBA::SystemException&) { diff --git a/src/Logger/SALOME_Logger_Server.hxx b/src/Logger/SALOME_Logger_Server.hxx index 4b000c50c..4b1441bd1 100644 --- a/src/Logger/SALOME_Logger_Server.hxx +++ b/src/Logger/SALOME_Logger_Server.hxx @@ -29,6 +29,7 @@ public: virtual ~Logger(); //put message into one special place for all servers void putMessage(const char* message); + void ping(); private: //if m_putIntoFile is true all messages will be put into special //otherwise all messages will be put into terminal via cout diff --git a/src/Logger/SALOME_Trace.cxx b/src/Logger/SALOME_Trace.cxx index ab5abd2b2..e3185daf6 100644 --- a/src/Logger/SALOME_Trace.cxx +++ b/src/Logger/SALOME_Trace.cxx @@ -34,28 +34,54 @@ SALOME_Trace::SALOME_Trace() //Initialize the ORB CORBA::ORB_var orb = CORBA::ORB_init(argc,argv) ; - //Get initial naming context - CORBA::Object_var theObj = orb->resolve_initial_references("NameService"); - //Narrow to NamingContext - CosNaming::NamingContext_var inc = CosNaming::NamingContext::_narrow(theObj); - + long TIMESleep = 250000000; + int NumberOfTries = 40; + int a; + timespec ts_req; + ts_req.tv_nsec=TIMESleep; + ts_req.tv_sec=0; + timespec ts_rem; + ts_rem.tv_nsec=0; + ts_rem.tv_sec=0; + CosNaming::NamingContext_var inc; + CORBA::Object_var theObj; + CORBA::Object_var obj; CosNaming::Name name; name.length(1); name[0].id = CORBA::string_dup("Logger"); - - CORBA::Object_var obj; - obj = inc->resolve(name); - - m_pInterfaceLogger = SALOME_Logger::Logger::_narrow(obj) ; - + for (int i = 1; i<=NumberOfTries; i++){ + if (i!=1) + a=nanosleep(&ts_req,&ts_rem); + try{ + if(!CORBA::is_nil(orb)) + theObj = orb->resolve_initial_references("NameService"); + if (!CORBA::is_nil(theObj)) + inc = CosNaming::NamingContext::_narrow(theObj); + } + catch( CORBA::COMM_FAILURE& ) + { + cout<<"SALOME_TRACE: CORBA::COMM_FAILURE: Unable to contact the Naming Service" <resolve(name); + m_pInterfaceLogger = SALOME_Logger::Logger::_narrow(obj); + if (!CORBA::is_nil(m_pInterfaceLogger)) + cout<<"SALOME_TRACE: Logger Server was found"< +#endif //#define CHECKTIME #ifdef CHECKTIME @@ -46,12 +52,77 @@ int main(int argc,char **argv) CORBA::ORB_ptr orb = CORBA::ORB_init (argc, argv); // initialize POA - - CORBA::Object_var poaobj = orb->resolve_initial_references ("RootPOA"); - - PortableServer::POA_var poa = PortableServer::POA::_narrow (poaobj); - PortableServer::POAManager_var mgr = poa->the_POAManager(); - + // + long TIMESleep = 250000000; + int NumberOfTries = 40; + int a; + timespec ts_req; + ts_req.tv_nsec=TIMESleep; + ts_req.tv_sec=0; + timespec ts_rem; + ts_rem.tv_nsec=0; + ts_rem.tv_sec=0; + CosNaming::NamingContext_var inc; + PortableServer::POA_var poa; + CORBA::Object_var theObj; + CORBA::Object_var obj; + CORBA::Object_var object; + SALOME_Logger::Logger_var log; + int MODULE_CATALOG=0; + const char * Env = getenv("USE_LOGGER"); + int EnvL =0; + if ((Env!=NULL) && (strlen(Env))) + EnvL=1; + CosNaming::Name name; + name.length(1); + name[0].id=CORBA::string_dup("Logger"); + PortableServer::POAManager_var mgr; + for (int i = 1; i<=NumberOfTries; i++){ + if (i!=1) + a=nanosleep(&ts_req,&ts_rem); + try{ + obj = orb->resolve_initial_references("RootPOA"); + if(!CORBA::is_nil(obj)) + poa = PortableServer::POA::_narrow(obj); + if(!CORBA::is_nil(poa)) + mgr = poa->the_POAManager(); + if(!CORBA::is_nil(orb)) + theObj = orb->resolve_initial_references("NameService"); + } + catch( CORBA::COMM_FAILURE& ) + { + MESSAGE( "Module Catalog Server: CORBA::COMM_FAILURE: Unable to contact the Naming Service" ) + } + if (!CORBA::is_nil(theObj)){ + inc = CosNaming::NamingContext::_narrow(theObj); + if(!CORBA::is_nil(inc)) { + MESSAGE( "Module Catalog Server: Naming Service was found" ) + if(EnvL==1){ + CORBA::ORB_var orb1 = CORBA::ORB_init(argc,argv) ; + SALOME_NamingService &NS = *SINGLETON_::Instance() ; + NS.init_orb( orb1 ) ; + for(int j=1; j<=NumberOfTries; j++){ + if (j!=1) + a=nanosleep(&ts_req, &ts_rem); + try{ + object = inc->resolve(name);} + catch(CosNaming::NamingContext::NotFound){ MESSAGE( "Logger Server wasn't found" ) } + catch(...){ MESSAGE( "Module Catalog Server: Unknown exception" ) } + if (!CORBA::is_nil(object)) + log = SALOME_Logger::Logger::_narrow(object); + if (!CORBA::is_nil(log)){ + MESSAGE( "Module Catalog Server: Logger Server was found" ) + log->ping(); + MODULE_CATALOG=1; + break; + } + }} + }} + if ((MODULE_CATALOG==1)||((EnvL==0)&&(!CORBA::is_nil(inc)))) + break; + } + + // // Active catalog SALOME_ModuleCatalogImpl* Catalogue_i = new SALOME_ModuleCatalogImpl(argc, argv); diff --git a/src/NamingService/SALOME_NamingServicePy.py b/src/NamingService/SALOME_NamingServicePy.py index db2d75633..8b41f25be 100644 --- a/src/NamingService/SALOME_NamingServicePy.py +++ b/src/NamingService/SALOME_NamingServicePy.py @@ -29,6 +29,7 @@ # $Header$ import sys +import time from omniORB import CORBA import CosNaming from string import * @@ -48,15 +49,28 @@ class SALOME_NamingServicePy_i: MESSAGE ( "SALOME_NamingServicePy_i::__init__" ) self._orb = orb # initialize root context and current context - obj =self._orb.resolve_initial_references("NameService") - self._root_context =obj._narrow(CosNaming.NamingContext) - self._current_context = self._root_context + ok = 0 + steps = 40 + while steps > 0 and ok == 0: + try: + obj =self._orb.resolve_initial_references("NameService") + self._root_context =obj._narrow(CosNaming.NamingContext) + self._current_context = self._root_context - if self._root_context is None : - MESSAGE ( "Name Service Reference is invalid" ) - sys.exit(1) - + if self._root_context is None : + #MESSAGE ( "Name Service Reference is invalid" ) + #sys.exit(1) + MESSAGE(" Name service not found") + else: + ok = 1 + except CORBA.COMM_FAILURE, ex: + MESSAGE(" Name service not found") + time.sleep(0.25) + steps = steps - 1 + if steps == 0: + MESSAGE ( "Name Service Reference is invalid" ) + sys.exit(1) #------------------------------------------------------------------------- def Register(self,ObjRef, Path): MESSAGE ( "SALOME_NamingServicePy_i::Register" ) diff --git a/src/OBJECT/Makefile.in b/src/OBJECT/Makefile.in index 301ade4e1..4bb0d399b 100644 --- a/src/OBJECT/Makefile.in +++ b/src/OBJECT/Makefile.in @@ -10,7 +10,6 @@ VPATH=.:@srcdir@:@top_srcdir@/idl EXPORT_HEADERS = SALOME_InteractiveObject.hxx \ Handle_SALOME_InteractiveObject.hxx \ SALOME_Actor.h \ - SALOME_Transform.h \ SALOME_AISShape.hxx \ Handle_SALOME_AISShape.hxx \ SALOME_AISObject.hxx \ @@ -23,7 +22,6 @@ EXPORT_HEADERS = SALOME_InteractiveObject.hxx \ LIB = libSalomeObject.la LIB_SRC = SALOME_InteractiveObject.cxx \ SALOME_Actor.cxx \ - SALOME_Transform.cxx \ SALOME_AISShape.cxx\ SALOME_AISObject.cxx @@ -34,7 +32,7 @@ BIN = BIN_SRC = CPPFLAGS+=$(PYTHON_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) -LDFLAGS+=$(OCC_KERNEL_LIBS) $(OCC_VIEWER_LIBS) $(VTK_LIBS) $(OGL_LIBS) $(PYTHON_LIBS) +LDFLAGS+= $(VTK_LIBS) $(OGL_LIBS) $(PYTHON_LIBS) $(CAS_LDPATH) -lTKV3d -lSalomeVTKFilter @CONCLUDE@ diff --git a/src/OBJECT/SALOME_Actor.cxx b/src/OBJECT/SALOME_Actor.cxx index bf761ec7d..8029335eb 100644 --- a/src/OBJECT/SALOME_Actor.cxx +++ b/src/OBJECT/SALOME_Actor.cxx @@ -26,13 +26,16 @@ // Module : SALOME // $Header$ -using namespace std; /*! \class SALOME_Actor SALOME_Actor.h \brief Abstract class of SALOME Objects in VTK. */ #include "SALOME_Actor.h" +#include "SALOME_Transform.h" +#include "SALOME_TransformFilter.h" +#include "SALOME_PassThroughFilter.h" +#include "SALOME_GeometryFilter.h" // SALOME Includes #include "utilities.h" @@ -41,9 +44,12 @@ using namespace std; #include #include #include -#include #include +using namespace std; + +int SALOME_POINT_SIZE = 3; + void SALOME_Actor::Render(vtkRenderer *ren, vtkMapper *Mapper ) { if (this->Mapper == NULL) { @@ -122,14 +128,15 @@ void SALOME_Actor::ReleaseGraphicsResources(vtkWindow *renWin) this->Mapper->ReleaseGraphicsResources(renWin); } + 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(); } @@ -137,16 +144,12 @@ vtkPolyData* SALOME_Actor::GetPolyDataInput(){ void SALOME_Actor::SetMapper(vtkMapper* theMapper){ if(theMapper){ myPassFilter[0]->SetInput(theMapper->GetInput()); - // myPassFilter[0]->Update(); -------- This and other three lines must be comment or removed to fix the regression in SMESH myPassFilter[1]->SetInput(myPassFilter[0]->GetPolyDataOutput()); - // myPassFilter[1]->Update(); myTransformFilter->SetInput(myPassFilter[1]->GetPolyDataOutput()); myPassFilter[2]->SetInput(myTransformFilter->GetOutput()); - // myPassFilter[2]->Update(); myPassFilter[3]->SetInput(myPassFilter[2]->GetPolyDataOutput()); - // myPassFilter[3]->Update(); if(vtkDataSetMapper* aMapper = dynamic_cast(theMapper)) - aMapper->SetInput(myPassFilter[3]->GetOutput()); + aMapper->SetInput(myPassFilter[3]->GetPolyDataOutput()); else if(vtkPolyDataMapper* aMapper = dynamic_cast(theMapper)) aMapper->SetInput(myPassFilter[3]->GetPolyDataOutput()); } @@ -158,8 +161,29 @@ void SALOME_Actor::SetTransform(SALOME_Transform* theTransform){ myTransformFilter->Modified(); } + +void SALOME_Actor::SetRepresentation(int theMode) { + myRepresentation = theMode; + switch(theMode){ + case 3 : + myPassFilter[0]->SetInside(true); + GetProperty()->SetRepresentation(1); + break; + case 0 : + GetProperty()->SetPointSize(SALOME_POINT_SIZE); + default : + GetProperty()->SetRepresentation(myRepresentation); + myPassFilter[0]->SetInside(false); + } +} +int SALOME_Actor::GetRepresentation(){ + return myRepresentation; +} + + SALOME_Actor::SALOME_Actor(){ PreviewProperty = NULL; + myRepresentation = 2; myTransformFilter = SALOME_TransformFilter::New(); myPassFilter.push_back(SALOME_PassThroughFilter::New()); myPassFilter.push_back(SALOME_PassThroughFilter::New()); @@ -168,6 +192,7 @@ SALOME_Actor::SALOME_Actor(){ } SALOME_Actor::~SALOME_Actor(){ + myTransformFilter->Delete(); SetPreviewProperty(NULL); for(int i = 0, iEnd = myPassFilter.size(); i < iEnd; i++) if(myPassFilter[i] != NULL) diff --git a/src/OBJECT/SALOME_Actor.h b/src/OBJECT/SALOME_Actor.h index 0a994e616..ea35d47ef 100644 --- a/src/OBJECT/SALOME_Actor.h +++ b/src/OBJECT/SALOME_Actor.h @@ -30,17 +30,20 @@ #define SALOME_ACTOR_H // SALOME Includes -#include "SALOME_Transform.h" +#include "VTKViewer_Common.h" #include "SALOME_InteractiveObject.hxx" #ifndef _Handle_SALOME_InteractiveObject_HeaderFile #include "Handle_SALOME_InteractiveObject.hxx" #endif - #include -#include "VTKViewer_Common.h" -class SALOME_Actor : public vtkLODActor -{ +class SALOME_Transform; +class SALOME_TransformFilter; +class SALOME_PassThroughFilter; + +extern int SALOME_POINT_SIZE; + +class SALOME_Actor : public vtkLODActor{ protected: //constructor should be protected due to first implementation of this class //it was abstract class @@ -102,6 +105,9 @@ class SALOME_Actor : public vtkLODActor virtual void SetMapper(vtkMapper* theMapper); virtual void SetTransform(SALOME_Transform* theTransform); + virtual void SetRepresentation(int theMode); + virtual int GetRepresentation(); + protected: vtkProperty *PreviewProperty; Standard_Boolean ispreselected; @@ -116,5 +122,7 @@ class SALOME_Actor : public vtkLODActor SALOME_Transform *myTransform; std::vector myPassFilter; SALOME_TransformFilter *myTransformFilter; + int myRepresentation; }; + #endif // SALOME_ACTOR_H diff --git a/src/OBJECT/SALOME_Transform.cxx b/src/OBJECT/SALOME_Transform.cxx deleted file mode 100644 index d55c5fb79..000000000 --- a/src/OBJECT/SALOME_Transform.cxx +++ /dev/null @@ -1,123 +0,0 @@ -// File: SALOME_Transform.cxx -// Created: Wed Jun 4 09:46:59 2003 -// Author: Alexey PETROV -// - - -#include "SALOME_Transform.h" -#include "VTKViewer_Common.h" -#include -#include -#include -using namespace std; - -//======================================================================= - -SALOME_Transform* SALOME_Transform::New(){ - vtkObject* ret = vtkObjectFactory::CreateInstance("SALOME_Transform"); - if(ret) return (SALOME_Transform*)ret; - return new SALOME_Transform; -} - -void SALOME_Transform::SetScale(float theScaleX, float theScaleY, float theScaleZ){ - double aMatrix[16] = {theScaleX,0,0,0, - 0,theScaleY,0,0, - 0,0,theScaleZ,0, - 0,0,0,1.0000000}; - vtkTransform::SetMatrix(aMatrix); - //vtkTransform::Pop(); - //vtkTransform::Scale(theScale); -} - -int SALOME_Transform::IsIdentity(){ - float* aScale = GetScale(); - return (aScale[0] == 1.0 && aScale[1] == 1.0 && aScale[2] == 1.0); -} - -//======================================================================= - -SALOME_TransformFilter* SALOME_TransformFilter::New(){ - vtkObject* ret = vtkObjectFactory::CreateInstance("SALOME_TransformFilter"); - if(ret) return (SALOME_TransformFilter*)ret; - return new SALOME_TransformFilter; -} - -void SALOME_TransformFilter::Execute(){ - vtkPoints *inPts; - vtkPoints *newPts; - int numPts, numCells; - vtkPointSet *input = this->GetInput(); - vtkPointSet *output = this->GetOutput(); - vtkPointData *pd=input->GetPointData(), *outPD=output->GetPointData(); - vtkCellData *cd=input->GetCellData(), *outCD=output->GetCellData(); - output->CopyStructure( input ); - int anIdentity = 0; - if(SALOME_Transform* aTransform = dynamic_cast(this->Transform)) - anIdentity = aTransform->IsIdentity(); - if(!anIdentity && this->Transform != NULL){ - inPts = input->GetPoints(); - if(!inPts){ - vtkErrorMacro(<<"No input data"); - return; - } - numPts = inPts->GetNumberOfPoints(); - numCells = input->GetNumberOfCells(); - newPts = vtkPoints::New(); - newPts->Allocate(numPts); - this->UpdateProgress(.2); - this->Transform->TransformPoints(inPts,newPts); - this->UpdateProgress(.8); - output->SetPoints(newPts); - newPts->Delete(); - } - outPD->PassData(pd); - outCD->PassData(cd); -} - -//======================================================================= - -SALOME_PassThroughFilter* SALOME_PassThroughFilter::New(){ - vtkObject* ret = vtkObjectFactory::CreateInstance("SALOME_PassThroughFilter"); - if(ret) return (SALOME_PassThroughFilter*)ret; - return new SALOME_PassThroughFilter; -} - -SALOME_PassThroughFilter::SALOME_PassThroughFilter(){ - myGeomFilter = vtkGeometryFilter::New(); -} - -SALOME_PassThroughFilter::~SALOME_PassThroughFilter(){ - myGeomFilter->Delete(); -} - -void SALOME_PassThroughFilter::Execute(){ - vtkDataSet *input = static_cast(this->GetInput()); - vtkDataSet *output = static_cast(this->GetOutput()); - output->CopyStructure( input ); - 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(); -} diff --git a/src/OBJECT/SALOME_Transform.h b/src/OBJECT/SALOME_Transform.h deleted file mode 100644 index 65fa0b4b1..000000000 --- a/src/OBJECT/SALOME_Transform.h +++ /dev/null @@ -1,66 +0,0 @@ -// File: SALOME_Transformation.hxx -// Created: Wed Jun 4 09:39:09 2003 -// Author: Alexey PETROV -// - - -#ifndef SALOME_Transform_HeaderFile -#define SALOME_Transform_HeaderFile - -#include - -#include -#include -#include -class vtkGeometryFilter; - -//======================================================================= - -class VTK_EXPORT SALOME_Transform : public vtkTransform{ - public: - static SALOME_Transform *New(); - vtkTypeMacro(SALOME_Transform,vtkTransform); - void SetScale(float theScaleX, float theScaleY, float theScaleZ); - int IsIdentity(); -protected: - SALOME_Transform() {} - ~SALOME_Transform() {} - SALOME_Transform(const SALOME_Transform&) {} - void operator=(const SALOME_Transform&) {} -}; - -//======================================================================= - -class VTK_EXPORT SALOME_TransformFilter : public vtkTransformFilter{ - public: - static SALOME_TransformFilter *New(); - vtkTypeMacro(SALOME_TransformFilter,vtkTransformFilter); -protected: - SALOME_TransformFilter() {} - ~SALOME_TransformFilter() {} - SALOME_TransformFilter(const SALOME_TransformFilter&) {} - void operator=(const SALOME_TransformFilter&) {} - void Execute(); -}; - -//======================================================================= - -class SALOME_PassThroughFilter : public vtkDataSetToDataSetFilter{ - public: - vtkTypeMacro(SALOME_PassThroughFilter,vtkDataSetToDataSetFilter); - static SALOME_PassThroughFilter *New(); - void SetInput(vtkDataSet *input); - vtkPolyData *GetPolyDataOutput(); - protected: - SALOME_PassThroughFilter(); - virtual ~SALOME_PassThroughFilter(); - void Execute(); - vtkGeometryFilter* myGeomFilter; - private: - SALOME_PassThroughFilter(const SALOME_PassThroughFilter&); // Not implemented. - void operator=(const SALOME_PassThroughFilter&); // Not implemented. -}; - -//======================================================================= - -#endif diff --git a/src/OCCViewer/Makefile.in b/src/OCCViewer/Makefile.in index df92be72a..5f466d4af 100644 --- a/src/OCCViewer/Makefile.in +++ b/src/OCCViewer/Makefile.in @@ -44,7 +44,7 @@ LIB_CLIENT_IDL = SALOMEDS.idl \ CPPFLAGS+=$(QT_INCLUDES) $(OCC_INCLUDES) $(OGL_INCLUDES) $(PYTHON_INCLUDES) -LDFLAGS+=$(QT_MT_LIBS) $(OCC_KERNEL_LIBS) $(OCC_VIEWER_LIBS) $(OGL_LIBS) +LDFLAGS+=$(QT_MT_LIBS) $(OGL_LIBS) -lSalomeGUI @CONCLUDE@ diff --git a/src/Plot2d/Makefile.in b/src/Plot2d/Makefile.in index 23079dfd4..580beb445 100644 --- a/src/Plot2d/Makefile.in +++ b/src/Plot2d/Makefile.in @@ -44,7 +44,7 @@ LIB_CLIENT_IDL = SALOMEDS.idl \ SALOME_Exception.idl CPPFLAGS+=$(QT_INCLUDES) $(OCC_INCLUDES) $(OGL_INCLUDES) $(PYTHON_INCLUDES) $(QWT_INCLUDES) -LDFLAGS+=$(QT_MT_LIBS) $(OGL_LIBS) $(QWT_LIBS) +LDFLAGS+=$(QT_MT_LIBS) $(OGL_LIBS) $(QWT_LIBS) -lSalomeGUI @CONCLUDE@ diff --git a/src/Plot2d/Plot2d_ViewFrame.cxx b/src/Plot2d/Plot2d_ViewFrame.cxx index 2c9c8d748..b5d094b9f 100644 --- a/src/Plot2d/Plot2d_ViewFrame.cxx +++ b/src/Plot2d/Plot2d_ViewFrame.cxx @@ -299,7 +299,17 @@ void Plot2d_ViewFrame::rename( const Handle(SALOME_InteractiveObject)& IObject, */ bool Plot2d_ViewFrame::isInViewer( const Handle(SALOME_InteractiveObject)& IObject ) { - return ( getCurveByIO( IObject ) != NULL ); + if( getCurveByIO( IObject ) != NULL ) + return 1; + else{ + if(!IObject.IsNull()){ + QIntDictIterator it(myCurves); + for(; it.current();++it){ + if(it.current()->hasIO() && it.current()->getTableIO()->isSame(IObject)) + return 1; + }} + } + return 0; } /*! Returns true if interactive object is presented in the viewer and displayed diff --git a/src/Registry/SALOME_Registry_Server.cxx b/src/Registry/SALOME_Registry_Server.cxx index 6cba1c7d8..e4aee0f7d 100644 --- a/src/Registry/SALOME_Registry_Server.cxx +++ b/src/Registry/SALOME_Registry_Server.cxx @@ -74,76 +74,133 @@ int main( int argc , char **argv ) ASSERT(ptrSessionName) ; ASSERT(strlen( ptrSessionName )>0) ; const char *registryName = "Registry" ; - - - try - { - ORB_INIT &init = *SINGLETON_::Instance() ; - CORBA::ORB_var &orb = init( argc , argv ) ; - - - SALOME_NamingService &naming = *SINGLETON_::Instance() ; - naming.init_orb( orb ) ; - - RegistryService *ptrRegistry = SINGLETON_::Instance() ; - ptrRegistry->SessionName( ptrSessionName ) ; - Registry::Components_var varComponents = ptrRegistry->_this() ; - - // The RegistryService must not already exist. - - try - { - CORBA::Object_var pipo = naming.Resolve( registryName ) ; - if (CORBA::is_nil(pipo) ) throw ServiceUnreachable() ; - MESSAGE("RegistryService servant already existing" ) ; - exit( EXIT_FAILURE ) ; - } - catch( const ServiceUnreachable &ex ) - { + ORB_INIT &init = *SINGLETON_::Instance() ; + CORBA::ORB_var &orb = init( argc , argv ) ; + // + long TIMESleep = 250000000; + int NumberOfTries = 40; + int a; + timespec ts_req; + ts_req.tv_nsec=TIMESleep; + ts_req.tv_sec=0; + timespec ts_rem; + ts_rem.tv_nsec=0; + ts_rem.tv_sec=0; + CosNaming::NamingContext_var inc; + PortableServer::POA_var poa; + CORBA::Object_var theObj; + CORBA::Object_var obj; + CORBA::Object_var object; + SALOME_Logger::Logger_var log; + SALOME_NamingService &naming = *SINGLETON_::Instance() ; + Registry::Components_var varComponents; + int REGISTRY=0; + const char * Env = getenv("USE_LOGGER"); + int EnvL =0; + if ((Env!=NULL) && (strlen(Env))) + EnvL=1; + CosNaming::Name name; + name.length(1); + name[0].id=CORBA::string_dup("Logger"); + PortableServer::POAManager_var manager; + for (int i = 1; i<=NumberOfTries; i++){ + if (i!=1) + a=nanosleep(&ts_req,&ts_rem); + try{ + obj = orb->resolve_initial_references("RootPOA"); + if(!CORBA::is_nil(obj)) + poa = PortableServer::POA::_narrow(obj); + if(!CORBA::is_nil(poa)) + manager = poa->the_POAManager(); + if(!CORBA::is_nil(orb)) + theObj = orb->resolve_initial_references("NameService"); + if (!CORBA::is_nil(theObj)) + inc = CosNaming::NamingContext::_narrow(theObj); + } + catch( CORBA::COMM_FAILURE& ) + { + MESSAGE( "Registry Server: CORBA::COMM_FAILURE: Unable to contact the Naming Service" ) } - catch( const CORBA::Exception &exx ) - { - } - string absoluteName = string("/") + registryName; - naming.Register( varComponents , absoluteName.c_str() ) ; - - - CORBA::Object_var poaObj = orb->resolve_initial_references( "RootPOA" ) ; - PortableServer::POA_var poa = PortableServer::POA::_narrow(poaObj) ; - PortableServer::POAManager_var manager = poa->the_POAManager() ; - - - MESSAGE("On attend les requetes des clients") ; - try - { - // Activation du POA - MESSAGE("Activation du POA") ; - manager->activate() ; - - // Lancement de l'ORB - MESSAGE("Lancement de l'ORB") ; + if(!CORBA::is_nil(inc)) { + MESSAGE( "Registry Server: Naming Service was found" ) + if(EnvL==1){ + for(int j=1; j<=NumberOfTries; j++){ + if (j!=1) + a=nanosleep(&ts_req, &ts_rem); + try{ + object = inc->resolve(name); + } + catch(CosNaming::NamingContext::NotFound){ MESSAGE( "Registry Server: Logger Server wasn't found" ) } + catch(...){ MESSAGE( "Registry Server: Unknown exception" ) } + + if (!CORBA::is_nil(object)) + log = SALOME_Logger::Logger::_narrow(object); + if (!CORBA::is_nil(log)){ + MESSAGE( "Registry Server: Logger Server was found" ) + log->ping(); + REGISTRY=1; + break; + } + }} + } + if ((REGISTRY==1)||((EnvL==0)&&(!CORBA::is_nil(inc)))) + break; + } + // + try + { + naming.init_orb( orb ) ; + RegistryService *ptrRegistry = SINGLETON_::Instance() ; + ptrRegistry->SessionName( ptrSessionName ) ; + varComponents = ptrRegistry->_this() ; + // The RegistryService must not already exist. + + try + { + CORBA::Object_var pipo = naming.Resolve( registryName ) ; + if (CORBA::is_nil(pipo) ) throw ServiceUnreachable() ; + MESSAGE("RegistryService servant already existing" ) ; + exit( EXIT_FAILURE ) ; + } + catch( const ServiceUnreachable &ex ) + { + } + catch( const CORBA::Exception &exx ) + { + } + string absoluteName = string("/") + registryName; + naming.Register( varComponents , absoluteName.c_str() ) ; + MESSAGE("On attend les requetes des clients") ; + try + { + // Activation du POA + MESSAGE("Activation du POA") ; + manager->activate() ; + + // Lancement de l'ORB + MESSAGE("Lancement de l'ORB") ; #ifdef CHECKTIME - Utils_Timer timer; - timer.Start(); - timer.Stop(); - MESSAGE("SALOME_Registry_Server.cxx - orb->run()"); - timer.ShowAbsolute(); + Utils_Timer timer; + timer.Start(); + timer.Stop(); + MESSAGE("SALOME_Registry_Server.cxx - orb->run()"); + timer.ShowAbsolute(); #endif - orb->run() ; - } - catch( const CORBA::Exception &ex ) - { - MESSAGE("Erreur systeme") ; - return EXIT_FAILURE ; - } - - } - catch( const SALOME_Exception &ex ) - { - MESSAGE( "Communication Error : " << ex.what() ) + orb->run() ; + } + catch( const CORBA::Exception &ex ) + { + MESSAGE("Erreur systeme") ; return EXIT_FAILURE ; - } - + } + + } + catch( const SALOME_Exception &ex ) + { + MESSAGE( "Communication Error : " << ex.what() ) + return EXIT_FAILURE ; + } + END_OF( argv[0] ) ; return 0 ; } diff --git a/src/RessourcesCatalog/SALOME_RessourcesCatalog_Server.cxx b/src/RessourcesCatalog/SALOME_RessourcesCatalog_Server.cxx index 519f0b845..827efd482 100644 --- a/src/RessourcesCatalog/SALOME_RessourcesCatalog_Server.cxx +++ b/src/RessourcesCatalog/SALOME_RessourcesCatalog_Server.cxx @@ -31,7 +31,7 @@ using namespace std; #include "SALOME_NamingService.hxx" #include "SALOME_RessourcesCatalog_impl.hxx" #include "utilities.h" - +# include "Utils_SINGLETON.hxx" int main(int argc,char **argv) { try { @@ -42,20 +42,80 @@ int main(int argc,char **argv) CORBA::ORB_ptr orb = CORBA::ORB_init (argc, argv); // initialize POA - - CORBA::Object_var poaobj = orb->resolve_initial_references ("RootPOA"); - - PortableServer::POA_var poa = PortableServer::POA::_narrow (poaobj); - PortableServer::POAManager_var mgr = poa->the_POAManager(); - + // + long TIMESleep = 250000000; + int NumberOfTries = 40; + int a; + timespec ts_req; + ts_req.tv_nsec=TIMESleep; + ts_req.tv_sec=0; + timespec ts_rem; + ts_rem.tv_nsec=0; + ts_rem.tv_sec=0; + CosNaming::NamingContext_var inc; + PortableServer::POA_var poa; + CORBA::Object_var theObj; + CORBA::Object_var obj; + CORBA::Object_var object; + SALOME_Logger::Logger_var log; + SALOME_NamingService &naming = *SINGLETON_::Instance() ; + int RESSOURCES_CATALOG=0; + const char * Env = getenv("USE_LOGGER"); + int EnvL =0; + if ((Env!=NULL) && (strlen(Env))) + EnvL=1; + CosNaming::Name name; + name.length(1); + name[0].id=CORBA::string_dup("Logger"); + PortableServer::POAManager_var mgr; + for (int i = 1; i<=NumberOfTries; i++){ + if (i!=1) + a=nanosleep(&ts_req,&ts_rem); + try{ + obj = orb->resolve_initial_references("RootPOA"); + if(!CORBA::is_nil(obj)) + poa = PortableServer::POA::_narrow(obj); + if(!CORBA::is_nil(poa)) + mgr = poa->the_POAManager(); + if(!CORBA::is_nil(orb)) + theObj = orb->resolve_initial_references("NameService"); + if (!CORBA::is_nil(theObj)) + inc = CosNaming::NamingContext::_narrow(theObj); + } + catch( CORBA::COMM_FAILURE& ) + { + MESSAGE( "Ressources Catalog: CORBA::COMM_FAILURE: Unable to contact the Naming Service" ) + } + if(!CORBA::is_nil(inc)) { + MESSAGE( "Ressources Catalog: Naming Service was found" ) + if(EnvL==1){ + for(int j=1; j<=NumberOfTries; j++){ + if (j!=1) + a=nanosleep(&ts_req, &ts_rem); + try{ + object = inc->resolve(name); + } + catch(CosNaming::NamingContext::NotFound){ MESSAGE( "Ressources Catalog: Logger Server wasn't found" ) } + catch(...){ MESSAGE( "Ressources Catalog: Unknown exception" ) } + if (!CORBA::is_nil(object)) + log = SALOME_Logger::Logger::_narrow(object); + if (!CORBA::is_nil(log)){ + MESSAGE( "Ressources Catalog: Loger Server was found" ) + log->ping(); + RESSOURCES_CATALOG=1; + break; + } + }} + } + if ((RESSOURCES_CATALOG==1)||((EnvL==0)&&(!CORBA::is_nil(inc)))) + break; + } + // // Active catalog - + SALOME_RessourcesCatalogImpl* Catalogue_i = new SALOME_RessourcesCatalogImpl(argc, argv); poa->activate_object (Catalogue_i); - mgr->activate(); - - CORBA::Object_ptr myCata = Catalogue_i->_this(); // initialise Naming Service diff --git a/src/SALOMEDS/Makefile.in b/src/SALOMEDS/Makefile.in index dcb0778c0..873929b80 100644 --- a/src/SALOMEDS/Makefile.in +++ b/src/SALOMEDS/Makefile.in @@ -107,7 +107,7 @@ BIN_CLIENT_IDL = CPPFLAGS+=$(OCC_INCLUDES) $(HDF5_INCLUDES) CXXFLAGS+=$(OCC_CXXFLAGS) -LDFLAGS+=$(OCC_KERNEL_LIBS) $(OCC_OCAF_LIBS) $(OCC_VIEWER_LIBS) $(OCC_MODELER_LIBS) $(HDF5_LIBS) -lTOOLSDS -lSalomeNS -lSalomeHDFPersist -lOpUtil -lSalomeLoggerServer +LDFLAGS+= $(HDF5_LIBS) -lTOOLSDS -lSalomeNS -lSalomeHDFPersist -lOpUtil -lSalomeLoggerServer $(CAS_LDPATH) -lTKCAF @CONCLUDE@ diff --git a/src/SALOMEDS/SALOMEDS_Server.cxx b/src/SALOMEDS/SALOMEDS_Server.cxx index 087ef8ff5..238dd2450 100644 --- a/src/SALOMEDS/SALOMEDS_Server.cxx +++ b/src/SALOMEDS/SALOMEDS_Server.cxx @@ -31,7 +31,8 @@ using namespace std; #include CORBA_SERVER_HEADER(SALOMEDS) #include "SALOMEDS_StudyManager_i.hxx" #include "utilities.h" - +# include "Utils_SINGLETON.hxx" +#include "SALOME_NamingService.hxx" //#define CHECKTIME #ifdef CHECKTIME #include @@ -53,12 +54,80 @@ int main(int argc, char** argv) // Initialise the ORB. CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "omniORB3"); omniORB::MaxMessageSize(100 * 1024 * 1024); - // Obtain a reference to the root POA. - CORBA::Object_var obj = orb->resolve_initial_references("RootPOA"); - PortableServer::POA_var poa = PortableServer::POA::_narrow(obj); - - + // + long TIMESleep = 250000000; + int NumberOfTries = 40; + int a; + timespec ts_req; + ts_req.tv_nsec=TIMESleep; + ts_req.tv_sec=0; + timespec ts_rem; + ts_rem.tv_nsec=0; + ts_rem.tv_sec=0; + CosNaming::NamingContext_var inc; + PortableServer::POA_var poa; + CORBA::Object_var theObj; + CORBA::Object_var obj; + CORBA::Object_var object; + SALOME_Logger::Logger_var log; + int SALOMEDS=0; + const char * Env = getenv("USE_LOGGER"); + int EnvL =0; + if ((Env!=NULL) && (strlen(Env))) + EnvL=1; + CosNaming::Name name; + name.length(1); + name[0].id=CORBA::string_dup("Logger"); + PortableServer::POAManager_var pman; + for (int i = 1; i<=NumberOfTries; i++){ + if (i!=1) + a=nanosleep(&ts_req,&ts_rem); + try{ + obj = orb->resolve_initial_references("RootPOA"); + if(!CORBA::is_nil(obj)) + poa = PortableServer::POA::_narrow(obj); + if(!CORBA::is_nil(poa)) + pman = poa->the_POAManager(); + if(!CORBA::is_nil(orb)) + theObj = orb->resolve_initial_references("NameService"); + if (!CORBA::is_nil(theObj)){ + inc = CosNaming::NamingContext::_narrow(theObj); + if(!CORBA::is_nil(inc)) { + MESSAGE( "SalomeDS Server: Naming Service was found" ) + if(EnvL==1){ + CORBA::ORB_var orb1 = CORBA::ORB_init(argc,argv) ; + SALOME_NamingService &NS = *SINGLETON_::Instance() ; + NS.init_orb( orb1 ) ; + for(int j=1; j<=NumberOfTries; j++){ + if (j!=1) + a=nanosleep(&ts_req, &ts_rem); + try{ + object = inc->resolve(name);} + catch(CosNaming::NamingContext::NotFound){ MESSAGE( "SalomeDS Server: Logger Server wasn't found" ) } + catch(...){ MESSAGE( "SalomeDS Server: Unknown exception" ) } + if (!CORBA::is_nil(object)) + log = SALOME_Logger::Logger::_narrow(object); + if (!CORBA::is_nil(log)){ + MESSAGE( "SalomeDS Server: Logger Server was found" ) + log->ping(); + SALOMEDS=1; + break; + } + }} + }} + + } + catch( const SALOME_Exception &ex ) + { + MESSAGE( "Communication Error : " << ex.what() ) + return EXIT_FAILURE ; + } + if ((SALOMEDS==1)||((EnvL==0)&&(!CORBA::is_nil(inc)))) + break; + } + // + // We allocate the objects on the heap. Since these are reference // counted objects, they will be deleted by the POA when they are no // longer needed. @@ -71,7 +140,7 @@ int main(int argc, char** argv) // Obtain a POAManager, and tell the POA to start accepting // requests on its objects. - PortableServer::POAManager_var pman = poa->the_POAManager(); + pman = poa->the_POAManager(); pman->activate(); #ifdef CHECKTIME diff --git a/src/SALOMEGUI/CLIENT_msg_en.po b/src/SALOMEGUI/CLIENT_msg_en.po index 1cdf343b7..e20546601 100644 --- a/src/SALOMEGUI/CLIENT_msg_en.po +++ b/src/SALOMEGUI/CLIENT_msg_en.po @@ -20,7 +20,7 @@ msgstr "" #--------------- msgid "INF_VERSION" -msgstr "Version 1.2" +msgstr "Version 1.3.0" msgid "INF_COPYRIGHT" msgstr " " @@ -38,8 +38,8 @@ msgstr "salome" #: QAD_Application.cxx:133 msgid "QAD_Application::APP_DEFAULTTITLE" -msgstr "SALOME 1.2" +msgstr "SALOME 1.3.0" #: QAD_Desktop.cxx:424 msgid "QAD_Desktop::DESK_DEFAULTTITLE" -msgstr "SALOME 1.2" +msgstr "SALOME 1.3.0" diff --git a/src/SALOMEGUI/Makefile.in b/src/SALOMEGUI/Makefile.in index 2067c607f..08d0682d3 100644 --- a/src/SALOMEGUI/Makefile.in +++ b/src/SALOMEGUI/Makefile.in @@ -43,7 +43,6 @@ EXPORT_HEADERS = \ QAD_FileDlg.h \ QAD_FileValidator.h \ QAD_Help.h \ - QAD_HelpWindow.h \ QAD_PyInterp.h \ QAD_LeftFrame.h \ QAD_ListMenuIdAction.h \ @@ -99,7 +98,7 @@ EXPORT_HEADERS = \ SALOMEGUI_SetValueDlg.h \ SALOMEGUI_SetupCurveDlg.h \ SALOMEGUI_CloseDlg.h - + # .po files to transform in .qm PO_FILES = \ @@ -124,7 +123,6 @@ LIB_SRC = \ QAD_FileDlg.cxx \ QAD_FileValidator.cxx \ QAD_Help.cxx \ - QAD_HelpWindow.cxx \ PyInterp_base.cxx \ QAD_PyInterp.cxx \ QAD_PyInterp_mono.cxx \ @@ -175,13 +173,14 @@ LIB_SRC = \ SALOME_DataMapNodeOfDataMapOfIOMapOfInteger_0.cxx \ SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger_0.cxx \ SALOMEGUI_TrihedronSizeDlg.cxx \ + SALOMEGUI_ExternalBrowserDlg.cxx \ SALOMEGUI_LoadStudiesDlg.cxx \ SALOMEGUI_TableDlg.cxx \ SALOMEGUI_NameDlg.cxx \ SALOMEGUI_SetValueDlg.cxx \ SALOMEGUI_SetupCurveDlg.cxx \ - SALOMEGUI_CloseDlg.cxx - + SALOMEGUI_CloseDlg.cxx \ + SALOMEGUI_ActivateComponentDlg.cxx LIB_MOC = \ SALOMEGUI_Application.h \ SALOMEGUI_Desktop.h \ @@ -190,7 +189,6 @@ LIB_MOC = \ QAD_Desktop.h \ QAD_DirListDlg.h \ QAD_FileDlg.h \ - QAD_HelpWindow.h \ QAD_ListView.h \ QAD_ObjectBrowser.h \ QAD_Operation.h \ @@ -204,22 +202,23 @@ LIB_MOC = \ SALOMEGUI_OpenWith.h \ SALOMEGUI_StudyPropertiesDlg.h \ SALOMEGUI_TrihedronSizeDlg.h \ + SALOMEGUI_ExternalBrowserDlg.h \ SALOME_Selection.h \ SALOMEGUI_LoadStudiesDlg.h \ SALOMEGUI_ViewChoiceDlg.h \ SALOMEGUI_TableDlg.h \ SALOMEGUI_NameDlg.h \ SALOMEGUI_SetupCurveDlg.h \ - SALOMEGUI_CloseDlg.h - + SALOMEGUI_CloseDlg.h \ + SALOMEGUI_ActivateComponentDlg.h LIB_CLIENT_IDL = SALOMEDS.idl \ SALOMEDS_Attributes.idl \ SALOME_ModuleCatalog.idl \ SALOME_Component.idl \ SALOME_Exception.idl -CPPFLAGS+=$(QT_INCLUDES) $(PYTHON_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(QWT_INCLUDES) -LDFLAGS+=$(QT_MT_LIBS) $(OCC_KERNEL_LIBS) $(VTK_LIBS) $(QWT_LIBS) -lSalomeNS -lqsplitterP -lSalomeLifeCycleCORBA -lOpUtil -lSalomeObject +CPPFLAGS+=$(QT_INCLUDES) $(PYTHON_INCLUDES) $(OCC_INCLUDES) +LDFLAGS+=$(QT_MT_LIBS) -lSalomeNS -lqsplitterP -lSalomeLifeCycleCORBA -lOpUtil -lSalomeObject LIBS+= $(PYTHON_LIBS) diff --git a/src/SALOMEGUI/QAD_Application.cxx b/src/SALOMEGUI/QAD_Application.cxx index 935f2c4e7..a0b08aa45 100644 --- a/src/SALOMEGUI/QAD_Application.cxx +++ b/src/SALOMEGUI/QAD_Application.cxx @@ -464,7 +464,7 @@ void QAD_Application::helpAbout() void QAD_Application::helpSearch() { /* just calls QAD_Desktop::helpSearch() but can have own implementation */ - getDesktop()->helpSearch(); + // getDesktop()->helpSearch(); } /*! @@ -473,7 +473,7 @@ void QAD_Application::helpSearch() void QAD_Application::helpContents() { /* just calls QAD_Desktop::helpContents() but can have own implementation */ - getDesktop()->helpContents(); + // getDesktop()->helpContents(); } /*! diff --git a/src/SALOMEGUI/QAD_Desktop.cxx b/src/SALOMEGUI/QAD_Desktop.cxx index 189665a8e..89a1bf2b8 100644 --- a/src/SALOMEGUI/QAD_Desktop.cxx +++ b/src/SALOMEGUI/QAD_Desktop.cxx @@ -35,6 +35,8 @@ using namespace std; # include "Utils_SINGLETON.hxx" #define INCLUDE_MENUITEM_DEF +#define DEFAULT_BROWSER "mozilla" + #include "QAD.h" #include "QAD_Help.h" @@ -51,12 +53,13 @@ using namespace std; #include "QAD_ObjectBrowser.h" #include "QAD_Resource.h" #include "QAD_FileDlg.h" -#include "QAD_HelpWindow.h" +//NRI#include "QAD_HelpWindow.h" #include "QAD_DirListDlg.h" #include "QAD_WaitCursor.h" #include "SALOMEGUI_OpenWith.h" #include "SALOMEGUI_StudyPropertiesDlg.h" #include "SALOMEGUI_TrihedronSizeDlg.h" +#include "SALOMEGUI_ExternalBrowserDlg.h" #include "SALOMEGUI_LoadStudiesDlg.h" #include "SALOME_Selection.h" #include "SALOME_InteractiveObject.hxx" @@ -66,6 +69,7 @@ using namespace std; #include "utilities.h" #include "SALOMEGUI_CloseDlg.h" +#include "SALOMEGUI_ActivateComponentDlg.h" // QT Includes #include @@ -87,6 +91,7 @@ using namespace std; #include #include #include +#include #if QT_VERSION > 300 #include @@ -174,7 +179,7 @@ myStatusBar(0), myActiveApp(0), myActiveStudy(0), myCntUntitled(0), -myHelpWindow(0), +//NRImyHelpWindow(0), myDefaultTitle( tr("DESK_DEFAULTTITLE") ), myQueryClose( true ) { @@ -342,8 +347,8 @@ QAD_Desktop::~QAD_Desktop () myToolBarAction.clear(); myApps.clear(); delete resourceMgr; - if (myHelpWindow) - myHelpWindow->close(); +//NRI if (myHelpWindow) +// myHelpWindow->close(); resourceMgr = 0; QAD_Application::desktop = 0; } @@ -364,9 +369,17 @@ const int IdSelectAll = 1004; */ bool QAD_Desktop::eventFilter( QObject* o, QEvent* e ) { - if ( e->type() == QEvent::ContextMenu ) { - QContextMenuEvent* ce = (QContextMenuEvent*)e; - if ( o->inherits("QRenameEdit") ) { + if (e->type() == 2000 ) { + QMessageBox::information (this, tr ( "Help Information" ), tr ( "Can't run choosen browser.\nRunning default browser (Mozilla). ")); + return TRUE; + } + else if (e->type() == 2001 ) { + QMessageBox::critical(this, tr ( "Help Error" ), tr ( "Can't run the default browser.") ); + return TRUE; + } + else if ( e->type() == QEvent::ContextMenu ) { + QContextMenuEvent* ce = (QContextMenuEvent*)e; + if ( o->inherits("QRenameEdit") ) { return TRUE; } else if ( o->inherits("QLineEdit") ) { @@ -444,7 +457,7 @@ void QAD_Desktop::createActions() myMainMenu->insertItem ( tr("MEN_DESK_VIEW"), &myViewPopup, 2 ); /* add popup VIEW */ myMainMenu->insertItem ( tr("MEN_DESK_TOOLS"), &myToolsPopup, 5 ); /* add popup TOOLS */ myMainMenu->insertItem ( tr("MEN_DESK_PREF"), &myPrefPopup, 4 ); /* add popup PREF */ - myMainMenu->insertItem ( tr("MEN_DESK_WINDOW"), &myWindowPopup, 6 ); /* add popup WINDOW */ + myMainMenu->insertItem ( tr("MEN_DESK_WINDOW"), &myWindowPopup, 6 );/* add popup WINDOW */ myMainMenu->insertItem ( tr("MEN_DESK_HELP"), &myHelpPopup, 7 ); /* add popup HELP */ /* Applications will insert their items after 'File' 'Edit' and 'View' @@ -745,6 +758,13 @@ void QAD_Desktop::createActions() myPrefPopup.insertSeparator(); + /* External Browser */ + QActionP* externalBrowserAction = new QActionP( "", tr("MEN_DESK_PREF_EXTERNAL_BROWSER"), 0, this ); + QAD_ASSERT(connect( externalBrowserAction, SIGNAL(activated()), this, SLOT(onExternalBrowser() ))); + externalBrowserAction->addTo( &myPrefPopup ); + myStdActions.insert( PrefExternalBrowserId, externalBrowserAction ); + + myPrefPopup.insertSeparator(); /* BrowserPopup */ myPrefPopup.insertItem( tr("MEN_DESK_PREF_OBJECTBROWSER"), &myObjBrowserPopup ); @@ -871,6 +891,26 @@ void QAD_Desktop::createActions() this, SLOT( onHelpContents() ))); helpContentsAction->addTo( &myHelpPopup ); myStdActions.insert( HelpContentsId , helpContentsAction ); + + id = myHelpPopup.insertSeparator(); + + /* GUI contents */ + // NRI : Temporary commented + +// QActionP* helpContentsActionGUI = new QActionP( "", tr("MEN_DESK_HELP_GUICONTENTS"), 0, this ); +// helpContentsActionGUI->setStatusTip ( tr("PRP_DESK_HELP_GUICONTENTS") ); +// QAD_ASSERT(connect( helpContentsActionGUI, SIGNAL(activated()), +// this, SLOT( onHelpContentsGUI() ))); +// helpContentsActionGUI->addTo( &myHelpPopup ); +// myStdActions.insert( HelpContentsId , helpContentsActionGUI ); + + /* TUI contents */ + QActionP* helpContentsActionTUI = new QActionP( "", tr("MEN_DESK_HELP_TUICONTENTS"), 0, this ); + helpContentsActionTUI->setStatusTip ( tr("PRP_DESK_HELP_TUICONTENTS") ); + QAD_ASSERT(connect( helpContentsActionTUI, SIGNAL(activated()), + this, SLOT( onHelpContentsTUI() ))); + helpContentsActionTUI->addTo( &myHelpPopup ); + myStdActions.insert( HelpContentsId , helpContentsActionTUI ); /* search */ // QActionP* helpSearchAction = new QActionP( "", tr("MEN_DESK_HELP_SEARCH"), 0, this ); @@ -1001,6 +1041,7 @@ void QAD_Desktop::updateCaption( UpdateCommand cmd ) else { /* default icon and title */ setIcon( myDefaultIcon ); + qApp->processEvents(); setCaption( myDefaultTitle ); } } @@ -1181,48 +1222,48 @@ QString QAD_Desktop::getComponentUserName(const char *componentName) return ""; } -/*! - gets application Help Window (and creates if necessary) -*/ -QAD_HelpWindow* QAD_Desktop::getHelpWindow() -{ - if (!myHelpWindow) { - myHelpWindow = new QAD_HelpWindow(); +// /*! +// gets application Help Window (and creates if necessary) +// */ +// QAD_HelpWindow* QAD_Desktop::getHelpWindow() +// { +// if (!myHelpWindow) { +// myHelpWindow = new QAD_HelpWindow(); - QMap::Iterator it; - for( it = mapComponentName.begin(); it != mapComponentName.end(); ++it ) { - QCString dir; - QString root; +// QMap::Iterator it; +// for( it = mapComponentName.begin(); it != mapComponentName.end(); ++it ) { +// QCString dir; +// QString root; - // look for index.html and set homeDir - // 1. $(MODULE_ROOT_DIR)/doc/index.html - // 2. $(MODULE_ROOT_DIR)/doc/html/index.html - // 3. $(MODULE_ROOT_DIR)/doc/html/html/index.html - - if (dir = getenv( QString( it.data() + "_ROOT_DIR")) ) { - root = QAD_Tools::addSlash( QAD_Tools::addSlash(dir) + QAD_Tools::addSlash("share") + QAD_Tools::addSlash("salome") + "doc" ); - if ( QFileInfo( root + "index.html" ).exists() ) { - helpContext( root + "index.html", "" ); - } - else { - root = QAD_Tools::addSlash( root + "html" ); - if ( QFileInfo( root + "index.html" ).exists() ) { - helpContext( root + "index.html", "" ); - } - else { - root = QAD_Tools::addSlash( root + "html" ); - if ( QFileInfo( root + "index.html" ).exists() ) { - helpContext( root + "index.html", "" ); - } - } - } - } - } +// // look for index.html and set homeDir +// // 1. $(MODULE_ROOT_DIR)/doc/index.html +// // 2. $(MODULE_ROOT_DIR)/doc/html/index.html +// // 3. $(MODULE_ROOT_DIR)/doc/html/html/index.html + +// if (dir = getenv( QString( it.data() + "_ROOT_DIR")) ) { +// root = QAD_Tools::addSlash( QAD_Tools::addSlash(dir) + QAD_Tools::addSlash("share") + QAD_Tools::addSlash("salome") + "doc" ); +// if ( QFileInfo( root + "index.html" ).exists() ) { +// helpContext( root + "index.html", "" ); +// } +// else { +// root = QAD_Tools::addSlash( root + "html" ); +// if ( QFileInfo( root + "index.html" ).exists() ) { +// helpContext( root + "index.html", "" ); +// } +// else { +// root = QAD_Tools::addSlash( root + "html" ); +// if ( QFileInfo( root + "index.html" ).exists() ) { +// helpContext( root + "index.html", "" ); +// } +// } +// } +// } +// } - connect(myHelpWindow, SIGNAL(helpWindowClosed()), this, SLOT(onHelpWindowClosed())); - } - return myHelpWindow; -} +// connect(myHelpWindow, SIGNAL(helpWindowClosed()), this, SLOT(onHelpWindowClosed())); +// } +// return myHelpWindow; +// } /*! Called when desktop is closing @@ -1807,13 +1848,13 @@ void QAD_Desktop::onCascade() it.current()->resize((int)(0.8*w), (int)(0.8*h)); } -/*! - called when help window closed -*/ -void QAD_Desktop::onHelpWindowClosed() -{ - myHelpWindow = 0; -} +// /*! +// called when help window closed +// */ +// void QAD_Desktop::onHelpWindowClosed() +// { +// myHelpWindow = 0; +// } /*! Called when 'view status bar' option @@ -1984,28 +2025,157 @@ void QAD_Desktop::onNewWindow3d() //NRI : SAL2214 } +// Helps to execute command +class RunBrowser: public QThread { +public: + + RunBrowser(QString theApp, QString theParams, QString theHelpFile): + myApp(theApp), myParams(theParams), myHelpFile(theHelpFile), myStatus(0) {}; + + virtual void run() + { + QString aCommand; + + if ( !myApp.isEmpty()) + { + aCommand.sprintf("%s %s %s",myApp.latin1(),myParams.latin1(),myHelpFile.latin1()); + myStatus = system(aCommand); + if(myStatus != 0) + { + QCustomEvent* ce2000 = new QCustomEvent (2000); + postEvent (qApp, ce2000); + } + } + + if( myStatus != 0 || myApp.isEmpty()) + { + myParams = ""; + aCommand.sprintf("%s %s %s", QString(DEFAULT_BROWSER).latin1(),myParams.latin1(), myHelpFile.latin1()); + myStatus = system(aCommand); + if(myStatus != 0) + { + QCustomEvent* ce2001 = new QCustomEvent (2001); + postEvent (qApp, ce2001); + } + } + } + +private: + QString myApp; + QString myParams; + QString myHelpFile; + int myStatus; + +}; + /*! Called on 'help\contents' */ void QAD_Desktop::onHelpContents() +{ if (myActiveComp == "") + myActiveComp = getComponentUserName( "KERNEL" ); //NRI "Salome"; + + QCString dir; + QString root; + QString homeDir; + if (dir = getenv( getComponentName( myActiveComp ) + "_ROOT_DIR")) { + root = QAD_Tools::addSlash( QAD_Tools::addSlash(dir) + QAD_Tools::addSlash("share") + QAD_Tools::addSlash("salome") + QAD_Tools::addSlash("doc") + "html" ); + if ( QFileInfo( root + "index.html" ).exists() ) { + homeDir = root; + } else { + QMessageBox::warning( this, tr("WRN_WARNING"), + QString( "%1index.html doesn't exist." ).arg(root), tr ("BUT_OK") ); + return; + } + } + + QString helpFile = QFileInfo( homeDir + "index.html" ).absFilePath(); + + QString anApp = QAD_CONFIG->getSetting("ExternalBrowser:Application"); + QString aParams = QAD_CONFIG->getSetting("ExternalBrowser:Parameters"); + + RunBrowser* rs = new RunBrowser(anApp, aParams, helpFile); + rs->start(); +} + +/*! + Called on 'help\GUI Reference' +*/ +void QAD_Desktop::onHelpContentsGUI() { - if (myActiveApp) - myActiveApp->helpContents(); - else - helpContents(); + +// QCString dir; +// QString root; +// QString homeDir; + +// 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"); + +// RunBrowser* rs = new RunBrowser(anApp, aParams, helpFile); +// rs->start(); + } /*! - Called on 'help\search' + Called on 'help\TUI Reference' */ -void QAD_Desktop::onHelpSearch() +void QAD_Desktop::onHelpContentsTUI() { - if (myActiveApp) - myActiveApp->helpSearch(); - else - helpSearch(); + if (myActiveComp == "") + myActiveComp = getComponentUserName( "KERNEL" ); //NRI "Salome"; + + QCString dir; + QString root; + QString homeDir; + if (dir = getenv( getComponentName( myActiveComp ) + "_ROOT_DIR")) { + root = QAD_Tools::addSlash( QAD_Tools::addSlash(dir) + QAD_Tools::addSlash("share") + QAD_Tools::addSlash("salome") + QAD_Tools::addSlash("doc") + "html" ); + if ( QFileInfo( root + "index.html" ).exists() ) { + homeDir = root; + } else { + QMessageBox::warning( this, tr("WRN_WARNING"), + QString( "%1index.html doesn't exist." ).arg(root), tr ("BUT_OK") ); + return; + } + } + + QString helpFile = QFileInfo( homeDir + "index.html" ).absFilePath(); + + QString anApp = QAD_CONFIG->getSetting("ExternalBrowser:Application"); + QString aParams = QAD_CONFIG->getSetting("ExternalBrowser:Parameters"); + + RunBrowser* rs = new RunBrowser(anApp, aParams, helpFile); + rs->start(); } +// /*! +// Called on 'help\search' +// */ +// void QAD_Desktop::onHelpSearch() +// { +// if (myActiveApp) +// myActiveApp->helpSearch(); +// else +// helpSearch(); +// } + /*! Called on 'help\about' */ @@ -2572,45 +2742,6 @@ void QAD_Desktop::onDispatchTools(int id) bool libToolsGUI = true; if( QAD_XmlHandler::_bibmap[ id ].isEmpty() ) { - - if ( dir = getenv("SALOME_SITE_DIR")) { - dir = QAD_Tools::addSlash(dir) ; - dir = dir + "lib" ; - dir = QAD_Tools::addSlash(dir) ; - dir = dir + "salome" ; - dir = QAD_Tools::addSlash(dir) ; -#ifdef WNT - dir = dir + "libToolsGUI.dll" ; -#else - dir = dir + "libToolsGUI.so" ; -#endif - MESSAGE ( " GUI library = " << dir ); - fileInfo.setFile(dir) ; - if (fileInfo.exists()) { - ToolsLib = fileInfo.fileName() ; - found = true; - } - } - - if ( (dir = getenv("SALOME_ROOT_DIR")) && !found ) { - dir = QAD_Tools::addSlash(dir) ; - dir = dir + "lib" ; - dir = QAD_Tools::addSlash(dir) ; - dir = dir + "salome" ; - dir = QAD_Tools::addSlash(dir) ; -#ifdef WNT - dir = dir + "libToolsGUI.dll" ; -#else - dir = dir + "libToolsGUI.so" ; -#endif - MESSAGE ( " GUI library = " << dir ); - fileInfo.setFile(dir) ; - if (fileInfo.exists()) { - ToolsLib = fileInfo.fileName() ; - found = true; - } - } - if ( (dir = getenv("KERNEL_ROOT_DIR")) && !found ) { dir = QAD_Tools::addSlash(dir) ; dir = dir + "lib" ; @@ -2633,36 +2764,6 @@ void QAD_Desktop::onDispatchTools(int id) else { libToolsGUI = false; SCRUTE( QAD_XmlHandler::_bibmap[ id ] ) ; - if ( dir = getenv("SALOME_SITE_DIR")) { - dir = QAD_Tools::addSlash(dir) ; - dir = dir + "lib" ; - dir = QAD_Tools::addSlash(dir) ; - dir = dir + "salome" ; - dir = QAD_Tools::addSlash(dir) ; - dir = dir + QAD_XmlHandler::_bibmap[ id ].latin1() ; - MESSAGE ( " GUI library = " << dir ); - fileInfo.setFile(dir) ; - if (fileInfo.exists()) { - ToolsLib = fileInfo.fileName() ; - found = true; - } - } - - if ( (dir = getenv("SALOME_ROOT_DIR")) && !found ) { - dir = QAD_Tools::addSlash(dir) ; - dir = dir + "lib" ; - dir = QAD_Tools::addSlash(dir) ; - dir = dir + "salome" ; - dir = QAD_Tools::addSlash(dir) ; - dir = dir + QAD_XmlHandler::_bibmap[ id ].latin1() ; - MESSAGE ( " GUI library = " << dir ); - fileInfo.setFile(dir) ; - if (fileInfo.exists()) { - ToolsLib = fileInfo.fileName() ; - found = true; - } - } - if ( (dir = getenv("KERNEL_ROOT_DIR")) && !found ) { dir = QAD_Tools::addSlash(dir) ; dir = dir + "lib" ; @@ -2796,15 +2897,35 @@ void QAD_Desktop::onComboActiveComponent( const QString & component, bool isLoad aButton->setOn(true); } } - } else { - QMessageBox::critical( 0, - tr( "ERR_ERROR" ), - tr( "WRN_LOAD_COMPONENT" ) ); - myCombo->setCurrentItem (0); - for ( QToolButton* aButton=myComponentButton.first(); aButton; aButton=myComponentButton.next() ) { - aButton->setOn(false); - } - } + } else if (component.compare(QString("Salome"))!= 0) { + + SALOMEGUI_ActivateComponentDlg aDlg( this ); + int res = aDlg.exec(); + + switch ( res ) + { + case 1: + onNewStudy(); + onComboActiveComponent(component,true); + break; + case 2: + onOpenStudy(); + onComboActiveComponent(component,true); + break; + case 3: + onLoadStudy(); + onComboActiveComponent(component,true);; + break; + case 0: + default: + putInfo( tr("INF_CANCELLED") ); + myCombo->setCurrentItem (0); + for ( QToolButton* aButton=myComponentButton.first(); aButton; aButton=myComponentButton.next() ) { + aButton->setOn(false); + // return; + } + } + } } /*! @@ -3151,6 +3272,33 @@ void QAD_Desktop::onViewerTrihedron() } } +void QAD_Desktop::onExternalBrowser() +{ + + QString theApp = QAD_CONFIG->getSetting("ExternalBrowser:Application"); + QString theParams = QAD_CONFIG->getSetting("ExternalBrowser:Parameters"); + + SALOMEGUI_ExternalBrowserDlg *Dlg = new SALOMEGUI_ExternalBrowserDlg(this); + + if (!theApp.isEmpty()) + { + QString theParams = QAD_CONFIG->getSetting("ExternalBrowser:Parameters"); + Dlg->setSettings(theApp, theParams); + } + int r = Dlg->exec(); + QString theAppFromDialog = Dlg->getApp(); + QString theParamsFromDialog = Dlg->getParams(); + delete Dlg; + + if (r == QDialog::Accepted) + { + QAD_CONFIG->addSetting("ExternalBrowser:Application", theAppFromDialog ); + QAD_CONFIG->addSetting("ExternalBrowser:Parameters", theParamsFromDialog ); + } + +} + + void QAD_Desktop::onDirList() { // getting dir list from settings @@ -3366,52 +3514,52 @@ void QAD_Desktop::helpAbout() delete About; } -/* Help Search */ -void QAD_Desktop::helpSearch() -{ -} - -/* Help Contents */ -void QAD_Desktop::helpContents() -{ - if (myActiveComp == "") - myActiveComp = getComponentUserName( "KERNEL" ); //NRI "Salome"; - - QCString dir; - QString root; - if (dir = getenv( getComponentName( myActiveComp ) + "_ROOT_DIR")) { - root = QAD_Tools::addSlash( QAD_Tools::addSlash(dir) + QAD_Tools::addSlash("share") + QAD_Tools::addSlash("salome") + "doc" ); - if ( QFileInfo( root + "index.html" ).exists() ) { - helpContext( root + "index.html", "" ); - } - else { - root = QAD_Tools::addSlash( root + "html" ); - if ( QFileInfo( root + "index.html" ).exists() ) { - helpContext( root + "index.html", "" ); - } - else { - root = QAD_Tools::addSlash( root + "html" ); - if ( QFileInfo( root + "index.html" ).exists() ) { - helpContext( root + "index.html", "" ); - } - } - } - } +// /* Help Search */ +// void QAD_Desktop::helpSearch() +// { +// } + +// /* Help Contents */ +// void QAD_Desktop::helpContents() +// { +// if (myActiveComp == "") +// myActiveComp = getComponentUserName( "KERNEL" ); //NRI "Salome"; + +// QCString dir; +// QString root; +// if (dir = getenv( getComponentName( myActiveComp ) + "_ROOT_DIR")) { +// root = QAD_Tools::addSlash( QAD_Tools::addSlash(dir) + QAD_Tools::addSlash("share") + QAD_Tools::addSlash("salome") + "doc" ); +// if ( QFileInfo( root + "index.html" ).exists() ) { +// helpContext( root + "index.html", "" ); +// } +// else { +// root = QAD_Tools::addSlash( root + "html" ); +// if ( QFileInfo( root + "index.html" ).exists() ) { +// helpContext( root + "index.html", "" ); +// } +// else { +// root = QAD_Tools::addSlash( root + "html" ); +// if ( QFileInfo( root + "index.html" ).exists() ) { +// helpContext( root + "index.html", "" ); +// } +// } +// } +// } - //NRI getHelpWindow()->contents(); - getHelpWindow()->show(); - getHelpWindow()->raise(); - getHelpWindow()->setActiveWindow(); -} +// // //NRI getHelpWindow()->contents(); +// // getHelpWindow()->show(); +// // getHelpWindow()->raise(); +// // getHelpWindow()->setActiveWindow(); +// } /* Help Context */ -void QAD_Desktop::helpContext(const QString& source, const QString& context) -{ - getHelpWindow()->context(source, context); - getHelpWindow()->show(); - getHelpWindow()->raise(); - getHelpWindow()->setActiveWindow(); -} +// void QAD_Desktop::helpContext(const QString& source, const QString& context) +// { +// // getHelpWindow()->context(source, context); +// // getHelpWindow()->show(); +// // getHelpWindow()->raise(); +// // getHelpWindow()->setActiveWindow(); +// } /* Preferences/MultiFile Save */ void QAD_Desktop::onMultiFileSave() diff --git a/src/SALOMEGUI/QAD_Desktop.h b/src/SALOMEGUI/QAD_Desktop.h index 065837548..c8743a3c2 100644 --- a/src/SALOMEGUI/QAD_Desktop.h +++ b/src/SALOMEGUI/QAD_Desktop.h @@ -34,7 +34,7 @@ #include "QAD_Application.h" #include "QAD_OperatorMenus.h" #include "QAD_Menus.h" -#include "QAD_HelpWindow.h" +//NRI #include "QAD_HelpWindow.h" #include "QAD_Action.h" #include "SALOME_NamingService.hxx" @@ -80,7 +80,7 @@ protected: //VRV: T2.5 - add default viewer PrefViewerTrihedronId, PrefConsoleFontId, PrefObjectBrowserEntryId, PrefObjectBrowserIAPPId, PrefObjectBrowserValueId, PrefObjectBrowserCHRONO_SORTId, - PrefDirsId, PrefMultiFileSave, PrefASCIISave, PrefSaveId, + PrefDirsId, PrefMultiFileSave, PrefASCIISave, PrefExternalBrowserId, PrefSaveId, //NRI : SAL2214 WindowNew3dId, ViewOCCId, ViewVTKId, ViewPlot2dId, //NRI : SAL2214 @@ -147,9 +147,9 @@ public: /* help actions */ virtual void helpAbout(); - virtual void helpSearch(); - virtual void helpContents(); - virtual void helpContext(const QString& path, const QString& dir = QString::null); +/* virtual void helpSearch(); */ +/* virtual void helpContents(); */ +/* virtual void helpContext(const QString& path, const QString& dir = QString::null); */ bool loadComponent(QString); void activateComponent(const QString& theName, bool isLoadData = true); @@ -171,7 +171,7 @@ public: QString getComponentName(const char *componentUserName); QString getComponentUserName(const char *componentName); - QAD_HelpWindow* getHelpWindow(); + //NRI QAD_HelpWindow* getHelpWindow(); void onMouseMove(QMouseEvent*); bool onMousePress(QMouseEvent*); @@ -236,12 +236,15 @@ protected slots: void onObjectBrowser(); void onMultiFileSave(); void onASCIISave(); + void onExternalBrowser(); void onActivateApp(QAD_Application* app); void onDeactivateApp(QAD_Application* app); void onHelpContents(); - void onHelpSearch(); + void onHelpContentsGUI(); + void onHelpContentsTUI(); +/* void onHelpSearch(); */ void onHelpAbout(); void onNewWindow3d(); @@ -257,7 +260,7 @@ protected slots: void onComboActiveComponent( const QString & , bool isLoadData); void onCascade(); - void onHelpWindowClosed(); + //NRI void onHelpWindowClosed(); protected: QMenuBar* myMainMenu; /* the main menu bar */ @@ -305,7 +308,7 @@ protected: QList myMenusList; QAD_Menus* myActiveMenus; - QAD_HelpWindow* myHelpWindow; + //NRI QAD_HelpWindow* myHelpWindow; QList myComponentButton; diff --git a/src/SALOMEGUI/QAD_Message.cxx b/src/SALOMEGUI/QAD_Message.cxx index a932028e2..4730b1ee8 100644 --- a/src/SALOMEGUI/QAD_Message.cxx +++ b/src/SALOMEGUI/QAD_Message.cxx @@ -111,9 +111,9 @@ void QAD_Message::mousePressEvent(QMouseEvent* event) id = popup->insertItem( tr( "EDIT_SELECTALL_CMD" ) ); idMap.insert(IdSelectAll, id); popup->setItemEnabled( idMap[ IdCopy ], hasMarkedText() ); - popup->setItemEnabled( idMap[ IdSelectAll ], - (bool)text().length() && !allSelected ); - + popup->setItemEnabled( idMap[ IdSelectAll ], !allSelected ); + popup->setItemEnabled( idMap[ IdClear ], textLine(1)!=myPrompt ); + int r = popup->exec( event->globalPos() ); delete popup; diff --git a/src/SALOMEGUI/QAD_ObjectBrowser.cxx b/src/SALOMEGUI/QAD_ObjectBrowser.cxx index 35bcde863..7bea424c0 100644 --- a/src/SALOMEGUI/QAD_ObjectBrowser.cxx +++ b/src/SALOMEGUI/QAD_ObjectBrowser.cxx @@ -712,6 +712,9 @@ void QAD_ObjectBrowser::Update( SALOMEDS::SObject_ptr SO, */ void QAD_ObjectBrowser::Update() { + int x = myListView->contentsX(); + int y = myListView->contentsY(); + myListView->clear(); myListViewMap.clear(); @@ -844,6 +847,8 @@ void QAD_ObjectBrowser::Update() } /* Updating UseCase Browser ============================================= */ UpdateUseCaseBrowser(); + + myListView->setContentsPos(x,y); } /*! diff --git a/src/SALOMEGUI/QAD_PyEditor.cxx b/src/SALOMEGUI/QAD_PyEditor.cxx index 58407f6a0..4dd3aa333 100644 --- a/src/SALOMEGUI/QAD_PyEditor.cxx +++ b/src/SALOMEGUI/QAD_PyEditor.cxx @@ -278,9 +278,17 @@ void QAD_PyEditor::keyPressEvent( QKeyEvent *e ) } case Key_Up: { - // if Cntr+Key_Up event then scroll the commands stack up + // if Cntr+Key_Up event then move cursor up if (ctrlPressed) { - QString histLine = _currentPrompt; + QMultiLineEdit::cursorUp( ); + } + // if Shift+Key_Up event then move cursor up and select the text + else if ( shftPressed && curLine > 0 ){ + setCursorPosition(curLine-1, curCol, true); + } + // scroll the commands stack up + else { + QString histLine = _currentPrompt; if (! _isInHistory) { _isInHistory = true; @@ -297,19 +305,21 @@ void QAD_PyEditor::keyPressEvent( QKeyEvent *e ) endLine = numLines() -1; setCursorPosition(endLine, lineLength(endLine)); } - // if Shift+Key_Up event then move cursor up and select the text - else if ( shftPressed && curLine > 0 ){ - setCursorPosition(curLine-1, curCol, true); - } - // move cursor up - else { QMultiLineEdit::keyPressEvent( e ); } break; } case Key_Down: { - // if Cntr+Key_Down event then scroll the commands stack down + // if Cntr+Key_Down event then move cursor down if (ctrlPressed) { - QString histLine = _currentPrompt; + QMultiLineEdit::cursorDown( ); + } + // if Shift+Key_Down event then move cursor down and select the text + else if ( shftPressed && curLine < endLine ) { + setCursorPosition(curLine+1, curCol, true); + } + // scroll the commands stack down + else { + QString histLine = _currentPrompt; QString nextCommand = _interp->getNext(); if (nextCommand.compare(TOP_HISTORY_PY) != 0) { @@ -328,13 +338,6 @@ void QAD_PyEditor::keyPressEvent( QKeyEvent *e ) endLine = numLines() -1; setCursorPosition(endLine, lineLength(endLine)); } - // if Shift+Key_Down event then move cursor down and select the text - else if ( shftPressed && curLine < endLine ) { - setCursorPosition(curLine+1, curCol, true); - } - //move cursor down - else { QMultiLineEdit::keyPressEvent( e ); } - break; } case Key_Left: diff --git a/src/SALOMEGUI/QAD_ResourceMgr.cxx b/src/SALOMEGUI/QAD_ResourceMgr.cxx index bb52c0aee..d116c7b33 100644 --- a/src/SALOMEGUI/QAD_ResourceMgr.cxx +++ b/src/SALOMEGUI/QAD_ResourceMgr.cxx @@ -240,11 +240,10 @@ QString QAD_ResourceMgr::resources( const char* prefix ) const Collects list of directories, separated by ';' where resources for module 'prefix' can be situated The order is following : + - _ROOT_DIR/share/salome/resources directory - CSF_Resources env.var directory ( or directory list ) - - CSF_ResourcesDefaults env.var directory ( or directory list ) - ${HOME}/.salome/resources directory - - ${SALOME_SITE_DIR}/share/salome/resources directory - - ${SALOME_ROOT_DIR}/share/salome/resources directory + - KERNEL_ROOT_DIR/share/salome/resources directory */ QString QAD_ResourceMgr::collectDirs( const QString& prefix ) const { @@ -281,13 +280,6 @@ QString QAD_ResourceMgr::collectDirs( const QString& prefix ) const dirList.append( dirList.isEmpty() ? dir : ( QString( SEPARATOR ) + dir ) ); } } - // Try CSF_ResourcesDefaults env.var directory ( or directory list ) - cenv = getenv( "CSF_ResourcesDefaults" ); - if ( cenv ) { - dir.sprintf( "%s", cenv ); - if ( !dir.isEmpty() ) - dirList.append( dirList.isEmpty() ? dir : ( QString( SEPARATOR ) + dir ) ); - } // Try ${HOME}/.salome/resources directory cenv = getenv( "HOME" ); if ( cenv ) { @@ -301,36 +293,6 @@ QString QAD_ResourceMgr::collectDirs( const QString& prefix ) const dirList.append( dirList.isEmpty() ? dir : ( QString( SEPARATOR ) + dir ) ); } } - // Try ${SALOME_SITE_DIR}/share/salome/resources directory - cenv = getenv( "SALOME_SITE_DIR" ); - if ( cenv ) { - dir.sprintf( "%s", cenv ); - if ( !dir.isEmpty() ) { - dir = QAD_Tools::addSlash(dir) ; - dir = dir + "share" ; - dir = QAD_Tools::addSlash(dir) ; - dir = dir + "salome" ; - dir = QAD_Tools::addSlash(dir) ; - dir = dir + "resources" ; - dir = QAD_Tools::addSlash(dir) ; - dirList.append( dirList.isEmpty() ? dir : ( QString( SEPARATOR ) + dir ) ); - } - } - // Try ${SALOME_ROOT_DIR}/share/salome/resources directory - cenv = getenv( "SALOME_ROOT_DIR" ); - if ( cenv ) { - dir.sprintf( "%s", cenv ); - if ( !dir.isEmpty() ) { - dir = QAD_Tools::addSlash(dir) ; - dir = dir + "share" ; - dir = QAD_Tools::addSlash(dir) ; - dir = dir + "salome" ; - dir = QAD_Tools::addSlash(dir) ; - dir = dir + "resources" ; - dir = QAD_Tools::addSlash(dir) ; - dirList.append( dirList.isEmpty() ? dir : ( QString( SEPARATOR ) + dir ) ); - } - } // Try ${KERNEL_ROOT_DIR}/share/salome/resources directory cenv = getenv( "KERNEL_ROOT_DIR" ); diff --git a/src/SALOMEGUI/QAD_RightFrame.cxx b/src/SALOMEGUI/QAD_RightFrame.cxx index 200ecc5cb..806a1503c 100644 --- a/src/SALOMEGUI/QAD_RightFrame.cxx +++ b/src/SALOMEGUI/QAD_RightFrame.cxx @@ -69,49 +69,7 @@ QAD_RightFrame::QAD_RightFrame(QWidget *parent, const char *name, QCString dir; QFileInfo fileInfo ; bool found = false; - if (myViewType == VIEW_OCC) { - if ( dir = getenv("SALOME_SITE_DIR")) { - dir = QAD_Tools::addSlash(dir) ; - dir = dir + "lib" ; - dir = QAD_Tools::addSlash(dir) ; - dir = dir + "salome" ; - dir = QAD_Tools::addSlash(dir) ; -#ifdef WNT - dir = dir + "libOCCViewer.dll" ; -#else - dir = dir + "libOCCViewer.so" ; -#endif - MESSAGE ( " GUI library = " << dir ) - fileInfo.setFile(dir) ; - if (fileInfo.exists()) { - ComponentLib = fileInfo.fileName(); - found = true; - MESSAGE (" Found ") - } else - MESSAGE (" Not found ") - } - - if ( (dir = getenv("SALOME_ROOT_DIR")) && !found ) { - dir = QAD_Tools::addSlash(dir) ; - dir = dir + "lib" ; - dir = QAD_Tools::addSlash(dir) ; - dir = dir + "salome" ; - dir = QAD_Tools::addSlash(dir) ; -#ifdef WNT - dir = dir + "libOCCViewer.dll" ; -#else - dir = dir + "libOCCViewer.so" ; -#endif - MESSAGE ( " GUI library = " << dir ) - fileInfo.setFile(dir) ; - if (fileInfo.exists()) { - ComponentLib = fileInfo.fileName(); - found = true; - MESSAGE (" Found ") - } else - MESSAGE (" Not found ") - } - + if (myViewType == VIEW_OCC) { if ( (dir = getenv("KERNEL_ROOT_DIR")) && !found ) { dir = QAD_Tools::addSlash(dir) ; dir = dir + "lib" ; @@ -133,49 +91,6 @@ QAD_RightFrame::QAD_RightFrame(QWidget *parent, const char *name, MESSAGE (" Not found ") } } else if (myViewType == VIEW_VTK) { - - if ( dir = getenv("SALOME_SITE_DIR")) { - dir = QAD_Tools::addSlash(dir) ; - dir = dir + "lib" ; - dir = QAD_Tools::addSlash(dir) ; - dir = dir + "salome" ; - dir = QAD_Tools::addSlash(dir) ; -#ifdef WNT - dir = dir + "libVTKViewer.dll" ; -#else - dir = dir + "libVTKViewer.so" ; -#endif - MESSAGE ( " GUI library = " << dir ); - fileInfo.setFile(dir) ; - if (fileInfo.exists()) { - ComponentLib = fileInfo.fileName(); - found = true; - MESSAGE (" Found "); - } else - MESSAGE (" Not found "); - } - - if ( (dir = getenv("SALOME_ROOT_DIR")) && !found ) { - dir = QAD_Tools::addSlash(dir) ; - dir = dir + "lib" ; - dir = QAD_Tools::addSlash(dir) ; - dir = dir + "salome" ; - dir = QAD_Tools::addSlash(dir) ; -#ifdef WNT - dir = dir + "libVTKViewer.dll" ; -#else - dir = dir + "libVTKViewer.so" ; -#endif - MESSAGE ( " GUI library = " << dir ); - fileInfo.setFile(dir) ; - if (fileInfo.exists()) { - ComponentLib = fileInfo.fileName(); - found = true; - MESSAGE (" Found "); - } else - MESSAGE (" Not found "); - } - if ( (dir = getenv("KERNEL_ROOT_DIR")) && !found ) { dir = QAD_Tools::addSlash(dir) ; dir = dir + "lib" ; @@ -197,48 +112,6 @@ QAD_RightFrame::QAD_RightFrame(QWidget *parent, const char *name, MESSAGE (" Not found "); } } else if (myViewType == VIEW_GRAPHSUPERV) { - if ( dir = getenv("SALOME_SITE_DIR")){ - dir = QAD_Tools::addSlash(dir) ; - dir = dir + "lib" ; - dir = QAD_Tools::addSlash(dir) ; - dir = dir + "salome" ; - dir = QAD_Tools::addSlash(dir) ; -#ifdef WNT - dir = dir + "libSUPERVGraph.dll" ; -#else - dir = dir + "libSUPERVGraph.so" ; -#endif - MESSAGE ( " GUI library = " << dir ) - fileInfo.setFile(dir) ; - if (fileInfo.exists()) { - ComponentLib = fileInfo.fileName() ; - found = true; - MESSAGE (" Found ") - } else - MESSAGE (" Not found ") - } - - if ( (dir = getenv("SALOME_ROOT_DIR")) && !found ) { - dir = QAD_Tools::addSlash(dir) ; - dir = dir + "lib" ; - dir = QAD_Tools::addSlash(dir) ; - dir = dir + "salome" ; - dir = QAD_Tools::addSlash(dir) ; -#ifdef WNT - dir = dir + "libSUPERVGraph.dll" ; -#else - dir = dir + "libSUPERVGraph.so" ; -#endif - MESSAGE ( " GUI library = " << dir ) - fileInfo.setFile(dir) ; - if (fileInfo.exists()) { - ComponentLib = fileInfo.fileName() ; - found = true; - MESSAGE (" Found ") - } else - MESSAGE (" Not found ") - } - if ( (dir = getenv("KERNEL_ROOT_DIR")) && !found ) { dir = QAD_Tools::addSlash(dir) ; dir = dir + "lib" ; @@ -260,48 +133,6 @@ QAD_RightFrame::QAD_RightFrame(QWidget *parent, const char *name, MESSAGE (" Not found ") } } else if (myViewType == VIEW_PLOT2D) { - if ( dir = getenv("SALOME_SITE_DIR")){ - dir = QAD_Tools::addSlash(dir) ; - dir = dir + "lib" ; - dir = QAD_Tools::addSlash(dir) ; - dir = dir + "salome" ; - dir = QAD_Tools::addSlash(dir) ; -#ifdef WNT - dir = dir + "libPlot2d.dll" ; -#else - dir = dir + "libPlot2d.so" ; -#endif - MESSAGE ( " GUI library = " << dir ) - fileInfo.setFile(dir) ; - if (fileInfo.exists()) { - ComponentLib = fileInfo.fileName() ; - found = true; - MESSAGE (" Found ") - } else - MESSAGE (" Not found ") - } - - if ( (dir = getenv("SALOME_ROOT_DIR")) && !found ) { - dir = QAD_Tools::addSlash(dir) ; - dir = dir + "lib" ; - dir = QAD_Tools::addSlash(dir) ; - dir = dir + "salome" ; - dir = QAD_Tools::addSlash(dir) ; -#ifdef WNT - dir = dir + "libPlot2d.dll" ; -#else - dir = dir + "libPlot2d.so" ; -#endif - MESSAGE ( " GUI library = " << dir ) - fileInfo.setFile(dir) ; - if (fileInfo.exists()) { - ComponentLib = fileInfo.fileName() ; - found = true; - MESSAGE (" Found ") - } else - MESSAGE (" Not found ") - } - if ( (dir = getenv("KERNEL_ROOT_DIR")) && !found ) { dir = QAD_Tools::addSlash(dir) ; dir = dir + "lib" ; diff --git a/src/SALOMEGUI/QAD_icons.po b/src/SALOMEGUI/QAD_icons.po index 5b1e636f7..f30ce6918 100644 --- a/src/SALOMEGUI/QAD_icons.po +++ b/src/SALOMEGUI/QAD_icons.po @@ -68,15 +68,6 @@ msgstr "close.png" msgid "ICON_HELP" msgstr "help.png" -msgid "QAD_HelpWindow::ICON_APP_HELP_BACK" -msgstr "back.xpm" - -msgid "QAD_HelpWindow::ICON_APP_HELP_FORWARD" -msgstr "forward.xpm" - -msgid "QAD_HelpWindow::ICON_APP_HELP_HOME" -msgstr "home.xpm" - #-------------- # VIEW #-------------- diff --git a/src/SALOMEGUI/QAD_msg_en.po b/src/SALOMEGUI/QAD_msg_en.po index f31e12f8d..39dededad 100644 --- a/src/SALOMEGUI/QAD_msg_en.po +++ b/src/SALOMEGUI/QAD_msg_en.po @@ -175,6 +175,14 @@ msgstr "&About ..." msgid "QAD_Desktop::MEN_DESK_HELP_CONTENTS" msgstr "&Contents" +#: QAD_Desktop.cxx:265 +msgid "QAD_Desktop::MEN_DESK_HELP_GUICONTENTS" +msgstr "&GUI Reference" + +#: QAD_Desktop.cxx:265 +msgid "QAD_Desktop::MEN_DESK_HELP_TUICONTENTS" +msgstr "&TUI Reference" + #: QAD_Desktop.cxx:273 msgid "QAD_Desktop::MEN_DESK_HELP_SEARCH" msgstr "&Search ..." @@ -203,6 +211,10 @@ msgstr "Viewer background" msgid "MEN_DESK_PREF_VIEWER_TRIHEDRON" msgstr "Trihedron size" +#: QAD_Desktop.cxx:747 +msgid "MEN_DESK_PREF_EXTERNAL_BROWSER" +msgstr "External browser" + msgid "MEN_DESK_PREF_DEFAULT_VIEWER" msgstr "Default viewer" @@ -364,6 +376,14 @@ msgstr "Shows \'About\' dialog" msgid "QAD_Desktop::PRP_DESK_HELP_CONTENTS" msgstr "Shows the whole help contents" +#: QAD_Desktop.cxx:266 +msgid "QAD_Desktop::PRP_DESK_HELP_GUICONTENTS" +msgstr "Shows the GUI help contents" + +#: QAD_Desktop.cxx:266 +msgid "QAD_Desktop::PRP_DESK_HELP_TUICONTENTS" +msgstr "Shows the TUI help contents" + #: QAD_Desktop.cxx:274 msgid "QAD_Desktop::PRP_DESK_HELP_SEARCH" msgstr "Searches help for a topic" @@ -415,21 +435,6 @@ msgstr "Sketch a rectangular area to fit the view" # TOOL TIP #--------------- -#: QAD_HelpWindow.cxx:57 -msgid "QAD_HelpWindow::TOT_HELPWINDOW_BACKWARD" -msgstr "Backward" - -#: QAD_HelpWindow.cxx:60 -msgid "QAD_HelpWindow::TOT_HELPWINDOW_FORWARD" -msgstr "Forward" - -#: QAD_HelpWindow.cxx:63 -msgid "QAD_HelpWindow::TOT_HELPWINDOW_HOME" -msgstr "Home" - -msgid "QAD_HelpWindow::QAD_HELP_CONTENTS" -msgstr "Contents" - #: QAD_Application.cxx:173 msgid "QAD_Application::TOT_APP_EDIT_REDO" msgstr "Redo last operation" @@ -544,10 +549,6 @@ msgstr "The study %1 is not saved.\nDo you want to save it ?" msgid "WRN_WARNING" msgstr "Warning" -#: QAD_Desktop.cxx:1072 -msgid "QAD_Desktop::WRN_LOAD_COMPONENT" -msgstr "Creates or opens before a study" - msgid "WRN_STUDY_LOCKED" msgstr "This study is locked and therefore cannot be modified" diff --git a/src/SALOMEGUI/QAD_msg_fr.po b/src/SALOMEGUI/QAD_msg_fr.po index 8027e10fc..dec15cf79 100644 --- a/src/SALOMEGUI/QAD_msg_fr.po +++ b/src/SALOMEGUI/QAD_msg_fr.po @@ -398,18 +398,6 @@ msgstr "S # TOOL TIP #--------------- -#: QAD_HelpWindow.cxx:57 -msgid "QAD_HelpWindow::TOT_HELPWINDOW_BACKWARD" -msgstr "Avant" - -#: QAD_HelpWindow.cxx:60 -msgid "QAD_HelpWindow::TOT_HELPWINDOW_FORWARD" -msgstr "Apres" - -#: QAD_HelpWindow.cxx:63 -msgid "QAD_HelpWindow::TOT_HELPWINDOW_HOME" -msgstr "Home" - #: QAD_Application.cxx:173 msgid "QAD_Application::TOT_APP_EDIT_REDO" msgstr "Répéter l'opération" diff --git a/src/SALOMEGUI/SALOMEGUI_Application.cxx b/src/SALOMEGUI/SALOMEGUI_Application.cxx index 61556f22f..d9b5ad9b1 100644 --- a/src/SALOMEGUI/SALOMEGUI_Application.cxx +++ b/src/SALOMEGUI/SALOMEGUI_Application.cxx @@ -458,49 +458,7 @@ void SALOMEGUI_Application::onDisplay(int id) QCString dir; QFileInfo fileInfo ; bool found = false; - if ( getenv("SALOME_SITE_DIR") ) { - dir.fill('\0'); - dir.sprintf("%s",getenv("SALOME_SITE_DIR")); - dir = QAD_Tools::addSlash(dir) ; - dir = dir + "lib" ; - dir = QAD_Tools::addSlash(dir) ; -#ifdef WNT - dir = dir + "lib" + parentComp.latin1() + "GUI.dll" ; -#else - dir = dir + "lib" + parentComp.latin1() + "GUI.so" ; -#endif - MESSAGE ( " GUI library = " << dir ) - fileInfo.setFile(dir) ; - if (fileInfo.exists()) { - ComponentLib = fileInfo.fileName(); - found = true; - MESSAGE ( " found " ) - } else { - MESSAGE ( " Not found " ) - } - } - if ( !found && getenv("SALOME_ROOT_DIR") ) { - dir.fill('\0'); - dir.sprintf("%s", getenv("SALOME_ROOT_DIR")); - dir = QAD_Tools::addSlash(dir) ; - dir = dir + "lib" ; - dir = QAD_Tools::addSlash(dir) ; -#ifdef WNT - dir = dir + "lib" + parentComp.latin1() + "GUI.dll" ; -#else - dir = dir + "lib" + parentComp.latin1() + "GUI.so" ; -#endif - MESSAGE ( " GUI library = " << dir ) - fileInfo.setFile(dir) ; - if (fileInfo.exists()) { - ComponentLib = fileInfo.fileName() ; - found = true; - MESSAGE ( " found " ) - } else { - MESSAGE ( " Not found " ) - } - } - if ( !found && getenv( QAD_Application::getDesktop()->getComponentName(parentComp) + "_ROOT_DIR") ) { + if ( getenv( QAD_Application::getDesktop()->getComponentName(parentComp) + "_ROOT_DIR") ) { dir.fill('\0'); dir.sprintf("%s", getenv( QAD_Application::getDesktop()->getComponentName(parentComp) + "_ROOT_DIR")); dir = QAD_Tools::addSlash(dir) ; diff --git a/src/SALOMEGUI/SALOMEGUI_msg_en.po b/src/SALOMEGUI/SALOMEGUI_msg_en.po index bcdf3d4c6..af0785398 100644 --- a/src/SALOMEGUI/SALOMEGUI_msg_en.po +++ b/src/SALOMEGUI/SALOMEGUI_msg_en.po @@ -73,6 +73,32 @@ msgstr "Size :" msgid "SALOMEGUI_TrihedronSizeDlg::MEN_TRIHEDRON" msgstr "Trihedron" +#: SALOMEGUI_ExternalBrowserDlg.cxx:26 +msgid "SALOMEGUI_ExternalBrowserDlg::MEN_EXTERNAL_BROWSER" +msgstr "Choose external browser" + +#: SALOMEGUI_ExternalBrowserDlg.cxx:42 +msgid "SALOMEGUI_ExternalBrowserDlg::MEN_EXTERNAL_BROWSER_APP" +msgstr "Application:" + +#: SALOMEGUI_ExternalBrowserDlg.cxx:50 +msgid "SALOMEGUI_ExternalBrowserDlg::MEN_EXTERNAL_BROWSER_PARAMS" +msgstr "Parameters:" + +#: SALOMEGUI_ExternalBrowserDlg.cxx:58 +msgid "SALOMEGUI_ExternalBrowserDlg::MEN_EXTERNAL_BROWSER_BROWSE" +msgstr "&Browse" + +#: SALOMEGUI_ExternalBrowserDlg.cxx:95 +msgid "SALOMEGUI_ExternalBrowserDlg::MEN_EXTERNAL_BROWSER_CHOOSEAPP" +msgstr "Choose application" + +#: SALOMEGUI_ExternalBrowserDlg.cxx:126 +msgid "SALOMEGUI_ExternalBrowserDlg::MEN_EXTERNAL_BROWSER_NOTEXECUTABLE" +msgstr "The file is not executable!" + + + #: SALOMEGUI_OpenWith.cxx:37 msgid "SALOMEGUI_OpenWith::MEN_COMPONENT_CHOICE1" msgstr "Always use this component to open this type of object" @@ -652,6 +678,24 @@ msgstr "&Cancel" msgid "SALOMEGUI_CloseDlg::CLOSE_DESCRIPTION" msgstr "Do you want to close or only unload the study ?" +msgid "SALOMEGUI_ActivateComponentDlg::CAPTION" +msgstr "Activate module" + +msgid "SALOMEGUI_ActivateComponentDlg::NEW" +msgstr "&New" + +msgid "SALOMEGUI_ActivateComponentDlg::OPEN" +msgstr "&Open" + +msgid "SALOMEGUI_ActivateComponentDlg::LOAD" +msgstr "&Load" + +msgid "SALOMEGUI_ActivateComponentDlg::CANCEL" +msgstr "&Cancel" + +msgid "SALOMEGUI_ActivateComponentDlg::ActivateComponent_DESCRIPTION" +msgstr "You need to create, open or load study before." + msgid "SALOMEGUI_HELP_TITLE" msgstr "SALOME Help" diff --git a/src/SALOME_PY/Makefile.in b/src/SALOME_PY/Makefile.in index 08fac84a5..f99d2e4ed 100644 --- a/src/SALOME_PY/Makefile.in +++ b/src/SALOME_PY/Makefile.in @@ -44,7 +44,7 @@ LIB_CLIENT_IDL = SALOMEDS.idl \ SALOME_Exception.idl CPPFLAGS+=$(QT_INCLUDES) $(PYTHON_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) -DHAVE_CONFIG_H -LDFLAGS+= $(PYTHON_LIBS) $(QT_MT_LIBS) $(OCC_LIBS) $(VTK_LIBS) $(OGL_LIBS) -lSalomeGUI -lvtkCommonPython -lvtkGraphicsPython -lvtkImagingPython -lVTKViewer +LDFLAGS+= $(PYTHON_LIBS) $(QT_MT_LIBS) $(VTK_LIBS) $(OGL_LIBS) -lSalomeGUI -lvtkCommonPython -lvtkGraphicsPython -lvtkImagingPython -lVTKViewer @CONCLUDE@ diff --git a/src/SALOME_PYQT/Makefile.in b/src/SALOME_PYQT/Makefile.in index 525764d5d..146f123c1 100644 --- a/src/SALOME_PYQT/Makefile.in +++ b/src/SALOME_PYQT/Makefile.in @@ -49,7 +49,7 @@ EXPORT_SHAREDPYSCRIPTS = SalomePyQt.py LIB_CLIENT_IDL = SALOME_Exception.idl CPPFLAGS+=$(QT_INCLUDES) $(PYTHON_INCLUDES) $(SIP_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) -LIBS+= $(PYTHON_LIBS) $(SIP_LIBS) $(PYQT_LIBS) $(OCC_LIBS) $(VTK_LIBS) $(OGL_LIBS) +LIBS+= $(PYTHON_LIBS) $(SIP_LIBS) $(PYQT_LIBS) $(VTK_LIBS) $(OGL_LIBS) LDFLAGS+= -lSalomeGUI -lqtcmodule diff --git a/src/SALOME_SWIG/batchmode_salome.py b/src/SALOME_SWIG/batchmode_salome.py index f3a61bc76..463aff9be 100644 --- a/src/SALOME_SWIG/batchmode_salome.py +++ b/src/SALOME_SWIG/batchmode_salome.py @@ -68,8 +68,133 @@ def IDToObject(id): def IDToSObject(id): mySO = myStudy.FindObjectID(id); return mySO + + #-------------------------------------------------------------------------- + +def PersistentPresentation(theStudy, theSO, theWithID): + # put the sobject's content (with subchildren) to the string + aResult = "" + attrs = theSO.GetAllAttributes() + aLen = len(attrs) + anUncopied = 0 + for a in range(0,aLen): + attr = attrs[a] + if isinstance(attr,SALOMEDS._objref_AttributeTreeNode): + anUncopied += 1 + elif isinstance(attr,SALOMEDS._objref_AttributeTarget): + anUncopied += 1 + elif isinstance(attr,SALOMEDS._objref_AttributeReal) or \ + isinstance(attr,SALOMEDS._objref_AttributeInteger) or \ + isinstance(attr,SALOMEDS._objref_AttributeName) or \ + isinstance(attr,SALOMEDS._objref_AttributeComment) or \ + isinstance(attr,SALOMEDS._objref_AttributePersistentRef) or \ + isinstance(attr,SALOMEDS._objref_AttributeLocalID) or \ + isinstance(attr,SALOMEDS._objref_AttributeUserID): + aResult += " attribute value: " + str(attr.Value()) + elif isinstance(attr,SALOMEDS._objref_AttributeIOR): + aResult += " attribute: IOR" + elif isinstance(attr,SALOMEDS._objref_AttributeSequenceOfReal) or \ + isinstance(attr,SALOMEDS._objref_AttributeSequenceOfInteger): + aResult += " Sequence: " + str(attr.CorbaSequence()) + elif isinstance(attr,SALOMEDS._objref_AttributeDrawable): + aResult += " Drawable: " + str(attr.IsDrawable()) + elif isinstance(attr,SALOMEDS._objref_AttributeSelectable): + aResult += " Selectable: " + str(attr.IsSelectable()) + elif isinstance(attr,SALOMEDS._objref_AttributeExpandable): + aResult += " Expandable: " + str(attr.IsExpandable()) + elif isinstance(attr,SALOMEDS._objref_AttributeOpened): + aResult += " Opened: " + str(attr.IsOpened()) + elif isinstance(attr,SALOMEDS._objref_AttributeTextColor): + aResult += " TextColor: " + str(attr.TextColor()) + elif isinstance(attr,SALOMEDS._objref_AttributeTextHighlightColor): + aResult += " TextHighlightColor: " + str(attr.TextHighlightColor()) + elif isinstance(attr,SALOMEDS._objref_AttributePixMap): + aResult += " PixMap: " + str(attr.GetPixMap()) + elif isinstance(attr,SALOMEDS._objref_AttributeTableOfInteger) or \ + isinstance(attr,SALOMEDS._objref_AttributeTableOfReal): + aResult += " Table with title: " + attr.GetTitle() + elif isinstance(attr,SALOMEDS._objref_AttributePythonObject): + aResult += " PythonObject: " + attr.GetObject() + + if theWithID: + aResult = "sobject: " + theSO.GetID() + " nbattrs: " + str(aLen - anUncopied) + aResult + '\n' + else: + aResult = " nbattrs: " + str(aLen - anUncopied) + aResult + '\n' + anIter = theStudy.NewChildIterator(theSO) + while anIter.More(): + aResult += PersistentPresentation(theStudy, anIter.Value(), theWithID) + anIter.Next() + return aResult + #-------------------------------------------------------------------------- +def GetTree(theSO): + # returns the document list tree (as list) + aResult = [theSO.GetID()] + anIter = myStudy.NewChildIterator(theSO) + while anIter.More(): + aResult += GetTree(anIter.Value()) + anIter.Next() + return aResult + + #-------------------------------------------------------------------------- + +def CheckCopyPaste(theSO, theInfo ,theComponentPaste): + aRoot = theSO + while aRoot.GetID() != "0:": + aRoot = aRoot.GetFather() + aTree = GetTree(aRoot) + aStudyPersist = PersistentPresentation(myStudy, aRoot, 1) + + if not myStudyManager.CanCopy(theSO): + raise RuntimeError, " for "+theInfo+" returns false" + + if not myStudyManager.Copy(theSO): + raise RuntimeError, " for "+theInfo+" returns false" + + + if not myStudyManager.CanPaste(theSO): + raise RuntimeError, " for "+theInfo+" returns false" + + # check: before paste study is not changed check + if aStudyPersist != PersistentPresentation(myStudy, aRoot, 1): + raise RuntimeError, "Study is changed before Paste calling for "+theInfo + + aSObj = theSO + if theComponentPaste: + aSObj = theSO.GetFatherComponent() + theInfo = theInfo + "(paste for component)" + if not myStudyManager.Paste(aSObj): + raise RuntimeError, " for "+theInfo+" returns false" + aNewTree = GetTree(aRoot) + aLen = len(aTree) + for a in range(0,aLen): + if aTree[a] != aNewTree[a]: + return myStudy.FindObjectID(aNewTree[a]) + + if aLen < len(aNewTree): + return myStudy.FindObjectID(aNewTree[aLen]) + + raise RuntimeError, "After Copy calling the tree is not changed" + + #-------------------------------------------------------------------------- +def FindFileInDataDir(filename): + import os + datadir = os.getenv("DATA_DIR") + if datadir is not None: + import string + dirs = string.split(datadir, ":") + for dir in dirs: + file = dir + "/" + filename + if os.path.exists(file): + return file; + datadir = os.getenv("KERNEL_ROOT_DIR") + "/examples/" + file = datadir + filename + if os.path.exists(file): + return file; + + return None + #-------------------------------------------------------------------------- # initialise the ORB orb = CORBA.ORB_init([''], CORBA.ORB_ID) diff --git a/src/SALOME_SWIG/salome_test.py b/src/SALOME_SWIG/salome_test.py index 8550a196a..0ebc15156 100644 --- a/src/SALOME_SWIG/salome_test.py +++ b/src/SALOME_SWIG/salome_test.py @@ -15,10 +15,22 @@ from salome import sg import SALOMEDS import os +import SALOME_ModuleCatalog + +print "======================================================================" +print " Get Catalog " +print "======================================================================" +obj = salome.naming_service.Resolve('Kernel/ModulCatalog') +catalog = obj._narrow(SALOME_ModuleCatalog.ModuleCatalog) + print "======================================================================" print " Create Study " print "======================================================================" +comp = catalog.GetComponent("GEOM") +if comp is None: + raise RuntimeError,"Component GEOM not found in Module Catalog." + import geompy print "=================================" @@ -47,10 +59,18 @@ print print "============= Test SMESH =============================" print +comp = catalog.GetComponent("SMESH") +if comp is None: + raise RuntimeError,"Component SMESH not found in Module Catalog." + +comp = catalog.GetComponent("MED") +if comp is None: + raise RuntimeError,"Component MED not found in Module Catalog." + import SMESH import smeshpy -geom = salome.lcc.FindOrLoadComponent("FactoryServer", "Geometry") +geom = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM") myBuilder = salome.myStudy.NewBuilder() smeshgui = salome.ImportComponentGUI("SMESH") @@ -231,18 +251,22 @@ print print "============= Test Supervisor =============================" print +comp = catalog.GetComponent("SUPERV") +if comp is None: + raise RuntimeError,"Component SUPERV not found in Module Catalog." + from SuperV import * import SALOMEDS myStudy = salome.myStudy myBuilder = myStudy.NewBuilder() -SuperVision = lcc.FindOrLoadComponent("SuperVisionContainer","Supervision") +SuperVision = lcc.FindOrLoadComponent("SuperVisionContainer","SUPERV") father = myStudy.FindComponent("SUPERV") if father is None: father = myBuilder.NewComponent("SUPERV") A1 = myBuilder.FindOrCreateAttribute(father, "AttributeName"); FName = A1._narrow(SALOMEDS.AttributeName) - FName.SetValue("Supervision") + FName.SetValue( salome.sg.getComponentUserName("SUPERV") ) A2 = myBuilder.FindOrCreateAttribute(father, "AttributePixMap"); aPixmap = A2._narrow(SALOMEDS.AttributePixMap); aPixmap.SetPixMap( "ICON_OBJBROWSER_Supervision" ); @@ -277,10 +301,10 @@ def addStudy(ior): anIOR.SetValue(dataflow.getIOR()) import os -dir= os.getenv("SALOME_ROOT_DIR") +dir= os.getenv("SUPERV_ROOT_DIR") if dir == None: - raise RuntimeError, "SALOME_ROOT_DIR is not defined" -xmlfile = dir +"/../SALOME_ROOT/SuperVisionTest/resources/GraphEssai.xml" + raise RuntimeError, "SUPERV_ROOT_DIR is not defined" +xmlfile = dir +"/examples/GraphGeomEssai.xml" print "Load dataflow from the file : " print xmlfile print @@ -292,18 +316,6 @@ print "myGraph.IsValid() = ", myGraph.IsValid() # Get Nodes myGraph.PrintNodes() -Add,Sub,Mul,Div = myGraph.Nodes() - -# Load Datas -Addx = Add.Input("x",3.) -Addy = Add.Input("y",4.5) -Subx = Sub.Input("x",1.5) - -# Get Output Port -Addz = Add.Port('z') -Subz = Sub.Port('z') -Mulz = Mul.Port('z') -Divz = Div.Port('z') # This DataFlow is "executable" : all pending Ports are defined with Datas print myGraph.IsExecutable() @@ -324,14 +336,6 @@ print "myGraph.IsDone() = ",myGraph.IsDone() # Wait for Completion (but it is already done after event loop ...) print "Done : ",myGraph.DoneW() -# Get result -print "Result : ",Divz.ToString() - -# Intermediate results : -print "Intermediate Result Add\z : ",Addz.ToString() -print "Intermediate Result Sub\z : ",Subz.ToString() -print "Intermediate Result Mul\z : ",Mulz.ToString() - print " " #print "Type : print myGraph.IsDone()" #print " If execution is finished ==> 1 (true)" @@ -339,30 +343,11 @@ res=myGraph.IsDone() if res != 1: raise RuntimeError, "myGraph.Run() is not done" -print " " -print "Type : print Divz.ToString()" -print " You will get the result" -Divz.ToString() - print " " print "Type : myGraph.PrintPorts()" print " to see input and output values of the graph" myGraph.PrintPorts() -print " " -print "Type : Add.PrintPorts()" -Add.PrintPorts() - -print "Type : Sub.PrintPorts()" -Sub.PrintPorts() - -print "Type : Mul.PrintPorts()" -Mul.PrintPorts() - -print "Type : Div.PrintPorts()" -print " to see input and output values of nodes" -Div.PrintPorts() - # Export will create newsupervisionexample.xml and the corresponding .py file tmpdir=os.getenv("TmpDir") if tmpdir is None: @@ -385,30 +370,88 @@ for node in nodes: names.append(node.Name()) print names -print "Load FactorialComponent component, create dataflow using its services and run execution" -myPy = Graph('myPy') - -eval = myPy.Node('FactorialComponent','FactorialComponent','eval') -eval.SetContainer('FactoryServerPy') - -myPy.IsValid() - -myPy.PrintPorts() - -myPy.Run( 3 ) - -myPy.DoneW() - -myPy.State() - -myPy.PrintPorts() - +# Graph creation +GraphInLines = Graph( 'GraphInLines' ) +GraphInLines.SetName( 'GraphInLines' ) +GraphInLines.SetAuthor( '' ) +GraphInLines.SetComment( '' ) +GraphInLines.Coords( 0 , 0 ) + +# Creation of InLine Nodes +PyAdd = [] +PyAdd.append( 'def Add(a,b) : ' ) +PyAdd.append( ' return a+b ' ) +PyAdd.append( '' ) +Add = GraphInLines.INode( 'Add' , PyAdd ) +Add.InPort( 'a' , 'long' ) +Add.InPort( 'b' , 'long' ) +Add.OutPort( 'f' , 'long' ) +Add.SetName( 'Add' ) +Add.SetAuthor( '' ) +Add.SetComment( 'Python function' ) +Add.Coords( 351 , 77 ) +PySub = [] +PySub.append( 'def Sub(a,b) : ' ) +PySub.append( ' return a-b ' ) +PySub.append( '' ) +Sub = GraphInLines.INode( 'Sub' , PySub ) +Sub.InPort( 'a' , 'long' ) +Sub.InPort( 'b' , 'long' ) +Sub.OutPort( 'f' , 'long' ) +Sub.SetName( 'Sub' ) +Sub.SetAuthor( '' ) +Sub.SetComment( 'Python function' ) +Sub.Coords( 86 , 333 ) +PyMul = [] +PyMul.append( 'def Mul(a,b) : ' ) +PyMul.append( ' return a*b ' ) +Mul = GraphInLines.INode( 'Mul' , PyMul ) +Mul.InPort( 'a' , 'long' ) +Mul.InPort( 'b' , 'long' ) +Mul.OutPort( 'Result' , 'long' ) +Mul.SetName( 'Mul' ) +Mul.SetAuthor( '' ) +Mul.SetComment( 'Python function' ) +Mul.Coords( 616 , 247 ) + +# Creation of intermediate Output variables and of Control Links +Addf = Add.Port( 'f' ) +Mula = GraphInLines.Link( Addf , Mul.Port( 'a' ) ) +Mula.AddCoord( 1 , 570 , 356 ) +Mula.AddCoord( 2 , 570 , 186 ) +Subf = Sub.Port( 'f' ) +Mulb = GraphInLines.Link( Subf , Mul.Port( 'b' ) ) +Mulb.AddCoord( 1 , 282 , 376 ) +Mulb.AddCoord( 2 , 282 , 442 ) +Addb = GraphInLines.Link( Subf , Add.Port( 'b' ) ) +Addb.AddCoord( 1 , 283 , 209 ) +Addb.AddCoord( 2 , 283 , 374 ) +Addb.AddCoord( 3 , 283 , 442 ) + +# Creation of Input datas +Adda = Add.Input( 'a' , 1) +Suba = Sub.Input( 'a' , 3) +Subb = Sub.Input( 'b' , 4) + +# Creation of Output variables +MulResult = Mul.Port( 'Result' ) + +GraphInLines.Run() + +GraphInLines.DoneW() + +GraphInLines.PrintPorts() sg.updateObjBrowser(1); print print "============= Test VISU and MED =============================" print + +comp = catalog.GetComponent("VISU") +if comp is None: + raise RuntimeError,"Component VISU not found in Module Catalog." + import sys import SALOMEDS import SALOME @@ -418,13 +461,13 @@ import VISU import visu_gui medFile = "pointe.med" -medFile = os.getenv('SALOME_ROOT_DIR') + '/../SALOME_ROOT/data/' + medFile +medFile = os.getenv('KERNEL_ROOT_DIR') + '/examples/' + medFile print "Load ", medFile studyCurrent = salome.myStudyName -med_comp = salome.lcc.FindOrLoadComponent("FactoryServer", "Med") -myVisu = salome.lcc.FindOrLoadComponent("FactoryServer", "Visu") +med_comp = salome.lcc.FindOrLoadComponent("FactoryServer", "MED") +myVisu = salome.lcc.FindOrLoadComponent("FactoryServer", "VISU") try: if os.access(medFile, os.R_OK) : @@ -433,28 +476,23 @@ try: med_obj = visu_gui.visu.getMedObjectFromStudy() print "med_obj - ", med_obj - myField = visu_gui.visu.getFieldObjectFromStudy(2,1) - aMeshName = "FILED_DOUBLE_MESH" + myField1 = visu_gui.visu.getFieldObjectFromStudy(2,1) + aMeshName = "maa1" anEntity = VISU.NODE - aTimeStampId = 0 - - myResult1 = myVisu.ImportMedField(myField) + aTimeStampId = -1 + + myResult1 = myVisu.ImportMedField(myField1) aMesh1 = myVisu.MeshOnEntity(myResult1, aMeshName, anEntity); - aScalarMap1= myVisu.ScalarMapOnField(myResult1, aMeshName, anEntity, myField.getName(), aTimeStampId) - if(myField.getNumberOfComponents() > 1) : - aVectors = myVisu.VectorsOnField(myResult1, aMeshName, anEntity, myField.getName(), aTimeStampId) - - myResult2 = myVisu.ImportFile(medFile) - aMeshName = "maa1" - anEntity = VISU.NODE - aMesh2 = myVisu.MeshOnEntity(myResult2, aMeshName, anEntity) - - aScalarMap2 = myVisu.ScalarMapOnField(myResult2, aMeshName, anEntity, myField.getName(), aTimeStampId) - if(myField.getNumberOfComponents() > 1) : - aCutPlanes = myVisu.CutPlanesOnField(myResult2, aMeshName, anEntity, myField.getName(), aTimeStampId) - - sg.updateObjBrowser(0) + aScalarMap1= myVisu.ScalarMapOnField(myResult1, aMeshName, anEntity, myField1.getName(), aTimeStampId) + + myResult2 = myVisu.ImportFile(medFile); + aMesh2 = myVisu.MeshOnEntity(myResult2, aMeshName, anEntity); + + aTimeStampId = 3 + aScalarMap2= myVisu.ScalarMapOnField(myResult2, aMeshName, anEntity, myField1.getName(), aTimeStampId) + + sg.updateObjBrowser(0) else : print "We have no permission to rewrite medFile, so readStructFileWithFieldType can't open this file"; else : print "We have no permission to read medFile, it will not be opened"; diff --git a/src/Session/Makefile.in b/src/Session/Makefile.in index a9f96cf63..cea6d3477 100644 --- a/src/Session/Makefile.in +++ b/src/Session/Makefile.in @@ -51,7 +51,8 @@ BIN_CLIENT_IDL = SALOMEDS.idl SALOMEDS_Attributes.idl SALOME_Registry.idl SALOME CPPFLAGS+=$(QT_MT_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) CXXFLAGS+=$(OCC_CXXFLAGS) -LDFLAGS+=$(QT_MT_LIBS) $(OCC_KERNEL_LIBS) $(OCC_OCAF_LIBS) $(OCC_VIEWER_LIBS) $(OCC_MODELER_LIBS) -lSalomeContainer -lSalomeNS -lSalomeGUI -lSalomeObject -lSalomeLifeCycleCORBA -lqsplitterP -lRegistry -lSalomeNotification -lOpUtil -lSalomeLoggerServer -lPlot2d +#LDFLAGS+=$(QT_MT_LIBS) $(OCC_KERNEL_LIBS) $(OCC_OCAF_LIBS) $(OCC_VIEWER_LIBS) $(OCC_MODELER_LIBS) -lSalomeContainer -lSalomeNS -lSalomeGUI -lSalomeObject -lSalomeLifeCycleCORBA -lqsplitterP -lRegistry -lSalomeNotification -lOpUtil -lSalomeLoggerServer -lPlot2d +LDFLAGS+=$(QT_MT_LIBS) -lSalomeContainer -lSalomeNS -lSalomeGUI -lSalomeObject -lSalomeLifeCycleCORBA -lqsplitterP -lRegistry -lSalomeNotification -lOpUtil -lSalomeLoggerServer -lPlot2d -lSalomeVTKFilter @CONCLUDE@ diff --git a/src/Session/SALOME_Session_Server.cxx b/src/Session/SALOME_Session_Server.cxx index 36af98b64..639db43b0 100644 --- a/src/Session/SALOME_Session_Server.cxx +++ b/src/Session/SALOME_Session_Server.cxx @@ -28,8 +28,8 @@ # include "Utils_ORB_INIT.hxx" # include "Utils_SINGLETON.hxx" - #include "SALOME_Container_i.hxx" +# include "SALOME_NamingService.hxx" #include #include using namespace std; @@ -66,18 +66,94 @@ int main(int argc, char **argv) PySys_SetArgv( argc , argv ) ; Py_InitModule( "InitPyRunMethod" , MethodPyVoidMethod ) ; - try { // Initialise the ORB. ORB_INIT &init = *SINGLETON_::Instance() ; ASSERT(SINGLETON_::IsAlreadyExisting()) ; CORBA::ORB_var &orb = init( argc , argv ) ; + ASSERT(!CORBA::is_nil(orb)); // Obtain a reference to the root POA. CORBA::Object_var obj =orb->resolve_initial_references("RootPOA") ; PortableServer::POA_var root_poa = PortableServer::POA::_narrow(obj) ; + ASSERT(!CORBA::is_nil(root_poa)); + // ------------------------------------------------------------------------------- + // ---- naming service & Logger + + CosNaming::NamingContext_var myNS; + SALOME_Logger::Logger_var log; + SALOME_NamingService &naming = *SINGLETON_::Instance() ; + + { + int SESSION=0; + const char * Env = getenv("USE_LOGGER"); + int EnvL =0; + if ((Env!=NULL) && (strlen(Env))) + EnvL=1; + + CosNaming::Name name; + name.length(1); + name[0].id=CORBA::string_dup("Logger"); + + long TIMESleep = 250000000; + int NumberOfTries = 40; + timespec ts_req; + ts_req.tv_nsec=TIMESleep; + ts_req.tv_sec=0; + timespec ts_rem; + ts_rem.tv_nsec=0; + ts_rem.tv_sec=0; + + for (int i = 1; i<=NumberOfTries; i++) + { + if (i!=1) + int a=nanosleep(&ts_req,&ts_rem); + try + { + CORBA::Object_var theObj = orb->resolve_initial_references("NameService"); + if (!CORBA::is_nil(theObj)) + myNS = CosNaming::NamingContext::_narrow(theObj); + } + catch( CORBA::COMM_FAILURE& ) + { + MESSAGE( "Session Server: CORBA::COMM_FAILURE: Unable to contact the Naming Service" ); + } + if(!CORBA::is_nil(myNS)) + { + MESSAGE( "Session Server: Naming Service was found" ); + if(EnvL==1) // use Logger + { + for(int j=1; j<=NumberOfTries; j++) + { + if (j!=1) + int a=nanosleep(&ts_req, &ts_rem); + try + { + CORBA::Object_var object = myNS->resolve(name); // find Logger + if (!CORBA::is_nil(object)) + log = SALOME_Logger::Logger::_narrow(object); + if (!CORBA::is_nil(log)) + { + MESSAGE( "Session Server: Logger Server was found" ); + log->ping(); + SESSION=1; + break; + } + } + catch(CosNaming::NamingContext::NotFound) + { MESSAGE( "Session Server: Logger Server wasn't found" ); } + catch(...) + { MESSAGE( "Session Server: Unknown exception" ); } + } + } + } + if ((SESSION==1)||((EnvL==0)&&(!CORBA::is_nil(myNS)))) // Naming service found, & Logger if needed + break; + } + } + // ------------------------------------------------------------------------------- // ---- container @@ -127,13 +203,9 @@ int main(int argc, char **argv) pmanfac->activate() ; MESSAGE("pmanfac->activate()") - // ------------------------------------------------------------------------------- // servant : session - //SALOME_Session_i * mySALOME_Session = new SALOME_Session_i(argc, argv, orb, factory_poa) ; - //PortableServer::ObjectId_var mySALOME_Sessionid = factory_poa->activate_object(mySALOME_Session) ; - SALOME_Session_i * mySALOME_Session = new SALOME_Session_i(argc, argv, orb, root_poa) ; PortableServer::ObjectId_var mySALOME_Sessionid = root_poa->activate_object(mySALOME_Session) ; MESSAGE("poa->activate_object(mySALOME_Session)"); diff --git a/src/TOOLSDS/Makefile.in b/src/TOOLSDS/Makefile.in index 666688ba9..41f346ded 100644 --- a/src/TOOLSDS/Makefile.in +++ b/src/TOOLSDS/Makefile.in @@ -29,7 +29,7 @@ BIN_CLIENT_IDL = CPPFLAGS+=$(OCC_INCLUDES) $(HDF5_INCLUDES) CXXFLAGS+=$(OCC_CXXFLAGS) -LDFLAGS+=$(OCC_KERNEL_LIBS) -lOpUtil -lSalomeLoggerServer +LDFLAGS+= -lOpUtil -lSalomeLoggerServer $(CAS_LDPATH) -lTKernel @CONCLUDE@ diff --git a/src/TOOLSGUI/Makefile.in b/src/TOOLSGUI/Makefile.in index a51debd21..03a986861 100644 --- a/src/TOOLSGUI/Makefile.in +++ b/src/TOOLSGUI/Makefile.in @@ -58,7 +58,7 @@ LIB_CLIENT_IDL = SALOME_Exception.idl CPPFLAGS += $(QT_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) CXXFLAGS += $(OCC_CXXFLAGS) -LDFLAGS += -lSalomeGUI +LDFLAGS += -lSalomeGUI @CONCLUDE@ diff --git a/src/TOOLSGUI/ToolsGUI_CatalogGeneratorDlg.cxx b/src/TOOLSGUI/ToolsGUI_CatalogGeneratorDlg.cxx index 1147a6e37..f117c1b60 100644 --- a/src/TOOLSGUI/ToolsGUI_CatalogGeneratorDlg.cxx +++ b/src/TOOLSGUI/ToolsGUI_CatalogGeneratorDlg.cxx @@ -344,14 +344,12 @@ void ToolsGUI_CatalogGeneratorDlg::onApply() } else { QString command = ""; - if ( getenv("SALOME_ROOT_DIR") ) - command = QString( getenv( "SALOME_ROOT_DIR" ) ) + "/bin/runIDLparser -Wbcatalog=" + XmlFile; - else if ( getenv("KERNEL_ROOT_DIR") ) + if ( getenv("KERNEL_ROOT_DIR") ) command = QString( getenv( "KERNEL_ROOT_DIR" ) ) + "/bin/runIDLparser -Wbcatalog=" + XmlFile; else { QAD_MessageBox::error1( this, tr("TOOLS_ERR_ERROR"), - tr("SALOME_ROOT_DIR or KERNEL_ROOT_DIR variables are not defined"), + tr("KERNEL_ROOT_DIR variable is not defined"), tr("TOOLS_BUT_OK") ); } if (!Author.isEmpty()) command += ",author=" + Author; diff --git a/src/TestContainer/TestContainer.cxx b/src/TestContainer/TestContainer.cxx index 14de77051..9849ce584 100644 --- a/src/TestContainer/TestContainer.cxx +++ b/src/TestContainer/TestContainer.cxx @@ -36,7 +36,10 @@ using namespace std; #include "SALOME_NamingService.hxx" #include "OpUtil.hxx" - +# include "Utils_ORB_INIT.hxx" +# include "Utils_SINGLETON.hxx" +# include "Utils_SALOME_Exception.hxx" +# include "Utils_CommException.hxx" int main (int argc, char * argv[]) { @@ -51,9 +54,75 @@ int main (int argc, char * argv[]) //Engines::Container_var iGenFact = Engines::Container::_narrow(obj); // Obtain a reference to the root POA - CORBA::Object_var obj = orb->resolve_initial_references("RootPOA") ; - PortableServer::POA_var poa = PortableServer::POA::_narrow(obj) ; - + // + long TIMESleep = 250000000; + int NumberOfTries = 40; + int a; + timespec ts_req; + ts_req.tv_nsec=TIMESleep; + ts_req.tv_sec=0; + timespec ts_rem; + ts_rem.tv_nsec=0; + ts_rem.tv_sec=0; + CosNaming::NamingContext_var inc; + PortableServer::POA_var poa; + CORBA::Object_var theObj; + CORBA::Object_var obj; + CORBA::Object_var object; + SALOME_Logger::Logger_var log; + SALOME_NamingService &naming = *SINGLETON_::Instance() ; + int TEST_CONTAINER=0; + const char * Env = getenv("USE_LOGGER"); + int EnvL =0; + if ((Env!=NULL) && (strlen(Env))) + EnvL=1; + CosNaming::Name name; + name.length(1); + name[0].id=CORBA::string_dup("Logger"); + PortableServer::POAManager_var manager; + for (int i = 1; i<=NumberOfTries; i++){ + if (i!=1) + a=nanosleep(&ts_req,&ts_rem); + try{ + obj = orb->resolve_initial_references("RootPOA"); + if(!CORBA::is_nil(obj)) + poa = PortableServer::POA::_narrow(obj); + if(!CORBA::is_nil(poa)) + manager = poa->the_POAManager(); + if(!CORBA::is_nil(orb)) + theObj = orb->resolve_initial_references("NameService"); + if (!CORBA::is_nil(theObj)) + inc = CosNaming::NamingContext::_narrow(theObj); + } + catch( CORBA::COMM_FAILURE& ) + { + MESSAGE( "Test Container: CORBA::COMM_FAILURE: Unable to contact the Naming Service" ) + } + if(!CORBA::is_nil(inc)) { + MESSAGE( "Test Container: Naming Service was found" ) + if(EnvL==1){ + for(int j=1; j<=NumberOfTries; j++){ + if (j!=1) + a=nanosleep(&ts_req, &ts_rem); + try{ + object = inc->resolve(name); + } + catch(CosNaming::NamingContext::NotFound){ MESSAGE( "Test Container: Logger Server wasn't found" ) } + catch(...){ MESSAGE( "Test Container: Unknown exception" ) } + if (!CORBA::is_nil(object)) + log = SALOME_Logger::Logger::_narrow(object); + if (!CORBA::is_nil(log)){ + MESSAGE( "Test Container: Loger Server was found" ) + log->ping(); + TEST_CONTAINER=1; + break; + } + }} + } + if ((TEST_CONTAINER==1)||((EnvL==0)&&(!CORBA::is_nil(inc)))) + break; + } + // // Use Name Service to find container SALOME_NamingService _NS(orb) ; string containerName = "/Containers/" ; diff --git a/src/VTKViewer/Makefile.in b/src/VTKViewer/Makefile.in index 15e620896..3d562442d 100644 --- a/src/VTKViewer/Makefile.in +++ b/src/VTKViewer/Makefile.in @@ -38,23 +38,23 @@ 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 + # Libraries targets LIB = libVTKViewer.la LIB_SRC= VTKViewer.cxx \ VTKViewer_ViewFrame.cxx \ VTKViewer_RenderWindow.cxx \ VTKViewer_RenderWindowInteractor.cxx \ - VTKViewer_InteractorStyleSALOME.cxx + VTKViewer_InteractorStyleSALOME.cxx \ + VTKViewer_VectorText.cxx LIB_MOC = \ VTKViewer.h \ VTKViewer_ViewFrame.h \ VTKViewer_RenderWindowInteractor.h \ VTKViewer_RenderWindow.h - - + LIB_CLIENT_IDL = SALOMEDS.idl \ SALOME_ModuleCatalog.idl \ SALOME_Component.idl \ @@ -62,7 +62,7 @@ LIB_CLIENT_IDL = SALOMEDS.idl \ CPPFLAGS+=$(QT_INCLUDES) $(OGL_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) CXXFLAGS+= -LDFLAGS+=$(VTK_LIBS) $(OGL_LIBS) $(QT_MT_LIBS) +LDFLAGS+=$(VTK_LIBS) $(OGL_LIBS) $(QT_MT_LIBS) -lSalomeGUI @CONCLUDE@ diff --git a/src/VTKViewer/VTKViewer_InteractorStyleSALOME.cxx b/src/VTKViewer/VTKViewer_InteractorStyleSALOME.cxx index d9eb3a75c..b0cfe0abb 100644 --- a/src/VTKViewer/VTKViewer_InteractorStyleSALOME.cxx +++ b/src/VTKViewer/VTKViewer_InteractorStyleSALOME.cxx @@ -31,6 +31,7 @@ using namespace std; #include "VTKViewer_RenderWindow.h" #include +#include "QAD_Config.h" #include "QAD_Application.h" #include "QAD_Desktop.h" @@ -51,6 +52,7 @@ using namespace std; #include #include #include +#include //VRV: porting on Qt 3.0.5 @@ -144,6 +146,71 @@ void VTKViewer_InteractorStyleSALOME::PanXY(int x, int y, int oldX, int oldY) this->Interactor->Render(); } +//---------------------------------------------------------------------------- +void VTKViewer_InteractorStyleSALOME::ControlLblSize(double aOldScale, double aNewScale) { + m_Triedron->InitTraversal(); + vtkActor *ac = m_Triedron->GetNextActor(); + bool IsConeActor = true; + while(!(ac==NULL)) { + float aMaxXRange; + float aMaxYRange; + float aMaxZRange; + if(ac->IsA("vtkFollower")) { + float aScale[3]; + ac->GetScale(aScale); + + float aPosition[3]; + ac->GetPosition(aPosition); + + float aPercent = (aOldScale-aNewScale)/aOldScale; + ac->SetScale(aScale[0]*(1-aPercent),aScale[1]*(1-aPercent),aScale[2]*(1-aPercent)); + + //Set new position + float aLength = ac->GetLength(); + if (aPosition[0]!=0) { + //x + aPosition[0] = aMaxXRange; + } else if (aPosition[1]!=0) { + //y + aPosition[1] = aMaxYRange; + } else if (aPosition[2]!=0) { + //z + aPosition[2] = aMaxZRange; + } + ac->SetPosition(aPosition); + + IsConeActor = true; + } + else { + if (IsConeActor) { + //coneActor is the first in the list (see m_Triedron->AddItem(...) in VTKViewer_ViewFrame::AddVector(...)) + IsConeActor = false; + + float aPosition[3]; + ac->GetPosition(aPosition); + + if (aPosition[0]!=0) { + //x + float* aXRange = ac->GetXRange(); + if (aXRange[0] < aXRange[1]) aMaxXRange = aXRange[1]; + else aMaxXRange = aXRange[0]; + } else if (aPosition[1]!=0) { + //y + float* aYRange = ac->GetYRange(); + if (aYRange[0] < aYRange[1]) aMaxYRange = aYRange[1]; + else aMaxYRange = aYRange[0]; + } else if (aPosition[2]!=0) { + //z + float* aZRange = ac->GetZRange(); + if (aZRange[0] < aZRange[1]) aMaxZRange = aZRange[1]; + else aMaxZRange = aZRange[0]; + } + } + } + ac = m_Triedron->GetNextActor(); + } +} + //---------------------------------------------------------------------------- void VTKViewer_InteractorStyleSALOME::DollyXY(int dx, int dy) { @@ -161,9 +228,14 @@ void VTKViewer_InteractorStyleSALOME::DollyXY(int dx, int dy) cam = this->CurrentRenderer->GetActiveCamera(); if (cam->GetParallelProjection()) { + double aOldScale = cam->GetParallelScale(); cam->SetParallelScale(cam->GetParallelScale()/zoomFactor); + double aNewScale = cam->GetParallelScale(); + + // for controlling label size + ControlLblSize(aOldScale,aNewScale); } - else + else { cam->Dolly(zoomFactor); this->CurrentRenderer->ResetCameraClippingRange(); @@ -1318,6 +1390,7 @@ void VTKViewer_InteractorStyleSALOME::Place(const int theX, const int theY) }*/ //VTKViewer_RenderWindow* aRW = dynamic_cast(this->Interactor->GetRenderWindow()); if (myGUIWindow) myGUIWindow->update(); + } diff --git a/src/VTKViewer/VTKViewer_InteractorStyleSALOME.h b/src/VTKViewer/VTKViewer_InteractorStyleSALOME.h index 510224997..a8a9aa206 100644 --- a/src/VTKViewer/VTKViewer_InteractorStyleSALOME.h +++ b/src/VTKViewer/VTKViewer_InteractorStyleSALOME.h @@ -99,6 +99,7 @@ class VTKViewer_InteractorStyleSALOME : public QObject, public vtkInteractorStyl public: bool eventFilter(QObject* object, QEvent* event); + void ControlLblSize(double aOldScale, double aNewScale); void startZoom(); void startPan(); void startGlobalPan(); diff --git a/src/VTKViewer/VTKViewer_RenderWindow.cxx b/src/VTKViewer/VTKViewer_RenderWindow.cxx index 3ae42c55b..6072e344b 100644 --- a/src/VTKViewer/VTKViewer_RenderWindow.cxx +++ b/src/VTKViewer/VTKViewer_RenderWindow.cxx @@ -67,7 +67,8 @@ VTKViewer_RenderWindow::VTKViewer_RenderWindow(QWidget *parent, const char *name } VTKViewer_RenderWindow::~VTKViewer_RenderWindow() { - //myRW->Delete(); //BUG SAL2954, Commented by SRN, to avoid problems when using rlogin + myRW->Delete(); //BUG SAL2954, Commented by SRN, to avoid problems when using rlogin + // Uncommented because of bug SAL3913 } void VTKViewer_RenderWindow::paintEvent(QPaintEvent* theEvent) { diff --git a/src/VTKViewer/VTKViewer_RenderWindowInteractor.cxx b/src/VTKViewer/VTKViewer_RenderWindowInteractor.cxx index 6d049b67e..4099a3fcd 100644 --- a/src/VTKViewer/VTKViewer_RenderWindowInteractor.cxx +++ b/src/VTKViewer/VTKViewer_RenderWindowInteractor.cxx @@ -156,14 +156,14 @@ void VTKViewer_RenderWindowInteractor::Initialize() { Edge_Actor = vtkActor::New(); Edge_Actor->PickableOff(); Edge_Actor->GetProperty()->SetColor(1,0,0); - Edge_Actor->GetProperty()->SetRepresentationToSurface(); Edge_Actor->GetProperty()->SetLineWidth(5); + Edge_Actor->GetProperty()->SetRepresentationToWireframe(); Point_Actor = vtkActor::New(); Point_Actor->PickableOff(); Point_Actor->GetProperty()->SetColor(1,1,0); - Point_Actor->GetProperty()->SetRepresentationToSurface(); Point_Actor->GetProperty()->SetPointSize(5); + Point_Actor->GetProperty()->SetRepresentationToPoints(); return ; } @@ -912,12 +912,12 @@ QColor VTKViewer_RenderWindowInteractor::GetColor(const Handle(SALOME_Interactiv // GEOM actor float r,g,b; anActor->GetColor(r,g,b); - return QColor(r*255,g*255,b*255); + return QColor(int(r*255),int(g*255),int(b*255)); } else { float color[3]; anActor->GetProperty()->GetColor(color); - return QColor(color[0]*255,color[1]*255,color[2]*255); + return QColor(int(color[0]*255),int(color[1]*255),int(color[2]*255)); } } } @@ -1063,7 +1063,12 @@ static void CellCreateMapper(vtkPolyData *theSourcePolyData, vtkPolyDataMapper* int aPartId = ite.Key(); if(0 > aPartId || aPartId >= aNbOfParts) break; theSourcePolyData->GetCellPoints(aPartId,ptIds); - aPolyData->InsertNextCell(theSourcePolyData->GetCellType(aPartId),ptIds); + vtkCell* aCell = theSourcePolyData->GetCell(aPartId); + aPolyData->InsertNextCell(aCell->GetCellType(),ptIds); + for (int i = 0, iEnd = aCell->GetNumberOfEdges(); i < iEnd; i++){ + vtkCell* anEdgeCell = aCell->GetEdge(i); + aPolyData->InsertNextCell(VTK_LINE,anEdgeCell->GetPointIds()); + } } ptIds->Delete(); theMapper->SetInput(aPolyData); diff --git a/src/VTKViewer/VTKViewer_ViewFrame.cxx b/src/VTKViewer/VTKViewer_ViewFrame.cxx index ae35016b9..b54107cd5 100644 --- a/src/VTKViewer/VTKViewer_ViewFrame.cxx +++ b/src/VTKViewer/VTKViewer_ViewFrame.cxx @@ -26,10 +26,13 @@ // Module : SALOME // $Header$ -using namespace std; #include "VTKViewer_ViewFrame.h" #include "VTKViewer_RenderWindow.h" -//#include "VTKViewer_InteractorStyleSALOME.h" + +#include "SALOME_Transform.h" +#include "SALOME_TransformFilter.h" +#include "SALOME_PassThroughFilter.h" +#include "SALOME_GeometryFilter.h" #include "QAD_Settings.h" #include "QAD_Config.h" @@ -38,6 +41,7 @@ using namespace std; #include "SALOME_Selection.h" #include "SALOME_InteractiveObject.hxx" #include "VTKViewer_InteractorStyleSALOME.h" +#include "VTKViewer_VectorText.h" #include "utilities.h" @@ -50,21 +54,14 @@ using namespace std; // VTK Includes #include #include -#include #include #include -#include #include #include -#include -#include -#include -#include -#include -#include #include +using namespace std; /*! Constructor */ @@ -81,13 +78,13 @@ VTKViewer_ViewFrame::VTKViewer_ViewFrame(QWidget* parent, const char* name) vtkFollower* CreateTextActor(char *text, float aSize) { - vtkVectorText* aTxt = vtkVectorText::New(); + VTKViewer_VectorText* aTxt = VTKViewer_VectorText::New(); aTxt->SetText(text); vtkPolyDataMapper* textMapper = vtkPolyDataMapper::New(); textMapper->SetInput(aTxt->GetOutput()); vtkFollower* textActor = vtkFollower::New(); textActor->SetMapper(textMapper); - float aScale = 6 * aSize/100; + float aScale = 17 * aSize/100; textActor->SetScale(aScale, aScale, aScale); return textActor; } @@ -258,6 +255,7 @@ void VTKViewer_ViewFrame::InitialSetup() { m_Renderer->GetActiveCamera()->ParallelProjectionOn(); m_Renderer->LightFollowCameraOn(); + m_Renderer->TwoSidedLightingOn(); // Set BackgroundColor QString BgrColorRed = QAD_CONFIG->getSetting("VTKViewer:BackgroundColorRed"); @@ -426,7 +424,38 @@ void VTKViewer_ViewFrame::onViewReset() camera->SetFocalPoint(0,0,0); camera->SetViewUp(0,0,1); m_Renderer->ResetCamera(); + + double aOldScale = camera->GetParallelScale(); camera->SetParallelScale(500); + double aNewScale = camera->GetParallelScale(); + + //for controlling labels scale after reset + float dim; + QString Size = QAD_CONFIG->getSetting("Viewer:TrihedronSize"); + if( Size.isEmpty() ){ + dim = 100; + } else { + dim = Size.toFloat(); + } + float aScale = 17 * dim/100; + + m_Triedron->InitTraversal(); + vtkActor *ac = m_Triedron->GetNextActor(); + bool IsConeActor = true; + while(!(ac==NULL)) { + if(ac->IsA("vtkFollower")) { + ac->SetScale(aScale, aScale, aScale); + IsConeActor = true; + } + else { + if (IsConeActor) { + //coneActor is the first in the list (see m_Triedron->AddItem(...) in VTKViewer_ViewFrame::AddVector(...)) + IsConeActor = false; + } + } + ac = m_Triedron->GetNextActor(); + } + m_Renderer->ResetCameraClippingRange(); m_RW->update(); } @@ -572,7 +601,7 @@ static void ResetCameraClippingRange(vtkRenderer* theRenderer, float bounds[6] ) anActiveCamera->SetClippingRange( range ); } -static void ResetCamera(vtkRenderer* theRenderer){ +static void ResetCamera(vtkRenderer* theRenderer, vtkActorCollection* theTriedron, VTKViewer_RenderWindowInteractor* theRWInteractor){ //see vtkRenderer::ResetCamera(float bounds[6]) method float bounds[6]; if(!theRenderer) return; @@ -582,6 +611,7 @@ static void ResetCamera(vtkRenderer* theRenderer){ float distance; float width; double vn[3], *vup; + int* winsize; if ( theRenderer->GetActiveCamera() != NULL ) { @@ -601,6 +631,10 @@ static void ResetCamera(vtkRenderer* theRenderer){ (bounds[5]-bounds[4])*(bounds[5]-bounds[4])); double ang = theRenderer->GetActiveCamera()->GetViewAngle(); distance = 2.0*width/tan(ang*vtkMath::Pi()/360.0); + + // find size of the window + winsize = theRenderer->GetSize(); + // check view-up vector against view plane normal vup = theRenderer->GetActiveCamera()->GetViewUp(); if ( fabs(vtkMath::Dot(vup,vn)) > 0.999 ) @@ -611,11 +645,25 @@ static void ResetCamera(vtkRenderer* theRenderer){ // update the camera theRenderer->GetActiveCamera()->SetFocalPoint(center[0],center[1],center[2]); - theRenderer->GetActiveCamera()->SetPosition(center[0]+distance*vn[0], + theRenderer->GetActiveCamera()->SetPosition(center[0]+distance*vn[0], center[1]+distance*vn[1], center[2]+distance*vn[2]); // setup default parallel scale + double aOldScale = theRenderer->GetActiveCamera()->GetParallelScale(); + + if(winsize[0]GetActiveCamera()->SetParallelScale(width/2.0); + double aNewScale = theRenderer->GetActiveCamera()->GetParallelScale(); + + // for controlling label size + VTKViewer_InteractorStyleSALOME* Style = 0; + if (theRWInteractor->GetInteractorStyle()->IsA("VTKViewer_InteractorStyleSALOME")) { + Style = VTKViewer_InteractorStyleSALOME::SafeDownCast(theRWInteractor->GetInteractorStyle()); + Style->ControlLblSize(aOldScale,aNewScale); + } + //workaround on VTK //theRenderer->ResetCameraClippingRange(bounds); ResetCameraClippingRange(theRenderer,bounds); @@ -634,8 +682,9 @@ void VTKViewer_ViewFrame::onViewFitAll() TriedronWasVisible = true; } bool hasVisibleActors = m_Renderer->VisibleActorCount() > 0; - if ( hasVisibleActors ) // if there are visible actors, not to take into account Trihedron - ResetCamera(m_Renderer); + if ( hasVisibleActors ) { // if there are visible actors, not to take into account Trihedron + ResetCamera(m_Renderer,m_Triedron,m_RWInteractor); + } if(TriedronWasVisible) { m_Triedron->InitTraversal(); vtkActor *ac = m_Triedron->GetNextActor(); @@ -643,8 +692,9 @@ void VTKViewer_ViewFrame::onViewFitAll() ac->VisibilityOn(); ac = m_Triedron->GetNextActor(); } - if ( !hasVisibleActors ) // if there are NO visible actors, fit view to see only Trihedron - ResetCamera(m_Renderer); + if ( !hasVisibleActors ) { // if there are NO visible actors, fit view to see only Trihedron + ResetCamera(m_Renderer,m_Triedron,m_RWInteractor); + } } //m_Renderer->ResetCameraClippingRange(); m_RW->update(); @@ -930,6 +980,11 @@ void VTKViewer_ViewFrame::GetScale(double theScale[3]){ void VTKViewer_ViewFrame::SetScale(double theScale[3]){ m_Transform->SetScale(theScale[0], theScale[1], theScale[2]); m_Transform->Modified(); + vtkActorCollection* theActors = m_Renderer->GetActors(); + theActors->InitTraversal(); + vtkActor *anActor; + while(anActor = theActors->GetNextActor()) + anActor->GetMapper()->Update(); Repaint(); }