Salome HOME
PR: merge SalomePro 1_2d = mergefrom_BRANCH_MergeV1_2d
authorprascle <prascle>
Fri, 30 Jan 2004 13:28:12 +0000 (13:28 +0000)
committerprascle <prascle>
Fri, 30 Jan 2004 13:28:12 +0000 (13:28 +0000)
80 files changed:
INSTALL
bin/VERSION
bin/runSalome.py
doc/html/INPUT/doxyfile
doc/html/INPUT/sources/static/tree.js
idl/Makefile.in
idl/SALOMEDS.idl
idl/SALOMEDS_Attributes.idl
idl/SALOME_Component.idl
idl/SALOME_Exception.idl
idl/SALOME_GenericObj.idl [new file with mode: 0644]
idl/SALOME_ModuleCatalog.idl
idl/SALOME_Session.idl
src/Container/SALOME_ContainerPy.py
src/GenericObj/Makefile.in [new file with mode: 0644]
src/GenericObj/SALOME_GenericObj_i.cc [new file with mode: 0644]
src/GenericObj/SALOME_GenericObj_i.hh [new file with mode: 0644]
src/Logger/SALOME_Logger_Server.cxx
src/Logger/SALOME_Trace.cxx
src/Logger/SALOME_Trace.hxx
src/Logger/SALOME_Trace.py
src/Makefile.in
src/NamingService/SALOME_NamingServicePy.py
src/OBJECT/SALOME_Actor.cxx
src/OBJECT/SALOME_Actor.h
src/OCCViewer/OCCViewer_ViewFrame.cxx
src/OCCViewer/OCCViewer_ViewFrame.h
src/Plot2d/Plot2d_ViewFrame.h
src/RegistryDisplay/RegWidget.cxx
src/RegistryDisplay/RegWidgetFactory.cxx
src/SALOMEDS/Makefile.in
src/SALOMEDS/SALOMEDS_AttributeIOR_i.cxx
src/SALOMEDS/SALOMEDS_StudyBuilder_i.cxx
src/SALOMEDS/SALOMEDS_StudyBuilder_i.hxx
src/SALOMEDS/SALOMEDS_StudyManager_i.cxx
src/SALOMEDS/SALOMEDS_Study_i.cxx
src/SALOMEDS/SALOMEDS_Study_i.hxx
src/SALOMEDS/SALOMEDS_TableOfIntegerAttribute.cxx
src/SALOMEDS/SALOMEDS_TableOfRealAttribute.cxx
src/SALOMEDS/SALOMEDS_TableOfStringAttribute.cxx
src/SALOMEGUI/QAD_Application.cxx
src/SALOMEGUI/QAD_Desktop.cxx
src/SALOMEGUI/QAD_Desktop.h
src/SALOMEGUI/QAD_FileDlg.cxx
src/SALOMEGUI/QAD_HelpWindow.cxx
src/SALOMEGUI/QAD_ObjectBrowser.cxx
src/SALOMEGUI/QAD_ObjectBrowser.h
src/SALOMEGUI/QAD_Study.cxx
src/SALOMEGUI/QAD_Study.h
src/SALOMEGUI/QAD_StudyFrame.cxx
src/SALOMEGUI/QAD_StudyFrame.h
src/SALOMEGUI/QAD_Tools.cxx
src/SALOMEGUI/QAD_ViewFrame.h
src/SALOMEGUI/QAD_icons.po
src/SALOMEGUI/QAD_msg_en.po
src/SALOMEGUI/SALOMEGUI_Application.cxx
src/SALOMEGUI/SALOMEGUI_SetValueDlg.cxx
src/SALOMEGUI/SALOMEGUI_SetValueDlg.h
src/SALOMEGUI/SALOMEGUI_msg_en.po
src/SALOMEGUI/SALOMEGUI_msg_fr.po
src/SALOME_PYQT/SalomePyQt.cxx
src/SALOME_PYQT/SalomePyQt.hxx
src/SALOME_PYQT/SalomePyQt.sip
src/SALOME_SWIG/salome_test.py
src/SUPERVGraph/SUPERVGraph_ViewFrame.cxx
src/SUPERVGraph/SUPERVGraph_ViewFrame.h
src/Session/SALOME_Session_i.cxx
src/Utils/Utils_SINGLETON.hxx
src/VTKViewer/Makefile.in
src/VTKViewer/VTKViewer_InteractorStyleSALOME.cxx
src/VTKViewer/VTKViewer_InteractorStyleSALOME.h
src/VTKViewer/VTKViewer_RenderWindow.cxx
src/VTKViewer/VTKViewer_RenderWindowInteractor.cxx
src/VTKViewer/VTKViewer_RenderWindowInteractor.h
src/VTKViewer/VTKViewer_Trihedron.cxx [new file with mode: 0644]
src/VTKViewer/VTKViewer_Trihedron.h [new file with mode: 0644]
src/VTKViewer/VTKViewer_Utilities.cxx [new file with mode: 0644]
src/VTKViewer/VTKViewer_Utilities.h [new file with mode: 0644]
src/VTKViewer/VTKViewer_ViewFrame.cxx
src/VTKViewer/VTKViewer_ViewFrame.h

diff --git a/INSTALL b/INSTALL
index 7879c9772518fc0e76c257df14f8b1071e29761a..6334efe6a2bbd7a21a428b0f0f10ff7b8b0d1d44 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -1,4 +1,5 @@
-This is the version 1.3.0 of KERNEL
+This is the version 1.4.0 of KERNEL
 
 Previous versions :
+       - 1.3.0
        - 1.2.1
index 42b1f7f00b76626e32d0c5e4ebdbaf56f4395992..037ad6d66619d126cbd2c545d03a0b56210092ec 100755 (executable)
@@ -1 +1 @@
-THIS IS SALOME - KERNEL VERSION: 1.3.0
+THIS IS SALOME - KERNEL VERSION: 1.4.0
index d4a702a52b8e986b797aaaf56966448d11fb2da3..b9ccbd48a7e74eda78b7a14d6dc1d9f933597eac 100755 (executable)
@@ -256,7 +256,9 @@ for module in liste_modules:
     module_root_dir=modules_root_dir[module]
     add_ld_library_path(os.path.join(module_root_dir,"lib","salome"))
 
+os.environ["SALOME_trace"]="local"
 if with_logger:
+   os.environ["SALOME_trace"]="with_logger"
    locdir=os.environ['PWD']
    libtracedir=os.path.join(locdir,"libSalomeTrace")
    libtrace = os.path.join(kernel_root_dir,"lib","salome","libSALOMELoggerClient.so.0.0.0")
index 537e1c9df21f7c51e3c37a712e223920c87293cb..61c8e7ea348c9015ba26a59783ccde9acab25025 100755 (executable)
@@ -3,7 +3,7 @@
 #---------------------------------------------------------------------------
 # General configuration options
 #---------------------------------------------------------------------------
-PROJECT_NAME           = "SALOME v.1.3.0"
+PROJECT_NAME           = "SALOME v.1.4.0"
 PROJECT_NUMBER         = id#1.1
 OUTPUT_DIRECTORY       = ../
 OUTPUT_LANGUAGE        = English
index b4a9a0d1752d9f719c0c5004e41972b55e43b857..5e07feb1f57defbd1c1f007c34172a59b249935c 100755 (executable)
@@ -1,4 +1,4 @@
-foldersTree = gFld("<b>SALOME v.1.3.0 </b>", "", "")
+foldersTree = gFld("<b>SALOME v.1.4.0 </b>", "", "")
      insDoc(foldersTree, gLnk("Main Page", "", "main.html"))
 
 aux1 = insFld(foldersTree, gFld("TUI Reference Guide", ""))
index cda49464195cb14795774ee9ba870f522791f7f4..8033ab2b02cec0396c94c89a3935f89d0ac14481 100644 (file)
@@ -24,7 +24,8 @@ IDL_FILES = \
   TypeData.idl \
   MPIObject.idl \
   MPIContainer.idl \
-  Logger.idl
+  Logger.idl \
+  SALOME_GenericObj.idl
 
 PY_CLIENT_IDL = $(IDL_FILES)
 
index ed5f15d546e57fb63f2bf25f6b1f349977b61fc3..686297a177b385294053b54bb50d033f99a75147 100644 (file)
@@ -2,20 +2,20 @@
 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
 // 
 //  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 //  Lesser General Public License for more details.
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 //
 //
 //
@@ -23,8 +23,8 @@
 //  Author : Yves FRICAUD
 //  $Header$
 
-/*! \mainpage 
-    \image html Application-About.png    
+/*! \mainpage
+    \image html Application-About.png
 */
 
 /*!
@@ -62,20 +62,20 @@ module SALOMEDS
   typedef string SalomeReference;
 
 /*! 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 
+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
 */
   typedef sequence<string> ListOfFileNames;
-/*! List of modification dates of the study
+/*! List of modification dates of a study
 */
   typedef sequence<string> ListOfDates ;
 /*! An unbounded sequence of strings
 */
   typedef sequence<string> ListOfStrings ;
-/*! A byte stream which is used for binary data transfer between components
+/*! A byte stream which is used for binary data transfer between different components
 */
   typedef sequence<octet> TMPFile;
 
@@ -100,11 +100,11 @@ during each working session.
   interface UseCaseBuilder;
   interface Callback;
 
-/*! List of attributes
+/*! List of attributes of %SObjects
 */
   typedef sequence<GenericAttribute> ListOfAttributes;
 
-/*! Exception indicating that this feature hasn't been implemented
+/*! Exception indicating that this feature hasn't been implemented in %SALOME PRO application.
 */
   exception NotImplemented {};
 
@@ -127,6 +127,7 @@ during each working session.
 
   interface Study
   {
+
     exception StudyInvalidContext {};
     exception StudyInvalidComponent {};
 /*! Invalid directory of the %study exception
@@ -180,25 +181,40 @@ during each working session.
     SComponent FindComponentID(in ID aComponentID);
 /*!
     Allows to find a %SObject by the Name Attribute of this %SObject
+
+    \param anObjectName String parameter defining the name of the object
+    \return The obtained %SObject
+
 <BR><VAR>See also <A href=exemple/Example19.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 
 */
     SObject       FindObject      (in string anObjectName);
 /*!
     Allows to find a %SObject by its ID
+    \param aObjectID This parameter defines the ID of the required object
+    \return The obtained %SObject
+
 */
     SObject       FindObjectID    (in ID aObjectID);
 /*!
     Allows to find a %SObject by IOR of the object belonging to this %SObject.
+    \param anObjectName This parameter defines the IOR of the object
+    \return The obtained %SObject
+
 */
     SObject       FindObjectIOR   (in ID aObjectIOR);
 /*!
-    Returns a list of %SObjects belonging to this %Component. The Name Attribute
-    of these %SObjects should correspond to <VAR>anObjectName</VAR>.
+    Finds in the study all %SObjects produced by a given %Component.
+    \param anObjectName The Name Attribute of the searched %SObjects should correspond to <VAR>anObjectName</VAR>.
+    \param aComponentName The name of the component, which objects are searched for.
 */
     ListOfSObject FindObjectByName(in string anObjectName, in string aComponentName);
 /*!
     Allows to find a %SObject by the path to it.
+
+    \param thePath The path to the required %SObject.
+    \return The obtained %SObject.
+
 */
     SObject FindObjectByPath(in string thePath);
 /*!
@@ -208,12 +224,15 @@ during each working session.
 
 /*!
     Sets the context of the %Study.
+    \param thePath String parameter defining the context of the study.
+
 <BR><VAR>See also <A href=exemple/Example23.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 
 */
     void SetContext(in string thePath);
 /*!
-    Gets the context of the %Study
+    Gets the context of the %Study.
+    
 <BR><VAR>See also <A href=exemple/Example23.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 
 */
@@ -238,19 +257,24 @@ during each working session.
    \note  If the parameter <VAR>theContext</VAR> is empty, then the current context will be used.
 */
     ListOfStrings GetComponentNames(in string theContext);
-/*! \brief Creation of a new iterator of child levels
-
-    Creates a new iterator of child levels of the %SObject
+/*!
+    Creates a new iterator of child levels of the given %SObject.
+    \param aSO The given %SObject
+    \return A new iterator of child levels of the given %SObject.
 */
     ChildIterator      NewChildIterator(in SObject aSO);
-/*! \brief Creation of a new iterator of the %SComponent
+/*!
 
-    Creates a new iterator of the %SComponent.
+    Creates a new iterator of the %SComponents.
+
+    \return A new iterator of the %SComponents.
 */
     SComponentIterator NewComponentIterator();
-/*! \brief Creation of a %StudyBuilder
-
+/*!
    Creates a new %StudyBuilder to add or modify an object in the study.
+
+   \return A new %StudyBuilder.
+
 <BR><VAR>See also <A href=exemple/Example20.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 
 */
@@ -264,6 +288,7 @@ during each working session.
 /*! \brief Getting properties of the study
 
    Returns the attriubte, which contains the properties of this study.
+
 <BR><VAR>See also <A href=exemple/Example20.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 
 */
@@ -324,6 +349,17 @@ during each working session.
     Enables(if isEnabled = True)/disables automatic addition of new %SObjects to the use case.
 */
     void EnableUseCaseAutoFilling(in boolean isEnabled);
+
+/*!
+    Functions for internal usage only
+*/
+    void AddPostponed(in string theIOR);
+
+    void AddCreatedPostponed(in string theIOR);
+
+    void RemovePostponed(in long theUndoLimit);
+
+    void UndoPostponed(in long theWay);
   };
 
   //==========================================================================
@@ -354,49 +390,66 @@ during each working session.
 <BR><VAR>See also <A href=exemple/Example17.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 
 */
-    SComponent NewComponent(in string ComponentDataType);
+    SComponent NewComponent(in string ComponentDataType) raises(LockProtection);
 /*! \brief Definition of the instance to the %SComponent
 
     Defines the instance to the %SComponent.
 */
-    void       DefineComponentInstance (in SComponent aComponent,in Object ComponentIOR);
-/*! \brief Deletion of the %SComponent
+    void       DefineComponentInstance (in SComponent aComponent,in Object ComponentIOR) raises(LockProtection);
+/*! \brief Deletion of a %SComponent
 
-  Removes the %SComponent.
+  Removes a %SComponent.
 */
-    void       RemoveComponent(in SComponent aComponent);
+    void       RemoveComponent(in SComponent aComponent) raises(LockProtection);
 
 /*! \brief Creation of a new %SObject
 
-   Creates a new %SObject.
+   Creates a new %SObject under a definite father %SObject.
+
+   \param theFatherObject The father %SObject under which this one should be created.
+   \return New %SObject
+
 <BR><VAR>See also <A href=exemple/Example18.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 
 */
-    SObject NewObject      (in SObject theFatherObject);
+
+    SObject NewObject      (in SObject theFatherObject) raises(LockProtection);
+
 /*! \brief Creation of a new %SObject with a definite %tag
 
    Creates a new %SObject with a definite %tag.
+
+   \param atag Long value corresponding to the tag of the new %SObject.
+   \return New %SObject
+
 */
-    SObject NewObjectToTag (in SObject theFatherObject, in long atag);
+    SObject NewObjectToTag (in SObject theFatherObject, in long atag) raises(LockProtection);
 /*! \brief Deletion of the %SObject
 
   Removes a %SObject from the %StudyBuilder.
+
+  \param anObject The %SObject to be deleted.
 */
-    void    RemoveObject   (in SObject anObject);
+    void    RemoveObject   (in SObject anObject) raises(LockProtection);
 /*! \brief Deletion of the %SObject with all his child objects.
 
   Removes the %SObject with all his child objects.
+
+  \param anObject The %SObject to be deleted with all child objects.
 */
-    void    RemoveObjectWithChildren(in SObject anObject);
+    void    RemoveObjectWithChildren(in SObject anObject) raises(LockProtection);
 
 /*!
    Loads a %SComponent.
+
 <BR><VAR>See also <A href=exemple/Example19.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 
 */
     void  LoadWith (in SComponent sco, in Driver Engine) raises (SALOME::SALOME_Exception);
 /*!
    Loads a %SObject.
+
+   \param sco %SObject to be loaded.
 */
     void  Load (in SObject sco);
 
@@ -410,9 +463,9 @@ during each working session.
 */
 
     GenericAttribute FindOrCreateAttribute(in  SObject        anObject,
-                                        in  string         aTypeOfAttribute);
+                                        in  string         aTypeOfAttribute) raises(LockProtection);
 
-/*! \brief Looking for an attribute assigned to %SObject
+/*! \brief Looking for an attribute assigned to %SObject
 
     Allows to find an attribute of a specific type which is assigned to the object.
     \param anObject        The %SObject corresponding to the attribute which is looked for.
@@ -433,37 +486,46 @@ during each working session.
 <BR><VAR>See also <A href=exemple/Example17.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 */
     void RemoveAttribute(in  SObject        anObject,
-                               in  string         aTypeOfAttribute);
-/*! \brief Addition of a reference
-
+                        in  string         aTypeOfAttribute) raises(LockProtection);
+/*!
     Adds a reference between %anObject and %theReferencedObject.
+    \param anObject The %SObject which will get a reference
+    \param theReferencedObject The %SObject having a reference
 */
 
     void Addreference(in SObject anObject,
                      in SObject theReferencedObject) ;
 /*!
    Adds a directory in the %Study.
+   \param theName String parameter defining the name of the directory.
+
 <BR><VAR>See also <A href=exemple/Example23.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 
 */
-    void AddDirectory(in string theName);
+    void AddDirectory(in string theName) raises(LockProtection);
 
 /*! \brief Identification of the %SObject's substructure.
 
       Identification of the %SObject's substructure by GUID.
-      It has the following format "00000000-0000-0000-0000-000000000000"
+
+
+      \param anObject The %SObject which will be identified
+      \param theGUID GUID has the following format "00000000-0000-0000-0000-000000000000"
 */
 
-     void SetGUID(in SObject anObject, in string theGUID);
+     void SetGUID(in SObject anObject, in string theGUID) raises(LockProtection);
 /*!
+Searches for a definite %SObject with a definite GUID and returns True if it finds it.
 
-   Returns True if the %SObject has GUID.
+\param anObject A definite %SObject which will be identified
+\param theGUID GUID has the following format "00000000-0000-0000-0000-000000000000"
 */
      boolean IsGUID(in SObject anObject, in string theGUID);
 
 /*! \brief Creation of a new command
 
    Creates a new command which can contain several different actions.
+   
 <BR><VAR>See also <A href=exemple/Example3.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 
 */
@@ -471,6 +533,9 @@ during each working session.
 /*! \brief Execution of the command
 
    Commits all actions declared within this command.
+
+   \exception LockProtection This exception is raised, when trying to perform this command a study, which is protected for modifications.
+
 <BR><VAR>See also <A href=exemple/Example16.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 
 */
@@ -482,6 +547,7 @@ during each working session.
 /*! \brief Cancelation of the command
 
     Cancels all actions declared within the command.
+    
 <BR><VAR>See also <A href=exemple/Example17.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 */
     void AbortCommand(); // command management
@@ -493,6 +559,9 @@ during each working session.
 /*! \brief Undo method
 
     Cancels all actions of the last command.
+
+    \exception LockProtection This exception is raised, when trying to perform this command a study, which is protected for modifications.
+
 <BR><VAR>See also <A href=exemple/Example16.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 
 */
@@ -500,28 +569,40 @@ during each working session.
 /*! \brief Redo method
 
     Redoes all actions of the last command.
+
+\exception LockProtection This exception is raised, when trying to perform this command a study, which is protected for modifications.
+
  <BR><VAR>See also <A href=exemple/Example16.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 
 */
     void Redo() raises (LockProtection);
 /*!
     Returns True if at this moment there are any actions which can be canceled.
+    
    <BR><VAR>See also <A href=exemple/Example16.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 
 */
     boolean GetAvailableUndos();
 /*!
     Returns True if at this moment there are any actions which can be redone.
+
    <BR><VAR>See also <A href=exemple/Example3.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 
 */
     boolean GetAvailableRedos();
 /*!
-    Sets the callback for addition of the given %SObject. Returns the previous callback.
+    This method is called when adding an object into study.
+    It sets the callback for addition of the given %SObject.
+    \param theCallback New assigned callback.
+    \return The previous callback.
 */
     Callback SetOnAddSObject(in Callback theCallback);
 /*!
-    Sets the callback for removal of the given %SObject. Returns the previous callback.
+    This method is called when adding an object into study.
+    It sets the callback for removal of the given %SObject.
+
+    \return The previous callback.
+    \param theCallback New assigned callback.
 */
     Callback SetOnRemoveSObject(in Callback theCallback);
 
@@ -545,9 +626,12 @@ during each working session.
 */
     void ping();
 
-/*! \brief Creation of a new %Study
+/*! \brief Creation of a new study
+
+     Creates a new study with a definite name.
+
+     \param study_name String parameter defining the name of the study
 
-     Creates a new %Study with a definite name.
 <BR><VAR>See also <A href=exemple/Example17.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 
 */
@@ -556,33 +640,39 @@ during each working session.
 /*! \brief Open a study
 
      Reads and activates the structure of the study %Objects.
+     \param aStudyUrl The path to the study
     \warning This method doesn't activate the corba objects. Only a component can do it.
+
 <BR><VAR>See also <A href=exemple/Example1.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 */
     Study Open (in URL aStudyUrl) raises (SALOME::SALOME_Exception);
 
 /*! \brief Closing the study
 
-    Closes the study.
+    Closes a study.
 */
     void  Close(in Study aStudy);
 /*! \brief Saving the study in a HDF file (or files).
 
-    Saves the study.
+    Saves a 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).
+/*! \brief Saving a study in a ASCII file (or files).
 
-    Saves the study in a ASCII format.
+    Saves a study in an ASCII format file (or files).
     \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 specified HDF file (or files).
 
     Saves the study in a specified file (or files).
+    \param aUrl The path to the definite file in whcih the study will be saved
+    \param aStudy The study which will be saved
     \param theMultiFile If this parameter is True the study will be saved in several files.
 
  <BR><VAR>See also <A href=exemple/Example1.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
@@ -593,6 +683,9 @@ during each working session.
 /*! \brief Saving the study in a specified ASCII file (or files).
 
     Saves the study in a specified ASCII file (or files).
+
+    \param aUrl The path to the definite file in whcih the study will be saved
+    \param aStudy The study which will be saved
     \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
@@ -602,21 +695,25 @@ during each working session.
 
 /*! \brief List of open studies.
 
-    Returns the list of open studies in the current session.
+Gets the list of open studies
+
+    \return A list of open studies in the current session.
 */
     ListOfOpenStudies GetOpenStudies();
 
 /*! \brief Getting a particular %Study picked by name
 
     Activates a particular %Study
-    amongst the session collection picking it by name.
+    among the session collection picking it by name.
+    \param aStudyName The name of the study
 */
     Study GetStudyByName  (in string aStudyName);
 
 /*! \brief Getting a particular %Study picked by ID
 
     Activates a particular %Study
-    amongst the session collection picking it by ID.
+    among the session collection picking it by ID.
+    \param aStudyID The ID of the study
 */
     Study GetStudyByID  (in short aStudyID);
 
@@ -628,14 +725,19 @@ during each working session.
     boolean CanCopy(in SObject theObject);
 /*!
     Returns True, if the given %SObject is copied to the clipboard.
+    \param theObject The %SObject which will be copied
 */
     boolean Copy(in SObject theObject);
 /*!
     Returns True, if the object from the clipboard can be pasted to the given %SObject.
+    \param theObject The %SObject stored in the clipboard.
 */
     boolean CanPaste(in SObject theObject);
 /*!
     Returns the %SObject in which the object from the clipboard was pasted to.
+    \param theObject The %SObject which will be pasted
+    \exception SALOMEDS::StudyBuilder::LockProtection This exception is raised, when trying to paste
+    an object into a study, which is protected for modifications.
 */
     SObject Paste(in SObject theObject) raises (SALOMEDS::StudyBuilder::LockProtection);
   };
@@ -647,6 +749,7 @@ during each working session.
    The objects in the %study are built by the %StudyBuilder. The %SObject interface
    provides methods for elementary inquiries, like getting an object %ID or its attribuites.
  \note
    <BR><VAR>Tag</VAR> of an item in %SALOME application is an integer value uniquely defining an item
    in the tree-type data structure.
    <BR><VAR>ID</VAR> of an item is a description of item's position in the tree-type data structure.
@@ -659,54 +762,59 @@ during each working session.
 /*! Name of the %SObject
 */
     attribute string Name; // equivalent to setName() & getName()
-/*! \brief Getting an object %ID
+/*! Gets an object %ID
 
-   Returns ID of the %SObject.
+   \return ID of the %SObject.
 */
     ID GetID();
-/*! \brief Acquisition of the father %Component of the %SObject
+/*!  Acquisition of the father %Component of the %SObject
 
-  Returns the father %Component of the %SObject.
+  \return The father %Component of the %SObject.
 */
     SComponent GetFatherComponent();
-/*! \brief Acquisition of the father %SObject of the %SObject
+/*! Acquisition of the father %SObject of the %SObject
 
-   Returns the father %SObject of the given %SObject.
+   \return the father %SObject of the given %SObject.
 */
     SObject    GetFather();
-/*! \brief %Tag of %SObject
+/*! Gets the %tag of a %SObject
 
-    Returns the %tag of the %SObject.
+    \return the %tag of a %SObject.
 */
     short      Tag();
-/*! \brief Looking for subobjects of an object.
+/*! Looks for subobjects of a given %SObject.
 
-    Returns True if it finds a subobject of the %SObject with a definite tag.
+    \param atag Tag of the given %SObject
+    \return True if it finds a subobject of the %SObject with a definite tag as well as the required subobject.
 */
 
     boolean FindSubObject (in long atag, out SObject obj);
-/*! \brief Looking for attributes of the %SObject
+/*! Looks for attributes of a given %SObject
+
+   \param aTypeOfAttribute String value defining the type of the required attribute of the given %SObject.
+   \return True if it finds an attribute of a definite type of the given %SObject as well as the discovered attribute.
 
-   Returns True if it finds an attribute of a definite type of the %SObject.
 <BR><VAR>See also <A href=exemple/Example1.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 */
     boolean FindAttribute(out GenericAttribute anAttribute,
                                  in  string         aTypeOfAttribute);
-/*!
-    Returns the object which this %SObject refers to. It also returns True if it finds
+/*! Looks for a %SObject which the given %SObject refers to.
+
+    \return The object which the given %SObject refers to as well as True if it finds
     this object.
 */
     boolean ReferencedObject(out SObject obj); // A REVOIR
-/*! \brief Getting all attributes of the %SObject
+/*! Gets all attributes of a given %SObject
+
+    \return The list of all attributes of the given %SObject.
 
-    Returns the list of all attributes of the %SObject.
 <BR><VAR>See also <A href=exemple/Example17.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 
 */
     ListOfAttributes     GetAllAttributes();
-/*! \brief Returning the study
+/*! Gets the study of a given %SObject.
 
-    Returns the study containing the given %SObject.
+    /return The study containing the given %SObject.
 */
     Study GetStudy();
   };
@@ -728,7 +836,8 @@ during each working session.
 /*! \brief Method CheckLocked
 
    Checks whether the %Study is protected for modifications.
-   \note <BR>This exception is raised only outside the transaction.
+
+   \note <BR>This exception is raised only outside a transaction.
 */
     void CheckLocked() raises (LockProtection);
   };
@@ -745,13 +854,14 @@ during each working session.
   //==========================================================================
   interface SComponent : SObject
   {
-/*! \brief Data type of the %SComponent
+/*! Gets the data type of the given %SComponent
 
-    Returns the data type of the %SComponent.
+    \return The data type of this %SComponent.
 */
     string  ComponentDataType();
-/*!
-  Returns IOR of the according component.
+/*! Gets the IOR of the given component
+
+  \return True (if there is an instance of the given component) and its IOR.
 */
     boolean ComponentIOR (out ID theID); //returns True if there is an instance
                                          //In this case ID identifies this one
@@ -767,23 +877,22 @@ during each working session.
   //==========================================================================
   interface SComponentIterator
   {
-/*! \brief Initialization of the Iterator
-
+/*!
 Activates the %SComponentIterator.
 */
     void Init();
-/*! \brief Method More
+/*!  Method More
 
-   Returns True if there is one more %SComponent in the list.
+   \return True if there is one more %SComponent in the list.
 */
     boolean More();
-/*! \brief Moving the iterator to the next %SComponent
-
+/*!
 Moves the iterator to the next %SComponent in the list.
 */
     void Next();
 /*!
     Returns the %SComponent corresponding to the current %SComponent found by the iterator.
+
  <BR><VAR>See also <A href=exemple/Example1.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 
 */
@@ -799,19 +908,21 @@ Moves the iterator to the next %SComponent in the list.
   //==========================================================================
   interface ChildIterator
   {
-/*! \brief Initialization of the Iterator.
+/*!
 
 Activates the %ChildIterator.
 */
     void Init();
-/*! \brief Initialization of the Iterator for all child levels.
+/*!
+
+Activates the %ChildIterator for all child levels.
 
-Activates the %ChildIterator (if True) for all child levels.
+\param allLevels If this boolean parameter is True, the %ChildIterator will be activated for all child levels.
 */
     void InitEx(in boolean allLevels);
-/*! \brief Method More
+/*! Method More
 
-    Returns True if the %ChildIterator finds one more child level.
+   \return True if there is one more %ChildIterator in the list.
 */
     boolean More();
 /*!
@@ -832,14 +943,14 @@ Activates the %ChildIterator (if True) for all child levels.
 */
   interface UseCaseIterator
   {
-/*! \brief Initialization of the Iterator.
-
-Activates the %UseCaseIterator. If <VAR>allLevels</VAR> is True the Iterator is activated for all subobjects.
+/*!
+Activates the %UseCaseIterator.
+\param allLevels If the value of this parameter is True the Iterator is activated for all subobjects.
 */
     void Init(in boolean allLevels);
-/*! \brief Method More
+/*! Method More
 
-    Returns True if the %UseCaseIterator finds one more object.
+    \return True if the %UseCaseIterator finds one more object.
 */
     boolean More();
 /*!
@@ -862,11 +973,17 @@ Activates the %UseCaseIterator. If <VAR>allLevels</VAR> is True the Iterator is
   interface UseCaseBuilder
   {
 /*!
-   Adds to the use case an object <VAR>theObject</VAR> as a child of the current object of the use case.
+   Adds to the use case an object as a child of the current object of the use case.
+
+   \param theObject The added %SObject.
+   \return True if this %SObject has been added in the use case.
 */
     boolean Append(in SObject theObject);
 /*!
-   Removes an object <VAR>theObject</VAR> from the use case.
+   Removes an object from the use case.
+
+   \param theObject The deleted %SObject
+   \return True if this %SObject has been deleted from the use case.
 */
     boolean Remove(in SObject theObject);
 /*!
@@ -936,17 +1053,26 @@ Activates the %UseCaseIterator. If <VAR>allLevels</VAR> is True the Iterator is
   //==========================================================================
 /*! \brief %Driver interface
 
-    This interface contains a set of methods used for the management
-     of the object produced in the %study by a component.
+This class represents a common tool for all components integrated into SALOME application, that allows them to communicate with the study. It contains a set of methods which
+can be called by any component and which provide the following functionality:
+<ul>
+    <li> publishing in the study of the objects created by a definite component
+    <li> saving/loading of the data created by a definite component. These methods are called by the StudyManager when loading/saving a study containing the data created by a definite component.
+    <li> transforming of the transient references into persistant references (or vice versa) of the SObjects when saving (or loading) a study
+    <li> copy/paste common functionality. These methods can be called by any component in order to copy/paste its object created in the study
+</ul>
+
 */
   //==========================================================================
   interface Driver
   {
 
-    /*! \brief Saving the data.
+    /*! \brief Saving the data produced by a definite component.
 
         This method is called by the StudyManager when saving a study.
        \param theComponent    %SComponent corresponding to this Component
+       \param theURL  The path to the file in which the data will be saved.
+       \param isMultiFile  If the value of this boolean parameter is True, the data will be saved in several files.
        \return A byte stream TMPFile that contains all saved data
 
 <BR><VAR>See also <A href=exemple/Example19.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
@@ -956,6 +1082,17 @@ Activates the %UseCaseIterator. If <VAR>allLevels</VAR> is True the Iterator is
 
     TMPFile Save(in SComponent theComponent, in string theURL, in boolean isMultiFile);
 
+/*! \brief Saving the data in ASCII format produced by a definite component.
+
+        This method is called by the StudyManager when saving a study in ASCII format.
+       \param theComponent    %SComponent corresponding to this Component
+       \param theURL  The path to the file in which the data will be saved.
+       \param isMultiFile  If the value of this boolean parameter is True, the data will be saved in several files.
+       \return A byte stream TMPFile that will contain all saved data
+
+<BR><VAR>See also <A href=exemple/Example19.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
+
+     */
     TMPFile SaveASCII(in SComponent theComponent, in string theURL, in boolean isMultiFile);
 
     /*! \brief Loading the data.
@@ -963,32 +1100,53 @@ Activates the %UseCaseIterator. If <VAR>allLevels</VAR> is True the Iterator is
        This method is called by the StudyManager when opening a study.
        \param theComponent      %SComponent corresponding to this Component
        \param theStream   The file which contains all data saved by the component on Save method
+       \param isMultiFile  If the value of this boolean parameter is True, the data will be loaded from several files
+
      */
 
     boolean Load(in SComponent theComponent, in TMPFile theStream, in string theURL, in boolean isMultiFile);
 
+    /*! \brief Loading the data from files in ASCII format.
+
+       This method is called by the StudyManager when opening a study.
+       \param theComponent      %SComponent corresponding to this Component
+       \param theStream   The file which contains all data saved by the component on Save method
+       \param isMultiFile  If the value of this boolean parameter is True, the data will be loaded from several files
+
+     */
+
     boolean LoadASCII(in SComponent theComponent, in TMPFile theStream, in string theURL, in boolean isMultiFile);
 
     /*! \brief Closing of the study
 
       This method Close is called by the StudyManager when closing a study.
-
+    \param aSComponent The according %SComponent
      */
 
     void Close (in SComponent aSComponent);
     //void Close ( in string  aIORSComponent);
 
-    /*! \brief The type of the data
+    /*! Gets the type of the data
 
-        Returns the type of data produced by the Component in the study.
+        \return The type of data produced by the Component in the study.
      */
 
      string ComponentDataType();
 
     // Driver Transient -> persistent called for each object in study
 /*!
-   Transforms IOR into PersistentID of the object. It is called for each
+   Transforms IOR of a given %SObject into PersistentID. It is called for each
    object in the %study.
+\note <br> In %SALOME the objects which are present in an active study are identified by an IOR, when this
+study is saved these references are transformed into persintent IDs.
+
+   \param theSObject The given %SObject.
+   \param IORString The IOR of the given %SObject.
+   \param isMultiFile If this parameter is True the study containing the given %SObject is stored in several files.
+   \param isASCII If this parameter is True the study containing the given %SObject is stored in ASCII format.
+
+   \return The persistent ID of the given %SObject
+
 */
     string IORToLocalPersistentID (in SObject theSObject,
                                   in string IORString,
@@ -997,6 +1155,17 @@ Activates the %UseCaseIterator. If <VAR>allLevels</VAR> is True the Iterator is
 /*!
   Transforms PersistentID into IOR of the object. It is called for each
    object in the %study.
+
+   \note <br> In %SALOME the objects which are present in an saved study (file) are identified by a persistent ID, when this
+study is open, these references are transformed into persintent IORs.
+
+   \param theSObject The given %SObject.
+   \param IORString The IOR of the given %SObject.
+   \param isMultiFile If this parameter is True the study containing the given %SObject is stored in several files.
+   \param isASCII If this parameter is True the study containing the given %SObject is stored in ASCII format.
+
+   \return The IOR of the given %SObject
+
 */
     string LocalPersistentIDToIOR (in SObject theSObject,
                                   in string aLocalPersistentID,
@@ -1005,9 +1174,10 @@ Activates the %UseCaseIterator. If <VAR>allLevels</VAR> is True the Iterator is
       raises (SALOME::SALOME_Exception);
 
     // Publishing in the study
-/*! \brief Publishing in the study
+/*! Publishing in the study
 
-    Returns True if the given %Component can publish the %object in the %study.
+    \return True if the given %Component can publish a definite object with a given IOR in the %study.
+    \param theIOR The IOR of a definite object
 */
     boolean CanPublishInStudy(in Object theIOR) raises (SALOME::SALOME_Exception);
 /*! \brief Publishing in the study
@@ -1019,6 +1189,8 @@ Activates the %UseCaseIterator. If <VAR>allLevels</VAR> is True the Iterator is
     \param theObject      The object which is published
     \param theName      The name of the published object. If this parameter is empty, the name is generated
     automatically by the component.
+
+    \return The published %SObject.
 */
     SObject PublishInStudy(in Study theStudy, in SObject theSObject, in Object theObject, in string theName);
 
@@ -1026,6 +1198,8 @@ Activates the %UseCaseIterator. If <VAR>allLevels</VAR> is True the Iterator is
 
 /*!
     Returns True, if the given %SObject can be copied to the clipboard.
+
+    \param theObject The given %SObject which should be copied.
 */
     boolean CanCopy(in SObject theObject);
 /*!
index fca28960a879f96105352d06cf3075534c05c830..27f1f6dbdcf70322f462f17e75bbc08987ea33cb 100644 (file)
@@ -42,18 +42,19 @@ module SALOMEDS
 /*! Sequence of string values
 */
   typedef sequence <string> StringSeq;
-/*! \struct Color 
-   This structure stores a set of elements defining the color based on RGB.
+/*! \struct Color
+   This structure stores a set of elements defining the color based on RGB palette. These elements are
+   used as input parameters for methods necessary for color definition of different items.
 */
   struct Color {
 /*! Red color
-*/  
+*/
    double R;
 /*! Green color
-*/ 
+*/
    double G;
 /*! Blue color
-*/ 
+*/
    double B;
   };
   //==========================================================================
@@ -66,11 +67,13 @@ module SALOMEDS
   {
 /*!
     Returns the value of this attribute.
+
 <BR><VAR>See also <A href=exemple/Example1.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 */
     double Value();
 /*!
    Sets the value of this attribute.
+
 <BR><VAR>See also <A href=exemple/Example1.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 */
     void   SetValue(in double value);
@@ -85,11 +88,13 @@ module SALOMEDS
   {
 /*!
     Returns the value of this attribute
+
 <BR><VAR>See also <A href=exemple/Example1.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 */
     long   Value();
 /*!
    Sets the value of this attribute
+
 <BR><VAR>See also <A href=exemple/Example1.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 */
     void   SetValue(in long value);
@@ -113,6 +118,7 @@ module SALOMEDS
     DoubleSeq CorbaSequence();
 /*!
    Adds to the end of the sequence a real number.
+
    \param value    A real number added to the sequence.
 
 <BR><VAR>See also <A href=exemple/Example3.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
@@ -121,22 +127,30 @@ module SALOMEDS
 /*!
     Removes a real number with a definite index
     from the sequence of real numbers stored in the Attribute.
+
+    \param index The index of the given real number
 */
     void      Remove(in long index);
 /*!
-    Substitutes a real number with a definite index for another real number.
+    Substitutes a given real number with a definite index for another real number.
+    \param index The index of the given real number.
+    \param value The value of another real number.
+
 <BR><VAR>See also <A href=exemple/Example3.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 
 */
     void      ChangeValue(in long index, in double value);
 /*!
-  Returns a real number with a definite index
+  Returns a given real number with a definite index
     in the sequence of real numbers stored in the Attribute.
+    \param index The index of the given real number.
+
 <BR><VAR>See also <A href=exemple/Example1.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 */
     double    Value(in short index);
 /*!
     Returns the length of the sequence of real numbers stored in the Attribute.
+
 <BR><VAR>See also <A href=exemple/Example3.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 
 */
@@ -151,7 +165,7 @@ module SALOMEDS
   interface AttributeSequenceOfInteger : GenericAttribute
   {
 /*!
-   Initialization of the attribute with initial data.
+   Initialisation of the attribute with initial data.
    \param other    Initially assigned sequence of integer numbers.
 */
     void      Assign (in LongSeq other);
@@ -170,22 +184,30 @@ module SALOMEDS
 /*!
     Removes an integer number with a definite index
     from the sequence of integer numbers stored in the Attribute.
+    \param index The index of the given integer number.
+
 <BR><VAR>See also <A href=exemple/Example3.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 
 */
     void      Remove(in long index);
 /*!
     Substitutes an integer number with a definite index for another integer number.
+    \param index The index of the given integer number.
+    \param value The value of another integer number.
+
 */
     void      ChangeValue(in long index, in long value);
 /*!
-   Returns an integer number with a definite index
+   Returns a given integer number with a definite index
     in the sequence of integer numbers stored in the Attribute.
+    \param index The index of the given integer number.
+
 <BR><VAR>See also <A href=exemple/Example1.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 */
     long      Value(in short index);
 /*!
     Returns the length of the sequence of integer numbers stored in the Attribute.
+
 <BR><VAR>See also <A href=exemple/Example3.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 
 */
@@ -204,11 +226,15 @@ module SALOMEDS
   {
 /*!
     Returns the value of this attribute
+
 <BR><VAR>See also <A href=exemple/Example1.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 */
     string Value();
 /*!
    Sets the value of this attribute
+
+   \param value This parameter defines the value of this attribute.
+
 <BR><VAR>See also <A href=exemple/Example1.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 */
     void   SetValue(in string value);
@@ -225,11 +251,14 @@ module SALOMEDS
   {
 /*!
     Returns the value of this attribute
+
 <BR><VAR>See also <A href=exemple/Example1.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 */
     string Value();
 /*!
    Sets the value of this attribute
+   \param value This string parameter defines the value of this attribute - a description of a %SObject.
+
 <BR><VAR>See also <A href=exemple/Example1.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 */
     void   SetValue(in string value);
@@ -245,11 +274,14 @@ module SALOMEDS
   {
 /*!
     Returns the value of this attribute
+
 <BR><VAR>See also <A href=exemple/Example1.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 */
     string Value();
 /*!
    Sets the value of this attribute
+   \param value This parameter defines the value of this attribute - IOR of a %SObject.
+
 <BR><VAR>See also <A href=exemple/Example1.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 */
     void   SetValue(in string value);
@@ -265,11 +297,14 @@ module SALOMEDS
   {
 /*!
     Returns the value of this attribute
+
 <BR><VAR>See also <A href=exemple/Example1.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 */
     string Value();
 /*!
    Sets the value of this attribute
+   \param value This parameter defines the value of this attribute.
+
 <BR><VAR>See also <A href=exemple/Example1.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 */
     void   SetValue(in string value);
@@ -323,20 +358,24 @@ module SALOMEDS
   //==========================================================================
 /*! \brief Drawable flag Attribute.
 
-   This is a presentation attribute necessary for display of the study tree in the browser.
-   The item associated to SObject is created/displayed if TRUE.
+   This is a presentation attribute necessary for display of a study tree in the browser.
+   The item associated to a %SObject is created/displayed if TRUE.
 */
   //==========================================================================
   interface AttributeDrawable : GenericAttribute
   {
 /*!
    Returns TRUE if the item is drawable (as it is by default) and FALSE if it isn't.
+
 <BR><VAR>See also <A href=exemple/Example8.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 
 */
     boolean IsDrawable();
 /*!
-Sets the items to be drawable if <VAR>value</VAR> is TRUE (the default) or not to be selectable if <VAR>value</VAR>is FALSE.
+Sets the item to be drawable.
+
+\param value If the value of this boolean parameter is TRUE (default) the item will be drawable.
+
 <BR><VAR>See also <A href=exemple/Example8.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 
 */
@@ -354,12 +393,17 @@ Sets the items to be drawable if <VAR>value</VAR> is TRUE (the default) or not t
   {
 /*!
    Returns TRUE if the item is selectable (as it is by default) and FALSE if it isn't.
+
+
 <BR><VAR>See also <A href=exemple/Example9.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 
 */
     boolean IsSelectable();
 /*!
-Sets the items to be selectable if <VAR>value</VAR> is TRUE (the default) or not to be selectable if <VAR>value</VAR>is FALSE.
+Sets the item to be selectable
+
+\param value If the value of this parameter is TRUE (the default) the item will be set as selectable.
+
 <BR><VAR>See also <A href=exemple/Example9.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 
 */
@@ -378,13 +422,15 @@ Sets the items to be selectable if <VAR>value</VAR> is TRUE (the default) or not
   {
 /*!
     Returns TRUE if this item is expandable even when it has no children.
+
 <BR><VAR>See also <A href=exemple/Example10.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 
 */
     boolean IsExpandable();
-/*!
-   Sets this item to be expandable even if it has no children if <VAR>value</VAR> is TRUE, and to be
-   expandable only if it has children if <VAR>value</VAR> is FALSE (the default).
+/*! Sets this item to be expandable even if it has no children.
+
+ \param value If the value of this boolean parameter is TRUE, this item will be set as expandable.
+
 <BR><VAR>See also <A href=exemple/Example10.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 
 */
@@ -403,13 +449,17 @@ Sets the items to be selectable if <VAR>value</VAR> is TRUE (the default) or not
   {
 /*!
     Returns TRUE if this item is open (its children are visible) and FALSE if it isn't.
+
 <BR><VAR>See also <A href=exemple/Example11.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 
 */
     boolean IsOpened();
 /*!
-   Sets this item to be open (its children are visible) if <VAR>value</VAR> is TRUE, and to be closed
-(its children are not visible) if <VAR>value</VAR> is FALSE.
+   Sets this item to be open (its children are visible)
+
+   \param value If the value of this boolean parameter is TRUE this item will be set as open,
+    and as closed if FALSE.
+
 <BR><VAR>See also <A href=exemple/Example11.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 
 */
@@ -425,12 +475,16 @@ Sets the items to be selectable if <VAR>value</VAR> is TRUE (the default) or not
   {
 /*!
    Returns the color of an item.
+
 <BR><VAR>See also <A href=exemple/Example12.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 
 */
     Color TextColor();
 /*!
    Sets the color of an item.
+
+   \param value This parameter defines the color of the item.
+
 <BR><VAR>See also <A href=exemple/Example12.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 
 */
@@ -447,12 +501,17 @@ Sets the items to be selectable if <VAR>value</VAR> is TRUE (the default) or not
   {
 /*!
    Returns the highlight color of an item.
+
+
+
 <BR><VAR>See also <A href=exemple/Example13.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 
 */
     Color TextHighlightColor();
 /*!
    Sets the highlight color of an item.
+   \param value This parameter defines the highlight color of the item.
+
 <BR><VAR>See also <A href=exemple/Example13.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 
 */
@@ -467,17 +526,20 @@ Sets the items to be selectable if <VAR>value</VAR> is TRUE (the default) or not
   interface AttributePixMap : GenericAttribute
   {
 /*!
-   Returns True if there is an icon before the name of the item.
+   Returns True if there is an icon before the name of the given item.
 */
     boolean HasPixMap();
 /*!
-   Returns the name of the icon.
+   Returns the name of the icon in the format of a string.
+
 <BR><VAR>See also <A href=exemple/Example14.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 
 */
     string  GetPixMap();
 /*!
    Sets the name of the icon.
+   \param value This string parameter defines the name of the icon.
+
 <BR><VAR>See also <A href=exemple/Example14.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 
 */
@@ -490,6 +552,7 @@ Sets the items to be selectable if <VAR>value</VAR> is TRUE (the default) or not
    A set of these attributes on the %SObjects of the %study forms an inner auxiliary
    tree whith its own structure and identifier. The quantity of such trees with different
    identifiers can be arbitrary.
+
 <BR><VAR>See also <A href=exemple/Example18.html> an example </A> of usage of the methods of this interface in batchmode of %SALOME application.</VAR>
 
 */
@@ -497,108 +560,112 @@ Sets the items to be selectable if <VAR>value</VAR> is TRUE (the default) or not
   interface AttributeTreeNode : GenericAttribute
   {
 /*!
-  Sets the father TreeNode to this TreeNode.
+  Assigns the father tree node to this tree node.
 */
     void              SetFather(in AttributeTreeNode value);
 /*!
-  Returns True if there is the father TreeNode of this TreeNode.
+  Returns True if there is a father tree node of this tree node.
 */
     boolean           HasFather();
 /*!
-  Returns the father Treenode of this TreeNode.
+  Returns the father tree node of this tree node.
 */
     AttributeTreeNode GetFather();
 /*!
-  Sets the previous brother TreeNode to this treeNode.
+  Assigns the previous brother tree node to the given tree node.
 */
     void              SetPrevious(in AttributeTreeNode value);
 /*!
-  Returns True if there is the previous brother TreeNode of this TreeNode.
+  Returns True if there is the previous brother tree node of this tree node.
 */
     boolean           HasPrevious();
 /*!
-  Returns the previous brother TreeNode of this TreeNode.
+  Returns the previous brother tree node of this tree node.
 */
     AttributeTreeNode GetPrevious();
 /*!
-  Sets the next brother TreeNode to this treeNode.
+  Sets the next brother tree node to this tree node.
 */
     void              SetNext(in AttributeTreeNode value);
 /*!
-  Returns True if there is the next brother TreeNode of this TreeNode.
+  Returns True if there is the next brother tree node of this tree node.
 */
     boolean           HasNext();
 /*!
-  Returns the previous brother TreeNode of this TreeNode.
+  Returns the previous brother tree node of this tree node.
 */
     AttributeTreeNode GetNext();
 /*!
-  Sets the first child TreeNode to this treeNode.
+  Sets the first child tree node to this tree node.
 */
     void              SetFirst(in AttributeTreeNode value);
 /*!
-  Returns True if there is the first child TreeNode of this TreeNode.
+  Returns True if there is the first child tree node of this tree node.
 */
     boolean           HasFirst();
 /*!
-  Returns the first child TreeNode of this TreeNode.
+  Returns the first child tree node of this tree node.
 */
     AttributeTreeNode GetFirst();
 /*!
-  Sets ID of the tree. TreeNodes of one tree have the same ID.
+  Sets ID of a tree.
+  \param value String parameter defining the ID of a tree.
+  \note <br>Tree nodes of one tree have the same ID.
 */
     void              SetTreeID(in string value);
 /*!
-  Gets ID of the tree.
+  Gets ID of a tree.
+  \return An ID of a tree in the format of a string.
 */
     string            GetTreeID();
 
 /*!
-   Adds a child TreeNode to the end of the list of children of this Treenode.
+   Adds a child tree node to the end of the list of children of this tree node.
 */
     void              Append(in AttributeTreeNode value);
 /*!
-   Adds a child TreeNode to the beginning of the list of children of this Treenode.
+   Adds a child tree node to the beginning of the list of children of this tree node.
 
 */
     void              Prepend(in AttributeTreeNode value);
 /*!
-   Adds a brother TreeNode before this Treenode.
-    In this case the both TreeNodes will belong to the same father.
+   Adds a brother tree node before this tree node.
+    In this case the both tree nodes will belong to the same father.
 */
     void              InsertBefore(in AttributeTreeNode value);
 /*!
-   Adds a brother TreeNode after this Treenode.
-    In this case the both TreeNodes will belong to the same father.
+   Adds a brother tree node after this tree node.
+    In this case the both tree nodes will belong to the same father.
 */
     void              InsertAfter(in AttributeTreeNode value);
 /*!
-   Deletes a TreeNode.
+   Deletes a tree node.
+
 <BR><VAR>See also <A href=exemple/Example3.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 
 */
     void              Remove();
 
 /*!
-   Returns  the  depth  of the TreeNode in the
-   structure, it means the  number of  fathers of the given TreeNode.
-   (i.e.: the depth of the root TreeNode is 0).
+   Returns  the  depth  of the tree node in the
+   structure, it means the  number of  fathers of the given tree node.
+   (i.e.: the depth of the root tree node is 0).
 */
     long              Depth();
 /*!
-    Returns True if it is a root TreeNode.
+    Returns True if it is a root tree node.
 */
     boolean           IsRoot();
 /*!
-    Returns True if this TreeNode is a descendant of the TreeNode.
+    Returns True if this tree node is a descendant of the tree node.
 */
     boolean           IsDescendant(in AttributeTreeNode value);
 /*!
-    Returns True if this TreeNode is the father of the TreeNode.
+    Returns True if this tree node is the father of the tree node.
 */
     boolean           IsFather(in AttributeTreeNode value);
 /*!
-    Returns True if this TreeNode is a child of the TreeNode.
+    Returns True if this tree node is a child of the tree node.
 */
     boolean           IsChild(in AttributeTreeNode value);
 /*!
@@ -616,11 +683,15 @@ Sets the items to be selectable if <VAR>value</VAR> is TRUE (the default) or not
   {
 /*!
    Returns the value of this attribute.
+
 <BR><VAR>See also <A href=exemple/Example1.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 */
     long   Value();
 /*!
    Sets the value of this attribute.
+
+   \param value This parameter defines the local ID which will be set.
+
 <BR><VAR>See also <A href=exemple/Example1.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 */
     void   SetValue(in long value);
@@ -636,11 +707,13 @@ Sets the items to be selectable if <VAR>value</VAR> is TRUE (the default) or not
   {
 /*!
    Returns the value of this attribute
+
 <BR><VAR>See also <A href=exemple/Example1.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 */
     string Value();
 /*!
    Sets the value of this attribute
+
 <BR><VAR>See also <A href=exemple/Example1.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
 */
     void   SetValue(in string value);
@@ -665,7 +738,7 @@ Sets the items to be selectable if <VAR>value</VAR> is TRUE (the default) or not
 */
     void          Add(in SObject anObject);
 /*!
-    Returns the list of %SObjects which refer to this %SObject.
+    Returns a list of %SObjects which refer to this %SObject.
 */
     SALOMEDS::Study::ListOfSObject Get();
 /*!
@@ -681,6 +754,7 @@ Sets the items to be selectable if <VAR>value</VAR> is TRUE (the default) or not
 
    This attribute allows to store a table of integers (indexing from 1 like in CASCADE)
     and string titles of this table, of each row, of each column.
+
 <BR><VAR>See also <A href=exemple/Example21.html> an example </A> of usage of these methods in batchmode of %SALOME application.</VAR>
 
 */
@@ -758,24 +832,35 @@ Sets the items to be selectable if <VAR>value</VAR> is TRUE (the default) or not
     // operations with rows
 /*!
    Adds a row to the end of the table.
+   \param theData A sequence of long values which will be set as elements of the added row.
 */
     void AddRow(in LongSeq theData) raises(IncorrectArgumentLength);
 /*!
-   Sets the values of all elements of the row.
+   Sets the elements of a definite row.
+   \param theRow The number of the row.
+   \param theData A sequence of long values which will be set as elements of this row.
+
 */
     void SetRow(in long theRow, in LongSeq theData) raises(IncorrectArgumentLength, IncorrectIndex);
 /*!
-   Returns the row of the table.
+   Gets the row of the table.
+
+   \param theRow The number of the row.
+   \return A sequence of long values which are set as elements of this row.
 */
     LongSeq GetRow(in long theRow) raises(IncorrectIndex);
 
     // operations with columns
 /*!
    Adds a column to the end of the table.
+
+   \param theData A sequence of long values which will be set as elements of this column.
 */
     void AddColumn(in LongSeq theData) raises(IncorrectArgumentLength);
 /*!
    Sets the values of all elements of the column.
+
+  \param theData A sequence of long values which will be set as elements of this column.
 */
     void SetColumn(in long theColumn, in LongSeq theData) raises(IncorrectArgumentLength, IncorrectIndex);
 /*!
index 391112dfda558a481d47ac4c8b62f45b1b464bd9..ad9be3b06762bab1e8daa8ac0d13ed580da310e1 100644 (file)
@@ -43,6 +43,8 @@ module Engines
   {
 /*!
     Initializes the %container with a definite name.
+    \param ContainerName Name of the container
+    \return an initialized container
 */
     Container start_impl( in string ContainerName ) ;
 
@@ -50,11 +52,13 @@ module Engines
     Loads into the container a new component, registers it and starts it's CORBA servant.
     \param nameToRegister     Name of the component which will be registered in Registry (or Name Service)
     \param componentName     Name of the constructed library of the %component
+    \return a loaded component
 */
     Component load_impl(in string nameToRegister, in string componentName);
 
 /*!
-       Stops the component servant, and deletes all related objects
+    Stops the component servant, and deletes all related objects
+    \param component_i     Component to be removed
 */
     void remove_impl(in Component component_i);
 
@@ -109,6 +113,8 @@ module Engines
     Container GetContainerRef() ;
 /*!
    This method is used by the %SUPERVISOR component. It sets the names of the graph and of the node.
+   \param aGraphName Name of graph
+   \param aNodeName Name of node
 */
     void Names( in string aGraphName , in string aNodeName ) ;
 /*!
index c310e9de4261ac4da003cece7274d3c913212b57..fd6a224c4a01dec3526638e87d3de1d6fab18a4d 100644 (file)
@@ -65,7 +65,7 @@ The main exception in %SALOME application.
 */
   exception SALOME_Exception
   {
-    ExceptionStruct details;
+    ExceptionStruct details; /*!<Structure of the exception.*/
   };
 
 };
diff --git a/idl/SALOME_GenericObj.idl b/idl/SALOME_GenericObj.idl
new file mode 100644 (file)
index 0000000..03d730a
--- /dev/null
@@ -0,0 +1,42 @@
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : SALOME_Component.idl
+//  Author : Alexey Petrov, OPEN CASCADE
+//  $Header$
+
+#ifndef _SALOME_GENERICOBJ_IDL_
+#define _SALOME_GENERICOBJ_IDL_
+/*!  
+
+This is a package of interfaces used for providing of common bechavior 
+of SALOME transient CORBA objects in %SALOME application.
+*/
+module SALOME{
+  interface GenericObj{
+    /*! Increase the reference count (mark as used by another object).*/
+    void Register();
+    /*! Decrease the reference count (release by another object).*/
+    void Destroy();
+  };
+};
+
+#endif
index d3ac7ecee549c2a97559fc585ac9bab04b71f0ae..227c6b7e0e77eb45b37f68cf5c8205d433ea0201 100644 (file)
 
 /*!  
 The main package of interfaces used for creation of the module catalog in %SALOME application.
+Module catalog allows to manage components of %SALOME application, to call specified in the
+xml files interfaces with the help of AComponent interface.
 */
 module SALOME_ModuleCatalog
 {
   // Type Definitions
 /*! 
-This enumeration contains a set of definitions of the components integrated
+This enumeration contains a current set of definitions of the components integrated
 into %SALOME application.
 */
   enum ComponentType {  GEOM,  /*!<Module %GEOM */
@@ -47,7 +49,7 @@ into %SALOME application.
                        OTHER   /*!<Any other type of module */
                      } ;
 /*! 
-This struct contains fields defining the parameters of the services.
+This struct contains fields defining the parameter of the service.
 */
 
   struct ServicesParameter
@@ -56,7 +58,12 @@ This struct contains fields defining the parameters of the services.
     string Parametername; /*!<Name of the parameter.*/
   } ;
 
+/*! 
+The list of the parameters of service.
+*/
+
   typedef sequence<ServicesParameter> ListOfServicesParameter;
+
 /*! 
 This struct contains fields completely defining each service.
 */
@@ -65,7 +72,7 @@ This struct contains fields completely defining each service.
   {
     string                  ServiceName; /*!<Name of the service.*/
     ListOfServicesParameter ServiceinParameter; /*!< List of input parameters of the services.*/
-    ListOfServicesParameter ServiceoutParameter; /*!< List of input parameters of the services.*/
+    ListOfServicesParameter ServiceoutParameter; /*!< List of output parameters of the services.*/
     boolean                 Servicebydefault; /*!<True if the service is taken with its defult fields.*/
   } ;
 /*! 
@@ -89,7 +96,7 @@ List of interface definitions.
 */
   typedef sequence<DefinitionInterface> ListOfDefInterface ;
 /*! 
-List of interfaces.
+List of names of interfaces.
 */
   typedef sequence<string> ListOfInterfaces ;
 /*! 
@@ -123,12 +130,16 @@ List of pair GUI elements (component name, component icone)
     string what ; /*!<Indicates if it's a %component, a %service or a % pathPrefix.*/
   } ;
 
+  /*!
+   This interface provides the common funcionality information of corresponding component.
+   Information is loaded from specific xml files.
+  */
   interface Acomponent
   {
     // GetInterfaceList : operation to get a list of the interfaces name of
     //                    a component
   /*!
-   Gets a list of names of interfaces of the component
+   Gets the list of names of interfaces of the component
     \return a list of interfaces of the component 
   */
     ListOfInterfaces GetInterfaceList() ;
@@ -146,7 +157,7 @@ List of pair GUI elements (component name, component icone)
     // GetServiceList : operation to get a list of the services name of
     //                  an interface of a component
  /*! 
-   Gets a list of names of services of a definite interface belonging to the component.
+   Gets the list of names of services of a definite interface belonging to the component.
    \note <BR>If the specified interface doesn't exist, Notfound exception is thrown.
    \param interfacename Name of the interface 
    \return List of services of the required interface
@@ -199,13 +210,13 @@ Sets/gets the name of the component
 */
     readonly attribute string componentname;
 
-/*! 
+/*!
 Sets/gets the user name of the component
 */
     readonly attribute string componentusername;
 
 /*! 
-Defines whether the component can be multistudy or not
+Defines whether the component is multistudy or not
 */
     readonly attribute boolean multistudy;
 
index 9cce222ffee09d959124504c5825e8db079979b0..f42ccde7ef4b37f1abcaab1db364ca19127109c2 100644 (file)
@@ -35,7 +35,9 @@ module SALOME
    This enumeration contains values defining the state of the session
   
 */ 
-  enum SessionState {asleep, running} ;
+  enum SessionState {asleep, /*! Session is inactive */
+                    running /*! Session is running */
+  } ;
 
 /*! \brief %Session State and Statistics
 
@@ -80,7 +82,10 @@ module SALOME
    Launches GUI in the session
 */
     void GetInterface(); 
-    //***//    VISU::VISU_Gen GetVisuGen();
+
+/*! 
+   Returns the Visu component
+*/
     Engines::Component GetVisuComponent();
 
 /*! 
index 4d906f84de61e1ea23a9551894dc2fcb46840eb8..6444ef148dc70a8ef04cb63e819d057d1d57b351 100755 (executable)
@@ -85,12 +85,29 @@ class SALOME_ContainerPy_i (Engines__POA.Container):
             else :
                 MESSAGE( "SALOME_ContainerPy_i::start_impl " + str(ContainerName) + ".object found without runSession" )
             return container
-        shstr = os.getenv( "PWD" ) + "/"
-        shstr += "runSession ./SALOME_ContainerPy.py "
+        #shstr = os.getenv( "PWD" ) + "/"
+        #shstr += "runSession ./SALOME_ContainerPy.py "
+        shstr = "runSession SALOME_ContainerPy.py "
         shstr += ContainerName
-        shstr += " > /tmp/"
-        shstr += ContainerName
-        shstr += ".log 2>&1 &"
+
+        # mpv: fix for SAL4731 - allways create new file to write log of server
+        num = 1
+        fileName = ""
+        while 1:
+            fileName = "/tmp/"+ContainerName+"_%i.log"%num
+            if not os.path.exists(fileName):
+                break
+            num += 1
+            pass
+        
+        shstr += " > "
+        shstr += fileName
+        shstr += " 2>&1 &"
+        
+        #shstr += " > /tmp/"
+        #shstr += ContainerName
+        #shstr += ".log 2>&1 &"
+        
         MESSAGE(  "SALOME_ContainerPy_i::start_impl " + "os.system(" + str(shstr) + ")" )
         os.system( shstr )
         count = 21
diff --git a/src/GenericObj/Makefile.in b/src/GenericObj/Makefile.in
new file mode 100644 (file)
index 0000000..5839dfa
--- /dev/null
@@ -0,0 +1,46 @@
+#  Copyright (C) 2003  CEA/DEN, EDF R&D
+#
+#
+#
+#  File   : Makefile.in
+#  Author : Alexey Petrov
+#  Module : VISU
+#  $Header: 
+
+top_srcdir=@top_srcdir@
+top_builddir=../..
+srcdir=@srcdir@
+VPATH=.:@srcdir@:@top_srcdir@/idl
+
+
+@COMMENCE@
+
+# Libraries targets
+LIB = libSalomeGenericObj.la
+LIB_SRC = SALOME_GenericObj_i.cc
+
+LIB_SERVER_IDL = SALOME_GenericObj.idl
+LIB_CLIENT_IDL = 
+
+# Executables targets
+BIN = 
+BIN_SRC = 
+
+BIN_CLIENT_IDL =  
+BIN_SERVER_IDL =
+EXPORT_HEADERS = SALOME_GenericObj_i.hh
+
+# additionnal information to compil and link file
+CPPFLAGS += 
+
+LDFLAGS += 
+
+LIBS += 
+
+# additional file to be cleaned
+MOSTLYCLEAN +=
+CLEAN +=
+DISTCLEAN +=
+
+@CONCLUDE@
\ No newline at end of file
diff --git a/src/GenericObj/SALOME_GenericObj_i.cc b/src/GenericObj/SALOME_GenericObj_i.cc
new file mode 100644 (file)
index 0000000..93aaa9d
--- /dev/null
@@ -0,0 +1,61 @@
+//  SALOME_GenericObj_i_CC
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//  File   : SALOME_GenericObj_i.cc
+//  Author : Alexey PETROV
+//  Module : SALOME
+
+#include "SALOME_GenericObj_i.hh"
+#include "utilities.h"
+
+using namespace SALOME;
+
+GenericObj_i::GenericObj_i(PortableServer::POA_ptr thePOA): myRefCounter(1){
+  INFOS("GenericObj_i::GenericObj_i() - this = "<<this<<
+       "; CORBA::is_nil(thePOA) = "<<CORBA::is_nil(thePOA));
+  if(CORBA::is_nil(thePOA))
+    myPOA = PortableServer::RefCountServantBase::_default_POA();
+  else
+    myPOA = PortableServer::POA::_duplicate(thePOA);
+}
+
+
+PortableServer::POA_ptr GenericObj_i::_default_POA(){
+  //return PortableServer::RefCountServantBase::_default_POA();
+  return PortableServer::POA::_duplicate(myPOA);
+}
+
+
+void GenericObj_i::Register(){
+  INFOS("GenericObj_i::Register "<<this<<"; myRefCounter = "<<myRefCounter)
+  ++myRefCounter;
+}
+
+
+void GenericObj_i::Destroy(){
+  INFOS("GenericObj_i::Destroy "<<this<<"; myRefCounter = "<<myRefCounter)
+  if(--myRefCounter <= 0){
+    PortableServer::ObjectId_var anObjectId = myPOA->servant_to_id(this);
+    myPOA->deactivate_object(anObjectId.in());
+    _remove_ref();
+  }
+}
diff --git a/src/GenericObj/SALOME_GenericObj_i.hh b/src/GenericObj/SALOME_GenericObj_i.hh
new file mode 100644 (file)
index 0000000..715b0a9
--- /dev/null
@@ -0,0 +1,56 @@
+//  SALOME_GenericObj_i_HH
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//  File   : SALOME_GenericObj_i.hh
+//  Author : Alexey PETROV
+//  Module : SALOME
+
+#ifndef SALOME_GenericObj_i_HH
+#define SALOME_GenericObj_i_HH
+
+// IDL headers
+#include "SALOMEconfig.h"
+#include CORBA_SERVER_HEADER(SALOME_GenericObj)
+
+namespace SALOME{
+  class GenericObj_i : 
+    public virtual POA_SALOME::GenericObj,
+    public virtual PortableServer::RefCountServantBase
+  {
+  protected:
+    PortableServer::POA_var myPOA;
+    int myRefCounter;
+  public:
+    // In the constructor you can provide default POA for the servant
+    GenericObj_i(PortableServer::POA_ptr thePOA = PortableServer::POA::_nil());
+    // The function is used implicetly in "_this" function
+    virtual PortableServer::POA_ptr _default_POA();
+  public: // Follow functions is IDL defined
+    /*! Increase the reference count (mark as used by another object).*/
+    virtual void Register();
+    /*! Decrease the reference count (release by another object).*/
+    virtual void Destroy();
+  };
+};
+
+#endif
+
index c3f7acce130c8aaa2e9052a581823d2fac008483..5d1b3a4a756de74ad3f3c7f44f8d8b8bb49dfc9d 100644 (file)
@@ -53,7 +53,7 @@ void Logger::putMessage(const char* message)
 
 void Logger::ping()
 {
-  cout<<" Logger::ping() pid "<< getpid()<<endl;
+  //cout<<" Logger::ping() pid "<< getpid()<<endl;
 }
 
 int main(int argc, char **argv)
@@ -66,59 +66,58 @@ int main(int argc, char **argv)
   try
     {
       //Initialize the ORB
-      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;
+      const long TIMESleep = 250000000;
+      const int NumberOfTries = 40;
+      int i;
+      timespec ts_req = {0, TIMESleep};
+      timespec ts_rem = {0, 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;}
+
+      CORBA::ORB_var orb = CORBA::ORB_init(argc, argv) ;
+
+      for (int i = 1; i <= NumberOfTries; i++){        
+       if (i != 1) nanosleep(&ts_req, &ts_rem);
+       try {
+         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
+         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]);
+
+
       myLoggerRef = myLogger->_this();
       CosNaming::Name name;
       name.length(1);
index e3185daf6120a226e3b6a7515fd74b359d65b650..d139476c1aaad1fe780e6053335f64e0cac933ea 100644 (file)
@@ -22,80 +22,7 @@ using namespace std;
 
 SALOME_Trace::SALOME_Trace()
 {
-  //get reference on object reference from NS
-  //and initialize m_pInterfaceLogger 
-
-  int argc = 1;
-  char* argv[1] = {"application"};
-  try
-    {
-      //NB. You can't use SALOME_NamingService class because it uses MESSAGE macro
-      //Otherwise, you will get segmentation fault.   
-
-      //Initialize the ORB
-      CORBA::ORB_var orb = CORBA::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;
-      CORBA::Object_var theObj;
-      CORBA::Object_var obj;
-      CosNaming::Name name;
-      name.length(1);
-      name[0].id = CORBA::string_dup("Logger");
-      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 (CORBA::SystemException&)
-    {
-//       cout << "Caught CORBA::SystemException.";
-    }
-  catch (CORBA::Exception&)
-    {
-//       cout << "Caught CORBA::Exception.";
-    }
-  catch (...)
-    {
-//       cout << "Caught unknown exception.";
-    }
-  //cerr << "-----SALOME_Trace::SALOME_Trace----"<<endl;
+  isInitialized = 0;
 }
 
 SALOME_Trace::~SALOME_Trace()
@@ -108,8 +35,80 @@ SALOME_Trace& SALOME_Trace::Instance()
        return instance;
 }
 
+int SALOME_Trace::Initialize(CORBA::ORB_ptr theOrb) {
+  //get reference on object reference from NS
+  //and initialize m_pInterfaceLogger 
+  if (isInitialized && !CORBA::is_nil(m_pInterfaceLogger))
+    return 1;
+
+  const long TIMESleep = 250000000;
+  const int NumberOfTries = 40;
+  int i;
+  timespec ts_req = {0, TIMESleep};
+  timespec ts_rem = {0, 0};
+
+  CosNaming::NamingContext_var inc;
+  CORBA::Object_var theObj;
+  CORBA::Object_var obj;
+
+  // searchin for naming service for 0.25*40=10 seconds
+  for (i = 1; i <= NumberOfTries; i++) {
+    if (i != 1) nanosleep(&ts_req,&ts_rem);
+    try{ 
+      if(CORBA::is_nil(obj))
+       obj = theOrb->resolve_initial_references("RootPOA");
+      if(CORBA::is_nil(theObj))
+       theObj = theOrb->resolve_initial_references("NameService"); 
+      if (!CORBA::is_nil(theObj))
+       inc = CosNaming::NamingContext::_narrow(theObj);
+      if (!CORBA::is_nil(inc)) break;
+    } catch( CORBA::COMM_FAILURE& ) {
+    } catch (...) {
+    }
+  }
+  
+  if (CORBA::is_nil(inc)) {
+    cout<<"SALOME_Trace can not find NameService"<<endl;
+    return 0;
+  }
+  
+  //cout<<"SALOME_Trace : NameService was found"<<endl;
+  
+  const char * Env = getenv("USE_LOGGER");
+  int EnvL = (Env != NULL && strlen(Env))?1:0;
+  
+  // the try to get Logger server if it is necessary
+  if(EnvL) {
+    CosNaming::Name name;
+    name.length(1);
+    name[0].id=CORBA::string_dup("Logger");    
+    
+    for(i = 1; i <= NumberOfTries; i++){
+      if (i != 1) nanosleep(&ts_req, &ts_rem);
+      try {
+       obj = inc->resolve(name);
+       if (!CORBA::is_nil(obj)) m_pInterfaceLogger = SALOME_Logger::Logger::_narrow(obj);
+      } catch(CosNaming::NamingContext::NotFound) {
+      } catch(...) {
+      }
+      if (!CORBA::is_nil(m_pInterfaceLogger)) {
+       //cout<<"SALOME_Trace : Logger Server was found"<<endl;
+       m_pInterfaceLogger->ping();
+       break;
+      }
+    }
+    if (CORBA::is_nil(m_pInterfaceLogger)) {
+      cout<<"SALOME_Trace can not find Logger"<<endl;
+      return 0;
+    }
+  }
+  isInitialized = 1;
+  return 1;
+}
+
 void SALOME_Trace::putMessage(ostream& msg)
 {
+  //if (!isInitialized) cout<<"!!! SALOME_Trace is used without initialising !!!"<<endl;
   //write resulting string into Logger CORBA server
   //concatenate string from passing parameters for transfering into Logger CORBA server
 
index e24239e8dd3a6ac107669f1c4c6c7d8945b06684..90fbfd06fd441aa2e4a81594c52c4cc2e3754c61 100644 (file)
@@ -52,11 +52,14 @@ class SALOME_Trace : public ostrstream
 public:
        virtual ~SALOME_Trace();
         static Standard_EXPORT SALOME_Trace& Instance();
+       // initializes Logger (if USE_LOGGER variable is set) and returns true, in case success
+       int Initialize(CORBA::ORB_ptr theOrb);
        Standard_EXPORT void putMessage(std::ostream& msg);
 protected:
        //disable creation of instances. It's necessary to use static SALOME_Logger& Instance()
        SALOME_Trace();
        SALOME_Logger::Logger_var m_pInterfaceLogger;// object reference on Logger server.
+       int isInitialized;
 };
 
 #define GLogger SALOME_Trace::Instance()
index 04dbcc35c92262642fc20ca1aed111279449556d..ab30f3379d505bce3e1bfa47c813b6ac5d2f87fa 100644 (file)
@@ -11,31 +11,48 @@ import sys
 import CosNaming
 from omniORB import CORBA
 import SALOME_Logger
+import time
+import os
+
+trace="local"
+if (os.environ["SALOME_trace"] == "with_logger"):
+    trace="logger"
 
 class SALOME_Trace :
     def __init__(self):
         self.m_pInterfaceLogger = None
-        try:
-            orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID)
-            theObj = orb.resolve_initial_references("NameService")
-            inc = theObj._narrow(CosNaming.NamingContext)
-            name = [CosNaming.NameComponent("Logger","")]
-            obj = inc.resolve(name);
-            
-            self.m_pInterfaceLogger = obj._narrow(SALOME_Logger.Logger)
-
-        except CosNaming.NamingContext.NotFound, e :
-                print "Caught exception: Naming Service can't found Logger"
-        except CORBA.COMM_FAILURE, e:
-                print "Caught CORBA::SystemException CommFailure"
-        except CORBA.SystemException, e:
-                print "Caught CORBA::SystemException."
-        except CORBA.Exception, e:
-                print "Caught CORBA::Exception."
-        except Exception, e:
-                print "Caught unknown exception."
-                
+        if trace=="logger":
+            ok = 0
+            steps = 40
+            while steps > 0 and ok == 0:
+
+              try:
+                orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID)
+                theObj = orb.resolve_initial_references("NameService")
+                inc = theObj._narrow(CosNaming.NamingContext)
+                name = [CosNaming.NameComponent("Logger","")]
+                obj = inc.resolve(name);
+
+                self.m_pInterfaceLogger = obj._narrow(SALOME_Logger.Logger)
+
+                if not self.m_pInterfaceLogger is None:
+                  ok = 1
+
+              except CosNaming.NamingContext.NotFound, e :
+                    if steps == 1: print "Caught exception: Naming Service can't found Logger"
+              except CORBA.COMM_FAILURE, e:
+                    if steps == 1: print "Caught CORBA::SystemException CommFailure"
+              except CORBA.SystemException, e:
+                    if steps == 1: print "Caught CORBA::SystemException."
+              except CORBA.Exception, e:
+                    if steps == 1: print "Caught CORBA::Exception."
+              except Exception, e:
+                    if steps == 1: print "Caught unknown exception."
 
+              time.sleep(0.25)
+              steps = steps - 1
+         
+         
     def putMessage ( self, LogMsg ) :
         
         if (CORBA.is_nil(self.m_pInterfaceLogger)):
index 89f82d775e3d9a0e9bf90dea4e3f4f61520ecd44..f35650e424aae48b820a39d744966c8a9dfb80bd 100644 (file)
@@ -33,7 +33,7 @@ VPATH=.:@srcdir@
 @COMMENCE@
 
 SUBDIRS = MSG2QM SALOMELocalTrace Logger SALOMELogger Utils PatchQt \
-          NamingService Registry \
+          GenericObj NamingService Registry \
          ModuleCatalog DataTypeCatalog RessourcesCatalog \
           Notification  NOTIFICATION_SWIG \
          Container TestContainer LifeCycleCORBA HDFPersist \
index 8b41f25bed92501afef8dd5c8c0c570bda57dcc5..2bc3c553ca4cfa4c7969215bbf70fab90c6c338f 100644 (file)
@@ -46,7 +46,7 @@ class SALOME_NamingServicePy_i:
     #-------------------------------------------------------------------------
 
     def __init__(self, orb):
-        MESSAGE ( "SALOME_NamingServicePy_i::__init__" )
+        #MESSAGE ( "SALOME_NamingServicePy_i::__init__" )
         self._orb = orb
         # initialize root context and current context
        ok = 0
@@ -138,7 +138,7 @@ class SALOME_NamingServicePy_i:
             
     #-------------------------------------------------------------------------
     def Resolve(self, Path):
-        MESSAGE ( "SALOME_NamingServicePy_i::Resolve" )
+        #MESSAGE ( "SALOME_NamingServicePy_i::Resolve" )
         path_list = list(Path)
         if path_list[0]=='/':
             self._current_context = self._root_context
index 8029335ebb34d14f9bc34070c70f7f264e6d56dc..db7a30cf2e6a18a29302fdb99ac802c823d1222b 100644 (file)
 #include <vtkPolyDataMapper.h>
 #include <vtkTransformPolyDataFilter.h>
 
+// For test
+#include <vtkMapperCollection.h>
+#include "vtkTimerLog.h"
+
 using namespace std;
 
 int SALOME_POINT_SIZE = 3;
 
-void SALOME_Actor::Render(vtkRenderer *ren, vtkMapper *Mapper )
-{
-  if (this->Mapper == NULL) {
-    MESSAGE ("No mapper for actor.")
-    return;
-  }
-  
-  vtkMapper *bestMapper;
-  bestMapper = this->Mapper;
-
-  /* render the property */
-  if (!this->Property) {
-    // force creation of a property
-    this->GetProperty();
-  }
-
-  this->Property->Render(this, ren);
-  if (this->BackfaceProperty) {
-    this->BackfaceProperty->BackfaceRender(this, ren);
-    this->Device->SetBackfaceProperty(this->BackfaceProperty);
-  }
-  this->Device->SetProperty(this->Property);
-  
-  
-  /* render the texture */
-  if (this->Texture) {
-    this->Texture->Render(ren);
-  }
-  
-  
-  // Store information on time it takes to render.
-  // We might want to estimate time from the number of polygons in mapper.
-  this->Device->Render(ren,bestMapper);
-  this->EstimatedRenderTime = bestMapper->GetTimeToDraw();
-}
-
-int SALOME_Actor::RenderOpaqueGeometry(vtkViewport *vp)
-{
-  int renderedSomething = 0; 
-  vtkRenderer      *ren = (vtkRenderer *)vp;
-
-  if ( ! this->Mapper ) {
-    return 0;
-  }
-
-  // make sure we have a property
-  if (!this->Property) {
-    // force creation of a property
-    this->GetProperty();
-  }
-
-  // is this actor opaque ?
-  if (this->GetIsOpaque()) {
-    this->Property->Render(this, ren);
-    
-    // render the backface property
-    if (this->BackfaceProperty) {
-      this->BackfaceProperty->BackfaceRender(this, ren);
-    }
-    
-    // render the texture 
-    if (this->Texture) {
-      this->Texture->Render(ren);
-    }
-    this->Render(ren,this->Mapper);
-    
-    renderedSomething = 1;
-  }
-  
-  return renderedSomething; 
-}
-
-void SALOME_Actor::ReleaseGraphicsResources(vtkWindow *renWin)
-{
-  vtkActor::ReleaseGraphicsResources(renWin);
-  this->Mapper->ReleaseGraphicsResources(renWin);
-}
 
+vtkStandardNewMacro(SALOME_Actor);
 
 void SALOME_Actor::AddToRender(vtkRenderer* theRenderer){
   theRenderer->AddActor(this);
@@ -158,12 +86,33 @@ void SALOME_Actor::SetMapper(vtkMapper* theMapper){
 
 void SALOME_Actor::SetTransform(SALOME_Transform* theTransform){
   myTransformFilter->SetTransform(theTransform);
-  myTransformFilter->Modified();
+}
+
+
+unsigned long int SALOME_Actor::GetMTime(){
+  unsigned long mTime = this->Superclass::GetMTime();
+  unsigned long time = myTransformFilter->GetMTime();
+  mTime = ( time > mTime ? time : mTime );
+  return mTime;
 }
 
 
 void SALOME_Actor::SetRepresentation(int theMode) { 
-  myRepresentation = theMode;
+  switch(myRepresentation){
+  case 0 : 
+  case 2 : 
+    myProperty->DeepCopy(GetProperty());
+  }    
+  switch(theMode){
+  case 0 : 
+  case 2 : 
+    GetProperty()->DeepCopy(myProperty);
+    break;
+  default:
+    GetProperty()->SetAmbient(1.0);
+    GetProperty()->SetDiffuse(0.0);
+    GetProperty()->SetSpecular(0.0);
+  }
   switch(theMode){
   case 3 : 
     myPassFilter[0]->SetInside(true);
@@ -172,9 +121,10 @@ void SALOME_Actor::SetRepresentation(int theMode) {
   case 0 : 
     GetProperty()->SetPointSize(SALOME_POINT_SIZE);  
   default :
-    GetProperty()->SetRepresentation(myRepresentation);
+    GetProperty()->SetRepresentation(theMode);
     myPassFilter[0]->SetInside(false);
   }
+  myRepresentation = theMode;
 }
 int SALOME_Actor::GetRepresentation(){ 
   return myRepresentation;
@@ -183,6 +133,8 @@ int SALOME_Actor::GetRepresentation(){
 
 SALOME_Actor::SALOME_Actor(){
   PreviewProperty = NULL;
+  ispreselected = Standard_False;
+  myProperty = vtkProperty::New();
   myRepresentation = 2;
   myTransformFilter = SALOME_TransformFilter::New();
   myPassFilter.push_back(SALOME_PassThroughFilter::New());
@@ -195,6 +147,9 @@ SALOME_Actor::~SALOME_Actor(){
   myTransformFilter->Delete();
   SetPreviewProperty(NULL);
   for(int i = 0, iEnd = myPassFilter.size(); i < iEnd; i++)
-    if(myPassFilter[i] != NULL) 
+    if(myPassFilter[i] != NULL){
+      myPassFilter[i]->UnRegisterAllOutputs(); 
       myPassFilter[i]->Delete();
+    }
+  myProperty->Delete();
 }
index ea35d47ef07d50a14ed8021b8927b7cc39b60a5e..03758fee9870e4aba7bdd4f4d19a6fb239b69348 100644 (file)
@@ -50,23 +50,25 @@ class SALOME_Actor : public vtkLODActor{
   SALOME_Actor();
   ~SALOME_Actor();
  public:
-  vtkTypeMacro(SALOME_Actor,vtkActor);
+  static SALOME_Actor* New();
+
+  vtkTypeMacro(SALOME_Actor,vtkLODActor);
 
   // Description:
   // This causes the actor to be rendered. It, in turn, will render the actor`s
   // property and then mapper.
-  virtual void Render(vtkRenderer *, vtkMapper *);
+  //virtual void Render(vtkRenderer *, vtkMapper *);
 
   // Description:
   // This method is used internally by the rendering process.
   // We overide the superclass method to properly set the estimated render time.
-  virtual int RenderOpaqueGeometry(vtkViewport *viewport);
+  //virtual int RenderOpaqueGeometry(vtkViewport *viewport);
 
   // Description:
   // Release any graphics resources that are being consumed by this actor.
   // The parameter window could be used to determine which graphic
   // resources to release.
-  virtual void ReleaseGraphicsResources(vtkWindow *);
+  //virtual void ReleaseGraphicsResources(vtkWindow *);
 
   virtual Standard_Boolean hasIO() { return !myIO.IsNull(); }
   virtual Handle_SALOME_InteractiveObject getIO() { return myIO; } 
@@ -105,8 +107,14 @@ class SALOME_Actor : public vtkLODActor{
   virtual void SetMapper(vtkMapper* theMapper); 
   virtual void SetTransform(SALOME_Transform* theTransform); 
 
+  virtual unsigned long int GetMTime();
+
   virtual void SetRepresentation(int theMode);
   virtual int GetRepresentation();
+
+  // Infinitive means actor without size (point for example
+  // which is not taken into account in calculation of boundaries of the scene
+  virtual bool IsInfinitive() { return false; }
     
  protected:
   vtkProperty         *PreviewProperty;
@@ -122,6 +130,7 @@ class SALOME_Actor : public vtkLODActor{
   SALOME_Transform *myTransform;
   std::vector<SALOME_PassThroughFilter*> myPassFilter;
   SALOME_TransformFilter *myTransformFilter;
+  vtkProperty *myProperty;
   int myRepresentation;
 };
 
index c15abf390ed31448c5e9776ca63b95e4f6240079..2ddc4325fc1abc068ffe48db69a951229cc378d5 100644 (file)
@@ -40,6 +40,8 @@ using namespace std;
 #include "QAD_Application.h"
 #include "utilities.h"
 
+#include "QAD_Config.h"
+#include "QAD_Settings.h"
 #include "SALOME_Selection.h"
 #include "SALOME_AISShape.hxx"
 
@@ -49,7 +51,7 @@ using namespace std;
 // Open CASCADE Include
 #include <V3d_View.hxx>
 #include <AIS_ListIteratorOfListOfInteractive.hxx>
-
+#include <Visual3d_View.hxx>
 
 /*!
     Constructor
@@ -380,6 +382,7 @@ void OCCViewer_ViewFrame::onViewTrihedron()
     myViewer->getAISContext()->Display( myViewer->getTrihedron() );
   else
     myViewer->getAISContext()->Erase( myViewer->getTrihedron() );
+  onAdjustTrihedron();
 }
 
 void OCCViewer_ViewFrame::rename( const Handle(SALOME_InteractiveObject)& IObject, QString newName )
@@ -499,11 +502,6 @@ void OCCViewer_ViewFrame::redo(SALOMEDS::Study_var aStudy,
   Repaint();
 }
 
-void OCCViewer_ViewFrame::SetTrihedronSize( int dim )
-{
-  myViewer->setTrihedronSize( dim );
-}
-
 /* selection */
 Handle(SALOME_InteractiveObject) OCCViewer_ViewFrame::FindIObject(const char* Entry)
 {
@@ -658,6 +656,58 @@ void OCCViewer_ViewFrame::EraseAll()
 
 
 
-void OCCViewer_ViewFrame::Repaint(){
+void OCCViewer_ViewFrame::Repaint()
+{
+  onAdjustTrihedron();
   myViewer->getViewer3d()->Update();
 }
+
+void OCCViewer_ViewFrame::onAdjustTrihedron()
+{
+  Handle (AIS_InteractiveContext) ic = myViewer->getAISContext();
+  
+  if (!ic->IsDisplayed(myViewer->getTrihedron())) 
+    return;
+  else 
+    {
+      AIS_ListOfInteractive List;
+      ic->Erase( myViewer->getTrihedron() );
+      ic->DisplayedObjects(List);
+      ic->Display( myViewer->getTrihedron() ); 
+      if (List.IsEmpty())
+       {
+         myViewer->setTrihedronSize(100);
+         return;
+       }
+    }
+  
+  Handle( V3d_View) view3d = ((OCCViewer_ViewPort3d*)myViewPort)->getView();
+  
+  if (!view3d.IsNull())
+    {
+      double Xmin=0, Ymin=0, Zmin=0, Xmax=0, Ymax=0, Zmax=0;
+      double aMaxSide; 
+      double aPercents;
+     
+      view3d->View()->MinMaxValues(Xmin, Ymin, Zmin, Xmax, Ymax, Zmax);
+
+      if (Xmin==RealFirst() || Ymin==RealFirst() || Zmin==RealFirst() ||
+         Xmax==RealLast()  || Ymax==RealLast()  || Zmax==RealLast())
+       return;
+           
+      aMaxSide = Xmax - Xmin;
+      if (aMaxSide < Ymax -Ymin) aMaxSide = Ymax -Ymin;
+      if (aMaxSide < Zmax -Zmin) aMaxSide = Zmax -Zmin;
+      
+      static float aSizeInPercents = 105;
+      QString aSetting = QAD_CONFIG->getSetting("Viewer:TrihedronSize");
+      if (!aSetting.isEmpty()) aSizeInPercents = aSetting.toFloat();
+
+      static float EPS = 5.0E-3;
+      float aSize = myViewer->getTrihedron()->Size();
+      float aNewSize = aMaxSide*aSizeInPercents/100.0;
+      // if the new trihedron size have sufficient difference, then apply the value
+      if(fabs(aNewSize-aSize) > aSize*EPS || fabs(aNewSize-aSize) > aNewSize*EPS)
+       myViewer->setTrihedronSize(aNewSize);
+    }
+}
index 918c9e117ce42a6d723b3d1475903b26bce00eae..61125300fdefef6308040352bb5f55e60de50af1 100644 (file)
@@ -65,9 +65,7 @@ class QAD_EXPORT OCCViewer_ViewFrame : public QAD_ViewFrame
   QCursor           cursor() const;
 
   void              SetSelectionMode( int mode ) {};
-
-  void              SetTrihedronSize( int dim );
-
+  
   /*  popup management */
   void              setPopupServer( QAD_Application* );
 
@@ -134,6 +132,7 @@ class QAD_EXPORT OCCViewer_ViewFrame : public QAD_ViewFrame
   void           onViewBottom();
   void           onViewTop();
   void           onViewTrihedron(); 
+  void           onAdjustTrihedron();
  
  protected:
   OCCViewer_Viewer3d*      myViewer;    // my owner
index 5dddcc5dfa85b02deaf47f7c01b9d65e64739e84..ee92ee7ba4c325980f7cde14cbf9e78e98ef5136 100644 (file)
@@ -45,7 +45,7 @@ public:
   ViewType          getTypeView() const { return VIEW_PLOT2D; }
   QWidget*          getViewWidget();
   void              SetSelectionMode( int mode ) {}
-  void              SetTrihedronSize( int dim ) {}
+  void              onAdjustTrihedron( ) {}
 
   /* popup management */
   void              setPopupServer( QAD_Application* );
index 9110ca423e5761063f6e13034febb3b95a027bb5..afc79eac91563ac13c72a7944330fa4cf611f9a4 100644 (file)
@@ -50,15 +50,17 @@ using namespace std;
 # include "HelpWindow.hxx" 
 # include "IntervalWindow.hxx"
 
-static QString addSlash( const QString& path );
-
 typedef int PIXELS;
 RegWidget* RegWidget::myRegWidgetPtr = 0;
+QString addSlash( const QString& );
+QString findFile( QString filename );
 
 #define BOLD( text ) ( QString( "<b>" ) + QString( text ) + QString( "</b>" ) )
+
 /*!
   Creates components list
 */
+
 Registry::Components_var MakeRegistry( CORBA::ORB_var &orb )
 {
 
@@ -112,32 +114,14 @@ RegWidget::RegWidget(CORBA::ORB_var &orb, QWidget *parent, const char *name )
        _tabWidget(0), _refresh(0), _interval(0),
        myInfoWindow(0), myHelpWindow(0), myIntervalWindow(0)
 {
-
+   QString aFile = findFile("default.png");
+ /* char* dir = getenv( "CSF_ResourcesDefaults" );
   QString path( "" );
-  QString dir;
-  char* cenv;
-  cenv = getenv( "KERNEL_ROOT_DIR" );
-  if ( cenv ) {
-    dir.sprintf( "%s", cenv );
-    if ( !dir.isEmpty() ) {
-      dir = addSlash(dir) ;
-      dir = dir + "share" ;
-      dir = addSlash(dir) ;
-      dir = dir + "salome" ;
-      dir = addSlash(dir) ;
-      dir = dir + "resources" ;
-      dir = addSlash(dir) ;
-      QDir qDir( dir );
-      path = qDir.filePath( "default.png" );
-    }
-  }
-//    char* dir = getenv( "CSF_ResourcesDefaults" );
-//    QString path( "" );
-//    if ( dir ) {
-//      QDir qDir( dir );
-//      path = qDir.filePath( "default.png" );
-//    }
-  QPixmap pm ( path );
+  if ( dir ) {
+    QDir qDir( dir );
+    path = qDir.filePath( "default.png" );
+  }*/
+  QPixmap pm ( aFile );
   if ( !pm.isNull() )
     setIcon( pm );
 
@@ -466,7 +450,7 @@ void RegWidget::slotSelectRefresh()
   myIntervalWindow->installEventFilter( this );
   myIntervalWindow->setValue(myRefreshInterval);
   myIntervalWindow->show();
-  connect( myIntervalWindow->Cancel(), SIGNAL( clicked() ), myIntervalWindow, SLOT( reject() ) );
+  connect( myIntervalWindow->Cancel(), SIGNAL( clicked() ), myIntervalWindow, SLOT( close() ) );
   connect( myIntervalWindow->Ok(), SIGNAL( clicked() ), this, SLOT( slotIntervalOk() ) );
   END_OF("slotSelectRefresh");
 }
@@ -596,6 +580,79 @@ void InfoWindow::setText( const QString& text )
   myTextView->setText( text );
 }
 
+static const char* SEPARATOR    = ":";
+
+QString findFile( QString filename )
+{
+  QString dir;
+  char* cenv;
+  
+  // Try ${HOME}/.salome/resources directory
+  cenv = getenv( "HOME" );
+  if ( cenv ) {
+    dir.sprintf( "%s", cenv );
+    if ( !dir.isEmpty() ) {
+      dir = addSlash(dir) ;
+      dir = dir + ".salome" ;
+      dir = addSlash(dir) ;
+      dir = dir + "resources" ;
+      dir = addSlash(dir) ;
+      QFileInfo fileInfo( dir + filename );
+      if ( fileInfo.isFile() && fileInfo.exists() )
+       return fileInfo.filePath();
+    }
+  }
+  // Try ${SALOME_SITE_DIR}/share/salome/resources directory
+  cenv = getenv( "SALOME_SITE_DIR" );
+  if ( cenv ) {
+    dir.sprintf( "%s", cenv );
+    if ( !dir.isEmpty() ) {
+      dir = addSlash(dir) ;
+      dir = dir + "share" ;
+      dir = addSlash(dir) ;
+      cenv = getenv("SALOME_SITE_NAME");
+      if (cenv)  dir = dir + cenv;
+      else       dir = dir + "salome" ;
+      dir = addSlash(dir) ;
+      dir = dir + "resources" ;
+      dir = addSlash(dir) ;
+      QFileInfo fileInfo( dir + filename );
+      if ( fileInfo.isFile() && fileInfo.exists() )
+       return fileInfo.filePath();
+    }
+  }
+  // Try ${SALOME_ROOT_DIR}/share/salome/resources directory
+  cenv = getenv( "SALOME_ROOT_DIR" );
+  if ( cenv ) {
+    dir.sprintf( "%s", cenv );
+    if ( !dir.isEmpty() ) {
+      dir = addSlash(dir) ;
+      dir = dir + "share" ;
+      dir = addSlash(dir) ;
+      dir = dir + "salome" ;
+      dir = addSlash(dir) ;
+      dir = dir + "resources" ;
+      dir = addSlash(dir) ;
+      QFileInfo fileInfo( dir + filename );
+      if ( fileInfo.isFile() && fileInfo.exists() )
+       return fileInfo.filePath();
+    }
+  }
+  // Try CSF_SaloameResources env.var directory ( or directory list )
+  cenv = getenv( "CSF_SalomeResources" );
+  if ( cenv ) {
+    dir.sprintf( "%s", cenv );
+    if ( !dir.isEmpty() ) {
+      QStringList dirList = QStringList::split( SEPARATOR, dir, false ); // skip empty entries
+      for ( int i = 0; i < dirList.count(); i++ ) {
+       QFileInfo fileInfo( addSlash( dirList[ i ] ) + filename );
+       if ( fileInfo.isFile() && fileInfo.exists() )
+         return fileInfo.filePath();
+      }
+    }
+  }
+  return filename;
+}
 QString addSlash( const QString& path )
 {
   if (!path.isNull()) {
index dcd0a27592c537811f26282495243064919f5bbc..341e60d54f0baea6b924bd49aa3b21c9d9131983 100644 (file)
@@ -37,7 +37,7 @@ void OnGUIEvent( CORBA::ORB_var &orb, QWidget *parent, const char *name )
 {
   // N.B. parent can be 0
  RegWidget* ptrRegWidget = RegWidget::GetRegWidget( orb, parent, name );
- ASSERT ( !ptrRegWidget );
//ASSERT ( !ptrRegWidget );
  ptrRegWidget->show();
  ptrRegWidget->raise();
  ptrRegWidget->setActiveWindow();
index 394cd98d90e31e886198cff796be090b474f8f47..84cb2949f9a2bb67315feffa5c6768d619b1ef5a 100644 (file)
@@ -111,7 +111,7 @@ BIN_CLIENT_IDL =
 
 CPPFLAGS+=$(OCC_INCLUDES) $(HDF5_INCLUDES)
 CXXFLAGS+=$(OCC_CXXFLAGS)
-LDFLAGS+= $(HDF5_LIBS) -lTOOLSDS -lSalomeNS -lSalomeHDFPersist -lOpUtil -lSALOMELocalTrace $(CAS_LDPATH) -lTKCAF
+LDFLAGS+= $(HDF5_LIBS) -lTOOLSDS -lSalomeNS -lSalomeHDFPersist -lOpUtil -lSALOMELocalTrace $(CAS_LDPATH) -lTKCAF -lSalomeGenericObj -lSalomeLifeCycleCORBA
 
 @CONCLUDE@
 
index fd338ac711296ec816d9edf27f37af1b18a0fccb..b1ec78bf08f1c4c991f4d09f89e5924529105b5f 100644 (file)
@@ -44,6 +44,11 @@ char* SALOMEDS_AttributeIOR_i::Value()
 void SALOMEDS_AttributeIOR_i::SetValue(const char* value) 
 {
   CheckLocked();
+
+  SALOMEDS::Study_var aStudy = SALOMEDS_Study_i::GetStudy(_myAttr->Label(), _myOrb);
+  aStudy->AddCreatedPostponed(value);
+  aStudy->AddPostponed(Value());
+
   CORBA::String_var Str = CORBA::string_dup(value);
   Handle(TDataStd_Comment)::DownCast(_myAttr)->Set(TCollection_ExtendedString(Str));
   SALOMEDS_Study_i::IORUpdated(Handle(SALOMEDS_IORAttribute)::DownCast(_myAttr),_myOrb);
index a0afc4e53d59a38b90ab9dd6c4081fc3c3ba7e22..d3cb87809a69c2f03bbb04b00a4583976ee5f3c9 100644 (file)
@@ -28,7 +28,8 @@
 
 using namespace std;
 #include "utilities.h"
-#include "SALOMEDS_StudyBuilder_i.hxx"
+#include "SALOMEDS_Study_i.hxx"
+//#include "SALOMEDS_StudyBuilder_i.hxx"
 #include "SALOMEDS_SObject_i.hxx"
 #include "SALOMEDS_SComponent_i.hxx"
 
@@ -111,6 +112,7 @@ SALOMEDS_StudyBuilder_i::~SALOMEDS_StudyBuilder_i()
 SALOMEDS::SComponent_ptr 
 SALOMEDS_StudyBuilder_i::NewComponent(const char* DataType)
 {
+  CheckLocked();
   //Always create component under main label.
   TDF_Label L  = _doc->Main();
 
@@ -144,6 +146,7 @@ SALOMEDS_StudyBuilder_i::NewComponent(const char* DataType)
 void SALOMEDS_StudyBuilder_i::DefineComponentInstance(SALOMEDS::SComponent_ptr aComponent,
                                                 CORBA::Object_ptr IOR)
 {
+  CheckLocked();
   //Find label
   TDF_Label Lab;
   ASSERT(!CORBA::is_nil(aComponent));
@@ -165,6 +168,7 @@ void SALOMEDS_StudyBuilder_i::DefineComponentInstance(SALOMEDS::SComponent_ptr a
 void 
 SALOMEDS_StudyBuilder_i::RemoveComponent(SALOMEDS::SComponent_ptr aComponent)
 {
+  CheckLocked();
   ASSERT(!CORBA::is_nil(aComponent));
   RemoveObject(aComponent);
 }
@@ -177,6 +181,7 @@ SALOMEDS_StudyBuilder_i::RemoveComponent(SALOMEDS::SComponent_ptr aComponent)
 SALOMEDS::SObject_ptr 
 SALOMEDS_StudyBuilder_i::NewObject(SALOMEDS::SObject_ptr theFatherObject)
 {
+  CheckLocked();
   TCollection_AsciiString anEntry;
  
   //Find label of father
@@ -213,6 +218,7 @@ SALOMEDS::SObject_ptr
 SALOMEDS_StudyBuilder_i::NewObjectToTag(SALOMEDS::SObject_ptr theFatherObject,
                                        CORBA::Long atag)
 {
+  CheckLocked();
   //Find label of father
   TDF_Label Lab;
 
@@ -237,6 +243,7 @@ SALOMEDS_StudyBuilder_i::NewObjectToTag(SALOMEDS::SObject_ptr theFatherObject,
 //============================================================================
 void SALOMEDS_StudyBuilder_i::RemoveObject(SALOMEDS::SObject_ptr anObject)
 {
+  CheckLocked();
   if(!CORBA::is_nil(_callbackOnRemove)) _callbackOnRemove->OnRemoveSObject(anObject);
 
   TDF_Label Lab;
@@ -250,6 +257,10 @@ void SALOMEDS_StudyBuilder_i::RemoveObject(SALOMEDS::SObject_ptr anObject)
       aTarget->Remove(Lab);
   }
 
+  Handle(SALOMEDS_IORAttribute) anAttr; // postponed removing of CORBA objects
+  if (Lab.FindAttribute(SALOMEDS_IORAttribute::GetID(), anAttr))
+    SALOMEDS_Study_i::GetStudy(_doc->Main(), _orb)->AddPostponed(strdup(TCollection_AsciiString(anAttr->Get()).ToCString()));
+
   Lab.ForgetAllAttributes();
 }
 
@@ -260,6 +271,7 @@ void SALOMEDS_StudyBuilder_i::RemoveObject(SALOMEDS::SObject_ptr anObject)
 //============================================================================
 void SALOMEDS_StudyBuilder_i::RemoveObjectWithChildren(SALOMEDS::SObject_ptr anObject)
 {
+  CheckLocked();
   if(!CORBA::is_nil(_callbackOnRemove)) _callbackOnRemove->OnRemoveSObject(anObject);
 
   TDF_Label Lab;
@@ -272,6 +284,9 @@ void SALOMEDS_StudyBuilder_i::RemoveObjectWithChildren(SALOMEDS::SObject_ptr anO
     if (aReference->Get().FindAttribute(SALOMEDS_TargetAttribute::GetID(),aTarget))
       aTarget->Remove(Lab);
   }
+  Handle(SALOMEDS_IORAttribute) anAttr; // postponed removing of CORBA objects
+  if (Lab.FindAttribute(SALOMEDS_IORAttribute::GetID(), anAttr))
+    SALOMEDS_Study_i::GetStudy(_doc->Main(), _orb)->AddPostponed(strdup(TCollection_AsciiString(anAttr->Get()).ToCString()));
 
   TDF_ChildIterator it(Lab);
   for(;it.More();it.Next()) {
@@ -281,6 +296,9 @@ void SALOMEDS_StudyBuilder_i::RemoveObjectWithChildren(SALOMEDS::SObject_ptr anO
       if (aReference->Get().FindAttribute(SALOMEDS_TargetAttribute::GetID(),aTarget))
        aTarget->Remove(aLabel);
     }
+    Handle(SALOMEDS_IORAttribute) anAttr; // postponed removing of CORBA objects
+    if (aLabel.FindAttribute(SALOMEDS_IORAttribute::GetID(), anAttr))
+      SALOMEDS_Study_i::GetStudy(_doc->Main(), _orb)->AddPostponed(strdup(TCollection_AsciiString(anAttr->Get()).ToCString()));
   }
 
   Lab.ForgetAllAttributes(Standard_True);
@@ -546,6 +564,7 @@ SALOMEDS::GenericAttribute_ptr SALOMEDS_StudyBuilder_i::FindOrCreateAttribute(SA
   if (strcmp(aTypeOfAttribute, "AttributeReal") == 0 ) {
     Handle(TDataStd_Real) anAttr;
     if (!Lab.FindAttribute(TDataStd_Real::GetID(), anAttr)) {
+      CheckLocked();
       anAttr = new TDataStd_Real;
       Lab.AddAttribute(anAttr); 
     }
@@ -556,6 +575,7 @@ SALOMEDS::GenericAttribute_ptr SALOMEDS_StudyBuilder_i::FindOrCreateAttribute(SA
   else if (strcmp(aTypeOfAttribute, "AttributeInteger") == 0 ) {
     Handle(TDataStd_Integer) anAttr;
     if (!Lab.FindAttribute(TDataStd_Integer::GetID(), anAttr)) {
+      CheckLocked();
       anAttr = new TDataStd_Integer;
       Lab.AddAttribute(anAttr); 
     }
@@ -566,6 +586,7 @@ SALOMEDS::GenericAttribute_ptr SALOMEDS_StudyBuilder_i::FindOrCreateAttribute(SA
   else if (strcmp(aTypeOfAttribute, "AttributeSequenceOfReal") == 0 ) {
     Handle(SALOMEDS_SequenceOfRealAttribute) anAttr;
     if (!Lab.FindAttribute(SALOMEDS_SequenceOfRealAttribute::GetID(), anAttr)) {
+      CheckLocked();
       anAttr = new SALOMEDS_SequenceOfRealAttribute;
       Lab.AddAttribute(anAttr); 
     }
@@ -576,6 +597,7 @@ SALOMEDS::GenericAttribute_ptr SALOMEDS_StudyBuilder_i::FindOrCreateAttribute(SA
   else if (strcmp(aTypeOfAttribute, "AttributeSequenceOfInteger") == 0 ) {
     Handle(SALOMEDS_SequenceOfIntegerAttribute) anAttr;
     if (!Lab.FindAttribute(SALOMEDS_SequenceOfIntegerAttribute::GetID(), anAttr)) {
+      CheckLocked();
       anAttr = new SALOMEDS_SequenceOfIntegerAttribute;
       Lab.AddAttribute(anAttr); 
     }
@@ -586,6 +608,7 @@ SALOMEDS::GenericAttribute_ptr SALOMEDS_StudyBuilder_i::FindOrCreateAttribute(SA
   else if (strcmp(aTypeOfAttribute, "AttributeName") == 0 ) {
     Handle(TDataStd_Name) anAttr;
     if (!Lab.FindAttribute(TDataStd_Name::GetID(), anAttr)) {
+      CheckLocked();
       anAttr = new TDataStd_Name;
       Lab.AddAttribute(anAttr); 
     }
@@ -596,6 +619,7 @@ SALOMEDS::GenericAttribute_ptr SALOMEDS_StudyBuilder_i::FindOrCreateAttribute(SA
   else if (strcmp(aTypeOfAttribute, "AttributeComment") == 0 ) {
     Handle(TDataStd_Comment) anAttr;
     if (!Lab.FindAttribute(TDataStd_Comment::GetID(), anAttr)) {
+      CheckLocked();
       anAttr = new TDataStd_Comment;
       Lab.AddAttribute(anAttr); 
     }
@@ -626,6 +650,7 @@ SALOMEDS::GenericAttribute_ptr SALOMEDS_StudyBuilder_i::FindOrCreateAttribute(SA
   else if (strcmp(aTypeOfAttribute, "AttributeIOR") == 0 ) {
     Handle(SALOMEDS_IORAttribute) anAttr;
     if (!Lab.FindAttribute(SALOMEDS_IORAttribute::GetID(), anAttr)) {
+      CheckLocked();
       anAttr = new SALOMEDS_IORAttribute;
       Lab.AddAttribute(anAttr); 
     }
@@ -686,6 +711,7 @@ SALOMEDS::GenericAttribute_ptr SALOMEDS_StudyBuilder_i::FindOrCreateAttribute(SA
   else if (strcmp(aTypeOfAttribute, "AttributeTextColor") == 0 ) {
     Handle(SALOMEDS_TextColorAttribute) anAttr;
     if (!Lab.FindAttribute(SALOMEDS_TextColorAttribute::GetID(), anAttr)) {
+      CheckLocked();
       anAttr = new SALOMEDS_TextColorAttribute;
       Lab.AddAttribute(anAttr); 
     }
@@ -696,6 +722,7 @@ SALOMEDS::GenericAttribute_ptr SALOMEDS_StudyBuilder_i::FindOrCreateAttribute(SA
   else if (strcmp(aTypeOfAttribute, "AttributeTextHighlightColor") == 0 ) {
     Handle(SALOMEDS_TextHighlightColorAttribute) anAttr;
     if (!Lab.FindAttribute(SALOMEDS_TextHighlightColorAttribute::GetID(), anAttr)) {
+      CheckLocked();
       anAttr = new SALOMEDS_TextHighlightColorAttribute;
       Lab.AddAttribute(anAttr); 
     }
@@ -706,6 +733,7 @@ SALOMEDS::GenericAttribute_ptr SALOMEDS_StudyBuilder_i::FindOrCreateAttribute(SA
   else if (strcmp(aTypeOfAttribute, "AttributePixMap") == 0 ) {
     Handle(SALOMEDS_PixMapAttribute) anAttr;
     if (!Lab.FindAttribute(SALOMEDS_PixMapAttribute::GetID(), anAttr)) {
+      CheckLocked();
       anAttr = new SALOMEDS_PixMapAttribute;
       Lab.AddAttribute(anAttr); 
     }
@@ -724,16 +752,20 @@ SALOMEDS::GenericAttribute_ptr SALOMEDS_StudyBuilder_i::FindOrCreateAttribute(SA
       delete(aGUIDString);
     }
     Handle(TDataStd_TreeNode) anAttr;
-    if (!Lab.FindAttribute(aTreeNodeGUID, anAttr))
+    if (!Lab.FindAttribute(aTreeNodeGUID, anAttr)) {
+      CheckLocked();
       anAttr = TDataStd_TreeNode::Set(Lab, aTreeNodeGUID);
+    }
     SALOMEDS_AttributeTreeNode_i* aTreeNodeAttr = new SALOMEDS_AttributeTreeNode_i(anAttr, _orb);
     SALOMEDS::AttributeTreeNode_var aTNA = aTreeNodeAttr->AttributeTreeNode::_this();
     return  aTNA._retn();
   }
   else if (strncmp(aTypeOfAttribute, "AttributeUserID",15) == 0 ) {
     Handle(TDataStd_UAttribute) anAttr;
-    if (!Lab.FindAttribute(SALOMEDS_AttributeUserID_i::DefaultID(), anAttr))
+    if (!Lab.FindAttribute(SALOMEDS_AttributeUserID_i::DefaultID(), anAttr)) {
+      CheckLocked();
       anAttr = TDataStd_UAttribute::Set(Lab, SALOMEDS_AttributeUserID_i::DefaultID());
+    }
     SALOMEDS_AttributeUserID_i* aUAttr = new SALOMEDS_AttributeUserID_i(anAttr, _orb);
     SALOMEDS::AttributeUserID_var aUA = aUAttr->AttributeUserID::_this();
     return  aUA._retn();
@@ -741,6 +773,7 @@ SALOMEDS::GenericAttribute_ptr SALOMEDS_StudyBuilder_i::FindOrCreateAttribute(SA
   else if (strcmp(aTypeOfAttribute, "AttributeLocalID") == 0 ) {
     Handle(SALOMEDS_LocalIDAttribute) anAttr;
     if (!Lab.FindAttribute(SALOMEDS_LocalIDAttribute::GetID(), anAttr)) {
+      CheckLocked();
       anAttr = new SALOMEDS_LocalIDAttribute;
       Lab.AddAttribute(anAttr); 
     }
@@ -761,6 +794,7 @@ SALOMEDS::GenericAttribute_ptr SALOMEDS_StudyBuilder_i::FindOrCreateAttribute(SA
   else if (strcmp(aTypeOfAttribute, "AttributeTableOfInteger") == 0 ) {
     Handle(SALOMEDS_TableOfIntegerAttribute) anAttr;
     if (!Lab.FindAttribute(SALOMEDS_TableOfIntegerAttribute::GetID(), anAttr)) {
+      CheckLocked();
       anAttr = new SALOMEDS_TableOfIntegerAttribute;
       Lab.AddAttribute(anAttr); 
     }
@@ -771,6 +805,7 @@ SALOMEDS::GenericAttribute_ptr SALOMEDS_StudyBuilder_i::FindOrCreateAttribute(SA
   else if (strcmp(aTypeOfAttribute, "AttributeTableOfReal") == 0 ) {
     Handle(SALOMEDS_TableOfRealAttribute) anAttr;
     if (!Lab.FindAttribute(SALOMEDS_TableOfRealAttribute::GetID(), anAttr)) {
+      CheckLocked();
       anAttr = new SALOMEDS_TableOfRealAttribute;
       Lab.AddAttribute(anAttr); 
     }
@@ -781,6 +816,7 @@ SALOMEDS::GenericAttribute_ptr SALOMEDS_StudyBuilder_i::FindOrCreateAttribute(SA
   else if (strcmp(aTypeOfAttribute, "AttributeTableOfString") == 0 ) {
     Handle(SALOMEDS_TableOfStringAttribute) anAttr;
     if (!Lab.FindAttribute(SALOMEDS_TableOfStringAttribute::GetID(), anAttr)) {
+      CheckLocked();
       anAttr = new SALOMEDS_TableOfStringAttribute;
       Lab.AddAttribute(anAttr); 
     }
@@ -791,9 +827,12 @@ SALOMEDS::GenericAttribute_ptr SALOMEDS_StudyBuilder_i::FindOrCreateAttribute(SA
   else if (strcmp(aTypeOfAttribute, "AttributeStudyProperties") == 0 ) {
     Handle(SALOMEDS_StudyPropertiesAttribute) anAttr;
     if (!Lab.FindAttribute(SALOMEDS_StudyPropertiesAttribute::GetID(), anAttr)) {
-      anAttr = new SALOMEDS_StudyPropertiesAttribute;
-      Lab.AddAttribute(anAttr); 
-      anAttr->SetModified(0);
+      CheckLocked();
+      if (!Lab.FindAttribute(SALOMEDS_StudyPropertiesAttribute::GetID(), anAttr)) {
+       anAttr = new SALOMEDS_StudyPropertiesAttribute;
+       Lab.AddAttribute(anAttr); 
+       anAttr->SetModified(0);
+      }
     }
     SALOMEDS_AttributeStudyProperties_i* aStPropAttr = new SALOMEDS_AttributeStudyProperties_i(anAttr, _orb);
     SALOMEDS::AttributeStudyProperties_var aSPA = aStPropAttr->AttributeStudyProperties::_this();
@@ -802,6 +841,7 @@ SALOMEDS::GenericAttribute_ptr SALOMEDS_StudyBuilder_i::FindOrCreateAttribute(SA
   else if (strcmp(aTypeOfAttribute, "AttributePythonObject") == 0 ) {
     Handle(SALOMEDS_PythonObjectAttribute) anAttr;
     if (!Lab.FindAttribute(SALOMEDS_PythonObjectAttribute::GetID(), anAttr)) {
+      CheckLocked();
       anAttr = new SALOMEDS_PythonObjectAttribute;
       Lab.AddAttribute(anAttr); 
     }
@@ -968,12 +1008,21 @@ CORBA::Boolean SALOMEDS_StudyBuilder_i::FindAttribute(SALOMEDS::SObject_ptr anOb
 //============================================================================
 
 void SALOMEDS_StudyBuilder_i::RemoveAttribute(SALOMEDS::SObject_ptr anObject, 
-                                                                     const char* aTypeOfAttribute)
+                                             const char* aTypeOfAttribute)
 {
+  CheckLocked();
   TDF_Label Lab;
   ASSERT(!CORBA::is_nil(anObject));
   CORBA::String_var anobid = anObject->GetID();
   TDF_Tool::Label(_doc->GetData(),strdup(anobid),Lab);
+  
+  if (strcmp(aTypeOfAttribute, "AttributeIOR") == 0) { // postponed removing of CORBA objects
+    Handle(SALOMEDS_IORAttribute) anAttr;
+    if (Lab.FindAttribute(SALOMEDS_IORAttribute::GetID(), anAttr))
+      SALOMEDS_Study_i::GetStudy(_doc->Main(), _orb)->AddPostponed(strdup(TCollection_AsciiString(anAttr->Get()).ToCString()));
+    else return;
+  }
+
   Lab.ForgetAttribute (SALOMEDS_SObject_i::ReturnGUIDForAttribute(aTypeOfAttribute));
 }
 
@@ -986,6 +1035,7 @@ void
 SALOMEDS_StudyBuilder_i::Addreference(SALOMEDS::SObject_ptr me, 
                                      SALOMEDS::SObject_ptr theReferencedObject)
 {
+  CheckLocked();
   TDF_Label Lab;
   ASSERT(!CORBA::is_nil(me));
   CORBA::String_var meid = me->GetID();
@@ -1009,6 +1059,7 @@ SALOMEDS_StudyBuilder_i::Addreference(SALOMEDS::SObject_ptr me,
 //============================================================================
 void SALOMEDS_StudyBuilder_i::AddDirectory(const char* thePath) 
 {
+  CheckLocked();
   if(thePath == NULL || strlen(thePath) == 0) throw SALOMEDS::Study::StudyInvalidDirectory();
 
   TCollection_AsciiString aPath(CORBA::string_dup(thePath)), aContext(""), aFatherPath;
@@ -1075,6 +1126,7 @@ void SALOMEDS_StudyBuilder_i::AddDirectory(const char* thePath)
 //============================================================================
 void SALOMEDS_StudyBuilder_i::SetGUID(SALOMEDS::SObject_ptr anObject, const char* theGUID)
 {
+  CheckLocked();
   TDF_Label aLabel;
   ASSERT(!CORBA::is_nil(anObject));
   CORBA::String_var anEntry = anObject->GetID();
@@ -1132,6 +1184,8 @@ void SALOMEDS_StudyBuilder_i::CommitCommand() throw (SALOMEDS::StudyBuilder::Loc
     AbortCommand();
     throw SALOMEDS::StudyBuilder::LockProtection();
   } else {
+    SALOMEDS_Study_i::GetStudy(_doc->Main(), _orb)->RemovePostponed(_doc->GetUndoLimit());
+
     int aModif = anAttr->GetModified();
     if (aModif < 0) aModif = 1000; // if user make undo and then - new transaction "modify" will never be zero
     anAttr->SetModified(aModif+1);
@@ -1156,6 +1210,8 @@ CORBA::Boolean SALOMEDS_StudyBuilder_i::HasOpenCommand()
 //============================================================================
 void SALOMEDS_StudyBuilder_i::AbortCommand()
 {
+  SALOMEDS_Study_i::GetStudy(_doc->Main(), _orb)->UndoPostponed(0);
+  
   _doc->AbortCommand();
 }
 
@@ -1175,6 +1231,7 @@ void SALOMEDS_StudyBuilder_i::Undo() throw (SALOMEDS::StudyBuilder::LockProtecti
     INFOS("Locked document modification !!!");
     throw SALOMEDS::StudyBuilder::LockProtection();
   } else {
+    SALOMEDS_Study_i::GetStudy(_doc->Main(), _orb)->UndoPostponed(1);
     _doc->Undo();
     anAttr->SetModified(anAttr->GetModified()-1);
   }
@@ -1198,6 +1255,7 @@ void SALOMEDS_StudyBuilder_i::Redo() throw (SALOMEDS::StudyBuilder::LockProtecti
     throw SALOMEDS::StudyBuilder::LockProtection();
   } else {
     _doc->Redo();
+    SALOMEDS_Study_i::GetStudy(_doc->Main(), _orb)->UndoPostponed(-1);
     anAttr->SetModified(anAttr->GetModified()+1);
   }
 }
@@ -1222,7 +1280,6 @@ CORBA::Boolean  SALOMEDS_StudyBuilder_i::GetAvailableRedos()
   return _doc->GetAvailableRedos();
 }
 
-
 //============================================================================
 /*! Function : UndoLimit
  *  Purpose  : 
@@ -1240,6 +1297,7 @@ CORBA::Long  SALOMEDS_StudyBuilder_i::UndoLimit()
 //============================================================================
 void  SALOMEDS_StudyBuilder_i::UndoLimit(CORBA::Long n)
 {
+  CheckLocked();
   _doc->SetUndoLimit (n);
 }
 
@@ -1266,3 +1324,13 @@ SALOMEDS::Callback_ptr SALOMEDS_StudyBuilder_i::SetOnRemoveSObject(SALOMEDS::Cal
   _callbackOnRemove = SALOMEDS::Callback::_duplicate(theCallback);
   return aRet;
 }
+
+void SALOMEDS_StudyBuilder_i::CheckLocked() throw (SALOMEDS::StudyBuilder::LockProtection) {
+  if (_doc->HasOpenCommand()) return;
+  Handle(SALOMEDS_StudyPropertiesAttribute) anAttr;
+  if (!_doc->Main().FindAttribute(SALOMEDS_StudyPropertiesAttribute::GetID(), anAttr)) {
+    anAttr = new SALOMEDS_StudyPropertiesAttribute;
+    _doc->Main().AddAttribute(anAttr);
+  }
+  if (anAttr->IsLocked()) throw SALOMEDS::StudyBuilder::LockProtection();
+}
index 14313fac61f9aab509b7ab0b2f947f26a10e4a8a..f282e4e97ec140382c8978579c520b5f8edd98d6 100644 (file)
@@ -138,6 +138,8 @@ public:
   virtual CORBA::Long UndoLimit();
   virtual void UndoLimit(CORBA::Long);
 
+  void CheckLocked() throw (SALOMEDS::StudyBuilder::LockProtection);
+
   virtual SALOMEDS::Callback_ptr SetOnAddSObject(SALOMEDS::Callback_ptr theCallback);
   virtual SALOMEDS::Callback_ptr SetOnRemoveSObject(SALOMEDS::Callback_ptr theCallback);
 };
index 4d12d2379154387ca9d96bfcc4fb28102f85a030..ba14acbf02c176f2c122267262f05f4187b42299 100644 (file)
@@ -28,6 +28,7 @@
 
 using namespace std;
 #include "utilities.h"
+#include "SALOME_LifeCycleCORBA.hxx"
 #include "SALOMEDS_StudyManager_i.hxx"
 #include "SALOMEDS_Study_i.hxx"
 #include "SALOMEDS_SComponent_i.hxx"
@@ -75,8 +76,12 @@ using namespace std;
 
 #include <strstream>
 
-#define USE_CASE_LABEL_ID            "0:2"
+#include <SALOME_GenericObj_i.hh>
 
+#define USE_CASE_LABEL_ID             "0:2"
+#define AUTO_SAVE_GUID                "128268A3-71C9-4036-89B1-F81BD6A4FCF2"
+#define AUTO_SAVE_TAG                 "0:8"
+#define AUTO_SAVE_TIME_OUT_IN_SECONDS 1200
 //===========================================================================
 //Function : LoadAttributes
 //===========================================================================
@@ -583,35 +588,15 @@ SALOMEDS::Study_ptr  SALOMEDS_StudyManager_i::Open(const char* aUrl)
   _IDcounter++;
   Study->StudyId( _IDcounter );
 
-  // Register study in the naming service
-  // Path to acces the study
-  if(!_name_service->Change_Directory("/Study")) 
-      MESSAGE( "Unable to access the study directory" )
-  else
-    {
-      char* aPath = CORBA::string_dup(aUrl);
-      char *aName = NULL;
-      char *adr = strtok(aPath, "/");
-      while (adr)
-       {
-         aName = adr;
-         adr = strtok(NULL, "/");
-       }
-      adr = aName;
-      aName = strtok(adr, ".");
-      SCRUTE(aName);
-      _name_service->Register(Study, CORBA::string_dup(aName));
-      CORBA::string_free(aPath);
-    }
+  // Assign the value of the URL in the study object
+  Study->URL (aUrl);
+  SCRUTE(aUrl);
 
   // Assign the value of the IOR in the study->root
   CORBA::String_var IORStudy = _orb->object_to_string(Study);
   SALOMEDS_IORAttribute::Set(Doc->Main().Root(),
                             TCollection_ExtendedString(CORBA::string_dup(IORStudy)),_orb);
 
-  // Assign the value of the URL in the study object
-  Study->URL (aUrl);
-  SCRUTE(aUrl);
   SALOMEDS_PersRefAttribute::Set(Doc->Main(),strdup(aUrl)); 
 
   if (!hdf_file->ExistInternalObject("STUDY_STRUCTURE")) {
@@ -640,6 +625,12 @@ SALOMEDS::Study_ptr  SALOMEDS_StudyManager_i::Open(const char* aUrl)
   
   hdf_file->CloseOnDisk();
 
+  // Register study in the naming service
+  // Path to acces the study
+  if(!_name_service->Change_Directory("/Study")) MESSAGE( "Unable to access the study directory" )
+  else _name_service->Register(Study, CORBA::string_dup(Study->Name()));
+
+
   if (isASCII) {
     SALOMEDS::ListOfFileNames_var aFilesToRemove = new SALOMEDS::ListOfFileNames;
     aFilesToRemove->length(1);
@@ -663,7 +654,9 @@ SALOMEDS::Study_ptr  SALOMEDS_StudyManager_i::Open(const char* aUrl)
 void  SALOMEDS_StudyManager_i::Close(SALOMEDS::Study_ptr aStudy)
 {
   if(aStudy->_is_nil()) return;
-    
+  
+  aStudy->RemovePostponed(-1);
+  
   // Destroy study name in the naming service
   if(_name_service->Change_Directory("/Study")) 
     _name_service->Destroy_Name(aStudy->Name());
@@ -705,18 +698,12 @@ void SALOMEDS_StudyManager_i::SaveASCII(SALOMEDS::Study_ptr aStudy, CORBA::Boole
 //============================================================================
 void SALOMEDS_StudyManager_i::SaveAs(const char* aUrl, SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile)
 {
-  // Save the URL of the Study => to be used with the function "Save"
-  aStudy->URL(aUrl);
-  
   _SaveAs(aUrl,aStudy,theMultiFile, false);
 
 }
 
 void SALOMEDS_StudyManager_i::SaveAsASCII(const char* aUrl, SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile)
 {
-  // Save the URL of the Study => to be used with the function "Save"
-  aStudy->URL(aUrl);
-  
   _SaveAs(aUrl,aStudy,theMultiFile, true);
 }
 
@@ -1300,11 +1287,61 @@ void SALOMEDS_StudyManager_i::_SaveAs(const char* aUrl,
 
   SALOMEDS::StudyBuilder_var SB= aStudy->NewBuilder();
 
-  aStudy->URL(aUrl);
-
   ASSERT(!CORBA::is_nil(aStudy));
   try
     {
+      // mpv 15.12.2003: for saving components we have to load all data from all modules
+
+      SALOMEDS::SComponentIterator_var itcomponent1 = aStudy->NewComponentIterator();
+      for (; itcomponent1->More(); itcomponent1->Next())
+       {
+         SALOMEDS::SComponent_var sco = itcomponent1->Value();
+         // if there is an associated Engine call its method for saving
+         CORBA::String_var IOREngine;
+         try {
+           
+           if (!sco->ComponentIOR(IOREngine)) {
+             SALOMEDS::GenericAttribute_var aGeneric;
+             SALOMEDS::AttributeName_var aName;
+             if(sco->FindAttribute(aGeneric, "AttributeName"))
+               aName = SALOMEDS::AttributeName::_narrow(aGeneric);
+
+             if (!aName->_is_nil()) {
+               
+               CORBA::String_var aCompType = aName->Value();
+
+               
+               CORBA::String_var aFactoryType;
+               if (strcmp(aCompType, "SUPERV") == 0) aFactoryType = "SuperVisionContainer";
+               else aFactoryType = "FactoryServer";
+               
+               Engines::Component_var aComp =
+                 SALOME_LifeCycleCORBA(_name_service).FindOrLoad_Component(aFactoryType, aCompType);
+               
+               if (aComp->_is_nil()) {
+                 Engines::Component_var aComp =
+                   SALOME_LifeCycleCORBA(_name_service).FindOrLoad_Component("FactoryServerPy", aCompType);
+               }
+               
+               if (!aComp->_is_nil()) {
+                 SALOMEDS::Driver_var aDriver = SALOMEDS::Driver::_narrow(aComp);
+                 if (!CORBA::is_nil(aDriver)) {
+                   SB->LoadWith(sco, aDriver);
+                 }
+               }
+             }
+           }
+         } catch(...) {
+           MESSAGE("Can not restore information to resave it");
+           return;
+         }
+       }
+
+
+
+      CORBA::String_var anOldName = aStudy->Name();
+      aStudy->URL(aUrl);
+
       // To change for Save 
       // Do not have to do a new file but just a Open??? Rewrite all informations after erasing evrything??
       hdf_file = new HDFfile((char *)aUrl);
@@ -1318,6 +1355,10 @@ void SALOMEDS_StudyManager_i::_SaveAs(const char* aUrl,
       hdf_group_datacomponent->CreateOnDisk();
 
       SALOMEDS::SComponentIterator_var itcomponent = aStudy->NewComponentIterator();
+      
+      //SRN: Added 17 Nov, 2003
+      SALOMEDS::SObject_var anAutoSaveSO = aStudy->FindObjectID(AUTO_SAVE_TAG);
+      //SRN: End
 
       for (; itcomponent->More(); itcomponent->Next())
        {
@@ -1329,7 +1370,42 @@ void SALOMEDS_StudyManager_i::_SaveAs(const char* aUrl,
 
          CORBA::String_var componentDataType = sco->ComponentDataType();
          MESSAGE ( "Look for  an engine for data type :"<< componentDataType);
-         // if there is an associated Engine call its method for saving
+
+         //SRN: Added 17 Nov 2003: If there is a specified attribute, the component peforms a special save       
+         if(!CORBA::is_nil(anAutoSaveSO) && SB->IsGUID(sco, AUTO_SAVE_GUID)) {     
+       
+           SALOMEDS::GenericAttribute_var aGeneric;
+           SALOMEDS::AttributeTableOfString_var aTable;
+           if(anAutoSaveSO->FindAttribute(aGeneric, "AttributeTableOfString")) {
+             aTable = SALOMEDS::AttributeTableOfString::_narrow(aGeneric);
+             Standard_Integer nbRows = aTable->GetNbRows(), k, aTimeOut = 0;
+              if(nbRows > 0 && aTable->GetNbColumns() > 1) {   
+
+               SALOMEDS::StringSeq_var aRow;
+               for(k=1; k<=nbRows; k++) {
+                 aRow = aTable->GetRow(k);
+                 if (strcmp(aRow[0], componentDataType) == 0) {
+                   CORBA::String_var anEntry = CORBA::string_dup(aRow[1]);
+                   SALOMEDS::SObject_var aCompSpecificSO = aStudy->FindObjectID(anEntry);
+                   if(!CORBA::is_nil(aCompSpecificSO)) {
+                     SALOMEDS::AttributeInteger_var anInteger;
+                     if(aCompSpecificSO->FindAttribute(aGeneric, "AttributeInteger")) {
+                       anInteger = SALOMEDS::AttributeInteger::_narrow(aGeneric);
+                       anInteger->SetValue(-1);
+                       while(anInteger->Value() < 0) { sleep(2); if(++aTimeOut > AUTO_SAVE_TIME_OUT_IN_SECONDS) break; }
+                     }  // if(aCompSpecificSO->FindAttribute(anInteger, "AttributeInteger"))
+                   }  // if(!CORBA::is_nil(aCompSpecificSO)) 
+                 }  // if (strcmp(aRow[0], componentDataType) == 0)
+               }  // for
+
+             }  // if(nbRows > 0 && aTable->GetNbColumns() > 1)
+
+           }  // if(anAutoSaveSO->FindAttribute(aTable, "AttributeTableOfString")
+
+         }  // if(SB->IsGUID(AUTO_SAVE_GUID)
+
+         //SRN: End
+
          CORBA::String_var IOREngine;
          if (sco->ComponentIOR(IOREngine))
            {
@@ -1344,6 +1420,7 @@ void SALOMEDS_StudyManager_i::_SaveAs(const char* aUrl,
                  MESSAGE("Engine :"<<Engine->ComponentDataType());
 
                  SALOMEDS::TMPFile_var aStream;
+
                   if (theASCII) aStream = Engine->SaveASCII(sco,SALOMEDS_Tool::GetDirFromPath(aUrl),theMultiFile);
                  else aStream = Engine->Save(sco,SALOMEDS_Tool::GetDirFromPath(aUrl),theMultiFile);
 
@@ -1452,6 +1529,11 @@ void SALOMEDS_StudyManager_i::_SaveAs(const char* aUrl,
 
       hdf_group_study_structure->CloseOnDisk();
       hdf_file->CloseOnDisk();
+
+      _name_service->Change_Directory("/Study");
+      _name_service->Destroy_Name(anOldName);
+      _name_service->Register(aStudy, aStudy->Name());
+
       aStudy->IsSaved(true);
       hdf_group_study_structure =0; // will be deleted by hdf_file destructor
       delete hdf_file; // recursively deletes all hdf objects...
@@ -1546,7 +1628,8 @@ CORBA::Boolean SALOMEDS_StudyManager_i::CanCopy(SALOMEDS::SObject_ptr theObject)
   CORBA::Object_var obj = _orb->string_to_object(IOREngine);
   SALOMEDS::Driver_var Engine = SALOMEDS::Driver::_narrow(obj) ;
   if (CORBA::is_nil(Engine)) return false;
-  return Engine->CanCopy(theObject);
+  Standard_Boolean a = Engine->CanCopy(theObject);
+  return a;
 }
 
 //============================================================================
index c282ab096f431937c5ce1fade24b8f2ef130ca52..ed98968e84807c471e040e5c042d386e987495fd 100644 (file)
@@ -39,6 +39,8 @@ using namespace std;
 #include <TDocStd_Owner.hxx>
 #include <CDM_Document.hxx>
 #include <CDM_Application.hxx>
+#include <TDF_ChildIDIterator.hxx>
+#include <SALOME_GenericObj_i.hh>
 #include "SALOMEDS_LocalIDAttribute.hxx"
 #include "SALOMEDS_PersRefAttribute.hxx"
 #include "SALOMEDS_UseCaseIterator_i.hxx"
@@ -65,6 +67,8 @@ SALOMEDS_Study_i::SALOMEDS_Study_i(const Handle(TDocStd_Document) doc,
   _URL = NULL;
   _StudyId = -1;
   _autoFill = true;
+  myNbPostponed.Append(0);
+  myNbUndos = 0;
 }
   
 //============================================================================
@@ -766,9 +770,20 @@ char* SALOMEDS_Study_i::URL()
 //============================================================================
 void SALOMEDS_Study_i::URL(const char* url)
 {
+  if (_URL) delete [] _URL;
   _URL = new char[strlen(url) +1];
   strcpy(_URL,url);
   SCRUTE(_URL);
+
+  char *aName = _URL;
+  char *adr = strtok(aName, "/");
+  while (adr)
+    {
+      aName = adr;
+      adr = strtok(NULL, "/");
+    }
+  strcpy(_URL,url);
+  Name(aName);
 }
 
 
@@ -863,22 +878,25 @@ void SALOMEDS_Study_i::UpdateIORLabelMap(const char* anIOR,const char* anEntry)
   myIORLabels.Bind(TCollection_ExtendedString(IOR), aLabel);
 }
 
-void SALOMEDS_Study_i::IORUpdated(const Handle(SALOMEDS_IORAttribute) theAttribute, CORBA::ORB_ptr orb) {
-  // get accorded study first
+SALOMEDS::Study_ptr SALOMEDS_Study_i::GetStudy(const TDF_Label theLabel, CORBA::ORB_ptr orb) {
   Handle(SALOMEDS_IORAttribute) Att;
-  if (theAttribute->Label().Root().FindAttribute(SALOMEDS_IORAttribute::GetID(),Att)){
-    TCollection_AsciiString ch(Att->Get());
-    char* IOR = CORBA::string_dup(ch.ToCString());
+  if (theLabel.Root().FindAttribute(SALOMEDS_IORAttribute::GetID(),Att)){
+    char* IOR = CORBA::string_dup(TCollection_AsciiString(Att->Get()).ToCString());
     CORBA::Object_var obj = orb->string_to_object(IOR);
     SALOMEDS::Study_ptr aStudy = SALOMEDS::Study::_narrow(obj) ;
     ASSERT(!CORBA::is_nil(aStudy));
-    TCollection_AsciiString aString;
-    TDF_Tool::Entry(theAttribute->Label(),aString);
-    aStudy->UpdateIORLabelMap(TCollection_AsciiString(theAttribute->Get()).ToCString(), aString.ToCString());
+    return SALOMEDS::Study::_duplicate(aStudy);
   } else {
-    INFOS("IORUpdated: Problem to get study");
-    return;
+    INFOS("GetStudy: Problem to get study");
   }
+  return SALOMEDS::Study::_nil();
+}
+
+void SALOMEDS_Study_i::IORUpdated(const Handle(SALOMEDS_IORAttribute) theAttribute, CORBA::ORB_ptr orb) {
+  TCollection_AsciiString aString;
+  TDF_Tool::Entry(theAttribute->Label(), aString);
+  GetStudy(theAttribute->Label(), orb)->UpdateIORLabelMap(TCollection_AsciiString(theAttribute->Get()).ToCString(),
+                                                         aString.ToCString());
 }
 
 SALOMEDS::Study::ListOfSObject* SALOMEDS_Study_i::FindDependances(SALOMEDS::SObject_ptr anObject) {
@@ -964,10 +982,12 @@ void SALOMEDS_Study_i::Close()
       // we have found the associated engine to write the data 
       MESSAGE ( "We have found an engine for data type :"<< sco->ComponentDataType());
       CORBA::Object_var obj = _orb->string_to_object(IOREngine);
-      SALOMEDS::Driver_var anEngine = SALOMEDS::Driver::_narrow(obj) ;
-             
-      if (!anEngine->_is_nil())  
-       anEngine->Close(sco);
+      if (!CORBA::is_nil(obj)) {
+       SALOMEDS::Driver_var anEngine = SALOMEDS::Driver::_narrow(obj) ;
+       
+       if (!anEngine->_is_nil())  
+         anEngine->Close(sco);
+      }
     }
   }
 
@@ -980,3 +1000,115 @@ void SALOMEDS_Study_i::Close()
   if(!anApp.IsNull()) anApp->Close(_doc);
   _doc.Nullify();
 }
+
+//============================================================================
+/*! Function : AddPostponed
+ *  Purpose  : 
+ */
+ //============================================================================
+void SALOMEDS_Study_i::AddPostponed(const char* theIOR) {
+  if (!NewBuilder()->HasOpenCommand()) return;
+  try {
+    CORBA::Object_var obj = _orb->string_to_object(theIOR);
+    if (!CORBA::is_nil(obj)) {
+      SALOME::GenericObj_var aGeneric = SALOME::GenericObj::_narrow(obj) ;
+      if (!CORBA::is_nil(aGeneric)) {
+       TCollection_AsciiString anIOR(strdup(theIOR));
+       anIOR.Prepend("d");
+       myPostponedIORs.Append(anIOR); // add prefix: deleted
+       myNbPostponed.SetValue(myNbPostponed.Length(), myNbPostponed.Last() + 1);
+      }
+    }
+  } catch(...) {}
+}
+
+void SALOMEDS_Study_i::AddCreatedPostponed(const char* theIOR) {
+  if (!NewBuilder()->HasOpenCommand()) return;
+  try {
+    CORBA::Object_var obj = _orb->string_to_object(theIOR);
+    if (!CORBA::is_nil(obj)) {
+      SALOME::GenericObj_var aGeneric = SALOME::GenericObj::_narrow(obj) ;
+      if (!CORBA::is_nil(aGeneric)) {
+       TCollection_AsciiString anIOR(strdup(theIOR));
+       anIOR.Prepend("c");
+       myPostponedIORs.Append(anIOR); // add prefix: created
+       myNbPostponed.SetValue(myNbPostponed.Length(), myNbPostponed.Last() + 1);
+      }
+    }
+  } catch(...) {}
+}
+
+//============================================================================
+/*! Function : RemovePostponed
+ *  Purpose  : 
+ */
+//============================================================================
+void SALOMEDS_Study_i::RemovePostponed(const CORBA::Long theUndoLimit) {
+  int anIndex;
+  int anOld;
+
+  int aUndoLimit = theUndoLimit;
+  if (theUndoLimit < 0) aUndoLimit = 0;
+
+  if (myNbUndos > 0) { // remove undone
+    anOld = 0;
+    for(anIndex = 1; anIndex < myNbPostponed.Length() - myNbUndos; anIndex++)
+      anOld += myNbPostponed(anIndex);
+    int aNew = myPostponedIORs.Length() - myNbPostponed.Last();
+
+    for(anIndex = anOld + 1; anIndex <= aNew; anIndex++) {
+      TCollection_AsciiString anIOR = myPostponedIORs(anIndex);
+      if (anIOR.Value(1) == 'c') {
+       CORBA::Object_var obj = _orb->string_to_object(strdup(anIOR.Split(1).ToCString()));
+       SALOME::GenericObj_var aGeneric = SALOME::GenericObj::_narrow(obj);
+       if (!CORBA::is_nil(aGeneric)) aGeneric->Destroy();
+      }
+    }
+    if (anOld < aNew) myPostponedIORs.Remove(anOld + 1, aNew);
+    if (myNbPostponed.Length() > 0) myNbPostponed.Remove(myNbPostponed.Length() - myNbUndos, myNbPostponed.Length() - 1);
+
+    myNbUndos = 0;
+  }
+
+  if (myNbPostponed.Length() > aUndoLimit) { // remove objects, that can not be undone
+    anOld = 0;
+    for(anIndex = myNbPostponed.Length() - aUndoLimit; anIndex >= 1; anIndex--)
+      anOld += myNbPostponed(anIndex);
+    for(anIndex = 1; anIndex <= anOld; anIndex++) {
+      TCollection_AsciiString anIOR = myPostponedIORs(anIndex);
+      if (anIOR.Value(1) == 'd') {
+       CORBA::Object_var obj = _orb->string_to_object(strdup(anIOR.Split(1).ToCString()));
+       SALOME::GenericObj_var aGeneric = SALOME::GenericObj::_narrow(obj);
+       if (!CORBA::is_nil(aGeneric)) aGeneric->Destroy();
+      }
+    }
+    if (anOld > 0) myPostponedIORs.Remove(1, anOld);
+    myNbPostponed.Remove(1, myNbPostponed.Length() - aUndoLimit);
+  }
+
+  if (theUndoLimit == -1) { // remove all IORs from the study on the study close
+    TDF_ChildIDIterator anIter(_doc->GetData()->Root(), SALOMEDS_IORAttribute::GetID(), Standard_True);
+    for(; anIter.More(); anIter.Next()) {
+      Handle(SALOMEDS_IORAttribute) anAttr = Handle(SALOMEDS_IORAttribute)::DownCast(anIter.Value());
+      CORBA::String_var anIOR = strdup(TCollection_AsciiString(anAttr->Get()).ToCString());
+      try {
+       CORBA::Object_var obj = _orb->string_to_object(anIOR);
+       SALOME::GenericObj_var aGeneric = SALOME::GenericObj::_narrow(obj);
+       if (!CORBA::is_nil(aGeneric)) aGeneric->Destroy();
+      } catch (...) {}
+    }
+  } else myNbPostponed.Append(0);
+}
+
+//============================================================================
+/*! Function : UndoPostponed
+ *  Purpose  : 
+ */
+//============================================================================
+void SALOMEDS_Study_i::UndoPostponed(const CORBA::Long theWay) {
+  myNbUndos += theWay;
+  // remove current postponed
+  if (myNbPostponed.Last() > 0)
+    myPostponedIORs.Remove(myPostponedIORs.Length() - myNbPostponed.Last() + 1, myPostponedIORs.Length());
+  myNbPostponed(myNbPostponed.Length()) = 0;
+}
index fa5cffabaf3e427eb06574f7ff7a549d8d55a87c..be93b95f99a698c325fb9ba3895415447b071466 100644 (file)
@@ -42,6 +42,8 @@
 #include <TDF_Data.hxx>
 #include <TDF_Label.hxx>
 #include <stdio.h>
+#include <TColStd_SequenceOfInteger.hxx>
+#include <TColStd_SequenceOfAsciiString.hxx>
 
 //SALOMEDS headers
 #include "SALOMEDS_SComponentIterator_i.hxx"
@@ -70,6 +72,12 @@ private:
   CORBA::Short             _StudyId;
 
   SALOMEDS_DataMapStringLabel myIORLabels;
+
+  // data structures for postponed destroying of CORBA object functionality
+  TColStd_SequenceOfAsciiString myPostponedIORs; // ordered set of IORs
+  TColStd_SequenceOfInteger myNbPostponed; // number of IOR in the each transaction
+  int myNbUndos; // number of current Undos, made by user
+
   TDF_Label                _current;
   bool                     _autoFill;  
 
@@ -257,6 +265,8 @@ public:
   virtual CORBA::Short StudyId();
   virtual void  StudyId(CORBA::Short id);
 
+  static SALOMEDS::Study_ptr GetStudy(const TDF_Label theLabel, CORBA::ORB_ptr orb);
+
   static void IORUpdated(const Handle(SALOMEDS_IORAttribute) theAttribute, CORBA::ORB_ptr orb);
 
   virtual void UpdateIORLabelMap(const char* anIOR, const char* aLabel);
@@ -277,5 +287,15 @@ public:
   virtual void Close();
 
   void EnableUseCaseAutoFilling(CORBA::Boolean isEnabled) { _autoFill = isEnabled; }
+
+  // postponed destroying of CORBA object functionality
+  virtual void AddPostponed(const char* theIOR);
+
+  virtual void AddCreatedPostponed(const char* theIOR);
+
+  virtual void RemovePostponed(const CORBA::Long theUndoLimit); // removes postponed IORs of old transaction
+                                                        // if theUndoLimit==0, removes all
+  virtual void UndoPostponed(const CORBA::Long theWay); // theWay = 1: resurrect objects,
+                                                // theWay = -1: get back to the list of postponed
 };
 #endif
index 7eb9b5545d549059e0fad11cf9e502f6e5c12b24..a5134a76f19690450ff36fc9f1e04a89717f88ea 100644 (file)
@@ -231,11 +231,11 @@ void SALOMEDS_TableOfIntegerAttribute::Restore(const Handle(TDF_Attribute)& with
   myNbColumns = aTable->myNbColumns;
   myTitle = aTable->myTitle;
   
-  for(anIndex = 1; anIndex <= aTable->GetNbRows();anIndex++) {
-    SetRowTitle(anIndex,aTable->GetRowTitle(anIndex));
-  }
+  for(anIndex = 1; anIndex <= aTable->GetNbRows();anIndex++)
+    myRows->Append(aTable->GetRowTitle(anIndex));
+
   for(anIndex = 1; anIndex <= aTable->GetNbColumns(); anIndex++) 
-    SetColumnTitle(anIndex, aTable->GetColumnTitle(anIndex));
+    myCols->Append(aTable->GetColumnTitle(anIndex));
 }
 
 Handle(TDF_Attribute) SALOMEDS_TableOfIntegerAttribute::NewEmpty() const
@@ -258,11 +258,10 @@ void SALOMEDS_TableOfIntegerAttribute::Paste(const Handle(TDF_Attribute)& into,
   aTable->myNbRows = myNbRows;
   aTable->myNbColumns = myNbColumns;
 
-  for(anIndex = 1; anIndex <= GetNbRows();anIndex++) {
-    aTable->SetRowTitle(anIndex,GetRowTitle(anIndex));
-  }
+  for(anIndex = 1; anIndex <= GetNbRows();anIndex++)
+    aTable->myRows->Append(GetRowTitle(anIndex));
   for(anIndex = 1; anIndex <= GetNbColumns(); anIndex++) 
-    aTable->SetColumnTitle(anIndex, GetColumnTitle(anIndex));
+    aTable->myCols->Append(GetColumnTitle(anIndex));
 }
 
 
index 4d6ae31c1c9aff560d106ab4f4550703c00b2030..d12b58bb2f84c239632f75f7812b58ead84995cb 100644 (file)
@@ -232,11 +232,11 @@ void SALOMEDS_TableOfRealAttribute::Restore(const Handle(TDF_Attribute)& with)
   myNbColumns = aTable->myNbColumns;
   myTitle = aTable->myTitle;
   
-  for(anIndex = 1; anIndex <= aTable->GetNbRows();anIndex++) {
-    SetRowTitle(anIndex,aTable->GetRowTitle(anIndex));
-  }
+  for(anIndex = 1; anIndex <= aTable->GetNbRows();anIndex++)
+    myRows->Append(aTable->GetRowTitle(anIndex));
+
   for(anIndex = 1; anIndex <= aTable->GetNbColumns(); anIndex++) 
-    SetColumnTitle(anIndex, aTable->GetColumnTitle(anIndex));
+    myCols->Append(aTable->GetColumnTitle(anIndex));
 }
 
 Handle(TDF_Attribute) SALOMEDS_TableOfRealAttribute::NewEmpty() const
@@ -259,11 +259,10 @@ void SALOMEDS_TableOfRealAttribute::Paste(const Handle(TDF_Attribute)& into,
   aTable->myNbRows = myNbRows;
   aTable->myNbColumns = myNbColumns;
 
-  for(anIndex = 1; anIndex <= GetNbRows();anIndex++) {
-    aTable->SetRowTitle(anIndex,GetRowTitle(anIndex));
-  }
+  for(anIndex = 1; anIndex <= GetNbRows();anIndex++)
+    aTable->myRows->Append(GetRowTitle(anIndex));
   for(anIndex = 1; anIndex <= GetNbColumns(); anIndex++) 
-    aTable->SetColumnTitle(anIndex, GetColumnTitle(anIndex));
+    aTable->myCols->Append(GetColumnTitle(anIndex));
 }
 
 
index 486cee1927df79580701cd39c8ea510cc0b5f931..737f1f752fde4b23930e765f300b65ef56a371a0 100644 (file)
@@ -231,11 +231,11 @@ void SALOMEDS_TableOfStringAttribute::Restore(const Handle(TDF_Attribute)& with)
   myNbColumns = aTable->myNbColumns;
   myTitle = aTable->myTitle;
   
-  for(anIndex = 1; anIndex <= aTable->GetNbRows();anIndex++) {
-    SetRowTitle(anIndex,aTable->GetRowTitle(anIndex));
-  }
+  for(anIndex = 1; anIndex <= aTable->GetNbRows();anIndex++)
+    myRows->Append(aTable->GetRowTitle(anIndex));
+
   for(anIndex = 1; anIndex <= aTable->GetNbColumns(); anIndex++) 
-    SetColumnTitle(anIndex, aTable->GetColumnTitle(anIndex));
+    myCols->Append(aTable->GetColumnTitle(anIndex));
 }
 
 Handle(TDF_Attribute) SALOMEDS_TableOfStringAttribute::NewEmpty() const
@@ -258,11 +258,10 @@ void SALOMEDS_TableOfStringAttribute::Paste(const Handle(TDF_Attribute)& into,
   aTable->myNbRows = myNbRows;
   aTable->myNbColumns = myNbColumns;
 
-  for(anIndex = 1; anIndex <= GetNbRows();anIndex++) {
-    aTable->SetRowTitle(anIndex,GetRowTitle(anIndex));
-  }
+  for(anIndex = 1; anIndex <= GetNbRows();anIndex++)
+    aTable->myRows->Append(GetRowTitle(anIndex));
   for(anIndex = 1; anIndex <= GetNbColumns(); anIndex++) 
-    aTable->SetColumnTitle(anIndex, GetColumnTitle(anIndex));
+    aTable->myCols->Append(GetColumnTitle(anIndex));
 }
 
 
index a0b08aa456a785da51025a5625fb637725dba31e..439362886164eb87beb35a7239e62b78b4c572a6 100644 (file)
@@ -396,7 +396,7 @@ const QString& QAD_Application::getStudyExtension() const
 */
 bool QAD_Application::isStudyOpened( const QString& studyName )
 {
-  QString Name = QAD_Tools::getFileNameFromPath( studyName, false );
+  QString Name = QAD_Tools::getFileNameFromPath( studyName, true );
   return (( getStudyByName( studyName ) != NULL ) || (getStudyByName( Name ) != NULL )); 
 }
 
@@ -464,7 +464,7 @@ void QAD_Application::helpAbout()
 void QAD_Application::helpSearch()
 {
   /* just calls QAD_Desktop::helpSearch() but can have own implementation */
- //  getDesktop()->helpSearch();
+//  getDesktop()->helpSearch();
 }
 
 /*!
@@ -473,7 +473,7 @@ void QAD_Application::helpSearch()
 void QAD_Application::helpContents()
 {
   /* just calls QAD_Desktop::helpContents() but can have own implementation */
- //  getDesktop()->helpContents();
+//  getDesktop()->helpContents();
 }
 
 /*!
@@ -801,7 +801,7 @@ QAD_Study* QAD_Application::newStudy()
     while ( exist ) {
       exist = false;
       for (unsigned int ind = 0; ind < List->length();ind++) {
-       QString NameS = QAD_Tools::getFileNameFromPath( QString( List[ind] ), false );
+       QString NameS = QAD_Tools::getFileNameFromPath( QString( List[ind] ), true );
        if ( NameS.compare( StudyName ) == 0 ) {
          StudyName = getDesktop()->getNewStudyName();
          exist = true;
@@ -914,8 +914,9 @@ QAD_Study* QAD_Application::openStudy( const QString& fileName )
       /* open StudyDS */
       SALOMEDS::Study_var aStudy = myStudyMgr->Open((char*) name.latin1());
 
+      //MPV: name of the study is set in the study manager now
       //NRI DEBUG : 11/02/2002
-      aStudy->Name( QAD_Tools::getFileNameFromPath(name,false) );
+      //aStudy->Name( QAD_Tools::getFileNameFromPath(name,true) );
 
       /* create QAD study */            
       openStudy = new QAD_Study( this, aStudy, fileName );
index 89a1bf2b815f408561efc31bccf39b897ccfada0..2c911191725392f94702531c3de640564910a1d3 100644 (file)
@@ -53,7 +53,7 @@ using namespace std;
 #include "QAD_ObjectBrowser.h"
 #include "QAD_Resource.h"
 #include "QAD_FileDlg.h"
-//NRI#include "QAD_HelpWindow.h"
+//NRI #include "QAD_HelpWindow.h"
 #include "QAD_DirListDlg.h"
 #include "QAD_WaitCursor.h"
 #include "SALOMEGUI_OpenWith.h"
@@ -66,6 +66,7 @@ using namespace std;
 #include "SALOME_ListIteratorOfListIO.hxx"
 #include "SALOMEGUI_AboutDlg.h"
 #include "SALOMEGUI_ViewChoiceDlg.h"
+#include "SALOMEGUI_SetValueDlg.h"
 #include "utilities.h"
 
 #include "SALOMEGUI_CloseDlg.h"
@@ -113,6 +114,18 @@ extern "C"
 QAD_ResourceMgr* QAD_Desktop::resourceMgr = 0;
 QPalette*       QAD_Desktop::palette = 0;
 
+static QString createString( int theItemId, int thePosId ) 
+{
+  QString aRetString = QString("item-id=");
+  QString aString;
+  QString aItemId = aString.setNum(theItemId);
+  QString aPosId = aString.setNum(thePosId);
+  aRetString = aRetString + '"'; aRetString = aRetString + aItemId; aRetString = aRetString + '"'; 
+  aRetString = aRetString + " pos-id="; aRetString = aRetString + '"';
+  aRetString = aRetString + aPosId; 
+  aRetString = aRetString + '"'; aRetString = aRetString + ">";
+  return aRetString;
+}
 
 /*!
     Creates the resource manager [ static ]
@@ -457,7 +470,7 @@ void QAD_Desktop::createActions()
     myMainMenu->insertItem ( tr("MEN_DESK_VIEW"),   &myViewPopup, 2 ); /* add popup VIEW */
     myMainMenu->insertItem ( tr("MEN_DESK_TOOLS"),  &myToolsPopup, 5 );        /* add popup TOOLS */
     myMainMenu->insertItem ( tr("MEN_DESK_PREF"),   &myPrefPopup, 4 ); /* add popup PREF */
-    myMainMenu->insertItem ( tr("MEN_DESK_WINDOW"), &myWindowPopup, 6 );/* add popup WINDOW */
+    myMainMenu->insertItem ( tr("MEN_DESK_WINDOW"), &myWindowPopup, 6 );       /* add popup WINDOW */
     myMainMenu->insertItem ( tr("MEN_DESK_HELP"),   &myHelpPopup, 7 ); /* add popup HELP */
 
     /* Applications will insert their items after 'File' 'Edit' and 'View'
@@ -728,6 +741,8 @@ void QAD_Desktop::createActions()
     QAD_ASSERT(connect( myQAG, SIGNAL(selected(QActionP * )), this, SLOT(onDefaultViewer(QActionP *) )));
     //VRV: T2.5 - add default viewer
 
+    myPrefPopup.insertSeparator();
+
     QActionP* viewerTrihedronAction = new QActionP( "", tr("MEN_DESK_PREF_VIEWER_TRIHEDRON"), 0, this );
     QAD_ASSERT(connect( viewerTrihedronAction, SIGNAL(activated()), this, SLOT(onViewerTrihedron() )));
     viewerTrihedronAction->addTo( &myPrefPopup );
@@ -756,6 +771,12 @@ void QAD_Desktop::createActions()
     ASCIISaveAction->addTo( &myPrefPopup );
     myStdActions.insert( PrefASCIISave, ASCIISaveAction );
 
+    /* Undo level */
+    QActionP* UndoLevelAction = new QActionP( "", tr("MEN_DESK_PREF_UNDO_LEVEL"), 0, this );
+    QAD_ASSERT(connect( UndoLevelAction, SIGNAL(activated()), this, SLOT(onUndoLevel() )));
+    UndoLevelAction->addTo( &myPrefPopup );
+    myStdActions.insert( PrefUndoLevelId, UndoLevelAction );
+
     myPrefPopup.insertSeparator();
     
     /* External Browser */
@@ -811,7 +832,7 @@ void QAD_Desktop::createActions()
     QActionP* objectBrowserCHRONO_SORTAction = new QActionP( "", tr("MEN_DESK_PREF_OBJECTBROWSER_CHRONO_SORT"), 0, this, 0, true );
     QAD_ASSERT(connect( objectBrowserCHRONO_SORTAction, SIGNAL(activated()), this, SLOT(onObjectBrowser() )));
     objectBrowserCHRONO_SORTAction->setToggleAction(true);
-    QString showSORT = QAD_CONFIG->getSetting("ObjectBrowser:CHRONO_SORT");
+    QString showSORT = QAD_CONFIG->getSetting("ObjectBrowser:ChronologicalSort");
     
     if ( showSORT.compare( aTrueQString ) == 0 )
       objectBrowserCHRONO_SORTAction->setOn(true) ;
@@ -821,6 +842,34 @@ void QAD_Desktop::createActions()
     objectBrowserCHRONO_SORTAction->addTo( &myObjBrowserPopup );
     myStdActions.insert( PrefObjectBrowserCHRONO_SORTId, objectBrowserCHRONO_SORTAction ) ;
     
+    /* Show or don't Show UseCase browser */
+    QActionP* objectBrowserShowUseCaseAction = new QActionP( "", tr("MEN_DESK_PREF_OBJECTBROWSER_SHOW_USECASE"), 0, this, 0, true );
+    QAD_ASSERT(connect( objectBrowserShowUseCaseAction, SIGNAL(activated()), this, SLOT(onObjectBrowser() )));
+    objectBrowserShowUseCaseAction->setToggleAction(true);
+    QString showUseCase = QAD_CONFIG->getSetting("ObjectBrowser:ShowUseCaseBrowser");
+    
+    if ( showUseCase.compare( aTrueQString ) == 0 )
+      objectBrowserShowUseCaseAction->setOn(true) ;
+    else
+      objectBrowserShowUseCaseAction->setOn(false) ;
+    
+    objectBrowserShowUseCaseAction->addTo( &myObjBrowserPopup );
+    myStdActions.insert( PrefObjectBrowserShowUseCaseId, objectBrowserShowUseCaseAction ) ;
+
+    /* Resize or don't resize columns automatically */
+    QActionP* objectBrowserNoAutoSizeAction = new QActionP( "", tr("MEN_DESK_PREF_OBJECTBROWSER_NO_AUTOSIZE"), 0, this, 0, true );
+    QAD_ASSERT(connect( objectBrowserNoAutoSizeAction, SIGNAL(activated()), this, SLOT(onObjectBrowser() )));
+    objectBrowserNoAutoSizeAction->setToggleAction(true);
+    QString noAutoSize = QAD_CONFIG->getSetting("ObjectBrowser:NoAutoSizeColumns");
+    
+    if ( noAutoSize.compare( aTrueQString ) == 0 )
+      objectBrowserNoAutoSizeAction->setOn(true) ;
+    else
+      objectBrowserNoAutoSizeAction->setOn(false) ;
+    
+    objectBrowserNoAutoSizeAction->addTo( &myObjBrowserPopup );
+    myStdActions.insert( PrefObjectBrowserNoAutoSizeColumnsId, objectBrowserNoAutoSizeAction ) ;
+
     myPrefPopup.insertSeparator();
 
     QActionP* dirAction = new QActionP( "", tr("MEN_DESK_PREF_DIRICTORIES"), ALT+Key_D, this );
@@ -1169,6 +1218,18 @@ QAD_Study* QAD_Desktop::findStudy( SALOMEDS::Study_ptr theStudy )
   return 0;
 }
 
+/*!
+  Gets value of max undo level for SALOMEDS::Study's from preferences
+*/
+int QAD_Desktop::getUndoLevel()
+{
+  static int MAX_UNDO = 10;
+  int anUndoLevel = MAX_UNDO;
+  QString aLevel = QAD_CONFIG->getSetting("Desktop:UndoLevel");
+  if(!aLevel.isEmpty()) anUndoLevel = aLevel.toInt();
+  return anUndoLevel;
+}
+
 /*!
     Returns current active application
 */
@@ -1436,8 +1497,8 @@ void QAD_Desktop::onLoadStudy()
          //don't ask user to remove study permanently
          if (app->getStudyByName ( name ) != NULL)
            onCloseStudy ( app->getStudyByName ( name ), false );
-         else if (app->getStudyByName ( QAD_Tools::getFileNameFromPath( name, false )) != NULL)
-           onCloseStudy ( app->getStudyByName ( QAD_Tools::getFileNameFromPath( name, false )), false );
+         else if (app->getStudyByName ( QAD_Tools::getFileNameFromPath( name, true )) != NULL)
+           onCloseStudy ( app->getStudyByName ( QAD_Tools::getFileNameFromPath( name, true )), false );
        }
       appFound = true;
       
@@ -1525,8 +1586,7 @@ void QAD_Desktop::onOpenStudy()
     SALOMEDS::ListOfOpenStudies_var List = myStudyMgr->GetOpenStudies();
     for (unsigned int ind = 0; ind < List->length();ind++) {
       QString NameExistingStudy(List[ind]);
-      QString NameOpeningStudy = QAD_Tools::getFileNameFromPath( name, false );
-     
+      QString NameOpeningStudy = QAD_Tools::getFileNameFromPath( name, true );
       if ( NameExistingStudy.compare( NameOpeningStudy ) == 0 ) {
        if ( QAD_MessageBox::warn2 ( this, tr("WRN_WARNING"),
                                     tr("QUE_DOC_ALREADYEXIST").arg( name ),
@@ -1571,8 +1631,8 @@ void QAD_Desktop::onOpenStudy()
                //don't ask user to remove study permanently
                if (app->getStudyByName ( name ) != NULL)
                  onCloseStudy ( app->getStudyByName ( name ), false );
-               else if (app->getStudyByName ( QAD_Tools::getFileNameFromPath( name, false )) != NULL)
-                 onCloseStudy ( app->getStudyByName ( QAD_Tools::getFileNameFromPath( name, false )), false );
+               else if (app->getStudyByName ( QAD_Tools::getFileNameFromPath( name, true )) != NULL)
+                 onCloseStudy ( app->getStudyByName ( QAD_Tools::getFileNameFromPath( name, true )), false );
            }
            appFound = true;
 
@@ -1634,10 +1694,10 @@ bool QAD_Desktop::loadComponentData( const QString& compName )
       if (!CORBA::is_nil(driver)) {
        SALOMEDS::StudyBuilder_var  B = aStudy->NewBuilder();
        if (!CORBA::is_nil(B)) {
-         QAD_Operation* op = new QAD_Operation( myActiveStudy );
-         op->start();
+//       QAD_Operation* op = new QAD_Operation( myActiveStudy );
+//       op->start();
          B->LoadWith(SCO,driver);
-         op->finish();
+//       op->finish();
        } else {
          return false;
        }
@@ -2029,8 +2089,8 @@ void QAD_Desktop::onNewWindow3d()
 class RunBrowser: public QThread {
 public:
   
-  RunBrowser(QString theApp, QString theParams, QString theHelpFile): 
-    myApp(theApp), myParams(theParams), myHelpFile(theHelpFile), myStatus(0) {};
+  RunBrowser(QString theApp, QString theParams, QString theHelpFile, QString theContext=NULL): 
+    myApp(theApp), myParams(theParams), myHelpFile("file:" + theHelpFile + theContext), myStatus(0) {};
  
   virtual void run()
   {
@@ -2088,9 +2148,8 @@ void QAD_Desktop::onHelpContents()
       return;
     }
   }
-  
-  QString helpFile = QFileInfo( homeDir + "index.html" ).absFilePath(); 
-  
+
+  QString helpFile = QFileInfo( homeDir + "index.html" ).absFilePath();   
   QString anApp = QAD_CONFIG->getSetting("ExternalBrowser:Application");
   QString aParams = QAD_CONFIG->getSetting("ExternalBrowser:Parameters");
    
@@ -2103,7 +2162,6 @@ void QAD_Desktop::onHelpContents()
 */
 void QAD_Desktop::onHelpContentsGUI()
 {
-  
 //   QCString dir;
 //   QString root;
 //   QString homeDir;
@@ -2123,9 +2181,7 @@ void QAD_Desktop::onHelpContentsGUI()
 //   }
 //   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");
    
@@ -2155,7 +2211,7 @@ void QAD_Desktop::onHelpContentsTUI()
       return;
     }
   }
-  
+
   QString helpFile = QFileInfo( homeDir + "index.html" ).absFilePath(); 
   
   QString anApp = QAD_CONFIG->getSetting("ExternalBrowser:Application");
@@ -2536,6 +2592,14 @@ bool QAD_Desktop::loadComponent(QString Component)
   QXmlSimpleReader reader;
   reader.setContentHandler( myXmlHandler );
   reader.setErrorHandler( myXmlHandler );
+
+  bool IsMaxActStudy = myActiveStudy->getActiveStudyFrame()->isMaximized();
+  if (IsMaxActStudy) {
+    QString aSourceData = source.data();
+    aSourceData = changeXmlInputSourceData( aSourceData, Component );
+    source.setData(aSourceData);
+  }
+
   bool ok = reader.parse( source );
   file.close();
   if ( !ok ) {
@@ -2705,6 +2769,119 @@ bool QAD_Desktop::loadComponent(QString Component)
   return true;
 }
 
+QString QAD_Desktop::changeXmlInputSourceData(QString theData, QString theComponent) 
+{
+  if ( theComponent=="Supervision" ) {
+    //Supervision main menu item
+    int aItemId = 300;
+    int aPosId = 3;
+    QString aStrOld = createString( aItemId, aPosId );
+    QString aStrNew = createString( aItemId, aPosId+1 );
+    theData = theData.replace( QRegExp(aStrOld), aStrNew );
+  }
+  
+  if ( theComponent == "Visu" ) {
+    //Visualization main menu item
+    int aItemId = 401;
+    int aPosId = 3;
+    QString aStrOld = createString( aItemId, aPosId );
+    QString aStrNew = createString( aItemId, aPosId+1 );
+    theData = theData.replace( QRegExp(aStrOld), aStrNew );
+
+    //Selection main menu item
+    aItemId = 41;
+    aPosId = 4;
+    aStrOld = createString( aItemId, aPosId );
+    aStrNew = createString( aItemId, aPosId+1 );
+    theData = theData.replace( QRegExp(aStrOld), aStrNew );
+        
+    //Representation main menu item
+    aItemId = 42;
+    aPosId = 5;
+    aStrOld = createString( aItemId, aPosId );
+    aStrNew = createString( aItemId, aPosId+1 );
+    theData = theData.replace( QRegExp(aStrOld), aStrNew );
+  }
+
+  if ( theComponent == "SMESH" ) {
+    //Hypotheses main menu item
+    int aItemId = 50;
+    int aPosId = 3;
+    QString aStrOld = createString( aItemId, aPosId );
+    QString aStrNew = createString( aItemId, aPosId+1 );
+    theData = theData.replace( QRegExp(aStrOld), aStrNew );
+
+    //Mesh main menu item
+    aItemId = 70;
+    aPosId = 4;
+    aStrOld = createString( aItemId, aPosId );
+    aStrNew = createString( aItemId, aPosId+1 );
+    theData = theData.replace( QRegExp(aStrOld), aStrNew );
+
+    //Controls main menu item
+    aItemId = 60;
+    aPosId = 5;
+    aStrOld = createString( aItemId, aPosId );
+    aStrNew = createString( aItemId, aPosId+1 );
+    theData = theData.replace( QRegExp(aStrOld), aStrNew );
+
+    //Modification main menu item
+    aItemId = 40;
+    aPosId = 6;
+    aStrOld = createString( aItemId, aPosId );
+    aStrNew = createString( aItemId, aPosId+1 );
+    theData = theData.replace( QRegExp(aStrOld), aStrNew );
+
+    //Numbering main menu item
+    aItemId = 80;
+    aPosId = 7;
+    aStrOld = createString( aItemId, aPosId );
+    aStrNew = createString( aItemId, aPosId+1 );
+    theData = theData.replace( QRegExp(aStrOld), aStrNew );
+  }
+  
+  if ( theComponent == "Geometry" ) {
+    //New Entity main menu item
+    int aItemId = 70;
+    int aPosId = 3;
+    QString aStrOld = createString( aItemId, aPosId );
+    QString aStrNew = createString( aItemId, aPosId+1 );
+    theData = theData.replace( QRegExp(aStrOld), aStrNew );
+
+    //Operations main menu item
+    aItemId = 40;
+    aPosId = 4;
+    aStrOld = createString( aItemId, aPosId );
+    aStrNew = createString( aItemId, aPosId+1 );
+    theData = theData.replace( QRegExp(aStrOld), aStrNew );
+
+    //Repair main menu item
+    aItemId = 50;
+    aPosId = 5;
+    aStrOld = createString( aItemId, aPosId );
+    aStrNew = createString( aItemId, aPosId+1 );
+    theData = theData.replace( QRegExp(aStrOld), aStrNew );
+
+    //Measures main menu item
+    aItemId = 60;
+    aPosId = 6;
+    aStrOld = createString( aItemId, aPosId );
+    aStrNew = createString( aItemId, aPosId+1 );
+    theData = theData.replace( QRegExp(aStrOld), aStrNew );
+  }
+
+  if ( theComponent == "Med" ) {
+    //MED main menu item
+    int aItemId = 90;
+    int aPosId = 3;
+    QString aStrOld = createString( aItemId, aPosId );
+    QString aStrNew = createString( aItemId, aPosId+1 );
+    theData = theData.replace( QRegExp(aStrOld), aStrNew );
+  }
+  
+  return theData;
+}
+
 typedef bool OneDim(int, QAD_Desktop*);
 typedef void (*PTR_FACTORY_FUNCTION)( CORBA::ORB_var &orb, QWidget *parent, const char *name ) ;
 
@@ -2931,6 +3108,7 @@ void QAD_Desktop::onComboActiveComponent( const QString & component, bool isLoad
 /*!
  */
 void QAD_Desktop::activateComponent(const QString& theName, bool isLoadData){
+  
   int nbItem = myCombo->count();
   int Index = 0;
 
@@ -3223,10 +3401,30 @@ void QAD_Desktop::onObjectBrowser()
   bool showCHRONO_SORT ;
   if ( myStdActions.at( PrefObjectBrowserCHRONO_SORTId )->isOn() ) {
     showCHRONO_SORT = true;
-    QAD_CONFIG->addSetting( "ObjectBrowser:CHRONO_SORT", "true");
+    QAD_CONFIG->addSetting( "ObjectBrowser:ChronologicalSort", "true");
   } else {
     showCHRONO_SORT = false;
-    QAD_CONFIG->addSetting( "ObjectBrowser:CHRONO_SORT", "false");
+    QAD_CONFIG->addSetting( "ObjectBrowser:ChronologicalSort", "false");
+  }
+
+  /* To show or not to show UseCase browser */
+  bool showUseCase;
+  if ( myStdActions.at( PrefObjectBrowserShowUseCaseId )->isOn() ) {
+    showUseCase = true;
+    QAD_CONFIG->addSetting( "ObjectBrowser:ShowUseCaseBrowser", "true");
+  } else {
+    showUseCase = false;
+    QAD_CONFIG->addSetting( "ObjectBrowser:ShowUseCaseBrowser", "false");
+  }
+
+  /* Resize or don't resize columns automatically */
+  bool autoSize;
+  if ( myStdActions.at( PrefObjectBrowserNoAutoSizeColumnsId )->isOn() ) {
+    autoSize = false;
+    QAD_CONFIG->addSetting( "ObjectBrowser:NoAutoSizeColumns", "true");
+  } else {
+    autoSize = true;
+    QAD_CONFIG->addSetting( "ObjectBrowser:NoAutoSizeColumns", "false");
   }
 
   if ( myActiveApp ) {
@@ -3239,6 +3437,8 @@ void QAD_Desktop::onObjectBrowser()
        sf->getLeftFrame()->getObjectBrowser()->setShowValueColumn( showValue );
        sf->getLeftFrame()->getObjectBrowser()->setEnableChronoSort( showCHRONO_SORT );
 //     sf->getLeftFrame()->getObjectBrowser()->setShowIAPP( showIAPP ); // this is done by below updateObjBrowser() call
+       sf->getLeftFrame()->getObjectBrowser()->showUseCaseBrowser( showUseCase );
+       sf->getLeftFrame()->getObjectBrowser()->autoSizeColumns( autoSize );
       }
       study->updateObjBrowser(true);
     }
@@ -3265,7 +3465,7 @@ void QAD_Desktop::onViewerTrihedron()
       for ( QAD_Study* study = studies.first(); study; study = studies.next() )  {
        int nbSf = study->getStudyFramesCount();
        for ( int i = 0; i < nbSf; i++ ) {
-         study->getStudyFrame(i)->getRightFrame()->getViewFrame()->SetTrihedronSize((int)dim);
+         study->getStudyFrame(i)->getRightFrame()->getViewFrame()->onAdjustTrihedron();
        }
       }
     }
@@ -3553,13 +3753,19 @@ void QAD_Desktop::helpAbout()
 // }
 
 /* Help Context */
-// void QAD_Desktop::helpContext(const QString& source, const QString& context)
-// {
-// //   getHelpWindow()->context(source, context);
-// //   getHelpWindow()->show();
-// //   getHelpWindow()->raise();
-// //   getHelpWindow()->setActiveWindow();
-// }
+//void QAD_Desktop::helpContext(const QString& source, const QString& context)
+//{
+//  //getHelpWindow()->context(source, context);   //implemented in QAD_HelpWindow::context( const QString& _source, const QString& _context)
+//  //getHelpWindow()->show();                     //from QMainWindow class
+//  //getHelpWindow()->raise();                    //from QMainWindow class
+//  //getHelpWindow()->setActiveWindow();          //from QMainWindow class
+
+//  QString anApp = QAD_CONFIG->getSetting("ExternalBrowser:Application");
+//  QString aParams = QAD_CONFIG->getSetting("ExternalBrowser:Parameters");
+   
+//  RunBrowser* rs = new RunBrowser(anApp, aParams, source, context);
+//  rs->start();
+//}
 
 /* Preferences/MultiFile Save */
 void QAD_Desktop::onMultiFileSave()
@@ -3579,6 +3785,39 @@ void QAD_Desktop::onASCIISave()
     QAD_CONFIG->addSetting( "Desktop:ASCIISave", "false");
 }
 
+/* Preferences / Undo Level */
+void QAD_Desktop::onUndoLevel()
+{
+  static int MAX_UNDO_LEVEL = 1000;
+  bool isAccepted = false;
+  static QString aLabel = QString("Level value (%1 ... %2) : ").
+    arg(1).arg(MAX_UNDO_LEVEL);
+  int anUndoLevel = 
+    SALOMEGUI_SetValueDlg::getInteger("Undo Level",aLabel,
+                                     1,MAX_UNDO_LEVEL,getUndoLevel(),
+                                     &isAccepted);
+  if(!isAccepted) return;
+  QAD_CONFIG->addSetting("Desktop:UndoLevel", anUndoLevel);
+  if(!myActiveApp) return;
+  QList<QAD_Study>& studies = myActiveApp->getStudies();
+  int aWasWarning = 0;
+  for(QAD_Study* study = studies.first(); study; study = studies.next()){
+    SALOMEDS::Study_var aStudyDoc = study->getStudyDocument();
+    SALOMEDS::StudyBuilder_var aStudyBuilder = aStudyDoc->NewBuilder();
+    if (!aStudyDoc->GetProperties()->IsLocked()) {
+      aStudyBuilder->UndoLimit(anUndoLevel);
+    } else  {
+      if (!aWasWarning) {
+       QAD_MessageBox::warn1 ((QWidget*)QAD_Application::getDesktop(),
+                              QObject::tr("WRN_WARNING"), 
+                              QObject::tr("WRN_STUDY_LOCKED"),
+                              QObject::tr("BUT_OK"));
+       aWasWarning = 1;
+      }
+    }
+  }
+}
+
 /*********************************************************************
 ** Class: AppSelectionDlg
 ** Descr: Dialog for the selection of the application when several
index c8743a3c2527346dbd3ff0b9740cce6c725c18bd..56f8a79072ea4c9ed7a1cf66b606ee0c06853ce7 100644 (file)
@@ -34,7 +34,7 @@
 #include "QAD_Application.h"
 #include "QAD_OperatorMenus.h"
 #include "QAD_Menus.h"
-//NRI #include "QAD_HelpWindow.h"
+//NRI#include "QAD_HelpWindow.h"
 #include "QAD_Action.h"
 
 #include "SALOME_NamingService.hxx"
@@ -79,8 +79,9 @@ protected:
          DefaultViewerOCCId, DefaultViewerVTKId, DefaultGraphSupervisorId, DefaultPlot2dId,
          //VRV: T2.5 - add default viewer
          PrefViewerTrihedronId, PrefConsoleFontId, PrefObjectBrowserEntryId, 
-         PrefObjectBrowserIAPPId, PrefObjectBrowserValueId, PrefObjectBrowserCHRONO_SORTId, 
-         PrefDirsId, PrefMultiFileSave, PrefASCIISave, PrefExternalBrowserId, PrefSaveId,
+         PrefObjectBrowserIAPPId, PrefObjectBrowserValueId, PrefObjectBrowserCHRONO_SORTId,PrefObjectBrowserShowUseCaseId, 
+         PrefObjectBrowserNoAutoSizeColumnsId,  
+         PrefDirsId, PrefMultiFileSave, PrefASCIISave, PrefUndoLevelId, PrefExternalBrowserId, PrefSaveId,
          //NRI : SAL2214
          WindowNew3dId, ViewOCCId, ViewVTKId, ViewPlot2dId,
          //NRI : SAL2214
@@ -144,14 +145,15 @@ public:
     QWorkspaceP*      getMainFrame() const;
     QString          getNewStudyName();
     QAD_Study*        findStudy( SALOMEDS::Study_ptr theStudy );
-
+    static int        getUndoLevel();
     /* help actions */
     virtual void      helpAbout();    
-/*     virtual void      helpSearch(); */
-/*     virtual void      helpContents(); */
-/*     virtual void      helpContext(const QString& path, const QString& dir = QString::null); */
-
+/*    virtual void      helpSearch();
+    virtual void      helpContents();
+    virtual void      helpContext(const QString& path, const QString& dir = QString::null);
+*/
     bool             loadComponent(QString);
+    QString           changeXmlInputSourceData(QString theData, QString theComponent);
     void             activateComponent(const QString& theName, bool isLoadData = true);
     void              createStudy();
 
@@ -236,6 +238,7 @@ protected slots:
     void             onObjectBrowser();
     void              onMultiFileSave();
     void              onASCIISave();
+    void              onUndoLevel();
     void             onExternalBrowser();      
 
     void             onActivateApp(QAD_Application* app);
@@ -244,7 +247,7 @@ protected slots:
     void             onHelpContents();
     void             onHelpContentsGUI();
     void             onHelpContentsTUI();
-/*     void          onHelpSearch(); */
+/*    void           onHelpSearch(); */
     void             onHelpAbout();
 
     void             onNewWindow3d();
@@ -260,7 +263,7 @@ protected slots:
     void             onComboActiveComponent( const QString & , bool isLoadData);
     void              onCascade(); 
 
-    //NRI    void              onHelpWindowClosed();
+/* NRI   void              onHelpWindowClosed(); */
 
 protected:
     QMenuBar*        myMainMenu;           /* the main menu bar */
@@ -308,7 +311,7 @@ protected:
     QList<QAD_Menus>   myMenusList;
     QAD_Menus*        myActiveMenus;
 
-    //NRI    QAD_HelpWindow*    myHelpWindow;
+    //NRI QAD_HelpWindow*    myHelpWindow;
 
     QList<QToolButton> myComponentButton;
 
index 2d626eb9650659b1ceb477666fb38ab3cf5885dc..df22e1e21f1eda951c4ee42715ee4df62ce90c15 100644 (file)
@@ -227,10 +227,11 @@ void QAD_FileDlg::addExtension()
 //  if ( mySelectedFile.isEmpty() )//VSR- 06/12/02
   if ( mySelectedFile.stripWhiteSpace().isEmpty() )//VSR+ 06/12/02
     return;
-  
+
 //  if ( QAD_Tools::getFileExtensionFromPath( mySelectedFile ).isEmpty() ) //VSR- 06/12/02
-  if ( QAD_Tools::getFileExtensionFromPath( mySelectedFile ).isEmpty() && !mySelectedFile.contains(".") ) //VSR+ 06/12/02
-  {
+//ota :   16/12/03  if ( QAD_Tools::getFileExtensionFromPath( mySelectedFile ).isEmpty() ) //VSR+ 06/12/02
+//  {
+
 #if QT_VERSION < 0x030000
     QRegExp r( QString::fromLatin1("([a-zA-Z0-9.*? +;#]*)$") );
     int len, index = r.match( selectedFilter(), 0, &len );
@@ -247,11 +248,28 @@ void QAD_FileDlg::addExtension()
 //      QString wildcard = selectedFilter().mid( index + 1, r.matchedLength()-2 ); //VSR- 06/12/02
       QString wildcard = selectedFilter().mid( index + 1, r.matchedLength()-2 ).stripWhiteSpace(); //VSR+ 06/12/02
 #endif
-      index = wildcard.findRev( '.' );    
-      if ( index >= 0 ) 
-        mySelectedFile += wildcard.mid( index );
+      if ( mySelectedFile[mySelectedFile.length() - 1] == '.')
+       //if the file name ends with the point remove it
+       mySelectedFile.truncate(mySelectedFile.length() - 1);
+      QString anExt = "." + QAD_Tools::getFileExtensionFromPath( mySelectedFile ).stripWhiteSpace();
+      // From the filters list make a pattern to validate a file extension
+      // Due to transformations from the filter list (*.txt *.*xx *.c++ QAD*.* ) we 
+      // will have the pattern (\.txt|\..*xx|\.c\+\+|\..*) (as we validate extension only we remove
+      // stay extension mask only in the pattern
+      QString aPattern(wildcard);
+      QRegExp anExtRExp("("+aPattern.replace(QRegExp("(^| )[0-9a-zA-Z*_?]*\\."), " \\.").
+                       stripWhiteSpace().replace(QRegExp("\\s+"), "|").
+                       replace(QRegExp("[*]"),".*").replace(QRegExp("[+]"),"\\+") + ")");
+      
+      if ( anExtRExp.match(anExt) == -1 ) //if a selected file extension does not match to filter's list
+       { //remove a point if it is at the word end
+         if (anExt[ anExt.length() - 1 ] == '.')  anExt.truncate( anExt.length() - 1 );
+         index = wildcard.findRev( '.' );    
+         if ( index >= 0 ) 
+           mySelectedFile += wildcard.mid( index ); //add the extension
+       }
     }
-  }
+  //  }
 }
 
 /*!
index 8cb020a7e063c0aab9369db3196a4ab551774633..d715bf5df5ea07b0e3d1155fa34c16e6a9c71332 100644 (file)
@@ -119,31 +119,31 @@ QAD_HelpWindow::QAD_HelpWindow()
   QCString dir;
   QString root;
   if ( (dir = getenv("KERNEL_ROOT_DIR")) ) {
-  root = QAD_Tools::addSlash( QAD_Tools::addSlash(dir) + QAD_Tools::addSlash("share")  + QAD_Tools::addSlash("salome")  + "doc" );
-  if ( QFileInfo( root + "index.html" ).exists() ) {
-  homeDir = root;
-  }
-  else {
-  root = QAD_Tools::addSlash( root + "html" );
-  if ( QFileInfo( root + "index.html" ).exists() ) {
-  homeDir = root;
-  }
-  else {
-  root = QAD_Tools::addSlash( root + "html" );
-  if ( QFileInfo( root + "index.html" ).exists() ) {
-  homeDir = root;
-  }
-  }
-  }
+    root = QAD_Tools::addSlash( QAD_Tools::addSlash(dir) + QAD_Tools::addSlash("share")  + QAD_Tools::addSlash("salome")  + "doc" );
+    if ( QFileInfo( root + "index.html" ).exists() ) {
+      homeDir = root;
+    }
+    else {
+      root = QAD_Tools::addSlash( root + "html" );
+      if ( QFileInfo( root + "index.html" ).exists() ) {
+       homeDir = root;
+      }
+      else {
+       root = QAD_Tools::addSlash( root + "html" );
+       if ( QFileInfo( root + "index.html" ).exists() ) {
+         homeDir = root;
+       }
+      }
+    }
   }
   if ( root.isEmpty() ) {
-  if ( QFileInfo( "/usr/local/doc/html/index.html" ).exists() ) {
-  homeDir = "/usr/local/doc/html/";
-  }
+    if ( QFileInfo( "/usr/local/doc/html/index.html" ).exists() ) {
+      homeDir = "/usr/local/doc/html/";
+    }
   }
   if ( root.isEmpty() ) 
-  root = "./doc/";
-  
+    root = "./doc/";
+
   browser->setSource( QFileInfo( homeDir + "index.html" ).absFilePath() );
   */
   browser->setFocus();
index 7bea424c0ac0b22bdf375c349ea9ed29abcb7ee5..d72f4c9d3a6413a8a31e94e5f81036d2c9ea8f6a 100644 (file)
@@ -36,6 +36,7 @@ using namespace std;
 #include "QAD_Settings.h"
 #include "QAD_Tools.h"
 #include "QAD_RightFrame.h"
+#include "QAD_LeftFrame.h"
 #include "SALOME_Selection.h"
 #include "SALOME_InteractiveObject.hxx"
 #include "SALOME_ListIteratorOfListIO.hxx"
@@ -72,6 +73,19 @@ using namespace std;
 #define UC_CLEAR_ID        1000014
 #define UC_SET_CURRENT_ID  1000016
 
+/*!
+  Small button which updates Object Browser's contents
+*/
+Btn::Btn ( QWidget * parent, const char * name ) : QToolButton( parent, name ) 
+{
+  connect( this, SIGNAL(clicked()), this, SLOT(onClicked()) );
+}
+void Btn::onClicked()
+{
+  QAD_ObjectBrowser* OB = QAD_Application::getDesktop()->getActiveApp()->getActiveStudy()->getActiveStudyFrame()->getLeftFrame()->getObjectBrowser();
+  OB->Update();
+}
+
 /*!
   Gets selected top-level items (i.e. not including sub-items) [ static ]
 */
@@ -157,12 +171,14 @@ void QAD_ObjectBrowser::setupListView()
   QAD_ResourceMgr* resMgr = QAD_Desktop::createResourceManager();
 
   this->setTabPosition( QTabWidget::Bottom );
-
+  
   /* Reading setting : Columns for Value, OCAF Doc entry, object IOR, OCAF Doc ref entry and Chrono sorting */
   QString AddColumn       = QAD_CONFIG->getSetting( "ObjectBrowser:AddColumn"   );
   QString ValueColumn     = QAD_CONFIG->getSetting( "ObjectBrowser:ValueColumn" );
-  QString ShowCHRONO_SORT = QAD_CONFIG->getSetting( "ObjectBrowser:CHRONO_SORT" );
-
+  QString ShowCHRONO_SORT = QAD_CONFIG->getSetting( "ObjectBrowser:ChronologicalSort" );
+  QString showUseCase = QAD_CONFIG->getSetting("ObjectBrowser:ShowUseCaseBrowser");
+  QString noAutoSizeColumns = QAD_CONFIG->getSetting( "ObjectBrowser:NoAutoSizeColumns" );
   /* create and setup Object Browser ================================= */
   myListView = new QListView( this, "Object Browser");
   myListView->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
@@ -176,7 +192,7 @@ void QAD_ObjectBrowser::setupListView()
   myListView->addColumn( tr( "OBJECT_BROWSER_IOR" ) );      /* Adding Object IOR column         */
   myListView->addColumn( tr( "OBJECT_BROWSER_REFENTRY" ) ); /* Adding OCAF Doc ref entry column */
   myListView->header()->setMovingEnabled( false );
-
   /* Properties */
   myListView->header()->setClickEnabled( TRUE );          /* Enable clicking on the header                    */
   myListView->setShowSortIndicator( TRUE ) ;              /* Add user arrows to indicate the sort order : LPN */
@@ -185,6 +201,7 @@ void QAD_ObjectBrowser::setupListView()
   myListView->setVScrollBarMode( QScrollView::AlwaysOn ); /* Set scrollbars always visible                    */
   myListView->setHScrollBarMode( QScrollView::AlwaysOn ); /* ...                                              */
 
+  myListView->setCornerWidget( new Btn( this ) );
   /* Connect section */
   //VRV: porting on Qt 3.0.5
 #if QT_VERSION < 0x030005
@@ -202,12 +219,12 @@ void QAD_ObjectBrowser::setupListView()
           this,       SLOT( onExpanded( QListViewItem* ) ) );
   connect( myListView, SIGNAL( collapsed( QListViewItem* ) ),
           this,       SLOT( onCollapsed( QListViewItem* ) ) );
-
+    
   /* create and setup UseCase Browser ================================ */
-  QWidget* vBox = new QWidget( this );
-  QVBoxLayout* vBoxLayout = new QVBoxLayout( vBox );
+  myVBox = new QWidget( this );
+  QVBoxLayout* vBoxLayout = new QVBoxLayout( myVBox );
   
-  myUseCaseView = new QListView( vBox, "UseCase Browser");
+  myUseCaseView = new QListView( myVBox, "UseCase Browser");
   myUseCaseView->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
   myUseCaseView->setMinimumSize( 1, 1 );
   myUseCaseView->setPalette( QAD_Application::getPalette( true ) );
@@ -228,23 +245,25 @@ void QAD_ObjectBrowser::setupListView()
   myUseCaseView->setSorting( -1 ) ;
   vBoxLayout->addWidget( myUseCaseView ); 
 
-  myNewBtn = new QToolButton( vBox );
+  myUseCaseView->setCornerWidget( new Btn( this ) );
+
+  myNewBtn = new QToolButton( myVBox );
   myNewBtn->setIconSet( resMgr->loadPixmap( "QAD", tr("ICON_UC_NEW") ) );
   myNewBtn->setAutoRaise( true );
   QToolTip::add( myNewBtn, tr( "UC_NEW_ID" ), QAD_Application::getDesktop()->toolTipGroup(), tr( "UC_NEW_TIP" ) );
-  myAddBtn = new QToolButton( vBox );
+  myAddBtn = new QToolButton( myVBox );
   myAddBtn->setIconSet( resMgr->loadPixmap( "QAD", tr("ICON_UC_ADD") ) );
   myAddBtn->setAutoRaise( true );
   QToolTip::add( myAddBtn, tr( "UC_APPEND_ID" ), QAD_Application::getDesktop()->toolTipGroup(), tr( "UC_APPEND_TIP" ) );
-  myDelBtn = new QToolButton( vBox );
+  myDelBtn = new QToolButton( myVBox );
   myDelBtn->setIconSet( resMgr->loadPixmap( "QAD", tr("ICON_UC_REMOVE") ) );
   myDelBtn->setAutoRaise( true );
   QToolTip::add( myDelBtn, tr( "UC_REMOVE_ID" ), QAD_Application::getDesktop()->toolTipGroup(), tr( "UC_REMOVE_TIP" ) );
-  myClearBtn = new QToolButton( vBox );
+  myClearBtn = new QToolButton( myVBox );
   myClearBtn->setIconSet( resMgr->loadPixmap( "QAD", tr("ICON_UC_CLEAR") ) );
   myClearBtn->setAutoRaise( true );
   QToolTip::add( myClearBtn, tr( "UC_CLEAR_ID" ), QAD_Application::getDesktop()->toolTipGroup(), tr( "UC_CLEAR_TIP" ) );
-  myCurrentBtn = new QToolButton( vBox );
+  myCurrentBtn = new QToolButton( myVBox );
   myCurrentBtn->setIconSet( resMgr->loadPixmap( "QAD", tr("ICON_UC_SET_CURRENT") ) );
   myCurrentBtn->setAutoRaise( true );
   QToolTip::add( myCurrentBtn, tr( "UC_SET_CURRENT_ID" ), QAD_Application::getDesktop()->toolTipGroup(), tr( "UC_SET_CURRENT_TIP" ) );
@@ -289,12 +308,21 @@ void QAD_ObjectBrowser::setupListView()
 
   /* add Object Browser and UseCase Browser as pages ================= */
   this->addTab( myListView,    tr( "TLT_OBJECT_BROWSER" ) );
-  this->addTab( vBox, tr( "TLT_USECASE_BROWSER" ) );
-
+  this->addTab( myVBox, tr( "TLT_USECASE_BROWSER" ) );
+  
+  if ( showUseCase != "true")
+    this->removePage(myVBox);
   setShowInfoColumns( AddColumn == "true" );
   setShowValueColumn( ValueColumn == "true" );
   setEnableChronoSort( ShowCHRONO_SORT == "true" );
   
+  if ( noAutoSizeColumns == "true" ) 
+    {
+      for (int i = 0; i < myListView->header()->count(); i++ )
+       myListView->setColumnWidthMode(i, QListView::Manual);
+    }
+
   resize( QSize( 100, 400 ) );
 }
 
@@ -306,11 +334,12 @@ bool QAD_ObjectBrowser::eventFilter( QObject* o, QEvent* e )
 {
   QAD_Desktop* Desktop     = (QAD_Desktop*) QAD_Application::getDesktop();
   QAD_Study* myActiveStudy = Desktop->getActiveStudy();
   if ( myStudy->_is_nil() )
     return QTabWidget::eventFilter( o, e );
 
   SALOMEDS::UseCaseBuilder_var UCBuilder = myStudy->GetUseCaseBuilder();
-  if ( o == myUseCaseView->viewport() ) {
+  if (o == myUseCaseView->viewport()) {
     if ( e->type() == QEvent::MouseButtonPress ) {
       // Test if clicked on selection and start drag if necessary
       QMouseEvent* me = ( QMouseEvent* )e;
@@ -688,8 +717,8 @@ void QAD_ObjectBrowser::Update( SALOMEDS::SObject_ptr SO,
              QString msg;
              QAD_ResourceMgr* resMgr = QAD_Desktop::createResourceManager();
              if ( resMgr ) {
-               if(resMgr->loadResources( QAD_Application::getDesktop()->getComponentName(QString(aFatherName->Value())), msg )) {
-                 QPixmap icon ( resMgr->loadPixmap( QAD_Application::getDesktop()->getComponentName(QString(aFatherName->Value())),
+               if(resMgr->loadResources( QString(aFatherName->Value()) + "GUI", msg )) {
+                 QPixmap icon ( resMgr->loadPixmap( QString(aFatherName->Value()) + "GUI",
                                                     tr(aPixmap->GetPixMap()) /*tr( "ICON_OBJBROWSER_" + theComponent )*/ ));
                  Item->setPixmap( 0, icon );
                }
@@ -712,9 +741,10 @@ void QAD_ObjectBrowser::Update( SALOMEDS::SObject_ptr SO,
 */
 void QAD_ObjectBrowser::Update()
 {
-  int x = myListView->contentsX();
-  int y = myListView->contentsY();
-
+  int xc = myListView->contentsX();
+  int yc = myListView->contentsY();
+  myListView->viewport()->setUpdatesEnabled( false );
   myListView->clear();
   myListViewMap.clear();
 
@@ -845,11 +875,14 @@ void QAD_ObjectBrowser::Update()
        Update (SC, Item);
     }
   }
-  /* Updating UseCase Browser ============================================= */
-  UpdateUseCaseBrowser();
+  myListView->setContentsPos(xc,yc);
 
-  myListView->setContentsPos(x,y);
-}
+  myListView->viewport()->setUpdatesEnabled( true );
+  myListView->viewport()->repaint( false );
+  /* Updating UseCase Browser ============================================= */
+  if ( this->count() > 1 ) 
+    UpdateUseCaseBrowser(); 
+} 
 
 /*!
   Removes item with all childs from the map - used to optimize UseCase browser update
@@ -876,7 +909,7 @@ void removeFromMap( ItemMap& theMap, QAD_ObjectBrowserItem* item )
 */
 void QAD_ObjectBrowser::UpdateUseCaseBrowser() {
 //  myUseCaseView->clear(); myUseCaseMap.clear();
-  if ( myStudy->_is_nil() ) {
+  if ( myStudy->_is_nil() || this->count()<2 ) {
     return;
   }
   myUseCaseView->blockSignals( true );
@@ -936,7 +969,7 @@ void QAD_ObjectBrowser::UpdateUseCaseBrowser() {
 */
 void QAD_ObjectBrowser::UpdateUCItem( SALOMEDS::SObject_var UCObject, QAD_ObjectBrowserItem* UCItem )
 {
-  if ( myStudy->_is_nil() || !UCItem )
+  if ( myStudy->_is_nil() || !UCItem ) 
     return;
 
   /* Creating SObjects item */
@@ -1103,7 +1136,7 @@ void QAD_ObjectBrowser::UpdateUCItem( SALOMEDS::SObject_var UCObject, QAD_Object
 void QAD_ObjectBrowser::unHighlightAll()
 {
   myListView->clearSelection();
-  myUseCaseView->clearSelection();
+  myUseCaseView->clearSelection();  
 }
 
 /*!
@@ -1283,6 +1316,9 @@ void QAD_ObjectBrowser::showUseCasePopupMenu(QListViewItem* theItem)
 */
 void QAD_ObjectBrowser::onSelectedItem()
 {
+  if (currentPage()==myListView)
+    myUseCaseView->clearSelection();
+
   QListView* whoIs;
   if ( sender()->inherits("QListView") )
     whoIs = (QListView*)sender();
@@ -1489,6 +1525,7 @@ void QAD_ObjectBrowser::setShowIAPP( bool show )
 void QAD_ObjectBrowser::setShowInfoColumns( bool show )
 {
   bool shown = myListView->header()->isResizeEnabled( 2 );
+  
   if ( show != shown ) {
     if ( show ) {
       myListView->header()->setResizeEnabled( true, 2 );
@@ -1524,6 +1561,7 @@ void QAD_ObjectBrowser::setShowInfoColumns( bool show )
 void QAD_ObjectBrowser::setShowValueColumn( bool show )
 {
   bool shown = myListView->header()->isResizeEnabled( 1 );
+  
   if ( show != shown ) {
     if ( show ) {
       myListView->header()->setResizeEnabled( true, 1 );
@@ -1809,3 +1847,43 @@ void QAD_ObjectBrowser::onUseCaseBtn()
   if ( sender() == myCurrentBtn )
     onUseCasePopupMenu( UC_SET_CURRENT_ID );
 }
+
+/* 
+   Show/remove UseCase Browser 
+*/
+
+void QAD_ObjectBrowser::showUseCaseBrowser ( bool show )
+{
+  bool shown = (this->count() > 1);
+  
+  if (show != shown)
+    {
+      if (show)
+       {
+         this->addTab( myVBox, tr( "TLT_USECASE_BROWSER" ) );
+         UpdateUseCaseBrowser();
+         unHighlightAll();
+       }
+      else
+       this->removePage(myVBox);
+    }
+}
+
+/*!
+  Switch between auto resizing of columns and manual mode
+*/
+void QAD_ObjectBrowser::autoSizeColumns( bool autosize )
+{
+  if (autosize)
+    {
+      for (int i = 0; i < myListView->header()->count(); i++ )
+       if (myListView->header()->isResizeEnabled(i))
+         myListView->setColumnWidthMode(i, QListView::Maximum);
+      
+    }
+  else
+    {
+      for (int i = 0; i < myListView->header()->count(); i++ )
+       myListView->setColumnWidthMode(i, QListView::Manual); 
+    }
+}
index a03afac0af8bc4268c1bf993d8aed2ea0cd39920..ef5f940997a2ec25b85f0df095f0c5d4f5cfd66d 100644 (file)
@@ -89,6 +89,8 @@ public:
     void                   setShowInfoColumns( bool show );
     void                   setShowValueColumn( bool show );
     void                   setEnableChronoSort( bool enable );
+    void                   showUseCaseBrowser ( bool show );
+    void                   autoSizeColumns ( bool autosize );
 
 protected:
     void                  Update( SALOMEDS::SObject_ptr SO,
@@ -132,6 +134,7 @@ private:
     ItemMap                myListViewMap;
     ItemMap                myUseCaseMap;
     QListView*            myListView;
+    QWidget*               myVBox;
     QListView*            myUseCaseView;
     QPopupMenu*                   myPopupMenu;
     SALOMEDS::Study_ptr    myStudy;
@@ -143,4 +146,14 @@ private:
     QToolButton*           myClearBtn;
 };
 
+
+class Btn : public QToolButton
+{
+  Q_OBJECT
+public:
+  Btn ( QWidget * parent, const char * name = 0 );
+public slots:
+  void onClicked();
+};
+
 #endif
index 0e1796ab3123fe4369c3e132b2ca8e88795318b3..1be9aef0e0b111f80415207363ee22c0fd2162c1 100644 (file)
@@ -60,7 +60,6 @@ using namespace std;
 // QT Include
 #include <qapplication.h>
 
-#define MAX_UNDO 10
 /*!
     Constructor
 */
@@ -75,7 +74,7 @@ myPath( path )
 {
     myStudy = aStudy;
 
-    myTitle = QAD_Tools::getFileNameFromPath( path, false );
+    myTitle = QAD_Tools::getFileNameFromPath( path, true );
 
     myIsActive = false;
     myIsSaved = false;
@@ -104,7 +103,12 @@ myPath( path )
     /* set default Undo/Redo limit */
     QAD_ASSERT_DEBUG_ONLY( !myStudy->_is_nil() );
     SALOMEDS::StudyBuilder_var SB = myStudy->NewBuilder();
-    SB->UndoLimit( MAX_UNDO );
+
+    int aLocked = myStudy->GetProperties()->IsLocked();
+    if (aLocked) myStudy->GetProperties()->SetLocked(false);
+    SB->UndoLimit(QAD_Desktop::getUndoLevel());
+    if (aLocked) myStudy->GetProperties()->SetLocked(true);
+
 }
 
 /*!
@@ -169,7 +173,10 @@ void QAD_Study::removeStudyFrame( QAD_StudyFrame* sf )
       SALOMEDS::SObject_var fatherSF = myStudy->FindObjectID(sf->entry());
       if (!fatherSF->_is_nil()) {
        SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder();
+       int aLocked = myStudy->GetProperties()->IsLocked();
+       if (aLocked) myStudy->GetProperties()->SetLocked(false);
        aStudyBuilder->RemoveObject(fatherSF);
+       if (aLocked) myStudy->GetProperties()->SetLocked(true);
       }
       
       updateObjBrowser( true );
@@ -274,7 +281,7 @@ void QAD_Study::setTitle( const QString& path )
 {
   myPath = path;
 
-  QString title = QAD_Tools::getFileNameFromPath( path, false );
+  QString title = QAD_Tools::getFileNameFromPath( path, true );
   QAD_ASSERT_DEBUG_ONLY ( !title.isNull() );
 
   for ( QAD_StudyFrame* sf = myStudyFrames.first(); sf ; sf = myStudyFrames.next() )
@@ -380,6 +387,7 @@ void QAD_Study::onStudyDeactivated()
 */
 void QAD_Study::close()
 {
+  emit closed();
   if ( !myStudy->_is_nil() )
     abortAllOperations();
     /* clear each study frame */
index 2d650058df1716fbe4b6fe429a55fc3d14d7d232..94fe80305634dd4b7513279b867caf9ab4741d6a 100644 (file)
@@ -154,6 +154,7 @@ public:
 signals:
   void           docClosing( QAD_Study* );
   void           docOperationTerminated( bool );
+  void            closed();
 
 public slots:
   void           onStudyFrameActivated( QAD_StudyFrame* );
index 194aaa516395eaf45a21bf3533dd05e2473a0ce8..29bde65b10062d15e3721e005fca7be8d592ff96 100644 (file)
@@ -124,7 +124,6 @@ void QAD_StudyFrame::setVisible( bool visible )
 */
 void QAD_StudyFrame::closeEvent(QCloseEvent* e)
 {
-  emit sfBeforeStudyFrameClosing(this); 
   emit sfStudyFrameClosing(this); 
 }
 
index b16822dacd646419604f6489e70ba66ab9d4ccd0..e8b393b441a938b7d036f4d611301433ab224f99 100644 (file)
@@ -87,7 +87,6 @@ class QAD_EXPORT QAD_StudyFrame: public QMainWindow
  signals:
   void                sfStudyFrameActivated( QAD_StudyFrame* );
   void                sfStudyFrameClosing( QAD_StudyFrame*);
-  void                sfBeforeStudyFrameClosing( QAD_StudyFrame*);
 
  public slots:
   void               onStudyFrameActivated ( QWidget* );
index 0b9ab52d31802f8aca52b3ad3ed208e920bfbd07..e2e85bf5363a20a3b6e2c67fe80b9f96d33a46ab 100644 (file)
@@ -276,7 +276,7 @@ TCollection_AsciiString QAD_Tools::toAsciiString( const QString& qString)
 QFont QAD_Tools::stringToFont( const QString& fontDescription )
 {
   QFont font;
-  if ( !font.fromString( fontDescription ) )
+  if ( fontDescription.stripWhiteSpace().isEmpty() || !font.fromString( fontDescription ) )
     font = QFont( "Courier", 11 );
   return font;
 }
index 04a78ddcd7cfe72c397525fab74561180e68b820..b894bb703e1819a88b631ffa27e52da86eea74b5 100644 (file)
@@ -58,8 +58,8 @@ public:
   virtual QColor         backgroundColor() const = 0;
 
   virtual void           SetSelectionMode( int mode ) = 0;
-
-  virtual void           SetTrihedronSize( int dim ) = 0;
+  
+  virtual void           onAdjustTrihedron() = 0; 
 
   /*  popup management */
   virtual void           setPopupServer( QAD_Application* ) = 0;
index f30ce69182cc64c2102c3041fce7fa356a13ba9b..5b1e636f7e276c20e11d9f69a7580ba49c1a304f 100644 (file)
@@ -68,6 +68,15 @@ msgstr "close.png"
 msgid "ICON_HELP"
 msgstr "help.png"
 
+msgid "QAD_HelpWindow::ICON_APP_HELP_BACK"
+msgstr "back.xpm"
+
+msgid "QAD_HelpWindow::ICON_APP_HELP_FORWARD"
+msgstr "forward.xpm"
+
+msgid "QAD_HelpWindow::ICON_APP_HELP_HOME"
+msgstr "home.xpm"
+
 #--------------
 # VIEW
 #--------------
index 39dededad9df354cf20c6c1a00795ae367ef9bff..e845d78e42aa0bc7980fd1e0c3e7f8c0af4b560b 100644 (file)
@@ -259,6 +259,12 @@ msgstr "Interface Applicative"
 msgid "MEN_DESK_PREF_OBJECTBROWSER_CHRONO_SORT"
 msgstr "Chronological sort of objects" 
 
+msgid "MEN_DESK_PREF_OBJECTBROWSER_SHOW_USECASE"
+msgstr "Show UseCase Browser" 
+
+msgid "MEN_DESK_PREF_OBJECTBROWSER_NO_AUTOSIZE"
+msgstr "No autosize columns" 
+
 
 msgid "QAD_Desktop::MEN_DESK_SELECTION_MODE"
 msgstr "Selection Mode"
@@ -435,6 +441,21 @@ msgstr "Sketch a rectangular area to fit the view"
 # TOOL TIP
 #---------------
 
+#: QAD_HelpWindow.cxx:57
+msgid "QAD_HelpWindow::TOT_HELPWINDOW_BACKWARD"
+msgstr "Backward"
+
+#: QAD_HelpWindow.cxx:60
+msgid "QAD_HelpWindow::TOT_HELPWINDOW_FORWARD"
+msgstr "Forward"
+
+#: QAD_HelpWindow.cxx:63
+msgid "QAD_HelpWindow::TOT_HELPWINDOW_HOME"
+msgstr "Home"
+
+msgid "QAD_HelpWindow::QAD_HELP_CONTENTS"
+msgstr "Contents"
+
 #: QAD_Application.cxx:173
 msgid "QAD_Application::TOT_APP_EDIT_REDO"
 msgstr "Redo last operation"
@@ -752,6 +773,9 @@ msgstr "ASCII Save"
 msgid "TOT_APP_EDIT_COPY"
 msgstr "Copy"
 
+msgid "MEN_DESK_PREF_UNDO_LEVEL"
+msgstr "Undo Level"
+
 msgid "MEN_APP_EDIT_COPY"
 msgstr "&Copy"
 
index d9b5ad9b10ce07afd26b67be17690ba12ef94cb8..fa67befd6afadcd7ddd016de3ca538067d6cfec5 100644 (file)
@@ -615,7 +615,7 @@ void SALOMEGUI_Application::onDisplay(int id)
     viewFrame->Repaint();
 
   if (isForeignGUIUsed)
-    foreignGUI.DlClose();
+    ;//foreignGUI.DlClose(); // VSR: Fix crash on Display objects from non-parent components
   myActiveStudy->updateObjBrowser(true);
 }
 
index 2573f3ff9cbcfaf5b38bf0b90c1001e4bdc289c3..3a8eb70f2a7d4b56bdf131b74881b79d158d4fe4 100644 (file)
@@ -119,6 +119,21 @@ void SALOMEGUI_SetValueDlg::setLabel( const QString& label )
   myLabel->setText( label );
 }
 
+void SALOMEGUI_SetValueDlg::accept()
+{
+  const QValidator* v = myLineEdit->validator();
+  if ( v ) {
+    if ( v->inherits( "QIntValidator" ) ) {
+      bool b;
+      int val = myLineEdit->text().toInt( &b );
+      const QIntValidator* iv = dynamic_cast<const QIntValidator*>(v);
+      if ( !b || val < iv->bottom() || val > iv->top())
+       return;
+    }
+  }
+  QDialog::accept();
+}
+
 /*!
   Gets string value
 */
@@ -167,6 +182,32 @@ int SALOMEGUI_SetValueDlg::getInteger( const QString& caption,
   return v;
 }
 
+/*!
+  Gets integer value
+*/
+int SALOMEGUI_SetValueDlg::getInteger( const QString& caption, 
+                                      const QString& label, 
+                                      int            bottom,
+                                      int            top,
+                                      const int      oldValue,
+                                      bool*          ok, 
+                                      QWidget*       parent )
+{
+  int v = 0;
+  SALOMEGUI_SetValueDlg* dlg = new SALOMEGUI_SetValueDlg( parent );
+  dlg->setCaption( caption );
+  dlg->setLabel( label );
+  dlg->setValidator( new QIntValidator( bottom, top, dlg ) );
+  dlg->setValue( QString::number( oldValue ) );
+  int result = dlg->exec();
+  if ( result == QDialog::Accepted ) 
+    v = dlg->value().toInt();
+  if ( ok ) 
+    *ok = result == QDialog::Accepted;
+  delete dlg;
+  return v;
+}
+
 /*!
   Gets double value
 */
index bcd845838f641beb8a84a5f386a9171add464cad..3b5bd02b989fdf9262cdc66759d947f189635586 100644 (file)
@@ -36,11 +36,20 @@ public:
                              const int      oldValue = 0,
                              bool*          ok = 0, 
                              QWidget*       parent = 0 );
+  static int      getInteger( const QString& caption, 
+                             const QString& label, 
+                             int            bottom,
+                             int            top,
+                             const int      oldValue = 0,
+                             bool*          ok = 0, 
+                             QWidget*       parent = 0 );
   static double   getDouble ( const QString& caption, 
                              const QString& label, 
                              const double   oldValue = 0.0,
                              bool*          ok = 0, 
                              QWidget*       parent = 0 );
+public slots:
+  void accept();
 
 private:
   SALOMEGUI_SetValueDlg( QWidget* parent = 0 );
index af07853984258baa0a947d545677a4383ebb1387..311b6075fe9ac8a5243e94995d8d056ba09951cd 100644 (file)
@@ -67,7 +67,7 @@ msgstr "Appropriate view must be created to display selected object(s)"
 
 #: SALOMEGUI_TrihedronSizeDlg.cxx:77
 msgid "SALOMEGUI_TrihedronSizeDlg::MEN_TRIHEDRON_SIZE"
-msgstr "Size :"
+msgstr "Size (% of bounding box) :"
 
 #: SALOMEGUI_TrihedronSizeDlg.cxx:36
 msgid "SALOMEGUI_TrihedronSizeDlg::MEN_TRIHEDRON"
index b595f87c20bb52e546f4f7a51e2d73488b973382..6ffd9526218a695b22a7cac14bcfa17ebbaa638d 100644 (file)
@@ -66,7 +66,7 @@ msgstr "La vue appropri
 #---------------
 
 msgid "INF_VERSION"
-msgstr "Version 1.1a"
+msgstr ""
 
 msgid "INF_COPYRIGHT"
 msgstr ""
@@ -81,7 +81,7 @@ msgstr ""
 
 #: SALOMEGUI_TrihedronSizeDlg.cxx:77
 msgid "SALOMEGUI_TrihedronSizeDlg::MEN_TRIHEDRON_SIZE"
-msgstr "Size :"
+msgstr "Size (% of bounding box) :"
 
 #: SALOMEGUI_TrihedronSizeDlg.cxx:36
 msgid "SALOMEGUI_TrihedronSizeDlg::MEN_TRIHEDRON"
@@ -316,7 +316,7 @@ msgstr "VTK Viewer"
 
 #: SALOMEGUI_AboutDlg.cxx:42
 msgid "ABOUT_SALOME_TLT"
-msgstr "About SALOME "
+msgstr "About SALOME Professional"
 
 msgid "SALOMEGUI_OpenWith::OPEN_WITH_TLT"
 msgstr "Open With"
index 9f7c1afa25a550a8e2719b0349d988011f079e44..11d2fe9ce73e3329537ca214d3ffce506d829d45 100644 (file)
@@ -107,3 +107,7 @@ QString SalomePyQt::getExistingDirectory(QWidget*       parent,
 {
   return QAD_FileDlg::getExistingDirectory(parent, initial, caption);
 }
+
+void SalomePyQt::helpContext(const QString& source, const QString& context) {
+  //QAD_Application::getDesktop()->helpContext(source, context);
+}
index c79a1d97ef4e1eedb713e8295fbaaeb0ed75322d..b3f5101a6c12244d03cd9f6f4a84e41d743b6a4d 100644 (file)
@@ -44,6 +44,7 @@ public:
   static QString getExistingDirectory(QWidget*       parent,
                                       const QString& initial,
                                       const QString& caption);
+  static void helpContext(const QString& source, const QString& context);
 };
 
 #endif
index 51ab6d7728525a78459f49086fbb662acdedc953..3f593d0af71defd34a3848bb77dbf15036c4c57e 100644 (file)
@@ -45,4 +45,5 @@ public:
 
   static QString getFileName(QWidget*, const QString&, const QStringList&, const QString&, bool);
   static QString getExistingDirectory(QWidget*, const QString&, const QString&);
+  static void helpContext(const QString&, const QString&);
 };
index 0ebc151562527f6065b94b1e23d8f27c8ce73404..31b7f308f475f09679164ac33cc48f63d99b9dca 100644 (file)
@@ -471,6 +471,13 @@ myVisu = salome.lcc.FindOrLoadComponent("FactoryServer", "VISU")
 
 try:
     if os.access(medFile, os.R_OK) :
+       if not os.access(medFile, os.W_OK) :
+              import random
+              medFileNew = "/tmp/" + str(random.randint(0,1000000)) + "_" + medfile
+              print " -- Copy " + medFile + " to " + medFileNew
+              os.system("cp "+ medFile + " " + medFileNew)
+              medFile = medFileNew
+
        if os.access(medFile, os.W_OK) :
            med_comp.readStructFileWithFieldType(medFile,studyCurrent)
            med_obj = visu_gui.visu.getMedObjectFromStudy()
index 2fa21f44754e60685880a87e2a3039f49708d805..01fa60ce26cbf4ab7f2cccd8a2c5fcde6d1c84e8 100644 (file)
@@ -254,9 +254,9 @@ void SUPERVGraph_ViewFrame::SetSelectionMode( int mode )
   MESSAGE ( "SUPERVGraph_ViewFrame::SetSelectionMode" )
 }
 
-void SUPERVGraph_ViewFrame::SetTrihedronSize( int dim )
+void SUPERVGraph_ViewFrame::onAdjustTrihedron(  )
 {
-  MESSAGE ( "SUPERVGraph_ViewFrame::SetTrihedronSize" )  
+  MESSAGE ( "SUPERVGraph_ViewFrame::onAdjustTrihedron" )  
 }
 
 void SUPERVGraph_ViewFrame::rename( const Handle(SALOME_InteractiveObject)& IObject, 
index 49c297a7a907406a7ee70ff1743d9c6346027d3e..8c62cc436096492c2dcfc4ef079f19af9620b1b1 100644 (file)
@@ -64,7 +64,7 @@ class QAD_EXPORT SUPERVGraph_ViewFrame : public QAD_ViewFrame {
   
   void                           SetSelectionMode( int mode );
 
-  void                           SetTrihedronSize( int dim );
+  void                           onAdjustTrihedron( );
   
   /*  popup management */
   void                           setPopupServer( QAD_Application* );
index 0265845606263de0eeb85de31d31866928db2198..fb2d92a94031fed84a862a671fa5b83461df285d 100644 (file)
@@ -172,6 +172,7 @@ void SALOME_Session_i::StopSession()
 SALOME::StatSession SALOME_Session_i::GetStatSession()
 {
   // update Session state
+  //qApp->lock(); // rollback bug 
   _GUIMutex.lock();    
   _isGUI = _IAPPThread->running();
   _runningStudies = 0;
@@ -182,6 +183,7 @@ SALOME::StatSession SALOME_Session_i::GetStatSession()
     qApp->unlock();
   }
   _GUIMutex.unlock();
+  //qApp->unlock();
   // getting stat info
   SALOME::StatSession_var myStats = new SALOME::StatSession ;
   if (_runningStudies)
index 3d2e58cd341f1828cf99eddec26f9d7f5f0ec38d..4e06560a00cad19cb745ea2c2ea89974da4f9360 100644 (file)
@@ -107,7 +107,7 @@ template <class TYPE> TYPE *SINGLETON_<TYPE>::Instance( void )
 {
        if ( ! PtrSingleton )
        {
-               MESSAGE("SINGLETON_<TYPE>::Instance( void )") ;
+               //MESSAGE("SINGLETON_<TYPE>::Instance( void )") ;
                PtrSingleton = new SINGLETON_<TYPE> ;
                new DESTRUCTEUR_DE_<TYPE>( PtrSingleton->_Instance ) ;
        }
@@ -125,7 +125,7 @@ template <class TYPE> bool SINGLETON_<TYPE>::IsAlreadyExisting( void )
 
 template <class TYPE> SINGLETON_<TYPE>::SINGLETON_( void )
 {
-       MESSAGE("CREATION d'un SINGLETON_") ;
+       //MESSAGE("CREATION d'un SINGLETON_") ;
 }
 
 
index 3d562442d2867b40b2a99e2208d12194db09973a..0733c58b9711ee4cb49890f8b6832c9a956f1c00 100644 (file)
@@ -47,7 +47,9 @@ LIB_SRC= VTKViewer.cxx \
         VTKViewer_RenderWindow.cxx \
         VTKViewer_RenderWindowInteractor.cxx \
         VTKViewer_InteractorStyleSALOME.cxx \
-        VTKViewer_VectorText.cxx
+        VTKViewer_Trihedron.cxx \
+        VTKViewer_VectorText.cxx \
+        VTKViewer_Utilities.cxx
 
 LIB_MOC = \
         VTKViewer.h \
index b0cfe0abb33102f28d92d11dc6214ce37e6c9295..329e055acb0f731bdfec14ebdcfef92737bc510b 100644 (file)
 //  Module : SALOME
 //  $Header$
 
-using namespace std;
 #include "VTKViewer_InteractorStyleSALOME.h"
 #include "VTKViewer_RenderWindow.h"
+#include "VTKViewer_Utilities.h"
+#include "VTKViewer_Trihedron.h"
 
-#include <qapplication.h>
 #include "QAD_Config.h"
 #include "QAD_Application.h"
 #include "QAD_Desktop.h"
@@ -54,31 +54,25 @@ using namespace std;
 #include <vtkImageData.h>
 #include <vtkFollower.h>
 
-
+#include <qapplication.h>
 //VRV: porting on Qt 3.0.5
 #if QT_VERSION >= 0x030005
 #include <qpainter.h>
 #endif
 //VRV: porting on Qt 3.0.5
 
-//----------------------------------------------------------------------------
-VTKViewer_InteractorStyleSALOME *VTKViewer_InteractorStyleSALOME::New() 
-{
-  // First try to create the object from the vtkObjectFactory
-  vtkObject* ret = vtkObjectFactory::CreateInstance("VTKViewer_InteractorStyleSALOME");
-  if(ret)
-    {
-      return (VTKViewer_InteractorStyleSALOME*)ret;
-    }
-  // If the factory was unable to create the object, then create it here.
-  return new VTKViewer_InteractorStyleSALOME;
-}
+using namespace std;
 
+extern int SetVisibility(vtkActorCollection* theCollection, int theParam);
+extern int GetVisibility(vtkActorCollection* theCollection);
 
 //----------------------------------------------------------------------------
+vtkStandardNewMacro(VTKViewer_InteractorStyleSALOME);
+//----------------------------------------------------------------------------
+
 VTKViewer_InteractorStyleSALOME::VTKViewer_InteractorStyleSALOME() 
 {
-  m_Triedron = 0;
+  m_Trihedron = 0;
   this->MotionFactor = 10.0;
   this->State = VTK_INTERACTOR_STYLE_CAMERA_NONE;
   this->RadianToDegree = 180.0 / vtkMath::Pi();
@@ -92,9 +86,8 @@ VTKViewer_InteractorStyleSALOME::~VTKViewer_InteractorStyleSALOME()
 }
 
 //----------------------------------------------------------------------------
-void VTKViewer_InteractorStyleSALOME::setTriedron( vtkActorCollection* triedron )
-{
-  m_Triedron = triedron;
+void VTKViewer_InteractorStyleSALOME::setTriedron(VTKViewer_Trihedron* theTrihedron){
+  m_Trihedron = theTrihedron;
 }
 
 //----------------------------------------------------------------------------
@@ -120,15 +113,8 @@ void VTKViewer_InteractorStyleSALOME::RotateXY(int dx, int dy)
   cam->Azimuth(rxf);
   cam->Elevation(ryf);
   cam->OrthogonalizeViewUp();
-  this->CurrentRenderer->ResetCameraClippingRange();
-  vtkRenderWindowInteractor *rwi = this->Interactor;
-  /* VSV Light follows camera: if (this->CurrentLight)
-    {
-      // get the first light
-      this->CurrentLight->SetPosition(cam->GetPosition());
-      this->CurrentLight->SetFocalPoint(cam->GetFocalPoint());
-      }        */
-  rwi->Render();
+  ::ResetCameraClippingRange(this->CurrentRenderer); 
+  this->Interactor->Render();
 }
 
 //----------------------------------------------------------------------------
@@ -148,98 +134,26 @@ void VTKViewer_InteractorStyleSALOME::PanXY(int x, int y, int oldX, int oldY)
 
 //----------------------------------------------------------------------------
 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();
-  }
+  return;
 }
 
 //----------------------------------------------------------------------------
 void VTKViewer_InteractorStyleSALOME::DollyXY(int dx, int dy)
 {
-  vtkCamera *cam;
+  if (this->CurrentRenderer == NULL) return;
+
   double dxf = this->MotionFactor * (double)(dx) / (double)(this->CurrentRenderer->GetCenter()[1]);
   double dyf = this->MotionFactor * (double)(dy) / (double)(this->CurrentRenderer->GetCenter()[1]);
 
   double zoomFactor = pow((double)1.1, dxf + dyf);
   
-  if (this->CurrentRenderer == NULL)
-    {
-      return;
-    }
-  
-  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
-    {
-      cam->Dolly(zoomFactor);
-      this->CurrentRenderer->ResetCameraClippingRange();
-    }
+  vtkCamera *aCam = this->CurrentRenderer->GetActiveCamera();
+  if (aCam->GetParallelProjection())
+    aCam->SetParallelScale(aCam->GetParallelScale()/zoomFactor);
+  else{
+    aCam->Dolly(zoomFactor);
+    ::ResetCameraClippingRange(this->CurrentRenderer);
+  }
   
   /* VSV Light follows camera: if (this->CurrentLight)
     {      
@@ -597,6 +511,27 @@ void VTKViewer_InteractorStyleSALOME::startFitArea()
   qApp->installEventFilter(this);
 }
 
+
+void  VTKViewer_InteractorStyleSALOME::ViewFitAll() {
+  int aTriedronWasVisible = false;
+  if(m_Trihedron){
+    aTriedronWasVisible = 
+      m_Trihedron->GetVisibility() == VTKViewer_Trihedron::eOn;
+    if(aTriedronWasVisible) m_Trihedron->VisibilityOff();
+  }
+
+  if(m_Trihedron->GetVisibleActorCount(CurrentRenderer)){
+    m_Trihedron->VisibilityOff();
+    ::ResetCamera(CurrentRenderer);
+  }else{
+    m_Trihedron->SetVisibility(VTKViewer_Trihedron::eOnlyLineOn);
+    ::ResetCamera(CurrentRenderer,true);
+  }
+  if(aTriedronWasVisible) m_Trihedron->VisibilityOn();
+  else m_Trihedron->VisibilityOff();
+}
+
+
 // starts Global Panning operation (e.g. through menu command)
 void VTKViewer_InteractorStyleSALOME::startGlobalPan()
 {
@@ -612,29 +547,21 @@ void VTKViewer_InteractorStyleSALOME::startGlobalPan()
   vtkCamera *cam = this->CurrentRenderer->GetActiveCamera();
   myScale = cam->GetParallelScale();
 
+  ViewFitAll();
   // make fit all
-  Standard_Boolean TriedronWasVisible = false;
-  if ( m_Triedron ) {
-    m_Triedron->InitTraversal();
-    vtkActor *ac = m_Triedron->GetNextActor();
-    while(!(ac==NULL)) {
-      if(ac->GetVisibility()) {
-       TriedronWasVisible = true;
-       ac->VisibilityOff();
-      }
-      ac = m_Triedron->GetNextActor();
-    }
-  }
-  this->CurrentRenderer->ResetCamera();
-  this->CurrentRenderer->ResetCameraClippingRange();
-  if( m_Triedron && TriedronWasVisible ) {
-    m_Triedron->InitTraversal();
-    vtkActor *ac = m_Triedron->GetNextActor();
-    while(!(ac==NULL)) {
-      ac->VisibilityOn();
-      ac = m_Triedron->GetNextActor();
-    }
-  }
+//   int TriedronWasVisible = false;
+//   if(m_Trihedron){
+//     TriedronWasVisible = 
+//       m_Trihedron->GetVisibility() == VTKViewer_Trihedron::eOn;
+//     if(TriedronWasVisible) m_Trihedron->VisibilityOff();
+//   }
+
+//   ::ResetCamera(this->CurrentRenderer);
+  
+//   if(m_Trihedron)
+//     if(TriedronWasVisible) 
+//       m_Trihedron->VisibilityOn();
+
   //VTKViewer_RenderWindow* aRW = dynamic_cast<VTKViewer_RenderWindow*>(this->Interactor->GetRenderWindow());
   if (myGUIWindow) myGUIWindow->update();
   
@@ -657,10 +584,7 @@ void VTKViewer_InteractorStyleSALOME::fitRect(const int left,
                                        const int right, 
                                        const int bottom)
 {
-  if (this->CurrentRenderer == NULL) {
-    return;
-  }
-  vtkCamera *cam = this->CurrentRenderer->GetActiveCamera();
+  if (this->CurrentRenderer == NULL) return;
  
   // move camera
   int x = (left + right)/2;
@@ -670,17 +594,17 @@ void VTKViewer_InteractorStyleSALOME::fitRect(const int left,
   int oldY = aSize[1]/2;
   TranslateView(oldX, oldY, x, y);
 
-      
   // zoom camera
   double dxf = (double)(aSize[0]) / (double)(abs(right - left));
   double dyf = (double)(aSize[1]) / (double)(abs(bottom - top));
   double zoomFactor = (dxf + dyf)/2 ;
 
-  if (cam->GetParallelProjection()) {
-    cam->SetParallelScale(cam->GetParallelScale()/zoomFactor);
-  } else {
-    cam->Dolly(zoomFactor);
-    this->CurrentRenderer->ResetCameraClippingRange();
+  vtkCamera *aCam = this->CurrentRenderer->GetActiveCamera();
+  if(aCam->GetParallelProjection())
+    aCam->SetParallelScale(aCam->GetParallelScale()/zoomFactor);
+  else{
+    aCam->Dolly(zoomFactor);
+    ::ResetCameraClippingRange(this->CurrentRenderer);
   }
   
   //vtkRenderWindowInteractor *rwi = this->Interactor;
@@ -765,6 +689,8 @@ void VTKViewer_InteractorStyleSALOME::setCursor(const int operation)
 void VTKViewer_InteractorStyleSALOME::onStartOperation()
 {
   if (!myGUIWindow) return;
+  // VSV: LOD actor activisation
+  //  this->Interactor->GetRenderWindow()->SetDesiredUpdateRate(this->Interactor->GetDesiredUpdateRate());
   switch (State) {
     case VTK_INTERACTOR_STYLE_CAMERA_SELECT:
     case VTK_INTERACTOR_STYLE_CAMERA_FIT:
@@ -789,14 +715,16 @@ void VTKViewer_InteractorStyleSALOME::onFinishOperation()
 {
   if (!myGUIWindow) return;
 
+
   QAD_Study* aActiveStudy = QAD_Application::getDesktop()->getActiveStudy();
   SALOME_Selection* aSel    = SALOME_Selection::Selection( aActiveStudy->getSelection() );
   vtkRenderWindowInteractor *rwi = this->Interactor;
 
+  // VSV: LOD actor activisation
+  //  rwi->GetRenderWindow()->SetDesiredUpdateRate(rwi->GetStillUpdateRate());
+
   int aSelectionMode = aSel->SelectionMode();
   bool aSelActiveCompOnly = aSel->IsSelectActiveCompOnly();
-  SALOMEDS::SComponent_var aActiveComponent = SALOMEDS::SComponent::_narrow(
-     aActiveStudy->getStudyDocument()->FindObject(QAD_Application::getDesktop()->getActiveComponent()));
 
   switch (State) {
     case VTK_INTERACTOR_STYLE_CAMERA_SELECT:
@@ -829,6 +757,11 @@ void VTKViewer_InteractorStyleSALOME::onFinishOperation()
           vtkActorCollection* listactors = NULL;
           this->FindPokedRenderer(x, y);
          rwi->StartPickCallback();
+
+//       vtkPicker* aPicker = vtkPicker::SafeDownCast(rwi->GetPicker());
+//       if (aPicker)
+//         aPicker->SetTolerance(0.01);
+         
           rwi->GetPicker()->Pick(x, y, 0.0, this->CurrentRenderer);
     
           if ( rwi->GetPicker()->IsA("vtkCellPicker") ) {
@@ -1020,6 +953,10 @@ void VTKViewer_InteractorStyleSALOME::onFinishOperation()
           }
         } else {
           //processing rectangle selection
+         SALOMEDS::SComponent_var aActiveComponent = SALOMEDS::SComponent::
+           _narrow(aActiveStudy->getStudyDocument()->
+                   FindObject(QAD_Application::getDesktop()->getActiveComponent()));
+         if(aSelActiveCompOnly && aActiveComponent->_is_nil()) return;
          rwi->StartPickCallback();
 
          if (!myShiftState) {
@@ -1117,9 +1054,10 @@ void VTKViewer_InteractorStyleSALOME::onFinishOperation()
                    if(SActor->hasIO()) {
                      Handle(SALOME_InteractiveObject) IO = SActor->getIO();
                      if(IO.IsNull()) continue;
-                     if(aSelActiveCompOnly)
+                     if(aSelActiveCompOnly) {
                        if(strcmp(aActiveComponent->ComponentDataType(),IO->getComponentDataType()) != 0)
                          continue;
+                     }
                      if(vtkDataSet* aDataSet = SActor->GetMapper()->GetInput()){
                        for(int i = 0, iEnd = aDataSet->GetNumberOfCells(); i < iEnd; i++){
                          if(vtkCell* aCell = aDataSet->GetCell(i)){
@@ -1218,6 +1156,8 @@ void VTKViewer_InteractorStyleSALOME::onFinishOperation()
     }
     break;
   }
+  if (myGUIWindow) myGUIWindow->update();
+
 }
 
 // called during viewer operation when user moves mouse (!put necessary processing here!)
@@ -1382,7 +1322,7 @@ void VTKViewer_InteractorStyleSALOME::Place(const int theX, const int theY)
   // restore zoom scale
   vtkCamera *cam = this->CurrentRenderer->GetActiveCamera();
   cam->SetParallelScale(myScale);
-  this->CurrentRenderer->ResetCameraClippingRange();
+  ::ResetCameraClippingRange(this->CurrentRenderer);
 
   /* VSV Light follows camera: if (this->CurrentLight) {
     this->CurrentLight->SetPosition(cam->GetPosition());
index a8a9aa206359329d28f5ab9676bdddb99d3edb84..62438e91e2d4fd16f0af7bdcf0c7c42a57601aeb 100644 (file)
@@ -34,6 +34,7 @@
 #include <qcursor.h>
 #include "SALOME_Actor.h"
 
+class VTKViewer_Trihedron;
 
 #define VTK_INTERACTOR_STYLE_CAMERA_NONE    0
 #define VTK_INTERACTOR_STYLE_CAMERA_ROTATE  1
@@ -53,7 +54,7 @@ class VTKViewer_InteractorStyleSALOME : public QObject, public vtkInteractorStyl
   // programmers.
   static VTKViewer_InteractorStyleSALOME *New();
 
-  void setTriedron( vtkActorCollection* triedron );
+  void setTriedron(VTKViewer_Trihedron* theTrihedron);
 
   vtkTypeMacro(VTKViewer_InteractorStyleSALOME, vtkObject);
   void PrintSelf(ostream& os, vtkIndent indent);
@@ -67,6 +68,8 @@ class VTKViewer_InteractorStyleSALOME : public QObject, public vtkInteractorStyl
   void OnRightButtonDown(int ctrl, int shift, int x, int y);
   void OnRightButtonUp  (int ctrl, int shift, int x, int y);
 
+  void  ViewFitAll();
+
  protected:
   VTKViewer_InteractorStyleSALOME();
   ~VTKViewer_InteractorStyleSALOME();
@@ -132,7 +135,7 @@ protected:
   bool         myCursorState;
   bool         myShiftState;
   int ForcedState;
-  vtkActorCollection* m_Triedron;  
+  VTKViewer_Trihedron* m_Trihedron;  
 
   QWidget*     myGUIWindow;
 
index 6072e344b883f9302822b24ca45bada172a5e646..7712ec01e3c700e8543b58c8122eb4006d4e5e23 100644 (file)
@@ -45,6 +45,7 @@ using namespace std;
 #include <vtkRenderWindowInteractor.h>
 #include <vtkRendererCollection.h>
 #include <vtkXOpenGLRenderWindow.h>
+#include <vtkCamera.h>
 
 //#include <GL/gl.h>
 //#include <GL/glu.h>
@@ -64,6 +65,7 @@ VTKViewer_RenderWindow::VTKViewer_RenderWindow(QWidget *parent, const char *name
   myRW->SetDisplayId((void*)x11Display());
   myRW->SetWindowId((void*)winId());
   myRW->DoubleBufferOn();
+  setMouseTracking(true);
 }
 
 VTKViewer_RenderWindow::~VTKViewer_RenderWindow() {
@@ -76,10 +78,23 @@ void VTKViewer_RenderWindow::paintEvent(QPaintEvent* theEvent) {
 }
 
 void VTKViewer_RenderWindow::resizeEvent(QResizeEvent* theEvent) {
-  vtkRenderWindowInteractor* aRWI = myRW->GetInteractor();
-  if (aRWI != NULL)
-    aRWI->SetSize(width(), height());
-  myRW->SetSize(width(), height());
+  int aWidth = myRW->GetSize()[0], aHeight = myRW->GetSize()[1];
+  if(vtkRenderWindowInteractor* aRWI = myRW->GetInteractor())
+    aRWI->UpdateSize(width(), height());
+  if(aWidth != width() || aHeight != height()){
+    vtkRendererCollection * aRenderers = myRW->GetRenderers();
+    aRenderers->InitTraversal();
+    double aCoeff = 1.0;
+    if(vtkRenderer *aRenderer = aRenderers->GetNextItem()){
+      vtkCamera *aCamera = aRenderer->GetActiveCamera();
+      double aScale = aCamera->GetParallelScale();
+      if((aWidth - width())*(aHeight - height()) > 0)
+       aCoeff = sqrt(double(aWidth)/double(width())*double(height())/double(aHeight));
+      else
+       aCoeff = double(aWidth)/double(width());
+      aCamera->SetParallelScale(aScale*aCoeff);
+    }
+  }
 }
 
 
index 4099a3fcd19ae5e7d7031a9897ad43e519170c58..2e4ce4b961dcb5fb8b46b4256e109f7f83cc8b8d 100644 (file)
@@ -26,7 +26,6 @@
 //  Module : SALOME
 //  $Header$
 
-using namespace std;
 #include "VTKViewer_RenderWindowInteractor.h"
 #include "VTKViewer_RenderWindow.h"
 #include "VTKViewer_InteractorStyleSALOME.h"
@@ -59,10 +58,11 @@ using namespace std;
 #include <vtkRendererCollection.h>
 #include <vtkPolyDataWriter.h>
 
-
 // QT Includes
 #include <qkeycode.h>
 
+using namespace std;
+
 VTKViewer_RenderWindowInteractor* VTKViewer_RenderWindowInteractor::New() {
   vtkObject *ret = vtkObjectFactory::CreateInstance("VTKViewer_RenderWindowInteractor") ;
   if( ret ) {
@@ -168,6 +168,13 @@ void VTKViewer_RenderWindowInteractor::Initialize() {
   return ;
 }
 
+
+void VTKViewer_RenderWindowInteractor::SetInteractorStyle(vtkInteractorObserver *theInteractor){
+  myInteractorStyle = dynamic_cast<VTKViewer_InteractorStyleSALOME*>(theInteractor);
+  vtkRenderWindowInteractor::SetInteractorStyle(theInteractor);
+}
+
+
 void VTKViewer_RenderWindowInteractor::SetSelectionMode(int mode)
 {
   Cell_Actor->VisibilityOff();
@@ -759,55 +766,38 @@ bool VTKViewer_RenderWindowInteractor::highlight( const Handle(SALOME_Interactiv
                                                  bool hilight, 
                                                  bool update)
 {
-  VTKViewer_InteractorStyleSALOME* aStyle = VTKViewer_InteractorStyleSALOME::SafeDownCast(this->InteractorStyle);
-  if (!aStyle) return false;
-
-  vtkRenderer* aren;
-  for (this->RenderWindow->GetRenderers()->InitTraversal(); 
-       (aren = this->RenderWindow->GetRenderers()->GetNextItem()); ) {
-    vtkActorCollection* theActors = aren->GetActors();
-    theActors->InitTraversal();
-    vtkActor *ac = theActors->GetNextActor();
-    while(!(ac==NULL)) {
-      if ( ac->IsA("SALOME_Actor") ) {
-       SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac );
-       if ( anActor->hasIO() ) {
-         if ( IObject->isSame( anActor->getIO() ) ) {
-           if ( anActor->GetMapper() == NULL ) {
-             return false;
-           }
-           //highlight or unhilight actors
-           if ( anActor->hasHighlight() ) {
-             anActor->highlight(hilight);
-           } else {
-             if ( anActor->GetVisibility() == 1 ) {
-               if (hilight) {
-                 vtkActor2D *actor2D;
-                 vtkProp3D *prop3D;
-                 if ( (prop3D=vtkProp3D::SafeDownCast(anActor)) != NULL ) {
-                   aStyle->HighlightProp3D(prop3D);
-                 } else if ( (actor2D=vtkActor2D::SafeDownCast(anActor)) != NULL ) {
-                   aStyle->HighlightActor2D(actor2D);
-                 }
-                 //this->InteractorStyle->HighlightProp(anActor);
-               } else {
-                 aStyle->HighlightProp3D(NULL);
-                 aStyle->HighlightActor2D(NULL);
-                 //this->InteractorStyle->HighlightProp(NULL);
-               }
+  VTKViewer_InteractorStyleSALOME* aStyle = 
+    VTKViewer_InteractorStyleSALOME::SafeDownCast(this->InteractorStyle);
+  if(!aStyle) return false;
+  vtkRendererCollection* aRenColl = this->RenderWindow->GetRenderers();
+  aRenColl->InitTraversal();
+  while(vtkRenderer* aRen = this->RenderWindow->GetRenderers()->GetNextItem()){
+      vtkActorCollection* theActors = aRen->GetActors();
+      theActors->InitTraversal();
+      while(vtkActor *anAct = theActors->GetNextActor()) {
+       if(SALOME_Actor* anActor = SALOME_Actor::SafeDownCast(anAct)){
+         if(anActor->hasIO()){
+           if(IObject->isSame(anActor->getIO())){
+             if(anActor->GetMapper() == NULL)
+               return false;
+             //highlight or unhilight actors
+             if(anActor->hasHighlight())
+               anActor->highlight(hilight);
+             else{
+               if(anActor->GetVisibility() == 1 && hilight)
+                 aStyle->HighlightProp(anActor);
+               else if(!hilight)
+                 aStyle->HighlightProp(NULL);
              }
            }
          }
        }
       }
-      ac = theActors->GetNextActor();
     }
-  }
-  if (update) {
+  if(update){
     Render();
     emit RenderWindowModified();
   }
-
   return false;
 }
 
@@ -830,36 +820,32 @@ void VTKViewer_RenderWindowInteractor::Update() {
 }
 
 
-bool VTKViewer_RenderWindowInteractor::unHighlightAll()
-{
-  vtkRenderer* aren;
-  for (this->RenderWindow->GetRenderers()->InitTraversal(); 
-       (aren = this->RenderWindow->GetRenderers()->GetNextItem()); ) {
-    vtkActorCollection* theActors = aren->GetActors();
+bool VTKViewer_RenderWindowInteractor::unHighlightAll(){
+  VTKViewer_InteractorStyleSALOME* aStyle = 
+    VTKViewer_InteractorStyleSALOME::SafeDownCast(this->InteractorStyle);
+  if(aStyle) aStyle->HighlightProp(NULL);
+  vtkRendererCollection* aRenColl = this->RenderWindow->GetRenderers();
+  aRenColl->InitTraversal();
+  while(vtkRenderer* aRen = this->RenderWindow->GetRenderers()->GetNextItem()){
+    vtkActorCollection* theActors = aRen->GetActors();
     theActors->InitTraversal();
-
-    if ( theActors->IsItemPresent(Point_Actor) != 0 ) 
-      aren->RemoveActor( Point_Actor );
-    if ( theActors->IsItemPresent( Edge_Actor ) != 0 ) 
-      aren->RemoveActor( Edge_Actor ); 
-    if ( theActors->IsItemPresent( Cell_Actor ) != 0 ) 
-      aren->RemoveActor( Cell_Actor );
-
-    vtkActor *ac = theActors->GetNextActor();
-
-    while(!(ac==NULL)) {
-      if ( ac->IsA("SALOME_Actor") ) {
-       SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac );
-       if ( anActor->hasIO() ) {
+    if(theActors->IsItemPresent(Point_Actor)) 
+      aRen->RemoveActor(Point_Actor);
+    if(theActors->IsItemPresent(Edge_Actor)) 
+      aRen->RemoveActor(Edge_Actor); 
+    if(theActors->IsItemPresent(Cell_Actor)) 
+      aRen->RemoveActor(Cell_Actor);
+    vtkActor *anActor = theActors->GetNextActor();
+    while(vtkActor *anAct = theActors->GetNextActor()) {
+      if(SALOME_Actor* anActor = SALOME_Actor::SafeDownCast(anAct)){
+       if(anActor->hasIO()){
          //highlight or unhilight actors
-         if ( anActor->hasHighlight() )
+         if(anActor->hasHighlight())
            anActor->highlight(false);
        }
       }
-      ac = theActors->GetNextActor();
     }
   }
-
   emit RenderWindowModified() ;
   return false;
 }
index 24f7dd62262df5a0c6f15f992864eadf4e16626a..e5fa4088529c8953db29d6d2f77083117cc0e8e7 100644 (file)
 #include <TColStd_MapOfInteger.hxx>
 #include <TColStd_MapIteratorOfMapOfInteger.hxx>
 
-class VTKViewer_RenderWindow;
 class vtkPolyData;
 class vtkPolyDataMapper;
 
+class VTKViewer_RenderWindow;
+class VTKViewer_InteractorStyleSALOME;
+
 // ------------------------------------------------------------
 // :TRICKY: Fri Apr 21 22:19:27 2000 Pagey
 // The Signal/Slot mechanism used by Qt requires that QObject 
@@ -66,7 +68,7 @@ public:
 
   static VTKViewer_RenderWindowInteractor *New() ; 
 
-  vtkTypeMacro(vtkRenderWindowInteractor,vtkObject);
+  vtkTypeMacro(VTKViewer_RenderWindowInteractor,vtkRenderWindowInteractor);
 
   void PrintSelf(ostream& os, vtkIndent indent);
 
@@ -76,6 +78,11 @@ public:
   // want to have mouse interaction.
   virtual void Initialize();
 
+  virtual void SetInteractorStyle(vtkInteractorObserver *);
+  VTKViewer_InteractorStyleSALOME* GetInteractorStyleSALOME(){
+    return myInteractorStyle;
+  }
+
   // Description:
   // This will start up the X event loop and never return. If you
   // call this method it will loop processing X events until the
@@ -174,23 +181,24 @@ public:
   vtkRenderer* GetRenderer();
 
   QWidget* getGUIWindow() {return myGUIWindow;}
-  void setGUIWindow(QWidget* theWin) { myGUIWindow = theWin;}
-
+  void setGUIWindow(QWidget* theWin) {myGUIWindow = theWin;}
+  
   typedef void (*TCreateMapperFun)(vtkPolyData *theSourcePolyData, 
-                                          vtkPolyDataMapper* theMapper, 
-                                          const TColStd_MapOfInteger& theMapIndex);
+                                  vtkPolyDataMapper* theMapper, 
+                                  const TColStd_MapOfInteger& theMapIndex);
  protected:
 
   VTKViewer_RenderWindowInteractor();
   ~VTKViewer_RenderWindowInteractor();
 
+  VTKViewer_InteractorStyleSALOME* myInteractorStyle;
+
   bool highlight(const Handle(SALOME_InteractiveObject)& IObject, 
                 const TColStd_MapOfInteger& MapIndex, TCreateMapperFun theFun,
                 vtkActor *theActor, bool hilight, bool update );
-  //
+
   // Timer used during various mouse events to figure 
   // out mouse movements. 
-  //
   QTimer *mTimer ;
 
   //CAI: Display mode
@@ -202,14 +210,11 @@ public:
   vtkActor* Edge_Actor; //NB
   vtkActor* Cell_Actor;
   
-  //
   // User for switching to stereo mode.
-  //
   int PositionBeforeStereo[2];
-  //
+
   // Connect/disconnect all slots which allow events on the
   // render window to be passed to the interactor. 
-  //
   void ConnectSlots() ;
   void DisconnectSlots() ;
   void ProcessSlotConnections(bool conn) ;
@@ -227,13 +232,12 @@ public:
   void KeyPressed(QKeyEvent *event) ;
 
   private slots:
-    //
     // Not all of these slots are needed in VTK_MAJOR_VERSION=3,
     // but moc does not understand "#if VTK_MAJOR_VERSION". Hence, 
     // we have to include all of these for the time being. Once,
     // this bug in MOC is fixed, we can separate these. 
-    //
     void TimerFunc() ;
+
  signals:
   void RenderWindowModified() ;
 
@@ -243,3 +247,4 @@ public:
 
 #endif
 
diff --git a/src/VTKViewer/VTKViewer_Trihedron.cxx b/src/VTKViewer/VTKViewer_Trihedron.cxx
new file mode 100644 (file)
index 0000000..be2d188
--- /dev/null
@@ -0,0 +1,390 @@
+//  SALOME VTKViewer : 
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : VTKViewer_Trihedron.cxx
+//  Author : Alexey PETROV
+//  Module : SALOME
+//  $Header: 
+
+#include "VTKViewer_Trihedron.h"
+#include "utilities.h"
+#include "SALOME_Actor.h"
+
+// VTK Includes
+#include <vtkMath.h>
+#include <vtkMapper.h>
+#include <vtkDataSet.h>
+#include <vtkRenderer.h>
+#include <vtkFollower.h>
+#include <vtkRenderWindow.h>
+#include <vtkObjectFactory.h>
+
+#include <vtkActor.h>
+#include <vtkProperty.h>
+#include <vtkLineSource.h>
+#include <vtkConeSource.h>
+#include <vtkPolyDataMapper.h>
+
+#include "VTKViewer_VectorText.h"
+
+using namespace std;
+
+//==============================================================================
+
+class VTKViewer_UnScaledActor: public vtkFollower{
+  VTKViewer_UnScaledActor(const VTKViewer_UnScaledActor&);
+
+public:
+  vtkTypeMacro(VTKViewer_UnScaledActor,vtkFollower);
+  static VTKViewer_UnScaledActor *New();
+
+  virtual void SetSize(int theSize);
+  virtual void Render(vtkRenderer *theRenderer);
+
+protected:
+  VTKViewer_UnScaledActor();
+  int mySize;
+};
+
+vtkStandardNewMacro(VTKViewer_UnScaledActor);
+
+VTKViewer_UnScaledActor::VTKViewer_UnScaledActor(){}
+
+void VTKViewer_UnScaledActor::Render(vtkRenderer *theRenderer){
+  if(theRenderer){
+    float P[2][3] = {{-1.0, -1.0, 0.0},{+1.0, +1.0, 0.0}};
+    theRenderer->ViewToWorld(P[0][0],P[0][1],P[0][2]);
+    theRenderer->ViewToWorld(P[1][0],P[1][1],P[1][2]);
+    float aWorldDiag = sqrt((P[1][0]-P[0][0])*(P[1][0]-P[0][0])+
+                           (P[1][1]-P[0][1])*(P[1][1]-P[0][1])+
+                           (P[1][2]-P[0][2])*(P[1][2]-P[0][2]));
+    int* aSize = theRenderer->GetRenderWindow()->GetSize();
+    float aWinDiag = sqrt(float(aSize[0]*aSize[0]+aSize[1]*aSize[1]));
+    vtkDataSet* aDataSet = GetMapper()->GetInput();
+    float aLength = aDataSet->GetLength();
+    float aScale = mySize*aWorldDiag/aWinDiag/aLength*sqrt(float(aSize[0])/float(aSize[1]));
+    SetScale(aScale);
+  }
+  vtkFollower::Render(theRenderer);
+}
+
+void VTKViewer_UnScaledActor::SetSize(int theSize){
+  mySize = theSize;
+}
+
+//==============================================================================
+
+// The base class for concreate Axis
+// Its only duty is to give correct initialization and destruction
+//   of its pipe-lines
+class VTKViewer_Axis : public vtkObject{
+protected:
+  VTKViewer_Axis();
+  VTKViewer_Axis(const VTKViewer_Axis&);
+  virtual ~VTKViewer_Axis();
+ public:
+  vtkTypeMacro(VTKViewer_Axis,vtkObject);
+  
+  virtual void AddToRender(vtkRenderer* theRenderer){
+    theRenderer->AddActor(myLabelActor);
+    theRenderer->AddActor(myArrowActor);
+    theRenderer->AddActor(myLineActor);
+  }
+
+  virtual void SetVisibility(VTKViewer_Trihedron::TVisibility theVis);
+  virtual VTKViewer_Trihedron::TVisibility GetVisibility() { 
+    return myVisibility;
+  }
+
+  virtual void SetCamera(vtkCamera* theCamera){
+    myLabelActor->SetCamera(theCamera);
+  }
+
+  virtual void SetProperty(vtkProperty* theProperty){
+    myLabelActor->SetProperty(theProperty);
+    myArrowActor->SetProperty(theProperty);
+    myLineActor->SetProperty(theProperty);
+  }
+
+  virtual void SetSize(float theSize);
+
+  virtual VTKViewer_UnScaledActor* GetLabel(){
+    return myLabelActor;
+  }
+
+  virtual VTKViewer_UnScaledActor* GetArrow(){
+    return myArrowActor;
+  }
+
+protected:
+  VTKViewer_Trihedron::TVisibility myVisibility;
+  float myDir[3], myRot[3];
+
+  vtkActor *myLineActor;
+  VTKViewer_UnScaledActor *myArrowActor;
+  VTKViewer_UnScaledActor *myLabelActor;
+
+  vtkPolyDataMapper *myMapper[3];
+  vtkLineSource *myLineSource;
+  vtkConeSource *myConeSource;
+  VTKViewer_VectorText* myVectorText;
+};
+
+VTKViewer_Axis::VTKViewer_Axis(){
+  // Initialize the Line pipe-line representation
+  myLineSource = vtkLineSource::New();
+  myLineSource->SetPoint1(0.0,0.0,0.0);
+
+  myMapper[0] = vtkPolyDataMapper::New();
+  myMapper[0]->SetInput(myLineSource->GetOutput());
+
+  myLineActor = vtkActor::New();
+  myLineActor->SetMapper(myMapper[0]);
+  myLineActor->PickableOff();
+
+  // Initialize the Arrow pipe-line representation
+  myConeSource =  vtkConeSource::New();
+  myConeSource->SetResolution(2);
+  myConeSource->SetAngle(10);
+
+  myMapper[1] = vtkPolyDataMapper::New();
+  myMapper[1]->SetInput(myConeSource->GetOutput());
+  
+  myArrowActor = VTKViewer_UnScaledActor::New();
+  myArrowActor->SetMapper(myMapper[1]);
+  static int aArrowActorSize = 24;
+  myArrowActor->SetSize(aArrowActorSize);
+  myArrowActor->PickableOff();
+
+  // Initialize the Label pipe-line representation
+  myVectorText = VTKViewer_VectorText::New();
+
+  myMapper[2] = vtkPolyDataMapper::New();
+  myMapper[2]->SetInput(myVectorText->GetOutput());
+
+  myLabelActor = VTKViewer_UnScaledActor::New();
+  myLabelActor->SetMapper(myMapper[2]);
+  static int aLabelActorSize = 12;
+  myLabelActor->SetSize(aLabelActorSize);
+  myLabelActor->PickableOff();
+
+  // Initialise visibility param.
+  myVisibility = VTKViewer_Trihedron::eOn;
+}
+
+VTKViewer_Axis::~VTKViewer_Axis(){
+  // Destroy of the Label pipe-line representation
+  myLabelActor->Delete();
+
+  myMapper[2]->RemoveAllInputs();
+  myMapper[2]->Delete();
+
+  myVectorText->Delete();
+
+  // Destroy of the Arrow pipe-line representation
+  myArrowActor->Delete();
+
+  myMapper[1]->RemoveAllInputs();
+  myMapper[1]->Delete();
+
+  myConeSource->Delete();
+
+  // Destroy of the Arrow pipe-line representation
+  myLineActor->Delete();
+
+  myMapper[2]->RemoveAllInputs();
+  myMapper[2]->Delete();
+
+  myLineSource->Delete();
+}
+
+void VTKViewer_Axis::SetVisibility(VTKViewer_Trihedron::TVisibility theVis){
+  switch(theVis){
+  case VTKViewer_Trihedron::eOff:
+  case VTKViewer_Trihedron::eOn:
+    myLabelActor->SetVisibility(theVis);
+    myArrowActor->SetVisibility(theVis);
+    myLineActor->SetVisibility(theVis);
+    break;
+  case VTKViewer_Trihedron::eOnlyLineOn:
+    myLabelActor->VisibilityOff();
+    myArrowActor->VisibilityOff();
+    myLineActor->VisibilityOn();
+    break;
+  default:
+    return;
+  }
+  myVisibility = theVis;
+}
+
+void VTKViewer_Axis::SetSize(float theSize){
+  float aPosition[3] = {myDir[0]*theSize, myDir[1]*theSize, myDir[2]*theSize};
+  myLineSource->SetPoint2(aPosition);
+
+  myArrowActor->SetPosition(0.0,0.0,0.0);
+  myArrowActor->AddPosition(aPosition);
+  myArrowActor->SetOrientation(myRot);
+
+  myLabelActor->SetPosition(0.0,0.0,0.0);
+  myLabelActor->AddPosition(aPosition);
+}
+
+//==============================================================================
+class VTKViewer_XAxis : public VTKViewer_Axis{
+protected:
+  VTKViewer_XAxis();
+  VTKViewer_XAxis(const VTKViewer_XAxis&);
+public:
+  vtkTypeMacro(VTKViewer_XAxis,VTKViewer_Axis);
+  static VTKViewer_XAxis *New();
+};
+
+vtkStandardNewMacro(VTKViewer_XAxis);
+
+VTKViewer_XAxis::VTKViewer_XAxis(){ 
+  myDir[0] = 1.0; myDir[1] = 0.0; myDir[2] = 0.0;
+  myRot[0] = 0.0; myRot[1] = 0.0; myRot[2] = 0.0;
+  myVectorText->SetText("X");
+  vtkProperty* aProperty = vtkProperty::New();
+  aProperty->SetColor(1.0,0.0,0.0);
+  SetProperty(aProperty);
+  aProperty->Delete();
+}
+
+//==============================================================================
+class VTKViewer_YAxis : public VTKViewer_Axis{
+protected:
+  VTKViewer_YAxis();
+  VTKViewer_YAxis(const VTKViewer_YAxis&);
+public:
+  vtkTypeMacro(VTKViewer_YAxis,VTKViewer_Axis);
+  static VTKViewer_YAxis *New();
+};
+
+vtkStandardNewMacro(VTKViewer_YAxis);
+
+VTKViewer_YAxis::VTKViewer_YAxis(){ 
+  myDir[0] = 0.0; myDir[1] = 1.0; myDir[2] = 0.0;
+  myRot[0] = 0.0; myRot[1] = 0.0; myRot[2] = 90.;
+  myVectorText->SetText("Y");
+  vtkProperty* aProperty = vtkProperty::New();
+  aProperty->SetColor(0.0,1.0,0.0);
+  SetProperty(aProperty);
+  aProperty->Delete();
+}
+
+//==============================================================================
+class VTKViewer_ZAxis : public VTKViewer_Axis{
+protected:
+  VTKViewer_ZAxis();
+  VTKViewer_ZAxis(const VTKViewer_ZAxis&);
+public:
+  vtkTypeMacro(VTKViewer_ZAxis,VTKViewer_Axis);
+  static VTKViewer_ZAxis *New();
+};
+
+vtkStandardNewMacro(VTKViewer_ZAxis);
+
+VTKViewer_ZAxis::VTKViewer_ZAxis(){ 
+  myDir[0] = 0.0; myDir[1] = 0.0; myDir[2] = 1.0;
+  myRot[0] = 0.0; myRot[1] = -90; myRot[2] = 0.0;
+  myVectorText->SetText("Z");
+  vtkProperty* aProperty = vtkProperty::New();
+  aProperty->SetColor(0.0,0.0,1.0);
+  SetProperty(aProperty);
+  aProperty->Delete();
+}
+
+//==============================================================================
+
+vtkStandardNewMacro(VTKViewer_Trihedron);
+
+VTKViewer_Trihedron::VTKViewer_Trihedron(){
+  myPresent = vtkActorCollection::New();
+  myAxis[0] = VTKViewer_XAxis::New();
+  myAxis[1] = VTKViewer_YAxis::New();
+  myAxis[2] = VTKViewer_ZAxis::New();
+  static float aSize = 100;
+  SetSize(aSize);
+}
+
+VTKViewer_Trihedron::~VTKViewer_Trihedron(){
+  myPresent->RemoveAllItems();
+  myPresent->Delete();
+  for(int i = 0; i < 3; i++)
+    myAxis[i]->Delete();
+}
+
+void VTKViewer_Trihedron::SetSize(float theSize){
+  mySize = theSize;
+  for(int i = 0; i < 3; i++)
+    myAxis[i]->SetSize(theSize);
+}
+
+void VTKViewer_Trihedron::SetVisibility(TVisibility theVis){
+  for(int i = 0; i < 3; i++)
+    myAxis[i]->SetVisibility(theVis);
+}
+
+VTKViewer_Trihedron::TVisibility VTKViewer_Trihedron::GetVisibility(){
+  return myAxis[0]->GetVisibility();
+}
+
+void VTKViewer_Trihedron::AddToRender(vtkRenderer* theRenderer){
+  vtkCamera* aCamera = theRenderer->GetActiveCamera();
+  for(int i = 0; i < 3; i++){
+    myAxis[i]->AddToRender(theRenderer);
+    myAxis[i]->SetCamera(aCamera);
+  }
+}
+
+void VTKViewer_Trihedron::RemoveFromRender(vtkRenderer* theRenderer){
+  myPresent->InitTraversal();
+  while(vtkActor* anActor = myPresent->GetNextActor())
+    theRenderer->RemoveActor(anActor);
+}
+
+int VTKViewer_Trihedron::GetVisibleActorCount(vtkRenderer* theRenderer){
+  //TVisibility aVis = GetVisibility();
+  //SetVisibility(eOff);
+  vtkActorCollection* aCollection = theRenderer->GetActors();
+  aCollection->InitTraversal();
+  int aCount = 0;
+  while(vtkActor* prop = aCollection->GetNextActor())
+    if( prop->GetVisibility())
+      if(SALOME_Actor* anActor = SALOME_Actor::SafeDownCast(prop))
+       if(!anActor->IsInfinitive()) 
+         aCount++;
+  //int aCount = theRenderer->VisibleActorCount();
+  //SetVisibility(aVis);
+  return aCount;
+}
+
+void VTKViewer_Trihedron::Render(vtkRenderer* theRenderer){
+  for(int i = 0; i < 3; i++)
+    {
+      myAxis[i]->GetLabel()->Render(theRenderer);
+      myAxis[i]->GetArrow()->Render(theRenderer);
+    }
+}
+
diff --git a/src/VTKViewer/VTKViewer_Trihedron.h b/src/VTKViewer/VTKViewer_Trihedron.h
new file mode 100644 (file)
index 0000000..056ea15
--- /dev/null
@@ -0,0 +1,69 @@
+//  SALOME VTKViewer : 
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : VTKViewer_Trihedron.h
+//  Author : Alexey PETROV
+//  Module : SALOME
+//  $Header: 
+
+#ifndef VTKViewer_Trihedron_H
+#define VTKViewer_Trihedron_H
+
+#include <vtkObject.h>
+
+class vtkActorCollection;
+class VTKViewer_Axis;
+class vtkRenderer;
+
+class VTKViewer_Trihedron : public vtkObject{
+ protected:
+  VTKViewer_Trihedron();
+  VTKViewer_Trihedron(const VTKViewer_Trihedron&);
+  virtual ~VTKViewer_Trihedron();
+ public:
+  vtkTypeMacro(VTKViewer_Trihedron,vtkObject);
+  static VTKViewer_Trihedron *New();
+  
+  virtual void SetSize(float theSize);
+  virtual float GetSize() { return mySize;}
+
+  enum TVisibility{eOff, eOn, eOnlyLineOn};
+  virtual void SetVisibility(TVisibility theVis);
+  virtual void VisibilityOff() { SetVisibility(eOff);}
+  virtual void VisibilityOn() { SetVisibility(eOn);}
+  virtual TVisibility GetVisibility();
+
+  virtual void AddToRender(vtkRenderer* theRenderer);
+  virtual void RemoveFromRender(vtkRenderer* theRenderer);
+
+  virtual int GetVisibleActorCount(vtkRenderer* theRenderer);
+  
+  virtual void  Render(vtkRenderer *theRenderer);
+  
+protected:
+  vtkActorCollection* myPresent;
+  VTKViewer_Axis* myAxis[3];
+  float mySize;
+};
+
+#endif
diff --git a/src/VTKViewer/VTKViewer_Utilities.cxx b/src/VTKViewer/VTKViewer_Utilities.cxx
new file mode 100644 (file)
index 0000000..ce64a1e
--- /dev/null
@@ -0,0 +1,195 @@
+//  SALOME VTKViewer : 
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : VTKViewer_Utilities.cxx
+//  Author : Alexey PETROV
+//  Module : SALOME
+//  $Header: 
+
+#include "VTKViewer_Utilities.h"
+#include "utilities.h"
+#include "SALOME_Actor.h"
+
+// VTK Includes
+#include <vtkMath.h>
+#include <vtkCamera.h>
+#include <vtkRenderer.h>
+#include <vtkRenderWindow.h>
+
+using namespace std;
+
+//see vtkRenderer::ResetCamera(float bounds[6]) method
+void ResetCamera(vtkRenderer* theRenderer, int theUsingZeroFocalPoint){  
+  if(!theRenderer) return;
+  float bounds[6];
+  int aCount = ComputeVisiblePropBounds(theRenderer,bounds);
+  if(theUsingZeroFocalPoint || aCount){
+    float aLength = bounds[1]-bounds[0];
+    aLength = max((bounds[3]-bounds[2]),aLength);
+    aLength = max((bounds[5]-bounds[4]),aLength);
+    
+    double vn[3];
+    if ( theRenderer->GetActiveCamera() != NULL )
+      theRenderer->GetActiveCamera()->GetViewPlaneNormal(vn);
+    else{
+      INFOS("Trying to reset non-existant camera");
+      return;
+    }
+    
+    float center[3] = {0.0, 0.0, 0.0};
+    if(!theUsingZeroFocalPoint){
+      center[0] = (bounds[0] + bounds[1])/2.0;
+      center[1] = (bounds[2] + bounds[3])/2.0;
+      center[2] = (bounds[4] + bounds[5])/2.0;
+    }
+    theRenderer->GetActiveCamera()->SetFocalPoint(center[0],center[1],center[2]);
+    
+    float width = sqrt((bounds[1]-bounds[0])*(bounds[1]-bounds[0]) +
+                      (bounds[3]-bounds[2])*(bounds[3]-bounds[2]) +
+                      (bounds[5]-bounds[4])*(bounds[5]-bounds[4]));
+    
+    double ang = theRenderer->GetActiveCamera()->GetViewAngle();
+    float distance = 2.0*width/tan(ang*vtkMath::Pi()/360.0);
+    
+    // check view-up vector against view plane normal
+    double *vup = theRenderer->GetActiveCamera()->GetViewUp();
+    if ( fabs(vtkMath::Dot(vup,vn)) > 0.999 ){
+      MESSAGE("Resetting view-up since view plane normal is parallel");
+      theRenderer->GetActiveCamera()->SetViewUp(-vup[2], vup[0], vup[1]);
+    }
+    
+    // update the camera
+    theRenderer->GetActiveCamera()->SetPosition(center[0]+distance*vn[0],
+                                               center[1]+distance*vn[1],
+                                               center[2]+distance*vn[2]);
+    // find size of the window
+    int* winsize = theRenderer->GetSize();
+    if(winsize[0] < winsize[1]) width *= float(winsize[1])/float(winsize[0]);
+    
+    if(theUsingZeroFocalPoint) width *= sqrt(2.0);
+    
+    theRenderer->GetActiveCamera()->SetParallelScale(width/2.0);
+  }
+  //workaround on VTK
+  //theRenderer->ResetCameraClippingRange(bounds);
+  ResetCameraClippingRange(theRenderer);
+}
+
+
+// Compute the bounds of the visible props
+int ComputeVisiblePropBounds(vtkRenderer* theRenderer, float theBounds[6]){
+  vtkProp    *prop;
+  float      *bounds;
+  int        aCount=0;
+
+  theBounds[0] = theBounds[2] = theBounds[4] = VTK_LARGE_FLOAT;
+  theBounds[1] = theBounds[3] = theBounds[5] = -VTK_LARGE_FLOAT;
+  
+  // loop through all props
+  vtkActorCollection* aCollection = theRenderer->GetActors();
+  aCollection->InitTraversal();
+  while (vtkActor* prop = aCollection->GetNextActor()) {
+    // if it's invisible, or has no geometry, we can skip the rest 
+    if ( prop->GetVisibility() )
+      {
+      if(SALOME_Actor* anActor = SALOME_Actor::SafeDownCast(prop))
+       if(anActor->IsInfinitive()) continue;
+      bounds = prop->GetBounds();
+      // make sure we haven't got bogus bounds
+      if ( bounds != NULL &&
+           bounds[0] > -VTK_LARGE_FLOAT && bounds[1] < VTK_LARGE_FLOAT &&
+           bounds[2] > -VTK_LARGE_FLOAT && bounds[3] < VTK_LARGE_FLOAT &&
+           bounds[4] > -VTK_LARGE_FLOAT && bounds[5] < VTK_LARGE_FLOAT )
+        {
+        aCount++;
+
+        if (bounds[0] < theBounds[0])
+          {
+          theBounds[0] = bounds[0]; 
+          }
+        if (bounds[1] > theBounds[1])
+          {
+          theBounds[1] = bounds[1]; 
+          }
+        if (bounds[2] < theBounds[2])
+          {
+          theBounds[2] = bounds[2]; 
+          }
+        if (bounds[3] > theBounds[3])
+          {
+          theBounds[3] = bounds[3]; 
+          }
+        if (bounds[4] < theBounds[4])
+          {
+          theBounds[4] = bounds[4]; 
+          }
+        if (bounds[5] > theBounds[5])
+          {
+          theBounds[5] = bounds[5]; 
+          }
+        }//not bogus
+      }
+    }
+  return aCount;
+}
+
+
+//see vtkRenderer::ResetCameraClippingRange(float bounds[6]) method
+void ResetCameraClippingRange(vtkRenderer* theRenderer){
+  if(!theRenderer || !theRenderer->VisibleActorCount()) return;
+
+  vtkCamera* anActiveCamera = theRenderer->GetActiveCamera();
+  if( anActiveCamera == NULL ){
+    MESSAGE("Trying to reset clipping range of non-existant camera");
+    return;
+  }
+  
+  // Find the plane equation for the camera view plane
+  double vn[3];
+  anActiveCamera->GetViewPlaneNormal(vn);
+  double  position[3];
+  anActiveCamera->GetPosition(position);
+
+  float bounds[6];
+  theRenderer->ComputeVisiblePropBounds(bounds);
+
+  double center[3];
+  center[0] = (bounds[0] + bounds[1])/2.0;
+  center[1] = (bounds[2] + bounds[3])/2.0;
+  center[2] = (bounds[4] + bounds[5])/2.0;
+  
+  double width = sqrt((bounds[1]-bounds[0])*(bounds[1]-bounds[0]) +
+                    (bounds[3]-bounds[2])*(bounds[3]-bounds[2]) +
+                    (bounds[5]-bounds[4])*(bounds[5]-bounds[4]));
+
+  double distance = sqrt((position[0]-center[0])*(position[0]-center[0]) +
+                        (position[1]-center[1])*(position[1]-center[1]) +
+                        (position[2]-center[2])*(position[2]-center[2]));
+
+  float range[2] = {distance - width/2.0, distance + width/2.0};
+
+  // Do not let the range behind the camera throw off the calculation.
+  if (range[0] < 0.0) range[0] = 0.0;
+
+  anActiveCamera->SetClippingRange( range );
+}
diff --git a/src/VTKViewer/VTKViewer_Utilities.h b/src/VTKViewer/VTKViewer_Utilities.h
new file mode 100644 (file)
index 0000000..e297ce7
--- /dev/null
@@ -0,0 +1,39 @@
+//  SALOME VTKViewer : 
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : VTKViewer_Utilities.h
+//  Author : Alexey PETROV
+//  Module : SALOME
+//  $Header: 
+
+#ifndef VTKViewer_Utilities_H
+#define VTKViewer_Utilities_H
+
+class vtkRenderer;
+
+extern void ResetCamera(vtkRenderer* theRenderer, int theUsingZeroFocalPoint = false);
+extern int ComputeVisiblePropBounds(vtkRenderer* theRenderer, float theBounds[6]);
+extern void ResetCameraClippingRange(vtkRenderer* theRenderer);
+extern float EPS_BNDBOX;
+
+#endif
index b54107cd51a135e34e560f9f8579df89af503a09..8f9e8e286b1f39d0388a8f6c3a64b3c39fc8bf18 100644 (file)
 //  $Header$
 
 #include "VTKViewer_ViewFrame.h"
+#include "VTKViewer_Utilities.h"
+#include "VTKViewer_Trihedron.h"
 #include "VTKViewer_RenderWindow.h"
+#include "VTKViewer_InteractorStyleSALOME.h"
 
 #include "SALOME_Transform.h"
 #include "SALOME_TransformFilter.h"
@@ -40,8 +43,6 @@
 #include "QAD_Desktop.h"
 #include "SALOME_Selection.h"
 #include "SALOME_InteractiveObject.hxx"
-#include "VTKViewer_InteractorStyleSALOME.h"
-#include "VTKViewer_VectorText.h"
 
 #include "utilities.h"
 
 // VTK Includes
 #include <vtkActor.h>
 #include <vtkRenderer.h>
-#include <vtkPolyDataMapper.h> 
-
-#include <vtkMath.h>
-#include <vtkLine.h>
-#include <vtkConeSource.h>
-#include <vtkFollower.h>
+#include <vtkTransform.h>
 
 using namespace std;
+
 /*!
     Constructor
 */
@@ -70,186 +67,16 @@ VTKViewer_ViewFrame::VTKViewer_ViewFrame(QWidget* parent, const char* name)
 {
   m_ViewUp[0] = 0; m_ViewUp[1] = 0; m_ViewUp[2] = -1;
   m_ViewNormal[0] = 0; m_ViewNormal[1] = 0; m_ViewNormal[2] = 1;
+  m_Triedron = VTKViewer_Trihedron::New();
   m_Transform = SALOME_Transform::New();
+  //m_Renderer = VTKViewer_Renderer::New() ;
+  m_Renderer = vtkRenderer::New() ;
 
-  //  m_InitialSetupDone = false ;
+  m_Triedron->AddToRender(m_Renderer);
   InitialSetup();
-}
-
-
-vtkFollower* CreateTextActor(char *text, float aSize) {
-  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 = 17 * aSize/100;
-  textActor->SetScale(aScale, aScale, aScale);
-  return textActor;
-}
-
-void VTKViewer_ViewFrame::AddVector(float* o,float* p,vtkRenderer* renderer, float aSize) {
-  vtkPoints* myPoints = vtkPoints::New();
-  vtkLine* myLine = vtkLine::New();
-
-  myPoints->InsertNextPoint(o);
-  myPoints->InsertNextPoint(p);
-
-  (myLine->GetPointIds())->InsertNextId(0);
-  (myLine->GetPointIds())->InsertNextId(1);
-
-  vtkActor* lineActor = vtkActor::New();
-
-  vtkCellArray* cell = vtkCellArray::New();
-
-  cell->InsertNextCell(myLine);
-
-  vtkPolyData* output = vtkPolyData::New();
-  
-  output->SetPoints(myPoints);
-  output->SetLines(cell);
-  vtkPolyDataMapper* mapper = vtkPolyDataMapper::New();
-
-  mapper->SetInput(output);
-
-  lineActor->SetMapper(mapper);
-
-  // Create CONE
-
-  vtkConeSource* acone =  vtkConeSource::New();
-
-  float dim = aSize;
-
-  acone->SetResolution(2);
-  //  acone->SetAngle(70);
-  acone->SetRadius(0.02*dim);
-  acone->SetHeight(0.08*dim);
-
-  vtkActor* coneActor = vtkActor::New();
-  vtkPolyDataMapper* coneMapper = vtkPolyDataMapper::New();
-  coneMapper->SetInput(acone->GetOutput());
-
-  coneActor->SetMapper(coneMapper);
-  float rot[3];
-  rot[0]=0; rot[1]=0; rot[2]=0;
-
-  vtkFollower* aTextActor;
-
-  coneActor->AddPosition(p);
-  if(p[0]!=0) {
-    // x
-    aTextActor = CreateTextActor("X", dim);
-  } else if(p[1]!=0) {
-    // y
-    rot[2]=90;
-    coneActor->AddOrientation(rot);
-    aTextActor = CreateTextActor("Y", dim);
-  } else if(p[2]!=0) {
-    // z
-    rot[1]=-90;
-    coneActor->AddOrientation(rot);
-    aTextActor = CreateTextActor("Z", dim);
-  }
-  aTextActor->AddPosition(p);
-  aTextActor->SetCamera(renderer->GetActiveCamera());
-
-  coneActor->GetProperty()->SetInterpolation(1);
-  coneActor->GetProperty()->SetRepresentationToSurface();
-  coneActor->GetProperty()->SetAmbient(1);
-  coneActor->GetProperty()->SetAmbientColor(1,1,1);
-  coneActor->GetProperty()->SetDiffuseColor(0.7,0.7,0.7);
-  coneActor->GetProperty()->SetSpecularColor(0.7,0.7,0.7);
-
-  lineActor->GetProperty()->SetInterpolation(1);
-  lineActor->GetProperty()->SetRepresentationToSurface();
-  lineActor->GetProperty()->SetAmbient(1);
-  lineActor->GetProperty()->SetAmbientColor(1,1,1);
-  lineActor->GetProperty()->SetDiffuseColor(0.7,0.7,0.7);
-  lineActor->GetProperty()->SetSpecularColor(0.7,0.7,0.7);
-
-  aTextActor->GetProperty()->SetAmbient(1);
-  aTextActor->GetProperty()->SetAmbientColor(1,1,1);
-  aTextActor->GetProperty()->SetDiffuseColor(0.7,0.7,0.7);
-  aTextActor->GetProperty()->SetSpecularColor(0.7,0.7,0.7);
-     
-  coneActor->PickableOff();
-  lineActor->PickableOff();
-  aTextActor->PickableOff();
-  
-  m_Triedron->AddItem(coneActor);
-  m_Triedron->AddItem(lineActor);
-  m_Triedron->AddItem(aTextActor);
-
-  renderer->AddActor(coneActor);
-  renderer->AddActor(lineActor);
-  renderer->AddActor(aTextActor);
 }  
 
-bool VTKViewer_ViewFrame::isTrihedronDisplayed() {
-  m_Triedron->InitTraversal();
-  vtkActor *ac = m_Triedron->GetNextActor();
-  while(!(ac==NULL)) {
-    if(ac->GetVisibility()) return true;
-    ac = m_Triedron->GetNextActor();
-  }
-  return false;
-}
-
-void VTKViewer_ViewFrame::SetTrihedronSize(int size)
-{
-  m_Triedron->InitTraversal();
-  vtkActor* anActor = m_Triedron->GetNextActor();
-  while(!(anActor==NULL)) {  
-    m_Renderer->RemoveActor( anActor );
-    anActor = m_Triedron->GetNextActor();
-  }
-
-  m_Triedron->RemoveAllItems();
-  AddAxis(m_Renderer);
-  m_RW->update();
-}
-
-
-void VTKViewer_ViewFrame::AddAxis(vtkRenderer* renderer) {  
-  float origine[3];
-  float X[3];
-  float Y[3];
-  float Z[3];
-  float dim;
-
-  QString Size = QAD_CONFIG->getSetting("Viewer:TrihedronSize");
-  if( Size.isEmpty() ){
-    dim = 100;
-  } else {
-    dim = Size.toFloat();
-  }
-
-  origine[0]=0;        origine[1]=0;        origine[2]=0;
-  X[0]=origine[0]+dim; X[1]=origine[0];     X[2]=origine[0];
-  Y[0]=origine[0];     Y[1]=origine[0]+dim; Y[2]=origine[0];
-  Z[0]=origine[0];     Z[1]=origine[0];     Z[2]=origine[0]+dim;
-
-  AddVector(origine,X,renderer, dim);
-  AddVector(origine,Y,renderer, dim);
-  AddVector(origine,Z,renderer, dim);
-}
-
-/*!
-  Returns widget containing 3D-Viewer
-*/
-QWidget* VTKViewer_ViewFrame::getViewWidget() 
-{
-  return m_RW;
-}
-
-
 void VTKViewer_ViewFrame::InitialSetup() {
-  m_Renderer = vtkRenderer::New() ;
-
   m_RW = new VTKViewer_RenderWindow(this, "RenderWindow");
   m_RW->getRenderWindow()->AddRenderer(m_Renderer);
 
@@ -266,11 +93,7 @@ void VTKViewer_ViewFrame::InitialSetup() {
     m_Renderer->SetBackground( BgrColorRed.toInt()/255., BgrColorGreen.toInt()/255., BgrColorBlue.toInt()/255. );
   else
     m_Renderer->SetBackground( 0, 0, 0 );
-  // CREATE AXIS
-  m_Triedron = vtkActorCollection::New();
-  AddAxis(m_Renderer);
+  
   // Create an interactor.
   m_RWInteractor = VTKViewer_RenderWindowInteractor::New();
   m_RWInteractor->setGUIWindow(m_RW);
@@ -281,7 +104,7 @@ void VTKViewer_ViewFrame::InitialSetup() {
   m_RWInteractor->SetInteractorStyle(RWS); 
 
   m_RWInteractor->Initialize();
-  RWS->setTriedron( m_Triedron );
+  RWS->setTriedron(m_Triedron);
   //SRN: additional initialization, to init CurrentRenderer of vtkInteractorStyle 
   RWS->FindPokedRenderer(0, 0);
 
@@ -290,414 +113,218 @@ void VTKViewer_ViewFrame::InitialSetup() {
 }
 
 VTKViewer_ViewFrame::~VTKViewer_ViewFrame() {
-  //
+  m_Transform->Delete() ;
   // In order to ensure that the interactor unregisters
   // this RenderWindow, we assign a NULL RenderWindow to 
   // it before deleting it.
-  //
-  m_Transform->Delete() ;
-    
   m_RWInteractor->SetRenderWindow(NULL) ;
   m_RWInteractor->Delete() ;
   
   //m_RW->Delete() ;
-
+  m_Renderer->RemoveAllProps();
   // NRI : BugID 1137:  m_Renderer->Delete() ;
+  m_Triedron->Delete();
+  MESSAGE("VTKViewer_ViewFrame::~VTKViewer_ViewFrame()");
 }
 
+/*!
+  Returns widget containing 3D-Viewer
+*/
+QWidget* VTKViewer_ViewFrame::getViewWidget(){
+  return m_RW;
+}
+
+bool VTKViewer_ViewFrame::isTrihedronDisplayed(){
+  return m_Triedron->GetVisibility() == VTKViewer_Trihedron::eOn;
+}
+
+void VTKViewer_ViewFrame::onAdjustTrihedron(){   
+  if(!isTrihedronDisplayed()) 
+    return;
+  int aVisibleNum = m_Triedron->GetVisibleActorCount(m_Renderer);
+  if(aVisibleNum){
+    // calculating diagonal of visible props of the renderer
+    float bnd[6];
+    m_Triedron->VisibilityOff();
+    ::ComputeVisiblePropBounds(m_Renderer,bnd);
+    m_Triedron->VisibilityOn();
+    float aLength = 0;
+    static bool CalcByDiag = false;
+    if(CalcByDiag){
+      aLength = sqrt((bnd[1]-bnd[0])*(bnd[1]-bnd[0])+
+                    (bnd[3]-bnd[2])*(bnd[3]-bnd[2])+
+                    (bnd[5]-bnd[4])*(bnd[5]-bnd[4]));
+    }else{
+      aLength = bnd[1]-bnd[0];
+      aLength = max((bnd[3]-bnd[2]),aLength);
+      aLength = max((bnd[5]-bnd[4]),aLength);
+    }
+   
+    static float aSizeInPercents = 105;
+    QString aSetting = QAD_CONFIG->getSetting("Viewer:TrihedronSize");
+    if(!aSetting.isEmpty()) aSizeInPercents = aSetting.toFloat();
+
+    static float EPS_SIZE = 5.0E-3;
+    float aSize = m_Triedron->GetSize();
+    float aNewSize = aLength*aSizeInPercents/100.0;
+    // if the new trihedron size have sufficient difference, then apply the value
+    if(fabs(aNewSize-aSize) > aSize*EPS_SIZE || fabs(aNewSize-aSize) > aNewSize*EPS_SIZE)
+      m_Triedron->SetSize(aNewSize);
+  }
+  m_Triedron->Render(m_Renderer);
+  ::ResetCameraClippingRange(m_Renderer);
+}
 
 /*!
   Display/hide Trihedron
 */
-void VTKViewer_ViewFrame::onViewTrihedron()
-{
-  if (isTrihedronDisplayed()) {
-    m_Triedron->InitTraversal();
-    vtkActor *ac = m_Triedron->GetNextActor();
-    while(!(ac==NULL)) {
-      ac->VisibilityOff();
-      ac = m_Triedron->GetNextActor();
-    }
+void VTKViewer_ViewFrame::onViewTrihedron(){
+  if(!m_Triedron) return;
+  if(isTrihedronDisplayed())
+    m_Triedron->VisibilityOff();
+  else{
+    m_Triedron->VisibilityOn();
   }
-  else {
-    m_Triedron->InitTraversal();
-    vtkActor *ac = m_Triedron->GetNextActor();
-    while(!(ac==NULL)) {
-      ac->VisibilityOn();
-      ac = m_Triedron->GetNextActor();
-    }
-    m_TriedronVisible = true;
-  }  
-  m_RW->update();
+  Repaint();
 }
 
 /*!
   Provides top projection of the active view
 */
-void VTKViewer_ViewFrame::onViewTop() {
+void VTKViewer_ViewFrame::onViewTop(){
   vtkCamera* camera = m_Renderer->GetActiveCamera();
-  camera->SetFocalPoint(0,0,0);
   camera->SetPosition(0,0,1);
   camera->SetViewUp(0,1,0);
-  m_Renderer->ResetCamera();  
+  camera->SetFocalPoint(0,0,0);
   onViewFitAll();
-  m_RW->update();
 }
 
 /*!
   Provides bottom projection of the active view
 */
-void VTKViewer_ViewFrame::onViewBottom()
-{
+void VTKViewer_ViewFrame::onViewBottom(){
   vtkCamera* camera = m_Renderer->GetActiveCamera();
-  camera->SetFocalPoint(0,0,0);
   camera->SetPosition(0,0,-1);
   camera->SetViewUp(0,1,0);
-  m_Renderer->ResetCamera();  
+  camera->SetFocalPoint(0,0,0);
   onViewFitAll();
-  m_RW->update();
 }
 
 /*!
   Provides left projection of the active view
 */
-void VTKViewer_ViewFrame::onViewLeft()    
-{
+void VTKViewer_ViewFrame::onViewLeft(){
   vtkCamera* camera = m_Renderer->GetActiveCamera(); 
-  camera->SetFocalPoint(0,0,0);
   camera->SetPosition(0,1,0);
   camera->SetViewUp(0,0,1);
-  m_Renderer->ResetCamera();  
+  camera->SetFocalPoint(0,0,0);
   onViewFitAll();
-  m_RW->update(); 
 }
 
 /*!
   Provides right projection of the active view
 */
-void VTKViewer_ViewFrame::onViewRight()
-{
+void VTKViewer_ViewFrame::onViewRight(){
   vtkCamera* camera = m_Renderer->GetActiveCamera();
-  camera->SetFocalPoint(0,0,0);
   camera->SetPosition(0,-1,0);
   camera->SetViewUp(0,0,1);
-  m_Renderer->ResetCamera();  
+  camera->SetFocalPoint(0,0,0);
   onViewFitAll();
-  m_RW->update();
 }
 
 /*!
   Provides back projection of the active view
 */
-void VTKViewer_ViewFrame::onViewBack()
-{
+void VTKViewer_ViewFrame::onViewBack(){
   vtkCamera* camera = m_Renderer->GetActiveCamera();
   camera->SetPosition(-1,0,0);
-  camera->SetFocalPoint(0,0,0);
   camera->SetViewUp(0,0,1);
-  m_Renderer->ResetCamera();  
+  camera->SetFocalPoint(0,0,0);
   onViewFitAll();
-  m_RW->update();
 }
 
 /*!
   Provides front projection of the active view
 */
-void VTKViewer_ViewFrame::onViewFront()
-{
+void VTKViewer_ViewFrame::onViewFront(){
   vtkCamera* camera = m_Renderer->GetActiveCamera();
   camera->SetPosition(1,0,0);
-  camera->SetFocalPoint(0,0,0);
   camera->SetViewUp(0,0,1);
-  m_Renderer->ResetCamera();  
+  camera->SetFocalPoint(0,0,0);
   onViewFitAll();
-  m_RW->update();
 }
 
 /*!
-  Reset the active view
+  Fits all objects in the active view
 */
-void VTKViewer_ViewFrame::onViewReset()    
-{
-  vtkCamera* camera = m_Renderer->GetActiveCamera();
-  camera->SetPosition(1,-1,1);
-  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;
+void VTKViewer_ViewFrame::onViewFitAll(){
+  m_RWInteractor->GetInteractorStyleSALOME()->ViewFitAll();
+//   int aTriedronWasVisible = isTrihedronDisplayed();
+//   if(m_Triedron->GetVisibleActorCount(m_Renderer)){
+//     m_Triedron->VisibilityOff();
+//     ::ResetCamera(m_Renderer);
+//   }else{
+//     m_Triedron->SetVisibility(VTKViewer_Trihedron::eOnlyLineOn);
+//     ::ResetCamera(m_Renderer,true);
+//   }
+//   if(aTriedronWasVisible) m_Triedron->VisibilityOn();
+//   else m_Triedron->VisibilityOff();
 
-  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();
-  }
+  Repaint();
+}
 
-  m_Renderer->ResetCameraClippingRange();
-  m_RW->update();
+/*!
+  Reset the active view
+*/
+void VTKViewer_ViewFrame::onViewReset(){
+  int aTriedronIsVisible = isTrihedronDisplayed();
+  m_Triedron->SetVisibility(VTKViewer_Trihedron::eOnlyLineOn);
+  ::ResetCamera(m_Renderer,true);  
+  vtkCamera* aCamera = m_Renderer->GetActiveCamera();
+  aCamera->SetPosition(1,-1,1);
+  aCamera->SetViewUp(0,0,1);
+  ::ResetCamera(m_Renderer,true);  
+  if(aTriedronIsVisible) m_Triedron->VisibilityOn();
+  else m_Triedron->VisibilityOff();
+  static float aCoeff = 3.0;
+  aCamera->SetParallelScale(aCoeff*aCamera->GetParallelScale());
+  Repaint();
 }
 
 /*!
   Rotates the active view
 */
-void VTKViewer_ViewFrame::onViewRotate()
-{
-  VTKViewer_InteractorStyleSALOME* RWS = dynamic_cast<VTKViewer_InteractorStyleSALOME*>(getRWInteractor()->GetInteractorStyle());
-  if (RWS)
-    RWS->startRotate();
+void VTKViewer_ViewFrame::onViewRotate(){
+  m_RWInteractor->GetInteractorStyleSALOME()->startRotate();
 }
 
 /*!
   Sets a new center of the active view
 */
-void VTKViewer_ViewFrame::onViewGlobalPan()
-{
-  VTKViewer_InteractorStyleSALOME* RWS = dynamic_cast<VTKViewer_InteractorStyleSALOME*>(getRWInteractor()->GetInteractorStyle());
-  if (RWS)
-    RWS->startGlobalPan();
+void VTKViewer_ViewFrame::onViewGlobalPan(){
+  if(m_Triedron->GetVisibleActorCount(m_Renderer))
+    m_RWInteractor->GetInteractorStyleSALOME()->startGlobalPan();
 }
 
 /*!
   Zooms the active view
 */
-void VTKViewer_ViewFrame::onViewZoom()
-{
-  VTKViewer_InteractorStyleSALOME* RWS = dynamic_cast<VTKViewer_InteractorStyleSALOME*>(getRWInteractor()->GetInteractorStyle());
-  if (RWS)
-    RWS->startZoom();
+void VTKViewer_ViewFrame::onViewZoom(){
+  m_RWInteractor->GetInteractorStyleSALOME()->startZoom();
 }
 
 /*!
   Moves the active view
 */
-void VTKViewer_ViewFrame::onViewPan()
-{
-  VTKViewer_InteractorStyleSALOME* RWS = dynamic_cast<VTKViewer_InteractorStyleSALOME*>(getRWInteractor()->GetInteractorStyle());
-  if (RWS)
-    RWS->startPan();
+void VTKViewer_ViewFrame::onViewPan(){
+  m_RWInteractor->GetInteractorStyleSALOME()->startPan();
 }
 
 /*!
   Fits all obejcts within a rectangular area of the active view
 */
-void VTKViewer_ViewFrame::onViewFitArea()
-{
-  VTKViewer_InteractorStyleSALOME* RWS = dynamic_cast<VTKViewer_InteractorStyleSALOME*>(getRWInteractor()->GetInteractorStyle());
-  if (RWS)
-    RWS->startFitArea();
-}
-
-/*!
-  Fits all objects in the active view
-*/
-// Reset the camera clipping range to include this entire bounding box
-static void ResetCameraClippingRange(vtkRenderer* theRenderer, float bounds[6] )
-{
-  //see vtkRenderer::ResetCameraClippingRange(float bounds[6]) method
-  double  vn[3], position[3], a, b, c, d;
-  double  range[2], dist;
-  int     i, j, k;
-  float center[3];
-  float distance;
-  float width;
-
-  vtkCamera* anActiveCamera = theRenderer->GetActiveCamera();
-  if ( anActiveCamera == NULL )
-    {
-      //vtkErrorMacro(<< "Trying to reset clipping range of non-existant camera");
-    return;
-    }
-  
-  // Find the plane equation for the camera view plane
-  anActiveCamera->GetViewPlaneNormal(vn);
-  anActiveCamera->GetPosition(position);
-//  a = -vn[0];
-//  b = -vn[1];
-//  c = -vn[2];
-//  d = -(a*position[0] + b*position[1] + c*position[2]);
-
-  // Set the max near clipping plane and the min far clipping plane
-//  range[0] = a*bounds[0] + b*bounds[2] + c*bounds[4] + d;
-//  range[1] = 1e-18;
-
-  // Find the closest / farthest bounding box vertex
-//  for ( k = 0; k < 2; k++ )
-//    {
-//    for ( j = 0; j < 2; j++ )
-//       {
-//       for ( i = 0; i < 2; i++ )
-//         {
-//         dist = a*bounds[i] + b*bounds[2+j] + c*bounds[4+k] + d;
-//         range[0] = (dist<range[0])?(dist):(range[0]);
-//         range[1] = (dist>range[1])?(dist):(range[1]);
-//         }
-//       }
-//    }
-  
-  center[0] = (bounds[0] + bounds[1])/2.0;
-  center[1] = (bounds[2] + bounds[3])/2.0;
-  center[2] = (bounds[4] + bounds[5])/2.0;
-  width = sqrt((bounds[1]-bounds[0])*(bounds[1]-bounds[0]) +
-              (bounds[3]-bounds[2])*(bounds[3]-bounds[2]) +
-              (bounds[5]-bounds[4])*(bounds[5]-bounds[4]));
-  distance = sqrt((position[0]-center[0])*(position[0]-center[0]) +
-                 (position[1]-center[1])*(position[1]-center[1]) +
-                 (position[2]-center[2])*(position[2]-center[2]));
-  range[0] = distance - width/2.0;
-  range[1] = distance + width/2.0;
-
-  // Give ourselves a little breathing room
-  range[0] = 0.99*range[0] - (range[1] - range[0])*0.5;
-  range[1] = 1.01*range[1] + (range[1] - range[0])*0.5;
-
-  // Make sure near is not bigger than far
-  range[0] = (range[0] >= range[1])?(0.01*range[1]):(range[0]);
-
-  // Make sure near is at least some fraction of far - this prevents near
-  // from being behind the camera or too close in front. How close is too
-  // close depends on the resolution of the depth buffer
-  int ZBufferDepth = 16;
-  vtkRenderWindow* aRenderWindow = theRenderer->GetRenderWindow();
-  if (aRenderWindow)
-    {
-      ZBufferDepth = aRenderWindow->GetDepthBufferSize();
-    }
-  //
-  if ( ZBufferDepth <= 16 )
-    {
-    range[0] = (range[0] < 0.01*range[1])?(0.01*range[1]):(range[0]);
-    }
-  else if ( ZBufferDepth <= 24 )
-    {
-    range[0] = (range[0] < 0.01*range[1])?(0.01*range[1]):(range[0]);
-    }
-  else
-    {
-    range[0] = (range[0] < 0.01*range[1])?(0.01*range[1]):(range[0]);
-    }
-  anActiveCamera->SetClippingRange( range );
-}
-
-static void ResetCamera(vtkRenderer* theRenderer, vtkActorCollection* theTriedron, VTKViewer_RenderWindowInteractor* theRWInteractor){  
-  //see vtkRenderer::ResetCamera(float bounds[6]) method
-  float      bounds[6];
-  if(!theRenderer) return;
-  theRenderer->ComputeVisiblePropBounds( bounds );
-
-  float center[3];
-  float distance;
-  float width;
-  double vn[3], *vup;
-  int* winsize;
-  
-  if ( theRenderer->GetActiveCamera() != NULL )
-    {
-    theRenderer->GetActiveCamera()->GetViewPlaneNormal(vn);
-    }
-  else
-    {
-    MESSAGE("Trying to reset non-existant camera");
-    return;
-    }
-
-  center[0] = (bounds[0] + bounds[1])/2.0;
-  center[1] = (bounds[2] + bounds[3])/2.0;
-  center[2] = (bounds[4] + bounds[5])/2.0;
-  width = sqrt((bounds[1]-bounds[0])*(bounds[1]-bounds[0]) +
-              (bounds[3]-bounds[2])*(bounds[3]-bounds[2]) +
-              (bounds[5]-bounds[4])*(bounds[5]-bounds[4]));
-  double ang = theRenderer->GetActiveCamera()->GetViewAngle();
-  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 )
-    {
-    MESSAGE("Resetting view-up since view plane normal is parallel");
-    theRenderer->GetActiveCamera()->SetViewUp(-vup[2], vup[0], vup[1]);
-    }
-
-  // update the camera
-  theRenderer->GetActiveCamera()->SetFocalPoint(center[0],center[1],center[2]);
-  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);
-}
-
-void VTKViewer_ViewFrame::onViewFitAll()
-{
-  Standard_Boolean TriedronWasVisible = false;
-  if (isTrihedronDisplayed()) {
-    m_Triedron->InitTraversal();
-    vtkActor *ac = m_Triedron->GetNextActor();
-    while(!(ac==NULL)) {
-      ac->VisibilityOff();
-      ac = m_Triedron->GetNextActor();
-    }
-    TriedronWasVisible = true;
-  }
-  bool hasVisibleActors = m_Renderer->VisibleActorCount() > 0;
-  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();
-    while(!(ac==NULL)) {
-      ac->VisibilityOn();
-      ac = m_Triedron->GetNextActor();
-    }
-    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();
+void VTKViewer_ViewFrame::onViewFitArea(){
+  m_RWInteractor->GetInteractorStyleSALOME()->startFitArea();
 }
 
 /*!
@@ -967,9 +594,9 @@ void VTKViewer_ViewFrame::EraseAll()
 }
 
 
-void VTKViewer_ViewFrame::Repaint()
+void VTKViewer_ViewFrame::Repaint(bool theUpdateTrihedron)
 {
-  // m_RWInteractor->Render();
+  if (theUpdateTrihedron) onAdjustTrihedron();
   m_RW->update();
 }
 
@@ -979,12 +606,7 @@ 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();
+  m_RWInteractor->Render();
   Repaint();
 }
 
@@ -992,18 +614,12 @@ void VTKViewer_ViewFrame::AddActor( SALOME_Actor* theActor, bool update /*=false
   theActor->SetVisibility(true);
   theActor->AddToRender(m_Renderer);
   theActor->SetTransform(m_Transform);
-  if(update){
-    m_Renderer->ResetCameraClippingRange();
-    m_RWInteractor->Render();
-  }
+  if(update) Repaint();
 }
 
 void VTKViewer_ViewFrame::RemoveActor( SALOME_Actor* theActor, bool update /*=false*/ ){
   theActor->RemoveFromRender(m_Renderer);
-  if(update){
-    m_Renderer->ResetCameraClippingRange();
-    m_RWInteractor->Render();
-  }
+  if(update) Repaint();
 }
 
 
index 64467faa64a600607bf222e67111cc996a9463ab..83fc35ab1feb680b404e48efa4dded7804bfc75c 100644 (file)
@@ -37,8 +37,8 @@
 
 // VTK Includes
 class vtkRenderer;
-class vtkActorCollection;
 class vtkTransform;
+class VTKViewer_Trihedron;
 
 class QAD_EXPORT VTKViewer_ViewFrame : public QAD_ViewFrame{
   Q_OBJECT;
@@ -54,8 +54,7 @@ class QAD_EXPORT VTKViewer_ViewFrame : public QAD_ViewFrame{
   VTKViewer_RenderWindowInteractor* getRWInteractor() {return m_RWInteractor;}
 
   bool                           isTrihedronDisplayed();
-  void                           SetTrihedronSize( int dim );
-
   void                           setBackgroundColor( const QColor& );
   QColor                         backgroundColor() const;
   
@@ -89,7 +88,8 @@ class QAD_EXPORT VTKViewer_ViewFrame : public QAD_ViewFrame{
   void           Erase(const Handle(SALOME_InteractiveObject)& IObject, bool immediatly = true);
   void           DisplayAll();
   void           EraseAll();
-  void           Repaint();
+  void           Repaint(bool theUpdateTrihedron);
+  void           Repaint() { Repaint(true); }
 
   //apply existing transformation on adding SALOME_Actor
   void SetScale(double theScale[3]);
@@ -97,10 +97,6 @@ class QAD_EXPORT VTKViewer_ViewFrame : public QAD_ViewFrame{
   void AddActor(SALOME_Actor*, bool update = false);
   void RemoveActor(SALOME_Actor*, bool update = false);
 
- private:
-  void AddVector(float* o,float* p,vtkRenderer* renderer, float aSize);
-  void AddAxis(vtkRenderer* renderer);
  public slots:
   void           onViewPan(); 
   void           onViewZoom();
@@ -116,20 +112,19 @@ class QAD_EXPORT VTKViewer_ViewFrame : public QAD_ViewFrame{
   void           onViewBottom();
   void           onViewTop();
   void           onViewTrihedron(); 
+  void           onAdjustTrihedron();
  
  private:
   double                        m_ViewUp[3];
   double                        m_ViewNormal[3];
-
+  
   void                          InitialSetup();
 
   vtkRenderer*                      m_Renderer;
   VTKViewer_RenderWindow*           m_RW;
   VTKViewer_RenderWindowInteractor* m_RWInteractor;
 
-  Standard_Boolean              m_TriedronVisible;
-  vtkActorCollection*           m_Triedron;  
-
+  VTKViewer_Trihedron *m_Triedron;  
   SALOME_Transform *m_Transform;
 };
 #endif