@COMMENCE@
-SUBDIRS = idl src salome_adm
+SUBDIRS = idl src examples salome_adm
RESOURCES_FILES = \
back.xpm \
-THIS IS SALOME PRO - KERNEL VERSION: 1.2
+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
-export KERNEL_ROOT_DIR=/Salome2/KERNEL_install
-
-export GEOM_ROOT_DIR=/Salome2/GEOM_install
-export MED_ROOT_DIR=/Salome2/MED_install
-export SMESH_ROOT_DIR=/Salome2/SMESH_install
-export SUPERV_ROOT_DIR=/Salome2/SUPERV_install
-export VISU_ROOT_DIR=/Salome2/VISU_install
-
-python -i runSalome.py --gui --modules=GEOM,SMESH,VISU,SUPERV,MED --xterm --containers=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"]
#
# Lancement Session Loader
#
- SessionLoader().run()
+ if with_gui:
+ SessionLoader().run()
#
# Initialisation ORB et Naming Service
import SALOME
session=clt.waitNS("/Kernel/Session",SALOME.Session)
+ if os.getenv("HOSTNAME") == None:
+ if os.getenv("HOST") == None:
+ os.environ["HOSTNAME"]="localhost"
+ else:
+ os.environ["HOSTNAME"]=os.getenv("HOST")
+
+ 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")
#
dnl Library libdl :
AC_CHECK_LIB(dl,dlopen)
+dnl Library librt : for alpha/osf
+AC_CHECK_LIB(rt,nanosleep)
+
dnl add library libm :
AC_CHECK_LIB(m,ceil)
-
-# -* Makefile *-
+# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+#
#
-# Author : Patrick GOLDBRONN (CEA)
-# Date : 30/11/2001
-# $Header$
#
-# source path
+# File : Makefile.in
+# Author : Patrick GOLDBRONN (CEA)
+# Module : doc
+# $Header$
+
top_srcdir=@top_srcdir@
top_builddir=../..
srcdir=@srcdir@
<td bgcolor= "lightgreen"><div align="center"><b>void putMessage ( in string message )</b></div></td>
<td bgcolor= "lightgreen"><div align="center"><b>putMessage ( message )</b></div></td>
</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>void ping ( )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>ping ( )</b></div></td>
+</tr>
</table><br>
</b></HTML>
<td bgcolor= "lightgreen"><div align="center"><b>Save ( aStudy, theMultiFile )</b></div></td>
</tr>
<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>void SaveASCII ( in Study aStudy, in boolean theMultiFile )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>SaveASCII ( aStudy, theMultiFile )</b></div></td>
+</tr>
+<tr>
<td bgcolor= "lightgreen"><div align="center"><b>void SaveAs ( in URL aUrl, in Study aStudy, in boolean theMultiFile )</b></div></td>
<td bgcolor= "lightgreen"><div align="center"><b>SaveAs ( aUrl, aStudy, theMultiFile )</b></div></td>
</tr>
<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>void SaveAsASCII ( in URL aUrl, in Study aStudy, in boolean theMultiFile )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>SaveAsASCII ( aUrl, aStudy, theMultiFile )</b></div></td>
+</tr>
+<tr>
<td bgcolor= "lightgreen"><div align="center"><b>ListOfOpenStudies GetOpenStudies ( )</b></div></td>
<td bgcolor= "lightgreen"><div align="center"><b>return_value = GetOpenStudies ( )</b></div></td>
</tr>
<td bgcolor= "lightgreen"><div align="center"><b>return_value = Save ( theComponent, theURL, isMultiFile )</b></div></td>
</tr>
<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>TMPFile SaveASCII ( in SComponent theComponent, in string theURL, in boolean isMultiFile )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = SaveASCII ( theComponent, theURL, isMultiFile )</b></div></td>
+</tr>
+<tr>
<td bgcolor= "lightgreen"><div align="center"><b>boolean Load ( in SComponent theComponent, in TMPFile theStream, in string theURL, in boolean isMultiFile )</b></div></td>
<td bgcolor= "lightgreen"><div align="center"><b>return_value = Load ( theComponent, theStream, theURL, isMultiFile )</b></div></td>
</tr>
<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>boolean LoadASCII ( in SComponent theComponent, in TMPFile theStream, in string theURL, in boolean isMultiFile )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = LoadASCII ( theComponent, theStream, theURL, isMultiFile )</b></div></td>
+</tr>
+<tr>
<td bgcolor= "lightgreen"><div align="center"><b>void Close ( in SComponent aSComponent )</b></div></td>
<td bgcolor= "lightgreen"><div align="center"><b>Close ( aSComponent )</b></div></td>
</tr>
<td bgcolor= "lightgreen"><div align="center"><b>return_value = ComponentDataType ( )</b></div></td>
</tr>
<tr>
-<td bgcolor= "lightgreen"><div align="center"><b>string IORToLocalPersistentID ( in SObject theSObject, in string IORString, in boolean isMultiFile )</b></div></td>
-<td bgcolor= "lightgreen"><div align="center"><b>return_value = IORToLocalPersistentID ( theSObject, IORString, isMultiFile )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>string IORToLocalPersistentID ( in SObject theSObject, in string IORString, in boolean isMultiFile, in boolean isASCII )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = IORToLocalPersistentID ( theSObject, IORString, isMultiFile, isASCII )</b></div></td>
</tr>
<tr>
-<td bgcolor= "lightgreen"><div align="center"><b>string LocalPersistentIDToIOR ( in SObject theSObject, in string aLocalPersistentID, in boolean isMultiFile )</b></div></td>
-<td bgcolor= "lightgreen"><div align="center"><b>return_value = LocalPersistentIDToIOR ( theSObject, aLocalPersistentID, isMultiFile )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>string LocalPersistentIDToIOR ( in SObject theSObject, in string aLocalPersistentID, in boolean isMultiFile, in boolean isASCII )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = LocalPersistentIDToIOR ( theSObject, aLocalPersistentID, isMultiFile, isASCII )</b></div></td>
</tr>
<tr>
<td bgcolor= "lightgreen"><div align="center"><b>boolean CanPublishInStudy ( in Object theIOR )</b></div></td>
<td bgcolor= "lightgreen"><div align="center"><b>boolean Resume_impl ( )</b></div></td>
<td bgcolor= "lightgreen"><div align="center"><b>return_value = Resume_impl ( )</b></div></td>
</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>long CpuUsed_impl ( )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = CpuUsed_impl ( )</b></div></td>
+</tr>
</table><br>
</b></HTML>
<td bgcolor= "lightgreen"><div align="center"><b>GetInterface ( )</b></div></td>
</tr>
<tr>
-<td bgcolor= "lightgreen"><div align="center"><b>VISU_Gen GetVisuGen ( )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>Component GetVisuGen ( )</b></div></td>
<td bgcolor= "lightgreen"><div align="center"><b>return_value = GetVisuGen ( )</b></div></td>
</tr>
<tr>
#---------------------------------------------------------------------------
# General configuration options
#---------------------------------------------------------------------------
-PROJECT_NAME = "SALOME PRO v.1.2"
+PROJECT_NAME = "SALOME v.1.4.0"
PROJECT_NUMBER = id#1.1
OUTPUT_DIRECTORY = ../
OUTPUT_LANGUAGE = English
../../../share/salome/idl/SALOME_Exception.idl \
../../../share/salome/idl/SALOMEDS_Attributes.idl \
../../../share/salome/idl/SALOME_Session.idl \
- ../../../share/salome/idl/SALOME_Component.idl
+ ../../../share/salome/idl/SALOME_Component.idl \
+ ../../../share/salome/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx \
+ ../../../share/salome/src/NamingService/SALOME_NamingService.hxx \
+ ../../../share/salome/src/NamingService/SALOME_NamingService.cxx \
+ ../../../share/salome/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx
FILE_PATTERNS =
RECURSIVE = NO
EXCLUDE =
CHM_FILE =
HHC_LOCATION =
GENERATE_CHI = NO
-BINARY_TOC = NO
-TOC_EXPAND = NO
-DISABLE_INDEX = NO
+BINARY_TOC = YES
+TOC_EXPAND = YES
+DISABLE_INDEX = YES
ENUM_VALUES_PER_LINE = 4
-GENERATE_TREEVIEW = NO
+GENERATE_TREEVIEW = YES
TREEVIEW_WIDTH = 250
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
top_srcdir=@top_srcdir@
top_builddir=../..
+root_srcdir=@ROOT_SRCDIR@
srcdir=@srcdir@
VPATH=.:@srcdir@
doxygen=@DOXYGEN@
doc:
cp -fr $(srcdir)/INPUT ./; \
cd INPUT; \
- sed 's|../../../share/salome|../$(top_srcdir)|' doxyfile > doxyfile1; \
+ sed 's|../../../share/salome|$(root_srcdir)|' ./doxyfile > ./doxyfile1; \
mv -f doxyfile1 doxyfile; \
$(doxygen) ./doxyfile; \
cd ..; \
- cp -f $(srcdir)/INPUT/sources/doxygen.css ./html/doxygen.css
+ cp -fr $(srcdir)/INPUT/sources/static/*.* ./html/
cp -fr $(srcdir)/INPUT/sources/ html/
cp -fr $(srcdir)/INPUT/exemple/ html/
cp -fr $(srcdir)/INPUT/HTML/ html/
rm -rf INPUT
install:
+ $(INSTALL) -d $(docdir); \
cp -rf html $(docdir)
uninstall:
{
//put message into one special place for all servers using Logger
oneway void putMessage (in string message);
+ void ping ();
};
};
SALOME_MPIObject.idl \
SALOME_MPIContainer.idl \
SALOME_TestMPIComponent.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
-// 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
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// Author : Yves FRICAUD
// $Header$
-/*! \mainpage
+/*! \mainpage
\image html Application-About.png
-
-*/
-/*! \page page1 Mapping of IDL definitions to Python language.
-\section Intro Introduction
-%SALOME PRO is a distributed client/server application using the Common Object Request Broker Architecture (CORBA).
-CORBA architecture uses the Interface Definition Language (IDL), which specifies interfaces between CORBA objects. So with help of IDL
-CORBA's language independence is ensured . Because interfaces described in IDL can be mapped to the most of currently used programming languages, CORBA applications and components are thus
-independent of the language(s) used to implement them. In other words, a client written in C++ can communicate with a server written in Java, which in turn can communicate with
-another server written in COBOL, and so forth.
-
-One important thing to remember about IDL is that it is not an implementation language. That is, applications can't be written in IDL. The sole purpose of IDL is to define interfaces;
-providing implementations for these interfaces is performed using some other language.
-
-This page contains an abridged reference manual for mapping of IDL definitions to Python language. It will be useful for Python programmers who are not familiar
-with IDL language. All examples are taken from %SALOME PRO source files.
-The complete version of Python Language Mapping Specification can be found <A HREF="http://www.omg.org">here.</A>
-
-<BR><STRONG>CONTENTS:</STRONG>
-- \ref subsection1
-- \ref subsection2
-- \ref subsection3
-- \ref subsection4
-- \ref subsection5
-- \ref subsection6
-- \ref subsection7
-
-\subsection subsection1 Using Scoped Names
-
-Python implements a module concept that is similar to the IDL scoping mechanisms,
-except that it does not allow for nested modules. In addition, Python requires each
-object to be implemented in a module; globally visible objects are not supported.
-
-Because of these constraints, scoped names are translated into Python using the
-following rules:
-
-\95 An IDL module mapped into a Python module. Modules containing modules are
-mapped to packages (i.e., directories with an <STRONG>__init__</STRONG> module containing all
-definitions excluding the nested modules). An implementation can chose to map toplevel
-definitions (including the module CORBA) to modules in an implementationdefined
-package, to allow concurrent installations of different CORBA runtime
-libraries. In that case, the implementation must provide additional modules so that
-toplevel modules can be used without importing them from a package.
-
-\95 For all other scopes, a Python class is introduced that contains all the definitions
-inside this scope.
-
-\95 Other global definitions (except modules) appear in a module whose name is
-implementation dependent. Implementations are encouraged to use the name of the
-IDL file when defining the name of that module.
-
-For instance,
-
-\verbatim
-module SALOMEDS {
- interface StudyManager {
- void Close(in Study aStudy);
- };
-};
-\endverbatim
-
-would introduce a module SALOMEDS.py, which contains the following definitions:
-
-\verbatim
-# module SALOMEDS.py
-class StudyManager:
- def _Close(self,aStudy):
- pass #interfaces are discussed later
-\endverbatim
-
-To avoid conflicts, IDL names that are also Python identifiers are prefixed with an underscore (\91_\92).
-
-\subsection subsection2 Mapping for Template and Array Types
-
-Both the bounded and the unbounded string type of IDL are mapped to the Python
-string type. Wide strings are represented by an implementation-defined type with the
-following properties:
-
-\95 For the wide string X and the integer n, X[n] returns the nth character, which is a
-wide string of length 1.
-
-\95 len(X) returns the number of characters of wide string X.
-
-\95 CORBA.wstr(c) returns a wide character with the code point c in an
-implementation-defined encoding.
-
-\95 X+Y returns the concatenation of wide strings X and Y.
-
-\95 CORBA.word(CORBA.wstr(c)) == c
-
-The sequence template is mapped to sequence objects (e.g., tuples or lists).
-Applications should not assume that values of a sequence type are mutable. Sequences
-and arrays of octets and characters are mapped to the string type for efficiency reasons.
-
-For example, given the IDL definitions
-
-\verbatim
-module SALOMEDS {
- typedef sequence <string> StringSeq;
-
- interface AttributeTableOfInteger : GenericAttribute {
-
- void SetRowTitles(in StringSeq theTitles) raises(IncorrectArgumentLength);
- };
-};
-\endverbatim
-
-a client could invoke the operation
-
-\verbatim
-print My_AttributeTableOfInteger.SetRowTitles(["X","F"])
-\endverbatim
-
-Array types are mapped like sequence templates. The application in this example also expects an
-IncorrectArgumentLength exception if it passes sequences that violate the bounds constraint or
-arrays of wrong size.
-
-Another example with arrays. The following IDL definition
-
-\verbatim
-module SALOMEDS {
- typedef sequence<GenericAttribute> ListOfAttributes;
- interface SObject {
- ListOfAttributes GetAllAttributes();
- };
-};
-\endverbatim
-
-is equal to
-
-\verbatim
-import SALOMEDS
-
-attributes=[]
-
-attributes = My_SObject.GetAllAttributes()
-
-length = len(attributes)
-
-print "Attributes number = ", length
-print attributes
-\endverbatim
-
-\subsection subsection3 Mapping for Objects and Operations
-
-A CORBA object reference is represented as a Python object at run-time. This object
-provides all the operations that are available on the interface of the object. Although
-this specification does not mandate the use of classes for stub objects, the following
-discussion uses classes to indicate the interface.
-
-The nil object is represented by <STRONG>None</STRONG>.
-
-If an operation expects parameters of the IDL Object type, any Python object
-representing an object reference might be passed as actual argument.
-
-If an operation expects a parameter of an abstract interface, either an object
-implementing that interface, or a value supporting this interface may be passed as
-actual argument. The semantics of abstract values then define whether the argument is
-passed by value or by reference.
-
-Operations of an interface map to methods available on the object references.
-Parameters with a parameter attribute of <STRONG>in</STRONG> or <STRONG>inout</STRONG>
-are passed from left to right tothe method, skipping <STRONG>out</STRONG> parameters.
-The return value of a method depends on the number of <STRONG>out</STRONG> parameters
-and the return type. If the operation returns a value, this
-value forms the first <VAR>result value</VAR>. All <STRONG>inout</STRONG> or <STRONG>out</STRONG>
-parameters form consecutive <VAR>result values</VAR>. The method result depends then on the number
-of <VAR>result values</VAR>:
-
-\95 If there is no <VAR>result value</VAR>, the method returns None.
-
-\95 If there is exactly one <VAR>result value</VAR>, it is returned as a single value.
-
-\95 If there is more than one <VAR>result value</VAR>, all of them are packed into a tuple, and this
-tuple is returned.
-
-Assuming the IDL definition
-
-\verbatim
-module SALOMEDS{
- interface StudyBuilder{
- boolean FindAttribute ( in SObject anObject,
- out GenericAttribute anAttribute,
- in string aTypeOfAttribute );
- };
-};
-\endverbatim
-
-a client could write
-
-\verbatim
-from SALOMEDS import StudyBuilder;
-my_StudyBuilder=...
-
- res,A=my_StudyBuilder.FindAttribute(Sobj, "AttributeSequenceOfReal")
-\endverbatim
-
-In this example <STRONG>A</STRONG> corresponds to the return value <STRONG>anAttribute</STRONG> and
-<STRONG>res</STRONG> to the <STRONG>boolean</STRONG> return value.
-
-If an interface defines an <STRONG>attribute name</STRONG>, for example, the attribute is mapped into an
-operation <STRONG>_get_name</STRONG>. If the attribute is not <STRONG>readonly</STRONG>, there is an
-additional operation <STRONG>_set_name</STRONG>.
-
-The IDL definition
-
-\verbatim
-module SALOMEDS{
- interface Study{
- attribute string Name;
- };
-};
-\endverbatim
-
-is equal to the following
-
-\verbatim
-from SALOMEDS import Study
-My_Study=...
- Name=My_Study._get_name();
- Name=My_Study._set_name();
-\endverbatim
-
-\subsection subsection4 Narrowing Object References
-
-Python objects returned from CORBA operations or pseudo-operations (such as
-string_to_object) might have a dynamic type, which is more specific than the
-static type as defined in the operation signature.
-
-Since there is no efficient and reliable way of automatically creating the most specific
-type, explicit narrowing is necessary. To narrow an object reference <STRONG>A</STRONG> to an interface
-class <STRONG>AttributeSequenceOfReal</STRONG>, the client can use the following operation
-
-\verbatim
-A = A._narrow(SALOMEDS.AttributeSequenceOfReal)
-\endverbatim
-
-\subsection subsection5 Mapping for Exceptions
-
-An IDL exception is translated into a Python class derived from
-CORBA.UserException. System exceptions are derived from CORBA.SystemException.
-Both base classes are derived from CORBA.Exception. The parameters of the
-exception are mapped in the same way as the fields of a struct definition. When
-raising an exception, a new instance of the class is created; the constructor
-expects the exception parameters. For example, the definition
-
-\verbatim
-module SALOMEDS{
- interface StudyBuilder{
- exception LockProtection {};
- void CommitCommand() raises(LockProtection);
- };
-};
-\endverbatim
-
-could be used caught as
-
-\verbatim
-from SALOMEDS import StudyBuilder;
-my_StudyBuilder=...
-try:
- my_StudyBuilder.CommitCommand();
-except StudyBuilder.LockProtection,value:
- print "Error! Study is locked for modifications"
-\endverbatim
-
-
-\subsection subsection6 Mapping for Enumeration Types
-
-An enumeration is mapped into a number of constant objects in the name space where
-the enumeration is defined. An application may only test for equivalence of two
-enumeration values, and not assume that they behave like numbers.
-For example, the definition
-
-\verbatim
-module VISU {
- interface PrsObject{
-
- enum PrsObjType{ TCURVE, TTABLE, TMESH, TCONTAINER,
- TSCALARMAP, TISOSURFACE, TDEFORMEDSHAPE,
- TCUTPLANES, TVECTORS };
- };
-};
-\endverbatim
-
-introduces the objects
-
-\verbatim
-from VISU import PrsObject
-VISU.PrsObjType.TCURVE,VISU.PrsObjType.TTABLE,VISU.PrsObjType.TMESH,VISU.PrsObjType.TCONTAINER,
-VISU.PrsObjType.TSCALARMAP,VISU.PrsObjType.TISOSURFACE,VISU.PrsObjType.TDEFORMEDSHAPE,VISU.PrsObjType.TCUTPLANES,
-VISU.PrsObjType.TVECTORS
-\endverbatim
-
-\subsection subsection7 Mapping for Structured Types
-
-An IDL struct definition is mapped into a Python class or type. For each field in the
-struct, there is a corresponding attribute in the class with the same name as the field.
-The constructor of the class expects the field values, from left to right.
-For example, the IDL definition
-
-\verbatim
-struct SDate {
- short Second;
- short Minute;
- short Hour;
- short Day;
- short Month;
- short Year;
- };
-\endverbatim
-
-could be used in the Python statements
-
-\verbatim
-Date=SDate(30, 12, 15, 26, 1, 79)
-print Date.Second,Date.Minute,Date.Hour,Date.Day,Date.Month,Date.Year
-\endverbatim
-*/
-/*! \page page2 Mapping of SALOME IDL definitions to Python language.
-
-
- - <B>%SALOME STUDY module</B>
- - <A href=HTML/SALOMEDS.html>Mapping of %SALOMEDS functions</A>
- - <A href=HTML/SALOMEDS_Attributes.html>Mapping of SALOMEDS_Attributes functions</A>
- - <B>%SAlOME KERNEL module</B>
- - <A href=HTML/Med_Gen.html>Mapping of %Med_Gen functions</A>
- - <A href=HTML/SALOME_Session.html>Mapping of %SALOME_Session functions</A>
- - <A href=HTML/SALOME_ModuleCatalog.html>Mapping of %SALOME_ModuleCatalog functions</A>
- - <A href=HTML/SALOME_Exception.html>Mapping of %SALOME_Exception functions</A>
- - <A href=HTML/SALOME_Component.html>Mapping of %SALOME_Component functions</A>
- - <B>%SALOME MED component</B>
- - <A href=HTML/MED.html>Mapping of %Med functions</A>
- - <B>%SALOME SUPERVISION module</B>
- - <A href=HTML/SUPERV.html>Mapping of %SUPERV functions</A>
- - <B>%SALOME %VISU module</B>
- - <A href=HTML/VISU_Gen.html>Mapping of %VISU_Gen functions</A>
-
-*/
-
-/*! \defgroup Study SALOME STUDY module
*/
/*!
#include "SALOME_Exception.idl"
-/*! \ingroup Study
+/*!
This package contains the interfaces used for creation, managment
and modification of the %Study
*/
/*! IOR of the study in %SALOME application
*/
typedef string SalomeReference;
-/*! List of names of open studies in a %SALOME session
+
+/*! List of the names of studies which are currently open in this %SALOME session.
+Since %SALOME is a multi-study application, it allows to open a lot of studies
+during each working session.
*/
typedef sequence<string> ListOfOpenStudies;
/*! List of file names
*/
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 UseCaseIterator;
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
*/
typedef sequence<SObject> ListOfSObject;
/*!
- Gets a persistent reference to the %Study.
+ Gets the persistent reference to the %Study.
*/
PersistentReference GetPersistentReference();
/*!
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 %SComponents.
- Creates a new iterator of the %SComponent.
+ \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
+/*! \brief Saving the study in a HDF file (or files).
+
+ Saves a study.
+
+ \param theMultiFile If this parameter is True the study will be saved in several files.
- Saves the study.
<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 a study in a ASCII file (or files).
+ 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 file
+/*! \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.
- Saves the study in a specified file.
<BR><VAR>See also <A href=exemple/Example1.html> an example </A> of this method usage in batchmode of %SALOME application.</VAR>
*/
void SaveAs(in URL aUrl, // if the file already exists
in Study aStudy,
in boolean theMultiFile); // overwrite (as option)
+/*! \brief Saving the study in a specified ASCII file (or files).
+ Saves the study in a specified ASCII file (or files).
+
+ \param 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
in Study aStudy,
in boolean theMultiFile); // overwrite (as option)
/*! \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 %Generic attribute interface
- %Generic attribute is a base interface for all attributes which inherit
- its methods.
+ %Generic attribute is a base interface for all attributes which can be assigned to the SObjects created in the study.
*/
//==========================================================================
interface GenericAttribute
/*! \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);
};
//==========================================================================
/*! \brief %SComponent interface
+ The %SComponent interface establishes in the study a permanent assocition to the Components integrated into %SALOME platform.
The %SComponent interface is a specialization of the %SObject interface.
It inherits the most of its methods from the %SObject interface.
*/
//==========================================================================
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 The callback interface
+/*! \brief The callback interface
The %StudyBuilder can be created with the method <VAR>NewBuilder</VAR>. While invocation of this method a new object of the class <VAR>Callback</VAR> is created
and this object is assigned to the newly created Builder as callback which should be called when adding and removing of the ojects.
//==========================================================================
/*! \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);
/*!
};
};
-
+
#endif
/*! 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);
/*!
#ifndef _SALOME_COMPONENT_IDL_
#define _SALOME_COMPONENT_IDL_
-/*! \ingroup Kernel
+/*!
This is a package of interfaces used for connecting new components to %SALOME application. It also contains a set of interfaces used
for management of %MED component in %SALOME application.
/*! \brief Interface of the %Container
This interface defines the process of loading and registration
- of new components in SALOME application
+ of new components in %SALOME application
*/
interface Container
{
/*!
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 ) ;
/*!
// $Header$
/*! \file SALOME_Exception.idl This file contains the objects defining the main exception used
-in %SALOME application.
+in %SALOME application. The idl SALOME_Exception provides a generic CORBA exception for SALOME,
+ with an attribute that gives an exception type,a message, plus optional source file name and line number.
+This idl is intended to serve for all user CORBA exceptions raised in SALOME code, as IDL specification
+does not support exception inheritance. So, all the user CORBA exceptions from SALOME could be
+handled in a single catch.
+
*/
#ifndef _SALOME_EXCEPTION_IDL_
#define _SALOME_EXCEPTION_IDL_
/*!
-Module SALOME regroups all idl definitions for SALOME Kernel
+Module %SALOME regroups all idl definitions for %SALOME Kernel component
*/
module SALOME
{
/*!
-This enumeration contains the elements indicating the type of the exception.
+This enumeration contains the elements indicating the type of the exception
+which can be raised during %SALOME session.
*/
enum ExceptionType
{
COMM, /*!< Communication problem */
BAD_PARAM, /*!< Bad User parameters */
- INTERNAL_ERROR /*!< SALOME Bug, irrecoverable */
+ INTERNAL_ERROR /*!< Application level problem, irrecoverable */
};
/*!
This struct contains a set of fields defining the structure of the exception.
*/
exception SALOME_Exception
{
- ExceptionStruct details;
+ ExceptionStruct details; /*!<Structure of the exception.*/
};
};
creation of the catalog of components in %SALOME application
*/
-/*! \ingroup Kernel
+/*!
The main package of interfaces used for creation of the module catalog in %SALOME application.
+Module 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 %SALOME modules.
+This enumeration contains a current set of definitions of the components integrated
+into %SALOME application.
*/
enum ComponentType { GEOM, /*!<Module %GEOM */
MESH, /*!<Module %MESH */
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;
// $Header$
#include "SALOME_Component.idl"
-/*! \defgroup Kernel SALOME KERNEL module
-*/
-/*! \ingroup Kernel
-
+/*!
This package contains interfaces used for management of the session in %SALOME application.
*/
module SALOME
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();
/*!
CAS_CPPFLAGS=""
CAS_CXXFLAGS=""
CAS_LDFLAGS=""
-
occ_ok=no
dnl libraries directory location
SIP_INCLUDES="${PYTHON_INCLUDES} -I${SIPDIR}/include/python${PYTHON_VERSION}"
SIP_LIBS="-L${SIPDIR}/lib/python${PYTHON_VERSION}/site-packages -lsip"
else
+ sip_ok=yes
SIP_ROOT="$SIPDIR"
SIP_INCLUDES="-I${SIPDIR}"
SIP_LIBS="-L${SIPDIR} -lsip"
$(RESOURCES_FILES:%=$(top_builddir)/share/salome/resources/%): $(top_builddir)/share/salome/resources/% : %
cp -f $< $@
+data:
+ @if test "X$(top_builddir)" = "X."; then \
+ ((cd examples && $(MAKE) $@) || exit 1); \
+ fi;
+
+doc:
+ @if test "X$(top_builddir)" = "X."; then \
+ ((cd doc && $(MAKE) $@) || exit 1); \
+ fi;
install: install-resources
@@SETX@; for d in $(SUBDIRS); do \
using namespace std;
extern bool _Sleeping ;
+static Engines_Component_i * theEngines_Component ;
Engines_Component_i::Engines_Component_i()
{
const char *instanceName,
const char *interfaceName,
bool notif) :
- _instanceName(instanceName), _interfaceName(interfaceName),
- _myConnexionToRegistry(0), _ThreadId(0) , _graphName("") , _nodeName("") {
+ _instanceName(instanceName),
+ _interfaceName(interfaceName),
+ _myConnexionToRegistry(0),
+ _ThreadId(0) , _ThreadCpuUsed(0) , _Executed(false) , _graphName("") , _nodeName("") {
MESSAGE("Component constructor with instanceName "<< _instanceName);
_orb = CORBA::ORB::_duplicate(orb);
_poa = PortableServer::POA::_duplicate(poa);
: _instanceName(instanceName),
_interfaceName(interfaceName),
_myConnexionToRegistry(0),
- _ThreadId(0)
-{
+ _ThreadId(0) , _ThreadCpuUsed(0) , _Executed(false) , _graphName("") , _nodeName("") {
// MESSAGE("Component constructor with instanceName "<< _instanceName);
_orb = CORBA::ORB::_duplicate(orb);
_poa = PortableServer::POA::_duplicate(poa);
void Engines_Component_i::beginService(const char *serviceName)
{
- MESSAGE("Send BeginService notification for " << serviceName << endl
+ MESSAGE(pthread_self() << "Send BeginService notification for " << serviceName << endl
<< "Component instance : " << _instanceName << endl << endl);
_ThreadId = pthread_self() ;
_StartUsed = 0 ;
_StartUsed = CpuUsed_impl() ;
+ _ThreadCpuUsed = 0 ;
+ _Executed = true ;
_serviceName = serviceName ;
if ( pthread_setcanceltype( PTHREAD_CANCEL_ASYNCHRONOUS , NULL ) ) {
perror("pthread_setcanceltype ") ;
perror("pthread_setcancelstate ") ;
exit(0) ;
}
- MESSAGE("Return from BeginService for " << serviceName
- << " ThreadId " << _ThreadId
- << " _graphName " << _graphName << " _nodeName " << _nodeName );
+// MESSAGE(pthread_self() << " Return from BeginService for " << serviceName
+// << " ThreadId " << _ThreadId << " StartUsed " << _StartUsed
+// << " _graphName " << _graphName << " _nodeName " << _nodeName );
}
void Engines_Component_i::endService(const char *serviceName)
{
- MESSAGE("Send EndService notification for " << serviceName << endl
- << "Component instance : " << _instanceName << endl << endl);
+ _ThreadCpuUsed = CpuUsed_impl() ;
+ MESSAGE(pthread_self() << " Send EndService notification for " << serviceName << endl
+ << " Component instance : " << _instanceName << " StartUsed " << _StartUsed << " _ThreadCpuUsed "
+ << _ThreadCpuUsed << endl << endl);
_ThreadId = 0 ;
}
return CORBA::string_dup( _nodeName.c_str() ) ;
}
-bool Killer( pthread_t ThreadId , int signum ) {
+bool Engines_Component_i::Killer( pthread_t ThreadId , int signum ) {
if ( ThreadId ) {
if ( signum == 0 ) {
if ( pthread_cancel( ThreadId ) ) {
return false ;
}
else {
- MESSAGE("Killer : ThreadId " << ThreadId << " pthread_canceled") ;
+ MESSAGE(pthread_self() << "Killer : ThreadId " << ThreadId << " pthread_canceled") ;
}
}
else {
return false ;
}
else {
- MESSAGE("Killer : ThreadId " << ThreadId << " pthread_killed("
+ MESSAGE(pthread_self() << "Killer : ThreadId " << ThreadId << " pthread_killed("
<< signum << ")") ;
}
}
}
bool Engines_Component_i::Kill_impl() {
- MESSAGE("Engines_Component_i::Kill_i() pthread_t "<< pthread_self()
- << " pid " << getpid() << " instanceName "
- << _instanceName.c_str() << " interface " << _interfaceName.c_str()
- << " machineName " << GetHostname().c_str()<< " _id " << hex << _id
- << dec << " _ThreadId " << _ThreadId << " this " << hex << this
- << dec ) ;
+// MESSAGE("Engines_Component_i::Kill_i() pthread_t "<< pthread_self()
+// << " pid " << getpid() << " instanceName "
+// << _instanceName.c_str() << " interface " << _interfaceName.c_str()
+// << " machineName " << GetHostname().c_str()<< " _id " << hex << _id
+// << dec << " _ThreadId " << _ThreadId << " this " << hex << this
+// << dec ) ;
bool RetVal = false ;
if ( _ThreadId > 0 && pthread_self() != _ThreadId ) {
RetVal = Killer( _ThreadId , 0 ) ;
}
+void SetCpuUsed() {
+ theEngines_Component->SetCurCpu() ;
+}
+void Engines_Component_i::SetCurCpu() {
+ _ThreadCpuUsed = CpuUsed() ;
+// MESSAGE(pthread_self() << " Engines_Component_i::SetCurCpu() _ThreadCpuUsed " << _ThreadCpuUsed) ;
+}
+
#include <sys/time.h>
#include <sys/resource.h>
#include <unistd.h>
-CORBA::Long Engines_Component_i::CpuUsed_impl() {
+long Engines_Component_i::CpuUsed() {
+ long cpu = 0 ;
struct rusage usage ;
- long cpu ;
- if ( getrusage( RUSAGE_SELF , &usage ) == -1 ) {
- perror("GraphBase::CpuUsed") ;
- return 0 ;
+ if ( _ThreadId || _Executed ) {
+ if ( getrusage( RUSAGE_SELF , &usage ) == -1 ) {
+ perror("Engines_Component_i::CpuUsed") ;
+ return 0 ;
+ }
+ cpu = usage.ru_utime.tv_sec - _StartUsed ;
+// cout << pthread_self() << " Engines_Component_i::CpuUsed " << " " << _serviceName
+// << usage.ru_utime.tv_sec << " - " << _StartUsed << " = " << cpu << endl ;
+ }
+ else {
+// cout << pthread_self() << "Engines_Component_i::CpuUsed _ThreadId " << _ThreadId << " " << _serviceName
+// << " _StartUsed " << _StartUsed << endl ;
+ }
+ return cpu ;
+}
+
+CORBA::Long Engines_Component_i::CpuUsed_impl() {
+ long cpu = 0 ;
+ if ( _ThreadId || _Executed ) {
+ if ( _ThreadId > 0 ) {
+ if ( pthread_self() != _ThreadId ) {
+ if ( _Sleeping ) {
+ }
+ else {
+// Get Cpu in the appropriate thread with that object !...
+ theEngines_Component = this ;
+ Killer( _ThreadId ,SIGUSR1 ) ;
+ }
+ cpu = _ThreadCpuUsed ;
+ }
+ else {
+ _ThreadCpuUsed = CpuUsed() ;
+ cpu = _ThreadCpuUsed ;
+// cout << pthread_self() << " Engines_Component_i::CpuUsed_impl " << _serviceName << " " << cpu
+// << endl ;
+ }
+ }
+ else {
+ cpu = _ThreadCpuUsed ;
+// cout << pthread_self() << " Engines_Component_i::CpuUsed_impl " << _serviceName << " " << cpu
+// << endl ;
+ }
+ }
+ else {
+// cout << pthread_self() << "Engines_Component_i::CpuUsed_impl _ThreadId " << _ThreadId << " "
+// << _serviceName << " _StartUsed " << _StartUsed << endl ;
}
-// return usage.ru_utime.__time_t tv_sec ;
- cout << "CpuUsed " << usage.ru_utime.tv_sec << " " << usage.ru_utime.tv_usec << " "
- << usage.ru_stime.tv_sec << " " << usage.ru_stime.tv_usec << endl ;
- cpu = usage.ru_utime.tv_sec - _StartUsed ;
return cpu ;
}
return Engines::Container::_nil() ;
}
-// Load component in current container
-Engines::Component_ptr Engines_Container_i::load_impl
- (const char* nameToRegister,
- const char* componentName)
-{
- BEGIN_OF("Container_i::load_impl");
+Engines::Component_ptr Engines_Container_i::load_impl( const char* nameToRegister,
+ const char* componentName ) {
_numInstanceMutex.lock() ; // lock on the instance number
+ BEGIN_OF( "Container_i::load_impl " << componentName ) ;
_numInstance++ ;
char _aNumI[12];
- sprintf(_aNumI,"%d",_numInstance) ;
+ sprintf( _aNumI , "%d" , _numInstance ) ;
string _impl_name = componentName;
string _nameToRegister = nameToRegister;
//SCRUTE(instanceName);
//string absolute_impl_name = _library_path + "lib" + _impl_name + ".so";
- string absolute_impl_name(_impl_name);
- // SCRUTE(absolute_impl_name);
+ string absolute_impl_name( _impl_name ) ;
+ SCRUTE(absolute_impl_name);
void* handle;
- handle = dlopen(absolute_impl_name.c_str(), RTLD_LAZY);
- if (!handle)
- {
- INFOS("Can't load shared library : " << absolute_impl_name);
- INFOS("error dlopen: " << dlerror());
- _numInstanceMutex.unlock() ;
- return Engines::Component::_nil() ;
- }
+ handle = dlopen( absolute_impl_name.c_str() , RTLD_LAZY ) ;
+ if ( !handle ) {
+ INFOS("Can't load shared library : " << absolute_impl_name);
+ INFOS("error dlopen: " << dlerror());
+ _numInstanceMutex.unlock() ;
+ return Engines::Component::_nil() ;
+ }
string factory_name = _nameToRegister + string("Engine_factory");
// SCRUTE(factory_name) ;
PortableServer::ObjectId *,
const char *,
const char *) ;
-// typedef PortableServer::ObjectId * (*FACTORY_FUNCTION_SUPERV)
-// (CORBA::ORB_ptr,
-// PortableServer::POA_ptr,
-// PortableServer::ObjectId *,
-// const char *,
-// const char * ,
-// int , char ** ) ;
-
FACTORY_FUNCTION Component_factory = (FACTORY_FUNCTION) dlsym(handle, factory_name.c_str());
-// FACTORY_FUNCTION_SUPERV Component_factory_superv = (FACTORY_FUNCTION_SUPERV) Component_factory ;
-
-// PortableServer::ObjectId * (*Component_factory) (CORBA::ORB_ptr,
-// PortableServer::POA_ptr,
-// PortableServer::ObjectId *,
-// const char *,
-// const char *) =
-// (PortableServer::ObjectId * (*) (CORBA::ORB_ptr,
-// PortableServer::POA_ptr,
-// PortableServer::ObjectId *,
-// const char *,
-// const char *))
-// dlsym(handle, factory_name.c_str());
char *error ;
- if ((error = dlerror()) != NULL)
- {
+ if ( (error = dlerror() ) != NULL) {
INFOS("Can't resolve symbol: " + factory_name);
SCRUTE(error);
_numInstanceMutex.unlock() ;
return Engines::Component::_nil() ;
}
- // Instanciate required CORBA object
- PortableServer::ObjectId * id ;
-// if ( factory_name == "SupervisionEngine_factory" ) { // for Python ...
-// id = (Component_factory_superv) (_orb, _poa, _id, instanceName.c_str(),
-// _nameToRegister.c_str(), _argc , _argv );
-// }
-// else {
- id = (Component_factory) (_orb, _poa, _id, instanceName.c_str(),
- _nameToRegister.c_str());
-// }
+ string component_registerName = _containerName + "/" + _nameToRegister;
+ Engines::Component_var iobject = Engines::Component::_nil() ;
+ try {
+ CORBA::Object_var obj = _NS->Resolve( component_registerName.c_str() ) ;
+ if ( CORBA::is_nil( obj ) ) {
+// Instanciate required CORBA object
+ PortableServer::ObjectId * id ;
+ id = (Component_factory) ( _orb, _poa, _id, instanceName.c_str() ,
+ _nameToRegister.c_str() ) ;
// get reference from id
- CORBA::Object_var o = _poa->id_to_reference(*id);
- Engines::Component_var iobject = Engines::Component::_narrow(o) ;
+ obj = _poa->id_to_reference(*id);
+ iobject = Engines::Component::_narrow( obj ) ;
// _numInstanceMutex.lock() ; // lock on the add on handle_map (necessary ?)
// register the engine under the name containerName.dir/nameToRegister.object
- string component_registerName = _containerName + "/" + _nameToRegister;
- _NS->Register(iobject, component_registerName.c_str()) ;
+ _NS->Register( iobject , component_registerName.c_str() ) ;
+ MESSAGE( "Container_i::load_impl " << component_registerName.c_str() << " bound" ) ;
+ }
+ else { // JR : No ReBind !!!
+ MESSAGE( "Container_i::load_impl " << component_registerName.c_str() << " already bound" ) ;
+ iobject = Engines::Component::_narrow( obj ) ;
+ }
+ }
+ catch (...) {
+ MESSAGE( "Container_i::load_impl catched" ) ;
+ }
//Jr _numInstanceMutex.lock() ; // lock on the add on handle_map (necessary ?)
handle_map[instanceName] = handle;
+ END_OF("Container_i::load_impl");
_numInstanceMutex.unlock() ;
-// END_OF("Container_i::load_impl");
return Engines::Component::_duplicate(iobject);
}
struct sigaction SigIntAct ;
SigIntAct.sa_sigaction = &SigIntHandler ;
SigIntAct.sa_flags = SA_SIGINFO ;
- if ( sigaction( SIGINT , &SigIntAct, NULL ) ) {
+ if ( sigaction( SIGINT | SIGUSR1 , &SigIntAct, NULL ) ) {
perror("SALOME_Container main ") ;
exit(0) ;
}
else {
- INFOS("SigIntHandler activated") ;
+ INFOS(pthread_self() << "SigIntHandler activated") ;
}
}
+void SetCpuUsed() ;
+
void SigIntHandler(int what , siginfo_t * siginfo ,
void * toto ) {
- MESSAGE("SigIntHandler what " << what << endl
+ MESSAGE(pthread_self() << "SigIntHandler what " << what << endl
<< " si_signo " << siginfo->si_signo << endl
<< " si_code " << siginfo->si_code << endl
<< " si_pid " << siginfo->si_pid) ;
}
else {
ActSigIntHandler() ;
- _Sleeping = true ;
- INFOS("SigIntHandler BEGIN sleeping.")
- MESSAGE("SigIntHandler BEGIN sleeping.") ;
- int count = 0 ;
- while( _Sleeping ) {
- sleep( 1 ) ;
- count += 1 ;
+ if ( siginfo->si_signo == SIGUSR1 ) {
+ SetCpuUsed() ;
+ }
+ else {
+ _Sleeping = true ;
+ INFOS("SigIntHandler BEGIN sleeping.")
+ MESSAGE("SigIntHandler BEGIN sleeping.") ;
+ int count = 0 ;
+ while( _Sleeping ) {
+ sleep( 1 ) ;
+ count += 1 ;
+ }
+ INFOS("SigIntHandler LEAVE sleeping after " << count << " s.")
+ MESSAGE("SigIntHandler LEAVE sleeping after " << count << " s.") ;
}
- INFOS("SigIntHandler LEAVE sleeping after " << count << " s.")
- MESSAGE("SigIntHandler LEAVE sleeping after " << count << " s.") ;
return ;
}
}
CPPFLAGS+= $(PYTHON_INCLUDES)
-LDFLAGS+= -lSalomeNS -lRegistry -lOpUtil -lSalomeNotification -lSalomeLoggerServer
+LDFLAGS+= -lSalomeNS -lRegistry -lOpUtil -lSalomeNotification -lSALOMELocalTrace
LIBS += @LDEXPDYNFLAGS@ $(PYTHON_LIBS)
from SALOME_utilities import *
+from thread import *
+
#=============================================================================
#define an implementation of the component interface
self._nodeName = ''
self._ThreadId = 0
self._StartUsed = 0
+ self._ThreadCpuUsed = 0
+ self._Executed = 0
naming_service = SALOME_NamingServicePy_i(self._orb)
Component_path = "/Containers/" + os.getenv( "HOSTNAME" ) + "/" + self._containerName + "/" + self._interfaceName
#-------------------------------------------------------------------------
def beginService(self , serviceName ):
- MESSAGE( "Send BeginService notification for " + str(serviceName) + "for graph/node" + str(self._graphName) + str(self._nodeName) )
+ MESSAGE( "Send BeginService notification for " + str(serviceName) + " for graph/node " + str(self._graphName) + " " + str(self._nodeName) )
MESSAGE( "Component instance : " + str ( self._instanceName ) )
+ self._serviceName = str(serviceName)
+ self._ThreadId = get_ident()
self._StartUsed = 0
self._StartUsed = self.CpuUsed_impl()
+ self._ThreadCpuUsed = 0
+ self._Executed = 1
+ MESSAGE( "SALOME_ComponentPy_i::beginService _StartUsed " + str( self._ThreadId ) + " " + str( self._StartUsed ) )
+
#-------------------------------------------------------------------------
def endService(self , serviceName ):
- MESSAGE( "Send EndService notification for " + str(serviceName) + "for graph/node" + str(self._graphName) + str(self._nodeName) )
+ MESSAGE( "Send EndService notification for " + str( self._ThreadId ) + " " + str(serviceName) + " for graph/node " + str(self._graphName) + " " + str(self._nodeName) + " CpuUsed " + str( self.CpuUsed_impl() ) )
MESSAGE( "Component instance : " + str(self._instanceName) )
#-------------------------------------------------------------------------
#-------------------------------------------------------------------------
def CpuUsed_impl(self):
- cpu = time.clock()
- cpuL = int(cpu) - self._StartUsed
- print "SALOME_ComponentPy_i::CpuUsed_impl ",cpuL,type(cpuL)
- return cpuL
+ if ( self._ThreadId | self._Executed ) :
+ if self._ThreadId == get_ident() :
+ cpu = time.clock()
+ self._ThreadCpuUsed = int(cpu) - self._StartUsed
+ MESSAGE( "SALOME_ComponentPy_i::CpuUsed_impl " + self._serviceName + " " + str( int(cpu) ) + " - " + str( self._StartUsed ) + " = " + str( self._ThreadCpuUsed ) )
+ return self._ThreadCpuUsed
+ MESSAGE( "SALOME_ComponentPy_i::CpuUsed_impl " + self._serviceName + " " + str( self._ThreadCpuUsed ) )
+ return self._ThreadCpuUsed
+ MESSAGE( "SALOME_ComponentPy_i::CpuUsed_impl self._StartUsed " + self._serviceName + " " + str(self._StartUsed) )
+ return 0
#-------------------------------------------------------------------------
void Names( const char * graphName , const char * nodeName ) ;
char * graphName() ;
char * nodeName() ;
+ bool Killer( pthread_t ThreadId , int signum );
bool Kill_impl();
bool Stop_impl();
bool Suspend_impl();
bool Resume_impl();
+ void SetCurCpu() ;
+ long CpuUsed() ;
CORBA::Long CpuUsed_impl() ;
protected:
private:
pthread_t _ThreadId ;
long _StartUsed ;
+ long _ThreadCpuUsed ;
+ bool _Executed ;
};
#endif
#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.
- CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
- PortableServer::POA_var root_poa = PortableServer::POA::_narrow(obj);
-
- // obtain the root poa manager
- PortableServer::POAManager_var pman = root_poa->the_POAManager();
-
- // define policy objects
- PortableServer::ImplicitActivationPolicy_var implicitActivation =
- root_poa->create_implicit_activation_policy(PortableServer::NO_IMPLICIT_ACTIVATION) ;
+ // 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++)
+ {
+ 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))
+ {
+ 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) ;
// default = NO_IMPLICIT_ACTIVATION
- PortableServer::ThreadPolicy_var threadPolicy =
- root_poa->create_thread_policy(PortableServer::ORB_CTRL_MODEL) ;
+ 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() ;
-
- char *containerName = "";
- if (argc >1)
- {
- containerName = argv[1] ;
- }
+ // destroy policy objects
+ implicitActivation->destroy() ;
+ threadPolicy->destroy() ;
+
+ 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@
#include "SALOME_NamingService.hxx"
#include "SALOME_DataTypeCatalog_impl.hxx"
#include "utilities.h"
+#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
-
- CORBA::Object_var poaobj = orb->resolve_initial_references ("RootPOA");
-
- PortableServer::POA_var poa = PortableServer::POA::_narrow (poaobj);
- PortableServer::POAManager_var mgr = poa->the_POAManager();
+ 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))
+ {
+ 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;
+ }
- // 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;
}
break;
case HDF_INT32 :
+#ifdef PCLINUX
+ type_hdf = H5T_STD_I32BE;
+#else
type_hdf = H5T_NATIVE_INT;
+#endif
break;
case HDF_INT64 :
{
hdf_err ret = -1;
hdf_idt type_hdf;
-
+
if ((type_hdf = H5Aget_type(id)) >= 0) {
+#ifdef PCLINUX
+ if ((H5Tget_class(type_hdf) == H5T_INTEGER) && (H5Tget_size(type_hdf) == 4))
+ type_hdf = H5T_NATIVE_INT;
+#endif
ret = H5Aread(id, type_hdf, val);
}
hdf_err HDFattrWrite(hdf_idt id, void *val)
{
hdf_idt type_id;
- hdf_type type;
- hdf_class_type hdf_type;
int ret = 0;
+#ifdef PCLINUX
+ int isI32BE = 0;
+#endif
if ((type_id = H5Aget_type(id)) < 0)
return -1;
+#ifdef PCLINUX
+ if((H5Tget_class(type_id) == H5T_INTEGER) && (H5Tget_size(type_id) == 4)) {
+ isI32BE = 1; /* See HDFattrCreate */
+ if (H5Tconvert(H5T_NATIVE_INT,H5T_STD_I32BE,1,(void *)val,NULL,NULL) < 0)
+ return -1;
+ }
+#endif
+
ret = H5Awrite(id,type_id, val);
+
+#ifdef PCLINUX
+ if (isI32BE && (H5Tconvert(H5T_STD_I32BE,H5T_NATIVE_INT,1,(void *)val,NULL,NULL) < 0))
+ return -1;
+#endif
+
H5Tclose(type_id);
return ret;
break;
case HDF_INT32 :
+#ifdef PCLINUX
+ type_hdf = H5T_STD_I32BE;
+#else
type_hdf = H5T_NATIVE_INT;
+#endif
break;
case HDF_INT64 :
{
hdf_idt type_id;
hdf_type type;
- hdf_class_type hdf_type;
hdf_size_type size;
if ((type_id = H5Dget_type(id)) < 0)
return HDF_NONE;
- hdf_type = H5Tget_class(type_id);
- switch (hdf_type)
+ switch (H5Tget_class(type_id))
{
case H5T_INTEGER :
size = H5Tget_size(type_id);
if ((datatype = H5Dget_type(id)) < 0)
return -1;
- if ((ret = H5Dread(id,datatype,H5S_ALL,H5S_ALL,
- H5P_DEFAULT, val)) < 0)
+#ifdef PCLINUX
+ if ((H5Tget_class(datatype) == H5T_INTEGER) && (H5Tget_size(datatype) == 4))
+ datatype = H5T_NATIVE_INT;
+#endif
+
+ if ((ret = H5Dread(id,datatype,H5S_ALL,H5S_ALL,H5P_DEFAULT, val)) < 0)
return -1;
return 0;
{
hdf_idt datatype;
hdf_err ret;
+#ifdef PCLINUX
+ int isI32BE = 0;
+ int size;
+#endif
if ((datatype = H5Dget_type(id)) < 0)
return -1;
- if ((ret = H5Dwrite(id,datatype,H5S_ALL,H5S_ALL,
- H5P_DEFAULT, val)) < 0)
+#ifdef PCLINUX
+ if((H5Tget_class(datatype) == H5T_INTEGER) && (H5Tget_size(datatype) == 4)) {
+ isI32BE = 1; /* See HDFdatasetCreate */
+ size = (int)HDFdatasetGetSize(id) / 4;
+ if(size == 0)
+ return -1;
+ if(H5Tconvert(H5T_NATIVE_INT, H5T_STD_I32BE, size, (void *)val, NULL, NULL) < 0)
+ return -1;
+ }
+#endif
+
+ if ((ret = H5Dwrite(id, datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, val)) < 0)
+ return -1;
+
+#ifdef PCLINUX
+ if (isI32BE && (H5Tconvert(H5T_STD_I32BE, H5T_NATIVE_INT, size, (void *)val, NULL, NULL) < 0))
return -1;
+#endif
return 0;
}
#BIN = test9 test8
CPPFLAGS+=$(OCC_INCLUDES) $(HDF5_INCLUDES) -DPCLINUX
-LDFLAGS+= $(OCC_LIBS) $(HDF5_LIBS)
+LDFLAGS+= $(CAS_LDPATH) -lTKernel $(HDF5_LIBS)
@CONCLUDE@
BIN_CLIENT_IDL = SALOME_Component.idl SALOME_TestComponent.idl \
SALOME_ModuleCatalog.idl
-LDFLAGS += -lSalomeNS -lOpUtil -lSalomeLoggerServer
+LDFLAGS += -lSalomeNS -lOpUtil -lSALOMELocalTrace
@CONCLUDE@
QString dir;
char* cenv;
- // Try ${SALOME_ROOT_DIR}/share/salome/resources directory
+ // Try ${KERNEL_ROOT_DIR}/share/salome/resources directory
cenv = getenv( "KERNEL_ROOT_DIR" );
if ( cenv ) {
dir.sprintf( "%s", cenv );
return fileInfo.filePath();
}
}
- // Try ${SALOME_SITE_DIR}/share/salome/resources directory
- cenv = getenv( "SALOME_SITE_DIR" );
- if ( cenv ) {
- dir.sprintf( "%s", cenv );
- if ( !dir.isEmpty() ) {
- dir = addSlash(dir) ;
- dir = dir + "share" ;
- dir = addSlash(dir) ;
- dir = dir + "salome" ;
- dir = addSlash(dir) ;
- dir = dir + "resources" ;
- dir = addSlash(dir) ;
- QFileInfo fileInfo( dir + filename );
- if ( fileInfo.isFile() && fileInfo.exists() )
- return fileInfo.filePath();
- }
- }
- // Try ${SALOME_ROOT_DIR}/share/salome/resources directory
- cenv = getenv( "SALOME_ROOT_DIR" );
- if ( cenv ) {
- dir.sprintf( "%s", cenv );
- if ( !dir.isEmpty() ) {
- dir = addSlash(dir) ;
- dir = dir + "share" ;
- dir = addSlash(dir) ;
- dir = dir + "salome" ;
- dir = addSlash(dir) ;
- dir = dir + "resources" ;
- dir = addSlash(dir) ;
- QFileInfo fileInfo( dir + filename );
- if ( fileInfo.isFile() && fileInfo.exists() )
- return fileInfo.filePath();
- }
- }
return filename;
}
QString addSlash( const QString& path )
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"
// Module : SALOME
#include <iostream>
-using namespace std;
#include "SALOME_Logger_Server.hxx"
-
+#include <SALOMEconfig.h>
+#include <sys/types.h>
+#include <unistd.h>
+using namespace std;
omni_mutex Logger::myLock;
/////////////////////////////////////////////////////////////////////
myLock.unlock();
}
+void Logger::ping()
+{
+ //cout<<" Logger::ping() pid "<< getpid()<<endl;
+}
+
int main(int argc, char **argv)
{
if (argc > 2)
try
{
//Initialize the ORB
- CORBA::ORB_var orb = CORBA::ORB_init(argc,argv) ;
-
- CORBA::Object_var obj = orb->resolve_initial_references("RootPOA") ;
- PortableServer::POA_var poa = PortableServer::POA::_narrow(obj) ;
-
- // NB. You can activate the POA before or after
- // activating objects in that POA.
- PortableServer::POAManager_var pman = poa->the_POAManager();
- pman->activate();
-
+ const long TIMESleep = 250000000;
+ const int NumberOfTries = 40;
+ int i;
+ timespec ts_req = {0, TIMESleep};
+ timespec ts_rem = {0, 0};
+ CosNaming::NamingContext_var inc;
+ SALOME_Logger::Logger_var myLoggerRef;
+ CORBA::Object_var theObj;
Logger* myLogger;
+ CORBA::Object_var obj;
+ PortableServer::POA_var poa;
+ PortableServer::POAManager_var pman;
+
+ 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]);
- // This activates the object in the root POA (by default), and
- // returns a reference to it.
- SALOME_Logger::Logger_var myLoggerRef = myLogger->_this();
-
- //NB. You can't use SALOME_NamingService class because it uses MESSAGE macro
- //Otherwise, you will get segmentation fault.
-
- //Get initial naming context
- CORBA::Object_var theObj = orb->resolve_initial_references("NameService");
- //Narrow to NamingContext
- CosNaming::NamingContext_var inc = CosNaming::NamingContext::_narrow(theObj);
-
+ myLoggerRef = myLogger->_this();
CosNaming::Name name;
name.length(1);
name[0].id = CORBA::string_dup("Logger");
-
inc->bind(name,myLoggerRef);
-
myLogger->_remove_ref();
-
+ pman->activate();
orb->run() ;
-
orb->destroy() ;
}
catch(CORBA::COMM_FAILURE& ex)
{
cerr << "Caught system exception COMM_FAILURE -- unable to contact the "
- << "object." << endl;
+ << "object." << endl;
}
catch(CORBA::SystemException&)
{
virtual ~Logger();
//put message into one special place for all servers
void putMessage(const char* message);
+ void ping();
private:
//if m_putIntoFile is true all messages will be put into special
//otherwise all messages will be put into terminal via cout
// Author : Vasily Rusyaev
// Module : SALOME
+#include "SALOME_Trace.hxx"
#include <memory.h>
#include <string>
#include <stdlib.h>
#include <iostream>
#include "SALOME_Trace.hxx"
+using namespace std;
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
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) ;
- //Get initial naming context
- CORBA::Object_var theObj = orb->resolve_initial_references("NameService");
- //Narrow to NamingContext
- CosNaming::NamingContext_var inc = CosNaming::NamingContext::_narrow(theObj);
-
- CosNaming::Name name;
- name.length(1);
- name[0].id = CORBA::string_dup("Logger");
-
- CORBA::Object_var obj;
- obj = inc->resolve(name);
-
- m_pInterfaceLogger = SALOME_Logger::Logger::_narrow(obj) ;
-
- }
- 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
# endif /* WNT */
#include <strstream.h>
-using namespace std;
#include "Logger.hh"
+using namespace std;
class SALOME_Trace : public ostrstream
{
public:
virtual ~SALOME_Trace();
static Standard_EXPORT SALOME_Trace& Instance();
+ // initializes Logger (if USE_LOGGER variable is set) and returns true, in case success
+ int Initialize(CORBA::ORB_ptr theOrb);
Standard_EXPORT void putMessage(std::ostream& msg);
protected:
//disable creation of instances. It's necessary to use static SALOME_Logger& Instance()
SALOME_Trace();
SALOME_Logger::Logger_var m_pInterfaceLogger;// object reference on Logger server.
+ int isInitialized;
};
#define GLogger SALOME_Trace::Instance()
import CosNaming
from omniORB import CORBA
import SALOME_Logger
+import time
+import os
+
+trace="local"
+if (os.environ["SALOME_trace"] == "with_logger"):
+ trace="logger"
class SALOME_Trace :
def __init__(self):
self.m_pInterfaceLogger = None
- try:
- orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID)
- theObj = orb.resolve_initial_references("NameService")
- inc = theObj._narrow(CosNaming.NamingContext)
- name = [CosNaming.NameComponent("Logger","")]
- obj = inc.resolve(name);
-
- self.m_pInterfaceLogger = obj._narrow(SALOME_Logger.Logger)
-
- except CosNaming.NamingContext.NotFound, e :
- print "Caught exception: Naming Service can't found Logger"
- except CORBA.COMM_FAILURE, e:
- print "Caught CORBA::SystemException CommFailure"
- except CORBA.SystemException, e:
- print "Caught CORBA::SystemException."
- except CORBA.Exception, e:
- print "Caught CORBA::Exception."
- except Exception, e:
- print "Caught unknown exception."
-
+ if trace=="logger":
+ ok = 0
+ steps = 40
+ while steps > 0 and ok == 0:
+
+ try:
+ orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID)
+ theObj = orb.resolve_initial_references("NameService")
+ inc = theObj._narrow(CosNaming.NamingContext)
+ name = [CosNaming.NameComponent("Logger","")]
+ obj = inc.resolve(name);
+
+ self.m_pInterfaceLogger = obj._narrow(SALOME_Logger.Logger)
+
+ if not self.m_pInterfaceLogger is None:
+ ok = 1
+
+ except CosNaming.NamingContext.NotFound, e :
+ if steps == 1: print "Caught exception: Naming Service can't found Logger"
+ except CORBA.COMM_FAILURE, e:
+ if steps == 1: print "Caught CORBA::SystemException CommFailure"
+ except CORBA.SystemException, e:
+ if steps == 1: print "Caught CORBA::SystemException."
+ except CORBA.Exception, e:
+ if steps == 1: print "Caught CORBA::Exception."
+ except Exception, e:
+ if steps == 1: print "Caught unknown exception."
+ time.sleep(0.25)
+ steps = steps - 1
+
+
def putMessage ( self, LogMsg ) :
if (CORBA.is_nil(self.m_pInterfaceLogger)):
BIN_SRC =
BIN_SERVER_IDL = SALOME_MPIObject.idl SALOME_MPIContainer.idl
-LDFLAGS+= -lSalomeContainer -lSalomeNS -lRegistry -lOpUtil
+LDFLAGS+= -lSalomeContainer -lSalomeNS -lRegistry -lOpUtil -lSalomeNotification -lSALOMELocalTrace
ifeq (@WITHMPICH@,yes)
CXXFLAGS+=${MPICH_INCLUDES}
CXX_DEPEND_FLAG+=${MPICH_INCLUDES}
BIN_SRC =
BIN_CLIENT_IDL = Logger.idl SALOME_MPIObject.idl SALOME_MPIContainer.idl SALOME_TestMPIComponent.idl
-LDFLAGS += -lSalomeNS -lSalomeLifeCycleCORBA -lOpUtil -lSalomeLoggerServer
+LDFLAGS += -lSalomeNS -lSalomeLifeCycleCORBA -lOpUtil -lSALOMELocalTrace
@CONCLUDE@
@COMMENCE@
-SUBDIRS = MSG2QM Logger Utils PatchQt NamingService Registry ModuleCatalog DataTypeCatalog \
- RessourcesCatalog Notification NOTIFICATION_SWIG Container TestContainer LifeCycleCORBA \
- HDFPersist OBJECT TOOLSDS SALOMEDS SALOMEGUI Plot2d VTKViewer OCCViewer SUPERVGraph Session \
- SALOME_SWIG TOOLSGUI SALOME_PY RegistryDisplay ModuleGenerator \
- SALOME_PYQT Loader
+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 (@WITHMPI@,yes)
SUBDIRS+= MPIContainer MPILifeCycleCORBA TestMPIContainer
CPPFLAGS+= $(QT_MT_INCLUDES)
CXXFLAGS+= @CXXTMPDPTHFLAGS@
-LDFLAGS+= $(QT_MT_LIBS) -lSalomeNS -lOpUtil -lSalomeLoggerServer
+LDFLAGS+= $(QT_MT_LIBS) -lSalomeNS -lOpUtil -lSALOMELocalTrace
@CONCLUDE@
#include "SALOME_NamingService.hxx"
#include "SALOME_ModuleCatalog_impl.hxx"
#include "utilities.h"
-using namespace std;
+#include "Utils_SINGLETON.hxx"
-//#define CHECKTIME
#ifdef CHECKTIME
#include <Utils_Timer.hxx>
#endif
+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
-
- CORBA::Object_var poaobj = orb->resolve_initial_references ("RootPOA");
-
- PortableServer::POA_var poa = PortableServer::POA::_narrow (poaobj);
- PortableServer::POAManager_var mgr = poa->the_POAManager();
-
- // Active catalog
+ 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 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
- 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
# $Header$
import sys
+import time
from omniORB import CORBA
import CosNaming
from string import *
#-------------------------------------------------------------------------
def __init__(self, orb):
- MESSAGE ( "SALOME_NamingServicePy_i::__init__" )
+ #MESSAGE ( "SALOME_NamingServicePy_i::__init__" )
self._orb = orb
# initialize root context and current context
- obj =self._orb.resolve_initial_references("NameService")
- self._root_context =obj._narrow(CosNaming.NamingContext)
- self._current_context = self._root_context
+ ok = 0
+ steps = 40
+ while steps > 0 and ok == 0:
+ try:
+ obj =self._orb.resolve_initial_references("NameService")
+ self._root_context =obj._narrow(CosNaming.NamingContext)
+ self._current_context = self._root_context
- if self._root_context is None :
- MESSAGE ( "Name Service Reference is invalid" )
- sys.exit(1)
-
+ if self._root_context is None :
+ #MESSAGE ( "Name Service Reference is invalid" )
+ #sys.exit(1)
+ MESSAGE(" Name service not found")
+ else:
+ ok = 1
+ except CORBA.COMM_FAILURE, ex:
+ MESSAGE(" Name service not found")
+ time.sleep(0.25)
+ steps = steps - 1
+ if steps == 0:
+ MESSAGE ( "Name Service Reference is invalid" )
+ sys.exit(1)
#-------------------------------------------------------------------------
def Register(self,ObjRef, Path):
MESSAGE ( "SALOME_NamingServicePy_i::Register" )
#-------------------------------------------------------------------------
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@
EXPORT_HEADERS = SALOME_InteractiveObject.hxx \
Handle_SALOME_InteractiveObject.hxx \
SALOME_Actor.h \
- SALOME_Transform.h \
SALOME_AISShape.hxx \
Handle_SALOME_AISShape.hxx \
SALOME_AISObject.hxx \
LIB = libSalomeObject.la
LIB_SRC = SALOME_InteractiveObject.cxx \
SALOME_Actor.cxx \
- SALOME_Transform.cxx \
SALOME_AISShape.cxx\
SALOME_AISObject.cxx
BIN_SRC =
CPPFLAGS+=$(PYTHON_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES)
-LDFLAGS+=$(OCC_KERNEL_LIBS) $(OCC_VIEWER_LIBS) $(VTK_LIBS) $(OGL_LIBS) $(PYTHON_LIBS)
+LDFLAGS+= $(VTK_LIBS) $(OGL_LIBS) $(PYTHON_LIBS) $(CAS_LDPATH) -lTKV3d -lSalomeVTKFilter
@CONCLUDE@
*/
#include "SALOME_Actor.h"
+#include "SALOME_Transform.h"
+#include "SALOME_TransformFilter.h"
+#include "SALOME_PassThroughFilter.h"
+#include "SALOME_GeometryFilter.h"
// SALOME Includes
#include "utilities.h"
-using namespace std;
// VTK Includes
#include <vtkObjectFactory.h>
#include <vtkDataSetMapper.h>
#include <vtkPolyDataMapper.h>
-#include <vtkGeometryFilter.h>
#include <vtkTransformPolyDataFilter.h>
-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;
+// For test
+#include <vtkMapperCollection.h>
+#include "vtkTimerLog.h"
- if ( ! this->Mapper ) {
- return 0;
- }
+using namespace std;
- // make sure we have a property
- if (!this->Property) {
- // force creation of a property
- this->GetProperty();
- }
+int SALOME_POINT_SIZE = 3;
- // 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::RemoveFromRender(vtkRenderer* theRenderer){
theRenderer->RemoveActor(this);
}
+
vtkPolyData* SALOME_Actor::GetPolyDataInput(){
return myPassFilter[3]->GetPolyDataOutput();
}
void SALOME_Actor::SetMapper(vtkMapper* theMapper){
if(theMapper){
myPassFilter[0]->SetInput(theMapper->GetInput());
- myPassFilter[0]->Update();
myPassFilter[1]->SetInput(myPassFilter[0]->GetPolyDataOutput());
- myPassFilter[1]->Update();
myTransformFilter->SetInput(myPassFilter[1]->GetPolyDataOutput());
myPassFilter[2]->SetInput(myTransformFilter->GetOutput());
- myPassFilter[2]->Update();
myPassFilter[3]->SetInput(myPassFilter[2]->GetPolyDataOutput());
- myPassFilter[3]->Update();
if(vtkDataSetMapper* aMapper = dynamic_cast<vtkDataSetMapper*>(theMapper))
- aMapper->SetInput(myPassFilter[3]->GetOutput());
+ aMapper->SetInput(myPassFilter[3]->GetPolyDataOutput());
else if(vtkPolyDataMapper* aMapper = dynamic_cast<vtkPolyDataMapper*>(theMapper))
aMapper->SetInput(myPassFilter[3]->GetPolyDataOutput());
}
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) {
+ 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);
+ GetProperty()->SetRepresentation(1);
+ break;
+ case 0 :
+ GetProperty()->SetPointSize(SALOME_POINT_SIZE);
+ default :
+ 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());
myPassFilter.push_back(SALOME_PassThroughFilter::New());
}
SALOME_Actor::~SALOME_Actor(){
+ myTransformFilter->Delete();
SetPreviewProperty(NULL);
for(int i = 0, iEnd = myPassFilter.size(); i < iEnd; i++)
- if(myPassFilter[i] != NULL)
+ if(myPassFilter[i] != NULL){
+ myPassFilter[i]->UnRegisterAllOutputs();
myPassFilter[i]->Delete();
+ }
+ myProperty->Delete();
}
#define SALOME_ACTOR_H
// SALOME Includes
-#include "SALOME_Transform.h"
+#include "VTKViewer_Common.h"
#include "SALOME_InteractiveObject.hxx"
#ifndef _Handle_SALOME_InteractiveObject_HeaderFile
#include "Handle_SALOME_InteractiveObject.hxx"
#endif
-
#include <vector>
-#include "VTKViewer_Common.h"
-class SALOME_Actor : public vtkLODActor
-{
+class SALOME_Transform;
+class SALOME_TransformFilter;
+class SALOME_PassThroughFilter;
+
+extern int SALOME_POINT_SIZE;
+
+class SALOME_Actor : public vtkLODActor{
protected:
//constructor should be protected due to first implementation of this class
//it was abstract class
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;
Standard_Boolean ispreselected;
SALOME_Transform *myTransform;
std::vector<SALOME_PassThroughFilter*> myPassFilter;
SALOME_TransformFilter *myTransformFilter;
+ vtkProperty *myProperty;
+ int myRepresentation;
};
+
#endif // SALOME_ACTOR_H
+++ /dev/null
-// File: SALOME_Transform.cxx
-// Created: Wed Jun 4 09:46:59 2003
-// Author: Alexey PETROV
-// <apo@ivanox.nnov.matra-dtv.fr>
-
-
-#include "SALOME_Transform.h"
-#include "VTKViewer_Common.h"
-#include <vtkObjectFactory.h>
-#include <vtkGeometryFilter.h>
-#include <vtkMatrix4x4.h>
-using namespace std;
-
-//=======================================================================
-
-SALOME_Transform* SALOME_Transform::New(){
- vtkObject* ret = vtkObjectFactory::CreateInstance("SALOME_Transform");
- if(ret) return (SALOME_Transform*)ret;
- return new SALOME_Transform;
-}
-
-void SALOME_Transform::SetScale(float theScaleX, float theScaleY, float theScaleZ){
- double aMatrix[16] = {theScaleX,0,0,0,
- 0,theScaleY,0,0,
- 0,0,theScaleZ,0,
- 0,0,0,1.0000000};
- vtkTransform::SetMatrix(aMatrix);
- //vtkTransform::Pop();
- //vtkTransform::Scale(theScale);
-}
-
-int SALOME_Transform::IsIdentity(){
- float* aScale = GetScale();
- return (aScale[0] == 1.0 && aScale[1] == 1.0 && aScale[2] == 1.0);
-}
-
-//=======================================================================
-
-SALOME_TransformFilter* SALOME_TransformFilter::New(){
- vtkObject* ret = vtkObjectFactory::CreateInstance("SALOME_TransformFilter");
- if(ret) return (SALOME_TransformFilter*)ret;
- return new SALOME_TransformFilter;
-}
-
-void SALOME_TransformFilter::Execute(){
- vtkPoints *inPts;
- vtkPoints *newPts;
- int numPts, numCells;
- vtkPointSet *input = this->GetInput();
- vtkPointSet *output = this->GetOutput();
- vtkPointData *pd=input->GetPointData(), *outPD=output->GetPointData();
- vtkCellData *cd=input->GetCellData(), *outCD=output->GetCellData();
- output->CopyStructure( input );
- int anIdentity = 0;
- if(SALOME_Transform* aTransform = dynamic_cast<SALOME_Transform*>(this->Transform))
- anIdentity = aTransform->IsIdentity();
- if(!anIdentity && this->Transform != NULL){
- inPts = input->GetPoints();
- if(!inPts){
- vtkErrorMacro(<<"No input data");
- return;
- }
- numPts = inPts->GetNumberOfPoints();
- numCells = input->GetNumberOfCells();
- newPts = vtkPoints::New();
- newPts->Allocate(numPts);
- this->UpdateProgress(.2);
- this->Transform->TransformPoints(inPts,newPts);
- this->UpdateProgress(.8);
- output->SetPoints(newPts);
- newPts->Delete();
- }
- outPD->PassData(pd);
- outCD->PassData(cd);
-}
-
-//=======================================================================
-
-SALOME_PassThroughFilter* SALOME_PassThroughFilter::New(){
- vtkObject* ret = vtkObjectFactory::CreateInstance("SALOME_PassThroughFilter");
- if(ret) return (SALOME_PassThroughFilter*)ret;
- return new SALOME_PassThroughFilter;
-}
-
-SALOME_PassThroughFilter::SALOME_PassThroughFilter(){
- myGeomFilter = vtkGeometryFilter::New();
-}
-
-SALOME_PassThroughFilter::~SALOME_PassThroughFilter(){
- myGeomFilter->Delete();
-}
-
-void SALOME_PassThroughFilter::Execute(){
- vtkDataSet *input = static_cast<vtkDataSet*>(this->GetInput());
- vtkDataSet *output = static_cast<vtkDataSet*>(this->GetOutput());
- output->CopyStructure( input );
- output->GetPointData()->PassData( input->GetPointData() );
- output->GetCellData()->PassData( input->GetCellData() );
-}
-
-void SALOME_PassThroughFilter::SetInput(vtkDataSet *input){
- myGeomFilter->SetInput(input);
- vtkDataSet *oldInput = this->GetInput();
- if(oldInput != NULL)
- if(input == NULL || oldInput->GetDataObjectType() != input->GetDataObjectType()){
- vtkWarningMacro("Changing input type. Deleting output");
- this->SetOutput(NULL);
- }
- if (input != NULL && this->vtkSource::GetOutput(0) == NULL){
- this->vtkSource::SetNthOutput(0, input->NewInstance());
- this->Outputs[0]->ReleaseData();
- this->Outputs[0]->Delete();
- }
- this->vtkProcessObject::SetNthInput(0, input);
-}
-
-vtkPolyData *SALOME_PassThroughFilter::GetPolyDataOutput() {
- vtkDataSet *ds = this->GetOutput();
- if(!ds) return NULL;
- if(ds->GetDataObjectType() == VTK_POLY_DATA) return (vtkPolyData *)ds;
- myGeomFilter->SetInput(this->GetOutput());
- return myGeomFilter->GetOutput();
-}
+++ /dev/null
-// File: SALOME_Transformation.hxx
-// Created: Wed Jun 4 09:39:09 2003
-// Author: Alexey PETROV
-// <apo@ivanox.nnov.matra-dtv.fr>
-
-
-#ifndef SALOME_Transform_HeaderFile
-#define SALOME_Transform_HeaderFile
-
-#include <math.h>
-
-#include <vtkTransform.h>
-#include <vtkTransformFilter.h>
-#include <vtkDataSetToDataSetFilter.h>
-class vtkGeometryFilter;
-
-//=======================================================================
-
-class VTK_EXPORT SALOME_Transform : public vtkTransform{
- public:
- static SALOME_Transform *New();
- vtkTypeMacro(SALOME_Transform,vtkTransform);
- void SetScale(float theScaleX, float theScaleY, float theScaleZ);
- int IsIdentity();
-protected:
- SALOME_Transform() {}
- ~SALOME_Transform() {}
- SALOME_Transform(const SALOME_Transform&) {}
- void operator=(const SALOME_Transform&) {}
-};
-
-//=======================================================================
-
-class VTK_EXPORT SALOME_TransformFilter : public vtkTransformFilter{
- public:
- static SALOME_TransformFilter *New();
- vtkTypeMacro(SALOME_TransformFilter,vtkTransformFilter);
-protected:
- SALOME_TransformFilter() {}
- ~SALOME_TransformFilter() {}
- SALOME_TransformFilter(const SALOME_TransformFilter&) {}
- void operator=(const SALOME_TransformFilter&) {}
- void Execute();
-};
-
-//=======================================================================
-
-class SALOME_PassThroughFilter : public vtkDataSetToDataSetFilter{
- public:
- vtkTypeMacro(SALOME_PassThroughFilter,vtkDataSetToDataSetFilter);
- static SALOME_PassThroughFilter *New();
- void SetInput(vtkDataSet *input);
- vtkPolyData *GetPolyDataOutput();
- protected:
- SALOME_PassThroughFilter();
- virtual ~SALOME_PassThroughFilter();
- void Execute();
- vtkGeometryFilter* myGeomFilter;
- private:
- SALOME_PassThroughFilter(const SALOME_PassThroughFilter&); // Not implemented.
- void operator=(const SALOME_PassThroughFilter&); // Not implemented.
-};
-
-//=======================================================================
-
-#endif
CPPFLAGS+=$(QT_INCLUDES) $(OCC_INCLUDES) $(OGL_INCLUDES) $(PYTHON_INCLUDES)
-LDFLAGS+=$(QT_MT_LIBS) $(OCC_KERNEL_LIBS) $(OCC_VIEWER_LIBS) $(OGL_LIBS)
+LDFLAGS+=$(QT_MT_LIBS) $(OGL_LIBS) -lSalomeGUI
@CONCLUDE@
#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>
using namespace std;
/*!
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
SALOME_Exception.idl
CPPFLAGS+=$(QT_INCLUDES) $(OCC_INCLUDES) $(OGL_INCLUDES) $(PYTHON_INCLUDES) $(QWT_INCLUDES)
-LDFLAGS+=$(QT_MT_LIBS) $(OGL_LIBS) $(QWT_LIBS)
+LDFLAGS+=$(QT_MT_LIBS) $(OGL_LIBS) $(QWT_LIBS) -lSalomeGUI
@CONCLUDE@
*/
bool Plot2d_ViewFrame::isInViewer( const Handle(SALOME_InteractiveObject)& IObject )
{
- return ( getCurveByIO( IObject ) != NULL );
+ if( getCurveByIO( IObject ) != NULL )
+ return 1;
+ else{
+ if(!IObject.IsNull()){
+ QIntDictIterator<Plot2d_Curve> it(myCurves);
+ for(; it.current();++it){
+ if(it.current()->hasIO() && it.current()->getTableIO()->isSame(IObject))
+ return 1;
+ }}
+ }
+ return 0;
}
/*!
Returns true if interactive object is presented in the viewer and displayed
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@
# include <stdlib.h>
# include <iostream>
# include <fstream>
-using namespace std;
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"
+
+#ifdef CHECKTIME
+#include <Utils_Timer.hxx>
+#endif
+using namespace std;
//#define CHECKTIME
#ifdef CHECKTIME
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" ;
-
-
- try
+ if(!CORBA::is_nil(inc))
{
- ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
- CORBA::ORB_var &orb = init( argc , argv ) ;
-
-
- SALOME_NamingService &naming = *SINGLETON_<SALOME_NamingService>::Instance() ;
- naming.init_orb( orb ) ;
-
- RegistryService *ptrRegistry = SINGLETON_<RegistryService>::Instance() ;
- ptrRegistry->SessionName( ptrSessionName ) ;
- Registry::Components_var varComponents = ptrRegistry->_this() ;
-
- // The RegistryService must not already exist.
-
- try
- {
- CORBA::Object_var pipo = naming.Resolve( registryName ) ;
- if (CORBA::is_nil(pipo) ) throw ServiceUnreachable() ;
- MESSAGE("RegistryService servant already existing" ) ;
- exit( EXIT_FAILURE ) ;
- }
- catch( const ServiceUnreachable &ex )
- {
- }
- catch( const CORBA::Exception &exx )
+ MESSAGE( "Registry Server: Naming Service was found" );
+ if(EnvL==1)
+ {
+ for(int j=1; j<=NumberOfTries; j++)
{
+ if (j!=1)
+ a=nanosleep(&ts_req, &ts_rem);
+ try
+ {
+ object = inc->resolve(name);
+ }
+ catch(CosNaming::NamingContext::NotFound)
+ {
+ MESSAGE( "Registry Server: Logger Server wasn't found" );
+ }
+ catch(...)
+ {
+ MESSAGE( "Registry Server: Unknown exception" );
+ }
+ if (!CORBA::is_nil(object))
+ {
+ MESSAGE( "Module Catalog Server: Logger Server was found" );
+ REGISTRY=1;
+ break;
+ }
}
- string absoluteName = string("/") + registryName;
- naming.Register( varComponents , absoluteName.c_str() ) ;
-
-
- CORBA::Object_var poaObj = orb->resolve_initial_references( "RootPOA" ) ;
- PortableServer::POA_var poa = PortableServer::POA::_narrow(poaObj) ;
- PortableServer::POAManager_var manager = poa->the_POAManager() ;
-
-
- MESSAGE("On attend les requetes des clients") ;
- try
- {
- // Activation du POA
- MESSAGE("Activation du POA") ;
- manager->activate() ;
-
- // Lancement de l'ORB
- MESSAGE("Lancement de l'ORB") ;
+ }
+ }
+ if ((REGISTRY==1)||((EnvL==0)&&(!CORBA::is_nil(inc))))
+ break;
+ }
+
+ try
+ {
+ naming.init_orb( orb ) ;
+ RegistryService *ptrRegistry = SINGLETON_<RegistryService>::Instance() ;
+ ptrRegistry->SessionName( ptrSessionName ) ;
+ varComponents = ptrRegistry->_this() ;
+ // The RegistryService must not already exist.
+
+ try
+ {
+ CORBA::Object_var pipo = naming.Resolve( registryName ) ;
+ if (CORBA::is_nil(pipo) ) throw ServiceUnreachable() ;
+ MESSAGE("RegistryService servant already existing" ) ;
+ exit( EXIT_FAILURE ) ;
+ }
+ catch( const ServiceUnreachable &ex )
+ {
+ }
+ catch( const CORBA::Exception &exx )
+ {
+ }
+ string absoluteName = string("/") + registryName;
+ naming.Register( varComponents , absoluteName.c_str() ) ;
+ MESSAGE("On attend les requetes des clients") ;
+ try
+ {
+ // Activation du POA
+ MESSAGE("Activation du POA") ;
+ manager->activate() ;
+
+ // Lancement de l'ORB
+ MESSAGE("Lancement de l'ORB") ;
#ifdef CHECKTIME
- Utils_Timer timer;
- timer.Start();
- timer.Stop();
- MESSAGE("SALOME_Registry_Server.cxx - orb->run()");
- timer.ShowAbsolute();
+ Utils_Timer timer;
+ timer.Start();
+ timer.Stop();
+ MESSAGE("SALOME_Registry_Server.cxx - orb->run()");
+ timer.ShowAbsolute();
#endif
- orb->run() ;
- }
- catch( const CORBA::Exception &ex )
- {
- MESSAGE("Erreur systeme") ;
- return EXIT_FAILURE ;
- }
-
+ orb->run() ;
}
- catch( const SALOME_Exception &ex )
+ catch( const CORBA::Exception &ex )
{
- MESSAGE( "Communication Error : " << ex.what() )
- return EXIT_FAILURE ;
+ MESSAGE("Erreur systeme") ;
+ return EXIT_FAILURE ;
}
-
- END_OF( argv[0] ) ;
- return 0 ;
+
+ }
+ catch( const SALOME_Exception &ex )
+ {
+ MESSAGE( "Communication Error : " << ex.what() )
+ return EXIT_FAILURE ;
+ }
+
+ END_OF( argv[0] ) ;
+ return 0 ;
}
# include "IntervalWindow.hxx"
using namespace std;
-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@
#include "SALOME_NamingService.hxx"
#include "SALOME_RessourcesCatalog_impl.hxx"
#include "utilities.h"
+#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
-
- CORBA::Object_var poaobj = orb->resolve_initial_references ("RootPOA");
-
- PortableServer::POA_var poa = PortableServer::POA::_narrow (poaobj);
- PortableServer::POAManager_var mgr = poa->the_POAManager();
-
- // Active catalog
-
- SALOME_RessourcesCatalogImpl* Catalogue_i = new SALOME_RessourcesCatalogImpl(argc, argv);
- poa->activate_object (Catalogue_i);
-
- mgr->activate();
+ // 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);
+ }
+ catch( CORBA::COMM_FAILURE& )
+ {
+ MESSAGE( "Ressources Catalog: CORBA::COMM_FAILURE: Unable to contact the Naming Service" );
+ }
+ if(!CORBA::is_nil(inc))
+ {
+ MESSAGE( "Ressources Catalog: Naming Service was found" );
+ if(EnvL==1)
+ {
+ for(int j=1; j<=NumberOfTries; j++)
+ {
+ if (j!=1)
+ a=nanosleep(&ts_req, &ts_rem);
+ try{
+ object = inc->resolve(name);
+ }
+ catch(CosNaming::NamingContext::NotFound)
+ {
+ MESSAGE( "Ressources Catalog: Logger Server wasn't found" );
+ }
+ catch(...)
+ {
+ MESSAGE( "Ressources Catalog: Unknown exception" );
+ }
+ if (!CORBA::is_nil(object))
+ {
+ MESSAGE( "Ressources Catalog: Loger Server was found" );
+ RESSOURCES_CATALOG=1;
+ break;
+ }
+ }
+ }
+ }
+ if ((RESSOURCES_CATALOG==1)||((EnvL==0)&&(!CORBA::is_nil(inc))))
+ break;
+ }
+ // Active catalog
- 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+=$(OCC_KERNEL_LIBS) $(OCC_OCAF_LIBS) $(OCC_VIEWER_LIBS) $(OCC_MODELER_LIBS) $(HDF5_LIBS) -lTOOLSDS -lSalomeNS -lSalomeHDFPersist -lOpUtil -lSalomeLoggerServer
+LDFLAGS+= $(HDF5_LIBS) -lTOOLSDS -lSalomeNS -lSalomeHDFPersist -lOpUtil -lSALOMELocalTrace $(CAS_LDPATH) -lTKCAF -lSalomeGenericObj -lSalomeLifeCycleCORBA
@CONCLUDE@
// Module : SALOME
// $Header$
-using namespace std;
#include "SALOMEDS_AttributeExternalFileDef_i.hxx"
#include <TCollection_ExtendedString.hxx>
#include "SALOMEDS_SObject_i.hxx"
+using namespace std;
char* SALOMEDS_AttributeExternalFileDef_i::Value()
{
// Module : SALOME
// $Header$
-using namespace std;
#include "SALOMEDS_AttributeFileType_i.hxx"
#include <TCollection_ExtendedString.hxx>
#include "SALOMEDS_SObject_i.hxx"
+using namespace std;
char* SALOMEDS_AttributeFileType_i::Value()
{
void SALOMEDS_AttributeIOR_i::SetValue(const char* value)
{
CheckLocked();
+
+ SALOMEDS::Study_var aStudy = SALOMEDS_Study_i::GetStudy(_myAttr->Label(), _myOrb);
+ aStudy->AddCreatedPostponed(value);
+ aStudy->AddPostponed(Value());
+
CORBA::String_var Str = CORBA::string_dup(value);
Handle(TDataStd_Comment)::DownCast(_myAttr)->Set(TCollection_ExtendedString(Str));
SALOMEDS_Study_i::IORUpdated(Handle(SALOMEDS_IORAttribute)::DownCast(_myAttr),_myOrb);
#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();
#include CORBA_SERVER_HEADER(SALOMEDS)
#include "SALOMEDS_StudyManager_i.hxx"
#include "utilities.h"
-using namespace std;
+#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.
- CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "omniORB3");
- omniORB::MaxMessageSize(100 * 1024 * 1024);
-
- // Obtain a reference to the root POA.
- CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
- PortableServer::POA_var poa = PortableServer::POA::_narrow(obj);
+ try
+ {
+ // Initialise the ORB.
+ CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "omniORB3");
+ omniORB::MaxMessageSize(100 * 1024 * 1024);
+ // Obtain a reference to the root POA.
+ //
+ 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++)
+ {
+ 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" ); }
-
- // 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);
+ 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;
+ }
+
+ // 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.
- PortableServer::POAManager_var 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;
}
// $Header$
#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);
};
// $Header$
#include "utilities.h"
+#include "SALOME_LifeCycleCORBA.hxx"
#include "SALOMEDS_StudyManager_i.hxx"
#include "SALOMEDS_Study_i.hxx"
#include "SALOMEDS_SComponent_i.hxx"
#include <strstream>
using namespace std;
-#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);
}
TNsize[0]=5;
TNsize[1]=maxSize+1;
char Data[5][maxSize+1];
-// char **Data = new (char*)[5];
-// for(int i=0;i<5;i++)
-// Data[i] = new char[maxSize+1+1];
for(index=0;index<5;index++) {
strcpy(Data[index],Val[index]);
for(int a = strlen(Data[index]) + 1; a < maxSize; a++) Data[index][a] = ' '; // mpv: for ASCII format
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"
using namespace std;
+
#define DIRECTORYID 16661
#define FILEID "FILE: "
#define FILELOCALID 26662
_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.2"
+msgstr "Version 1.4.0"
msgid "INF_COPYRIGHT"
msgstr " "
#: QAD_Application.cxx:133
msgid "QAD_Application::APP_DEFAULTTITLE"
-msgstr "SALOME 1.2"
+msgstr "SALOME 1.4.0"
#: QAD_Desktop.cxx:424
msgid "QAD_Desktop::DESK_DEFAULTTITLE"
-msgstr "SALOME 1.2"
+msgstr "SALOME 1.4.0"
QAD_FileDlg.h \
QAD_FileValidator.h \
QAD_Help.h \
- QAD_HelpWindow.h \
QAD_PyInterp.h \
QAD_LeftFrame.h \
QAD_ListMenuIdAction.h \
SALOMEGUI_SetValueDlg.h \
SALOMEGUI_SetupCurveDlg.h \
SALOMEGUI_CloseDlg.h
-
+
# .po files to transform in .qm
PO_FILES = \
QAD_FileDlg.cxx \
QAD_FileValidator.cxx \
QAD_Help.cxx \
- QAD_HelpWindow.cxx \
PyInterp_base.cxx \
QAD_PyInterp.cxx \
QAD_PyInterp_mono.cxx \
SALOME_DataMapNodeOfDataMapOfIOMapOfInteger_0.cxx \
SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger_0.cxx \
SALOMEGUI_TrihedronSizeDlg.cxx \
+ SALOMEGUI_ExternalBrowserDlg.cxx \
SALOMEGUI_LoadStudiesDlg.cxx \
SALOMEGUI_TableDlg.cxx \
SALOMEGUI_NameDlg.cxx \
SALOMEGUI_SetValueDlg.cxx \
SALOMEGUI_SetupCurveDlg.cxx \
- SALOMEGUI_CloseDlg.cxx
-
+ SALOMEGUI_CloseDlg.cxx \
+ SALOMEGUI_ActivateComponentDlg.cxx
LIB_MOC = \
SALOMEGUI_Application.h \
SALOMEGUI_Desktop.h \
QAD_Desktop.h \
QAD_DirListDlg.h \
QAD_FileDlg.h \
- QAD_HelpWindow.h \
QAD_ListView.h \
QAD_ObjectBrowser.h \
QAD_Operation.h \
SALOMEGUI_OpenWith.h \
SALOMEGUI_StudyPropertiesDlg.h \
SALOMEGUI_TrihedronSizeDlg.h \
+ SALOMEGUI_ExternalBrowserDlg.h \
SALOME_Selection.h \
SALOMEGUI_LoadStudiesDlg.h \
SALOMEGUI_ViewChoiceDlg.h \
SALOMEGUI_TableDlg.h \
SALOMEGUI_NameDlg.h \
SALOMEGUI_SetupCurveDlg.h \
- SALOMEGUI_CloseDlg.h
-
+ SALOMEGUI_CloseDlg.h \
+ SALOMEGUI_ActivateComponentDlg.h
LIB_CLIENT_IDL = SALOMEDS.idl \
SALOMEDS_Attributes.idl \
SALOME_ModuleCatalog.idl \
SALOME_Component.idl \
SALOME_Exception.idl
-CPPFLAGS+=$(QT_INCLUDES) $(PYTHON_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(QWT_INCLUDES)
-LDFLAGS+=$(QT_MT_LIBS) $(OCC_KERNEL_LIBS) $(VTK_LIBS) $(QWT_LIBS) -lSalomeNS -lqsplitterP -lSalomeLifeCycleCORBA -lOpUtil -lSalomeObject
+CPPFLAGS+=$(QT_INCLUDES) $(PYTHON_INCLUDES) $(OCC_INCLUDES)
+LDFLAGS+=$(QT_MT_LIBS) -lSalomeNS -lqsplitterP -lSalomeLifeCycleCORBA -lOpUtil -lSalomeObject
LIBS+= $(PYTHON_LIBS)
*/
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 "Utils_SINGLETON.hxx"
#define INCLUDE_MENUITEM_DEF
+#define DEFAULT_BROWSER "mozilla"
+
#include "QAD.h"
#include "QAD_Help.h"
#include "QAD_ObjectBrowser.h"
#include "QAD_Resource.h"
#include "QAD_FileDlg.h"
-#include "QAD_HelpWindow.h"
+//NRI #include "QAD_HelpWindow.h"
#include "QAD_DirListDlg.h"
#include "QAD_WaitCursor.h"
#include "SALOMEGUI_OpenWith.h"
#include "SALOMEGUI_StudyPropertiesDlg.h"
#include "SALOMEGUI_TrihedronSizeDlg.h"
+#include "SALOMEGUI_ExternalBrowserDlg.h"
#include "SALOMEGUI_LoadStudiesDlg.h"
#include "SALOME_Selection.h"
#include "SALOME_InteractiveObject.hxx"
#include "SALOME_ListIteratorOfListIO.hxx"
#include "SALOMEGUI_AboutDlg.h"
#include "SALOMEGUI_ViewChoiceDlg.h"
+#include "SALOMEGUI_SetValueDlg.h"
#include "utilities.h"
#include "SALOMEGUI_CloseDlg.h"
+#include "SALOMEGUI_ActivateComponentDlg.h"
// QT Includes
#include <qlabel.h>
#include <qfontdialog.h>
#include <qlineedit.h>
#include <qdatetime.h>
+#include <qthread.h>
#if QT_VERSION > 300
#include <qlistbox.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 ]
myActiveApp(0),
myActiveStudy(0),
myCntUntitled(0),
-myHelpWindow(0),
+//NRImyHelpWindow(0),
myDefaultTitle( tr("DESK_DEFAULTTITLE") ),
myQueryClose( true )
{
myToolBarAction.clear();
myApps.clear();
delete resourceMgr;
- if (myHelpWindow)
- myHelpWindow->close();
+//NRI if (myHelpWindow)
+// myHelpWindow->close();
resourceMgr = 0;
QAD_Application::desktop = 0;
}
*/
bool QAD_Desktop::eventFilter( QObject* o, QEvent* e )
{
- if ( e->type() == QEvent::ContextMenu ) {
- QContextMenuEvent* ce = (QContextMenuEvent*)e;
- if ( o->inherits("QRenameEdit") ) {
+ if (e->type() == 2000 ) {
+ QMessageBox::information (this, tr ( "Help Information" ), tr ( "Can't run choosen browser.\nRunning default browser (Mozilla). "));
+ return TRUE;
+ }
+ else if (e->type() == 2001 ) {
+ QMessageBox::critical(this, tr ( "Help Error" ), tr ( "Can't run the default browser.") );
+ return TRUE;
+ }
+ else if ( e->type() == QEvent::ContextMenu ) {
+ QContextMenuEvent* ce = (QContextMenuEvent*)e;
+ if ( o->inherits("QRenameEdit") ) {
return TRUE;
}
else if ( o->inherits("QLineEdit") ) {
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* externalBrowserAction = new QActionP( "", tr("MEN_DESK_PREF_EXTERNAL_BROWSER"), 0, this );
+ QAD_ASSERT(connect( externalBrowserAction, SIGNAL(activated()), this, SLOT(onExternalBrowser() )));
+ externalBrowserAction->addTo( &myPrefPopup );
+ myStdActions.insert( PrefExternalBrowserId, externalBrowserAction );
+
+ myPrefPopup.insertSeparator();
/* BrowserPopup */
myPrefPopup.insertItem( tr("MEN_DESK_PREF_OBJECTBROWSER"), &myObjBrowserPopup );
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 );
this, SLOT( onHelpContents() )));
helpContentsAction->addTo( &myHelpPopup );
myStdActions.insert( HelpContentsId , helpContentsAction );
+
+ id = myHelpPopup.insertSeparator();
+
+ /* GUI contents */
+ // NRI : Temporary commented
+
+// QActionP* helpContentsActionGUI = new QActionP( "", tr("MEN_DESK_HELP_GUICONTENTS"), 0, this );
+// helpContentsActionGUI->setStatusTip ( tr("PRP_DESK_HELP_GUICONTENTS") );
+// QAD_ASSERT(connect( helpContentsActionGUI, SIGNAL(activated()),
+// this, SLOT( onHelpContentsGUI() )));
+// helpContentsActionGUI->addTo( &myHelpPopup );
+// myStdActions.insert( HelpContentsId , helpContentsActionGUI );
+
+ /* TUI contents */
+ QActionP* helpContentsActionTUI = new QActionP( "", tr("MEN_DESK_HELP_TUICONTENTS"), 0, this );
+ helpContentsActionTUI->setStatusTip ( tr("PRP_DESK_HELP_TUICONTENTS") );
+ QAD_ASSERT(connect( helpContentsActionTUI, SIGNAL(activated()),
+ this, SLOT( onHelpContentsTUI() )));
+ helpContentsActionTUI->addTo( &myHelpPopup );
+ myStdActions.insert( HelpContentsId , helpContentsActionTUI );
/* search */
// QActionP* helpSearchAction = new QActionP( "", tr("MEN_DESK_HELP_SEARCH"), 0, this );
else
{ /* default icon and title */
setIcon( myDefaultIcon );
+ qApp->processEvents();
setCaption( myDefaultTitle );
}
}
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
*/
return "";
}
-/*!
- gets application Help Window (and creates if necessary)
-*/
-QAD_HelpWindow* QAD_Desktop::getHelpWindow()
-{
- if (!myHelpWindow) {
- myHelpWindow = new QAD_HelpWindow();
+// /*!
+// gets application Help Window (and creates if necessary)
+// */
+// QAD_HelpWindow* QAD_Desktop::getHelpWindow()
+// {
+// if (!myHelpWindow) {
+// myHelpWindow = new QAD_HelpWindow();
- QMap<QString,QString>::Iterator it;
- for( it = mapComponentName.begin(); it != mapComponentName.end(); ++it ) {
- QCString dir;
- QString root;
+// QMap<QString,QString>::Iterator it;
+// for( it = mapComponentName.begin(); it != mapComponentName.end(); ++it ) {
+// QCString dir;
+// QString root;
- // look for index.html and set homeDir
- // 1. $(MODULE_ROOT_DIR)/doc/index.html
- // 2. $(MODULE_ROOT_DIR)/doc/html/index.html
- // 3. $(MODULE_ROOT_DIR)/doc/html/html/index.html
-
- if (dir = getenv( QString( it.data() + "_ROOT_DIR")) ) {
- root = QAD_Tools::addSlash( QAD_Tools::addSlash(dir) + QAD_Tools::addSlash("share") + QAD_Tools::addSlash("salome") + "doc" );
- if ( QFileInfo( root + "index.html" ).exists() ) {
- helpContext( root + "index.html", "" );
- }
- else {
- root = QAD_Tools::addSlash( root + "html" );
- if ( QFileInfo( root + "index.html" ).exists() ) {
- helpContext( root + "index.html", "" );
- }
- else {
- root = QAD_Tools::addSlash( root + "html" );
- if ( QFileInfo( root + "index.html" ).exists() ) {
- helpContext( root + "index.html", "" );
- }
- }
- }
- }
- }
+// // look for index.html and set homeDir
+// // 1. $(MODULE_ROOT_DIR)/doc/index.html
+// // 2. $(MODULE_ROOT_DIR)/doc/html/index.html
+// // 3. $(MODULE_ROOT_DIR)/doc/html/html/index.html
+
+// if (dir = getenv( QString( it.data() + "_ROOT_DIR")) ) {
+// root = QAD_Tools::addSlash( QAD_Tools::addSlash(dir) + QAD_Tools::addSlash("share") + QAD_Tools::addSlash("salome") + "doc" );
+// if ( QFileInfo( root + "index.html" ).exists() ) {
+// helpContext( root + "index.html", "" );
+// }
+// else {
+// root = QAD_Tools::addSlash( root + "html" );
+// if ( QFileInfo( root + "index.html" ).exists() ) {
+// helpContext( root + "index.html", "" );
+// }
+// else {
+// root = QAD_Tools::addSlash( root + "html" );
+// if ( QFileInfo( root + "index.html" ).exists() ) {
+// helpContext( root + "index.html", "" );
+// }
+// }
+// }
+// }
+// }
- connect(myHelpWindow, SIGNAL(helpWindowClosed()), this, SLOT(onHelpWindowClosed()));
- }
- return myHelpWindow;
-}
+// connect(myHelpWindow, SIGNAL(helpWindowClosed()), this, SLOT(onHelpWindowClosed()));
+// }
+// return myHelpWindow;
+// }
/*!
Called when desktop is closing
//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;
}
it.current()->resize((int)(0.8*w), (int)(0.8*h));
}
-/*!
- called when help window closed
-*/
-void QAD_Desktop::onHelpWindowClosed()
-{
- myHelpWindow = 0;
-}
+// /*!
+// called when help window closed
+// */
+// void QAD_Desktop::onHelpWindowClosed()
+// {
+// myHelpWindow = 0;
+// }
/*!
Called when 'view status bar' option
//NRI : SAL2214
}
+// Helps to execute command
+class RunBrowser: public QThread {
+public:
+
+ RunBrowser(QString theApp, QString theParams, QString theHelpFile, QString theContext=NULL):
+ myApp(theApp), myParams(theParams), myHelpFile("file:" + theHelpFile + theContext), myStatus(0) {};
+
+ virtual void run()
+ {
+ QString aCommand;
+
+ if ( !myApp.isEmpty())
+ {
+ aCommand.sprintf("%s %s %s",myApp.latin1(),myParams.latin1(),myHelpFile.latin1());
+ myStatus = system(aCommand);
+ if(myStatus != 0)
+ {
+ QCustomEvent* ce2000 = new QCustomEvent (2000);
+ postEvent (qApp, ce2000);
+ }
+ }
+
+ if( myStatus != 0 || myApp.isEmpty())
+ {
+ myParams = "";
+ aCommand.sprintf("%s %s %s", QString(DEFAULT_BROWSER).latin1(),myParams.latin1(), myHelpFile.latin1());
+ myStatus = system(aCommand);
+ if(myStatus != 0)
+ {
+ QCustomEvent* ce2001 = new QCustomEvent (2001);
+ postEvent (qApp, ce2001);
+ }
+ }
+ }
+
+private:
+ QString myApp;
+ QString myParams;
+ QString myHelpFile;
+ int myStatus;
+
+};
+
/*!
Called on 'help\contents'
*/
void QAD_Desktop::onHelpContents()
+{ if (myActiveComp == "")
+ myActiveComp = getComponentUserName( "KERNEL" ); //NRI "Salome";
+
+ QCString dir;
+ QString root;
+ QString homeDir;
+ if (dir = getenv( getComponentName( myActiveComp ) + "_ROOT_DIR")) {
+ root = QAD_Tools::addSlash( QAD_Tools::addSlash(dir) + QAD_Tools::addSlash("share") + QAD_Tools::addSlash("salome") + QAD_Tools::addSlash("doc") + "html" );
+ if ( QFileInfo( root + "index.html" ).exists() ) {
+ homeDir = root;
+ } else {
+ QMessageBox::warning( this, tr("WRN_WARNING"),
+ QString( "%1index.html doesn't exist." ).arg(root), tr ("BUT_OK") );
+ return;
+ }
+ }
+
+ QString helpFile = QFileInfo( homeDir + "index.html" ).absFilePath();
+ QString anApp = QAD_CONFIG->getSetting("ExternalBrowser:Application");
+ QString aParams = QAD_CONFIG->getSetting("ExternalBrowser:Parameters");
+
+ RunBrowser* rs = new RunBrowser(anApp, aParams, helpFile);
+ rs->start();
+}
+
+/*!
+ Called on 'help\GUI Reference'
+*/
+void QAD_Desktop::onHelpContentsGUI()
{
- if (myActiveApp)
- myActiveApp->helpContents();
- else
- helpContents();
+// QCString dir;
+// QString root;
+// QString homeDir;
+
+// if ( (dir = getenv("KERNEL_ROOT_DIR")) ) {
+// root = QAD_Tools::addSlash( QAD_Tools::addSlash(dir) + "doc" );
+// root = QAD_Tools::addSlash( root + "guihtml" );
+// root = QAD_Tools::addSlash( root + "guihtml" );
+// if ( QFileInfo( root + "salomedoc.html" ).exists() ) {
+// homeDir = root;
+// }
+// }
+// if ( root.isEmpty() ) {
+// if ( QFileInfo( "/usr/local/doc/guihtml/salomedoc.html" ).exists() ) {
+// homeDir = "/usr/local/doc/guihtml/";
+// }
+// }
+// if ( root.isEmpty() )
+// root = "./doc/";
+// QString helpFile = QFileInfo( homeDir + "salomedoc.html" ).absFilePath();
+// QString anApp = QAD_CONFIG->getSetting("ExternalBrowser:Application");
+// QString aParams = QAD_CONFIG->getSetting("ExternalBrowser:Parameters");
+
+// RunBrowser* rs = new RunBrowser(anApp, aParams, helpFile);
+// rs->start();
+
}
/*!
- Called on 'help\search'
+ Called on 'help\TUI Reference'
*/
-void QAD_Desktop::onHelpSearch()
+void QAD_Desktop::onHelpContentsTUI()
{
- if (myActiveApp)
- myActiveApp->helpSearch();
- else
- helpSearch();
+ if (myActiveComp == "")
+ myActiveComp = getComponentUserName( "KERNEL" ); //NRI "Salome";
+
+ QCString dir;
+ QString root;
+ QString homeDir;
+ if (dir = getenv( getComponentName( myActiveComp ) + "_ROOT_DIR")) {
+ root = QAD_Tools::addSlash( QAD_Tools::addSlash(dir) + QAD_Tools::addSlash("share") + QAD_Tools::addSlash("salome") + QAD_Tools::addSlash("doc") + "html" );
+ if ( QFileInfo( root + "index.html" ).exists() ) {
+ homeDir = root;
+ } else {
+ QMessageBox::warning( this, tr("WRN_WARNING"),
+ QString( "%1index.html doesn't exist." ).arg(root), tr ("BUT_OK") );
+ return;
+ }
+ }
+
+ QString helpFile = QFileInfo( homeDir + "index.html" ).absFilePath();
+
+ QString anApp = QAD_CONFIG->getSetting("ExternalBrowser:Application");
+ QString aParams = QAD_CONFIG->getSetting("ExternalBrowser:Parameters");
+
+ RunBrowser* rs = new RunBrowser(anApp, aParams, helpFile);
+ rs->start();
}
+// /*!
+// Called on 'help\search'
+// */
+// void QAD_Desktop::onHelpSearch()
+// {
+// if (myActiveApp)
+// myActiveApp->helpSearch();
+// else
+// helpSearch();
+// }
+
/*!
Called on 'help\about'
*/
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 ) ;
bool libToolsGUI = true;
if( QAD_XmlHandler::_bibmap[ id ].isEmpty() )
{
-
- if ( dir = getenv("SALOME_SITE_DIR")) {
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + "lib" ;
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + "salome" ;
- dir = QAD_Tools::addSlash(dir) ;
-#ifdef WNT
- dir = dir + "libToolsGUI.dll" ;
-#else
- dir = dir + "libToolsGUI.so" ;
-#endif
- MESSAGE ( " GUI library = " << dir );
- fileInfo.setFile(dir) ;
- if (fileInfo.exists()) {
- ToolsLib = fileInfo.fileName() ;
- found = true;
- }
- }
-
- if ( (dir = getenv("SALOME_ROOT_DIR")) && !found ) {
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + "lib" ;
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + "salome" ;
- dir = QAD_Tools::addSlash(dir) ;
-#ifdef WNT
- dir = dir + "libToolsGUI.dll" ;
-#else
- dir = dir + "libToolsGUI.so" ;
-#endif
- MESSAGE ( " GUI library = " << dir );
- fileInfo.setFile(dir) ;
- if (fileInfo.exists()) {
- ToolsLib = fileInfo.fileName() ;
- found = true;
- }
- }
-
if ( (dir = getenv("KERNEL_ROOT_DIR")) && !found ) {
dir = QAD_Tools::addSlash(dir) ;
dir = dir + "lib" ;
else {
libToolsGUI = false;
SCRUTE( QAD_XmlHandler::_bibmap[ id ] ) ;
- if ( dir = getenv("SALOME_SITE_DIR")) {
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + "lib" ;
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + "salome" ;
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + QAD_XmlHandler::_bibmap[ id ].latin1() ;
- MESSAGE ( " GUI library = " << dir );
- fileInfo.setFile(dir) ;
- if (fileInfo.exists()) {
- ToolsLib = fileInfo.fileName() ;
- found = true;
- }
- }
-
- if ( (dir = getenv("SALOME_ROOT_DIR")) && !found ) {
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + "lib" ;
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + "salome" ;
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + QAD_XmlHandler::_bibmap[ id ].latin1() ;
- MESSAGE ( " GUI library = " << dir );
- fileInfo.setFile(dir) ;
- if (fileInfo.exists()) {
- ToolsLib = fileInfo.fileName() ;
- found = true;
- }
- }
-
if ( (dir = getenv("KERNEL_ROOT_DIR")) && !found ) {
dir = QAD_Tools::addSlash(dir) ;
dir = dir + "lib" ;
aButton->setOn(true);
}
}
- } else {
- QMessageBox::critical( 0,
- tr( "ERR_ERROR" ),
- tr( "WRN_LOAD_COMPONENT" ) );
- myCombo->setCurrentItem (0);
- for ( QToolButton* aButton=myComponentButton.first(); aButton; aButton=myComponentButton.next() ) {
- aButton->setOn(false);
- }
- }
+ } else if (component.compare(QString("Salome"))!= 0) {
+
+ SALOMEGUI_ActivateComponentDlg aDlg( this );
+ int res = aDlg.exec();
+
+ switch ( res )
+ {
+ case 1:
+ onNewStudy();
+ onComboActiveComponent(component,true);
+ break;
+ case 2:
+ onOpenStudy();
+ onComboActiveComponent(component,true);
+ break;
+ case 3:
+ onLoadStudy();
+ onComboActiveComponent(component,true);;
+ break;
+ case 0:
+ default:
+ putInfo( tr("INF_CANCELLED") );
+ myCombo->setCurrentItem (0);
+ for ( QToolButton* aButton=myComponentButton.first(); aButton; aButton=myComponentButton.next() ) {
+ aButton->setOn(false);
+ // return;
+ }
+ }
+ }
}
/*!
*/
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();
}
}
}
}
}
+void QAD_Desktop::onExternalBrowser()
+{
+
+ QString theApp = QAD_CONFIG->getSetting("ExternalBrowser:Application");
+ QString theParams = QAD_CONFIG->getSetting("ExternalBrowser:Parameters");
+
+ SALOMEGUI_ExternalBrowserDlg *Dlg = new SALOMEGUI_ExternalBrowserDlg(this);
+
+ if (!theApp.isEmpty())
+ {
+ QString theParams = QAD_CONFIG->getSetting("ExternalBrowser:Parameters");
+ Dlg->setSettings(theApp, theParams);
+ }
+ int r = Dlg->exec();
+ QString theAppFromDialog = Dlg->getApp();
+ QString theParamsFromDialog = Dlg->getParams();
+ delete Dlg;
+
+ if (r == QDialog::Accepted)
+ {
+ QAD_CONFIG->addSetting("ExternalBrowser:Application", theAppFromDialog );
+ QAD_CONFIG->addSetting("ExternalBrowser:Parameters", theParamsFromDialog );
+ }
+
+}
+
+
void QAD_Desktop::onDirList()
{
// getting dir list from settings
delete About;
}
-/* Help Search */
-void QAD_Desktop::helpSearch()
-{
-}
-
-/* Help Contents */
-void QAD_Desktop::helpContents()
-{
- if (myActiveComp == "")
- myActiveComp = getComponentUserName( "KERNEL" ); //NRI "Salome";
-
- QCString dir;
- QString root;
- if (dir = getenv( getComponentName( myActiveComp ) + "_ROOT_DIR")) {
- root = QAD_Tools::addSlash( QAD_Tools::addSlash(dir) + QAD_Tools::addSlash("share") + QAD_Tools::addSlash("salome") + "doc" );
- if ( QFileInfo( root + "index.html" ).exists() ) {
- helpContext( root + "index.html", "" );
- }
- else {
- root = QAD_Tools::addSlash( root + "html" );
- if ( QFileInfo( root + "index.html" ).exists() ) {
- helpContext( root + "index.html", "" );
- }
- else {
- root = QAD_Tools::addSlash( root + "html" );
- if ( QFileInfo( root + "index.html" ).exists() ) {
- helpContext( root + "index.html", "" );
- }
- }
- }
- }
+// /* Help Search */
+// void QAD_Desktop::helpSearch()
+// {
+// }
+
+// /* Help Contents */
+// void QAD_Desktop::helpContents()
+// {
+// if (myActiveComp == "")
+// myActiveComp = getComponentUserName( "KERNEL" ); //NRI "Salome";
+
+// QCString dir;
+// QString root;
+// if (dir = getenv( getComponentName( myActiveComp ) + "_ROOT_DIR")) {
+// root = QAD_Tools::addSlash( QAD_Tools::addSlash(dir) + QAD_Tools::addSlash("share") + QAD_Tools::addSlash("salome") + "doc" );
+// if ( QFileInfo( root + "index.html" ).exists() ) {
+// helpContext( root + "index.html", "" );
+// }
+// else {
+// root = QAD_Tools::addSlash( root + "html" );
+// if ( QFileInfo( root + "index.html" ).exists() ) {
+// helpContext( root + "index.html", "" );
+// }
+// else {
+// root = QAD_Tools::addSlash( root + "html" );
+// if ( QFileInfo( root + "index.html" ).exists() ) {
+// helpContext( root + "index.html", "" );
+// }
+// }
+// }
+// }
- //NRI getHelpWindow()->contents();
- getHelpWindow()->show();
- getHelpWindow()->raise();
- getHelpWindow()->setActiveWindow();
-}
+// // //NRI getHelpWindow()->contents();
+// // getHelpWindow()->show();
+// // getHelpWindow()->raise();
+// // getHelpWindow()->setActiveWindow();
+// }
/* Help Context */
-void QAD_Desktop::helpContext(const QString& source, const QString& context)
-{
- getHelpWindow()->context(source, context);
- getHelpWindow()->show();
- getHelpWindow()->raise();
- getHelpWindow()->setActiveWindow();
-}
+//void QAD_Desktop::helpContext(const QString& source, const QString& context)
+//{
+// //getHelpWindow()->context(source, context); //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"
-#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, 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 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();
QString getComponentName(const char *componentUserName);
QString getComponentUserName(const char *componentName);
- QAD_HelpWindow* getHelpWindow();
+ //NRI QAD_HelpWindow* getHelpWindow();
void onMouseMove(QMouseEvent*);
bool onMousePress(QMouseEvent*);
void onObjectBrowser();
void onMultiFileSave();
void onASCIISave();
+ void onUndoLevel();
+ void onExternalBrowser();
void onActivateApp(QAD_Application* app);
void onDeactivateApp(QAD_Application* app);
void onHelpContents();
- void onHelpSearch();
+ void onHelpContentsGUI();
+ void onHelpContentsTUI();
+/* void onHelpSearch(); */
void onHelpAbout();
void onNewWindow3d();
void onComboActiveComponent( const QString & , bool isLoadData);
void onCascade();
- void onHelpWindowClosed();
+/* NRI void onHelpWindowClosed(); */
protected:
QMenuBar* myMainMenu; /* the main menu bar */
QList<QAD_Menus> myMenusList;
QAD_Menus* myActiveMenus;
- 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();
id = popup->insertItem( tr( "EDIT_SELECTALL_CMD" ) );
idMap.insert(IdSelectAll, id);
popup->setItemEnabled( idMap[ IdCopy ], hasMarkedText() );
- popup->setItemEnabled( idMap[ IdSelectAll ],
- (bool)text().length() && !allSelected );
-
+ popup->setItemEnabled( idMap[ IdSelectAll ], !allSelected );
+ popup->setItemEnabled( idMap[ IdClear ], textLine(1)!=myPrompt );
+
int r = popup->exec( event->globalPos() );
delete popup;
#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 ]
*/
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 (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 xc = myListView->contentsX();
+ int yc = myListView->contentsY();
+ myListView->viewport()->setUpdatesEnabled( false );
+
myListView->clear();
myListViewMap.clear();
Update (SC, Item);
}
}
+ myListView->setContentsPos(xc,yc);
+
+ myListView->viewport()->setUpdatesEnabled( true );
+ myListView->viewport()->repaint( false );
/* Updating UseCase Browser ============================================= */
- UpdateUseCaseBrowser();
-}
+ 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
}
case Key_Up:
{
- // if Cntr+Key_Up event then scroll the commands stack up
+ // if Cntr+Key_Up event then move cursor up
if (ctrlPressed) {
- QString histLine = _currentPrompt;
+ QMultiLineEdit::cursorUp( );
+ }
+ // if Shift+Key_Up event then move cursor up and select the text
+ else if ( shftPressed && curLine > 0 ){
+ setCursorPosition(curLine-1, curCol, true);
+ }
+ // scroll the commands stack up
+ else {
+ QString histLine = _currentPrompt;
if (! _isInHistory)
{
_isInHistory = true;
endLine = numLines() -1;
setCursorPosition(endLine, lineLength(endLine));
}
- // if Shift+Key_Up event then move cursor up and select the text
- else if ( shftPressed && curLine > 0 ){
- setCursorPosition(curLine-1, curCol, true);
- }
- // move cursor up
- else { QMultiLineEdit::keyPressEvent( e ); }
break;
}
case Key_Down:
{
- // if Cntr+Key_Down event then scroll the commands stack down
+ // if Cntr+Key_Down event then move cursor down
if (ctrlPressed) {
- QString histLine = _currentPrompt;
+ QMultiLineEdit::cursorDown( );
+ }
+ // if Shift+Key_Down event then move cursor down and select the text
+ else if ( shftPressed && curLine < endLine ) {
+ setCursorPosition(curLine+1, curCol, true);
+ }
+ // scroll the commands stack down
+ else {
+ QString histLine = _currentPrompt;
QString nextCommand = _interp->getNext();
if (nextCommand.compare(TOP_HISTORY_PY) != 0)
{
endLine = numLines() -1;
setCursorPosition(endLine, lineLength(endLine));
}
- // if Shift+Key_Down event then move cursor down and select the text
- else if ( shftPressed && curLine < endLine ) {
- setCursorPosition(curLine+1, curCol, true);
- }
- //move cursor down
- else { QMultiLineEdit::keyPressEvent( e ); }
-
break;
}
case Key_Left:
Collects list of directories, separated by ';' where resources for module 'prefix'
can be situated
The order is following :
+ - <prefix>_ROOT_DIR/share/salome/resources directory
- CSF_<prefix>Resources env.var directory ( or directory list )
- - CSF_ResourcesDefaults env.var directory ( or directory list )
- ${HOME}/.salome/resources directory
- - ${SALOME_SITE_DIR}/share/salome/resources directory
- - ${SALOME_ROOT_DIR}/share/salome/resources directory
+ - KERNEL_ROOT_DIR/share/salome/resources directory
*/
QString QAD_ResourceMgr::collectDirs( const QString& prefix ) const
{
dirList.append( dirList.isEmpty() ? dir : ( QString( SEPARATOR ) + dir ) );
}
}
- // Try CSF_ResourcesDefaults env.var directory ( or directory list )
- cenv = getenv( "CSF_ResourcesDefaults" );
- if ( cenv ) {
- dir.sprintf( "%s", cenv );
- if ( !dir.isEmpty() )
- dirList.append( dirList.isEmpty() ? dir : ( QString( SEPARATOR ) + dir ) );
- }
// Try ${HOME}/.salome/resources directory
cenv = getenv( "HOME" );
if ( cenv ) {
dirList.append( dirList.isEmpty() ? dir : ( QString( SEPARATOR ) + dir ) );
}
}
- // Try ${SALOME_SITE_DIR}/share/salome/resources directory
- cenv = getenv( "SALOME_SITE_DIR" );
- if ( cenv ) {
- dir.sprintf( "%s", cenv );
- if ( !dir.isEmpty() ) {
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + "share" ;
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + "salome" ;
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + "resources" ;
- dir = QAD_Tools::addSlash(dir) ;
- dirList.append( dirList.isEmpty() ? dir : ( QString( SEPARATOR ) + dir ) );
- }
- }
- // Try ${SALOME_ROOT_DIR}/share/salome/resources directory
- cenv = getenv( "SALOME_ROOT_DIR" );
- if ( cenv ) {
- dir.sprintf( "%s", cenv );
- if ( !dir.isEmpty() ) {
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + "share" ;
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + "salome" ;
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + "resources" ;
- dir = QAD_Tools::addSlash(dir) ;
- dirList.append( dirList.isEmpty() ? dir : ( QString( SEPARATOR ) + dir ) );
- }
- }
// Try ${KERNEL_ROOT_DIR}/share/salome/resources directory
cenv = getenv( "KERNEL_ROOT_DIR" );
QCString dir;
QFileInfo fileInfo ;
bool found = false;
- if (myViewType == VIEW_OCC) {
- if ( dir = getenv("SALOME_SITE_DIR")) {
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + "lib" ;
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + "salome" ;
- dir = QAD_Tools::addSlash(dir) ;
-#ifdef WNT
- dir = dir + "libOCCViewer.dll" ;
-#else
- dir = dir + "libOCCViewer.so" ;
-#endif
- MESSAGE ( " GUI library = " << dir )
- fileInfo.setFile(dir) ;
- if (fileInfo.exists()) {
- ComponentLib = fileInfo.fileName();
- found = true;
- MESSAGE (" Found ")
- } else
- MESSAGE (" Not found ")
- }
-
- if ( (dir = getenv("SALOME_ROOT_DIR")) && !found ) {
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + "lib" ;
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + "salome" ;
- dir = QAD_Tools::addSlash(dir) ;
-#ifdef WNT
- dir = dir + "libOCCViewer.dll" ;
-#else
- dir = dir + "libOCCViewer.so" ;
-#endif
- MESSAGE ( " GUI library = " << dir )
- fileInfo.setFile(dir) ;
- if (fileInfo.exists()) {
- ComponentLib = fileInfo.fileName();
- found = true;
- MESSAGE (" Found ")
- } else
- MESSAGE (" Not found ")
- }
-
+ if (myViewType == VIEW_OCC) {
if ( (dir = getenv("KERNEL_ROOT_DIR")) && !found ) {
dir = QAD_Tools::addSlash(dir) ;
dir = dir + "lib" ;
MESSAGE (" Not found ")
}
} else if (myViewType == VIEW_VTK) {
-
- if ( dir = getenv("SALOME_SITE_DIR")) {
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + "lib" ;
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + "salome" ;
- dir = QAD_Tools::addSlash(dir) ;
-#ifdef WNT
- dir = dir + "libVTKViewer.dll" ;
-#else
- dir = dir + "libVTKViewer.so" ;
-#endif
- MESSAGE ( " GUI library = " << dir );
- fileInfo.setFile(dir) ;
- if (fileInfo.exists()) {
- ComponentLib = fileInfo.fileName();
- found = true;
- MESSAGE (" Found ");
- } else
- MESSAGE (" Not found ");
- }
-
- if ( (dir = getenv("SALOME_ROOT_DIR")) && !found ) {
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + "lib" ;
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + "salome" ;
- dir = QAD_Tools::addSlash(dir) ;
-#ifdef WNT
- dir = dir + "libVTKViewer.dll" ;
-#else
- dir = dir + "libVTKViewer.so" ;
-#endif
- MESSAGE ( " GUI library = " << dir );
- fileInfo.setFile(dir) ;
- if (fileInfo.exists()) {
- ComponentLib = fileInfo.fileName();
- found = true;
- MESSAGE (" Found ");
- } else
- MESSAGE (" Not found ");
- }
-
if ( (dir = getenv("KERNEL_ROOT_DIR")) && !found ) {
dir = QAD_Tools::addSlash(dir) ;
dir = dir + "lib" ;
MESSAGE (" Not found ");
}
} else if (myViewType == VIEW_GRAPHSUPERV) {
- if ( dir = getenv("SALOME_SITE_DIR")){
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + "lib" ;
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + "salome" ;
- dir = QAD_Tools::addSlash(dir) ;
-#ifdef WNT
- dir = dir + "libSUPERVGraph.dll" ;
-#else
- dir = dir + "libSUPERVGraph.so" ;
-#endif
- MESSAGE ( " GUI library = " << dir )
- fileInfo.setFile(dir) ;
- if (fileInfo.exists()) {
- ComponentLib = fileInfo.fileName() ;
- found = true;
- MESSAGE (" Found ")
- } else
- MESSAGE (" Not found ")
- }
-
- if ( (dir = getenv("SALOME_ROOT_DIR")) && !found ) {
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + "lib" ;
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + "salome" ;
- dir = QAD_Tools::addSlash(dir) ;
-#ifdef WNT
- dir = dir + "libSUPERVGraph.dll" ;
-#else
- dir = dir + "libSUPERVGraph.so" ;
-#endif
- MESSAGE ( " GUI library = " << dir )
- fileInfo.setFile(dir) ;
- if (fileInfo.exists()) {
- ComponentLib = fileInfo.fileName() ;
- found = true;
- MESSAGE (" Found ")
- } else
- MESSAGE (" Not found ")
- }
-
if ( (dir = getenv("KERNEL_ROOT_DIR")) && !found ) {
dir = QAD_Tools::addSlash(dir) ;
dir = dir + "lib" ;
MESSAGE (" Not found ")
}
} else if (myViewType == VIEW_PLOT2D) {
- if ( dir = getenv("SALOME_SITE_DIR")){
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + "lib" ;
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + "salome" ;
- dir = QAD_Tools::addSlash(dir) ;
-#ifdef WNT
- dir = dir + "libPlot2d.dll" ;
-#else
- dir = dir + "libPlot2d.so" ;
-#endif
- MESSAGE ( " GUI library = " << dir )
- fileInfo.setFile(dir) ;
- if (fileInfo.exists()) {
- ComponentLib = fileInfo.fileName() ;
- found = true;
- MESSAGE (" Found ")
- } else
- MESSAGE (" Not found ")
- }
-
- if ( (dir = getenv("SALOME_ROOT_DIR")) && !found ) {
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + "lib" ;
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + "salome" ;
- dir = QAD_Tools::addSlash(dir) ;
-#ifdef WNT
- dir = dir + "libPlot2d.dll" ;
-#else
- dir = dir + "libPlot2d.so" ;
-#endif
- MESSAGE ( " GUI library = " << dir )
- fileInfo.setFile(dir) ;
- if (fileInfo.exists()) {
- ComponentLib = fileInfo.fileName() ;
- found = true;
- MESSAGE (" Found ")
- } else
- MESSAGE (" Not found ")
- }
-
if ( (dir = getenv("KERNEL_ROOT_DIR")) && !found ) {
dir = QAD_Tools::addSlash(dir) ;
dir = dir + "lib" ;
#include <qapplication.h>
using namespace std;
-#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 "QAD_Desktop::MEN_DESK_HELP_CONTENTS"
msgstr "&Contents"
+#: QAD_Desktop.cxx:265
+msgid "QAD_Desktop::MEN_DESK_HELP_GUICONTENTS"
+msgstr "&GUI Reference"
+
+#: QAD_Desktop.cxx:265
+msgid "QAD_Desktop::MEN_DESK_HELP_TUICONTENTS"
+msgstr "&TUI Reference"
+
#: QAD_Desktop.cxx:273
msgid "QAD_Desktop::MEN_DESK_HELP_SEARCH"
msgstr "&Search ..."
msgid "MEN_DESK_PREF_VIEWER_TRIHEDRON"
msgstr "Trihedron size"
+#: QAD_Desktop.cxx:747
+msgid "MEN_DESK_PREF_EXTERNAL_BROWSER"
+msgstr "External browser"
+
msgid "MEN_DESK_PREF_DEFAULT_VIEWER"
msgstr "Default viewer"
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"
msgid "QAD_Desktop::PRP_DESK_HELP_CONTENTS"
msgstr "Shows the whole help contents"
+#: QAD_Desktop.cxx:266
+msgid "QAD_Desktop::PRP_DESK_HELP_GUICONTENTS"
+msgstr "Shows the GUI help contents"
+
+#: QAD_Desktop.cxx:266
+msgid "QAD_Desktop::PRP_DESK_HELP_TUICONTENTS"
+msgstr "Shows the TUI help contents"
+
#: QAD_Desktop.cxx:274
msgid "QAD_Desktop::PRP_DESK_HELP_SEARCH"
msgstr "Searches help for a topic"
msgid "WRN_WARNING"
msgstr "Warning"
-#: QAD_Desktop.cxx:1072
-msgid "QAD_Desktop::WRN_LOAD_COMPONENT"
-msgstr "Creates or opens before a study"
-
msgid "WRN_STUDY_LOCKED"
msgstr "This study is locked and therefore cannot be modified"
msgid "TOT_APP_EDIT_COPY"
msgstr "Copy"
+msgid "MEN_DESK_PREF_UNDO_LEVEL"
+msgstr "Undo Level"
+
msgid "MEN_APP_EDIT_COPY"
msgstr "&Copy"
# TOOL TIP
#---------------
-#: QAD_HelpWindow.cxx:57
-msgid "QAD_HelpWindow::TOT_HELPWINDOW_BACKWARD"
-msgstr "Avant"
-
-#: QAD_HelpWindow.cxx:60
-msgid "QAD_HelpWindow::TOT_HELPWINDOW_FORWARD"
-msgstr "Apres"
-
-#: QAD_HelpWindow.cxx:63
-msgid "QAD_HelpWindow::TOT_HELPWINDOW_HOME"
-msgstr "Home"
-
#: QAD_Application.cxx:173
msgid "QAD_Application::TOT_APP_EDIT_REDO"
msgstr "Répéter l'opération"
// Author : Michael Zorin (mzn)
// Module : SALOME
-using namespace std;
#include "SALOMEGUI_ActivateComponentDlg.h"
#include <qpushbutton.h>
#include <qlayout.h>
#include <qlabel.h>
#include <qmessagebox.h>
+using namespace std;
SALOMEGUI_ActivateComponentDlg::SALOMEGUI_ActivateComponentDlg ( QWidget * parent, const char * name, bool modal, WFlags f )
QCString dir;
QFileInfo fileInfo ;
bool found = false;
- if ( getenv("SALOME_SITE_DIR") ) {
- dir.fill('\0');
- dir.sprintf("%s",getenv("SALOME_SITE_DIR"));
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + "lib" ;
- dir = QAD_Tools::addSlash(dir) ;
-#ifdef WNT
- dir = dir + "lib" + parentComp.latin1() + "GUI.dll" ;
-#else
- dir = dir + "lib" + parentComp.latin1() + "GUI.so" ;
-#endif
- MESSAGE ( " GUI library = " << dir )
- fileInfo.setFile(dir) ;
- if (fileInfo.exists()) {
- ComponentLib = fileInfo.fileName();
- found = true;
- MESSAGE ( " found " )
- } else {
- MESSAGE ( " Not found " )
- }
- }
- if ( !found && getenv("SALOME_ROOT_DIR") ) {
- dir.fill('\0');
- dir.sprintf("%s", getenv("SALOME_ROOT_DIR"));
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + "lib" ;
- dir = QAD_Tools::addSlash(dir) ;
-#ifdef WNT
- dir = dir + "lib" + parentComp.latin1() + "GUI.dll" ;
-#else
- dir = dir + "lib" + parentComp.latin1() + "GUI.so" ;
-#endif
- MESSAGE ( " GUI library = " << dir )
- fileInfo.setFile(dir) ;
- if (fileInfo.exists()) {
- ComponentLib = fileInfo.fileName() ;
- found = true;
- MESSAGE ( " found " )
- } else {
- MESSAGE ( " Not found " )
- }
- }
- if ( !found && getenv( QAD_Application::getDesktop()->getComponentName(parentComp) + "_ROOT_DIR") ) {
+ if ( getenv( QAD_Application::getDesktop()->getComponentName(parentComp) + "_ROOT_DIR") ) {
dir.fill('\0');
dir.sprintf("%s", getenv( QAD_Application::getDesktop()->getComponentName(parentComp) + "_ROOT_DIR"));
dir = QAD_Tools::addSlash(dir) ;
viewFrame->Repaint();
if (isForeignGUIUsed)
- foreignGUI.DlClose();
+ ;//foreignGUI.DlClose(); // VSR: Fix crash on Display objects from non-parent components
myActiveStudy->updateObjBrowser(true);
}
// Module : SALOME
// $Header: /dn05/salome/CVS/SALOME_ROOT/SALOME/src/SALOMEGUI/SALOMEGUI_ExternalBrowserDlg.cxx
-using namespace std;
#include "SALOMEGUI_ExternalBrowserDlg.h"
#include <qbuttongroup.h>
#include "QAD_FileDlg.h"
#include "QAD_Tools.h"
+using namespace std;
/*
* Constructs a modal SALOMEGUI_ExternalBowserDlg which is a child of 'parent'
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"
msgstr "Trihedron"
+#: SALOMEGUI_ExternalBrowserDlg.cxx:26
+msgid "SALOMEGUI_ExternalBrowserDlg::MEN_EXTERNAL_BROWSER"
+msgstr "Choose external browser"
+
+#: SALOMEGUI_ExternalBrowserDlg.cxx:42
+msgid "SALOMEGUI_ExternalBrowserDlg::MEN_EXTERNAL_BROWSER_APP"
+msgstr "Application:"
+
+#: SALOMEGUI_ExternalBrowserDlg.cxx:50
+msgid "SALOMEGUI_ExternalBrowserDlg::MEN_EXTERNAL_BROWSER_PARAMS"
+msgstr "Parameters:"
+
+#: SALOMEGUI_ExternalBrowserDlg.cxx:58
+msgid "SALOMEGUI_ExternalBrowserDlg::MEN_EXTERNAL_BROWSER_BROWSE"
+msgstr "&Browse"
+
+#: SALOMEGUI_ExternalBrowserDlg.cxx:95
+msgid "SALOMEGUI_ExternalBrowserDlg::MEN_EXTERNAL_BROWSER_CHOOSEAPP"
+msgstr "Choose application"
+
+#: SALOMEGUI_ExternalBrowserDlg.cxx:126
+msgid "SALOMEGUI_ExternalBrowserDlg::MEN_EXTERNAL_BROWSER_NOTEXECUTABLE"
+msgstr "The file is not executable!"
+
+
+
#: SALOMEGUI_OpenWith.cxx:37
msgid "SALOMEGUI_OpenWith::MEN_COMPONENT_CHOICE1"
msgstr "Always use this component to open this type of object"
msgid "SALOMEGUI_CloseDlg::CLOSE_DESCRIPTION"
msgstr "Do you want to close or only unload the study ?"
+msgid "SALOMEGUI_ActivateComponentDlg::CAPTION"
+msgstr "Activate module"
+
+msgid "SALOMEGUI_ActivateComponentDlg::NEW"
+msgstr "&New"
+
+msgid "SALOMEGUI_ActivateComponentDlg::OPEN"
+msgstr "&Open"
+
+msgid "SALOMEGUI_ActivateComponentDlg::LOAD"
+msgstr "&Load"
+
+msgid "SALOMEGUI_ActivateComponentDlg::CANCEL"
+msgstr "&Cancel"
+
+msgid "SALOMEGUI_ActivateComponentDlg::ActivateComponent_DESCRIPTION"
+msgstr "You need to create, open or load study before."
+
msgid "SALOMEGUI_HELP_TITLE"
msgstr "SALOME Help"
#---------------
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"
#include <string>
#include <iostream>
-using namespace std;
-
#include "SALOME_Log.hxx"
+using namespace std;
SALOME_Log::SALOME_Log()
{
# endif /* WNT */
-using namespace std;
#include <iostream>
#include <strstream>
+using namespace std;
class SALOME_Log : public ostrstream
{
SALOME_Exception.idl
CPPFLAGS+=$(QT_INCLUDES) $(PYTHON_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) -DHAVE_CONFIG_H
-LDFLAGS+= $(PYTHON_LIBS) $(QT_MT_LIBS) $(OCC_LIBS) $(VTK_LIBS) $(OGL_LIBS) -lSalomeGUI -lvtkCommonPython -lvtkGraphicsPython -lvtkImagingPython -lVTKViewer
+LDFLAGS+= $(PYTHON_LIBS) $(QT_MT_LIBS) $(VTK_LIBS) $(OGL_LIBS) -lSalomeGUI -lvtkCommonPython -lvtkGraphicsPython -lvtkImagingPython -lVTKViewer
@CONCLUDE@
LIB_CLIENT_IDL = SALOME_Exception.idl
CPPFLAGS+=$(QT_INCLUDES) $(PYTHON_INCLUDES) $(SIP_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES)
-LIBS+= $(PYTHON_LIBS) $(SIP_LIBS) $(PYQT_LIBS) $(OCC_LIBS) $(VTK_LIBS) $(OGL_LIBS)
+LIBS+= $(PYTHON_LIBS) $(SIP_LIBS) $(PYQT_LIBS) $(VTK_LIBS) $(OGL_LIBS)
LDFLAGS+= -lSalomeGUI
{
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&);
};
def IDToSObject(id):
mySO = myStudy.FindObjectID(id);
return mySO
+
+ #--------------------------------------------------------------------------
+
+def PersistentPresentation(theStudy, theSO, theWithID):
+ # put the sobject's content (with subchildren) to the string
+ aResult = ""
+ attrs = theSO.GetAllAttributes()
+ aLen = len(attrs)
+ anUncopied = 0
+ for a in range(0,aLen):
+ attr = attrs[a]
+ if isinstance(attr,SALOMEDS._objref_AttributeTreeNode):
+ anUncopied += 1
+ elif isinstance(attr,SALOMEDS._objref_AttributeTarget):
+ anUncopied += 1
+ elif isinstance(attr,SALOMEDS._objref_AttributeReal) or \
+ isinstance(attr,SALOMEDS._objref_AttributeInteger) or \
+ isinstance(attr,SALOMEDS._objref_AttributeName) or \
+ isinstance(attr,SALOMEDS._objref_AttributeComment) or \
+ isinstance(attr,SALOMEDS._objref_AttributePersistentRef) or \
+ isinstance(attr,SALOMEDS._objref_AttributeLocalID) or \
+ isinstance(attr,SALOMEDS._objref_AttributeUserID):
+ aResult += " attribute value: " + str(attr.Value())
+ elif isinstance(attr,SALOMEDS._objref_AttributeIOR):
+ aResult += " attribute: IOR"
+ elif isinstance(attr,SALOMEDS._objref_AttributeSequenceOfReal) or \
+ isinstance(attr,SALOMEDS._objref_AttributeSequenceOfInteger):
+ aResult += " Sequence: " + str(attr.CorbaSequence())
+ elif isinstance(attr,SALOMEDS._objref_AttributeDrawable):
+ aResult += " Drawable: " + str(attr.IsDrawable())
+ elif isinstance(attr,SALOMEDS._objref_AttributeSelectable):
+ aResult += " Selectable: " + str(attr.IsSelectable())
+ elif isinstance(attr,SALOMEDS._objref_AttributeExpandable):
+ aResult += " Expandable: " + str(attr.IsExpandable())
+ elif isinstance(attr,SALOMEDS._objref_AttributeOpened):
+ aResult += " Opened: " + str(attr.IsOpened())
+ elif isinstance(attr,SALOMEDS._objref_AttributeTextColor):
+ aResult += " TextColor: " + str(attr.TextColor())
+ elif isinstance(attr,SALOMEDS._objref_AttributeTextHighlightColor):
+ aResult += " TextHighlightColor: " + str(attr.TextHighlightColor())
+ elif isinstance(attr,SALOMEDS._objref_AttributePixMap):
+ aResult += " PixMap: " + str(attr.GetPixMap())
+ elif isinstance(attr,SALOMEDS._objref_AttributeTableOfInteger) or \
+ isinstance(attr,SALOMEDS._objref_AttributeTableOfReal):
+ aResult += " Table with title: " + attr.GetTitle()
+ elif isinstance(attr,SALOMEDS._objref_AttributePythonObject):
+ aResult += " PythonObject: " + attr.GetObject()
+
+ if theWithID:
+ aResult = "sobject: " + theSO.GetID() + " nbattrs: " + str(aLen - anUncopied) + aResult + '\n'
+ else:
+ aResult = " nbattrs: " + str(aLen - anUncopied) + aResult + '\n'
+ anIter = theStudy.NewChildIterator(theSO)
+ while anIter.More():
+ aResult += PersistentPresentation(theStudy, anIter.Value(), theWithID)
+ anIter.Next()
+ return aResult
+
#--------------------------------------------------------------------------
+def GetTree(theSO):
+ # returns the document list tree (as list)
+ aResult = [theSO.GetID()]
+ anIter = myStudy.NewChildIterator(theSO)
+ while anIter.More():
+ aResult += GetTree(anIter.Value())
+ anIter.Next()
+ return aResult
+
+ #--------------------------------------------------------------------------
+
+def CheckCopyPaste(theSO, theInfo ,theComponentPaste):
+ aRoot = theSO
+ while aRoot.GetID() != "0:":
+ aRoot = aRoot.GetFather()
+ aTree = GetTree(aRoot)
+ aStudyPersist = PersistentPresentation(myStudy, aRoot, 1)
+
+ if not myStudyManager.CanCopy(theSO):
+ raise RuntimeError, "<CanCopy> for "+theInfo+" returns false"
+
+ if not myStudyManager.Copy(theSO):
+ raise RuntimeError, "<Copy> for "+theInfo+" returns false"
+
+
+ if not myStudyManager.CanPaste(theSO):
+ raise RuntimeError, "<CanPaste> for "+theInfo+" returns false"
+
+ # check: before paste study is not changed check
+ if aStudyPersist != PersistentPresentation(myStudy, aRoot, 1):
+ raise RuntimeError, "Study is changed before Paste calling for "+theInfo
+
+ aSObj = theSO
+ if theComponentPaste:
+ aSObj = theSO.GetFatherComponent()
+ theInfo = theInfo + "(paste for component)"
+ if not myStudyManager.Paste(aSObj):
+ raise RuntimeError, "<Paste> for "+theInfo+" returns false"
+ aNewTree = GetTree(aRoot)
+ aLen = len(aTree)
+ for a in range(0,aLen):
+ if aTree[a] != aNewTree[a]:
+ return myStudy.FindObjectID(aNewTree[a])
+
+ if aLen < len(aNewTree):
+ return myStudy.FindObjectID(aNewTree[aLen])
+
+ raise RuntimeError, "After Copy calling the tree is not changed"
+
+ #--------------------------------------------------------------------------
+def FindFileInDataDir(filename):
+ import os
+ datadir = os.getenv("DATA_DIR")
+ if datadir is not None:
+ import string
+ dirs = string.split(datadir, ":")
+ for dir in dirs:
+ file = dir + "/" + filename
+ if os.path.exists(file):
+ return file;
+ datadir = os.getenv("KERNEL_ROOT_DIR") + "/examples/"
+ file = datadir + filename
+ if os.path.exists(file):
+ return file;
+
+ return None
+
#--------------------------------------------------------------------------
# initialise the ORB
orb = CORBA.ORB_init([''], CORBA.ORB_ID)
import SALOMEDS
import os
+import SALOME_ModuleCatalog
+
+print "======================================================================"
+print " Get Catalog "
+print "======================================================================"
+obj = salome.naming_service.Resolve('Kernel/ModulCatalog')
+catalog = obj._narrow(SALOME_ModuleCatalog.ModuleCatalog)
+
print "======================================================================"
print " Create Study "
print "======================================================================"
+comp = catalog.GetComponent("GEOM")
+if comp is None:
+ raise RuntimeError,"Component GEOM not found in Module Catalog."
+
import geompy
print "================================="
print "============= Test SMESH ============================="
print
+comp = catalog.GetComponent("SMESH")
+if comp is None:
+ raise RuntimeError,"Component SMESH not found in Module Catalog."
+
+comp = catalog.GetComponent("MED")
+if comp is None:
+ raise RuntimeError,"Component MED not found in Module Catalog."
+
import SMESH
import smeshpy
-geom = salome.lcc.FindOrLoadComponent("FactoryServer", "Geometry")
+geom = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM")
myBuilder = salome.myStudy.NewBuilder()
smeshgui = salome.ImportComponentGUI("SMESH")
print "============= Test Supervisor ============================="
print
+comp = catalog.GetComponent("SUPERV")
+if comp is None:
+ raise RuntimeError,"Component SUPERV not found in Module Catalog."
+
from SuperV import *
import SALOMEDS
myStudy = salome.myStudy
myBuilder = myStudy.NewBuilder()
-SuperVision = lcc.FindOrLoadComponent("SuperVisionContainer","Supervision")
+SuperVision = lcc.FindOrLoadComponent("SuperVisionContainer","SUPERV")
father = myStudy.FindComponent("SUPERV")
if father is None:
father = myBuilder.NewComponent("SUPERV")
A1 = myBuilder.FindOrCreateAttribute(father, "AttributeName");
FName = A1._narrow(SALOMEDS.AttributeName)
- FName.SetValue("Supervision")
+ FName.SetValue( salome.sg.getComponentUserName("SUPERV") )
A2 = myBuilder.FindOrCreateAttribute(father, "AttributePixMap");
aPixmap = A2._narrow(SALOMEDS.AttributePixMap);
aPixmap.SetPixMap( "ICON_OBJBROWSER_Supervision" );
anIOR.SetValue(dataflow.getIOR())
import os
-dir= os.getenv("SALOME_ROOT_DIR")
+dir= os.getenv("SUPERV_ROOT_DIR")
if dir == None:
- raise RuntimeError, "SALOME_ROOT_DIR is not defined"
-xmlfile = dir +"/../SALOME_ROOT/SuperVisionTest/resources/GraphEssai.xml"
+ raise RuntimeError, "SUPERV_ROOT_DIR is not defined"
+xmlfile = dir +"/examples/GraphGeomEssai.xml"
print "Load dataflow from the file : "
print xmlfile
print
# Get Nodes
myGraph.PrintNodes()
-Add,Sub,Mul,Div = myGraph.Nodes()
-
-# Load Datas
-Addx = Add.Input("x",3.)
-Addy = Add.Input("y",4.5)
-Subx = Sub.Input("x",1.5)
-
-# Get Output Port
-Addz = Add.Port('z')
-Subz = Sub.Port('z')
-Mulz = Mul.Port('z')
-Divz = Div.Port('z')
# This DataFlow is "executable" : all pending Ports are defined with Datas
print myGraph.IsExecutable()
# Wait for Completion (but it is already done after event loop ...)
print "Done : ",myGraph.DoneW()
-# Get result
-print "Result : ",Divz.ToString()
-
-# Intermediate results :
-print "Intermediate Result Add\z : ",Addz.ToString()
-print "Intermediate Result Sub\z : ",Subz.ToString()
-print "Intermediate Result Mul\z : ",Mulz.ToString()
-
print " "
#print "Type : print myGraph.IsDone()"
#print " If execution is finished ==> 1 (true)"
if res != 1:
raise RuntimeError, "myGraph.Run() is not done"
-print " "
-print "Type : print Divz.ToString()"
-print " You will get the result"
-Divz.ToString()
-
print " "
print "Type : myGraph.PrintPorts()"
print " to see input and output values of the graph"
myGraph.PrintPorts()
-print " "
-print "Type : Add.PrintPorts()"
-Add.PrintPorts()
-
-print "Type : Sub.PrintPorts()"
-Sub.PrintPorts()
-
-print "Type : Mul.PrintPorts()"
-Mul.PrintPorts()
-
-print "Type : Div.PrintPorts()"
-print " to see input and output values of nodes"
-Div.PrintPorts()
-
# Export will create newsupervisionexample.xml and the corresponding .py file
tmpdir=os.getenv("TmpDir")
if tmpdir is None:
names.append(node.Name())
print names
-print "Load FactorialComponent component, create dataflow using its services and run execution"
-myPy = Graph('myPy')
-
-eval = myPy.Node('FactorialComponent','FactorialComponent','eval')
-eval.SetContainer('FactoryServerPy')
-
-myPy.IsValid()
-
-myPy.PrintPorts()
-
-myPy.Run( 3 )
-
-myPy.DoneW()
-
-myPy.State()
-
-myPy.PrintPorts()
-
+# Graph creation
+GraphInLines = Graph( 'GraphInLines' )
+GraphInLines.SetName( 'GraphInLines' )
+GraphInLines.SetAuthor( '' )
+GraphInLines.SetComment( '' )
+GraphInLines.Coords( 0 , 0 )
+
+# Creation of InLine Nodes
+PyAdd = []
+PyAdd.append( 'def Add(a,b) : ' )
+PyAdd.append( ' return a+b ' )
+PyAdd.append( '' )
+Add = GraphInLines.INode( 'Add' , PyAdd )
+Add.InPort( 'a' , 'long' )
+Add.InPort( 'b' , 'long' )
+Add.OutPort( 'f' , 'long' )
+Add.SetName( 'Add' )
+Add.SetAuthor( '' )
+Add.SetComment( 'Python function' )
+Add.Coords( 351 , 77 )
+PySub = []
+PySub.append( 'def Sub(a,b) : ' )
+PySub.append( ' return a-b ' )
+PySub.append( '' )
+Sub = GraphInLines.INode( 'Sub' , PySub )
+Sub.InPort( 'a' , 'long' )
+Sub.InPort( 'b' , 'long' )
+Sub.OutPort( 'f' , 'long' )
+Sub.SetName( 'Sub' )
+Sub.SetAuthor( '' )
+Sub.SetComment( 'Python function' )
+Sub.Coords( 86 , 333 )
+PyMul = []
+PyMul.append( 'def Mul(a,b) : ' )
+PyMul.append( ' return a*b ' )
+Mul = GraphInLines.INode( 'Mul' , PyMul )
+Mul.InPort( 'a' , 'long' )
+Mul.InPort( 'b' , 'long' )
+Mul.OutPort( 'Result' , 'long' )
+Mul.SetName( 'Mul' )
+Mul.SetAuthor( '' )
+Mul.SetComment( 'Python function' )
+Mul.Coords( 616 , 247 )
+
+# Creation of intermediate Output variables and of Control Links
+Addf = Add.Port( 'f' )
+Mula = GraphInLines.Link( Addf , Mul.Port( 'a' ) )
+Mula.AddCoord( 1 , 570 , 356 )
+Mula.AddCoord( 2 , 570 , 186 )
+Subf = Sub.Port( 'f' )
+Mulb = GraphInLines.Link( Subf , Mul.Port( 'b' ) )
+Mulb.AddCoord( 1 , 282 , 376 )
+Mulb.AddCoord( 2 , 282 , 442 )
+Addb = GraphInLines.Link( Subf , Add.Port( 'b' ) )
+Addb.AddCoord( 1 , 283 , 209 )
+Addb.AddCoord( 2 , 283 , 374 )
+Addb.AddCoord( 3 , 283 , 442 )
+
+# Creation of Input datas
+Adda = Add.Input( 'a' , 1)
+Suba = Sub.Input( 'a' , 3)
+Subb = Sub.Input( 'b' , 4)
+
+# Creation of Output variables
+MulResult = Mul.Port( 'Result' )
+
+GraphInLines.Run()
+
+GraphInLines.DoneW()
+
+GraphInLines.PrintPorts()
sg.updateObjBrowser(1);
print
print "============= Test VISU and MED ============================="
print
+
+comp = catalog.GetComponent("VISU")
+if comp is None:
+ raise RuntimeError,"Component VISU not found in Module Catalog."
+
import sys
import SALOMEDS
import SALOME
import visu_gui
medFile = "pointe.med"
-medFile = os.getenv('SALOME_ROOT_DIR') + '/../SALOME_ROOT/data/' + medFile
+medFile = os.getenv('KERNEL_ROOT_DIR') + '/examples/' + medFile
print "Load ", medFile
studyCurrent = salome.myStudyName
-med_comp = salome.lcc.FindOrLoadComponent("FactoryServer", "Med")
-myVisu = salome.lcc.FindOrLoadComponent("FactoryServer", "Visu")
+med_comp = salome.lcc.FindOrLoadComponent("FactoryServer", "MED")
+myVisu = salome.lcc.FindOrLoadComponent("FactoryServer", "VISU")
try:
if os.access(medFile, os.R_OK) :
+ 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()
print "med_obj - ", med_obj
- myField = visu_gui.visu.getFieldObjectFromStudy(2,1)
- aMeshName = "FILED_DOUBLE_MESH"
+ myField1 = visu_gui.visu.getFieldObjectFromStudy(2,1)
+ aMeshName = "maa1"
anEntity = VISU.NODE
- aTimeStampId = 0
-
- myResult1 = myVisu.ImportMedField(myField)
+ aTimeStampId = -1
+
+ myResult1 = myVisu.ImportMedField(myField1)
aMesh1 = myVisu.MeshOnEntity(myResult1, aMeshName, anEntity);
- aScalarMap1= myVisu.ScalarMapOnField(myResult1, aMeshName, anEntity, myField.getName(), aTimeStampId)
- if(myField.getNumberOfComponents() > 1) :
- aVectors = myVisu.VectorsOnField(myResult1, aMeshName, anEntity, myField.getName(), aTimeStampId)
-
- myResult2 = myVisu.ImportFile(medFile)
- aMeshName = "maa1"
- anEntity = VISU.NODE
- aMesh2 = myVisu.MeshOnEntity(myResult2, aMeshName, anEntity)
-
- aScalarMap2 = myVisu.ScalarMapOnField(myResult2, aMeshName, anEntity, myField.getName(), aTimeStampId)
- if(myField.getNumberOfComponents() > 1) :
- aCutPlanes = myVisu.CutPlanesOnField(myResult2, aMeshName, anEntity, myField.getName(), aTimeStampId)
-
- sg.updateObjBrowser(0)
+ aScalarMap1= myVisu.ScalarMapOnField(myResult1, aMeshName, anEntity, myField1.getName(), aTimeStampId)
+
+ myResult2 = myVisu.ImportFile(medFile);
+ aMesh2 = myVisu.MeshOnEntity(myResult2, aMeshName, anEntity);
+
+ aTimeStampId = 3
+ aScalarMap2= myVisu.ScalarMapOnField(myResult2, aMeshName, anEntity, myField1.getName(), aTimeStampId)
+
+ sg.updateObjBrowser(0)
else : print "We have no permission to rewrite medFile, so readStructFileWithFieldType can't open this file";
else : print "We have no permission to read medFile, it will not be opened";
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) $(OCC_KERNEL_LIBS) $(OCC_OCAF_LIBS) $(OCC_VIEWER_LIBS) $(OCC_MODELER_LIBS) -lSalomeNS -lSalomeGUI -lSalomeObject -lSalomeLifeCycleCORBA -lqsplitterP -lOpUtil -lSalomeLoggerServer -lPlot2d
+LDFLAGS+=$(QT_MT_LIBS) -lSalomeNS -lSalomeGUI -lSalomeObject -lSalomeLifeCycleCORBA -lqsplitterP -lOpUtil -lPlot2d -lSalomeVTKFilter -lSALOMELocalTrace
@CONCLUDE@
// Module : SALOME
// $Header$
-# include "Utils_ORB_INIT.hxx"
-# include "Utils_SINGLETON.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 ) ;
-
- CORBA::Object_var obj =orb->resolve_initial_references("RootPOA") ;
- PortableServer::POA_var poa = PortableServer::POA::_narrow(obj) ;
+ ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
+ ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting()) ;
+ CORBA::ORB_var &orb = init( argc , argv ) ;
- // 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)")
+ //
+ 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);
+ if(!CORBA::is_nil(poa))
+ pman = poa->the_POAManager();
+ if(!CORBA::is_nil(orb))
+ theObj = orb->resolve_initial_references("NameService");
+ if (!CORBA::is_nil(theObj))
+ inc = CosNaming::NamingContext::_narrow(theObj);
+ }
+ catch( CORBA::COMM_FAILURE& )
+ {
+ MESSAGE( "Session Server: CORBA::COMM_FAILURE: Unable to contact the Naming Service" );
+ }
+ if(!CORBA::is_nil(inc))
+ {
+ MESSAGE( "Session Server: Naming Service was found" );
+ if(EnvL==1)
+ {
+ for(int j=1; j<=NumberOfTries; j++)
+ {
+ if (j!=1)
+ a=nanosleep(&ts_req, &ts_rem);
+ try
+ {
+ object = inc->resolve(name);
+ }
+ catch(CosNaming::NamingContext::NotFound)
+ { MESSAGE( "Session Server: Logger Server wasn't found" );
+ }
+ catch(...)
+ {
+ MESSAGE( "Session Server: Unknown exception" );
+ }
+ if (!CORBA::is_nil(object))
+ {
+ 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)")
- 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() ;
- 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 ;
}
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+=$(OCC_KERNEL_LIBS) -lOpUtil -lSalomeLoggerServer
+LDFLAGS+= -lOpUtil $(CAS_LDPATH) -lTKernel
@CONCLUDE@
CPPFLAGS += $(QT_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES)
CXXFLAGS += $(OCC_CXXFLAGS)
-LDFLAGS += -lSalomeGUI
+LDFLAGS += -lSalomeGUI
@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("SALOME_ROOT_DIR") )
- command = QString( getenv( "SALOME_ROOT_DIR" ) ) + "/bin/runIDLparser -Wbcatalog=" + XmlFile;
- else if ( getenv("KERNEL_ROOT_DIR") )
- command = QString( getenv( "KERNEL_ROOT_DIR" ) ) + "/bin/runIDLparser -Wbcatalog=" + XmlFile;
+ if ( getenv("KERNEL_ROOT_DIR") )
+ command = QString( getenv( "KERNEL_ROOT_DIR" ) ) + "/bin/salome/runIDLparser " + IDLpath + " -Wbcatalog=" + XmlFile;
else {
QAD_MessageBox::error1( this,
tr("TOOLS_ERR_ERROR"),
- tr("SALOME_ROOT_DIR or KERNEL_ROOT_DIR variables are not defined"),
+ tr("KERNEL_ROOT_DIR variable is not defined"),
tr("TOOLS_BUT_OK") );
}
+
if (!Author.isEmpty()) command += ",author=" + Author;
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@
#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"
+using namespace std;
int main (int argc, char * argv[])
{
//Engines::Container_var iGenFact = Engines::Container::_narrow(obj);
// Obtain a reference to the root POA
- CORBA::Object_var obj = orb->resolve_initial_references("RootPOA") ;
- PortableServer::POA_var poa = PortableServer::POA::_narrow(obj) ;
-
+ //
+ long TIMESleep = 250000000;
+ int NumberOfTries = 40;
+ int a;
+ timespec ts_req;
+ ts_req.tv_nsec=TIMESleep;
+ ts_req.tv_sec=0;
+ timespec ts_rem;
+ ts_rem.tv_nsec=0;
+ ts_rem.tv_sec=0;
+ CosNaming::NamingContext_var inc;
+ PortableServer::POA_var poa;
+ CORBA::Object_var theObj;
+ CORBA::Object_var obj;
+ CORBA::Object_var object;
+ SALOME_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))
+ {
+ 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/" ;
BIN_CLIENT_IDL = Logger.idl SALOME_MPIObject.idl SALOME_MPIContainer.idl SALOME_TestMPIComponent.idl
BIN_SERVER_IDL =
-LDFLAGS+= -lSalomeNotification -lSalomeNS -lSalomeMPILifeCycleCORBA -lSalomeLifeCycleCORBA -lSalomeMPIContainer -lSalomeContainer -lRegistry -lOpUtil -lSalomeLoggerServer
+LDFLAGS+= -lSalomeNotification -lSalomeNS -lSalomeMPILifeCycleCORBA -lSalomeLifeCycleCORBA -lSalomeMPIContainer -lSalomeContainer -lRegistry -lOpUtil -lSALOMELocalTrace
@CONCLUDE@
Utils_Identity.cxx Utils_ORB_INIT.cxx \
Utils_DESTRUCTEUR_GENERIQUE.cxx
-LDFLAGS+= -lSalomeLoggerServer
+LDFLAGS+=
@CONCLUDE@
ATEXIT_( void )
{
ASSERT (Destructeurs==0);
- MESSAGE("ATEXIT constructor") ; // Messages nécéssaire pour pouvoir utiliser le logger dans la fonction Nettoyage
+ 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 HEREWEARE {cout<<flush ; cerr << __FILE__ << " [" << __LINE__ << "] : " << flush ;}
-//# define INFOS(chain) {HEREWEARE ; cerr << chain << endl ;}
-//# define PYSCRIPT(chain) {cout<<flush ; cerr << "---PYSCRIPT--- " << chain << endl ;}
-
-//VRV: T2.4 - replacement of these macros for using special CORBA server
-
-
-/* --- 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
+#define INFOS(msg) {SLog.putMessage(SLog<<__FILE__<<" ["<<__LINE__<<"] : "<<msg<<endl);}
+#define PYSCRIPT(msg) {SLog.putMessage(SLog<<"---PYSCRIPT--- "<<msg<<endl);}
+
+/* --- To print date and time of compilation of current source --- */
+
+#if defined ( __GNUC__ )
+#define COMPILER "g++"
+#elif defined ( __sun )
+#define COMPILER "CC"
+#elif defined ( __KCC )
+#define COMPILER "KCC"
+#elif defined ( __PGI )
+#define COMPILER "pgCC"
+#elif defined ( __alpha )
+#define COMPILER "cxx"
+#else
+#define COMPILER "undefined"
+#endif
+
+#ifdef INFOS_COMPILATION
+#error INFOS_COMPILATION already defined
+#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_
-
-/* --- the following MACROS are useful at debug time --- */
-
-//VRV: T2.4 - replacement of these macros for using special CORBA server
-
-#define MYTRACE GLogger << "- Trace " << __FILE__ << " [" << __LINE__ << "] : "
+ SLog.putMessage(\
+ SLog<<__FILE__<<" ["<< __LINE__<<"] : "\
+ << "COMPILED with " << COMPILER \
+ << ", " << __DATE__ \
+ << " at " << __TIME__ <<endl); }
-#define MESSAGE(msg) { GLogger.putMessage( MYTRACE <<msg<<endl<<ends); }
-#define SCRUTE(var) { GLogger.putMessage( MYTRACE << #var << "=" << var <<endl<<ends); }
+#ifdef _DEBUG_
-#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 */
EXPORT_HEADERS= VTKViewer_RenderWindow.h \
VTKViewer_ViewFrame.h \
VTKViewer_RenderWindowInteractor.h \
- VTKViewer_InteractorStyleSALOME.h
-
+ VTKViewer_InteractorStyleSALOME.h
+
# Libraries targets
LIB = libVTKViewer.la
LIB_SRC= VTKViewer.cxx \
VTKViewer_ViewFrame.cxx \
VTKViewer_RenderWindow.cxx \
VTKViewer_RenderWindowInteractor.cxx \
- VTKViewer_InteractorStyleSALOME.cxx
+ VTKViewer_InteractorStyleSALOME.cxx \
+ VTKViewer_Trihedron.cxx \
+ VTKViewer_VectorText.cxx \
+ VTKViewer_Utilities.cxx
LIB_MOC = \
VTKViewer.h \
VTKViewer_ViewFrame.h \
VTKViewer_RenderWindowInteractor.h \
VTKViewer_RenderWindow.h
-
-
+
LIB_CLIENT_IDL = SALOMEDS.idl \
SALOME_ModuleCatalog.idl \
SALOME_Component.idl \
CPPFLAGS+=$(QT_INCLUDES) $(OGL_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES)
CXXFLAGS+=
-LDFLAGS+=$(VTK_LIBS) $(OGL_LIBS) $(QT_MT_LIBS)
+LDFLAGS+=$(VTK_LIBS) $(OGL_LIBS) $(QT_MT_LIBS) -lSalomeGUI
@CONCLUDE@
#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 <vtkPolyDataMapper.h>
#include <vtkDataSetCollection.h>
#include <vtkImageData.h>
-using namespace std;
-
+#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();
}
//----------------------------------------------------------------------------
this->Interactor->Render();
}
+//----------------------------------------------------------------------------
+void VTKViewer_InteractorStyleSALOME::ControlLblSize(double aOldScale, double aNewScale) {
+ 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())
- {
- 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);
+ }
/* 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());
}*/
//VTKViewer_RenderWindow* aRW = dynamic_cast<VTKViewer_RenderWindow*>(this->Interactor->GetRenderWindow());
if (myGUIWindow) myGUIWindow->update();
+
}
#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();
public:
bool eventFilter(QObject* object, QEvent* event);
+ void ControlLblSize(double aOldScale, double aNewScale);
void startZoom();
void startPan();
void startGlobalPan();
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>
using namespace std;
//#include <GL/gl.h>
myRW->SetDisplayId((void*)x11Display());
myRW->SetWindowId((void*)winId());
myRW->DoubleBufferOn();
+ setMouseTracking(true);
}
VTKViewer_RenderWindow::~VTKViewer_RenderWindow() {
- //myRW->Delete(); //BUG SAL2954, Commented by SRN, to avoid problems when using rlogin
+ myRW->Delete(); //BUG SAL2954, Commented by SRN, to avoid problems when using rlogin
+ // Uncommented because of bug SAL3913
}
void VTKViewer_RenderWindow::paintEvent(QPaintEvent* theEvent) {
}
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);
+ }
+ }
}
#include <vtkVertex.h>
#include <vtkRendererCollection.h>
#include <vtkPolyDataWriter.h>
-using namespace std;
-
// QT Includes
#include <qkeycode.h>
+using namespace std;
+
VTKViewer_RenderWindowInteractor* VTKViewer_RenderWindowInteractor::New() {
vtkObject *ret = vtkObjectFactory::CreateInstance("VTKViewer_RenderWindowInteractor") ;
if( ret ) {
Edge_Actor = vtkActor::New();
Edge_Actor->PickableOff();
Edge_Actor->GetProperty()->SetColor(1,0,0);
- Edge_Actor->GetProperty()->SetRepresentationToSurface();
Edge_Actor->GetProperty()->SetLineWidth(5);
+ Edge_Actor->GetProperty()->SetRepresentationToWireframe();
Point_Actor = vtkActor::New();
Point_Actor->PickableOff();
Point_Actor->GetProperty()->SetColor(1,1,0);
- Point_Actor->GetProperty()->SetRepresentationToSurface();
Point_Actor->GetProperty()->SetPointSize(5);
+ Point_Actor->GetProperty()->SetRepresentationToPoints();
return ;
}
+
+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;
}
// GEOM actor
float r,g,b;
anActor->GetColor(r,g,b);
- return QColor(r*255,g*255,b*255);
+ return QColor(int(r*255),int(g*255),int(b*255));
}
else {
float color[3];
anActor->GetProperty()->GetColor(color);
- return QColor(color[0]*255,color[1]*255,color[2]*255);
+ return QColor(int(color[0]*255),int(color[1]*255),int(color[2]*255));
}
}
}
int aPartId = ite.Key();
if(0 > aPartId || aPartId >= aNbOfParts) break;
theSourcePolyData->GetCellPoints(aPartId,ptIds);
- aPolyData->InsertNextCell(theSourcePolyData->GetCellType(aPartId),ptIds);
+ vtkCell* aCell = theSourcePolyData->GetCell(aPartId);
+ aPolyData->InsertNextCell(aCell->GetCellType(),ptIds);
+ for (int i = 0, iEnd = aCell->GetNumberOfEdges(); i < iEnd; i++){
+ vtkCell* anEdgeCell = aCell->GetEdge(i);
+ aPolyData->InsertNextCell(VTK_LINE,anEdgeCell->GetPointIds());
+ }
}
ptIds->Delete();
theMapper->SetInput(aPolyData);
#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 "SALOME_PassThroughFilter.h"
+#include "SALOME_GeometryFilter.h"
+
#include "QAD_Settings.h"
#include "QAD_Config.h"
#include "QAD_Application.h"
#include <vtkActor.h>
#include <vtkRenderer.h>
#include <vtkTransform.h>
-#include <vtkPolyDataMapper.h>
-
-#include <vtkMath.h>
-#include <vtkTextSource.h>
-#include <vtkLine.h>
-#include <vtkConeSource.h>
-#include <vtkTextMapper.h>
-#include <vtkMapper2D.h>
-#include <vtkActor2D.h>
-#include <vtkWindowToImageFilter.h>
-#include <vtkTIFFWriter.h>
-#include <vtkVectorText.h>
-#include <vtkFollower.h>
+
using namespace std;
/*!
{
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) {
- vtkVectorText* aTxt = vtkVectorText::New();
- aTxt->SetText(text);
- vtkPolyDataMapper* textMapper = vtkPolyDataMapper::New();
- textMapper->SetInput(aTxt->GetOutput());
- vtkFollower* textActor = vtkFollower::New();
- textActor->SetMapper(textMapper);
- float aScale = 6 * 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->GetActiveCamera()->ParallelProjectionOn();
m_Renderer->LightFollowCameraOn();
+ m_Renderer->TwoSidedLightingOn();
// Set BackgroundColor
QString BgrColorRed = QAD_CONFIG->getSetting("VTKViewer:BackgroundColorRed");
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();
+}
+
+/*!
+ Fits all objects in the active view
+*/
+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();
+
+ Repaint();
}
/*!
Reset 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();
- camera->SetParallelScale(500);
- m_Renderer->ResetCameraClippingRange();
- m_RW->update();
+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){
- //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;
-
- 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);
- // 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
- theRenderer->GetActiveCamera()->SetParallelScale(width/2.0);
- //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);
- 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_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();
+ 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