-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
-THIS IS SALOME - KERNEL VERSION: 1.3.0
+THIS IS SALOME - KERNEL VERSION: 1.4.0
class NamingServer(Server):
XTERM=""
- CMD="runNS.sh > /tmp/salomeNS.log 2>&1"
+ USER=os.getenv('USER')
+ if USER is None:
+ USER='anonymous'
+ LOGDIR="/tmp/logs/" + USER
+ os.system("mkdir -m 777 -p " + LOGDIR)
+ CMD="runNS.sh > " + LOGDIR + "/salomeNS.log 2>&1"
# -----------------------------------------------------------------------------
#!/bin/sh
-python -i runSalome.py --gui --modules=GEOM,SMESH,VISU,SUPERV,MED --xterm --containers=cpp,python --killall
-#python -i runSalome.py --gui --modules=GEOM,SMESH,VISU,SUPERV,MED --logger --xterm
-#python -i runSalome.py --modules=GEOM,SMESH,VISU,SUPERV,MED
-#python -i runSalome.py --help
+python -i ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py --gui --modules=GEOM,SMESH,VISU,SUPERV,MED --xterm --containers=cpp,python --killall
+#python -i ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py --gui --modules=GEOM,SMESH,VISU,SUPERV,MED --logger --xterm
+#python -i ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py --modules=GEOM,SMESH,VISU,SUPERV,MED
+#python -i ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py --help
# -----------------------------------------------------------------------------
#
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")
+ libtraceln = os.path.join(libtracedir,"libSALOMELocalTrace.so")
+ aCommand = 'rm -rf ' + libtracedir + "; "
+ aCommand += 'mkdir ' + libtracedir + "; "
+ aCommand += 'ln -s ' + libtrace + " " + libtraceln + "; "
+ aCommand += 'ln -s ' + libtrace + " " + libtraceln + ".0; "
+ aCommand += 'ln -s ' + libtrace + " " + libtraceln + ".0.0.0; "
+ os.system(aCommand)
+ add_ld_library_path(libtracedir)
+
#print "LD_LIBRARY_PATH=",os.environ["LD_LIBRARY_PATH"]
#
import SALOME
session=clt.waitNS("/Kernel/Session",SALOME.Session)
+
+ theComputer = os.getenv("HOSTNAME")
+ computerSplitName = theComputer.split('.')
+ theComputer = computerSplitName[0]
+
#
# Lancement Container C++ local
#
# Attente de la disponibilité du Container C++ local dans le Naming Service
#
- theComputer = os.getenv("HOSTNAME")
- computerSplitName = theComputer.split('.')
- theComputer = computerSplitName[0]
-
clt.waitNS("/Containers/" + theComputer + "/FactoryServer")
#
#---------------------------------------------------------------------------
# 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
-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", ""))
rm -rf INPUT
install:
+ $(INSTALL) -d $(docdir); \
cp -rf html $(docdir)
uninstall:
TypeData.idl \
MPIObject.idl \
MPIContainer.idl \
- Logger.idl
+ Logger.idl \
+ SALOME_GenericObj.idl
PY_CLIENT_IDL = $(IDL_FILES)
// 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
//
//
//
// Author : Yves FRICAUD
// $Header$
-/*! \mainpage
- \image html Application-About.png
+/*! \mainpage
+ \image html Application-About.png
*/
/*!
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;
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 {};
interface Study
{
+
exception StudyInvalidContext {};
exception StudyInvalidComponent {};
/*! Invalid directory of the %study exception
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);
/*!
/*!
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>
*/
\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>
*/
/*! \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>
*/
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);
};
//==========================================================================
<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);
*/
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 a %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.
<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>
*/
/*! \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>
*/
/*! \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
/*! \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>
*/
/*! \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);
*/
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>
*/
/*! \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>
/*! \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
/*! \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);
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);
};
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.
/*! 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();
};
/*! \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);
};
//==========================================================================
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
//==========================================================================
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>
*/
//==========================================================================
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();
/*!
*/
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();
/*!
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);
/*!
//==========================================================================
/*! \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>
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.
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,
/*!
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,
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
\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);
/*!
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);
/*!
/*! 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;
};
//==========================================================================
{
/*!
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);
{
/*!
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);
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>
/*!
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>
*/
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);
/*!
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>
*/
{
/*!
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);
{
/*!
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);
{
/*!
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);
{
/*!
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);
+ };
+
+ //==========================================================================
+/*! \brief External File definition
+
+ This attribute stores a path to an External File.
+*/
+ //==========================================================================
+ interface AttributeExternalFileDef: GenericAttribute
+ {
+/*!
+ 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);
+ };
+
+ //==========================================================================
+/*! \brief File Type definition
+
+ This attribute stores an external File Type (see ExternalFileDef attribute).
+*/
+ //==========================================================================
+ interface AttributeFileType: GenericAttribute
+ {
+/*!
+ 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();
//==========================================================================
/*! \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>
*/
{
/*!
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>
*/
{
/*!
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>
*/
{
/*!
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>
*/
{
/*!
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>
*/
{
/*!
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>
*/
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>
*/
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>
*/
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);
/*!
{
/*!
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);
{
/*!
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);
*/
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();
/*!
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>
*/
// 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);
/*!
{
/*!
Initializes the %container with a definite name.
+ \param ContainerName Name of the container
+ \return an initialized container
*/
Container start_impl( in string ContainerName ) ;
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);
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 ) ;
/*!
*/
exception SALOME_Exception
{
- ExceptionStruct details;
+ ExceptionStruct details; /*!<Structure of the exception.*/
};
};
/*!
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 */
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
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.
*/
{
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.*/
} ;
/*!
*/
typedef sequence<DefinitionInterface> ListOfDefInterface ;
/*!
-List of interfaces.
+List of names of interfaces.
*/
typedef sequence<string> ListOfInterfaces ;
/*!
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() ;
// 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
*/
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;
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
Launches GUI in the session
*/
void GetInterface();
- //***// VISU::VISU_Gen GetVisuGen();
+
+/*!
+ Returns the Visu component
+*/
Engines::Component GetVisuComponent();
/*!
PYUIC="/usr/bin/pyuic"
fi
-AC_CHECK_FILES("$PYQTDIR/qt.py","$PYQTDIR/qt/qt.py",pyqt_ok=yes,pyqt_ok=no)
+PYQT_ROOT=$PYQTDIR
+PYQT_INCLUDES="-I$PYQT_SIPS"
+PYQT_LIBS="-L$PYQTDIR -lqtcmodule"
+
+AC_CHECK_FILES($PYQTDIR/qt.py $PYQTDIR/qt/qt.py $PYQTDIR/lib/qt.py,pyqt_ok=yes,pyqt_ok=no)
if test "x$pyqt_ok" = xno ; then
- AC_MSG_RESULT(no)
- AC_MSG_WARN(pyqt not found)
+ AC_MSG_WARN(qt.py not found)
else
AC_CHECK_FILE("$PYQTDIR/libqtcmodule.so",pyqt_ok=yes,pyqt_ok=no)
- if test "x$pyqt_ok" = xno ; then
- AC_MSG_RESULT(no)
- AC_MSG_WARN(pyqt not found)
- else
+ if test "x$pyqt_ok" = xyes ; then
PYQT_ROOT=$PYQTDIR
PYQT_LIBS="-L$PYQTDIR -lqtcmodule"
fi
- AC_CHECK_FILE("$PYQT_SIPS/copying.sip",pyqt_ok=yes,pyqt_ok=no)
if test "x$pyqt_ok" = xno ; then
- AC_MSG_RESULT(no)
- AC_MSG_WARN(pyqt not found)
- else
- PYQT_INCLUDES="-I$PYQT_SIPS"
+ AC_CHECK_FILE("$PYQTDIR/lib/libqtcmodule.so",pyqt_ok=yes,pyqt_ok=no)
+ if test "x$pyqt_ok" = xyes ; then
+ PYQT_ROOT=$PYQTDIR
+ PYQT_LIBS="-L$PYQTDIR/lib -lqtcmodule"
+ fi
fi
- AC_SUBST(PYQT_ROOT)
- AC_SUBST(PYQT_INCLUDES)
- AC_SUBST(PYQT_LIBS)
-
- AC_MSG_RESULT(yes)
+ AC_CHECK_FILE("$PYQT_SIPS/copying.sip",pyqt_ok=$pyqt_ok,pyqt_ok=no)
+ if test "x$pyqt_ok" = xyes ; then
+ PYQT_INCLUDES="-I$PYQT_SIPS"
+ fi
fi
-PYQT_ROOT=$PYQTDIR
-PYQT_INCLUDES="-I$PYQT_SIPS"
-PYQT_LIBS="-L$PYQTDIR -lqtcmodule"
-
AC_SUBST(PYQT_ROOT)
AC_SUBST(PYQT_INCLUDES)
AC_SUBST(PYUIC)
AC_SUBST(PYQT_SIPS)
AC_SUBST(PYQT_LIBS)
-
-
AC_MSG_RESULT(for pyqt: $pyqt_ok)
fi
if test "x$sip_vers" = "xnew"
then
- if test -z ${SIPDIR}/include ; then
+ if test -d ${SIPDIR}/include ; then
sip_ok=yes
SIP_ROOT="$SIPDIR"
SIP_INCLUDES="${PYTHON_INCLUDES} -I${SIPDIR}/include"
SIP_LIBS="-L${SIPDIR}/lib -lsip"
else
+ sip_ok=yes
SIP_ROOT="$SIPDIR"
SIP_INCLUDES="-I${SIPDIR}"
SIP_LIBS="-L${SIPDIR} -lsip"
CPPFLAGS+= $(PYTHON_INCLUDES)
-LDFLAGS+= -lSalomeNS -lRegistry -lOpUtil -lSalomeNotification -lSalomeLoggerServer
+LDFLAGS+= -lSalomeNS -lRegistry -lOpUtil -lSalomeNotification -lSALOMELocalTrace
LIBS += -Xlinker -export-dynamic $(PYTHON_LIBS)
// Module : SALOME
// $Header$
-using namespace std;
-using namespace std;
#include <stdio.h>
-# include "Utils_ORB_INIT.hxx"
-# include "Utils_SINGLETON.hxx"
+#include "Utils_ORB_INIT.hxx"
+#include "Utils_SINGLETON.hxx"
#include "SALOME_NamingService.hxx"
#include "SALOME_Container_i.hxx"
#include <iostream>
#include <string>
#include "utilities.h"
+using namespace std;
-//#define CHECKTIME
#ifdef CHECKTIME
#include <Utils_Timer.hxx>
#endif
#include <Python.h>
-static PyMethodDef MethodPyVoidMethod[] = {
- { NULL, NULL }
-};
+static PyMethodDef MethodPyVoidMethod[] =
+ {
+ { NULL, NULL }
+ };
int main(int argc, char* argv[])
{
INFOS_COMPILATION;
BEGIN_OF(argv[0])
- Py_Initialize() ;
+ Py_Initialize() ;
PySys_SetArgv( argc , argv ) ;
Py_InitModule( "InitPyRunMethod" , MethodPyVoidMethod ) ;
- try {
+ try
+ {
- // Initialise the ORB.
-// CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
- ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
- ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting()) ;
- CORBA::ORB_var &orb = init( argc , argv ) ;
+ // Initialise the ORB.
+ ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
+ ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting()) ;
+ CORBA::ORB_var &orb = init( argc , argv ) ;
- // Obtain a reference to the root POA.
- // obtain the root poa manager
- //
- long TIMESleep = 250000000;
- int NumberOfTries = 40;
- int a;
- timespec ts_req;
- ts_req.tv_nsec=TIMESleep;
- ts_req.tv_sec=0;
- timespec ts_rem;
- ts_rem.tv_nsec=0;
- ts_rem.tv_sec=0;
- CosNaming::NamingContext_var inc;
- PortableServer::POA_var root_poa;
- CORBA::Object_var theObj;
- CORBA::Object_var obj;
- CORBA::Object_var object;
- SALOME_Logger::Logger_var log;
- SALOME_NamingService &naming = *SINGLETON_<SALOME_NamingService>::Instance() ;
- int CONTAINER=0;
- const char * Env = getenv("USE_LOGGER");
- int EnvL =0;
- if ((Env!=NULL) && (strlen(Env)))
- EnvL=1;
-
- CosNaming::Name name;
- name.length(1);
- name[0].id=CORBA::string_dup("Logger");
- PortableServer::POAManager_var pman;
- for (int i = 1; i<=NumberOfTries; i++){
- if (i!=1)
- a=nanosleep(&ts_req,&ts_rem);
- try{
- obj = orb->resolve_initial_references("RootPOA");
- if(!CORBA::is_nil(obj))
- root_poa = PortableServer::POA::_narrow(obj);
- if(!CORBA::is_nil(root_poa))
- pman = root_poa->the_POAManager();
- if(!CORBA::is_nil(orb))
- theObj = orb->resolve_initial_references("NameService");
- if (!CORBA::is_nil(theObj))
- inc = CosNaming::NamingContext::_narrow(theObj);
- }
- catch( CORBA::COMM_FAILURE& )
+ // Obtain a reference to the root POA.
+ // obtain the root poa manager
+ //
+ long TIMESleep = 250000000;
+ int NumberOfTries = 40;
+ int a;
+ timespec ts_req;
+ ts_req.tv_nsec=TIMESleep;
+ ts_req.tv_sec=0;
+ timespec ts_rem;
+ ts_rem.tv_nsec=0;
+ ts_rem.tv_sec=0;
+ CosNaming::NamingContext_var inc;
+ PortableServer::POA_var root_poa;
+ CORBA::Object_var theObj;
+ CORBA::Object_var obj;
+ CORBA::Object_var object;
+ SALOME_NamingService &naming = *SINGLETON_<SALOME_NamingService>::Instance() ;
+ int CONTAINER=0;
+ const char * Env = getenv("USE_LOGGER");
+ int EnvL =0;
+ if ((Env!=NULL) && (strlen(Env)))
+ EnvL=1;
+
+ CosNaming::Name name;
+ name.length(1);
+ name[0].id=CORBA::string_dup("Logger");
+ PortableServer::POAManager_var pman;
+ for (int i = 1; i<=NumberOfTries; i++)
{
- MESSAGE( "Container: CORBA::COMM_FAILURE: Unable to contact the Naming Service" )
+ if (i!=1)
+ a=nanosleep(&ts_req,&ts_rem);
+ try
+ {
+ obj = orb->resolve_initial_references("RootPOA");
+ if(!CORBA::is_nil(obj))
+ root_poa = PortableServer::POA::_narrow(obj);
+ if(!CORBA::is_nil(root_poa))
+ pman = root_poa->the_POAManager();
+ if(!CORBA::is_nil(orb))
+ theObj = orb->resolve_initial_references("NameService");
+ if (!CORBA::is_nil(theObj))
+ inc = CosNaming::NamingContext::_narrow(theObj);
+ }
+ catch( CORBA::COMM_FAILURE& )
+ {
+ MESSAGE( "Container: CORBA::COMM_FAILURE: Unable to contact the Naming Service" );
}
- if(!CORBA::is_nil(inc)) {
- MESSAGE( "Container: Naming Service was found" )
- if(EnvL==1){
- for(int j=1; j<=NumberOfTries; j++){
- if (j!=1)
- a=nanosleep(&ts_req, &ts_rem);
- try{
- object = inc->resolve(name);
- }
- catch(CosNaming::NamingContext::NotFound){ MESSAGE( "Container: Logger Server wasn't found" ) }
- catch(...){ MESSAGE( "Container: Unknown exception" ) }
- if (!CORBA::is_nil(object))
- log = SALOME_Logger::Logger::_narrow(object);
- if (!CORBA::is_nil(log)){
- MESSAGE( "Container: Logger Server was found" )
- log->ping();
- CONTAINER=1;
- break;
- }
- }}
- }
- if ((CONTAINER==1)||((EnvL==0)&&(!CORBA::is_nil(inc))))
+ if(!CORBA::is_nil(inc))
+ {
+ MESSAGE( "Container: Naming Service was found" );
+ if(EnvL==1)
+ {
+ for(int j=1; j<=NumberOfTries; j++)
+ {
+ if (j!=1)
+ a=nanosleep(&ts_req, &ts_rem);
+ try
+ {
+ object = inc->resolve(name);
+ }
+ catch(CosNaming::NamingContext::NotFound)
+ {
+ MESSAGE( "Container: Logger Server wasn't found" );
+ }
+ catch(...)
+ {
+ MESSAGE( "Container: Unknown exception" );
+ }
+ if (!CORBA::is_nil(object))
+ {
+ MESSAGE( "Container: Logger Server was found" );
+ CONTAINER=1;
+ break;
+ }
+ }
+ }
+ }
+ if ((CONTAINER==1)||((EnvL==0)&&(!CORBA::is_nil(inc))))
break;
- }
+ }
- //
- // define policy objects
- PortableServer::ImplicitActivationPolicy_var implicitActivation =
- root_poa->create_implicit_activation_policy(PortableServer::NO_IMPLICIT_ACTIVATION) ;
+ // define policy objects
+ PortableServer::ImplicitActivationPolicy_var implicitActivation =
+ root_poa->create_implicit_activation_policy(PortableServer::NO_IMPLICIT_ACTIVATION) ;
- // default = NO_IMPLICIT_ACTIVATION
- PortableServer::ThreadPolicy_var threadPolicy =
- root_poa->create_thread_policy(PortableServer::ORB_CTRL_MODEL) ;
- // default = ORB_CTRL_MODEL, other choice SINGLE_THREAD_MODEL
+ // default = NO_IMPLICIT_ACTIVATION
+ PortableServer::ThreadPolicy_var threadPolicy =
+ root_poa->create_thread_policy(PortableServer::ORB_CTRL_MODEL) ;
+ // default = ORB_CTRL_MODEL, other choice SINGLE_THREAD_MODEL
- // create policy list
- CORBA::PolicyList policyList;
- policyList.length(2);
- policyList[0] = PortableServer::ImplicitActivationPolicy::_duplicate(implicitActivation) ;
- policyList[1] = PortableServer::ThreadPolicy::_duplicate(threadPolicy) ;
-
- // create the child POA
- PortableServer::POAManager_var nil_mgr = PortableServer::POAManager::_nil() ;
- PortableServer::POA_var factory_poa =
- root_poa->create_POA("factory_poa", pman, policyList) ;
+ // create policy list
+ CORBA::PolicyList policyList;
+ policyList.length(2);
+ policyList[0] = PortableServer::ImplicitActivationPolicy::_duplicate(implicitActivation) ;
+ policyList[1] = PortableServer::ThreadPolicy::_duplicate(threadPolicy) ;
+
+ // create the child POA
+ PortableServer::POAManager_var nil_mgr = PortableServer::POAManager::_nil() ;
+ PortableServer::POA_var factory_poa =
+ root_poa->create_POA("factory_poa", pman, policyList) ;
//with nil_mgr instead of pman, a new POA manager is created with the new POA
- // destroy policy objects
- implicitActivation->destroy() ;
- threadPolicy->destroy() ;
+ // destroy policy objects
+ implicitActivation->destroy() ;
+ threadPolicy->destroy() ;
- char *containerName = "";
- if (argc >1)
- {
- containerName = argv[1] ;
- }
+ char *containerName = "";
+ if (argc >1)
+ {
+ containerName = argv[1] ;
+ }
- Engines_Container_i * myContainer
- = new Engines_Container_i(orb, factory_poa, containerName , argc , argv );
+ Engines_Container_i * myContainer
+ = new Engines_Container_i(orb, factory_poa, containerName , argc , argv );
-// Engines_Container_i * myContainer
-// = new Engines_Container_i(string(argv[1]),string(argv[2]), orb, factory_poa);
+ // Engines_Container_i * myContainer
+ // = new Engines_Container_i(string(argv[1]),string(argv[2]), orb, factory_poa);
- // use naming service
-// myContainer->_NS.init_orb(orb);
-// Engines::Container_ptr pCont = Engines::Container::_narrow(myContainer->_this());
-// myContainer->_NS.Register(pCont, argv[2]);
+ // use naming service
+ // myContainer->_NS.init_orb(orb);
+ // Engines::Container_ptr pCont = Engines::Container::_narrow(myContainer->_this());
+ // myContainer->_NS.Register(pCont, argv[2]);
- pman->activate();
+ pman->activate();
#ifdef CHECKTIME
- Utils_Timer timer;
- timer.Start();
- timer.Stop();
- MESSAGE("SALOME_Registry_Server.cxx - orb->run()");
- timer.ShowAbsolute();
+ Utils_Timer timer;
+ timer.Start();
+ timer.Stop();
+ MESSAGE("SALOME_Registry_Server.cxx - orb->run()");
+ timer.ShowAbsolute();
#endif
- orb->run();
+ orb->run();
- orb->destroy();
- }
+ orb->destroy();
+ }
catch(CORBA::SystemException&)
- {
- INFOS("Caught CORBA::SystemException.")
- }
+ {
+ INFOS("Caught CORBA::SystemException.")
+ }
catch(PortableServer::POA::WrongPolicy&)
- {
- INFOS("Caught CORBA::WrongPolicyException.")
- }
+ {
+ INFOS("Caught CORBA::WrongPolicyException.")
+ }
catch(PortableServer::POA::ServantAlreadyActive&)
- {
- INFOS("Caught CORBA::ServantAlreadyActiveException")
- }
+ {
+ INFOS("Caught CORBA::ServantAlreadyActiveException")
+ }
catch(CORBA::Exception&)
- {
- INFOS("Caught CORBA::Exception.")
- }
+ {
+ INFOS("Caught CORBA::Exception.")
+ }
catch(...)
- {
- INFOS("Caught unknown exception.")
- }
+ {
+ INFOS("Caught unknown exception.")
+ }
END_OF(argv[0]);
}
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
CPPFLAGS+= $(QT_MT_INCLUDES)
CXXFLAGS+=
-LDFLAGS+= $(QT_MT_LIBS) $(OGL_LIBS) -lSalomeNS -lOpUtil -lSalomeLoggerServer
+LDFLAGS+= $(QT_MT_LIBS) $(OGL_LIBS) -lSalomeNS -lOpUtil -lSALOMELocalTrace
@CONCLUDE@
// Module : SALOME
// $Header$
-using namespace std;
#include <iostream.h>
#include "SALOME_NamingService.hxx"
#include "SALOME_DataTypeCatalog_impl.hxx"
#include "utilities.h"
-# include "Utils_SINGLETON.hxx"
+#include "Utils_SINGLETON.hxx"
+using namespace std;
+
int main(int argc,char **argv)
{
- try {
- CosNaming::NamingContext_var _rootContext, catalogContext;
- // initialize the ORB
- CORBA::ORB_ptr orb = CORBA::ORB_init (argc, argv);
- // initialize POA
- //
- long TIMESleep = 250000000;
- int NumberOfTries = 40;
- int a;
- timespec ts_req;
- ts_req.tv_nsec=TIMESleep;
- ts_req.tv_sec=0;
- timespec ts_rem;
- ts_rem.tv_nsec=0;
- ts_rem.tv_sec=0;
- CosNaming::NamingContext_var inc;
- PortableServer::POA_var poa;
- CORBA::Object_var theObj;
- CORBA::Object_var obj;
- CORBA::Object_var object;
- SALOME_Logger::Logger_var log;
- int DATA_TYPE_CATALOG=0;
- const char * Env = getenv("USE_LOGGER");
- int EnvL =0;
- if ((Env!=NULL) && (strlen(Env)))
- EnvL=1;
- CosNaming::Name name;
- name.length(1);
- name[0].id=CORBA::string_dup("Logger");
- PortableServer::POAManager_var mgr;
+ try
+ {
+ CosNaming::NamingContext_var _rootContext, catalogContext;
+ // initialize the ORB
+ CORBA::ORB_ptr orb = CORBA::ORB_init (argc, argv);
+ // initialize POA
+ //
+ long TIMESleep = 250000000;
+ int NumberOfTries = 40;
+ int a;
+ timespec ts_req;
+ ts_req.tv_nsec=TIMESleep;
+ ts_req.tv_sec=0;
+ timespec ts_rem;
+ ts_rem.tv_nsec=0;
+ ts_rem.tv_sec=0;
+ CosNaming::NamingContext_var inc;
+ PortableServer::POA_var poa;
+ CORBA::Object_var theObj;
+ CORBA::Object_var obj;
+ CORBA::Object_var object;
+ int DATA_TYPE_CATALOG=0;
+ const char * Env = getenv("USE_LOGGER");
+ int EnvL =0;
+ if ((Env!=NULL) && (strlen(Env)))
+ EnvL=1;
+ CosNaming::Name name;
+ name.length(1);
+ name[0].id=CORBA::string_dup("Logger");
+ PortableServer::POAManager_var mgr;
- for (int i = 1; i<=NumberOfTries; i++){
- if (i!=1)
- a=nanosleep(&ts_req,&ts_rem);
- try{
- obj = orb->resolve_initial_references("RootPOA");
- if(!CORBA::is_nil(obj))
- poa = PortableServer::POA::_narrow(obj);
- if(!CORBA::is_nil(poa))
- mgr = poa->the_POAManager();
- if(!CORBA::is_nil(orb))
- theObj = orb->resolve_initial_references("NameService");
- if (!CORBA::is_nil(theObj))
- inc = CosNaming::NamingContext::_narrow(theObj);}
- catch( CORBA::COMM_FAILURE& )
- {
- MESSAGE( "Data Type Catalog: CORBA::COMM_FAILURE: Unable to contact the Naming Service" )
- }
- if(!CORBA::is_nil(inc)) {
- MESSAGE( "Data Type Catalog: Naming Service was found" )
- if(EnvL==1){
- CORBA::ORB_var orb1 = CORBA::ORB_init(argc,argv) ;
- SALOME_NamingService &NS = *SINGLETON_<SALOME_NamingService>::Instance() ;
- NS.init_orb( orb1 ) ;
- for(int j=1; j<=NumberOfTries; j++){
- if (j!=1)
- a=nanosleep(&ts_req, &ts_rem);
- try{
- object = inc->resolve(name);}
- catch(CosNaming::NamingContext::NotFound){ MESSAGE( "Data Type Catalog: Logger Server wasn't found" ) }
- catch(...){ MESSAGE( "Data Type Catalog: Unknown exception" ) }
- if (!CORBA::is_nil(object))
- log = SALOME_Logger::Logger::_narrow(object);
- if (!CORBA::is_nil(log)){
- MESSAGE( "Data Type Catalog: Logger Server was found" )
- log->ping();
- DATA_TYPE_CATALOG=1;
- break;
+ for (int i = 1; i<=NumberOfTries; i++)
+ {
+ if (i!=1)
+ a=nanosleep(&ts_req,&ts_rem);
+ try
+ {
+ obj = orb->resolve_initial_references("RootPOA");
+ if(!CORBA::is_nil(obj))
+ poa = PortableServer::POA::_narrow(obj);
+ if(!CORBA::is_nil(poa))
+ mgr = poa->the_POAManager();
+ if(!CORBA::is_nil(orb))
+ theObj = orb->resolve_initial_references("NameService");
+ if (!CORBA::is_nil(theObj))
+ inc = CosNaming::NamingContext::_narrow(theObj);}
+ catch( CORBA::COMM_FAILURE& )
+ {
+ MESSAGE( "Data Type Catalog: CORBA::COMM_FAILURE: Unable to contact the Naming Service" );
}
+ if(!CORBA::is_nil(inc))
+ {
+ MESSAGE( "Data Type Catalog: Naming Service was found" );
+ if(EnvL==1)
+ {
+ CORBA::ORB_var orb1 = CORBA::ORB_init(argc,argv) ;
+ SALOME_NamingService &NS = *SINGLETON_<SALOME_NamingService>::Instance() ;
+ NS.init_orb( orb1 ) ;
+ for(int j=1; j<=NumberOfTries; j++)
+ {
+ if (j!=1)
+ a=nanosleep(&ts_req, &ts_rem);
+ try
+ {
+ object = inc->resolve(name);
+ }
+ catch(CosNaming::NamingContext::NotFound)
+ {
+ MESSAGE( "Data Type Catalog: Logger Server wasn't found" );
+ }
+ catch(...)
+ {
+ MESSAGE( "Data Type Catalog: Unknown exception" );
+ }
+ if (!CORBA::is_nil(object))
+ {
+ MESSAGE( "Data Type Catalog: Logger Server was found" );
+ DATA_TYPE_CATALOG=1;
+ break;
+ }
- }}
- }
- if ((DATA_TYPE_CATALOG==1)||((EnvL==0)&&(!CORBA::is_nil(inc))))
- break;
+ }
+ }
}
+ if ((DATA_TYPE_CATALOG==1)||((EnvL==0)&&(!CORBA::is_nil(inc))))
+ break;
+ }
- //
- // Active catalog
+ // Active catalog
- SALOME_DataTypeCatalogImpl* Catalogue_i = new SALOME_DataTypeCatalogImpl(argc, argv);
- poa->activate_object (Catalogue_i);
+ SALOME_DataTypeCatalogImpl* Catalogue_i = new SALOME_DataTypeCatalogImpl(argc, argv);
+ poa->activate_object (Catalogue_i);
- mgr->activate();
+ mgr->activate();
- CORBA::Object_ptr myCata = Catalogue_i->_this();
+ CORBA::Object_ptr myCata = Catalogue_i->_this();
- // initialise Naming Service
- SALOME_NamingService *_NS;
- _NS = new SALOME_NamingService(orb);
- // register Catalog in Naming Service
- _NS->Register(myCata ,"/Kernel/DataTypeCatalog");
+ // initialise Naming Service
+ SALOME_NamingService *_NS;
+ _NS = new SALOME_NamingService(orb);
+ // register Catalog in Naming Service
+ _NS->Register(myCata ,"/Kernel/DataTypeCatalog");
- MESSAGE("Running DataType Catalog Server.")
+ MESSAGE("Running DataType Catalog Server.")
- orb->run();
+ orb->run();
- poa->destroy(1,1);
+ poa->destroy(1,1);
- }
- catch(CORBA::SystemException&) {
+ }
+ catch(CORBA::SystemException&) {
INFOS("Caught CORBA::SystemException.")
- }
- catch(CORBA::Exception&) {
+ }
+ catch(CORBA::Exception&) {
INFOS("Caught CORBA::Exception.")
- }
+ }
return 0;
}
BIN_CLIENT_IDL = SALOME_Component.idl SALOME_TestComponent.idl \
SALOME_ModuleCatalog.idl
-LDFLAGS += -lSalomeNS -lOpUtil -lSalomeLoggerServer
+LDFLAGS += -lSalomeNS -lOpUtil -lSALOMELocalTrace
@CONCLUDE@
CPPFLAGS+=$(QT_MT_INCLUDES)
CXXFLAGS+=$(OCC_CXXFLAGS)
-LDFLAGS+=$(QT_MT_LIBS) -lSalomeNS -lOpUtil -lSalomeLoggerServer
+LDFLAGS+=$(QT_MT_LIBS) -lSalomeNS -lOpUtil -lSALOMELocalTrace
@CONCLUDE@
#include <SALOMEconfig.h>
#include CORBA_CLIENT_HEADER(SALOME_Session)
+#include CORBA_CLIENT_HEADER(Logger)
#include "Utils_ORB_INIT.hxx"
#include "Utils_SINGLETON.hxx"
void Logger::ping()
{
- cout<<" Logger::ping() pid "<< getpid()<<endl;
+ //cout<<" Logger::ping() pid "<< getpid()<<endl;
}
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);
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()
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
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()
import CosNaming
from omniORB import CORBA
import SALOME_Logger
+import time
+import os
+
+trace="local"
+if (os.environ.has_key("SALOME_trace")):
+ 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)):
@COMMENCE@
-SUBDIRS = MSG2QM Logger Utils PatchQt NamingService Registry ModuleCatalog DataTypeCatalog \
- RessourcesCatalog Notification NOTIFICATION_SWIG Container TestContainer LifeCycleCORBA \
- HDFPersist VTKFilter OBJECT TOOLSDS SALOMEDS SALOMEGUI Plot2d VTKViewer OCCViewer SUPERVGraph \
- Session SALOME_SWIG TOOLSGUI SALOME_PY RegistryDisplay ModuleGenerator SALOME_PYQT Loader
+SUBDIRS = MSG2QM SALOMELocalTrace Logger SALOMELogger Utils PatchQt \
+ GenericObj NamingService Registry \
+ ModuleCatalog DataTypeCatalog RessourcesCatalog \
+ Notification NOTIFICATION_SWIG \
+ Container TestContainer LifeCycleCORBA HDFPersist \
+ VTKFilter OBJECT \
+ TOOLSDS SALOMEDS \
+ SALOMEGUI Plot2d VTKViewer OCCViewer \
+ SUPERVGraph \
+ Session SALOME_SWIG TOOLSGUI SALOME_PY \
+ RegistryDisplay ModuleGenerator SALOME_PYQT Loader
ifeq (@WITHMPICH@,yes)
SUBDIRS+= MPIContainer
CPPFLAGS+= $(QT_MT_INCLUDES)
CXXFLAGS+= -ftemplate-depth-42
-LDFLAGS+= $(QT_MT_LIBS) -lSalomeNS -lOpUtil -lSalomeLoggerServer
+LDFLAGS+= $(QT_MT_LIBS) -lSalomeNS -lOpUtil -lSALOMELocalTrace
@CONCLUDE@
// File : SALOME_ModuleCatalog_Server.cxx
// Module : SALOME
-using namespace std;
/* $Header$ */
+
#include <iostream.h>
#include "SALOME_NamingService.hxx"
#include "SALOME_ModuleCatalog_impl.hxx"
#include "utilities.h"
-# include "Utils_SINGLETON.hxx"
+#include "Utils_SINGLETON.hxx"
-//#define CHECKTIME
-#ifdef CHECKTIME
-#include <Utils_Timer.hxx>
-#endif
-
-//#define CHECKTIME
#ifdef CHECKTIME
#include <Utils_Timer.hxx>
#endif
+using namespace std;
int main(int argc,char **argv)
{
- try {
- CosNaming::NamingContext_var _rootContext, catalogContext;
+ try
+ {
+ CosNaming::NamingContext_var _rootContext, catalogContext;
- // initialize the ORB
+ // initialize the ORB
- CORBA::ORB_ptr orb = CORBA::ORB_init (argc, argv);
+ CORBA::ORB_ptr orb = CORBA::ORB_init (argc, argv);
- // initialize POA
- //
- long TIMESleep = 250000000;
- int NumberOfTries = 40;
- int a;
- timespec ts_req;
- ts_req.tv_nsec=TIMESleep;
- ts_req.tv_sec=0;
- timespec ts_rem;
- ts_rem.tv_nsec=0;
- ts_rem.tv_sec=0;
- CosNaming::NamingContext_var inc;
- PortableServer::POA_var poa;
- CORBA::Object_var theObj;
- CORBA::Object_var obj;
- CORBA::Object_var object;
- SALOME_Logger::Logger_var log;
- int MODULE_CATALOG=0;
- const char * Env = getenv("USE_LOGGER");
- int EnvL =0;
- if ((Env!=NULL) && (strlen(Env)))
- EnvL=1;
- CosNaming::Name name;
- name.length(1);
- name[0].id=CORBA::string_dup("Logger");
- PortableServer::POAManager_var mgr;
- for (int i = 1; i<=NumberOfTries; i++){
- if (i!=1)
- a=nanosleep(&ts_req,&ts_rem);
- try{
- obj = orb->resolve_initial_references("RootPOA");
- if(!CORBA::is_nil(obj))
- poa = PortableServer::POA::_narrow(obj);
- if(!CORBA::is_nil(poa))
- mgr = poa->the_POAManager();
- if(!CORBA::is_nil(orb))
- theObj = orb->resolve_initial_references("NameService");
- }
- catch( CORBA::COMM_FAILURE& )
- {
- MESSAGE( "Module Catalog Server: CORBA::COMM_FAILURE: Unable to contact the Naming Service" )
- }
- if (!CORBA::is_nil(theObj)){
- inc = CosNaming::NamingContext::_narrow(theObj);
- if(!CORBA::is_nil(inc)) {
- MESSAGE( "Module Catalog Server: Naming Service was found" )
- if(EnvL==1){
- CORBA::ORB_var orb1 = CORBA::ORB_init(argc,argv) ;
- SALOME_NamingService &NS = *SINGLETON_<SALOME_NamingService>::Instance() ;
- NS.init_orb( orb1 ) ;
- for(int j=1; j<=NumberOfTries; j++){
- if (j!=1)
- a=nanosleep(&ts_req, &ts_rem);
- try{
- object = inc->resolve(name);}
- catch(CosNaming::NamingContext::NotFound){ MESSAGE( "Logger Server wasn't found" ) }
- catch(...){ MESSAGE( "Module Catalog Server: Unknown exception" ) }
- if (!CORBA::is_nil(object))
- log = SALOME_Logger::Logger::_narrow(object);
- if (!CORBA::is_nil(log)){
- MESSAGE( "Module Catalog Server: Logger Server was found" )
- log->ping();
- MODULE_CATALOG=1;
- break;
- }
- }}
- }}
- if ((MODULE_CATALOG==1)||((EnvL==0)&&(!CORBA::is_nil(inc))))
- break;
- }
+ // initialize POA
+ //
+ long TIMESleep = 250000000;
+ int NumberOfTries = 40;
+ int a;
+ timespec ts_req;
+ ts_req.tv_nsec=TIMESleep;
+ ts_req.tv_sec=0;
+ timespec ts_rem;
+ ts_rem.tv_nsec=0;
+ ts_rem.tv_sec=0;
+ CosNaming::NamingContext_var inc;
+ PortableServer::POA_var poa;
+ CORBA::Object_var theObj;
+ CORBA::Object_var obj;
+ CORBA::Object_var object;
+ int MODULE_CATALOG=0;
+ const char * Env = getenv("USE_LOGGER");
+ int EnvL =0;
+ if ((Env!=NULL) && (strlen(Env)))
+ EnvL=1;
+ CosNaming::Name name;
+ name.length(1);
+ name[0].id=CORBA::string_dup("Logger");
+ PortableServer::POAManager_var mgr;
+ for (int i = 1; i<=NumberOfTries; i++)
+ {
+ if (i!=1)
+ a=nanosleep(&ts_req,&ts_rem);
+ try
+ {
+ obj = orb->resolve_initial_references("RootPOA");
+ if(!CORBA::is_nil(obj))
+ poa = PortableServer::POA::_narrow(obj);
+ if(!CORBA::is_nil(poa))
+ mgr = poa->the_POAManager();
+ if(!CORBA::is_nil(orb))
+ theObj = orb->resolve_initial_references("NameService");
+ }
+ catch( CORBA::COMM_FAILURE& )
+ {
+ MESSAGE( "Module Catalog Server: CORBA::COMM_FAILURE: Unable to contact the Naming Service" );
+ }
+ if (!CORBA::is_nil(theObj))
+ {
+ inc = CosNaming::NamingContext::_narrow(theObj);
+ if(!CORBA::is_nil(inc))
+ {
+ MESSAGE( "Module Catalog Server: Naming Service was found" );
+ if(EnvL==1)
+ {
+ CORBA::ORB_var orb1 = CORBA::ORB_init(argc,argv) ;
+ SALOME_NamingService &NS = *SINGLETON_<SALOME_NamingService>::Instance() ;
+ NS.init_orb( orb1 ) ;
+ for(int j=1; j<=NumberOfTries; j++)
+ {
+ if (j!=1)
+ a=nanosleep(&ts_req, &ts_rem);
+ try{
+ object = inc->resolve(name);}
+ catch(CosNaming::NamingContext::NotFound)
+ {
+ MESSAGE( "Logger Server wasn't found" );
+ }
+ catch(...)
+ {
+ MESSAGE( "Module Catalog Server: Unknown exception" ) ;
+ }
+ if (!CORBA::is_nil(object))
+ {
+ MESSAGE( "Module Catalog Server: Logger Server was found" );
+ MODULE_CATALOG=1;
+ break;
+ }
+ }
+ }
+ }
+ }
+ if ((MODULE_CATALOG==1)||((EnvL==0)&&(!CORBA::is_nil(inc))))
+ break;
+ }
- //
- // Active catalog
+ // Active catalog
- SALOME_ModuleCatalogImpl* Catalogue_i = new SALOME_ModuleCatalogImpl(argc, argv);
- poa->activate_object (Catalogue_i);
+ SALOME_ModuleCatalogImpl* Catalogue_i = new SALOME_ModuleCatalogImpl(argc, argv);
+ poa->activate_object (Catalogue_i);
- mgr->activate();
+ mgr->activate();
- CORBA::Object_ptr myCata = Catalogue_i->_this();
+ CORBA::Object_ptr myCata = Catalogue_i->_this();
- // initialise Naming Service
- SALOME_NamingService *_NS;
- _NS = new SALOME_NamingService(orb);
- // register Catalog in Naming Service
- _NS->Register(myCata ,"/Kernel/ModulCatalog");
+ // initialise Naming Service
+ SALOME_NamingService *_NS;
+ _NS = new SALOME_NamingService(orb);
+ // register Catalog in Naming Service
+ _NS->Register(myCata ,"/Kernel/ModulCatalog");
- MESSAGE("Running CatalogServer.");
+ MESSAGE("Running CatalogServer.");
#ifdef CHECKTIME
- Utils_Timer timer;
- timer.Start();
- timer.Stop();
- MESSAGE("SALOME_Registry_Server.cxx - orb->run()");
- timer.ShowAbsolute();
+ Utils_Timer timer;
+ timer.Start();
+ timer.Stop();
+ MESSAGE("SALOME_Registry_Server.cxx - orb->run()");
+ timer.ShowAbsolute();
#endif
- orb->run();
+ orb->run();
- poa->destroy(1,1);
+ poa->destroy(1,1);
- }
- catch(CORBA::SystemException&) {
+ }
+ catch(CORBA::SystemException&) {
INFOS("Caught CORBA::SystemException.")
- }
- catch(CORBA::Exception&) {
+ }
+ catch(CORBA::Exception&) {
INFOS("Caught CORBA::Exception.")
- }
+ }
return 0;
}
from xml.sax.handler import *
from omniidl import idlast, idltype, idlvisitor, idlutil, output
-#values of this map are used in some nodes defenition
-common_data={"AUTHOR" : "",
- "ICON" : "",
- "VERSION" : "",
- "COMP_TYPE": "",
- "COMP_NAME": "",
- "COMP_MULT": "1"
+# parameters not found in IDL file, user's specified in optional parameters
+common_data={"AUTHOR" : "",
+ "ICON" : "",
+ "VERSION" : "",
+ "COMP_TYPE" : "",
+ "COMP_NAME" : "",
+ "COMP_UNAME" : "",
+ "COMP_MULT" : ""
}
+nb_components = 0
+
+#--------------------------------------------------
+# extract value of <param_name> from <args> list
+# it's proposed that the matching <args> item
+# looks like <param_name>=<value>, for example,
+# catalog=/tmp/myxml.xml
+#--------------------------------------------------
+def getParamValue( param_name, default_value, args ):
+ pattern=param_name+"="
+
+ res = default_value #initial value
+ for opt in args:
+ s = re.compile(pattern).search(opt)
+ if s:
+ res = opt[s.end():]
+ break #found
+
+ return res
+
+
#--------------------------------------------------
# print error message
#--------------------------------------------------
#--------------------------------------------------
class inParameter(Tree):
- def __init__(self, name=None, type='', comment=''):
+ def __init__(self, name=None, type='', comment='unknown'):
Tree.__init__(self, 'inParameter')
if name is None: return
#--------------------------------------------------
class outParameter(Tree):
- def __init__(self, name=None, type='', comment = ''):
+ def __init__(self, name=None, type='', comment = 'unknown'):
Tree.__init__(self, 'outParameter')
if name is None: return
#--------------------------------------------------
class Service(Tree):
- def __init__(self, name=None):
+ def __init__(self, name=None, comment = 'unknown'):
Tree.__init__(self, 'component-service')
if name is None: return
self.addNamedChild('service-name', name)
self.addNamedChild('service-author',common_data["AUTHOR"])
self.addNamedChild('service-version',common_data["VERSION"])
- self.addNamedChild('service-comment')
+ self.addNamedChild('service-comment', comment)
self.addNamedChild('service-by-default', "0")
self.addNamedChild('inParameter-list')
self.addNamedChild('outParameter-list')
#--------------------------------------------------
class Interface(Tree):
- def __init__(self, name=None):
+ def __init__(self, name=None, comment='unknown'):
Tree.__init__(self)
if name is None: return
self.addNamedChild('component-interface-name', name)
- self.addNamedChild('component-interface-comment');
+ self.addNamedChild('component-interface-comment', comment);
self.addNamedChild('component-service-list')
def createService(self, name):
# implements Component tree
#--------------------------------------------------
class Component(Tree):
- def __init__(self, name=None):
+ def __init__(self):
Tree.__init__(self, 'component')
-
- if name is None: return
-
- self.addNamedChild('component-name', name)
- self.addNamedChild('component-type',common_data["COMP_TYPE"])
- self.addNamedChild('component-author',common_data["AUTHOR"])
- self.addNamedChild('component-version',common_data["VERSION"])
- self.addNamedChild('component-comment')
+
+ self.addNamedChild('component-name', common_data["COMP_NAME"])
+ self.addNamedChild('component-username', common_data["COMP_UNAME"])
+ self.addNamedChild('component-type', common_data["COMP_TYPE"])
+ self.addNamedChild('component-author', common_data["AUTHOR"])
+ self.addNamedChild('component-version', common_data["VERSION"])
+ self.addNamedChild('component-comment', 'unknown')
self.addNamedChild('component-multistudy', common_data["COMP_MULT"])
- self.addNamedChild('component-icone',common_data["ICON"])
+ self.addNamedChild('component-icone', common_data["ICON"])
self.addNamedChild('constraint')
self.addNamedChild('component-interface-list')
return i
def merge(self, C):
- ext=C.getChild('component-author')
- int=self.getChild('component-author')
- if int is not None and ext is not None and len(ext.content):
- int.content = ext.content
-
- ext=C.getChild('component-type')
- int=self.getChild('component-type')
- if int is not None and ext is not None and len(ext.content):
- int.content = ext.content
-
- ext=C.getChild('component-icone')
- int=self.getChild('component-icone')
- if int is not None and ext is not None and len(ext.content):
- int.content = ext.content
-
- ext=C.getChild('component-version')
- int=self.getChild('component-version')
- if int is not None and ext is not None and len(ext.content):
- int.content = ext.content
-
- ext=C.getChild('component-comment')
- int=self.getChild('component-comment')
- if int is not None and ext is not None and len(ext.content):
- int.content = ext.content
-
- ext=C.getChild('component-multistudy')
- int=self.getChild('component-multistudy')
- if int is not None and ext is not None and len(ext.content):
- int.content = ext.content
-
- ext=C.getChild('constraint')
- int=self.getChild('constraint')
- if int is not None and ext is not None and len(ext.content):
- int.content = ext.content
-
+
+ for i in ['component-username', 'component-author',
+ 'component-type', 'component-icone', 'component-version',
+ 'component-comment', 'component-multistudy', 'constraint']:
+ ext = C.getChild(i)
+ int = self.getChild(i)
+ if int is None:
+ int = ext
+ elif ext is not None and len(ext.content):
+ int.content = ext.content
+
L_ext = C.getChild('component-interface-list')
L_int = self.getChild('component-interface-list')
if L_ext is None or L_int is None:
if ((s[0] == "Engines") & (s[1] == "Component")):
self.EngineType = 1; break
- if common_data["COMP_NAME"] : Comp = Component(common_data["COMP_NAME"])
- else : Comp = Component(node.identifier())
+ Comp = Component()
self.currentInterface = Comp.createInterface(node.identifier())
c.accept(self)
if (self.EngineType):
+ global nb_components
+ nb_components = nb_components + 1
self.catalog.mergeComponent(Comp)
self.EngineType = 0
self.currentService.createOutParameter \
(node.identifier(), self.currentType)
-#--------------------------------------------------
-# extract value of <param_name> from <args> list
-# it's proposed that the matching <args> item
-# looks like <param_name>=<value>, for example,
-# catalog=/tmp/myxml.xml
-#--------------------------------------------------
-def getParamValue( param_name, args ):
- pattern="^"+param_name+"="
-
- res = "" #initial value
- for opt in args:
- s = re.compile(pattern).search(opt)
- if s:
- res = opt[s.end():]
- break #found
-
- return res
-
#--------------------------------------------------
# parse idl and store xml file
#--------------------------------------------------
def run(tree, args):
- CatalogFileName=getParamValue("catalog",args)
- if CatalogFileName is None:
- CatalogFileName = 'CatalogModulePersonnel.xml'
+ print args
- if (re.compile(".*?.xml$").match(CatalogFileName, 1) is None):
+ CatalogFileName=getParamValue("catalog", "CatalogModulePersonnel.xml", args)
+ print CatalogFileName
+ if re.compile(".*?.xml$").match(CatalogFileName, 1) is None:
CatalogFileName = CatalogFileName + '.xml'
#========= Read parameters ======================
- common_data["ICON"] = getParamValue("icon",args) # get icon file
-
- common_data["AUTHOR"] = getParamValue("author",args) # get author name
- if common_data["AUTHOR"] is None: common_data["AUTHOR"] = os.getenv("USER");
+ common_data["ICON"] = getParamValue("icon", "", args)
+ common_data["AUTHOR"] = getParamValue("author", os.getenv("USER"), args)
+ common_data["VERSION"] = getParamValue("version", "1", args)
+ common_data["COMP_NAME"] = getParamValue("name", "", args)
+ common_data["COMP_UNAME"] = getParamValue("username", "", args)
+ common_data["COMP_TYPE"] = getParamValue("type", "OTHER", args)
+ common_data["COMP_MULT"] = getParamValue("multistudy", "1", args)
+
+ print common_data
- common_data["VERSION"] = getParamValue("version",args) # get version
-
- common_data["COMP_NAME"] = getParamValue("name",args) # get icon file
-
- val = getParamValue("type",args) # get icon file
- if val: common_data["COMP_TYPE"] = val
-
- val = getParamValue("multistudy",args) # get icon file
- if val : common_data["COMP_MULT"] = val
-
- remove_comp = getParamValue("remove", args)
+ remove_comp = getParamValue("remove", "", args)
#==================================================
print "Importing", CatalogFileName
C = Catalog(CatalogFileName)
else:
- print "Warning : ",CatalogFileName, " was not found."
+ print "Creating ",CatalogFileName
C = Catalog()
-
+
print "Reading idl file"
visitor = ModuleCatalogVisitor(C)
if __name__ == "__main__":
print
- print "Usage : omniidl -bIDLparser -Wbcatalog=<my_catalog.xml>[,icon=<pngfile>][,version=<num>][,author=<name>][,name=<component_name>][,multistudy=<component_multistudy>][,remove=component_name] <file.idl>"
+ print "Usage : omniidl -bIDLparser [-I<catalog files directory>]* -Wbcatalog=<my_catalog.xml>[,icon=<pngfile>][,version=<num>][,author=<name>][,name=<component_name>][,username=<component_username>][,multistudy=<component_multistudy>] <file.idl>"
print
#-------------------------------------------------------------------------
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
#-------------------------------------------------------------------------
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
NOTIFICATION_Supplier.cxx \
NOTIFICATION_Consumer.cxx
-LDFLAGS+= -lOpUtil
+LDFLAGS+= -lOpUtil -lSALOMELocalTrace
OMNIORB_IDLCXXFLAGS+= -Wbtp
@CONCLUDE@
#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);
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);
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;
SALOME_Actor::SALOME_Actor(){
PreviewProperty = NULL;
+ ispreselected = Standard_False;
+ myProperty = vtkProperty::New();
myRepresentation = 2;
myTransformFilter = SALOME_TransformFilter::New();
myPassFilter.push_back(SALOME_PassThroughFilter::New());
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();
}
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; }
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;
SALOME_Transform *myTransform;
std::vector<SALOME_PassThroughFilter*> myPassFilter;
SALOME_TransformFilter *myTransformFilter;
+ vtkProperty *myProperty;
int myRepresentation;
};
#include "QAD_Application.h"
#include "utilities.h"
+#include "QAD_Config.h"
+#include "QAD_Settings.h"
#include "SALOME_Selection.h"
#include "SALOME_AISShape.hxx"
// Open CASCADE Include
#include <V3d_View.hxx>
#include <AIS_ListIteratorOfListOfInteractive.hxx>
-
+#include <Visual3d_View.hxx>
/*!
Constructor
myViewer->getAISContext()->Display( myViewer->getTrihedron() );
else
myViewer->getAISContext()->Erase( myViewer->getTrihedron() );
+ onAdjustTrihedron();
}
void OCCViewer_ViewFrame::rename( const Handle(SALOME_InteractiveObject)& IObject, QString newName )
Repaint();
}
-void OCCViewer_ViewFrame::SetTrihedronSize( int dim )
-{
- myViewer->setTrihedronSize( dim );
-}
-
/* selection */
Handle(SALOME_InteractiveObject) OCCViewer_ViewFrame::FindIObject(const char* Entry)
{
-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);
+ }
+}
QCursor cursor() const;
void SetSelectionMode( int mode ) {};
-
- void SetTrihedronSize( int dim );
-
+
/* popup management */
void setPopupServer( QAD_Application* );
void onViewBottom();
void onViewTop();
void onViewTrihedron();
+ void onAdjustTrihedron();
protected:
OCCViewer_Viewer3d* myViewer; // my owner
ViewType getTypeView() const { return VIEW_PLOT2D; }
QWidget* getViewWidget();
void SetSelectionMode( int mode ) {}
- void SetTrihedronSize( int dim ) {}
+ void onAdjustTrihedron( ) {}
/* popup management */
void setPopupServer( QAD_Application* );
BIN_SRC = RegistryService.cxx
BIN_SERVER_IDL = SALOME_Registry.idl
-LDFLAGS+= -lSalomeNS -lOpUtil -lSalomeLoggerServer
+LDFLAGS+= -lSalomeNS -lOpUtil -lSALOMELocalTrace
@CONCLUDE@
// Module : SALOME
// $Header$
-using namespace std;
-# include <stdlib.h>
-# include <iostream.h>
-# include <fstream.h>
+#include <stdlib.h>
+#include <iostream.h>
+#include <fstream.h>
extern "C"
{
# include <stdio.h>
}
-# include "utilities.h"
-# include "Utils_ORB_INIT.hxx"
-# include "Utils_SINGLETON.hxx"
-# include "Utils_SALOME_Exception.hxx"
-# include "Utils_CommException.hxx"
-# include "ServiceUnreachable.hxx"
-# include "SALOME_NamingService.hxx"
-# include "RegistryService.hxx"
+#include "utilities.h"
+#include "Utils_ORB_INIT.hxx"
+#include "Utils_SINGLETON.hxx"
+#include "Utils_SALOME_Exception.hxx"
+#include "Utils_CommException.hxx"
+#include "ServiceUnreachable.hxx"
+#include "SALOME_NamingService.hxx"
+#include "RegistryService.hxx"
-//#define CHECKTIME
#ifdef CHECKTIME
#include <Utils_Timer.hxx>
#endif
+using namespace std;
int main( int argc , char **argv )
{
- BEGIN_OF( argv[0] )
- INFOS_COMPILATION
- SCRUTE(argc)
- if( argc<3 )
+ BEGIN_OF( argv[0] )
+ INFOS_COMPILATION
+ SCRUTE(argc)
+ if( argc<3 )
+ {
+ MESSAGE("you must provide the Salome session name when you call SALOME_Registry_Server") ;
+ throw CommException("you must provide the Salome session name when you call SALOME_Registry_Server") ;
+ }
+ const char *ptrSessionName=0 ;
+
+ int k=0 ;
+ for ( k=1 ; k<argc ; k++ )
+ {
+ if( strcmp(argv[k],"--salome_session")==0 )
{
- MESSAGE("you must provide the Salome session name when you call SALOME_Registry_Server") ;
- throw CommException("you must provide the Salome session name when you call SALOME_Registry_Server") ;
+ ptrSessionName=argv[k+1] ;
+ break ;
}
- const char *ptrSessionName=0 ;
-
- int k=0 ;
- for ( k=1 ; k<argc ; k++ )
+ }
+ ASSERT(ptrSessionName) ;
+ ASSERT(strlen( ptrSessionName )>0) ;
+ const char *registryName = "Registry" ;
+ ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
+ CORBA::ORB_var &orb = init( argc , argv ) ;
+ //
+ long TIMESleep = 250000000;
+ int NumberOfTries = 40;
+ int a;
+ timespec ts_req;
+ ts_req.tv_nsec=TIMESleep;
+ ts_req.tv_sec=0;
+ timespec ts_rem;
+ ts_rem.tv_nsec=0;
+ ts_rem.tv_sec=0;
+ CosNaming::NamingContext_var inc;
+ PortableServer::POA_var poa;
+ CORBA::Object_var theObj;
+ CORBA::Object_var obj;
+ CORBA::Object_var object;
+ SALOME_NamingService &naming = *SINGLETON_<SALOME_NamingService>::Instance() ;
+ Registry::Components_var varComponents;
+ int REGISTRY=0;
+ const char * Env = getenv("USE_LOGGER");
+ int EnvL =0;
+ if ((Env!=NULL) && (strlen(Env)))
+ EnvL=1;
+ CosNaming::Name name;
+ name.length(1);
+ name[0].id=CORBA::string_dup("Logger");
+ PortableServer::POAManager_var manager;
+ for (int i = 1; i<=NumberOfTries; i++)
+ {
+ if (i!=1)
+ a=nanosleep(&ts_req,&ts_rem);
+ try
+ {
+ obj = orb->resolve_initial_references("RootPOA");
+ if(!CORBA::is_nil(obj))
+ poa = PortableServer::POA::_narrow(obj);
+ if(!CORBA::is_nil(poa))
+ manager = poa->the_POAManager();
+ if(!CORBA::is_nil(orb))
+ theObj = orb->resolve_initial_references("NameService");
+ if (!CORBA::is_nil(theObj))
+ inc = CosNaming::NamingContext::_narrow(theObj);
+ }
+ catch( CORBA::COMM_FAILURE& )
{
- if( strcmp(argv[k],"--salome_session")==0 )
- {
- ptrSessionName=argv[k+1] ;
- break ;
- }
+ MESSAGE( "Registry Server: CORBA::COMM_FAILURE: Unable to contact the Naming Service" );
}
- ASSERT(ptrSessionName) ;
- ASSERT(strlen( ptrSessionName )>0) ;
- const char *registryName = "Registry" ;
- ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
- CORBA::ORB_var &orb = init( argc , argv ) ;
- //
- long TIMESleep = 250000000;
- int NumberOfTries = 40;
- int a;
- timespec ts_req;
- ts_req.tv_nsec=TIMESleep;
- ts_req.tv_sec=0;
- timespec ts_rem;
- ts_rem.tv_nsec=0;
- ts_rem.tv_sec=0;
- CosNaming::NamingContext_var inc;
- PortableServer::POA_var poa;
- CORBA::Object_var theObj;
- CORBA::Object_var obj;
- CORBA::Object_var object;
- SALOME_Logger::Logger_var log;
- SALOME_NamingService &naming = *SINGLETON_<SALOME_NamingService>::Instance() ;
- Registry::Components_var varComponents;
- int REGISTRY=0;
- const char * Env = getenv("USE_LOGGER");
- int EnvL =0;
- if ((Env!=NULL) && (strlen(Env)))
- EnvL=1;
- CosNaming::Name name;
- name.length(1);
- name[0].id=CORBA::string_dup("Logger");
- PortableServer::POAManager_var manager;
- for (int i = 1; i<=NumberOfTries; i++){
- if (i!=1)
- a=nanosleep(&ts_req,&ts_rem);
- try{
- obj = orb->resolve_initial_references("RootPOA");
- if(!CORBA::is_nil(obj))
- poa = PortableServer::POA::_narrow(obj);
- if(!CORBA::is_nil(poa))
- manager = poa->the_POAManager();
- if(!CORBA::is_nil(orb))
- theObj = orb->resolve_initial_references("NameService");
- if (!CORBA::is_nil(theObj))
- inc = CosNaming::NamingContext::_narrow(theObj);
- }
- catch( CORBA::COMM_FAILURE& )
+ if(!CORBA::is_nil(inc))
+ {
+ MESSAGE( "Registry Server: Naming Service was found" );
+ if(EnvL==1)
{
- MESSAGE( "Registry Server: CORBA::COMM_FAILURE: Unable to contact the Naming Service" )
- }
- if(!CORBA::is_nil(inc)) {
- MESSAGE( "Registry Server: Naming Service was found" )
- if(EnvL==1){
- for(int j=1; j<=NumberOfTries; j++){
+ for(int j=1; j<=NumberOfTries; j++)
+ {
if (j!=1)
a=nanosleep(&ts_req, &ts_rem);
- try{
- object = inc->resolve(name);
- }
- catch(CosNaming::NamingContext::NotFound){ MESSAGE( "Registry Server: Logger Server wasn't found" ) }
- catch(...){ MESSAGE( "Registry Server: Unknown exception" ) }
-
+ try
+ {
+ object = inc->resolve(name);
+ }
+ catch(CosNaming::NamingContext::NotFound)
+ {
+ MESSAGE( "Registry Server: Logger Server wasn't found" );
+ }
+ catch(...)
+ {
+ MESSAGE( "Registry Server: Unknown exception" );
+ }
if (!CORBA::is_nil(object))
- log = SALOME_Logger::Logger::_narrow(object);
- if (!CORBA::is_nil(log)){
- MESSAGE( "Registry Server: Logger Server was found" )
- log->ping();
- REGISTRY=1;
- break;
- }
- }}
- }
- if ((REGISTRY==1)||((EnvL==0)&&(!CORBA::is_nil(inc))))
- break;
- }
- //
- try
- {
- naming.init_orb( orb ) ;
- RegistryService *ptrRegistry = SINGLETON_<RegistryService>::Instance() ;
- ptrRegistry->SessionName( ptrSessionName ) ;
- varComponents = ptrRegistry->_this() ;
- // The RegistryService must not already exist.
+ {
+ MESSAGE( "Module Catalog Server: Logger Server was found" );
+ REGISTRY=1;
+ break;
+ }
+ }
+ }
+ }
+ if ((REGISTRY==1)||((EnvL==0)&&(!CORBA::is_nil(inc))))
+ break;
+ }
+
+ try
+ {
+ naming.init_orb( orb ) ;
+ RegistryService *ptrRegistry = SINGLETON_<RegistryService>::Instance() ;
+ ptrRegistry->SessionName( ptrSessionName ) ;
+ varComponents = ptrRegistry->_this() ;
+ // The RegistryService must not already exist.
- try
- {
- CORBA::Object_var pipo = naming.Resolve( registryName ) ;
- if (CORBA::is_nil(pipo) ) throw ServiceUnreachable() ;
- MESSAGE("RegistryService servant already existing" ) ;
- exit( EXIT_FAILURE ) ;
- }
- catch( const ServiceUnreachable &ex )
- {
- }
- catch( const CORBA::Exception &exx )
- {
- }
- string absoluteName = string("/") + registryName;
- naming.Register( varComponents , absoluteName.c_str() ) ;
- MESSAGE("On attend les requetes des clients") ;
- try
- {
- // Activation du POA
- MESSAGE("Activation du POA") ;
- manager->activate() ;
+ try
+ {
+ CORBA::Object_var pipo = naming.Resolve( registryName ) ;
+ if (CORBA::is_nil(pipo) ) throw ServiceUnreachable() ;
+ MESSAGE("RegistryService servant already existing" ) ;
+ exit( EXIT_FAILURE ) ;
+ }
+ catch( const ServiceUnreachable &ex )
+ {
+ }
+ catch( const CORBA::Exception &exx )
+ {
+ }
+ string absoluteName = string("/") + registryName;
+ naming.Register( varComponents , absoluteName.c_str() ) ;
+ MESSAGE("On attend les requetes des clients") ;
+ try
+ {
+ // Activation du POA
+ MESSAGE("Activation du POA") ;
+ manager->activate() ;
- // Lancement de l'ORB
- MESSAGE("Lancement de l'ORB") ;
+ // Lancement de l'ORB
+ MESSAGE("Lancement de l'ORB") ;
#ifdef CHECKTIME
- Utils_Timer timer;
- timer.Start();
- timer.Stop();
- MESSAGE("SALOME_Registry_Server.cxx - orb->run()");
- timer.ShowAbsolute();
+ Utils_Timer timer;
+ timer.Start();
+ timer.Stop();
+ MESSAGE("SALOME_Registry_Server.cxx - orb->run()");
+ timer.ShowAbsolute();
#endif
- orb->run() ;
- }
- catch( const CORBA::Exception &ex )
- {
- MESSAGE("Erreur systeme") ;
- return EXIT_FAILURE ;
- }
+ orb->run() ;
+ }
+ catch( const CORBA::Exception &ex )
+ {
+ MESSAGE("Erreur systeme") ;
+ return EXIT_FAILURE ;
+ }
- }
- catch( const SALOME_Exception &ex )
- {
- MESSAGE( "Communication Error : " << ex.what() )
- return EXIT_FAILURE ;
- }
+ }
+ catch( const SALOME_Exception &ex )
+ {
+ MESSAGE( "Communication Error : " << ex.what() )
+ return EXIT_FAILURE ;
+ }
- END_OF( argv[0] ) ;
- return 0 ;
+ END_OF( argv[0] ) ;
+ return 0 ;
}
# 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 )
{
_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 );
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");
}
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()) {
{
// N.B. parent can be 0
RegWidget* ptrRegWidget = RegWidget::GetRegWidget( orb, parent, name );
- ASSERT ( !ptrRegWidget );
+ //ASSERT ( !ptrRegWidget );
ptrRegWidget->show();
ptrRegWidget->raise();
ptrRegWidget->setActiveWindow();
CPPFLAGS+= $(QT_MT_INCLUDES)
CXXFLAGS+=
-LDFLAGS+= $(QT_MT_LIBS) $(OGL_LIBS) -lSalomeNS -lOpUtil -lSalomeLoggerServer
+LDFLAGS+= $(QT_MT_LIBS) $(OGL_LIBS) -lSalomeNS -lOpUtil -lSALOMELocalTrace
@CONCLUDE@
// Module : SALOME
// $Header$
-using namespace std;
#include <iostream.h>
#include "SALOME_NamingService.hxx"
#include "SALOME_RessourcesCatalog_impl.hxx"
#include "utilities.h"
-# include "Utils_SINGLETON.hxx"
+#include "Utils_SINGLETON.hxx"
+using namespace std;
+
int main(int argc,char **argv)
{
- try {
- CosNaming::NamingContext_var _rootContext, catalogContext;
+ try
+ {
+ CosNaming::NamingContext_var _rootContext, catalogContext;
- // initialize the ORB
+ // initialize the ORB
- CORBA::ORB_ptr orb = CORBA::ORB_init (argc, argv);
+ CORBA::ORB_ptr orb = CORBA::ORB_init (argc, argv);
- // initialize POA
- //
- long TIMESleep = 250000000;
- int NumberOfTries = 40;
- int a;
- timespec ts_req;
- ts_req.tv_nsec=TIMESleep;
- ts_req.tv_sec=0;
- timespec ts_rem;
- ts_rem.tv_nsec=0;
- ts_rem.tv_sec=0;
- CosNaming::NamingContext_var inc;
- PortableServer::POA_var poa;
- CORBA::Object_var theObj;
- CORBA::Object_var obj;
- CORBA::Object_var object;
- SALOME_Logger::Logger_var log;
- SALOME_NamingService &naming = *SINGLETON_<SALOME_NamingService>::Instance() ;
- int RESSOURCES_CATALOG=0;
- const char * Env = getenv("USE_LOGGER");
- int EnvL =0;
- if ((Env!=NULL) && (strlen(Env)))
- EnvL=1;
- CosNaming::Name name;
- name.length(1);
- name[0].id=CORBA::string_dup("Logger");
- PortableServer::POAManager_var mgr;
- for (int i = 1; i<=NumberOfTries; i++){
+ // initialize POA
+ //
+ long TIMESleep = 250000000;
+ int NumberOfTries = 40;
+ int a;
+ timespec ts_req;
+ ts_req.tv_nsec=TIMESleep;
+ ts_req.tv_sec=0;
+ timespec ts_rem;
+ ts_rem.tv_nsec=0;
+ ts_rem.tv_sec=0;
+ CosNaming::NamingContext_var inc;
+ PortableServer::POA_var poa;
+ CORBA::Object_var theObj;
+ CORBA::Object_var obj;
+ CORBA::Object_var object;
+ SALOME_NamingService &naming = *SINGLETON_<SALOME_NamingService>::Instance() ;
+ int RESSOURCES_CATALOG=0;
+ const char * Env = getenv("USE_LOGGER");
+ int EnvL =0;
+ if ((Env!=NULL) && (strlen(Env)))
+ EnvL=1;
+ CosNaming::Name name;
+ name.length(1);
+ name[0].id=CORBA::string_dup("Logger");
+ PortableServer::POAManager_var mgr;
+ for (int i = 1; i<=NumberOfTries; i++)
+ {
if (i!=1)
a=nanosleep(&ts_req,&ts_rem);
- try{
- obj = orb->resolve_initial_references("RootPOA");
- if(!CORBA::is_nil(obj))
- poa = PortableServer::POA::_narrow(obj);
- if(!CORBA::is_nil(poa))
- mgr = poa->the_POAManager();
- if(!CORBA::is_nil(orb))
- theObj = orb->resolve_initial_references("NameService");
- if (!CORBA::is_nil(theObj))
- inc = CosNaming::NamingContext::_narrow(theObj);
+ try
+ {
+ obj = orb->resolve_initial_references("RootPOA");
+ if(!CORBA::is_nil(obj))
+ poa = PortableServer::POA::_narrow(obj);
+ if(!CORBA::is_nil(poa))
+ mgr = poa->the_POAManager();
+ if(!CORBA::is_nil(orb))
+ theObj = orb->resolve_initial_references("NameService");
+ if (!CORBA::is_nil(theObj))
+ inc = CosNaming::NamingContext::_narrow(theObj);
}
catch( CORBA::COMM_FAILURE& )
{
- MESSAGE( "Ressources Catalog: CORBA::COMM_FAILURE: Unable to contact the Naming Service" )
+ MESSAGE( "Ressources Catalog: CORBA::COMM_FAILURE: Unable to contact the Naming Service" );
+ }
+ if(!CORBA::is_nil(inc))
+ {
+ MESSAGE( "Ressources Catalog: Naming Service was found" );
+ if(EnvL==1)
+ {
+ for(int j=1; j<=NumberOfTries; j++)
+ {
+ if (j!=1)
+ a=nanosleep(&ts_req, &ts_rem);
+ try{
+ object = inc->resolve(name);
+ }
+ catch(CosNaming::NamingContext::NotFound)
+ {
+ MESSAGE( "Ressources Catalog: Logger Server wasn't found" );
+ }
+ catch(...)
+ {
+ MESSAGE( "Ressources Catalog: Unknown exception" );
+ }
+ if (!CORBA::is_nil(object))
+ {
+ MESSAGE( "Ressources Catalog: Loger Server was found" );
+ RESSOURCES_CATALOG=1;
+ break;
+ }
+ }
}
- if(!CORBA::is_nil(inc)) {
- MESSAGE( "Ressources Catalog: Naming Service was found" )
- if(EnvL==1){
- for(int j=1; j<=NumberOfTries; j++){
- if (j!=1)
- a=nanosleep(&ts_req, &ts_rem);
- try{
- object = inc->resolve(name);
- }
- catch(CosNaming::NamingContext::NotFound){ MESSAGE( "Ressources Catalog: Logger Server wasn't found" ) }
- catch(...){ MESSAGE( "Ressources Catalog: Unknown exception" ) }
- if (!CORBA::is_nil(object))
- log = SALOME_Logger::Logger::_narrow(object);
- if (!CORBA::is_nil(log)){
- MESSAGE( "Ressources Catalog: Loger Server was found" )
- log->ping();
- RESSOURCES_CATALOG=1;
- break;
- }
- }}
- }
+ }
if ((RESSOURCES_CATALOG==1)||((EnvL==0)&&(!CORBA::is_nil(inc))))
break;
- }
- //
- // Active catalog
+ }
+
+ // Active catalog
- SALOME_RessourcesCatalogImpl* Catalogue_i = new SALOME_RessourcesCatalogImpl(argc, argv);
- poa->activate_object (Catalogue_i);
- mgr->activate();
- CORBA::Object_ptr myCata = Catalogue_i->_this();
+ SALOME_RessourcesCatalogImpl* Catalogue_i = new SALOME_RessourcesCatalogImpl(argc, argv);
+ poa->activate_object (Catalogue_i);
+ mgr->activate();
+ CORBA::Object_ptr myCata = Catalogue_i->_this();
- // initialise Naming Service
- SALOME_NamingService *_NS;
- _NS = new SALOME_NamingService(orb);
- // register Catalog in Naming Service
- _NS->Register(myCata ,"/Kernel/RessourcesCatalog");
+ // initialise Naming Service
+ SALOME_NamingService *_NS;
+ _NS = new SALOME_NamingService(orb);
+ // register Catalog in Naming Service
+ _NS->Register(myCata ,"/Kernel/RessourcesCatalog");
- MESSAGE("Running Ressources Catalog Server.")
+ MESSAGE("Running Ressources Catalog Server.")
- orb->run();
+ orb->run();
- poa->destroy(1,1);
+ poa->destroy(1,1);
- }
- catch(CORBA::SystemException&) {
+ }
+ catch(CORBA::SystemException&) {
INFOS("Caught CORBA::SystemException.")
- }
- catch(CORBA::Exception&) {
+ }
+ catch(CORBA::Exception&) {
INFOS("Caught CORBA::Exception.")
- }
+ }
return 0;
}
SALOMEDS_OCAFApplication.cxx \
SALOMEDS_GenericAttribute_i.cxx \
SALOMEDS_IORAttribute.cxx \
+ SALOMEDS_ExternalFileDef.cxx \
+ SALOMEDS_FileType.cxx \
SALOMEDS_PersRefAttribute.cxx \
SALOMEDS_AttributeComment_i.cxx \
+ SALOMEDS_AttributeExternalFileDef_i.cxx \
+ SALOMEDS_AttributeFileType_i.cxx \
SALOMEDS_AttributeIOR_i.cxx \
SALOMEDS_AttributeInteger_i.cxx \
SALOMEDS_AttributeName_i.cxx \
CPPFLAGS+=$(OCC_INCLUDES) $(HDF5_INCLUDES)
CXXFLAGS+=$(OCC_CXXFLAGS)
-LDFLAGS+= $(HDF5_LIBS) -lTOOLSDS -lSalomeNS -lSalomeHDFPersist -lOpUtil -lSalomeLoggerServer $(CAS_LDPATH) -lTKCAF
+LDFLAGS+= $(HDF5_LIBS) -lTOOLSDS -lSalomeNS -lSalomeHDFPersist -lOpUtil -lSALOMELocalTrace $(CAS_LDPATH) -lTKCAF -lSalomeGenericObj -lSalomeLifeCycleCORBA
@CONCLUDE@
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);
#include "SALOMEDS_AttributePersistentRef_i.hxx"
#include "SALOMEDS_AttributeIOR_i.hxx"
#include "SALOMEDS_AttributeComment_i.hxx"
+#include "SALOMEDS_AttributeExternalFileDef_i.hxx"
+#include "SALOMEDS_AttributeFileType_i.hxx"
#include "SALOMEDS_AttributeName_i.hxx"
#include "SALOMEDS_AttributeSequenceOfInteger_i.hxx"
#include "SALOMEDS_AttributeSequenceOfReal_i.hxx"
else if (strcmp(aTypeOfAttribute, "AttributeSequenceOfInteger") == 0 ) return SALOMEDS_SequenceOfIntegerAttribute::GetID();
else if (strcmp(aTypeOfAttribute, "AttributeName") == 0 ) return TDataStd_Name::GetID();
else if (strcmp(aTypeOfAttribute, "AttributeComment") == 0 ) return TDataStd_Comment::GetID();
+ else if (strcmp(aTypeOfAttribute, "AttributeExternalFileDef") == 0 ) return SALOMEDS_ExternalFileDef::GetID();
+ else if (strcmp(aTypeOfAttribute, "AttributeFileType") == 0 ) return SALOMEDS_FileType::GetID();
else if (strcmp(aTypeOfAttribute, "AttributeIOR") == 0 ) return SALOMEDS_IORAttribute::GetID();
else if (strcmp(aTypeOfAttribute, "AttributePersistentRef") == 0 ) return SALOMEDS_PersRefAttribute::GetID();
else if (strcmp(aTypeOfAttribute, "AttributeDrawable") == 0 ) return SALOMEDS_DrawableAttribute::GetID();
{
if (ID == TDataStd_Name::GetID()) return "AttributeName";
else if (ID == TDataStd_Comment::GetID()) return "AttributeComment";
+ else if (ID == SALOMEDS_ExternalFileDef::GetID()) return "AttributeExternalFileDef";
+ else if (ID == SALOMEDS_FileType::GetID()) return "AttributeFileType";
else if (ID == SALOMEDS_IORAttribute::GetID()) return "AttributeIOR";
else if (ID == SALOMEDS_PersRefAttribute::GetID()) return "AttributePersistentRef";
else if (ID == TDataStd_Real::GetID()) return "AttributeReal";
anAttribute = Attr->AttributeComment::_this();
return Standard_True;
}
+ else if (strcmp(aTypeOfAttribute, "AttributeExternalFileDef") == 0 ) {
+ SALOMEDS_AttributeExternalFileDef_i* Attr = new SALOMEDS_AttributeExternalFileDef_i(Handle(SALOMEDS_ExternalFileDef)::DownCast(anAttr), _orb);
+ anAttribute = Attr->AttributeExternalFileDef::_this();
+ return Standard_True;
+ }
+ else if (strcmp(aTypeOfAttribute, "AttributeFileType") == 0 ) {
+ SALOMEDS_AttributeFileType_i* Attr = new SALOMEDS_AttributeFileType_i(Handle(SALOMEDS_FileType)::DownCast(anAttr), _orb);
+ anAttribute = Attr->AttributeFileType::_this();
+ return Standard_True;
+ }
else if (strcmp(aTypeOfAttribute, "AttributeIOR") == 0 ) {
SALOMEDS_AttributeIOR_i* Attr = new SALOMEDS_AttributeIOR_i(Handle(SALOMEDS_IORAttribute)::DownCast(anAttr), _orb);
anAttribute = Attr->AttributeIOR::_this();
SALOMEDS_AttributeComment_i* Attr= new SALOMEDS_AttributeComment_i(Handle(TDataStd_Comment)::DownCast(anAttr), _orb);
anAttribute = Attr->AttributeComment::_this();
}
+ else if (ReturnGUIDForAttribute("AttributeExternalFileDef") == anAttr->ID()) {
+ SALOMEDS_AttributeExternalFileDef_i* Attr= new SALOMEDS_AttributeExternalFileDef_i(Handle(SALOMEDS_ExternalFileDef)::DownCast(anAttr), _orb);
+ anAttribute = Attr->AttributeExternalFileDef::_this();
+ }
+ else if (ReturnGUIDForAttribute("AttributeFileType") == anAttr->ID()) {
+ SALOMEDS_AttributeFileType_i* Attr= new SALOMEDS_AttributeFileType_i(Handle(SALOMEDS_FileType)::DownCast(anAttr), _orb);
+ anAttribute = Attr->AttributeFileType::_this();
+ }
else if (ReturnGUIDForAttribute("AttributeIOR") == anAttr->ID()) {
SALOMEDS_AttributeIOR_i* Attr= new SALOMEDS_AttributeIOR_i(Handle(SALOMEDS_IORAttribute)::DownCast(anAttr), _orb);
anAttribute = Attr->AttributeIOR::_this();
// Module : SALOME
// $Header$
-using namespace std;
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SALOMEDS)
#include "SALOMEDS_StudyManager_i.hxx"
#include "utilities.h"
-# include "Utils_SINGLETON.hxx"
+#include "Utils_SINGLETON.hxx"
#include "SALOME_NamingService.hxx"
-//#define CHECKTIME
+
#ifdef CHECKTIME
#include <Utils_Timer.hxx>
#endif
+using namespace std;
// extern "C"
// { // for ccmalloc memory debug
//////////////////////////////////////////////////////////////////////////
int main(int argc, char** argv)
{
-// ccmalloc_static_initialization();
+ // ccmalloc_static_initialization();
MESSAGE("SALOMEDS_Server - main");
- try {
- // Initialise the ORB.
+ try
+ {
+ // Initialise the ORB.
#if OMNIORB_VERSION >= 4
- const char* options[][2] = { { "giopMaxMsgSize", "104857600" }, { 0, 0 } };
- CORBA::ORB_var orb = CORBA::ORB_init( argc , argv , "omniORB4", options) ;
+ const char* options[][2] = { { "giopMaxMsgSize", "104857600" }, { 0, 0 } };
+ CORBA::ORB_var orb = CORBA::ORB_init( argc , argv , "omniORB4", options) ;
#else
- CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "omniORB3");
- omniORB::MaxMessageSize(100 * 1024 * 1024);
+ CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "omniORB3");
+ omniORB::MaxMessageSize(100 * 1024 * 1024);
#endif
- // Obtain a reference to the root POA.
- //
- long TIMESleep = 250000000;
- int NumberOfTries = 40;
- int a;
- timespec ts_req;
- ts_req.tv_nsec=TIMESleep;
- ts_req.tv_sec=0;
- timespec ts_rem;
- ts_rem.tv_nsec=0;
- ts_rem.tv_sec=0;
- CosNaming::NamingContext_var inc;
- PortableServer::POA_var poa;
- CORBA::Object_var theObj;
- CORBA::Object_var obj;
- CORBA::Object_var object;
- SALOME_Logger::Logger_var log;
- int SALOMEDS=0;
- const char * Env = getenv("USE_LOGGER");
- int EnvL =0;
- if ((Env!=NULL) && (strlen(Env)))
- EnvL=1;
- CosNaming::Name name;
- name.length(1);
- name[0].id=CORBA::string_dup("Logger");
- PortableServer::POAManager_var pman;
- for (int i = 1; i<=NumberOfTries; i++){
- if (i!=1)
- a=nanosleep(&ts_req,&ts_rem);
- try{
- obj = orb->resolve_initial_references("RootPOA");
- if(!CORBA::is_nil(obj))
- poa = PortableServer::POA::_narrow(obj);
- if(!CORBA::is_nil(poa))
- pman = poa->the_POAManager();
- if(!CORBA::is_nil(orb))
- theObj = orb->resolve_initial_references("NameService");
- if (!CORBA::is_nil(theObj)){
- inc = CosNaming::NamingContext::_narrow(theObj);
- if(!CORBA::is_nil(inc)) {
- MESSAGE( "SalomeDS Server: Naming Service was found" )
- if(EnvL==1){
- CORBA::ORB_var orb1 = CORBA::ORB_init(argc,argv) ;
- SALOME_NamingService &NS = *SINGLETON_<SALOME_NamingService>::Instance() ;
- NS.init_orb( orb1 ) ;
- for(int j=1; j<=NumberOfTries; j++){
- if (j!=1)
- a=nanosleep(&ts_req, &ts_rem);
- try{
- object = inc->resolve(name);}
- catch(CosNaming::NamingContext::NotFound){ MESSAGE( "SalomeDS Server: Logger Server wasn't found" ) }
- catch(...){ MESSAGE( "SalomeDS Server: Unknown exception" ) }
- if (!CORBA::is_nil(object))
- log = SALOME_Logger::Logger::_narrow(object);
- if (!CORBA::is_nil(log)){
- MESSAGE( "SalomeDS Server: Logger Server was found" )
- log->ping();
- SALOMEDS=1;
- break;
- }
- }}
- }}
-
- }
- catch( const SALOME_Exception &ex )
+ // Obtain a reference to the root POA.
+ //
+ long TIMESleep = 250000000;
+ int NumberOfTries = 40;
+ int a;
+ timespec ts_req;
+ ts_req.tv_nsec=TIMESleep;
+ ts_req.tv_sec=0;
+ timespec ts_rem;
+ ts_rem.tv_nsec=0;
+ ts_rem.tv_sec=0;
+ CosNaming::NamingContext_var inc;
+ PortableServer::POA_var poa;
+ CORBA::Object_var theObj;
+ CORBA::Object_var obj;
+ CORBA::Object_var object;
+ int SALOMEDS=0;
+ const char * Env = getenv("USE_LOGGER");
+ int EnvL =0;
+ if ((Env!=NULL) && (strlen(Env)))
+ EnvL=1;
+ CosNaming::Name name;
+ name.length(1);
+ name[0].id=CORBA::string_dup("Logger");
+ PortableServer::POAManager_var pman;
+ for (int i = 1; i<=NumberOfTries; i++)
{
- MESSAGE( "Communication Error : " << ex.what() )
- return EXIT_FAILURE ;
+ if (i!=1)
+ a=nanosleep(&ts_req,&ts_rem);
+ try
+ {
+ obj = orb->resolve_initial_references("RootPOA");
+ if(!CORBA::is_nil(obj))
+ poa = PortableServer::POA::_narrow(obj);
+ if(!CORBA::is_nil(poa))
+ pman = poa->the_POAManager();
+ if(!CORBA::is_nil(orb))
+ theObj = orb->resolve_initial_references("NameService");
+ if (!CORBA::is_nil(theObj)){
+ inc = CosNaming::NamingContext::_narrow(theObj);
+ if(!CORBA::is_nil(inc))
+ {
+ MESSAGE( "SalomeDS Server: Naming Service was found" );
+ if(EnvL==1)
+ {
+ CORBA::ORB_var orb1 = CORBA::ORB_init(argc,argv) ;
+ SALOME_NamingService &NS = *SINGLETON_<SALOME_NamingService>::Instance() ;
+ NS.init_orb( orb1 ) ;
+ for(int j=1; j<=NumberOfTries; j++)
+ {
+ if (j!=1)
+ a=nanosleep(&ts_req, &ts_rem);
+ try
+ {
+ object = inc->resolve(name);
+ }
+ catch(CosNaming::NamingContext::NotFound)
+ {
+ MESSAGE( "SalomeDS Server: Logger Server wasn't found" ); }
+
+ catch(...)
+ {
+ MESSAGE( "SalomeDS Server: Unknown exception" );
+ }
+ if (!CORBA::is_nil(object))
+ {
+ MESSAGE( "SalomeDS Server: Logger Server was found" );
+ SALOMEDS=1;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ }
+ catch( const SALOME_Exception &ex )
+ {
+ MESSAGE( "Communication Error : " << ex.what() );
+ return EXIT_FAILURE ;
+ }
+ if ((SALOMEDS==1)||((EnvL==0)&&(!CORBA::is_nil(inc))))
+ break;
}
- if ((SALOMEDS==1)||((EnvL==0)&&(!CORBA::is_nil(inc))))
- break;
- }
- //
- // We allocate the objects on the heap. Since these are reference
- // counted objects, they will be deleted by the POA when they are no
- // longer needed.
- SALOMEDS_StudyManager_i * myStudyManager_i = new SALOMEDS_StudyManager_i(orb);
+ // We allocate the objects on the heap. Since these are reference
+ // counted objects, they will be deleted by the POA when they are no
+ // longer needed.
+ SALOMEDS_StudyManager_i * myStudyManager_i = new SALOMEDS_StudyManager_i(orb);
- // Activate the objects. This tells the POA that the objects are
- // ready to accept requests.
- PortableServer::ObjectId_var myStudyManager_iid = poa->activate_object(myStudyManager_i);
- myStudyManager_i->register_name("/myStudyManager");
+ // Activate the objects. This tells the POA that the objects are
+ // ready to accept requests.
+ PortableServer::ObjectId_var myStudyManager_iid = poa->activate_object(myStudyManager_i);
+ myStudyManager_i->register_name("/myStudyManager");
- // Obtain a POAManager, and tell the POA to start accepting
- // requests on its objects.
- pman = poa->the_POAManager();
- pman->activate();
+ // Obtain a POAManager, and tell the POA to start accepting
+ // requests on its objects.
+ pman = poa->the_POAManager();
+ pman->activate();
#ifdef CHECKTIME
- Utils_Timer timer;
- timer.Start();
- timer.Stop();
- MESSAGE("SALOME_Registry_Server.cxx - orb->run()");
- timer.ShowAbsolute();
+ Utils_Timer timer;
+ timer.Start();
+ timer.Stop();
+ MESSAGE("SALOME_Registry_Server.cxx - orb->run()");
+ timer.ShowAbsolute();
#endif
- orb->run();
- orb->destroy();
- }
- catch(CORBA::SystemException&) {
- MESSAGE( "Caught CORBA::SystemException." )
- }
- catch(CORBA::Exception&) {
- MESSAGE( "Caught CORBA::Exception." )
- }
- catch(omniORB::fatalException& fe) {
- MESSAGE( "Caught omniORB::fatalException:" )
- MESSAGE( " file: " << fe.file() )
- MESSAGE( " line: " << fe.line() )
- MESSAGE( " mesg: " << fe.errmsg() )
- }
- catch(...) {
- MESSAGE( "Caught unknown exception." )
- }
+ orb->run();
+ orb->destroy();
+ }
+ catch(CORBA::SystemException&)
+ {
+ MESSAGE( "Caught CORBA::SystemException." );
+ }
+ catch(CORBA::Exception&)
+ {
+ MESSAGE( "Caught CORBA::Exception." );
+ }
+ catch(omniORB::fatalException& fe)
+ {
+ MESSAGE( "Caught omniORB::fatalException:" );
+ MESSAGE( " file: " << fe.file() );
+ MESSAGE( " line: " << fe.line() );
+ MESSAGE( " mesg: " << fe.errmsg() );
+ }
+ catch(...)
+ {
+ MESSAGE( "Caught unknown exception." );
+ }
return 0;
}
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"
#include "SALOMEDS_AttributePersistentRef_i.hxx"
#include "SALOMEDS_AttributeIOR_i.hxx"
#include "SALOMEDS_AttributeComment_i.hxx"
+#include "SALOMEDS_AttributeExternalFileDef_i.hxx"
+#include "SALOMEDS_AttributeFileType_i.hxx"
#include "SALOMEDS_AttributeName_i.hxx"
#include "SALOMEDS_AttributeSequenceOfInteger_i.hxx"
#include "SALOMEDS_AttributeSequenceOfReal_i.hxx"
SALOMEDS::SComponent_ptr
SALOMEDS_StudyBuilder_i::NewComponent(const char* DataType)
{
+ CheckLocked();
//Always create component under main label.
TDF_Label L = _doc->Main();
void SALOMEDS_StudyBuilder_i::DefineComponentInstance(SALOMEDS::SComponent_ptr aComponent,
CORBA::Object_ptr IOR)
{
+ CheckLocked();
//Find label
TDF_Label Lab;
ASSERT(!CORBA::is_nil(aComponent));
void
SALOMEDS_StudyBuilder_i::RemoveComponent(SALOMEDS::SComponent_ptr aComponent)
{
+ CheckLocked();
ASSERT(!CORBA::is_nil(aComponent));
RemoveObject(aComponent);
}
SALOMEDS::SObject_ptr
SALOMEDS_StudyBuilder_i::NewObject(SALOMEDS::SObject_ptr theFatherObject)
{
+ CheckLocked();
TCollection_AsciiString anEntry;
//Find label of father
SALOMEDS_StudyBuilder_i::NewObjectToTag(SALOMEDS::SObject_ptr theFatherObject,
CORBA::Long atag)
{
+ CheckLocked();
//Find label of father
TDF_Label Lab;
//============================================================================
void SALOMEDS_StudyBuilder_i::RemoveObject(SALOMEDS::SObject_ptr anObject)
{
+ CheckLocked();
if(!CORBA::is_nil(_callbackOnRemove)) _callbackOnRemove->OnRemoveSObject(anObject);
TDF_Label Lab;
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();
}
//============================================================================
void SALOMEDS_StudyBuilder_i::RemoveObjectWithChildren(SALOMEDS::SObject_ptr anObject)
{
+ CheckLocked();
if(!CORBA::is_nil(_callbackOnRemove)) _callbackOnRemove->OnRemoveSObject(anObject);
TDF_Label Lab;
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()) {
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);
if (strcmp(aTypeOfAttribute, "AttributeReal") == 0 ) {
Handle(TDataStd_Real) anAttr;
if (!Lab.FindAttribute(TDataStd_Real::GetID(), anAttr)) {
+ CheckLocked();
anAttr = new TDataStd_Real;
Lab.AddAttribute(anAttr);
}
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);
}
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);
}
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);
}
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);
}
else if (strcmp(aTypeOfAttribute, "AttributeComment") == 0 ) {
Handle(TDataStd_Comment) anAttr;
if (!Lab.FindAttribute(TDataStd_Comment::GetID(), anAttr)) {
+ CheckLocked();
anAttr = new TDataStd_Comment;
Lab.AddAttribute(anAttr);
}
SALOMEDS::AttributeComment_var aCA = aCommentAttr->AttributeComment::_this();
return aCA._retn();
}
+ else if (strcmp(aTypeOfAttribute, "AttributeExternalFileDef") == 0 ) {
+ Handle(SALOMEDS_ExternalFileDef) anAttr;
+ if (!Lab.FindAttribute(SALOMEDS_ExternalFileDef::GetID(), anAttr)) {
+ anAttr = new SALOMEDS_ExternalFileDef;
+ Lab.AddAttribute(anAttr);
+ }
+ SALOMEDS_AttributeExternalFileDef_i* anExternalFileDefAttr = new SALOMEDS_AttributeExternalFileDef_i(anAttr, _orb);
+ SALOMEDS::AttributeExternalFileDef_var aCA = anExternalFileDefAttr->AttributeExternalFileDef::_this();
+ return aCA._retn();
+ }
+ else if (strcmp(aTypeOfAttribute, "AttributeFileType") == 0 ) {
+ Handle(SALOMEDS_FileType) anAttr;
+ if (!Lab.FindAttribute(SALOMEDS_FileType::GetID(), anAttr)) {
+ anAttr = new SALOMEDS_FileType;
+ Lab.AddAttribute(anAttr);
+ }
+ SALOMEDS_AttributeFileType_i* anFileTypeAttr = new SALOMEDS_AttributeFileType_i(anAttr, _orb);
+ SALOMEDS::AttributeFileType_var aCA = anFileTypeAttr->AttributeFileType::_this();
+ return aCA._retn();
+ }
else if (strcmp(aTypeOfAttribute, "AttributeIOR") == 0 ) {
Handle(SALOMEDS_IORAttribute) anAttr;
if (!Lab.FindAttribute(SALOMEDS_IORAttribute::GetID(), anAttr)) {
+ CheckLocked();
anAttr = new SALOMEDS_IORAttribute;
Lab.AddAttribute(anAttr);
}
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);
}
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);
}
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);
}
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();
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);
}
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);
}
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);
}
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);
}
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();
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);
}
anAttribute = Attr->AttributeComment::_this();
return Standard_True;
}
+ else if (strcmp(aTypeOfAttribute, "AttributeExternalFileDef") == 0 ) {
+ SALOMEDS_AttributeExternalFileDef_i* Attr= new SALOMEDS_AttributeExternalFileDef_i(Handle(SALOMEDS_ExternalFileDef)::DownCast(anAttr), _orb);
+ anAttribute = Attr->AttributeExternalFileDef::_this();
+ return Standard_True;
+ }
+ else if (strcmp(aTypeOfAttribute, "AttributeFileType") == 0 ) {
+ SALOMEDS_AttributeFileType_i* Attr= new SALOMEDS_AttributeFileType_i(Handle(SALOMEDS_FileType)::DownCast(anAttr), _orb);
+ anAttribute = Attr->AttributeFileType::_this();
+ return Standard_True;
+ }
else if (strcmp(aTypeOfAttribute, "AttributeIOR") == 0 ) {
SALOMEDS_AttributeIOR_i* Attr= new SALOMEDS_AttributeIOR_i(Handle(SALOMEDS_IORAttribute)::DownCast(anAttr), _orb);
anAttribute = Attr->AttributeIOR::_this();
//============================================================================
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));
}
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();
//============================================================================
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;
//============================================================================
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();
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);
//============================================================================
void SALOMEDS_StudyBuilder_i::AbortCommand()
{
+ SALOMEDS_Study_i::GetStudy(_doc->Main(), _orb)->UndoPostponed(0);
+
_doc->AbortCommand();
}
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);
}
throw SALOMEDS::StudyBuilder::LockProtection();
} else {
_doc->Redo();
+ SALOMEDS_Study_i::GetStudy(_doc->Main(), _orb)->UndoPostponed(-1);
anAttr->SetModified(anAttr->GetModified()+1);
}
}
return _doc->GetAvailableRedos();
}
-
//============================================================================
/*! Function : UndoLimit
* Purpose :
//============================================================================
void SALOMEDS_StudyBuilder_i::UndoLimit(CORBA::Long n)
{
+ CheckLocked();
_doc->SetUndoLimit (n);
}
_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();
+}
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);
};
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"
#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
//===========================================================================
_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")) {
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);
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());
//============================================================================
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);
}
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);
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())
{
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))
{
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);
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...
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;
}
//============================================================================
#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"
_URL = NULL;
_StudyId = -1;
_autoFill = true;
+ myNbPostponed.Append(0);
+ myNbUndos = 0;
}
//============================================================================
//============================================================================
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);
}
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) {
// 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);
+ }
}
}
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;
+}
#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"
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;
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);
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
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
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));
}
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
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));
}
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
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));
}
#---------------
msgid "INF_VERSION"
-msgstr "Version 1.3.0"
+msgstr "Version 1.4.0"
msgid "INF_COPYRIGHT"
msgstr " "
#: QAD_Application.cxx:133
msgid "QAD_Application::APP_DEFAULTTITLE"
-msgstr "SALOME 1.3.0"
+msgstr "SALOME 1.4.0"
#: QAD_Desktop.cxx:424
msgid "QAD_Desktop::DESK_DEFAULTTITLE"
-msgstr "SALOME 1.3.0"
+msgstr "SALOME 1.4.0"
*/
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 ));
}
void QAD_Application::helpSearch()
{
/* just calls QAD_Desktop::helpSearch() but can have own implementation */
- // getDesktop()->helpSearch();
+// getDesktop()->helpSearch();
}
/*!
void QAD_Application::helpContents()
{
/* just calls QAD_Desktop::helpContents() but can have own implementation */
- // getDesktop()->helpContents();
+// getDesktop()->helpContents();
}
/*!
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;
/* 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 );
#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"
#include "SALOME_ListIteratorOfListIO.hxx"
#include "SALOMEGUI_AboutDlg.h"
#include "SALOMEGUI_ViewChoiceDlg.h"
+#include "SALOMEGUI_SetValueDlg.h"
#include "utilities.h"
#include "SALOMEGUI_CloseDlg.h"
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 ]
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'
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 );
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 */
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) ;
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 );
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
*/
//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;
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 ),
//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;
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;
}
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()
{
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");
*/
void QAD_Desktop::onHelpContentsGUI()
{
-
// QCString dir;
// QString root;
// QString homeDir;
// }
// 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");
return;
}
}
-
+
QString helpFile = QFileInfo( homeDir + "index.html" ).absFilePath();
QString anApp = QAD_CONFIG->getSetting("ExternalBrowser:Application");
} else if ( list_type_composants->length() > 1 ) {
SALOMEGUI_OpenWith* aDlg = new SALOMEGUI_OpenWith( this );
for (unsigned int ind = 0; ind < list_type_composants->length();ind++) {
- aDlg->addComponent( strdup(list_type_composants[ind]) );
+ QString compusername = getComponentUserName(strdup(list_type_composants[ind]));
+ if ( compusername.compare("") != 0 )
+ aDlg->addComponent( compusername );
}
int retVal = aDlg->exec();
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 ) {
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 ) ;
/*!
*/
void QAD_Desktop::activateComponent(const QString& theName, bool isLoadData){
+
int nbItem = myCombo->count();
int Index = 0;
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 ) {
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);
}
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();
}
}
}
// }
/* 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()
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
#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"
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
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();
void onObjectBrowser();
void onMultiFileSave();
void onASCIISave();
+ void onUndoLevel();
void onExternalBrowser();
void onActivateApp(QAD_Application* app);
void onHelpContents();
void onHelpContentsGUI();
void onHelpContentsTUI();
-/* void onHelpSearch(); */
+/* void onHelpSearch(); */
void onHelpAbout();
void onNewWindow3d();
void onComboActiveComponent( const QString & , bool isLoadData);
void onCascade();
- //NRI void onHelpWindowClosed();
+/* NRI void onHelpWindowClosed(); */
protected:
QMenuBar* myMainMenu; /* the main menu bar */
QList<QAD_Menus> myMenusList;
QAD_Menus* myActiveMenus;
- //NRI QAD_HelpWindow* myHelpWindow;
+ //NRI QAD_HelpWindow* myHelpWindow;
QList<QToolButton> myComponentButton;
// 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 );
// 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
+ }
}
- }
+ // }
}
/*!
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();
#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"
#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 ]
*/
myStudy = SALOMEDS::Study::_duplicate( study );
myListViewMap.clear();
myUseCaseMap.clear();
+ myListView=0; // must be done before setupListView(): setCornerWidget() provoque call to eventFilter
+ myUseCaseView=0; // and test myUseCaseView->viewport() before initialisation
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 ) );
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 */
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
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 ) );
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" ) );
/* 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 ) );
}
{
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 (! myUseCaseView) return QTabWidget::eventFilter( o, e );
+ if (o == myUseCaseView->viewport()) {
if ( e->type() == QEvent::MouseButtonPress ) {
// Test if clicked on selection and start drag if necessary
QMouseEvent* me = ( QMouseEvent* )e;
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 );
}
*/
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();
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
*/
void QAD_ObjectBrowser::UpdateUseCaseBrowser() {
// myUseCaseView->clear(); myUseCaseMap.clear();
- if ( myStudy->_is_nil() ) {
+ if ( myStudy->_is_nil() || this->count()<2 ) {
return;
}
myUseCaseView->blockSignals( true );
*/
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 */
void QAD_ObjectBrowser::unHighlightAll()
{
myListView->clearSelection();
- myUseCaseView->clearSelection();
+ myUseCaseView->clearSelection();
}
/*!
*/
void QAD_ObjectBrowser::onSelectedItem()
{
+ if (currentPage()==myListView)
+ myUseCaseView->clearSelection();
+
QListView* whoIs;
if ( sender()->inherits("QListView") )
whoIs = (QListView*)sender();
void QAD_ObjectBrowser::setShowInfoColumns( bool show )
{
bool shown = myListView->header()->isResizeEnabled( 2 );
+
if ( show != shown ) {
if ( show ) {
myListView->header()->setResizeEnabled( true, 2 );
void QAD_ObjectBrowser::setShowValueColumn( bool show )
{
bool shown = myListView->header()->isResizeEnabled( 1 );
+
if ( show != shown ) {
if ( show ) {
myListView->header()->setResizeEnabled( true, 1 );
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);
+ }
+}
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,
ItemMap myListViewMap;
ItemMap myUseCaseMap;
QListView* myListView;
+ QWidget* myVBox;
QListView* myUseCaseView;
QPopupMenu* myPopupMenu;
SALOMEDS::Study_ptr myStudy;
QToolButton* myClearBtn;
};
+
+class Btn : public QToolButton
+{
+ Q_OBJECT
+public:
+ Btn ( QWidget * parent, const char * name = 0 );
+public slots:
+ void onClicked();
+};
+
#endif
// QT Include
#include <qapplication.h>
-#define MAX_UNDO 10
/*!
Constructor
*/
{
myStudy = aStudy;
- myTitle = QAD_Tools::getFileNameFromPath( path, false );
+ myTitle = QAD_Tools::getFileNameFromPath( path, true );
myIsActive = false;
myIsSaved = false;
/* 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);
+
}
/*!
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 );
{
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() )
*/
void QAD_Study::close()
{
+ emit closed();
if ( !myStudy->_is_nil() )
abortAllOperations();
/* clear each study frame */
signals:
void docClosing( QAD_Study* );
void docOperationTerminated( bool );
+ void closed();
public slots:
void onStudyFrameActivated( QAD_StudyFrame* );
*/
void QAD_StudyFrame::closeEvent(QCloseEvent* e)
{
- emit sfBeforeStudyFrameClosing(this);
emit sfStudyFrameClosing(this);
}
signals:
void sfStudyFrameActivated( QAD_StudyFrame* );
void sfStudyFrameClosing( QAD_StudyFrame*);
- void sfBeforeStudyFrameClosing( QAD_StudyFrame*);
public slots:
void onStudyFrameActivated ( QWidget* );
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;
}
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;
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
#--------------
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"
# 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"
msgid "TOT_APP_EDIT_COPY"
msgstr "Copy"
+msgid "MEN_DESK_PREF_UNDO_LEVEL"
+msgstr "Undo Level"
+
msgid "MEN_APP_EDIT_COPY"
msgstr "&Copy"
viewFrame->Repaint();
if (isForeignGUIUsed)
- foreignGUI.DlClose();
+ ;//foreignGUI.DlClose(); // VSR: Fix crash on Display objects from non-parent components
myActiveStudy->updateObjBrowser(true);
}
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
*/
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
*/
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 );
#: 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"
#---------------
msgid "INF_VERSION"
-msgstr "Version 1.1a"
+msgstr ""
msgid "INF_COPYRIGHT"
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"
#: SALOMEGUI_AboutDlg.cxx:42
msgid "ABOUT_SALOME_TLT"
-msgstr "About SALOME "
+msgstr "About SALOME Professional"
msgid "SALOMEGUI_OpenWith::OPEN_WITH_TLT"
msgstr "Open With"
{
return QAD_FileDlg::getExistingDirectory(parent, initial, caption);
}
+
+void SalomePyQt::helpContext(const QString& source, const QString& context) {
+ //QAD_Application::getDesktop()->helpContext(source, context);
+}
static QString getExistingDirectory(QWidget* parent,
const QString& initial,
const QString& caption);
+ static void helpContext(const QString& source, const QString& context);
};
#endif
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&);
};
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()
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,
void SetSelectionMode( int mode );
- void SetTrihedronSize( int dim );
+ void onAdjustTrihedron( );
/* popup management */
void setPopupServer( QAD_Application* );
CPPFLAGS+=$(QT_MT_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES)
CXXFLAGS+=$(OCC_CXXFLAGS)
-LDFLAGS+=$(QT_MT_LIBS) -lSalomeNS -lSalomeGUI -lSalomeObject -lSalomeLifeCycleCORBA -lqsplitterP -lOpUtil -lSalomeLoggerServer -lPlot2d -lSalomeVTKFilter
+LDFLAGS+=$(QT_MT_LIBS) -lSalomeNS -lSalomeGUI -lSalomeObject -lSalomeLifeCycleCORBA -lqsplitterP -lOpUtil -lPlot2d -lSalomeVTKFilter -lSALOMELocalTrace
@CONCLUDE@
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SALOMEDS)
+SALOME_Session_QThread* SALOME_Session_QThread::_singleton = 0;
+
//=============================================================================
/*! SALOME_Session_QThread
* constructor
SALOME_Session_QThread::SALOME_Session_QThread(int argc, char ** argv) : QThread()
{
+ INFOS("Creation SALOME_Session_QThread");
_qappl = 0 ;
_mw = 0 ;
_argc = argc ;
_NS = 0 ;
} ;
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+ SALOME_Session_QThread* SALOME_Session_QThread::Instance(int argc, char ** argv)
+{
+ if (_singleton == 0) _singleton = new SALOME_Session_QThread(argc, argv);
+ return _singleton;
+
+}
+
//=============================================================================
/*! run
* Creates one QApplication for the all the session life.
{
public:
- SALOME_Session_QThread(int argc, char ** argv) ;
+ static SALOME_Session_QThread* Instance(int argc, char ** argv);
//! launch the Qt main window of the GUI on a separate thread
virtual void run() ;
QApplication *_qappl ;
SALOMEGUI_Application* _mw ;
+ SALOME_Session_QThread(int argc, char ** argv);
+
+private:
+ static SALOME_Session_QThread* _singleton;
} ;
#endif
// Module : SALOME
// $Header$
-# include "Utils_ORB_INIT.hxx"
-# include "Utils_SINGLETON.hxx"
-# include "SALOME_NamingService.hxx"
+#include "Utils_ORB_INIT.hxx"
+#include "Utils_SINGLETON.hxx"
+#include "SALOME_NamingService.hxx"
#include <iostream>
#include <unistd.h>
using namespace std;
try
{
- ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
- ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting()) ;
- CORBA::ORB_var &orb = init( argc , argv ) ;
+ ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
+ ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting()) ;
+ CORBA::ORB_var &orb = init( argc , argv ) ;
- //
- long TIMESleep = 250000000;
- int NumberOfTries = 40;
- int a;
- timespec ts_req;
- ts_req.tv_nsec=TIMESleep;
- ts_req.tv_sec=0;
- timespec ts_rem;
- ts_rem.tv_nsec=0;
- ts_rem.tv_sec=0;
- CosNaming::NamingContext_var inc;
- PortableServer::POA_var poa;
- CORBA::Object_var theObj;
- CORBA::Object_var obj;
- CORBA::Object_var object;
- SALOME_Logger::Logger_var log;
- SALOME_NamingService &naming = *SINGLETON_<SALOME_NamingService>::Instance() ;
- int SESSION=0;
- const char * Env = getenv("USE_LOGGER");
- int EnvL =0;
- if ((Env!=NULL) && (strlen(Env)))
- EnvL=1;
- CosNaming::Name name;
- name.length(1);
- name[0].id=CORBA::string_dup("Logger");
- PortableServer::POAManager_var pman;
- for (int i = 1; i<=NumberOfTries; i++){
- if (i!=1)
- a=nanosleep(&ts_req,&ts_rem);
- try{
+ //
+ long TIMESleep = 250000000;
+ int NumberOfTries = 40;
+ int a;
+ timespec ts_req;
+ ts_req.tv_nsec=TIMESleep;
+ ts_req.tv_sec=0;
+ timespec ts_rem;
+ ts_rem.tv_nsec=0;
+ ts_rem.tv_sec=0;
+ CosNaming::NamingContext_var inc;
+ PortableServer::POA_var poa;
+ CORBA::Object_var theObj;
+ CORBA::Object_var obj;
+ CORBA::Object_var object;
+ SALOME_NamingService &naming = *SINGLETON_<SALOME_NamingService>::Instance() ;
+ int SESSION=0;
+ const char * Env = getenv("USE_LOGGER");
+ int EnvL =0;
+ if ((Env!=NULL) && (strlen(Env)))
+ EnvL=1;
+ CosNaming::Name name;
+ name.length(1);
+ name[0].id=CORBA::string_dup("Logger");
+ PortableServer::POAManager_var pman;
+ for (int i = 1; i<=NumberOfTries; i++){
+ if (i!=1)
+ a=nanosleep(&ts_req,&ts_rem);
+ try
+ {
obj = orb->resolve_initial_references("RootPOA");
if(!CORBA::is_nil(obj))
- poa = PortableServer::POA::_narrow(obj);
+ poa = PortableServer::POA::_narrow(obj);
if(!CORBA::is_nil(poa))
- pman = poa->the_POAManager();
- if(!CORBA::is_nil(orb))
- theObj = orb->resolve_initial_references("NameService");
+ pman = poa->the_POAManager();
+ if(!CORBA::is_nil(orb))
+ theObj = orb->resolve_initial_references("NameService");
if (!CORBA::is_nil(theObj))
inc = CosNaming::NamingContext::_narrow(theObj);
- }
- catch( CORBA::COMM_FAILURE& )
- {
- MESSAGE( "Session Server: CORBA::COMM_FAILURE: Unable to contact the Naming Service" )
- }
- if(!CORBA::is_nil(inc)) {
- MESSAGE( "Session Server: Naming Service was found" )
- if(EnvL==1){
- for(int j=1; j<=NumberOfTries; j++){
- if (j!=1)
- a=nanosleep(&ts_req, &ts_rem);
- try{
- object = inc->resolve(name);
- }
- catch(CosNaming::NamingContext::NotFound){ MESSAGE( "Session Server: Logger Server wasn't found" ) }
- catch(...){ MESSAGE( "Session Server: Unknown exception" ) }
- if (!CORBA::is_nil(object))
- log = SALOME_Logger::Logger::_narrow(object);
- if (!CORBA::is_nil(log)){
- MESSAGE( "Session Server: Loger Server was found" )
- log->ping();
- SESSION=1;
- break;
- }
- }}
}
- if ((SESSION==1)||((EnvL==0)&&(!CORBA::is_nil(inc))))
- break;
+ catch( CORBA::COMM_FAILURE& )
+ {
+ MESSAGE( "Session Server: CORBA::COMM_FAILURE: Unable to contact the Naming Service" );
+ }
+ if(!CORBA::is_nil(inc))
+ {
+ MESSAGE( "Session Server: Naming Service was found" );
+ if(EnvL==1)
+ {
+ for(int j=1; j<=NumberOfTries; j++)
+ {
+ if (j!=1)
+ a=nanosleep(&ts_req, &ts_rem);
+ try
+ {
+ object = inc->resolve(name);
+ }
+ catch(CosNaming::NamingContext::NotFound)
+ { MESSAGE( "Session Server: Logger Server wasn't found" );
+ }
+ catch(...)
+ {
+ MESSAGE( "Session Server: Unknown exception" );
+ }
+ if (!CORBA::is_nil(object))
+ {
+ MESSAGE( "Session Server: Loger Server was found" );
+ SESSION=1;
+ break;
+ }
+ }
}
- //
+ }
+ if ((SESSION==1)||((EnvL==0)&&(!CORBA::is_nil(inc))))
+ break;
+ }
- // servant
- SALOME_Session_i * mySALOME_Session = new SALOME_Session_i(argc, argv, orb, poa) ;
- PortableServer::ObjectId_var mySALOME_Sessionid = poa->activate_object(mySALOME_Session) ;
- MESSAGE("poa->activate_object(mySALOME_Session)")
+ // servant
+ SALOME_Session_i * mySALOME_Session = new SALOME_Session_i(argc, argv, orb, poa) ;
+ PortableServer::ObjectId_var mySALOME_Sessionid = poa->activate_object(mySALOME_Session) ;
+ MESSAGE("poa->activate_object(mySALOME_Session)")
- obj = mySALOME_Session->_this() ;
- CORBA::String_var sior(orb->object_to_string(obj)) ;
+ obj = mySALOME_Session->_this() ;
+ CORBA::String_var sior(orb->object_to_string(obj)) ;
- mySALOME_Session->NSregister();
+ mySALOME_Session->NSregister();
- mySALOME_Session->_remove_ref() ;
+ mySALOME_Session->_remove_ref() ;
- //DECOMMENT PortableServer::POAManager_var pman = poa->the_POAManager() ;
- pman->activate() ;
- MESSAGE("pman->activate()")
+ //DECOMMENT PortableServer::POAManager_var pman = poa->the_POAManager() ;
+ pman->activate() ;
+ MESSAGE("pman->activate()")
- orb->run() ;
- orb->destroy() ;
+ orb->run() ;
+ orb->destroy() ;
}
- catch (CORBA::SystemException&)
+ catch (CORBA::SystemException&)
{
- INFOS("Caught CORBA::SystemException.")
+ INFOS("Caught CORBA::SystemException.");
}
- catch (CORBA::Exception&)
+ catch (CORBA::Exception&)
{
- INFOS("Caught CORBA::Exception.")
+ INFOS("Caught CORBA::Exception.");
}
- catch (...)
+ catch (...)
{
- INFOS("Caught unknown exception.")
+ INFOS("Caught unknown exception.");
}
return 0 ;
}
{
_argc = argc ;
_argv = argv ;
- _IAPPThread = new SALOME_Session_QThread(_argc, _argv) ;
+ _IAPPThread = SALOME_Session_QThread::Instance(_argc, _argv);
_isGUI = FALSE ;
_runningStudies= 0 ;
_orb = CORBA::ORB::_duplicate(orb) ;
SALOME::StatSession SALOME_Session_i::GetStatSession()
{
// update Session state
+ //qApp->lock(); // rollback bug
_GUIMutex.lock();
_isGUI = _IAPPThread->running();
_runningStudies = 0;
qApp->unlock();
}
_GUIMutex.unlock();
+ //qApp->unlock();
// getting stat info
SALOME::StatSession_var myStats = new SALOME::StatSession ;
if (_runningStudies)
CPPFLAGS+=$(OCC_INCLUDES) $(HDF5_INCLUDES)
CXXFLAGS+=$(OCC_CXXFLAGS)
-LDFLAGS+= -lOpUtil -lSalomeLoggerServer $(CAS_LDPATH) -lTKernel
+LDFLAGS+= -lOpUtil $(CAS_LDPATH) -lTKernel
@CONCLUDE@
//
// File : ToolsGUI_CatalogGeneratorDlg.cxx
// Author : Nicolas REJNERI
+// Modified : Marc TAJCHMAN
// Module : SALOME
// $Header$
#include "QAD_Desktop.h"
#include "QAD_FileDlg.h"
#include "QAD_MessageBox.h"
+#include "QAD_Tools.h"
#include <stdlib.h>
#include <qlabel.h>
#include <qlineedit.h>
supplGrpLayout->setSpacing( SPACING_SIZE );
supplGrpLayout->setMargin( MARGIN_SIZE );
+ QSize myMinimumSize(int(MIN_EDIT_SIZE*0.3), 0);
+
myAuthorEdit = new QLineEdit( supplGrp , "myAuthorEdit" );
myAuthorEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- myAuthorEdit->setMinimumSize( MIN_EDIT_SIZE*0.3, 0 );
+ myAuthorEdit->setMinimumSize( myMinimumSize );
OSD_Process aProcess;
myAuthorEdit->setText(aProcess.UserName().ToCString());
myVersionEdit = new QLineEdit(supplGrp , "myVersion" );
myVersionEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- myVersionEdit->setMinimumSize( MIN_EDIT_SIZE*0.3, 0 );
+ myVersionEdit->setMinimumSize( myMinimumSize );
QStringList aList = QStringList::split(QRegExp("\\s+"),tr( "INF_VERSION" ));
myVersionEdit->setText(aList.last());
QDoubleValidator *validator = new QDoubleValidator(myVersionEdit);
myCompName = new QLineEdit(supplGrp , "myCompName");
myCompName->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- myCompName->setMinimumSize( MIN_EDIT_SIZE*0.3, 0 );
+ myCompName->setMinimumSize( myMinimumSize );
+
+ myCompUserName = new QLineEdit(supplGrp , "myCompUserName");
+ myCompUserName->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ myCompUserName->setMinimumSize( MIN_EDIT_SIZE*0.3, 0 );
myCompType = new QLineEdit(supplGrp , "myCompType");
myCompType->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- myCompType->setMinimumSize( MIN_EDIT_SIZE*0.3, 0 );
+ myCompType->setMinimumSize( myMinimumSize );
myCompType->setText("OTHER");
myCompMultiStd = new QLineEdit(supplGrp , "myCompMultiStd");
myCompMultiStd->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- myCompMultiStd->setMinimumSize( MIN_EDIT_SIZE*0.3, 0 );
+ myCompMultiStd->setMinimumSize( myMinimumSize );
myCompMultiStd->setText("1");
QIntValidator *ivalidator = new QIntValidator(myVersionEdit);
myCompMultiStd->setValidator(ivalidator);
supplGrpLayout->addWidget( myAuthorEdit, 0, 1 );
supplGrpLayout->addWidget( new QLabel( tr( "TOOLS_COMP_NAME" ), supplGrp ), 0, 2);
supplGrpLayout->addWidget(myCompName,0,3);
- supplGrpLayout->addWidget( new QLabel( tr( "TOOLS_COMP_TYPE" ), supplGrp ), 0, 4);
- supplGrpLayout->addWidget(myCompType,0,5);
+ supplGrpLayout->addWidget( new QLabel( tr( "TOOLS_COMP_USERNAME" ), supplGrp ), 0, 4);
+ supplGrpLayout->addWidget(myCompUserName,0,5);
supplGrpLayout->addWidget( new QLabel( tr( "TOOLS_VERSION" ), supplGrp ), 1, 0);
supplGrpLayout->addWidget( myVersionEdit, 1, 1);
supplGrpLayout->addWidget( new QLabel( tr( "TOOLS_COMP_MULTISTD" ), supplGrp ), 1, 2);
supplGrpLayout->addWidget(myCompMultiStd,1,3);
+ supplGrpLayout->addWidget( new QLabel( tr( "TOOLS_COMP_TYPE" ), supplGrp ), 1, 4);
+ supplGrpLayout->addWidget(myCompType,1,5);
supplGrpLayout->addWidget( new QLabel( tr( "TOOLS_PNG_FILE" ), supplGrp ), 2, 0);
supplGrpLayout->addMultiCellWidget( myPngEdit, 2,2,1,4 );
supplGrpLayout->addWidget( myBrowsePngBtn, 2, 5 );
return myCompName->text().stripWhiteSpace();
}
+//=================================================================================
+// function : getCompUserName()
+// purpose : gets username of the component
+//=================================================================================
+QString ToolsGUI_CatalogGeneratorDlg::getCompUserName()
+{
+ return myCompUserName->text().stripWhiteSpace();
+}
+
//=================================================================================
// function : getCompType()
// purpose : gets type of the component
return myCompType->text().stripWhiteSpace();
}
+//=================================================================================
+// function : getIdlPath()
+// purpose : gets IDL path of modules
+//=================================================================================
+QString ToolsGUI_CatalogGeneratorDlg::getIdlPath()
+{
+ SALOME_ModuleCatalog::ModuleCatalog_var aCatalog =
+ SALOME_ModuleCatalog::ModuleCatalog::_narrow( QAD_Application::getDesktop()->getCatalogue());
+
+ SALOME_ModuleCatalog::ListOfIAPP_Affich_var list_composants =
+ aCatalog->GetComponentIconeList();
+
+ QString IDLpath = "";
+
+ for (unsigned int ind = 0; ind < list_composants->length();ind++) {
+ QString modulename = strdup(list_composants[ind].modulename) ;
+
+ QCString dir;
+ if (dir = getenv( modulename + "_ROOT_DIR")) {
+ IDLpath = IDLpath + "-I" + QAD_Tools::addSlash( QAD_Tools::addSlash(dir) +
+ QAD_Tools::addSlash("idl") +
+ QAD_Tools::addSlash("salome")) + " ";
+ }
+ }
+
+ // MESSAGE ( " IDLpath = " << IDLpath);
+
+ return IDLpath;
+}
+
//=================================================================================
// function : onBrowseBtnClicked()
// purpose : <...> (Browse) buttons slot
//=================================================================================
void ToolsGUI_CatalogGeneratorDlg::onApply()
{
+ QString IDLpath = getIdlPath();
QString XmlFile = getXmlFile();
QString IdlFile = getIdlFile();
QString Author = getAuthor();
QString Version = getVersion();
QString PngFile = getPngFile();
QString CompName = getCompName(); //gets component name
+ QString CompUserName = getCompUserName(); //gets component username
QString CompType = getCompType(); //gets component type
QString CompMultiStd = getCompMultiStd();
else {
QString command = "";
if ( getenv("KERNEL_ROOT_DIR") )
- command = QString( getenv( "KERNEL_ROOT_DIR" ) ) + "/bin/runIDLparser -Wbcatalog=" + XmlFile;
+ command = QString( getenv( "KERNEL_ROOT_DIR" ) ) + "/bin/salome/runIDLparser " + IDLpath + " -Wbcatalog=" + XmlFile;
else {
QAD_MessageBox::error1( this,
tr("TOOLS_ERR_ERROR"),
tr("KERNEL_ROOT_DIR variable is not defined"),
tr("TOOLS_BUT_OK") );
}
+
if (!Author.isEmpty()) command += ",author=" + Author;
if (!Version.isEmpty()) command += ",version=" + Version;
if (!PngFile.isEmpty()) {
command += QString(",icon=") + QString(aFile.ToCString());
}
if (!CompName.isEmpty()) command += ",name=" + CompName;
+ if (!CompUserName.isEmpty()) command += ",username=" + CompUserName;
if (!CompType.isEmpty()) command += ",type=" + CompType;
if (!CompMultiStd.isEmpty()) command += ",multistudy=" + CompMultiStd;
command += " " + IdlFile;
ToolsGUI_CatalogGeneratorDlg( QWidget* parent = 0, const char* name = 0 );
~ToolsGUI_CatalogGeneratorDlg();
+ QString getIdlPath();
QString getIdlFile();
QString getXmlFile();
QString getPngFile();
QString getAuthor();
QString getVersion();
QString getCompName();
+ QString getCompUserName();
QString getCompType();
QString getCompMultiStd();
QLineEdit* myVersionEdit;
QLineEdit* myAuthorEdit;
QLineEdit* myCompName;
+ QLineEdit* myCompUserName;
QLineEdit* myCompType;
QLineEdit* myCompMultiStd;
QPushButton* myBrowseIdlBtn;
msgid "ToolsGUI_CatalogGeneratorDlg::TOOLS_COMP_NAME"
msgstr "Name : "
+msgid "ToolsGUI_CatalogGeneratorDlg::TOOLS_COMP_USERNAME"
+msgstr "UserName : "
+
msgid "ToolsGUI_CatalogGeneratorDlg::TOOLS_COMP_TYPE"
msgstr "Type : "
BIN = TestContainer TestLogger
BIN_SRC =
-LDFLAGS+= -lSalomeNotification -lSalomeNS -lSalomeContainer -lRegistry -lOpUtil -lSalomeLoggerServer
+LDFLAGS+= -lSalomeNotification -lSalomeNS -lSalomeContainer -lRegistry -lOpUtil -lSALOMELocalTrace
@CONCLUDE@
// Module : SALOME
// $Header$
-using namespace std;
#include "utilities.h"
#include <iostream>
#include <unistd.h>
#include "SALOME_NamingService.hxx"
#include "OpUtil.hxx"
-# include "Utils_ORB_INIT.hxx"
-# include "Utils_SINGLETON.hxx"
-# include "Utils_SALOME_Exception.hxx"
-# include "Utils_CommException.hxx"
+#include "Utils_ORB_INIT.hxx"
+#include "Utils_SINGLETON.hxx"
+#include "Utils_SALOME_Exception.hxx"
+#include "Utils_CommException.hxx"
+using namespace std;
+
int main (int argc, char * argv[])
{
// Obtain a reference to the root POA
//
- long TIMESleep = 250000000;
- int NumberOfTries = 40;
- int a;
- timespec ts_req;
- ts_req.tv_nsec=TIMESleep;
- ts_req.tv_sec=0;
- timespec ts_rem;
- ts_rem.tv_nsec=0;
- ts_rem.tv_sec=0;
- CosNaming::NamingContext_var inc;
- PortableServer::POA_var poa;
- CORBA::Object_var theObj;
- CORBA::Object_var obj;
- CORBA::Object_var object;
- SALOME_Logger::Logger_var log;
- SALOME_NamingService &naming = *SINGLETON_<SALOME_NamingService>::Instance() ;
- int TEST_CONTAINER=0;
- const char * Env = getenv("USE_LOGGER");
+ long TIMESleep = 250000000;
+ int NumberOfTries = 40;
+ int a;
+ timespec ts_req;
+ ts_req.tv_nsec=TIMESleep;
+ ts_req.tv_sec=0;
+ timespec ts_rem;
+ ts_rem.tv_nsec=0;
+ ts_rem.tv_sec=0;
+ CosNaming::NamingContext_var inc;
+ PortableServer::POA_var poa;
+ CORBA::Object_var theObj;
+ CORBA::Object_var obj;
+ CORBA::Object_var object;
+ SALOME_NamingService &naming = *SINGLETON_<SALOME_NamingService>::Instance() ;
+ int TEST_CONTAINER=0;
+ const char * Env = getenv("USE_LOGGER");
int EnvL =0;
if ((Env!=NULL) && (strlen(Env)))
EnvL=1;
CosNaming::Name name;
name.length(1);
name[0].id=CORBA::string_dup("Logger");
- PortableServer::POAManager_var manager;
- for (int i = 1; i<=NumberOfTries; i++){
- if (i!=1)
- a=nanosleep(&ts_req,&ts_rem);
- try{
- obj = orb->resolve_initial_references("RootPOA");
- if(!CORBA::is_nil(obj))
- poa = PortableServer::POA::_narrow(obj);
- if(!CORBA::is_nil(poa))
- manager = poa->the_POAManager();
- if(!CORBA::is_nil(orb))
- theObj = orb->resolve_initial_references("NameService");
- if (!CORBA::is_nil(theObj))
- inc = CosNaming::NamingContext::_narrow(theObj);
- }
- catch( CORBA::COMM_FAILURE& )
- {
- MESSAGE( "Test Container: CORBA::COMM_FAILURE: Unable to contact the Naming Service" )
- }
- if(!CORBA::is_nil(inc)) {
- MESSAGE( "Test Container: Naming Service was found" )
- if(EnvL==1){
- for(int j=1; j<=NumberOfTries; j++){
- if (j!=1)
- a=nanosleep(&ts_req, &ts_rem);
- try{
- object = inc->resolve(name);
- }
- catch(CosNaming::NamingContext::NotFound){ MESSAGE( "Test Container: Logger Server wasn't found" ) }
- catch(...){ MESSAGE( "Test Container: Unknown exception" ) }
- if (!CORBA::is_nil(object))
- log = SALOME_Logger::Logger::_narrow(object);
- if (!CORBA::is_nil(log)){
- MESSAGE( "Test Container: Loger Server was found" )
- log->ping();
- TEST_CONTAINER=1;
- break;
+ PortableServer::POAManager_var manager;
+ for (int i = 1; i<=NumberOfTries; i++)
+ {
+ if (i!=1)
+ a=nanosleep(&ts_req,&ts_rem);
+ try
+ {
+ obj = orb->resolve_initial_references("RootPOA");
+ if(!CORBA::is_nil(obj))
+ poa = PortableServer::POA::_narrow(obj);
+ if(!CORBA::is_nil(poa))
+ manager = poa->the_POAManager();
+ if(!CORBA::is_nil(orb))
+ theObj = orb->resolve_initial_references("NameService");
+ if (!CORBA::is_nil(theObj))
+ inc = CosNaming::NamingContext::_narrow(theObj);
+ }
+ catch( CORBA::COMM_FAILURE& )
+ {
+ MESSAGE( "Test Container: CORBA::COMM_FAILURE: Unable to contact the Naming Service" )
+ }
+ if(!CORBA::is_nil(inc))
+ {
+ MESSAGE( "Test Container: Naming Service was found" )
+ if(EnvL==1)
+ {
+ for(int j=1; j<=NumberOfTries; j++)
+ {
+ if (j!=1)
+ a=nanosleep(&ts_req, &ts_rem);
+ try
+ {
+ object = inc->resolve(name);
+ }
+ catch(CosNaming::NamingContext::NotFound)
+ {
+ MESSAGE( "Test Container: Logger Server wasn't found" );
+ }
+ catch(...)
+ {
+ MESSAGE( "Test Container: Unknown exception" );
+ }
+ if (!CORBA::is_nil(object))
+ {
+ MESSAGE( "Test Container: Loger Server was found" );
+ TEST_CONTAINER=1;
+ break;
+ }
+ }
}
- }}
- }
+ }
if ((TEST_CONTAINER==1)||((EnvL==0)&&(!CORBA::is_nil(inc))))
break;
- }
- //
+ }
+
// Use Name Service to find container
SALOME_NamingService _NS(orb) ;
string containerName = "/Containers/" ;
Utils_Identity.cxx Utils_ORB_INIT.cxx \
Utils_DESTRUCTEUR_GENERIQUE.cxx
-LDFLAGS+= -lSalomeLoggerServer
+LDFLAGS+=
@CONCLUDE@
ATEXIT_( void )
{
ASSERT (Destructeurs==0);
+ MESSAGE("Construction ATEXIT"); // message necessaire pour utiliser logger dans Nettoyage (cf.BUG KERNEL4561)
Destructeurs = new list<DESTRUCTEUR_GENERIQUE_*> ; // Destructeurs alloué dynamiquement (cf. ci-dessous) ,
// il est utilisé puis détruit par la fonction Nettoyage
int cr = atexit( Nettoyage ); // exécute Nettoyage lors de exit, après la destruction des données statiques !
SALOME_Exception::SALOME_Exception( void ): exception() , _text(0)
{
- MESSAGE( "You must user the standard builder : SALOME_Exception::SALOME_Exception( const char *text )" ) ;
+ MESSAGE( "You must use the standard builder: SALOME_Exception::SALOME_Exception( const char *text )" ) ;
INTERRUPTION(1) ;
}
{
if ( ! PtrSingleton )
{
- MESSAGE("SINGLETON_<TYPE>::Instance( void )") ;
+ //MESSAGE("SINGLETON_<TYPE>::Instance( void )") ;
PtrSingleton = new SINGLETON_<TYPE> ;
new DESTRUCTEUR_DE_<TYPE>( PtrSingleton->_Instance ) ;
}
template <class TYPE> SINGLETON_<TYPE>::SINGLETON_( void )
{
- MESSAGE("CREATION d'un SINGLETON_") ;
+ //MESSAGE("CREATION d'un SINGLETON_") ;
}
/* --- Definition macros file to print informations if _DEBUG_ is defined --- */
-# ifndef UTILITIES_H
-# define UTILITIES_H
+#ifndef UTILITIES_H
+#define UTILITIES_H
-# include <stdlib.h>
-# include <iostream>
-
-
-
-//VRV: T2.4 - replacement macro for using special CORBA server
-#include "SALOME_Trace.hxx"
-//VRV: T2.4 - replacement macro for using special CORBA server
+#include <string>
+#include <iostream>
+#include "SALOME_Log.hxx"
/* --- INFOS is always defined (without _DEBUG_): to be used for warnings, with release version --- */
-//VRV: T2.4 - replacement of these macros for using special CORBA server
-
-#define INFOS(msg) { GLogger.putMessage(GLogger << __FILE__<< " [" << __LINE__ << "] : " << msg<< endl << ends ); }
-#define PYSCRIPT(msg) { GLogger.putMessage(GLogger<<"---PYSCRIPT--- "<<msg<<endl<<ends ); }
+#define INFOS(msg) {SLog->putMessage(*SLog<<__FILE__<<" ["<<__LINE__<<"] : "<<msg<<endl);}
+#define PYSCRIPT(msg) {SLog->putMessage(*SLog<<"---PYSCRIPT--- "<<msg<<endl);}
-//# define HEREWEARE {cout<<flush ; cerr << __FILE__ << " [" << __LINE__ << "] : " << flush ;}
-//# define INFOS(chain) {HEREWEARE ; cerr << chain << endl ;}
-//# define PYSCRIPT(chain) {cout<<flush ; cerr << "---PYSCRIPT--- " << chain << endl ;}
+/* --- To print date and time of compilation of current source --- */
-//VRV: T2.4 - replacement of these macros for using special CORBA server
+#if defined ( __GNUC__ )
+#define COMPILER "g++"
+#elif defined ( __sun )
+#define COMPILER "CC"
+#elif defined ( __KCC )
+#define COMPILER "KCC"
+#elif defined ( __PGI )
+#define COMPILER "pgCC"
+#else
+#define COMPILER "undefined"
+#endif
+#ifdef INFOS_COMPILATION
+#error INFOS_COMPILATION already defined
+#endif
-/* --- To print date and time of compilation of current source on stdout --- */
-
-# if defined ( __GNUC__ )
-# define COMPILER "g++"
-# elif defined ( __sun )
-# define COMPILER "CC"
-# elif defined ( __KCC )
-# define COMPILER "KCC"
-# elif defined ( __PGI )
-# define COMPILER "pgCC"
-# else
-# define COMPILER "undefined"
-# endif
-
-# ifdef INFOS_COMPILATION
-# error INFOS_COMPILATION already defined
-# endif
-
-//VRV: T2.4 - replacement macro for using special CORBA server
#define INFOS_COMPILATION { \
- GLogger.putMessage(\
- GLogger << __FILE__ << " [" << __LINE__ << "] : "\
- << "COMPILED with " << COMPILER \
- << ", " << __DATE__ \
- << " at " << __TIME__ << endl << endl <<endl<<ends); }
-/* # define INFOS_COMPILATION {\ */
-/* cerr << flush;\ */
-/* cout << __FILE__ ;\ */
-/* cout << " [" << __LINE__ << "] : " ;\ */
-/* cout << "COMPILED with " << COMPILER ;\ */
-/* cout << ", " << __DATE__ ; \ */
-/* cout << " at " << __TIME__ << endl ;\ */
-/* cout << "\n\n" ;\ */
-/* cout << flush ;\ */
-/* } */
-//VRV: T2.4 - replacement macro for using special CORBA server
-
-# ifdef _DEBUG_
+ SLog->putMessage(\
+ *SLog<<__FILE__<<" ["<< __LINE__<<"] : "\
+ << "COMPILED with " << COMPILER \
+ << ", " << __DATE__ \
+ << " at " << __TIME__ <<endl); }
-/* --- the following MACROS are useful at debug time --- */
+#ifdef _DEBUG_
-//VRV: T2.4 - replacement of these macros for using special CORBA server
-
-#define MYTRACE GLogger << "- Trace " << __FILE__ << " [" << __LINE__ << "] : "
-
-#define MESSAGE(msg) { GLogger.putMessage( MYTRACE <<msg<<endl<<ends); }
-#define SCRUTE(var) { GLogger.putMessage( MYTRACE << #var << "=" << var <<endl<<ends); }
-
-#define REPERE GLogger << " --------------" << endl
-#define BEGIN_OF(msg) {REPERE ; MYTRACE << "Begin of: " << msg << endl ; REPERE ; GLogger.putMessage(GLogger<<ends); }
-#define END_OF(msg) {REPERE ; MYTRACE << "Normal end of: " << msg << endl ; REPERE ; GLogger.putMessage(GLogger<<ends); }
-
-# define HERE {cout<<flush ; cerr << "- Trace " << __FILE__ << " [" << __LINE__ << "] : " << flush ;}
-
-//VRV: T2.4 - replacement of these macros for using special CORBA server
-
-# define INTERRUPTION(code) {HERE ; cerr << "INTERRUPTION return code= " << code << endl ; exit(code) ;}
+/* --- the following MACROS are useful at debug time --- */
-# ifndef ASSERT
-# define ASSERT(condition) if (!(condition)){ HERE ; cerr << "CONDITION " << #condition << " NOT VERIFIED"<< endl ; INTERRUPTION(1) ;}
-# endif /* ASSERT */
+#define MYTRACE *SLog << "- Trace " << __FILE__ << " [" << __LINE__ << "] : "
+#define MESSAGE(msg) {SLog->putMessage( MYTRACE <<msg<<endl<<ends); }
+#define SCRUTE(var) {SLog->putMessage( MYTRACE << #var << "=" << var <<endl<<ends); }
+#define REPERE *SLog << " --------------" << endl
+#define BEGIN_OF(msg) {REPERE;MYTRACE<<"Begin of: " <<msg<<endl;REPERE;}
+#define END_OF(msg) {REPERE;MYTRACE<<"Normal end of: "<<msg<<endl;REPERE;}
+#define HERE {cout<<flush ;cerr<<"- Trace "<<__FILE__<<" ["<<__LINE__<<"] : "<<flush ;}
+#define INTERRUPTION(code) {HERE;cerr<<"INTERRUPTION return code= "<<code<< endl;exit(code);}
+#ifndef ASSERT
+#define ASSERT(condition) \
+ if (!(condition)){HERE;cerr<<"CONDITION "<<#condition<<" NOT VERIFIED"<<endl;INTERRUPTION(1);}
+#endif /* ASSERT */
-# else /* ifdef _DEBUG_*/
+#else /* ifdef _DEBUG_*/
#define HERE
#define SCRUTE(var) {}
#define BEGIN_OF(msg) {}
#define END_OF(msg) {}
-# define INTERRUPTION(code) {}
+#define INTERRUPTION(code) {}
-# ifndef ASSERT
-# define ASSERT(condition) {}
-# endif /* ASSERT */
+#ifndef ASSERT
+#define ASSERT(condition) {}
+#endif /* ASSERT */
-# endif /* ifdef _DEBUG_*/
+#endif /* ifdef _DEBUG_*/
-# endif /* ifndef UTILITIES_H */
+#endif /* ifndef UTILITIES_H */
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 \
// 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"
#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();
}
//----------------------------------------------------------------------------
-void VTKViewer_InteractorStyleSALOME::setTriedron( vtkActorCollection* triedron )
-{
- m_Triedron = triedron;
+void VTKViewer_InteractorStyleSALOME::setTriedron(VTKViewer_Trihedron* theTrihedron){
+ m_Trihedron = theTrihedron;
}
//----------------------------------------------------------------------------
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();
}
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
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)
{
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()
{
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();
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;
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;
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:
{
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:
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") ) {
}
} 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) {
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)){
}
break;
}
+ if (myGUIWindow) myGUIWindow->update();
+
}
// called during viewer operation when user moves mouse (!put necessary processing here!)
// 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());
#include <qcursor.h>
#include "SALOME_Actor.h"
+class VTKViewer_Trihedron;
#define VTK_INTERACTOR_STYLE_CAMERA_NONE 0
#define VTK_INTERACTOR_STYLE_CAMERA_ROTATE 1
// programmers.
static VTKViewer_InteractorStyleSALOME *New();
- void setTriedron( vtkActorCollection* triedron );
+ void setTriedron(VTKViewer_Trihedron* theTrihedron);
vtkTypeMacro(VTKViewer_InteractorStyleSALOME, vtkObject);
void PrintSelf(ostream& os, vtkIndent indent);
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();
bool myCursorState;
bool myShiftState;
int ForcedState;
- vtkActorCollection* m_Triedron;
+ VTKViewer_Trihedron* m_Trihedron;
QWidget* myGUIWindow;
#include <vtkRenderWindowInteractor.h>
#include <vtkRendererCollection.h>
#include <vtkXOpenGLRenderWindow.h>
+#include <vtkCamera.h>
//#include <GL/gl.h>
//#include <GL/glu.h>
myRW->SetDisplayId((void*)x11Display());
myRW->SetWindowId((void*)winId());
myRW->DoubleBufferOn();
+ setMouseTracking(true);
}
VTKViewer_RenderWindow::~VTKViewer_RenderWindow() {
}
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);
+ }
+ }
}
// Module : SALOME
// $Header$
-using namespace std;
#include "VTKViewer_RenderWindowInteractor.h"
#include "VTKViewer_RenderWindow.h"
#include "VTKViewer_InteractorStyleSALOME.h"
#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 ) {
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();
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;
}
}
-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;
}
#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
static VTKViewer_RenderWindowInteractor *New() ;
- vtkTypeMacro(vtkRenderWindowInteractor,vtkObject);
+ vtkTypeMacro(VTKViewer_RenderWindowInteractor,vtkRenderWindowInteractor);
void PrintSelf(ostream& os, vtkIndent indent);
// 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
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
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) ;
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() ;
#endif
+
// $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"
#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
*/
{
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);
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);
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);
}
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();
}
/*!
}
-void VTKViewer_ViewFrame::Repaint()
+void VTKViewer_ViewFrame::Repaint(bool theUpdateTrihedron)
{
- // m_RWInteractor->Render();
+ if (theUpdateTrihedron) onAdjustTrihedron();
m_RW->update();
}
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();
}
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();
}
// VTK Includes
class vtkRenderer;
-class vtkActorCollection;
class vtkTransform;
+class VTKViewer_Trihedron;
class QAD_EXPORT VTKViewer_ViewFrame : public QAD_ViewFrame{
Q_OBJECT;
VTKViewer_RenderWindowInteractor* getRWInteractor() {return m_RWInteractor;}
bool isTrihedronDisplayed();
- void SetTrihedronSize( int dim );
-
+
void setBackgroundColor( const QColor& );
QColor backgroundColor() const;
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]);
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();
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