]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
PR: Merge V1_2c etape 1
authorprascle <prascle>
Tue, 14 Oct 2003 15:36:34 +0000 (15:36 +0000)
committerprascle <prascle>
Tue, 14 Oct 2003 15:36:34 +0000 (15:36 +0000)
63 files changed:
idl/Logger.idl
idl/SALOMEDS.idl
idl/SALOME_Component.idl
idl/SALOME_Exception.idl
idl/SALOME_ModuleCatalog.idl
idl/SALOME_Session.idl
salome_adm/unix/config_files/check_cas.m4
salome_adm/unix/make_commence.in
src/Container/Component_i.cxx
src/Container/Container_i.cxx
src/Container/SALOME_ComponentPy.py
src/Container/SALOME_Component_i.hxx
src/Container/SALOME_Container.cxx
src/DataTypeCatalog/SALOME_DataTypeCatalog_Server.cxx
src/HDFPersist/HDFattrCreate.c
src/HDFPersist/HDFattrRead.c
src/HDFPersist/HDFattrWrite.c
src/HDFPersist/HDFdatasetCreate.c
src/HDFPersist/HDFdatasetGetType.c
src/HDFPersist/HDFdatasetRead.c
src/HDFPersist/HDFdatasetWrite.c
src/HDFPersist/Makefile.in
src/Logger/SALOME_Logger_Server.cxx
src/Logger/SALOME_Logger_Server.hxx
src/Logger/SALOME_Trace.cxx
src/Makefile.in
src/ModuleCatalog/SALOME_ModuleCatalog_Server.cxx
src/NamingService/SALOME_NamingServicePy.py
src/OBJECT/Makefile.in
src/OBJECT/SALOME_Actor.cxx
src/OBJECT/SALOME_Actor.h
src/OBJECT/SALOME_Transform.cxx [deleted file]
src/OBJECT/SALOME_Transform.h [deleted file]
src/OCCViewer/Makefile.in
src/Plot2d/Makefile.in
src/Plot2d/Plot2d_ViewFrame.cxx
src/Registry/SALOME_Registry_Server.cxx
src/RessourcesCatalog/SALOME_RessourcesCatalog_Server.cxx
src/SALOMEDS/Makefile.in
src/SALOMEDS/SALOMEDS_Server.cxx
src/SALOMEGUI/CLIENT_msg_en.po
src/SALOMEGUI/Makefile.in
src/SALOMEGUI/QAD_Desktop.cxx
src/SALOMEGUI/QAD_Desktop.h
src/SALOMEGUI/QAD_Message.cxx
src/SALOMEGUI/QAD_PyEditor.cxx
src/SALOMEGUI/QAD_msg_en.po
src/SALOMEGUI/SALOMEGUI_msg_en.po
src/SALOME_PY/Makefile.in
src/SALOME_PYQT/Makefile.in
src/SALOME_SWIG/batchmode_salome.py
src/SALOME_SWIG/salome_test.py
src/Session/Makefile.in
src/Session/SALOME_Session_Server.cxx
src/TOOLSDS/Makefile.in
src/TOOLSGUI/Makefile.in
src/TestContainer/TestContainer.cxx
src/VTKViewer/Makefile.in
src/VTKViewer/VTKViewer_InteractorStyleSALOME.cxx
src/VTKViewer/VTKViewer_InteractorStyleSALOME.h
src/VTKViewer/VTKViewer_RenderWindow.cxx
src/VTKViewer/VTKViewer_RenderWindowInteractor.cxx
src/VTKViewer/VTKViewer_ViewFrame.cxx

index d58070da26452d456a8d58ae4702d95e6e9f5402..c30b5e22fb5acacb0ad4ae781cbbe99af65afd21 100644 (file)
@@ -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 (); 
          };
 };
 
index 5fcb8c16a80a38135759912dbd011d0ae9564911..ed5f15d546e57fb63f2bf25f6b1f349977b61fc3 100644 (file)
@@ -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 
 //  $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 <A HREF="http://www.omg.org">here.</A>
-
-<BR><STRONG>CONTENTS:</STRONG>
-- \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:
-
-\95 An IDL module mapped into a Python module. Modules containing modules are
-mapped to packages (i.e., directories with an <STRONG>__init__</STRONG> 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.
-
-\95 For all other scopes, a Python class is introduced that contains all the definitions
-inside this scope.
-
-\95 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 (\91_\92).
-
-\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:
-
-\95 For the wide string X and the integer n, X[n] returns the nth character, which is a
-wide string of length 1.
-
-\95 len(X) returns the number of characters of wide string X.
-
-\95 CORBA.wstr(c) returns a wide character with the code point c in an
-implementation-defined encoding.
-
-\95 X+Y returns the concatenation of wide strings X and Y.
-
-\95 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 <string> 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<GenericAttribute> 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 <STRONG>None</STRONG>.
-
-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 <STRONG>in</STRONG> or <STRONG>inout</STRONG> 
-are passed from left to right tothe method, skipping <STRONG>out</STRONG> parameters.
-The return value of a method depends on the number of <STRONG>out</STRONG> parameters 
-and the return type. If the operation returns a value, this
-value forms the first <VAR>result value</VAR>. All <STRONG>inout</STRONG> or <STRONG>out</STRONG> 
-parameters form consecutive <VAR>result values</VAR>. The method result depends then on the number
-of <VAR>result values</VAR>:
-
-\95 If there is no <VAR>result value</VAR>, the method returns None.
-
-\95 If there is exactly one <VAR>result value</VAR>, it is returned as a single value.
-
-\95 If there is more than one <VAR>result value</VAR>, 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 <STRONG>A</STRONG> corresponds to the return value <STRONG>anAttribute</STRONG> and  
-<STRONG>res</STRONG> to the <STRONG>boolean</STRONG> return value. 
-
-If an interface defines an <STRONG>attribute name</STRONG>, for example, the attribute is mapped into an
-operation <STRONG>_get_name</STRONG>. If the attribute is not <STRONG>readonly</STRONG>, there is an
-additional operation <STRONG>_set_name</STRONG>.
-
-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 <STRONG>A</STRONG> to an interface
-class <STRONG>AttributeSequenceOfReal</STRONG>, 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.
-
-
-  - <B>%SALOME STUDY module</B>
-     - <A href=HTML/SALOMEDS.html>Mapping of %SALOMEDS functions</A>
-     - <A href=HTML/SALOMEDS_Attributes.html>Mapping of SALOMEDS_Attributes functions</A>
-  - <B>%SAlOME KERNEL module</B>
-     - <A href=HTML/Med_Gen.html>Mapping of %Med_Gen functions</A>
-     - <A href=HTML/SALOME_Session.html>Mapping of %SALOME_Session functions</A>
-     - <A href=HTML/SALOME_ModuleCatalog.html>Mapping of %SALOME_ModuleCatalog functions</A>
-     - <A href=HTML/SALOME_Exception.html>Mapping of %SALOME_Exception functions</A>
-     - <A href=HTML/SALOME_Component.html>Mapping of %SALOME_Component functions</A>
-  - <B>%SALOME MED component</B>
-     - <A href=HTML/MED.html>Mapping of %Med functions</A>
-  - <B>%SALOME SUPERVISION module</B>
-     - <A href=HTML/SUPERV.html>Mapping of %SUPERV functions</A>
-  - <B>%SALOME %VISU module</B>
-     - <A href=HTML/VISU_Gen.html>Mapping of %VISU_Gen functions</A>
-
-*/
-
-/*! \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<string> ListOfOpenStudies;
 /*! List of file names
@@ -436,10 +99,12 @@ module SALOMEDS
   interface UseCaseIterator;
   interface UseCaseBuilder;
   interface Callback;
+
 /*! List of attributes
 */
   typedef sequence<GenericAttribute> 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<SObject> 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.
 <BR><VAR>See also <A href=exemple/Example19.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 
 */
     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.
  <BR><VAR>See also <A href=exemple/Example1.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 */
     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 <VAR>allLevels</VAR> is True the Iterator is
   };
   //==========================================================================
   //==========================================================================
-/*! \brief The callback interface  
+/*! \brief The callback interface
 
   The %StudyBuilder can be created with the method <VAR>NewBuilder</VAR>. While invocation of this method a new object of the class <VAR>Callback</VAR> 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 <VAR>allLevels</VAR> is True the Iterator is
 
   };
 };
+
 #endif
index 085bf919be17a3ae64e6d97d9d22fec5efb12ff1..391112dfda558a481d47ac4c8b62f45b1b464bd9 100644 (file)
@@ -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
   {
index 6c559445b4fa1b8f375f05f260074a6184d37718..c310e9de4261ac4da003cece7274d3c913212b57 100644 (file)
 //  $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.
index 3f6bfaefbc6225171d08e8541f8b038b43157fba..d3ac7ecee549c2a97559fc585ac9bab04b71f0ae 100644 (file)
   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,  /*!<Module %GEOM */
                         MESH,  /*!<Module %MESH */
index 7d1d5a7c48d2886e2eb3d75e41f67c6245b731a3..9cce222ffee09d959124504c5825e8db079979b0 100644 (file)
 //  $Header$
 
 #include "SALOME_Component.idl"
-/*! \defgroup Kernel SALOME KERNEL module
-*/
 
-/*!  \ingroup Kernel 
-   
+/*!   
   This package contains interfaces used for management of the session in %SALOME application.
 */
 module SALOME
index 7ad5b3c124f669b9a8a10da8e53c2a64adc80b08..26af611bac169491fb161a46bd2e9e6564afdd3d 100644 (file)
@@ -37,10 +37,11 @@ AC_SUBST(CAS_OCAF)
 AC_SUBST(CAS_DATAEXCHANGE)
 AC_SUBST(CAS_LDFLAGS)
 
+AC_SUBST(CAS_LDPATH)
+
 CAS_CPPFLAGS=""
 CAS_CXXFLAGS=""
 CAS_LDFLAGS=""
-
 occ_ok=no
 
 dnl libraries directory location
@@ -73,6 +74,14 @@ if test -z $CASROOT; then
   AC_MSG_WARN(You must provide CASROOT variable : see OCC installation manual)
 else
   occ_ok=yes
+  OCC_VERSION_MAJOR=0
+  ff=$CASROOT/inc/Standard_Version.hxx
+  if test -f $ff ; then
+    grep "define OCC_VERSION_MAJOR" $ff > /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
@@ -80,7 +89,7 @@ if test "x$occ_ok" = "xyes"; then
 dnl cascade headers
 
   CPPFLAGS_old="$CPPFLAGS"
-  CPPFLAGS="$CPPFLAGS -DLIN -DLINTEL -DCSFDB -DNO_CXX_EXCEPTION -DNo_exception -I$CASROOT/inc -Wno-deprecated"
+  CPPFLAGS="$CPPFLAGS -DLIN -DLINTEL -DCSFDB -DNO_CXX_EXCEPTION -DNo_exception -I$CASROOT/inc"
   CXXFLAGS_old="$CXXFLAGS"
   CXXFLAGS="$CXXFLAGS -funsigned-char"
 
@@ -92,18 +101,17 @@ 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)
 
   CPPFLAGS_old="$CPPFLAGS"
-  CPPFLAGS="$CPPFLAGS $CAS_CPPFLAGS -Wno-deprecated"
+  CPPFLAGS="$CPPFLAGS $CAS_CPPFLAGS"
   CXXFLAGS_old="$CXXFLAGS"
   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 <Standard_Type.hxx>
@@ -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
index d5e8ecc61b1b598e057539a99fb75a52809fb5c3..ef2a4a944d7332022cce940037bfb196e2a0cb51 100644 (file)
@@ -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,8 @@ all:
        $(MAKE) lib
        $(MAKE) bin
        $(MAKE) resources
+       $(MAKE) data
+       $(MAKE) doc
 
 #
 # add target to build administrative files
index 400072d0f32a15650fa51c36ca632881427d6104..09d463416e59a143acb2e0ed96544e6453dd044d 100644 (file)
@@ -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 <sys/time.h>
 #include <sys/resource.h>
 #include <unistd.h>
 
-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 ;
 }
 
index 9cef646b8b75c5fe20e401c937d31be7d8d69cc7..05f7c84f8bd39602717fe45a2f742ada8b3cbbd1 100644 (file)
@@ -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 ;
   }
 }
index 1ac2e3cfc11d678d80149042e27d7cb8d5a4868c..004d6ededc699551b7832e1fe58bc96043c36041 100755 (executable)
@@ -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
 
     #-------------------------------------------------------------------------
 
index a5d462b6542c97dec3d334f638f600d14a077c1c..fc537d1c84880778e7c08c8230fbbde4f00040db 100644 (file)
@@ -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
index 3914a57f383c9cbb44860161bc223e859c9d1f7e..ce8c05628e828dd287590121683474295a4cec21 100644 (file)
@@ -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 <iostream>
 #include <string>
@@ -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_<SALOME_NamingService>::Instance() ;
+    int CONTAINER=0;
+    const char * Env = getenv("USE_LOGGER");
+    int EnvL =0;
+    if ((Env!=NULL) && (strlen(Env)))
+      EnvL=1;
+
+    CosNaming::Name name;
+    name.length(1);
+    name[0].id=CORBA::string_dup("Logger");    
+    PortableServer::POAManager_var pman; 
+    for (int i = 1; i<=NumberOfTries; i++){
+      if (i!=1) 
+       a=nanosleep(&ts_req,&ts_rem);
+      try{ 
+       obj = orb->resolve_initial_references("RootPOA");
+       if(!CORBA::is_nil(obj))
+         root_poa = PortableServer::POA::_narrow(obj);
+       if(!CORBA::is_nil(root_poa))
+         pman = root_poa->the_POAManager();
+       if(!CORBA::is_nil(orb)) 
+         theObj = orb->resolve_initial_references("NameService");
+       if (!CORBA::is_nil(theObj))
+         inc = CosNaming::NamingContext::_narrow(theObj);
+      }
+      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);
index e9b4de72f8d758721143625f406bd13c89f90e1b..95c4ce6a1fb1e47842998e0ce8e1a79de28d1fbf 100644 (file)
@@ -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_<SALOME_NamingService>::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.")
   }
index 9d4b3dc5410c27eb3995b3bdc4647fb91871d3ed..e3e176b66a4e9800507c1314130686c4316b2bdb 100644 (file)
@@ -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 :
index 464e9c2a96d351b6658f37f4779b2a1521d346b8..25474b9a73774dd666c65289c7260683b2b95acb 100644 (file)
@@ -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);
   }
 
index b1dbea58844e473d2f53616106f2d5a81ae2c1e9..61d378427b3b46523592906a96c7a5a3ad697fdb 100644 (file)
@@ -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;
index dd4772525973d5ff4f1a85ef35d73b2aeafd0714..70e8ddd503597d89e043f4c5a8d5effd14dc07c8 100644 (file)
@@ -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 :
index 9cc4bbd6a8c53e571777813d7fac9b86631bc19a..722849d1a025789ec18524ff5f682c56bdf39686 100644 (file)
@@ -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);
index 7cb951b8d6dfc533f7842a32e56e061d79f56f42..0c89c3902439aaecb622c38805353f8e262a1c12 100644 (file)
@@ -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;
index f48c6a27c10df14346bf4e4f9bdf322d96b09004..07dbefdd9dd64d1e0e5ac3e3503fcb31859cba90 100644 (file)
@@ -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;
 }
index 3baa03bd930eac215ff0ddd97cca11dd7c4c5935..6fe8916d26bb9abebae07fd2f5fbeadfc7355a19 100644 (file)
@@ -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@
index 3d40b45f72d2633d6d28059cf6d57e7b678198d1..c3f7acce130c8aaa2e9052a581823d2fac008483 100644 (file)
@@ -11,7 +11,9 @@
 using namespace std;
 #include <iostream>
 #include "SALOME_Logger_Server.hxx"
-
+#include <SALOMEconfig.h>
+#include <sys/types.h>
+#include <unistd.h>
 omni_mutex Logger::myLock;
 
 /////////////////////////////////////////////////////////////////////
@@ -49,6 +51,11 @@ void Logger::putMessage(const char* message)
   myLock.unlock();
 }
 
+void Logger::ping()
+{
+  cout<<" Logger::ping() pid "<< getpid()<<endl;
+}
+
 int main(int argc, char **argv)
 {
   if (argc > 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"<<endl;
+          }
+      catch(...){ cout<<"Logger Server: Unknown exception dealed with Naming Service" <<endl; } 
+       if (!CORBA::is_nil(inc)){
+         cout<<"Logger Server: Naming Service was found"<<endl; 
+         break;}
+      }
       if (argc == 1)
        myLogger = new Logger();
       else
        myLogger = new Logger(argv[1]);
-
-
-      // This activates the object in the root POA (by default), and
-      // returns a reference to it.
-      SALOME_Logger::Logger_var myLoggerRef = myLogger->_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&) 
     {
index 4b000c50ca742362ab66eb6a3e5b165dce61bf2e..4b1441bd119b05858b699ee307e1b8e560461018 100644 (file)
@@ -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 
index ab5abd2b2e747a1049813193ab9121e7b7e2170d..e3185daf6120a226e3b6a7515fd74b359d65b650 100644 (file)
@@ -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" <<endl;
+           }
+          catch(...){ cout<< "SALOME_TRACE: Unknown exception dealed with Naming Service" <<endl; }
+         
+         if(!CORBA::is_nil(inc)) {
+           obj = inc->resolve(name);
+           m_pInterfaceLogger = SALOME_Logger::Logger::_narrow(obj);
+           if (!CORBA::is_nil(m_pInterfaceLogger))
+             cout<<"SALOME_TRACE: Logger Server was found"<<endl;
+           break;
+           
+         }
+      }
+          
     }
-  catch (const CosNaming::NamingContext::NotFound&)
-    {
-//       cout << "Caught exception: Naming Service can't found Logger";
-    }
-  catch (CORBA::COMM_FAILURE&)
-    {
-//       cout << "Caught CORBA::SystemException CommFailure.";
+      catch (const CosNaming::NamingContext::NotFound&)
+       {
+         //       cout << "Caught exception: Naming Service can't found Logger";
+       }
+      catch (CORBA::COMM_FAILURE&)
+       {
+         //       cout << "Caught CORBA::SystemException CommFailure.";
     }
   catch (CORBA::SystemException&)
     {
index 17bafb5964f60f8e9d03e2dc02531f0cc710f825..ed8d2f4ec80f217e4d0cd608c41c1030591b98a7 100644 (file)
@@ -34,9 +34,8 @@ VPATH=.:@srcdir@
 
 SUBDIRS = MSG2QM Logger Utils PatchQt NamingService Registry ModuleCatalog DataTypeCatalog \
          RessourcesCatalog Notification NOTIFICATION_SWIG Container TestContainer LifeCycleCORBA \
-          HDFPersist OBJECT TOOLSDS SALOMEDS SALOMEGUI Plot2d VTKViewer OCCViewer SUPERVGraph Session \
-         SALOME_SWIG TOOLSGUI SALOME_PY RegistryDisplay ModuleGenerator \
-         SALOME_PYQT Loader
+          HDFPersist VTKFilter OBJECT TOOLSDS SALOMEDS SALOMEGUI Plot2d VTKViewer OCCViewer SUPERVGraph \
+         Session SALOME_SWIG TOOLSGUI SALOME_PY RegistryDisplay ModuleGenerator SALOME_PYQT Loader
 
 ifeq (@WITHMPICH@,yes)
   SUBDIRS+= MPIContainer
index 817f31b9357c0e0199afe00955dd6843e0e5b43b..c76af7d3ce49ed82ed149129f61f7aed3ce4f76d 100644 (file)
@@ -30,6 +30,7 @@ using namespace std;
 #include "SALOME_NamingService.hxx"
 #include "SALOME_ModuleCatalog_impl.hxx"
 #include "utilities.h"
+# include "Utils_SINGLETON.hxx"
 
 //#define CHECKTIME
 #ifdef CHECKTIME
@@ -46,12 +47,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_<SALOME_NamingService>::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);
index db2d7563314cce3fbed3d706f1c853dd3c7613c8..8b41f25bed92501afef8dd5c8c0c570bda57dcc5 100644 (file)
@@ -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" )
index 301ade4e1a807a7878119e0d79444fd19dd3bc6f..4bb0d399bf95c25d099a90076278be5d984fde94 100644 (file)
@@ -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@
index bf761ec7d75d7ee41f401f3740c0e85480c63046..8029335ebb34d14f9bc34070c70f7f264e6d56dc 100644 (file)
 //  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 <vtkObjectFactory.h>
 #include <vtkDataSetMapper.h>
 #include <vtkPolyDataMapper.h>
-#include <vtkGeometryFilter.h>
 #include <vtkTransformPolyDataFilter.h>
 
+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<vtkDataSetMapper*>(theMapper))
-      aMapper->SetInput(myPassFilter[3]->GetOutput());
+      aMapper->SetInput(myPassFilter[3]->GetPolyDataOutput());
     else if(vtkPolyDataMapper* aMapper = dynamic_cast<vtkPolyDataMapper*>(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) 
index 0a994e6160239a947201ed1cf227e3fd044cff8e..ea35d47ef07d50a14ed8021b8927b7cc39b60a5e 100644 (file)
 #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 <vector.h>
-#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<SALOME_PassThroughFilter*> 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 (file)
index d55c5fb..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
-// File:       SALOME_Transform.cxx
-// Created:    Wed Jun  4 09:46:59 2003
-// Author:     Alexey PETROV
-//             <apo@ivanox.nnov.matra-dtv.fr>
-
-
-#include "SALOME_Transform.h"
-#include "VTKViewer_Common.h"
-#include <vtkObjectFactory.h>
-#include <vtkGeometryFilter.h>
-#include <vtkMatrix4x4.h>
-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<SALOME_Transform*>(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<vtkDataSet*>(this->GetInput());
-  vtkDataSet *output = static_cast<vtkDataSet*>(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 (file)
index 65fa0b4..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-// File:       SALOME_Transformation.hxx
-// Created:    Wed Jun  4 09:39:09 2003
-// Author:     Alexey PETROV
-//             <apo@ivanox.nnov.matra-dtv.fr>
-
-
-#ifndef SALOME_Transform_HeaderFile
-#define SALOME_Transform_HeaderFile
-
-#include <math.h>
-
-#include <vtkTransform.h>
-#include <vtkTransformFilter.h>
-#include <vtkDataSetToDataSetFilter.h>
-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
index df92be72a36c35137fa5808f64d229df8fd377f2..5f466d4af9dfb3aeb3d675170777b4fbe70a1399 100644 (file)
@@ -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@
index 23079dfd44817caea73b200c6491c8d63aa5de1f..580beb4456d356bdd65ce5f81ce786b52ba0506e 100644 (file)
@@ -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@
index 2c9c8d7488d950e4e10ae735602376d28eeb2891..b5d094b9fa131ba1c3b581e6b707b465b8d32e8d 100644 (file)
@@ -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<Plot2d_Curve> it(myCurves);
+      for(; it.current();++it){
+       if(it.current()->hasIO() && it.current()->getTableIO()->isSame(IObject))
+         return 1;
+      }}
+  }
+  return 0;
 }
 /*!
   Returns true if interactive object is presented in the viewer and displayed
index 6cba1c7d8c2374c90d80cc302a21ca43862864e3..e4aee0f7d45e78ad97e6260f224cb071bab5cba0 100644 (file)
@@ -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_<ORB_INIT>::Instance() ;
-               CORBA::ORB_var &orb = init( argc , argv ) ;
-
-
-               SALOME_NamingService &naming = *SINGLETON_<SALOME_NamingService>::Instance() ;
-               naming.init_orb( orb ) ;
-
-               RegistryService *ptrRegistry = SINGLETON_<RegistryService>::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_<ORB_INIT>::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_<SALOME_NamingService>::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_<RegistryService>::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 ;
 }
index 519f0b8453835f1b42505d28ce5424fcf9750fc9..827efd482290070a410eb27e229409b79de5bdf5 100644 (file)
@@ -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_<SALOME_NamingService>::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
index dcb0778c00ba6ed8226638f7f6446fce0a061699..873929b8017631d23e311300da24dee7e707d01e 100644 (file)
@@ -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@
 
index 087ef8ff5a06ac52e0ab1665fcad202977879394..238dd2450a4b23314595a8de31c1ba9e2f82f953 100644 (file)
@@ -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 <Utils_Timer.hxx>
@@ -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_<SALOME_NamingService>::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
index 1cdf343b7d29f676b6f18436c8882874018b9571..cb8f094c5113d5d522a68f2eaa8cad16ca632336 100644 (file)
@@ -20,7 +20,7 @@ msgstr ""
 #---------------
 
 msgid "INF_VERSION"
-msgstr "Version 1.2"
+msgstr "Version 1.2c"
 
 msgid "INF_COPYRIGHT"
 msgstr "  "
index 2067c607ff8f4b1ee5c174eaf0a8dd6563e097fd..ba4b9ea30984ad0fecff6efcde5167e7fe73d57b 100644 (file)
@@ -99,7 +99,7 @@ EXPORT_HEADERS = \
                   SALOMEGUI_SetValueDlg.h \
                   SALOMEGUI_SetupCurveDlg.h \
                   SALOMEGUI_CloseDlg.h
-                  
+
 
 # .po files to transform in .qm
 PO_FILES = \
@@ -175,13 +175,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 \
@@ -204,22 +205,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)
 
index 189665a8e367f45ae0dda69484e9b97d77557de6..2783c81b32026015bd5ce18e0ff3d0c669fa3904 100644 (file)
@@ -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"
@@ -57,6 +59,7 @@ using namespace std;
 #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 <qlabel.h>
@@ -87,6 +91,7 @@ using namespace std;
 #include <qfontdialog.h>
 #include <qlineedit.h>
 #include <qdatetime.h>
+#include <qthread.h>
 
 #if QT_VERSION > 300
   #include <qlistbox.h>
@@ -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") ) {
@@ -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,24 @@ void QAD_Desktop::createActions()
                        this, SLOT( onHelpContents() )));
     helpContentsAction->addTo( &myHelpPopup );
     myStdActions.insert( HelpContentsId , helpContentsAction );
+                               
+    id = myHelpPopup.insertSeparator();
+                                                  
+    /* GUI contents */
+    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 +1039,7 @@ void QAD_Desktop::updateCaption( UpdateCommand cmd )
     else
     {  /* default icon and title */
        setIcon( myDefaultIcon );
+       qApp->processEvents();
        setCaption( myDefaultTitle );
     }
 }
@@ -1984,15 +2023,179 @@ 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 (myActiveApp)
-    myActiveApp->helpContents();
-  else
-    helpContents();
+
+  // look for main.html and set homeDir
+  // 1. $(SALOME_ROOT_DIR)/doc/main.html
+  // 2. $(SALOME_ROOT_DIR)/doc/html/main.html
+  // 3. $(SALOME_ROOT_DIR)/doc/html/html/main.html
+  // 4. /usr/local/doc/html/main.html
+  
+  QCString dir;
+  QString root;
+  QString homeDir;
+  
+  if ( (dir = getenv("SALOME_ROOT_DIR")) ) {
+    root = QAD_Tools::addSlash( QAD_Tools::addSlash(dir) + "doc" );
+    if ( QFileInfo( root + "main.html" ).exists() ) {
+      homeDir = root;
+    }
+    else {
+      root = QAD_Tools::addSlash( root + "html" );
+      if ( QFileInfo( root + "main.html" ).exists() ) {
+       homeDir = root;
+      }
+      else {
+       root = QAD_Tools::addSlash( root + "html" );
+       if ( QFileInfo( root + "main.html" ).exists() ) {
+         homeDir = root;
+       }
+      }
+    }
+  }
+  if ( root.isEmpty() ) {
+    if ( QFileInfo( "/usr/local/doc/html/main.html" ).exists() ) {
+      homeDir = "/usr/local/doc/html/";
+    }
+  }
+  if ( root.isEmpty() ) 
+    root = "./doc/";
+  
+  QString helpFile = QFileInfo( homeDir + "main.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()
+{
+
+  // look for main.html and set homeDir
+  // 1. $(SALOME_ROOT_DIR)/doc/guihtml/guihtml/salomedoc.html
+  // 2. /usr/local/doc/guihtml/salomedoc.html
+  
+  QCString dir;
+  QString root;
+  QString homeDir;
+  
+  if ( (dir = getenv("SALOME_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\TUI Reference'
+*/
+void QAD_Desktop::onHelpContentsTUI()
+{
+
+  // look for main.html and set homeDir
+  // 1. $(SALOME_ROOT_DIR)/doc/html/html/index.html
+  // 2. /usr/local/doc/html/index.html
+  
+  QCString dir;
+  QString root;
+  QString homeDir;
+  
+  if ( (dir = getenv("SALOME_ROOT_DIR")) ) {
+    root = QAD_Tools::addSlash( QAD_Tools::addSlash(dir) + "doc" );
+    root = QAD_Tools::addSlash( root + "html" );
+    root = QAD_Tools::addSlash( root + "html" );
+    if ( QFileInfo( root + "index.html" ).exists() ) {
+      homeDir = root;
+    }
+  }
+  if ( root.isEmpty() ) {
+    if ( QFileInfo( "/usr/local/doc/html/index.html" ).exists() ) {
+      homeDir = "/usr/local/doc/html/";
+    }
+  }
+  if ( root.isEmpty() ) 
+    root = "./doc/";
+  
+  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();
+    
 }
 
 /*!
@@ -2796,15 +2999,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 +3374,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
index 0658375483beb57323cd8343627b90b855ac74f1..fe2c3e26962d24147c731ac2d242ca01e8e64345 100644 (file)
@@ -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
@@ -236,11 +236,14 @@ protected slots:
     void             onObjectBrowser();
     void              onMultiFileSave();
     void              onASCIISave();
+    void             onExternalBrowser();      
 
     void             onActivateApp(QAD_Application* app);
     void             onDeactivateApp(QAD_Application* app);
 
     void             onHelpContents();
+    void             onHelpContentsGUI();
+    void             onHelpContentsTUI();
     void             onHelpSearch();
     void             onHelpAbout();
 
index a932028e29f0f370025fb58813ef5114c23a753f..4730b1ee8149727ac2802de760bc015fd8dfb91f 100644 (file)
@@ -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;
     
index 58407f6a054a28425b0c21e8841b987d805ede98..4dd3aa333701ef2d3f0601943dcab112beaeb1f1 100644 (file)
@@ -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:
index f31e12f8d447deb72f8a4ff4ee045d8935b69e7b..26df825a8d96eb65a18075f4027568fff84f4cbe 100644 (file)
@@ -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"
@@ -544,10 +564,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"
 
index bcdf3d4c625a09bd1cada25f46f566552d622bac..af07853984258baa0a947d545677a4383ebb1387 100644 (file)
@@ -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"
 
index 08fac84a5f67e70bf78cbab24c5e05f8afa0dab1..f99d2e4ed6ab488c201eea7a1a32b897e6873960 100644 (file)
@@ -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@
index 525764d5d4abbc2254b6f35bbfff2e637214fce0..146f123c169d55654325374b127fe897421355f6 100644 (file)
@@ -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
 
 
index f3a61bc760addae0414bdad473f0d146785577c2..5ad16f16553922614625fef2e530fe78bd4ba7ed 100644 (file)
@@ -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, "<CanCopy> for "+theInfo+" returns false"
+    
+    if not myStudyManager.Copy(theSO):
+        raise RuntimeError, "<Copy> for "+theInfo+" returns false"
+
+    
+    if not myStudyManager.CanPaste(theSO):
+        raise RuntimeError, "<CanPaste> for "+theInfo+" returns false"
+
+    # check: before paste study is not changed check
+    if aStudyPersist != PersistentPresentation(myStudy, aRoot, 1):
+        raise RuntimeError, "Study is changed before Paste calling for "+theInfo
+    
+    aSObj = theSO
+    if theComponentPaste:
+        aSObj = theSO.GetFatherComponent()
+        theInfo = theInfo + "(paste for component)"
+    if not myStudyManager.Paste(aSObj):
+        raise RuntimeError, "<Paste> 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("SALOME_ROOT_DIR") + "/data/"
+    file = datadir + filename
+    if os.path.exists(file):
+        return file;
+
+    return None
+        
 #--------------------------------------------------------------------------
 # initialise the ORB
 orb = CORBA.ORB_init([''], CORBA.ORB_ID)
index 8550a196a829eee6821b08ab311d5daebe632aab..6b056326db2dd2aa6bad3be33a159f829e556ebf 100644 (file)
@@ -280,7 +280,7 @@ import os
 dir= os.getenv("SALOME_ROOT_DIR")
 if dir == None:
        raise RuntimeError, "SALOME_ROOT_DIR is not defined"
-xmlfile = dir +"/../SALOME_ROOT/SuperVisionTest/resources/GraphEssai.xml"
+xmlfile = dir +"/data/GraphEssai.xml"
 print "Load dataflow from the file : "
 print xmlfile
 print
@@ -418,7 +418,7 @@ import VISU
 import visu_gui
 
 medFile = "pointe.med"
-medFile = os.getenv('SALOME_ROOT_DIR') + '/../SALOME_ROOT/data/' + medFile
+medFile = os.getenv('SALOME_ROOT_DIR') + '/data/' + medFile
 print "Load ", medFile
 
 studyCurrent = salome.myStudyName
@@ -433,28 +433,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"; 
 
index cfeaf594583ea06da9d33dc00adff7f31d4078c1..9e95d0c62efb3512dc32783dd455cdf873d51ae8 100644 (file)
@@ -51,7 +51,7 @@ BIN_CLIENT_IDL = SALOMEDS.idl SALOMEDS_Attributes.idl SALOME_Component.idl SALOM
 
 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) -lSalomeNS -lSalomeGUI -lSalomeObject -lSalomeLifeCycleCORBA -lqsplitterP -lOpUtil -lSalomeLoggerServer -lPlot2d
+LDFLAGS+=$(QT_MT_LIBS)  -lSalomeNS -lSalomeGUI -lSalomeObject -lSalomeLifeCycleCORBA -lqsplitterP -lOpUtil -lSalomeLoggerServer -lPlot2d -lSalomeVTKFilter
 
 
 @CONCLUDE@
index a53193848d0b6819bb914a69d7a34ffc3debb0ca..99482aa3622354689f4948394e2b51c7afd4d06f 100644 (file)
@@ -28,7 +28,7 @@
 
 # include "Utils_ORB_INIT.hxx"
 # include "Utils_SINGLETON.hxx"
-
+# include "SALOME_NamingService.hxx"
 #include <iostream>
 #include <unistd.h>
 using namespace std;
@@ -61,9 +61,76 @@ int main(int argc, char **argv)
     ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting()) ;
     CORBA::ORB_var &orb = init( argc , argv ) ;
 
-    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_<SALOME_NamingService>::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");    
+       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);
+           }
+         catch( CORBA::COMM_FAILURE& )
+           {
+             MESSAGE( "Session Server: CORBA::COMM_FAILURE: Unable to contact the Naming Service" )
+               }
+         if(!CORBA::is_nil(inc)) {
+           MESSAGE( "Session 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( "Session Server: Logger Server wasn't found" ) }
+                 catch(...){ MESSAGE( "Session Server: Unknown exception" ) }
+                 if (!CORBA::is_nil(object))
+                   log = SALOME_Logger::Logger::_narrow(object);
+                 if (!CORBA::is_nil(log)){
+                   MESSAGE( "Session Server: Loger Server was found" )
+                     log->ping();
+                    SESSION=1;
+                   break;
+                 }
+               }}
+         }
+         if ((SESSION==1)||((EnvL==0)&&(!CORBA::is_nil(inc))))
+            break;
+             }
+    //
+   
     // servant
     SALOME_Session_i * mySALOME_Session = new SALOME_Session_i(argc, argv, orb, poa) ;
     PortableServer::ObjectId_var mySALOME_Sessionid = poa->activate_object(mySALOME_Session) ;
@@ -76,7 +143,7 @@ int main(int argc, char **argv)
 
     mySALOME_Session->_remove_ref() ;
 
-    PortableServer::POAManager_var pman = poa->the_POAManager() ;
+    //DECOMMENT PortableServer::POAManager_var pman = poa->the_POAManager() ;
     pman->activate() ;
     MESSAGE("pman->activate()")
 
index 666688ba9ca72c5d0126239ae5f6d754b974725f..41f346dedabb9b4d1f27bf1ba19028fed7b49bab 100644 (file)
@@ -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@
 
index a51debd21bae9ece81a87617429b77383f4700e2..03a9868616a7cce1ac8bec39c861edc387baa91f 100644 (file)
@@ -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@
index 14de77051264d06597819352161b42ffd29c4b5b..9849ce584bc5b451081003726348c614417794d4 100644 (file)
@@ -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_<SALOME_NamingService>::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/" ;
index 15e6208967fd2aa786b6187acfd16b8cace48013..3d562442d2867b40b2a99e2208d12194db09973a 100644 (file)
@@ -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@
 
index d9eb3a75c5b24879222f9f0b458514a4dbf8c951..b0cfe0abb33102f28d92d11dc6214ce37e6c9295 100644 (file)
@@ -31,6 +31,7 @@ using namespace std;
 #include "VTKViewer_RenderWindow.h"
 
 #include <qapplication.h>
+#include "QAD_Config.h"
 #include "QAD_Application.h"
 #include "QAD_Desktop.h"
 
@@ -51,6 +52,7 @@ using namespace std;
 #include <vtkPolyDataMapper.h>
 #include <vtkDataSetCollection.h>
 #include <vtkImageData.h>
+#include <vtkFollower.h>
 
 
 //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<VTKViewer_RenderWindow*>(this->Interactor->GetRenderWindow());
   if (myGUIWindow) myGUIWindow->update();
+
 }
 
 
index 5102249979fe4e6a777cda5d189dae24e41e5c8a..a8a9aa206359329d28f5ab9676bdddb99d3edb84 100644 (file)
@@ -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();
index 3ae42c55b30e9c1a6e1eecf4c0914030524a7e72..6072e344b883f9302822b24ca45bada172a5e646 100644 (file)
@@ -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) {
index 6d049b67ecd2a5cfcbaaae353bce438362f8fefa..4099a3fcd19ae5e7d7031a9897ad43e519170c58 100644 (file)
@@ -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);  
index ae35016b9deb87044fd24857003be06a02a6473b..b54107cd51a135e34e560f9f8579df89af503a09 100644 (file)
 //  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 <vtkActor.h>
 #include <vtkRenderer.h>
-#include <vtkTransform.h>
 #include <vtkPolyDataMapper.h> 
 
 #include <vtkMath.h>
-#include <vtkTextSource.h>
 #include <vtkLine.h>
 #include <vtkConeSource.h>
-#include <vtkTextMapper.h>
-#include <vtkMapper2D.h>
-#include <vtkActor2D.h>
-#include <vtkWindowToImageFilter.h>
-#include <vtkTIFFWriter.h>
-#include <vtkVectorText.h>
 #include <vtkFollower.h>
 
+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]<winsize[1] )
+    width=width*(float(winsize[1])/float(winsize[0]));
+  
   theRenderer->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();
 }