--- /dev/null
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+INSTALL(CODE "MACRO(QT4_COMPILE_TS_ON_INSTALL MYLRELEASE MYTSFILE MYFULLDIR MYOUTQMFILE)
+ FILE(MAKE_DIRECTORY \${MYFULLDIR})
+ MESSAGE(STATUS \"Compiling \${MYTSFILE}\")
+ EXECUTE_PROCESS(COMMAND \${MYLRELEASE} \${MYTSFILE} -qm \${MYFULLDIR}/\${MYOUTQMFILE})
+ENDMACRO(QT4_COMPILE_TS_ON_INSTALL)")
+
+# This MACRO uses the following vars
+# - QT_LRELEASE_EXECUTABLE : (given by default by FindQT.cmake)
+#
+# MYTSFILES containing all ts files to be compiled.
+# WHERETOINSTALL contains directory (relative to install_prefix) where to install files after compilation of ts files too qm.
+MACRO(QT4_INSTALL_TS_RESOURCES MYTSFILES WHERETOINSTALL)
+ INSTALL(CODE "SET(INSTALL_TS_DIR ${WHERETOINSTALL})")
+ SET(MYSOURCES)
+ FOREACH(input ${MYTSFILES})
+ STRING(REGEX REPLACE ".ts" "" base ${input})
+ SET(output "${base}.qm")
+ INSTALL(CODE "QT4_COMPILE_TS_ON_INSTALL( \"${QT_LRELEASE_EXECUTABLE}\" \"${CMAKE_CURRENT_SOURCE_DIR}/${input}\" \"${CMAKE_INSTALL_PREFIX}/\${INSTALL_TS_DIR}\" ${output})")
+ ENDFOREACH(input ${MYIDLFILES})
+ENDMACRO(QT4_INSTALL_TS_RESOURCES)
--- /dev/null
+dnl Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+dnl
+dnl Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+dnl CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+dnl
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
+dnl
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl
+
+# Check SALOME version
+#
+
+AC_DEFUN([CHECK_SALOME_VERSION],[
+AC_REQUIRE([AC_LINKER_OPTIONS])dnl
+
+AC_CHECKING(for salome version)
+
+salome_version_ok=no
+SALOME_VERSION=""
+
+salomeVersionFile=${GUI_ROOT_DIR}/include/salome/GUI_version.h
+SALOME_VERSION=$(grep GUI_VERSION_STR ${salomeVersionFile} | cut -d'"' -f2 | cut -d"." -f1)
+
+if test "x${SALOME_VERSION}" = "x" ; then
+ AC_MSG_WARN("Cannot determine the SALOME version. GUI module is required. Specify the variable GUI_ROOT_DIR")
+else
+ salome_version_ok=yes
+ AC_MSG_RESULT(Using salome version ${SALOME_VERSION})
+fi
+
+AC_SUBST(SALOME_VERSION)
+AC_MSG_RESULT(for salome version: $salome_version_ok)
+
+])dnl
+
--- /dev/null
+#! /usr/bin/env python
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+import os, re
+
+# -----------------------------------------------------------------------------
+
+def set_env( args ):
+ """Add environment required for GUI module"""
+ vtk_overloads_dir = os.path.join( os.getenv( "GUI_ROOT_DIR" ), "lib", "paraview" )
+ dirs = re.split( ":|;", os.getenv( 'VTK_AUTOLOAD_PATH', vtk_overloads_dir ) )
+ if vtk_overloads_dir not in dirs: dirs[0:0] = [vtk_overloads_dir]
+ os.environ['VTK_AUTOLOAD_PATH'] = os.pathsep.join(dirs)
+ return
+
+
--- /dev/null
+/*!
+
+\page gl_2d_viewer_page GL 2D Viewer
+
+<h2>Operations</h2>
+
+The functionalities of GL viewer are available via its Viewer
+Toolbar. Buttons marked with small downward triangles have extended
+functionality which can be accessed by locking on them with left mouse
+button.
+
+\image html glviewer_toolbar.png
+<hr>
+
+\image html gl_view_dump.png
+
+<b>Dump View</b> - exports an object from the viewer in bmp, png or
+jpeg image format.
+<hr>
+
+\image html gl_view_fitall.png
+
+<b>Fit all</b> - scales the presentation so that it could fit within
+the Viewer boundaries.
+<hr>
+
+\image html gl_view_fitarea.png
+
+<b>Fit area</b> - resizes the view to place in the visible area only
+the contents of a frame drawn with pressed left mouse button.
+<hr>
+
+\image html gl_view_fitselect.png
+
+<b>Fit selection</b> - resizes the view to fit in the visible area
+only currently selected objects.
+<hr>
+
+\image html gl_view_zoom.png
+
+<b>Zoom</b> - allows to zoom in and out.
+<hr>
+
+\image html gl_view_pan.png
+
+<b>Panning</b> - if the represented objects are greater that the
+visible area and you don't wish to use <b>Fit all</b> functionality,
+click on this button and you'll be able to drag the scene to see its
+remote parts.
+<hr>
+
+\image html gl_view_glpan.png
+
+<b>Global panning</b> - allows to select a point to be the center of
+the presentation showing all displayed objects in the visible ares.
+<hr>
+
+\image html gl_view_reset.png
+
+<b>Reset</b> - restores the default position the scene.
+<hr>
+
+\anchor gl_background
+<h2>Background</h2>
+
+GL Viewer background can be customized using the "Change background"
+popup menu command that opens standard "Select Color" dialog box:
+
+\image html selectcolor.png
+
+*/
--- /dev/null
+/*!
+
+\page howtos How-To's and Best Practices
+
+These documents provide guidelines and best practices explaining different aspects
+and usage examples of SALOME platform.
+
+- \subpage use_case_builder
+- \subpage drag_and_drop
+- \subpage using_pluginsmanager
+
+\page use_case_builder Customize data tree representation in the Object browser by means of use case builder
+
+\tableofcontents
+
+In SALOME, the representation of the data tree in the Object browser for the \a full
+(CORBA-based) module is done basing on the study contents as it is supplied by SALOME
+data server (SALOMEDS). In contrast to the \a light module which data tree is completely
+defined and can be easily attuned by the module specific implementation, \a full module
+must publish its data in the CORBA study by means of the corresponding API of SALOME
+data server, namely \c SALOMEDS::StudyBuilder. As soon as data entities are published
+in the study, they are shown in the Object browser, in the same order as they appear
+in the study tree. Re-arrangement of the data entities with such approach is not a
+trivial task: for example, when copying/moving any data entity at the new position
+within the tree, it is necessary to copy all its attributes as well
+and to clear (in case of move operation) the data entity at the original position. Also, it is not possible to
+make some data items in the tree "invisible" for the user (though it might be useful).
+
+Use case builder provides an alternative and more flexible way for customizing the
+data tree representation. It implements another approach to the data tree hierarchy,
+based on the tree node attributes. With use case builder it is possible to arrange
+and easily re-arrange the data items in the data tree in any appropriate way.
+
+For example, with use case builder it is easy to implement such operations as
+\ref drag_and_drop "Drag and Drop" and Copy/Cut/Paste. With use case builder approach
+it is not important how data entities are arranged in the study tree, they even may
+lie on the same level - use case builder allows providing custom data tree
+representation, completely indepedent on the study data tree itself. It is even possible
+to hide some data entities in the tree representation while still keeping them in the
+study (to store specific module data).
+
+Object browser automatically checks it the module root data object
+contains a tree node attribute and switches to the browsing of the
+data tree for such module using the use case
+builder. Otherwise, it browses data using an ordinary study tree iterator. Thus, it is
+possible to have in the same study some modules based on use case builder approach and
+others not using it.
+
+\section use_case_builder_usage Use case builder usage
+
+To obtain a reference to the use case builder, the function \c GetUseCaseBuilder() of the
+\c SALOMEDS::Study interface can be used:
+
+\code
+interface Study
+{
+ // Get reference to the use case builder
+ UseCaseBuilder GetUseCaseBuilder();
+};
+\endcode
+
+\c SALOMEDS::UseCaseBuilder interface of the \c SALOMEDS CORBA module provides several
+methods that can be used to build a custom data tree. Its API is
+similar to the API of
+\c SALOMEDS::StudyBuilder interface - it operates with terms \a "father object" and
+\a "child object". In addition, use case builder uses term \a "current object" that is
+used as a parent of the children objects added if the parent is not explicitly
+specified.
+
+\code
+interface UseCaseBuilder
+{
+ // Set top-level root object of the use case tree as the current one.
+ // This method is usually used to add SComponent items to the top level of the tree
+ boolean SetRootCurrent();
+
+ // Set the object theObject as the current object of the use case builder
+ boolean SetCurrentObject(in SObject theObject);
+
+ // Append object SObject to the end of children list of the current object
+ boolean Append(in SObject theObject);
+
+ // Append object SObject to the end of children list of the parent object theFather
+ boolean AppendTo(in SObject theFather, in SObject theObject);
+
+ // Insert object theFirst before the object theNext (under the same parent object)
+ boolean InsertBefore(in SObject theFirst, in SObject theNext);
+
+ // Remove object from the use case tree (without removing it from the study)
+ boolean Remove(in SObject theObject);
+
+ // Check if the object theObject has children (in the use case tree)
+ boolean HasChildren(in SObject theObject);
+
+ // Get father object of the given object theObject in the use cases tree
+ SObject GetFather(in SObject theObject);
+
+ // Check if given object theObject is added to the use case tree
+ boolean IsUseCaseNode(in SObject theObject);
+
+ // Get the current object of the use case builder
+ SObject GetCurrentObject();
+};
+\endcode
+
+\section browse_use_case_tree Browsing use case data tree
+
+Browsing the use case tree can be done by means of the use case iterator, that is
+provided by the \c SALOMEDS::UseCaseIterator interface of the \c SALOMEDS CORBA
+module. Access to the use case iterator can be done via \c SALOMEDS::UseCaseBuilder
+interface:
+
+\code
+interface UseCaseBuilder
+{
+ // Get a reference to the use case iterator and initialize it
+ // by the given object theObject
+ UseCaseIterator GetUseCaseIterator(in SObject theObject);
+};
+\endcode
+
+The API of the \c SALOMEDS::UseCaseIterator interface is similar to the
+\c SALOMEDS::ChildIterator:
+
+\code
+interface UseCaseIterator
+{
+ // Activate or reset use case iterator; boolean parameter allLevels
+ // specifies if the iterator should browse recursively on all sub-levels or
+ // on the first sub-level only.
+ void Init(in boolean allLevels);
+ // Check if the iterator can browse to the next item
+ boolean More();
+ // Browse the iterator to the next object
+ void Next();
+ // Get the object currently pointed by the iterator
+ SObject Value();
+};
+\endcode
+
+Typical usage of the \c UseCaseIterator is as follows:
+
+\code
+// get use case builder
+SALOMEDS::UseCaseBuilder_var useCaseBuilder = study->GetUseCaseBuilder();
+
+// get the use case iterator
+SALOMEDS::UseCaseIterator_var iter = useCaseIter->GetUseCaseIterator( sobject.in() );
+// iterate through the sub-items recursively
+for ( useCaseIter->Init( true ); useCaseIter->More(); useCaseIter->Next() ) {
+ SALOMEDS::SObject_var child = useCaseIter->Value();
+ // do something with the child
+ // ...
+ // clean-up
+ child->UnRegister();
+}
+// clean-up
+useCaseIter->UnRegister();
+useCaseBuilder->UnRegister();
+\endcode
+
+\section use_case_compatibility Remark about compatibility with existing studies
+
+If you decide to switch your module to the use case builder approach to provide
+customization for the data tree representation, you must take care of compatibility
+with existing SALOME studies. Basically it means that you have to add
+a simple code to \c Load() (and \c LoadASCII() if necessary) method
+of your module, which adds tree node attributes to all data entities
+in the data tree of your module. The simplest way to do
+this is to iterate through all data items and recursively add them to
+the use case builder:
+
+\code
+// find component
+SALOMEDS::SComponent_var comp = study->FindComponent( "MYMODULE" );
+// add tree node attributes only if component data is present in the study
+if ( !CORBA::is_nil( comp ) ) {
+ // get the use case builder
+ SALOMEDS::UseCaseBuilder_var useCaseBuilder = study->GetUseCaseBuilder();
+ // check if tree nodes are already set
+ if ( !useCaseBuilder->IsUseCaseNode( comp.in() ) ) {
+ // set the current node of the use case builder to the root
+ useCaseBuilder->SetRootCurrent();
+ // add component item to the top level of the use case tree
+ useCaseBuilder->Append( comp.in() );
+ // iterate through all child items recursively
+ SALOMEDS::ChildIterator_var iter = study->NewChildIterator( comp.in() );
+ for ( iter->InitEx( true ); iter->More(); iter->Next() ) {
+ SALOMEDS::SObject_var sobj = iter->Value();
+ SALOMEDS::SObject_var father = sobj->GetFather();
+ // add an object to the corresponding level in the use case tree
+ useCaseBuilder->AppendTo( father.in(), sobj.in() );
+ // clean up (avoid memory leaks)
+ sobj->UnRegister();
+ father->UnRegister();
+ }
+ }
+ useCaseBuilder->UnRegister(); // clean up
+}
+\endcode
+
+\page drag_and_drop Implementing Drag and Drop functionality in SALOME module
+
+\tableofcontents
+
+<b>Drag and Drop</b> provides a simple visual mechanism to transfer
+information between and within applications.
+
+In some aspects Drag and drop operates similarly to the clipboard copy/cut/paste
+mechanism.
+
+Since SALOME GUI is implemented on Qt, the drag and drop functionality support
+is provided by means of the corresponding Qt mechanisms.
+
+Currently dragging and dropping of the items can be done within Object browser only,
+however this functionality can be extended to other GUI elements as well.
+
+\section enable_drag_and_drop Enabling drag and drop in SALOME module
+
+The Drag and drop functionality is enabled by default in the Object browser. However,
+to allow dragging of a data object or dropping data on it, it is necessary to redefine
+\c isDraggable() and \c isDropAccepted() methods of the corresponding class, a successor
+of the \c SUIT_DataObject. These methods are defined in the base class \c SUIT_DataObject
+and default implementation of both functions returns \c false, which prevents dragging and
+dropping:
+
+\code
+bool SUIT_DataObject::isDraggable() const
+{
+ return false;
+}
+
+bool SUIT_DataObject::isDropAccepted() const
+{
+ return false;
+}
+\endcode
+
+If your data model is based on the \c SUIT_DataObject and \c SUIT_TreeModel, just
+re-implement these functions in your successor data object class and return \c true
+when it is needed (for example, depending on the data object type, state, etc).
+
+Another alternative is available if your module is directly inherited from
+\c LightApp_Module or \c SalomeApp_Module class (as the majority of existing SALOME modules).
+The class \c LightApp_Module (and thus \c SalomeApp_Module also) already provides
+high-level API that can be used for enabling drag and drop functionality.
+
+To enable dragging, redefine \c isDraggable() method of your module class. In this method
+you can analyze the data object subject to the drag operation and decide if
+it is necessary to enable or prevent its dragging:
+
+\code
+bool MyModuleGUI::isDraggable( const SUIT_DataObject* what ) const
+{
+ bool result = false;
+ const MyDataObject* obj = dynamic_cast<const MyDataObject*>( what );
+ if ( obj ) {
+ // check if object can be dragged
+ result = <some condition>;
+ }
+ return result;
+}
+\endcode
+
+Note, that you should not invoke here method \c isDragEnabled() of your data object class
+(in case if it inherits \c LightApp_DataObject or \c SalomeApp_DataObject), unless you
+redefine methods \c isDraggable() and \c isDropAccepted() in your data object class.
+The reason is that the implementation of these methods in \c LightApp_DataObject class
+redirects calls to the \c LightApp_Module - be careful to avoid entering endless
+recursion loop.
+
+To allow data dropping to an object (the object under the mouse cursor in the
+Object browser during the drag operation) redefine \c isDropAccepted() method of your
+module class:
+
+\code
+bool MyModuleGUI::isDropAccepted( const SUIT_DataObject* where ) const
+{
+ bool result = false;
+ const MyDataObject* obj = dynamic_cast<const MyDataObject*>( where );
+ if ( obj ) {
+ // check if object supports dropping
+ result = <some condition>;
+ }
+ return result;
+}
+\endcode
+
+The caution about avoiding recursive loop mentioned above is also valid for
+\c isDropAccepted() method.
+
+\section handle_data_dropping Handling data dropping
+
+When dragging operation is completed (the data is dropped to an object) the module owning
+the item on which the data is dropped is notified by invoking its \c dropObjects() method:
+
+\code
+void LightApp_Module::dropObjects( const DataObjectList& what,
+ SUIT_DataObject* where,
+ const int row,
+ Qt::DropAction action )
+{
+}
+\endcode
+
+The default implementation does nothing. However, this method can be redifined in the
+successor class and handle the operation properly. The list of dropped
+data objects is passed via \c what parameter. The data object on which
+the data is dropped is passed via \c where parameter. The parameter \c row specifies in the children list
+the position of object where data is dropped; if this parameter is equal to -1, the
+data is dropped to the end of the children list. Performed drop action is passed
+via \c action parameter; possible values are \c Qt::CopyAction and \c Qt::MoveAction
+(other actions are currently unsupported).
+
+The method \c dropObjects() should analyze the parameters and apply
+the corresponding actions for rearrangement of the data tree, copying or moving the data items depending on the
+operation performed. For example:
+
+\code
+void MyModuleGUI::dropObjects( const DataObjectList& what, SUIT_DataObject* where,
+ const int row, Qt::DropAction action )
+{
+ if ( action != Qt::CopyAction && action != Qt::MoveAction )
+ return; // unsupported action
+
+ // get parent object
+ MyDataObject* whereObj = dynamic_cast<MyDataObject*>( where );
+ if ( !dataObj ) return; // wrong parent
+
+ // iterate through all objects being dropped
+ for ( int i = 0; i < what.count(); i++ ) {
+ MyDataObject* whatObj = dynamic_cast<MyDataObject*>( what[i] );
+ if ( !whatObj ) continue; // skip wrong objects
+ // perform copying or moving
+ copyOrMove( whatObj, // data object being copied/moved
+ whereObj, // target data object
+ row, // index in the target data object
+ action == Qt::CopyAction ); // true if copying is done
+ }
+ // update Object browser
+ getApp()->updateObjectBrowser( false );
+}
+\endcode
+
+In the above code the function \c copyOrMove() performs actual data tree rearrangement.
+
+\section drag_drop_light_modules Drag and Drop in "light" modules
+
+The data model of the \a light (not having CORBA engine) SALOME module is usually
+based on the custom tree of data objects. The general approach is to
+inherit a custom data
+object class from the \c LightApp_DataObject and a custom data model from the
+\c LightApp_DataModel class. The data model class is responsible for building the
+appropriate presentation of the data tree in the Object browser.
+
+Thus, the implementation of the drag and drop functionality in a \a light module (more
+precisely, the method \a dropObjects() as described above), consists in copying data
+entities (by creating new instances of the corresponding data object class) or moving
+existing data objects to the new position in a tree. The Object browser will update the
+tree representation automatically, as soon as \c updateObjectBrowser() function is called.
+
+\section drag_drop_full_modules Using UseCaseBuilder for Drag and Drop handling in "full" modules
+
+Drag and drop operation requires underlying data model to allow flexible re-arrangement of
+the data entities inside the data tree. In a \a full (CORBA engine based) SALOME
+module, which data model is usually based on the hierarchy of \c SALOMEDS::SObject entities
+provided by the data server functionality, re-arrangement of the data
+tree is not a trivial task.
+
+However, SALOME data server (\c SALOMEDS) CORBA module proposes a mechanism that can be used
+to customize data tree representation in a simple and flexible way -
+\ref use_case_builder "use case builder".
+
+With use case builder, the \c dropObjects() function can be easily implemented. For example:
+
+\code
+// GUI part: process objects dropping
+void MyModuleGUI::dropObjects( const DataObjectList& what, SUIT_DataObject* where,
+ const int row, Qt::DropAction action )
+{
+ if ( action != Qt::CopyAction && action != Qt::MoveAction )
+ return; // unsupported action
+
+ // get parent object
+ SalomeApp_DataObject* dataObj = dynamic_cast<SalomeApp_DataObject*>( where );
+ if ( !dataObj ) return; // wrong parent
+ _PTR(SObject) parentObj = dataObj->object();
+
+ // collect objects being dropped
+ MYMODULE_ORB::object_list_var objects = new MYMODULE_ORB::object_list();
+ objects->length( what.count() );
+ int count = 0;
+ for ( int i = 0; i < what.count(); i++ ) {
+ dataObj = dynamic_cast<SalomeApp_DataObject*>( what[i] );
+ if ( !dataObj ) continue; // skip wrong objects
+ _PTR(SObject) sobj = dataObj->object();
+ objects[i] = _CAST(SObject, sobj)->GetSObject();
+ count++;
+ }
+ objects->length( count );
+
+ // call engine function
+ engine()->copyOrMove( objects.in(), // what
+ _CAST(SObject, parentObj)->GetSObject(), // where
+ row, // row
+ action == Qt::CopyAction ); // isCopy
+
+ // update Object browser
+ getApp()->updateObjectBrowser( false );
+}
+
+// Engine part: perform actual data copying / moving
+void MyModule::copyOrMove( const MYMODULE_ORB::object_list& what,
+ SALOMEDS::SObject_ptr where,
+ CORBA::Long row, CORBA::Boolean isCopy )
+{
+ if ( CORBA::is_nil( where ) ) return; // bad parent
+
+ SALOMEDS::Study_var study = where->GetStudy(); // study
+ SALOMEDS::StudyBuilder_var studyBuilder = study->NewBuilder(); // study builder
+ SALOMEDS::UseCaseBuilder_var useCaseBuilder = study->GetUseCaseBuilder(); // use case builder
+ SALOMEDS::SComponent_var father = where->GetFatherComponent(); // father component
+ std::string dataType = father->ComponentDataType();
+ if ( dataType != "MYMODULE" ) return; // not a MYMODULE component
+
+ SALOMEDS::SObject_var objAfter;
+ if ( row >= 0 && useCaseBuilder->HasChildren( where ) ) {
+ // insert at a given row -> find insertion position
+ SALOMEDS::UseCaseIterator_var useCaseIt = useCaseBuilder->GetUseCaseIterator( where );
+ int i;
+ for ( i = 0; i < row && useCaseIt->More(); i++, useCaseIt->Next() );
+ if ( i == row && useCaseIt->More() ) {
+ objAfter = useCaseIt->Value();
+ }
+ }
+ // process all objects in a given list
+ for ( int i = 0; i < what.length(); i++ ) {
+ SALOMEDS::SObject_var sobj = what[i];
+ if ( CORBA::is_nil( sobj ) ) continue; // skip bad object
+ if ( isCopy ) {
+ // copying is performed
+ // get the name of the object
+ CORBA::String_var name = sobj->GetName();
+ // create a new object, as a child of the component object
+ SALOMEDS::SObject_var new_sobj = studyBuilder->NewObject( father );
+ new_sobj->SetAttrString( "AttributeName", name.in() );
+ sobj = new_sobj;
+ // ... perform other necessary data copying like
+ // adding the corresponding attributes or creation
+ // of servant data entities...
+ }
+ // insert the object or its copy to the use case tree
+ if ( !CORBA::is_nil( objAfter ) )
+ useCaseBuilder->InsertBefore( sobj, objAfter ); // insert at a given row
+ else
+ useCaseBuilder->AppendTo( where, sobj ); // append to the
+ end of the list
+ }
+}
+
+\endcode
+
+*/
--- /dev/null
+/*!
+
+\page qxscene_2d_viewer_page QxScene 2D Viewer
+
+<h2>Operations</h2>
+
+The functionalities of QxScene viewer are available via its Viewer
+Toolbar. Buttons marked with small downward triangles have extended
+functionality which can be accessed by locking on them with left mouse
+button.
+
+\image html qxviewer_toolbar.png
+<hr>
+
+\image html qx_view_fitall.png
+
+<b>Fit all</b> - scales the presentation so that it could fit within
+the Viewer boundaries.
+<hr>
+
+\image html qx_view_fitarea.png
+
+<b>Fit area</b> - resizes the view to place in the visible area only
+the contents of a frame drawn with pressed left mouse button.
+<hr>
+
+\image html qx_view_zoom.png
+
+<b>Zoom</b> - allows to zoom in and out.
+<hr>
+
+\image html qx_view_pan.png
+
+<b>Panning</b> - if the represented objects are greater that the
+visible area and you don't wish to use <b>Fit all</b> functionality,
+click on this button and you'll be able to drag the scene to see its
+remote parts.
+<hr>
+
+\image html qx_view_glpan.png
+
+<b>Global panning</b> - allows to select a point to be the center of
+the presentation showing all displayed objects in the visible ares.
+<hr>
+
+\image html qx_view_reset.png
+
+<b>Reset</b> - restores the default position the scene.
+<hr>
+
+For more details about QxScene viewer, refer to the SALOME YACS module
+User's guide.
+
+*/
--- /dev/null
+/*!
+
+\page using_input_widgets_page Using input widgets
+
+This section contains some hints that might be useful when working
+with SALOME GUI input widgets.
+
+<h2>Spin boxes</h2>
+
+This type of widgets is used for numeric (integer or floating-point)
+data input. Spin boxes are used in standard \b SALOME modules if the
+input value has a clearly defined input range (and precision in
+case of a floating-point value).
+
+Input precision has a specific semantics in \b SALOME floating-point
+spin boxes:
+- Positive precision value means that a number in the fixed-point format
+(corresponding to the "f" format specifier for C printf function) is
+expected. Positive precision value is the maximum allowed number of
+digits after the decimal separator.
+- Negative precision value means that a number either in the fixed-point
+or the scientific (exponetial) format is expected. This is similar to the
+behavior of the "g" format specifier for C printf function. Negative
+precision value is the maximum allowed number of significant digits in
+mantissa (note that one digit is always before the decimal separator).
+
+To make the user aware of an input value constraints applied by some
+\b SALOME operations, the following basic capabilties are provided by
+spin boxes:
+- The text input manually in a spin box by the user is checked to be a
+number of valid type (integer or floating-point).
+- The text is converted to a number and checked to be within the valid
+range.
+- Additionally, for floating-point data the input text is checked
+against the precision rules described above.
+
+If the input text in a spin box does not meet the
+constraints, the user is shown a message in a
+tooltip near the spin box just as he types in it. The tooltip contains
+information about the valid data range. For a floating-point input, the
+tooltip also contains information about the expected precision.
+
+In standard \b SALOME modules the precision value can be adjusted through
+\ref setting_preferences_page "user preferences" of the correspodning modules, and the tooltip contains a
+reference to the corresponding parameter in the preferences.
+
+On-line documentation for each standard SALOME module contains the
+list of user preferences that can be used for tuning floating-point
+precision for different types of input quantities.
+
+<h2>Spin boxes and SALOME Notebook</h2>
+
+Apart from the numeric input, spin boxes in some \b SALOME modules accept
+the names of \b Notebook variables (see \ref using_notebook "Using Notebook"
+page for more details about \b Notebook).
+
+If a spin box accepts variable names, then it is
+additionally checked whether the manually input text represents a variable name. Variable
+names should comply with the common naming rules for \b Python variables.
+If the input is neither a valid number nor a variable name,
+the tooltip informs the user that variable names are also acceptable in this spin box.
+
+
+*/
--- /dev/null
+/*!
+
+\page using_pluginsmanager Extend SALOME gui functions using python plugins
+
+-# \ref S1_SALOMEPLUGINS
+-# \ref S2_SALOMEPLUGINS
+-# \ref S3_SALOMEPLUGINS
+-# \ref S4_SALOMEPLUGINS
+-# \ref S5_SALOMEPLUGINS
+
+\section S1_SALOMEPLUGINS Objectives
+
+The SALOME python plugin manager allows the end user to extend the
+graphic interface of SALOME with custom functions written as python
+modules. The screenshots below show the example of a tool that creates
+a mesh from a set of geometrical parameters with the support of
+simple graphical interface:
+
+The default menu for plugins is "Tool->Extensions":
+\image html SALOME_pythonplugins_menu.png
+
+In this example, the plugin provides a small interface to input the
+parameters (not provided by the plugin manager):
+\image html SALOME_pythonplugins_dialog.png
+
+Then creates the mesh model:
+\image html SALOME_pythonplugins_result.png
+
+In this example, the end user has to write:
+
+-# the python script that creates the mesh from the parameters, using
+ the GEOM and SMESH python interface, as in a clasic use case.
+-# the dialog box in PyQt to input the parameters
+-# the file salome_plugins.py that declares the plugins
+
+This page explains only the last point.
+
+\section S2_SALOMEPLUGINS Principles
+
+The general form of the file salome_plugins.py is:
+
+\code
+import salome_pluginsmanager
+
+# Creation of the plugin
+def myplugin1(context):
+ ...
+ # Here is the code of the plugin myplugin1
+ ...
+
+def myplugin2(context):
+ ...
+ # Here is the code of the plugin myplugin2
+ ...
+
+# Declaration of the plugins to the pluginsmanager
+salome_pluginsmanager.AddFunction('My plugin n°1', 'This action runs the plugin n°1', myplugin1)
+salome_pluginsmanager.AddFunction('My plugin n°2', 'This action runs the plugin n°2', myplugin2)
+...
+\endcode
+
+The procedure is to define a function that implements the plugin, and
+to declare this function to the plugins manager. The implementation
+can be very variable. It is advisable to consider this function as a
+proxy to your code that you can manage in a python package
+installed in the standard SALOME python directories.
+
+In this code, the variable "context" is automatically transmitted by
+the pluginmanager when you request the plugin. This context provides
+you with at at least the following attributes:
+
+\code
+activeStudy = context.study
+salomegui = context.sg
+\endcode
+
+Once written, this script salome_plugin.py has to be moved to a
+specific place on your filesystem where SALOME is programmed to search
+for plugins. The possible directories are (in search order):
+
+-# The directory <*_ROOT_DIR>/share/salome/plugins/<module_name>, when
+ this plugin is developped in the framework of a SALOME module
+ (<*_ROOT_DIR> is the root installation directory of the module, and
+ <module_name> is the name of the module in low letters).
+-# The directory ~/.config/salome/Plugins for personnal end user
+ plugins.
+-# Any path in the shell variable SALOME_PLUGIN_PATH (each path must be
+ separated by a comma ":" for unix and ";" for windows). This
+ variable should be set and exported before running the SALOME application.
+
+\section S3_SALOMEPLUGINS A complete example
+
+Suppose that you write a SALOME script that creates a trihedron for each of
+your studies (a simple and standard SALOME script, that every end user
+is capable to write if he reads the documentation and follows the
+training course):
+
+\code
+# Intialize the geompy factory with the active study
+import salome
+import geompy
+geompy.init_geom(salome.myStudy)
+
+# Create the objects
+Vx = geompy.MakeVectorDXDYDZ(10, 0, 0)
+Vy = geompy.MakeVectorDXDYDZ(0, 10, 0)
+Vz = geompy.MakeVectorDXDYDZ(0, 0, 10)
+origin = geompy.MakeVertex(0, 0, 0)
+
+# Register the objects in the active study
+geompy.addToStudy( Vx, "Vx" ))
+geompy.addToStudy( Vy, "Vy" ))
+geompy.addToStudy( Vz, "Vz" ))
+geompy.addToStudy( origin, "origin" ))
+\endcode
+
+The job consists in creating the file salome_plugins.py as follows:
+
+\code
+import salome_pluginsmanager
+def trihedron(context):
+ import geompy
+ # Intialize the geompy factory with the active study
+ activeStudy = context.study
+ geompy.init_geom(activeStudy)
+ # Create the objects
+ Vx = geompy.MakeVectorDXDYDZ(10, 0, 0)
+ Vy = geompy.MakeVectorDXDYDZ(0, 10, 0)
+ Vz = geompy.MakeVectorDXDYDZ(0, 0, 10)
+ origin = geompy.MakeVertex(0, 0, 0)
+ # Register the objects in the active study
+ geompy.addToStudy( Vx, "Vx" )
+ geompy.addToStudy( Vy, "Vy" )
+ geompy.addToStudy( Vz, "Vz" )
+ geompy.addToStudy( origin, "origin" )
+
+# Register the function in the plugin manager
+salome_pluginsmanager.AddFunction('O,Vx,Vy,Vz',
+ 'Creates the trihedron',
+ trihedron)
+
+\endcode
+
+Move this script in the directory
+~/.config/salome/Plugins, run SALOME and enjoy your new function.
+
+\section S4_SALOMEPLUGINS How to select an object of the object browser
+
+Sometimes it can be useful to retrieve an object of the object browser to perform
+an action on it, for example, to select a mesh and display some information related to it.
+
+Some important methods and objects to use are as follows:
+-# context.sg.getObjectBrowser(): to connect the signal event
+ `selectionChanged()` to a custom slot
+-# context.salome.sg.getAllSelected(): to get the list of selected object
+ in the object browser
+-# objId = context.salome.sg.getSelected(0):
+ to get the first selected object in the object browser
+-# salomeObj = context.salome.study.FindObjectID(objId).GetObject():
+ to retrieve the salome object from selection. It can be a GEOM, SMESH, or any
+ other module object.
+
+ If it is a mesh, then it is possible to call GetMEDMesh() on the object.
+ If it is not a mesh, this call will raise an exception.
+ So it is possible to write the mesh retrieval in the following way:
+\code
+mesh = None
+try:
+ mesh = salomeObj.GetMEDMesh()
+except:
+ print "The selection is not a mesh"
+\endcode
+
+A example of those methods is available with the demo examples.
+See the next chapter \ref S5_SALOMEPLUGINS.
+
+\section S5_SALOMEPLUGINS Other examples
+
+The GUI module provides you with some basic demo examples located in
+the directory src/SalomeApp/pluginsdemo of the source space and
+installed in the directory $GUI_ROOT_DIR/share/salome/plugins/gui/demo.
+
+\note These examples are automatically installed when you install the GUI
+but are not activated. To activate the plugins, edit the file
+$GUI_ROOT_DIR/share/salome/plugins/gui/demo/salome_plugins.py and turn the
+variable DEMO_IS_ACTIVATED to True.
+
+The demo examples are:
+-# \b trihedron: create a trihedron and display it with fit on the size
+-# \b tube_shapewithgui: create a geom object from parameters given by a
+ dialog box.
+-# \b tube_meshwithgui: create a mesh object from parameters given by a
+ dialog box. This illustrates that a plugin can work with more than
+ one SALOME module.
+-# \b tube_shapewithguiAndPreview: same than tube_shapewithgui but with
+ an additionnal preview function (button apply in the dialog box).
+-# \b runSalomeShellSession: run a SALOME prepared shell session in a
+ xterm.
+-# \b minmax: computes the min and max values of a control on a selected mesh.
+ \note This plugin is available in the SMESH module only. To activate it, edit
+ the file $GUI_ROOT_DIR/share/salome/plugins/gui/demo/smesh_plugins.py and turn the variable
+ DEMO_IS_ACTIVATED to True.
+
+*/
--- /dev/null
+/* The standard CSS for doxygen */
+
+body, table, div, p, dl {
+ font-family: Lucida Grande, Verdana, Geneva, Arial, sans-serif;
+ font-size: 12px;
+}
+
+/* @group Heading Levels */
+
+h1 {
+ font-size: 150%;
+}
+
+h2 {
+ font-size: 120%;
+}
+
+h3 {
+ font-size: 100%;
+}
+
+dt {
+ font-weight: bold;
+}
+
+div.multicol {
+ -moz-column-gap: 1em;
+ -webkit-column-gap: 1em;
+ -moz-column-count: 3;
+ -webkit-column-count: 3;
+}
+
+p.startli, p.startdd, p.starttd {
+ margin-top: 2px;
+}
+
+p.endli {
+ margin-bottom: 0px;
+}
+
+p.enddd {
+ margin-bottom: 4px;
+}
+
+p.endtd {
+ margin-bottom: 2px;
+}
+
+/* @end */
+
+caption {
+ font-weight: bold;
+}
+
+span.legend {
+ font-size: 70%;
+ text-align: center;
+}
+
+h3.version {
+ font-size: 90%;
+ text-align: center;
+}
+
+div.qindex, div.navtab{
+ background-color: #EBEFF6;
+ border: 1px solid #A3B4D7;
+ text-align: center;
+ margin: 2px;
+ padding: 2px;
+}
+
+div.qindex, div.navpath {
+ width: 100%;
+ line-height: 140%;
+}
+
+div.navtab {
+ margin-right: 15px;
+}
+
+/* @group Link Styling */
+
+a {
+ color: #3D578C;
+ font-weight: normal;
+ text-decoration: none;
+}
+
+.contents a:visited {
+ color: #4665A2;
+}
+
+a:hover {
+ text-decoration: underline;
+}
+
+a.qindex {
+ font-weight: bold;
+}
+
+a.qindexHL {
+ font-weight: bold;
+ background-color: #9CAFD4;
+ color: #ffffff;
+ border: 1px double #869DCA;
+}
+
+.contents a.qindexHL:visited {
+ color: #ffffff;
+}
+
+a.el {
+ font-weight: bold;
+}
+
+a.elRef {
+}
+
+a.code {
+ color: #4665A2;
+}
+
+a.codeRef {
+ color: #4665A2;
+}
+
+/* @end */
+
+dl.el {
+ margin-left: -1cm;
+}
+
+.fragment {
+ font-family: monospace, fixed;
+ font-size: 105%;
+}
+
+pre.fragment {
+ border: 1px solid #C4CFE5;
+ background-color: #FBFCFD;
+ padding: 4px 6px;
+ margin: 4px 8px 4px 2px;
+ overflow: auto;
+ word-wrap: break-word;
+ font-size: 9pt;
+ line-height: 125%;
+}
+
+div.ah {
+ background-color: black;
+ font-weight: bold;
+ color: #ffffff;
+ margin-bottom: 3px;
+ margin-top: 3px;
+ padding: 0.2em;
+ border: solid thin #333;
+ border-radius: 0.5em;
+ -webkit-border-radius: .5em;
+ -moz-border-radius: .5em;
+ box-shadow: 2px 2px 3px #999;
+ -webkit-box-shadow: 2px 2px 3px #999;
+ -moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px;
+ background-image: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#000),color-stop(0.3, #444));
+ background-image: -moz-linear-gradient(center top, #eee 0%, #444 40%, #000);
+}
+
+div.groupHeader {
+ margin-left: 16px;
+ margin-top: 12px;
+ font-weight: bold;
+}
+
+div.version {
+ border:1px solid #0000FF;
+ color: #CCCCCC;
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 9pt;
+ text-align: center;
+ width:100px;
+ -moz-border-radius: 8px;
+ margin: 5px;
+}
+
+div.footer1 {
+ background-color: #DFE5F1;
+ border: 1px solid #AAAAAA;
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 11px;
+ padding: 10px;
+ margin-top: 15px;
+}
+
+
+div.groupText {
+ margin-left: 16px;
+ font-style: italic;
+}
+
+body {
+ background: white;
+ color: black;
+ margin: 0;
+}
+
+div.contents {
+ margin-top: 10px;
+ margin-left: 10px;
+ margin-right: 10px;
+}
+
+td.indexkey {
+ background-color: #EBEFF6;
+ font-weight: bold;
+ border: 1px solid #C4CFE5;
+ margin: 2px 0px 2px 0;
+ padding: 2px 10px;
+}
+
+td.indexvalue {
+ background-color: #EBEFF6;
+ border: 1px solid #C4CFE5;
+ padding: 2px 10px;
+ margin: 2px 0px;
+}
+
+tr.memlist {
+ background-color: #EEF1F7;
+}
+
+p.formulaDsp {
+ text-align: center;
+}
+
+img.formulaDsp {
+
+}
+
+img.formulaInl {
+ vertical-align: middle;
+}
+
+div.center {
+ text-align: center;
+ margin-top: 0px;
+ margin-bottom: 0px;
+ padding: 0px;
+}
+
+div.center img {
+ border: 0px;
+}
+
+address.footer {
+ text-align: right;
+ padding-right: 12px;
+}
+
+img.footer {
+ border: 0px;
+ vertical-align: middle;
+}
+
+/* @group Code Colorization */
+
+span.keyword {
+ color: #008000
+}
+
+span.keywordtype {
+ color: #604020
+}
+
+span.keywordflow {
+ color: #e08000
+}
+
+span.comment {
+ color: #800000
+}
+
+span.preprocessor {
+ color: #806020
+}
+
+span.stringliteral {
+ color: #002080
+}
+
+span.charliteral {
+ color: #008080
+}
+
+span.vhdldigit {
+ color: #ff00ff
+}
+
+span.vhdlchar {
+ color: #000000
+}
+
+span.vhdlkeyword {
+ color: #700070
+}
+
+span.vhdllogic {
+ color: #ff0000
+}
+
+/* @end */
+
+/*
+.search {
+ color: #003399;
+ font-weight: bold;
+}
+
+form.search {
+ margin-bottom: 0px;
+ margin-top: 0px;
+}
+
+input.search {
+ font-size: 75%;
+ color: #000080;
+ font-weight: normal;
+ background-color: #e8eef2;
+}
+*/
+
+td.tiny {
+ font-size: 75%;
+}
+
+.dirtab {
+ padding: 4px;
+ border-collapse: collapse;
+ border: 1px solid #A3B4D7;
+}
+
+th.dirtab {
+ background: #EBEFF6;
+ font-weight: bold;
+}
+
+hr {
+ height: 0px;
+ border: none;
+ border-top: 1px solid #4A6AAA;
+}
+
+hr.footer {
+ height: 1px;
+}
+
+/* @group Member Descriptions */
+
+table.memberdecls {
+ border-spacing: 0px;
+ padding: 0px;
+}
+
+.mdescLeft, .mdescRight,
+.memItemLeft, .memItemRight,
+.memTemplItemLeft, .memTemplItemRight, .memTemplParams {
+ background-color: #F9FAFC;
+ border: none;
+ margin: 4px;
+ padding: 1px 0 0 8px;
+}
+
+.mdescLeft, .mdescRight {
+ padding: 0px 8px 4px 8px;
+ color: #555;
+}
+
+.memItemLeft, .memItemRight, .memTemplParams {
+ border-top: 1px solid #C4CFE5;
+}
+
+.memItemLeft, .memTemplItemLeft {
+ white-space: nowrap;
+}
+
+.memTemplParams {
+ color: #4665A2;
+ white-space: nowrap;
+}
+
+/* @end */
+
+/* @group Member Details */
+
+/* Styles for detailed member documentation */
+
+.memtemplate {
+ font-size: 80%;
+ color: #4665A2;
+ font-weight: normal;
+ margin-left: 9px;
+}
+
+.memnav {
+ background-color: #EBEFF6;
+ border: 1px solid #A3B4D7;
+ text-align: center;
+ margin: 2px;
+ margin-right: 15px;
+ padding: 2px;
+}
+
+.memitem {
+ padding: 0;
+ margin-bottom: 10px;
+}
+
+.memname {
+ white-space: nowrap;
+ font-weight: bold;
+ margin-left: 6px;
+}
+
+.memproto {
+ border-top: 1px solid #A8B8D9;
+ border-left: 1px solid #A8B8D9;
+ border-right: 1px solid #A8B8D9;
+ padding: 6px 0px 6px 0px;
+ color: #253555;
+ font-weight: bold;
+ text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9);
+ /* opera specific markup */
+ box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
+ border-top-right-radius: 8px;
+ border-top-left-radius: 8px;
+ /* firefox specific markup */
+ -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px;
+ -moz-border-radius-topright: 8px;
+ -moz-border-radius-topleft: 8px;
+ /* webkit specific markup */
+ -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
+ -webkit-border-top-right-radius: 8px;
+ -webkit-border-top-left-radius: 8px;
+ background-image:url('nav_f.png');
+ background-repeat:repeat-x;
+ background-color: #E2E8F2;
+
+}
+
+.memdoc {
+ border-bottom: 1px solid #A8B8D9;
+ border-left: 1px solid #A8B8D9;
+ border-right: 1px solid #A8B8D9;
+ padding: 2px 5px;
+ background-color: #FBFCFD;
+ border-top-width: 0;
+ /* opera specific markup */
+ border-bottom-left-radius: 8px;
+ border-bottom-right-radius: 8px;
+ box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
+ /* firefox specific markup */
+ -moz-border-radius-bottomleft: 8px;
+ -moz-border-radius-bottomright: 8px;
+ -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px;
+ background-image: -moz-linear-gradient(center top, #FFFFFF 0%, #FFFFFF 60%, #F7F8FB 95%, #EEF1F7);
+ /* webkit specific markup */
+ -webkit-border-bottom-left-radius: 8px;
+ -webkit-border-bottom-right-radius: 8px;
+ -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
+ background-image: -webkit-gradient(linear,center top,center bottom,from(#FFFFFF), color-stop(0.6,#FFFFFF), color-stop(0.60,#FFFFFF), color-stop(0.95,#F7F8FB), to(#EEF1F7));
+}
+
+.paramkey {
+ text-align: right;
+}
+
+.paramtype {
+ white-space: nowrap;
+}
+
+.paramname {
+ color: #602020;
+ white-space: nowrap;
+}
+.paramname em {
+ font-style: normal;
+}
+
+.params, .retval, .exception, .tparams {
+ border-spacing: 6px 2px;
+}
+
+.params .paramname, .retval .paramname {
+ font-weight: bold;
+ vertical-align: top;
+}
+
+.params .paramtype {
+ font-style: italic;
+ vertical-align: top;
+}
+
+.params .paramdir {
+ font-family: "courier new",courier,monospace;
+ vertical-align: top;
+}
+
+
+
+
+/* @end */
+
+/* @group Directory (tree) */
+
+/* for the tree view */
+
+.ftvtree {
+ font-family: sans-serif;
+ margin: 0px;
+}
+
+/* these are for tree view when used as main index */
+
+.directory {
+ font-size: 9pt;
+ font-weight: bold;
+ margin: 5px;
+}
+
+.directory h3 {
+ margin: 0px;
+ margin-top: 1em;
+ font-size: 11pt;
+}
+
+/*
+The following two styles can be used to replace the root node title
+with an image of your choice. Simply uncomment the next two styles,
+specify the name of your image and be sure to set 'height' to the
+proper pixel height of your image.
+*/
+
+/*
+.directory h3.swap {
+ height: 61px;
+ background-repeat: no-repeat;
+ background-image: url("yourimage.gif");
+}
+.directory h3.swap span {
+ display: none;
+}
+*/
+
+.directory > h3 {
+ margin-top: 0;
+}
+
+.directory p {
+ margin: 0px;
+ white-space: nowrap;
+}
+
+.directory div {
+ display: none;
+ margin: 0px;
+}
+
+.directory img {
+ vertical-align: -30%;
+}
+
+/* these are for tree view when not used as main index */
+
+.directory-alt {
+ font-size: 100%;
+ font-weight: bold;
+}
+
+.directory-alt h3 {
+ margin: 0px;
+ margin-top: 1em;
+ font-size: 11pt;
+}
+
+.directory-alt > h3 {
+ margin-top: 0;
+}
+
+.directory-alt p {
+ margin: 0px;
+ white-space: nowrap;
+}
+
+.directory-alt div {
+ display: none;
+ margin: 0px;
+}
+
+.directory-alt img {
+ vertical-align: -30%;
+}
+
+/* @end */
+
+div.dynheader {
+ margin-top: 8px;
+}
+
+address {
+ font-style: normal;
+ color: #2A3D61;
+}
+
+table.doxtable {
+ border-collapse:collapse;
+}
+
+table.doxtable td, table.doxtable th {
+ border: 1px solid #2D4068;
+ padding: 3px 7px 2px;
+}
+
+table.doxtable th {
+ background-color: #374F7F;
+ color: #FFFFFF;
+ font-size: 110%;
+ padding-bottom: 4px;
+ padding-top: 5px;
+ text-align:left;
+}
+
+.tabsearch {
+ top: 0px;
+ left: 10px;
+ height: 36px;
+ background-image: url('tab_b.png');
+ z-index: 101;
+ overflow: hidden;
+ font-size: 13px;
+}
+
+.navpath ul
+{
+ font-size: 11px;
+ background-image:url('tab_b.png');
+ background-repeat:repeat-x;
+ height:30px;
+ line-height:30px;
+ color:#8AA0CC;
+ border:solid 1px #C2CDE4;
+ overflow:hidden;
+ margin:0px;
+ padding:0px;
+}
+
+.navpath li
+{
+ list-style-type:none;
+ float:left;
+ padding-left:10px;
+ padding-right:15px;
+ background-image:url('bc_s.png');
+ background-repeat:no-repeat;
+ background-position:right;
+ color:#364D7C;
+}
+
+.navpath li.navelem a
+{
+ height:32px;
+ display:block;
+ text-decoration: none;
+ outline: none;
+}
+
+.navpath li.navelem a:hover
+{
+ color:#6884BD;
+}
+
+.navpath li.footer
+{
+ list-style-type:none;
+ float:right;
+ padding-left:10px;
+ padding-right:15px;
+ background-image:none;
+ background-repeat:no-repeat;
+ background-position:right;
+ color:#364D7C;
+ font-size: 8pt;
+}
+
+
+div.summary
+{
+ float: right;
+ font-size: 8pt;
+ padding-right: 5px;
+ width: 50%;
+ text-align: right;
+}
+
+div.summary a
+{
+ white-space: nowrap;
+}
+
+div.ingroups
+{
+ font-size: 8pt;
+ padding-left: 5px;
+ width: 50%;
+ text-align: left;
+}
+
+div.ingroups a
+{
+ white-space: nowrap;
+}
+
+div.header
+{
+ background-image:url('nav_h.png');
+ background-repeat:repeat-x;
+ background-color: #F9FAFC;
+ margin: 0px;
+ border-bottom: 1px solid #C4CFE5;
+}
+
+div.headertitle
+{
+ padding: 5px 5px 5px 10px;
+}
+
+.title {
+ font-size: 150%;
+ font-weight: bold;
+ margin: 10px 2px;
+}
+
+dl
+{
+ padding: 0 0 0 10px;
+}
+
+dl.note, dl.warning, dl.attention, dl.pre, dl.post, dl.invariant, dl.deprecated, dl.todo, dl.test, dl.bug
+{
+ border-left:4px solid;
+ padding: 0 0 0 6px;
+}
+
+dl.note
+{
+ border-color: #D0D000;
+}
+
+dl.warning, dl.attention
+{
+ border-color: #FF0000;
+}
+
+dl.pre, dl.post, dl.invariant
+{
+ border-color: #00D000;
+}
+
+dl.deprecated
+{
+ border-color: #505050;
+}
+
+dl.todo
+{
+ border-color: #00C0E0;
+}
+
+dl.test
+{
+ border-color: #3030E0;
+}
+
+dl.bug
+{
+ border-color: #C08050;
+}
+
+#projectlogo
+{
+ text-align: center;
+ vertical-align: bottom;
+ border-collapse: separate;
+}
+
+#projectlogo img
+{
+ border: 0px none;
+}
+
+#projectname
+{
+ background-color: #175783;
+ border: 1px solid;
+ height: 80px;
+ background-repeat: no-repeat;
+/* font: 300% arial,sans-serif;*/
+ margin: 0px;
+ padding: 0px;
+}
+
+#projectbrief
+{
+ font: 120% arial,sans-serif;
+ margin: 0px;
+ padding: 0px;
+}
+
+#projectnumber
+{
+ font: 50% arial,sans-serif;
+ margin: 0px;
+ padding: 0px;
+}
+
+#titlearea
+{
+ background: url("head.png");
+ background-color: #175783;
+ border: 1px solid;
+ height: 80px;
+ background-repeat: no-repeat;
+ padding: 0px;
+ margin: 0px;
+ width: 100%;
+ border-bottom: 1px solid #5373B4;
+}
+
--- /dev/null
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<meta http-equiv="X-UA-Compatible" content="IE=9"/>
+<title>$title</title>
+<link href="$relpath$tabs.css" rel="stylesheet" type="text/css"/>
+$treeview
+$search
+$mathjax
+<script type="text/javascript">
+$(document).ready(initResizable);
+</script>
+<link href="$relpath$doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body onload='searchBox.OnSelectItem(0);'>
+<div id="top"><!-- do not remove this div! -->
+<div id="titlearea"><div align="right"><div class="version">Version: @VERSION@</div></div></div>
+
+</div>
--- /dev/null
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<meta http-equiv="X-UA-Compatible" content="IE=9"/>
+<title>$title</title>
+<link href="$relpath$tabs.css" rel="stylesheet" type="text/css"/>
+$treeview
+$search
+$mathjax
+<script type="text/javascript">
+$(document).ready(initResizable);
+</script>
+<link href="$relpath$doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body onload='searchBox.OnSelectItem(0);'>
+<div id="top"><!-- do not remove this div! -->
+<div id="titlearea"><div align="right"><div class="version">Version: @VERSION@</div></div></div>
+
+</div>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="fr_FR">
+<context>
+ <name>CAF_Application</name>
+ <message>
+ <source>MEN_APP_EDIT</source>
+ <translation>&Editer</translation>
+ </message>
+ <message>
+ <source>INF_ALL_FILTER</source>
+ <translation>Tous les fichiers (*.*)</translation>
+ </message>
+ <message>
+ <source>INF_ALL_DOCUMENTS_FILTER</source>
+ <translation>Tous les documents lisibles</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_EDIT</source>
+ <translation>&Editer</translation>
+ </message>
+ <message>
+ <source>MEN_APP_EDIT_UNDO</source>
+ <translation>&Défaire</translation>
+ </message>
+ <message>
+ <source>MEN_APP_EDIT_REDO</source>
+ <translation>&Refaire</translation>
+ </message>
+ <message>
+ <source>PRP_APP_EDIT_REDO</source>
+ <translation>Refaire la dernière opération</translation>
+ </message>
+ <message>
+ <source>PRP_APP_EDIT_UNDO</source>
+ <translation>Défaire la dernière opération</translation>
+ </message>
+ <message>
+ <source>TOT_APP_EDIT_REDO</source>
+ <translation>Refaire</translation>
+ </message>
+ <message>
+ <source>TOT_APP_EDIT_UNDO</source>
+ <translation>Défaire</translation>
+ </message>
+ <message>
+ <source>INF_APP_REDOACTIONS</source>
+ <translation> Refait %1 action(s) </translation>
+ </message>
+ <message>
+ <source>INF_APP_UNDOACTIONS</source>
+ <translation> Défait %1 action(s) </translation>
+ </message>
+ <message>
+ <source>ABOUT_INFO</source>
+ <translation>Application SUIT Caf</translation>
+ </message>
+</context>
+</TS>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="fr_FR">
+<context>
+ <name>@default</name>
+ <message>
+ <source>ERROR_TLT</source>
+ <translation>Erreur</translation>
+ </message>
+ <message>
+ <source>ERROR_ACTIVATE_MODULE_MSG</source>
+ <translation>Impossible d'activer le module %1</translation>
+ </message>
+ <message>
+ <source>MODULE_ROOT_OBJECT_TOOLTIP</source>
+ <translation>%1 objet-racine du module</translation>
+ </message>
+</context>
+</TS>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="fr_FR">
+<context>
+ <name>@default</name>
+ <message>
+ <source>DSC_FITSELECT</source>
+ <translation>Montrer la zone choisie dans la vue</translation>
+ </message>
+ <message>
+ <source>ERROR</source>
+ <translation>Erreur</translation>
+ </message>
+ <message>
+ <source>MNU_DUMP_VIEW</source>
+ <translation>Sauvegarder</translation>
+ </message>
+ <message>
+ <source>MNU_PAN_VIEW</source>
+ <translation>Déplacement</translation>
+ </message>
+ <message>
+ <source>DSC_GLOBALPAN_VIEW</source>
+ <translation>Sélection d'un nouveau centre de vue</translation>
+ </message>
+ <message>
+ <source>MNU_ZOOM_VIEW</source>
+ <translation>Zoomer</translation>
+ </message>
+ <message>
+ <source>DSC_PAN_VIEW</source>
+ <translation>Déplacer la vue</translation>
+ </message>
+ <message>
+ <source>DSC_FITALL</source>
+ <translation>Montrer tous les objets dans la vue</translation>
+ </message>
+ <message>
+ <source>MNU_FITALL</source>
+ <translation>Tout afficher</translation>
+ </message>
+ <message>
+ <source>MNU_GLOBALPAN_VIEW</source>
+ <translation>Déplacement global</translation>
+ </message>
+ <message>
+ <source>INF_APP_DUMP_VIEW</source>
+ <translation>Sauvegarder la vue</translation>
+ </message>
+ <message>
+ <source>GL_IMAGE_FILES</source>
+ <translation>Fichiers images (*.bmp *.png)</translation>
+ </message>
+ <message>
+ <source>MNU_RESET_VIEW</source>
+ <translation>Restaurer</translation>
+ </message>
+ <message>
+ <source>DSC_FITRECT</source>
+ <translation>Montrer la zone dans la vue</translation>
+ </message>
+ <message>
+ <source>MNU_FITRECT</source>
+ <translation>Afficher la zone</translation>
+ </message>
+ <message>
+ <source>CHANGE_BGCOLOR</source>
+ <translation>Changer la couleur d'arrière-plan...</translation>
+ </message>
+ <message>
+ <source>DSC_DUMP_VIEW</source>
+ <translation>Sauvegarder la vue en cours dans un fichier image</translation>
+ </message>
+ <message>
+ <source>MNU_FITSELECT</source>
+ <translation>Afficher la sélection</translation>
+ </message>
+ <message>
+ <source>DSC_ZOOM_VIEW</source>
+ <translation>Zoomer la vue</translation>
+ </message>
+ <message>
+ <source>DSC_RESET_VIEW</source>
+ <translation>Restaurer le point de vue</translation>
+ </message>
+ <message>
+ <source>ERR_DOC_CANT_SAVE_FILE</source>
+ <translation>Impossible de sauvegarder le fichier</translation>
+ </message>
+ <message>
+ <source>LBL_TOOLBAR_LABEL</source>
+ <translation>Opérations de visualisation</translation>
+ </message>
+</context>
+<context>
+ <name>GLViewer_ViewFrame</name>
+ <message>
+ <source>DUMP_VIEW_SAVE_FILE_DLG_CAPTION</source>
+ <translation>Sauvegarder la vue dans le fichier</translation>
+ </message>
+ <message>
+ <source>DUMP_VIEW_ERROR_DLG_TEXT</source>
+ <translation>Impossible de sauvegarder la vue dans le fichier</translation>
+ </message>
+ <message>
+ <source>DUMP_VIEW_ERROR_DLG_CAPTION</source>
+ <translation>Erreur</translation>
+ </message>
+</context>
+<context>
+ <name>GLViewer_ViewManager</name>
+ <message>
+ <source>GL_VIEW_TITLE</source>
+ <translation>Scène GL:%M - visualiseur:%V</translation>
+ </message>
+</context>
+</TS>
--- /dev/null
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource>
+ <file>images/en.png</file>
+ <file>images/fr.png</file>
+</qresource>
+</RCC>
+
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// File: LightApp_FullScreenHelper.h
+// Created: 04/10/2011 18:44:25 PM
+// Author: OCC team
+//
+#include <QAction>
+#include <QMenuBar>
+#include <QStatusBar>
+
+#include <PyConsole_Console.h>
+
+#include <STD_Application.h>
+
+#include <SUIT_Session.h>
+#include <SUIT_Desktop.h>
+#include <SUIT_DataBrowser.h>
+
+#include "LightApp_FullScreenHelper.h"
+#include "LightApp_Application.h"
+
+
+/*!
+ * Constructor
+ */
+LightApp_FullScreenHelper::LightApp_FullScreenHelper()
+{
+ myStatusBarVisibility = false;
+}
+
+/*!
+ * Destructor
+ */
+LightApp_FullScreenHelper::~LightApp_FullScreenHelper()
+{
+
+}
+
+
+/*!
+ * Switch application to the full screen mode.
+ */
+void LightApp_FullScreenHelper::switchToFullScreen() {
+
+ SUIT_Session* session = SUIT_Session::session();
+ if(!session)
+ return;
+
+ LightApp_Application* app = dynamic_cast<LightApp_Application*>( session->activeApplication() );
+
+ if(!app)
+ return;
+
+ SUIT_Desktop* desktop = app->desktop();
+
+ if(!desktop)
+ return;
+
+ desktop->setWindowState(desktop->windowState() ^ Qt::WindowFullScreen);
+
+ if(desktop->menuBar())
+ desktop->menuBar()->hide();
+
+ if(desktop->statusBar()) {
+ myStatusBarVisibility = desktop->statusBar()->isVisible();
+ desktop->statusBar()->hide();
+ QAction *act = app->action(STD_Application::ViewStatusBarId);
+ if(act)
+ act->setEnabled(false);
+ }
+
+
+ QList<QDockWidget*> aDocWidgets = desktop->findChildren<QDockWidget*>();
+ myDocWidgetMap.clear();
+
+ QWidget* ob = app->objectBrowser();
+ QObject* obParent = ob ? ob->parent() : 0;
+
+ foreach(QDockWidget* aWidget, aDocWidgets) {
+ if(aWidget && aWidget->parent() == desktop) {
+ if( aWidget->isVisible() && aWidget != obParent ) {
+ aWidget->hide();
+ QAction* act = aWidget->toggleViewAction();
+ bool isActionEnabled = false;
+ if(act) {
+ isActionEnabled = act->isEnabled();
+ if( isActionEnabled ) {
+ act->setEnabled(false);
+ }
+ }
+
+ myDocWidgetMap.insert(aWidget, isActionEnabled);
+ }
+ }
+ }
+
+ QList<QToolBar*> aToolBars = desktop->findChildren<QToolBar*>();
+ myToolBarMap.clear();
+ foreach(QToolBar* aWidget, aToolBars ) {
+ if( aWidget && aWidget->parent() == desktop ) {
+ if( aWidget->isVisible()) {
+ aWidget->hide();
+ QAction* act = aWidget->toggleViewAction();
+ bool isActionEnabled = false;
+ if(act) {
+ isActionEnabled = act->isEnabled();
+ if( isActionEnabled ) {
+ act->setEnabled(false);
+ }
+ }
+ myToolBarMap.insert(aWidget, isActionEnabled);
+ }
+ }
+ }
+}
+
+/*!
+ * Switch application to the normal screen mode.
+ */
+void LightApp_FullScreenHelper::switchToNormalScreen() {
+
+ SUIT_Session* session = SUIT_Session::session();
+ if(!session)
+ return;
+
+ LightApp_Application* app = dynamic_cast<LightApp_Application*>( session->activeApplication() );
+
+ if(!app)
+ return;
+
+ SUIT_Desktop* desktop = app->desktop();
+
+ if(!desktop)
+ return;
+
+ desktop->setWindowState(desktop->windowState() ^ Qt::WindowFullScreen);
+
+
+ DocWidgetMap::iterator it = myDocWidgetMap.begin();
+ for( ;it != myDocWidgetMap.end() ; it++ ) {
+ QDockWidget* aWidget = it.key();
+ bool state = it.value();
+ aWidget->show();
+ QAction* act = aWidget->toggleViewAction();
+ if(act && state)
+ act->setEnabled(true);
+ }
+
+ ToolBarMap::iterator it1 = myToolBarMap.begin();
+ for( ;it1 != myToolBarMap.end() ; it1++ ) {
+ QToolBar* aWidget = it1.key();
+ bool state = it1.value();
+ aWidget->show();
+ QAction* act = aWidget->toggleViewAction();
+ if(act && state)
+ act->setEnabled(true);
+ }
+
+ if(desktop->menuBar())
+ desktop->menuBar()->show();
+
+ if(desktop->statusBar() && myStatusBarVisibility) {
+ desktop->statusBar()->show();
+ QAction *act = app->action(STD_Application::ViewStatusBarId);
+ if(act)
+ act->setEnabled(true);
+ }
+
+}
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// File: LightApp_FullScreenHelper.h
+// Created: 04/10/2011 18:39:25 PM
+// Author: OCC team
+//
+#ifndef LIGHTAPP_FULLSCREEN_H
+#define LIGHTAPP_FULLSCREEN_H
+
+#include "LightApp.h"
+
+#include <QMap>
+#include <QDockWidget>
+#include <QToolBar>
+
+
+class LIGHTAPP_EXPORT LightApp_FullScreenHelper {
+ public:
+
+ LightApp_FullScreenHelper();
+ ~LightApp_FullScreenHelper();
+
+ void switchToFullScreen();
+ void switchToNormalScreen();
+
+ private:
+ typedef QMap<QDockWidget*,bool> DocWidgetMap;
+ DocWidgetMap myDocWidgetMap;
+
+ typedef QMap<QToolBar*, bool> ToolBarMap;
+ ToolBarMap myToolBarMap;
+
+
+ bool myStatusBarVisibility;
+
+};
+
+
+#endif //LIGHTAPP_FULLSCREEN_H
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// Author : Roman NIKOLAEV, Open CASCADE S.A.S. (roman.nikolaev@opencascade.com)
+// Date : 22/06/2007
+//
+#include "LightApp_PyInterp.h"
+
+#include <SUITApp_init_python.hxx>
+#include <PyConsole_Interp.h>
+
+#include <pthread.h>
+
+/*!
+ * constructor : multi Python interpreter, one per SALOME study.
+ * calls initialize method defined in base class, which calls virtual methods
+ * initstate & initcontext redefined here.
+ */
+LightApp_PyInterp::LightApp_PyInterp(): PyConsole_Interp()
+{
+}
+
+/*!
+ * Destructor.
+ */
+LightApp_PyInterp::~LightApp_PyInterp()
+{
+}
+
+/*!\class LightApp_PyInterp
+ * EDF-CCAR
+ * When SALOME uses multi Python interpreter feature,
+ * Every study has its own interpreter and thread state (_tstate = Py_NewInterpreter())
+ * This is fine because every study has its own modules (sys.modules) stdout and stderr
+ * BUT some Python modules must be imported only once. In multi interpreter context Python
+ * modules (*.py) are imported several times.
+ * The pyqt module must be imported only once because it registers classes in a C module.
+ * It's quite the same with omniorb modules (internals and generated with omniidl)
+ * This problem is handled with "shared modules" defined in salome_shared_modules.py
+ * These "shared modules" are imported only once and only copied in all the other interpreters
+ * BUT it's not the only problem. Every interpreter has its own __builtin__ module. That's fine
+ * but if we have copied some modules and imported others problems may arise with operations that
+ * are not allowed in restricted execution environment. So we must impose that all interpreters
+ * have identical __builtin__ module.
+ * That's all, for the moment ...
+ */
+
+
+bool LightApp_PyInterp::initContext()
+{
+ /*!
+ * The GIL is assumed to be held
+ * It is the caller responsability caller to acquire the GIL
+ * It will still be held on initContext output
+ */
+ if ( !PyConsole_Interp::initContext() )
+ return false;
+
+ //Import special module to change the import mechanism
+ PyObjWrapper m1( PyImport_ImportModule( "import_hook" ) );
+ if ( !m1 )
+ {
+ PyErr_Print();
+ return false;
+ }
+
+ // Call init_shared_modules to initialize the shared import mechanism for modules
+ //that must not be imported twice
+ PyObjWrapper m2( PyObject_CallMethod( m1, (char*)"init_shared_modules", (char*)"O", SUIT_PYTHON::salome_shared_modules_module ) );
+ if ( !m2 )
+ {
+ PyErr_Print();
+ return false;
+ }
+ return true;
+}
+
+/*!
+ Do nothing
+ The initialization has been done in main
+ */
+void LightApp_PyInterp::initPython()
+{
+ _gtstate=SUIT_PYTHON::_gtstate; // initialisation in main
+ _interp=SUIT_PYTHON::_interp;
+}
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// Author : Roman NIKOLAEV, Open CASCADE S.A.S. (roman.nikolaev@opencascade.com)
+// Date : 22/06/2007
+//
+#ifndef _LIGHTAPP_PYINTERP_H_
+#define _LIGHTAPP_PYINTERP_H_
+
+#include <PyConsole_Interp.h> // this include must be first (see PyInterp_base.h)!
+
+class LightApp_PyInterp : public PyConsole_Interp
+{
+public:
+ LightApp_PyInterp();
+ virtual ~LightApp_PyInterp();
+
+protected:
+ virtual void initPython();
+ virtual bool initContext();
+};
+
+#endif //_LIGHTAPP_PYINTERP_H_
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : LightApp_LightApp_WgViewModel.cxx
+// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
+
+#include "LightApp_WgViewModel.h"
+#include "SUIT_ViewWindow.h"
+
+LightApp_WgViewModel::LightApp_WgViewModel( const QString& type, QWidget* w )
+ : SUIT_ViewModel(),
+ myType( type ),
+ myWidget( w ),
+ myCreated( false )
+{
+}
+
+LightApp_WgViewModel::~LightApp_WgViewModel()
+{
+}
+
+SUIT_ViewWindow* LightApp_WgViewModel::createView( SUIT_Desktop* d )
+{
+ SUIT_ViewWindow* vw = 0;
+ if ( !myCreated ) {
+ vw = new SUIT_ViewWindow( d );
+ vw->setCentralWidget( myWidget );
+ myCreated = true;
+ }
+ return vw;
+}
+
+QString LightApp_WgViewModel::getType() const
+{
+ return myType;
+}
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : LightApp_LightApp_WgViewModel.h
+// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
+
+#ifndef LIGHTAPP_WGVIEWMODEL_H
+#define LIGHTAPP_WGVIEWMODEL_H
+
+#include "SUIT_ViewModel.h"
+#include "SUIT_ViewManager.h"
+
+class LightApp_WgViewModel : public SUIT_ViewModel
+{
+ Q_OBJECT
+
+public:
+ LightApp_WgViewModel( const QString& type, QWidget* w );
+ virtual ~LightApp_WgViewModel();
+
+ virtual SUIT_ViewWindow* createView( SUIT_Desktop* d );
+ virtual QString getType() const;
+
+private:
+ QString myType;
+ QWidget* myWidget;
+ bool myCreated;
+};
+#endif // LIGHTAPP_WGVIEWMODEL_H
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="fr_FR">
+<context>
+ <name>@default</name>
+ <message>
+ <source>EXTERNAL_BROWSER_CANNOT_SHOW_PAGE</source>
+ <translation>Le navigateur externe "%1" ne peut pas trouver la page d'aide "%2". Voulez-vous le modifierdans les préférences ?</translation>
+ </message>
+ <message>
+ <source>ABOUT_COPYRIGHT</source>
+ <translation>Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+
+Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6,
+CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS</translation>
+ </message>
+ <message>
+ <source>ABOUT_CAPTION</source>
+ <translation>A propos de %1</translation>
+ </message>
+ <message>
+ <source>ABOUT_BASE</source>
+ <translation>Informations générales</translation>
+ </message>
+ <message>
+ <source>ABOUT_MODULE_INFOS</source>
+ <translation>Modules</translation>
+ </message>
+ <message>
+ <source>ABOUT_UNKNOWN_VERSION</source>
+ <translation>Inconnue</translation>
+ </message>
+ <message>
+ <source>ABOUT_CLOSE</source>
+ <translation>&Fermer</translation>
+ </message>
+ <message>
+ <source>APP_NAME</source>
+ <translation>SALOME</translation>
+ </message>
+ <message>
+ <source>ABOUT_LICENSE</source>
+ <translation>GNU LGPL</translation>
+ </message>
+ <message>
+ <source>ABOUT_VERSION</source>
+ <translation>Version %1</translation>
+ </message>
+ <message>
+ <source>ENTRY_COLUMN</source>
+ <translation>Entrée</translation>
+ </message>
+ <message>
+ <source>BROWSER_TITLE</source>
+ <translation>Aide de SALOME</translation>
+ </message>
+ <message>
+ <source>BROWSER_TOOLBAR_TITLE</source>
+ <translation>Navigation</translation>
+ </message>
+ <message>
+ <source>BROWSER_FILEMENU</source>
+ <translation>&Fichier</translation>
+ </message>
+ <message>
+ <source>BROWSER_CLOSE</source>
+ <translation>&Fermer</translation>
+ </message>
+ <message>
+ <source>BROWSER_BACK</source>
+ <translation>Reculer</translation>
+ </message>
+ <message>
+ <source>BROWSER_FORWARD</source>
+ <translation>Avancer</translation>
+ </message>
+ <message>
+ <source>BROWSER_FIND</source>
+ <translation>&Chercher...</translation>
+ </message>
+ <message>
+ <source>BROWSER_FINDNEXT</source>
+ <translation>Chercher &suivant</translation>
+ </message>
+ <message>
+ <source>BROWSER_FINDPREV</source>
+ <translation>Chercher &précédent</translation>
+ </message>
+</context>
+<context>
+ <name>LightApp_Application</name>
+ <message>
+ <source>LANG_CHANGED</source>
+ <translation>La langue de l'application a été modifié.
+Les modifications seront appliquées à la prochaine session.</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_THEME</source>
+ <translation>T&hème</translation>
+ </message>
+ <message>
+ <source>TOT_THEME</source>
+ <translation>Thème</translation>
+ </message>
+ <message>
+ <source>PRP_THEME</source>
+ <translation>Changer les propriétés du style </translation>
+ </message>
+ <message>
+ <source>TOT_FULLSCREEN</source>
+ <translation>Plein écran</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_FULLSCREEN</source>
+ <translation>Plein écran</translation>
+ </message>
+ <message>
+ <source>PRP_FULLSCREEN</source>
+ <translation>Basculer en mode plein écran</translation>
+ </message>
+ <message>
+ <source>INF_TOOLBAR_MODULES</source>
+ <translation>Modules</translation>
+ </message>
+ <message>
+ <source>PREF_SHOW_LEGEND</source>
+ <translation>Montrer la légende</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_RENAME</source>
+ <translation>&Renommer</translation>
+ </message>
+ <message>
+ <source>PREF_MULTI_FILE</source>
+ <translation>Sauvegarde multi-fichiers</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_PREFERENCES</source>
+ <translation>&Préférences...</translation>
+ </message>
+ <message>
+ <source>PREF_TRIHEDRON_SHOW</source>
+ <translation>Afficher le trièdre</translation>
+ </message>
+ <message>
+ <source>PREF_TRIHEDRON</source>
+ <translation>Trièdre</translation>
+ </message>
+ <message>
+ <source>PREF_TRIHEDRON_SIZE</source>
+ <translation>Taille</translation>
+ </message>
+ <message>
+ <source>OBJECT_BROWSER</source>
+ <translation>Arbre d'étude</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_PREFERENCES</source>
+ <translation>Permettre de changer les préférences</translation>
+ </message>
+ <message>
+ <source>PREF_GROUP_DIRECTORIES</source>
+ <translation>Liste des répertoires</translation>
+ </message>
+ <message>
+ <source>PREF_GROUP_VTKVIEWER</source>
+ <translation>Scène VTK 3D</translation>
+ </message>
+ <message>
+ <source>PREF_STORE_POS</source>
+ <translation>Enregistrer la position des fenêtres</translation>
+ </message>
+ <message>
+ <source>PREF_AUTO_SAVE</source>
+ <translation>Intervalle d'enregistrement automatique (min)</translation>
+ </message>
+ <message>
+ <source>PREF_AUTO_SAVE_DISABLED</source>
+ <translation>Désactivé</translation>
+ </message>
+ <message>
+ <source>PREF_PROJECTION_MODE</source>
+ <translation>Mode de projection:</translation>
+ </message>
+ <message>
+ <source>PREF_ORTHOGRAPHIC</source>
+ <translation>Orthogonal</translation>
+ </message>
+ <message>
+ <source>PREF_PERSPECTIVE</source>
+ <translation>Perspective</translation>
+ </message>
+ <message>
+ <source>PREF_NAVIGATION</source>
+ <translation>Navigation:</translation>
+ </message>
+ <message>
+ <source>PREF_STANDARD_STYLE</source>
+ <translation>Style de contrôles type Salomé</translation>
+ </message>
+ <message>
+ <source>PREF_KEYFREE_STYLE</source>
+ <translation>Style sans clavier</translation>
+ </message>
+ <message>
+ <source>PREF_ZOOMING</source>
+ <translation>Mode de zoom:</translation>
+ </message>
+ <message>
+ <source>PREF_ZOOMING_AT_CENTER</source>
+ <translation>Relatif au centre de la scène</translation>
+ </message>
+ <message>
+ <source>PREF_ZOOMING_AT_CURSOR</source>
+ <translation>Relatif au curseur</translation>
+ </message>
+ <message>
+ <source>PREF_INCREMENTAL_SPEED</source>
+ <translation>Incrément de vitesse:</translation>
+ </message>
+ <message>
+ <source>PREF_INCREMENTAL_SPEED_MODE</source>
+ <translation>Mode de modification:</translation>
+ </message>
+ <message>
+ <source>PREF_ARITHMETIC</source>
+ <translation>Progression arithmétique</translation>
+ </message>
+ <message>
+ <source>PREF_GEOMETRICAL</source>
+ <translation>Progression géométrique</translation>
+ </message>
+ <message>
+ <source>PREF_FRAME_SPACEMOUSE</source>
+ <translation>Spacemouse</translation>
+ </message>
+ <message>
+ <source>PREF_SHOW_STATIC_TRIHEDRON</source>
+ <translation>Montrer le trièdre statique</translation>
+ </message>
+ <message>
+ <source>PREF_SPACEMOUSE_FUNC_1</source>
+ <translation>Réduire l'incrément de vitesse</translation>
+ </message>
+ <message>
+ <source>PREF_SPACEMOUSE_FUNC_2</source>
+ <translation>Augmenter l'incrément de vitesse</translation>
+ </message>
+ <message>
+ <source>PREF_SPACEMOUSE_FUNC_3</source>
+ <translation>Changement Dominant/Combiné</translation>
+ </message>
+ <message>
+ <source>PREF_SPACEMOUSE_BTN_1</source>
+ <translation>Bouton 1</translation>
+ </message>
+ <message>
+ <source>PREF_SPACEMOUSE_BTN_2</source>
+ <translation>Bouton 2</translation>
+ </message>
+ <message>
+ <source>PREF_SPACEMOUSE_BTN_3</source>
+ <translation>Bouton 3</translation>
+ </message>
+ <message>
+ <source>PREF_SPACEMOUSE_BTN_4</source>
+ <translation>Bouton 4</translation>
+ </message>
+ <message>
+ <source>PREF_SPACEMOUSE_BTN_5</source>
+ <translation>Bouton 5</translation>
+ </message>
+ <message>
+ <source>PREF_SPACEMOUSE_BTN_6</source>
+ <translation>Bouton 6</translation>
+ </message>
+ <message>
+ <source>PREF_SPACEMOUSE_BTN_7</source>
+ <translation>Bouton 7</translation>
+ </message>
+ <message>
+ <source>PREF_SPACEMOUSE_BTN_8</source>
+ <translation>Bouton 8</translation>
+ </message>
+ <message>
+ <source>PREF_SPACEMOUSE_BTN_*</source>
+ <translation>Bouton *</translation>
+ </message>
+ <message>
+ <source>PREF_SPACEMOUSE_BTN_10</source>
+ <translation>Bouton 10</translation>
+ </message>
+ <message>
+ <source>PREF_SPACEMOUSE_BTN_11</source>
+ <translation>Bouton 11</translation>
+ </message>
+ <message>
+ <source>PREF_FRAME_RECORDING</source>
+ <translation>Enregistrement AVI</translation>
+ </message>
+ <message>
+ <source>PREF_ALL_DISLPAYED_FRAMES</source>
+ <translation>Enregistrer toutes les images affichées</translation>
+ </message>
+ <message>
+ <source>PREF_FPS</source>
+ <translation>FPS</translation>
+ </message>
+ <message>
+ <source>PREF_GROUP_TTL</source>
+ <translation>Paramètres</translation>
+ </message>
+ <message>
+ <source>PREF_PROGRESSIVE</source>
+ <translation>Progressif</translation>
+ </message>
+ <message>
+ <source>PREF_QUALITY</source>
+ <translation>Qualité</translation>
+ </message>
+ <message>
+ <source>PREF_RECORDING_MODE</source>
+ <translation>Mode</translation>
+ </message>
+ <message>
+ <source>PREF_SKIPPED_FRAMES</source>
+ <translation>Enregistrer à FPS donné</translation>
+ </message>
+ <message>
+ <source>PREF_FRAME_GROUP_NAMES</source>
+ <translation>Nom des groupes</translation>
+ </message>
+ <message>
+ <source>PREF_GROUP_NAMES_TEXT_COLOR</source>
+ <translation>Couleur du texte</translation>
+ </message>
+ <message>
+ <source>PREF_GROUP_NAMES_TRANSPARENCY</source>
+ <translation>Transparence</translation>
+ </message>
+ <message>
+ <source>PREF_BOTTOM</source>
+ <translation>Dessous</translation>
+ </message>
+ <message>
+ <source>PREF_CURVE_TYPE</source>
+ <translation>Type de courbe:</translation>
+ </message>
+ <message>
+ <source>PREF_ISOS</source>
+ <translation>Nombre d'isolignes</translation>
+ </message>
+ <message>
+ <source>PREF_ISOS_U</source>
+ <translation>Selon U</translation>
+ </message>
+ <message>
+ <source>PREF_ISOS_V</source>
+ <translation>Selon V</translation>
+ </message>
+ <message>
+ <source>PREF_POINTS</source>
+ <translation>Points</translation>
+ </message>
+ <message>
+ <source>PRP_MODULE</source>
+ <translation>Basculer vers le module "%1"</translation>
+ </message>
+ <message>
+ <source>PREF_ASCII_FILE</source>
+ <translation>Enregistrement ASCII</translation>
+ </message>
+ <message>
+ <source>PREFERENCES_NOT_LOADED</source>
+ <translation>Les préférences du module "<b>%N</b>" seront accessibles quand le module sera chargé</translation>
+ </message>
+ <message>
+ <source>PREF_LINEAR</source>
+ <translation>Linéaire</translation>
+ </message>
+ <message>
+ <source>DATA_MODELS</source>
+ <translation>Modèles de données</translation>
+ </message>
+ <message>
+ <source>PRP_RENAME</source>
+ <translation>Renommer la fenêtre active</translation>
+ </message>
+ <message>
+ <source>TOT_RENAME</source>
+ <translation>Renommer</translation>
+ </message>
+ <message>
+ <source>MEN_RENAME_OBJ</source>
+ <translation>Renommer</translation>
+ </message>
+ <message>
+ <source>LOG_WINDOW</source>
+ <translation>Fenêtre de messages</translation>
+ </message>
+ <message>
+ <source>PREF_SPLINE</source>
+ <translation>Spline</translation>
+ </message>
+ <message>
+ <source>PREF_OBJ_BROWSER_SEARCH_TOOL</source>
+ <translation>Outil de recherche</translation>
+ </message>
+ <message>
+ <source>PREF_AUTO_HIDE_SEARCH_TOOL</source>
+ <translation>Cacher automatiquement</translation>
+ </message>
+ <message>
+ <source>PREF_OBJ_BROWSER_SETTINGS</source>
+ <translation>Paramètres de l'arbre d'étude</translation>
+ </message>
+ <message>
+ <source>PRP_APP_MODULE</source>
+ <translation>Basculer au point neutre de la plate-forme SALOME</translation>
+ </message>
+ <message>
+ <source>PREF_GROUP_PY_CONSOLE</source>
+ <translation>Propriétés de la console Python</translation>
+ </message>
+ <message>
+ <source>PREF_SHOW_BANNER</source>
+ <translation>Afficher la bannière</translation>
+ </message>
+ <message>
+ <source>PREF_GROUP_STYLE</source>
+ <translation>Style Salomé</translation>
+ </message>
+ <message>
+ <source>PREF_USE_SALOME_STYLE</source>
+ <translation>Utiliser le style Salomé</translation>
+ </message>
+ <message>
+ <source>PREF_MARKER_SIZE</source>
+ <translation>Taille de repère:</translation>
+ </message>
+ <message>
+ <source>PREF_TAB_VIEWERS</source>
+ <translation>Scènes</translation>
+ </message>
+ <message>
+ <source>PREF_APP</source>
+ <translation>Application</translation>
+ </message>
+ <message>
+ <source>PREF_TOP</source>
+ <translation>Dessus</translation>
+ </message>
+ <message>
+ <source>MEN_REFRESH</source>
+ <translation>Rafraîchir</translation>
+ </message>
+ <message>
+ <source>PREF_AUTO_SIZE_FIRST</source>
+ <translation>Taille automatique pour la colonne "Nom"</translation>
+ </message>
+ <message>
+ <source>PREF_RESIZE_ON_EXPAND_ITEM</source>
+ <translation>Redimensionner les colonnes quand l'objet est déplié</translation>
+ </message>
+ <message>
+ <source>PREF_BROWSE_TO_THE_PUBLISHED_OBJECT</source>
+ <translation>Se déplacer sur l'objet publié</translation>
+ </message>
+ <message>
+ <source>PREF_BROWSE_NEVER</source>
+ <translation>Jamais</translation>
+ </message>
+ <message>
+ <source>PREF_BROWSE_AFTER_APPLY_AND_CLOSE_ONLY</source>
+ <translation>Seulement après "Appliquer et Fermer"</translation>
+ </message>
+ <message>
+ <source>PREF_BROWSE_ALWAYS</source>
+ <translation>Toujours</translation>
+ </message>
+ <message>
+ <source>PREF_GROUP_SUPERV</source>
+ <translation>Superviseur des graphes</translation>
+ </message>
+ <message>
+ <source>PREF_TAB_OBJBROWSER</source>
+ <translation>Arbre d'étude</translation>
+ </message>
+ <message>
+ <source>PREF_TAB_GENERAL</source>
+ <translation>Général</translation>
+ </message>
+ <message>
+ <source>NEW_WINDOW_0</source>
+ <translation>Scène &GL </translation>
+ </message>
+ <message>
+ <source>NEW_WINDOW_1</source>
+ <translation>Scène &Plot2d </translation>
+ </message>
+ <message>
+ <source>NEW_WINDOW_2</source>
+ <translation>Scène &OCC</translation>
+ </message>
+ <message>
+ <source>NEW_WINDOW_3</source>
+ <translation>Scène VT&K</translation>
+ </message>
+ <message>
+ <source>NEW_WINDOW_4</source>
+ <translation>Scène &QxGraph</translation>
+ </message>
+ <message>
+ <source>NEW_WINDOW_5</source>
+ <translation>Scène Qx&Scene</translation>
+ </message>
+ <message>
+ <source>CREATING_NEW_WINDOW</source>
+ <translation>Créer une nouvelle %1</translation>
+ </message>
+ <message>
+ <source>OBJ_BROWSER_NAME</source>
+ <translation>Objet</translation>
+ </message>
+ <message>
+ <source>PREF_LEGEND_POSITION</source>
+ <translation>Position de la Légende:</translation>
+ </message>
+ <message>
+ <source>PREF_RELATIVE_SIZE</source>
+ <translation>Relative</translation>
+ </message>
+ <message>
+ <source>PREF_VIEWER_BACKGROUND</source>
+ <translation>Arrière-plan</translation>
+ </message>
+ <message>
+ <source>PREF_VIEWER_BACKGROUND_COLOR</source>
+ <translation>Couleur de l'arrière-plan</translation>
+ </message>
+ <message>
+ <source>PREF_VIEWER_SELECTION</source>
+ <translation>Couleur de sélection</translation>
+ </message>
+ <message>
+ <source>PREF_XYVIEWER_BACKGROUND</source>
+ <translation>Vue XY</translation>
+ </message>
+ <message>
+ <source>PREF_XZVIEWER_BACKGROUND</source>
+ <translation>Vue XZ</translation>
+ </message>
+ <message>
+ <source>PREF_YZVIEWER_BACKGROUND</source>
+ <translation>Vue YZ</translation>
+ </message>
+ <message>
+ <source>PREF_3DVIEWER_BACKGROUND</source>
+ <translation>Vue 3D</translation>
+ </message>
+ <message>
+ <source>PREF_FONT</source>
+ <translation>Police</translation>
+ </message>
+ <message>
+ <source>PREF_LEGEND_FONT</source>
+ <translation>Police de la légende</translation>
+ </message>
+ <message>
+ <source>PREF_FONT_COLOR</source>
+ <translation>Couleur de police de la légende</translation>
+ </message>
+ <message>
+ <source>PREF_SELECTED_FONT_COLOR</source>
+ <translation>Couleur de surlignement de la légende</translation>
+ </message>
+ <message>
+ <source>PREF_LEFT</source>
+ <translation>Gauche</translation>
+ </message>
+ <message>
+ <source>PREF_TAB_DIRECTORIES</source>
+ <translation>Emplacements</translation>
+ </message>
+ <message>
+ <source>ACTIVATING_MODULE</source>
+ <translation>Activation du module "%1" en cours</translation>
+ </message>
+ <message>
+ <source>PREF_VERT_AXIS_SCALE</source>
+ <translation>Echelle de l'axe vertical :</translation>
+ </message>
+ <message>
+ <source>PREF_HOR_AXIS_SCALE</source>
+ <translation>Echelle de l'axe horizontal :</translation>
+ </message>
+ <message>
+ <source>PREF_GROUP_LANGUAGE</source>
+ <translation>Langue</translation>
+ </message>
+ <message>
+ <source>PREF_CURRENT_LANGUAGE</source>
+ <translation>Langue actuelle</translation>
+ </message>
+ <message>
+ <source>PREF_GROUP_LOOK_AND_FEEL</source>
+ <translation>Aspect</translation>
+ </message>
+ <message>
+ <source>PREF_OPAQUE_RESIZE</source>
+ <translation>Redimensionnement opaque</translation>
+ </message>
+ <message>
+ <source>PREF_GROUP_STUDY</source>
+ <translation>Propiétés de l'étude</translation>
+ </message>
+ <message>
+ <source>PREF_CATEGORY_SALOME</source>
+ <translation>SALOME</translation>
+ </message>
+ <message>
+ <source>PREF_DROP_DOWN_BUTTONS</source>
+ <translation>Boutons alignés dans la barre</translation>
+ </message>
+ <message>
+ <source>PREF_GROUP_COMMON</source>
+ <translation>Commun</translation>
+ </message>
+ <message>
+ <source>PREF_GROUP_OCCVIEWER</source>
+ <translation>Scène OCC 3D</translation>
+ </message>
+ <message>
+ <source>PREF_LOGARITHMIC</source>
+ <translation>Logarithmique</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_MODULE_HELP</source>
+ <translation>Module &Aide</translation>
+ </message>
+ <message>
+ <source>PREF_SUPERV_TITLE_COLOR</source>
+ <translation>Couleur de titre</translation>
+ </message>
+ <message>
+ <source>PREF_PARAM</source>
+ <translation>Paramètres</translation>
+ </message>
+ <message>
+ <source>PREF_RIGHT</source>
+ <translation>Droite</translation>
+ </message>
+ <message>
+ <source>PREF_LINES</source>
+ <translation>Lignes</translation>
+ </message>
+ <message>
+ <source>INF_CANCELLED</source>
+ <translation>L'activation du module est annulée</translation>
+ </message>
+ <message>
+ <source>PREF_GROUP_EXT_BROWSER</source>
+ <translation>Navigateur externe</translation>
+ </message>
+ <message>
+ <source>PREF_SUPERV_CTRL_COLOR</source>
+ <translation>Couleur de contrôle</translation>
+ </message>
+ <message>
+ <source>PREF_GROUP_DEF_COLUMNS</source>
+ <translation>Colonnnes par défaut </translation>
+ </message>
+ <message>
+ <source>PREF_GROUP_PLOT2DVIEWER</source>
+ <translation>Scène Plot2d</translation>
+ </message>
+ <message>
+ <source>PREF_DEVIATION_COLOR</source>
+ <translation>Couleur des marqueurs de déviation</translation>
+ </message>
+ <message>
+ <source>PREF_DEVIATION_MARKER_LW</source>
+ <translation>Epaisseur des lignes des marqueurs de déviation</translation>
+ </message>
+ <message>
+ <source>PREF_DEVIATION_MARKER_TS</source>
+ <translation>Taille des coches des marqueurs de déviation</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_MRU</source>
+ <translation>&Récemment utilisés</translation>
+ </message>
+ <message>
+ <source>TOT_DESK_PREFERENCES</source>
+ <translation>Préférences</translation>
+ </message>
+ <message>
+ <source>DEFINE_EXTERNAL_BROWSER</source>
+ <translation>Le navigateur externe n'est pas trouvé. Voulez-vous le définir dans les préférences?</translation>
+ </message>
+ <message>
+ <source>PREF_AUTO_SIZE</source>
+ <translation>Taille automatique pour les autres colonnes</translation>
+ </message>
+ <message>
+ <source>TOT_DESK_MRU</source>
+ <translation>Récemment utilisés</translation>
+ </message>
+ <message>
+ <source>ACTIVATE_MODULE_OP_NEW</source>
+ <translation>&Nouveau</translation>
+ </message>
+ <message>
+ <source>ACTIVATE_MODULE_OP_OPEN</source>
+ <translation>&Ouvrir...</translation>
+ </message>
+ <message>
+ <source>PYTHON_CONSOLE</source>
+ <translation>Console Python</translation>
+ </message>
+ <message>
+ <source>PREF_DYNAMIC_PRESELECTION</source>
+ <translation>Utiliser l'algorithme de sélection avancée</translation>
+ </message>
+ <message>
+ <source>TOT_CLOSE</source>
+ <translation>Fermer</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_CLOSE</source>
+ <translation>&Fermer</translation>
+ </message>
+ <message>
+ <source>PRP_CLOSE</source>
+ <translation>Fermer la fenêtre active</translation>
+ </message>
+ <message>
+ <source>TOT_CLOSE_ALL</source>
+ <translation>Tout fermer</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_CLOSE_ALL</source>
+ <translation>&Tout fermer</translation>
+ </message>
+ <message>
+ <source>PRP_CLOSE_ALL</source>
+ <translation>Fermer toutes les fenêtres</translation>
+ </message>
+ <message>
+ <source>TOT_GROUP_ALL</source>
+ <translation>Tout grouper</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_GROUP_ALL</source>
+ <translation>Tout &grouper</translation>
+ </message>
+ <message>
+ <source>PRP_GROUP_ALL</source>
+ <translation>Grouper toutes les fenêtres</translation>
+ </message>
+ <message>
+ <source>ERR_DOC_NOT_EXISTS</source>
+ <translation>Impossible d'ouvrir %1.
+Le fichier n'existe pas</translation>
+ </message>
+ <message>
+ <source>PREF_GROUP_MRU</source>
+ <translation>Montrer les études récemment utilisées</translation>
+ </message>
+ <message>
+ <source>PREF_MRU_VISIBLE_COUNT</source>
+ <translation>Nombre d'études</translation>
+ </message>
+ <message>
+ <source>PREF_MRU_INSERT_MODE</source>
+ <translation>Mode d'insertion</translation>
+ </message>
+ <message>
+ <source>PREF_MRU_MOVE_FIRST</source>
+ <translation>Placer au début</translation>
+ </message>
+ <message>
+ <source>PREF_MRU_MOVE_LAST</source>
+ <translation>Placer à la fin</translation>
+ </message>
+ <message>
+ <source>PREF_MRU_ADD_FIRST</source>
+ <translation>Ajouter au début</translation>
+ </message>
+ <message>
+ <source>PREF_MRU_ADD_LAST</source>
+ <translation>Ajouter à la fin</translation>
+ </message>
+ <message>
+ <source>PREF_MRU_LINK_TYPE</source>
+ <translation>Type de lien</translation>
+ </message>
+ <message>
+ <source>PREF_MRU_LINK_AUTO</source>
+ <translation>Auto</translation>
+ </message>
+ <message>
+ <source>PREF_MRU_LINK_SHORT</source>
+ <translation>Court</translation>
+ </message>
+ <message>
+ <source>PREF_MRU_LINK_FULL</source>
+ <translation>Complet</translation>
+ </message>
+ <message>
+ <source>PREFERENCES_NOT_SUPPORTED</source>
+ <translation>Les préférences du module "%1" ne sont pas supportées</translation>
+ </message>
+ <message>
+ <source>PREF_TAB_SHORTCUTS</source>
+ <translation>Raccourcis clavier</translation>
+ </message>
+ <message>
+ <source>PREF_GROUP_SHORTCUTS</source>
+ <translation>Réglage des raccourcis clavier</translation>
+ </message>
+</context>
+<context>
+ <name>LightApp_Module</name>
+ <message>
+ <source>MEN_HIDE</source>
+ <translation>Cacher</translation>
+ </message>
+ <message>
+ <source>TOP_DISPLAY_ONLY</source>
+ <translation>Afficher uniquement</translation>
+ </message>
+ <message>
+ <source>STB_DISPLAY_ONLY</source>
+ <translation>Afficher uniquement</translation>
+ </message>
+ <message>
+ <source>MEN_DISPLAY_ONLY</source>
+ <translation>Afficher uniquement</translation>
+ </message>
+ <message>
+ <source>TOP_HIDE</source>
+ <translation>Cacher</translation>
+ </message>
+ <message>
+ <source>MEN_ERASE_ALL</source>
+ <translation>Tout cacher</translation>
+ </message>
+ <message>
+ <source>STB_HIDE</source>
+ <translation>Cacher</translation>
+ </message>
+ <message>
+ <source>STB_SHOW</source>
+ <translation>Afficher</translation>
+ </message>
+ <message>
+ <source>TOP_SHOW</source>
+ <translation>Afficher</translation>
+ </message>
+ <message>
+ <source>MEN_SHOW</source>
+ <translation>Afficher</translation>
+ </message>
+ <message>
+ <source>STB_ERASE_ALL</source>
+ <translation>Tout cacher</translation>
+ </message>
+ <message>
+ <source>TOP_ERASE_ALL</source>
+ <translation>Tout cacher</translation>
+ </message>
+</context>
+<context>
+ <name>LightApp_ModuleDlg</name>
+ <message>
+ <source>DESCRIPTION</source>
+ <translation>Vous activez le module
+ <b>%1</b>.<br>Choisissez l'action nécessaire avec le bouton correspondant ci-dessous</translation>
+ </message>
+ <message>
+ <source>CANCEL</source>
+ <translation>&Annuler</translation>
+ </message>
+ <message>
+ <source>CAPTION</source>
+ <translation>Activer le module</translation>
+ </message>
+</context>
+<context>
+ <name>LightApp_NameDlg</name>
+ <message>
+ <source>TLT_RENAME</source>
+ <translation>Renommer</translation>
+ </message>
+ <message>
+ <source>NAME_LBL</source>
+ <translation>Nom: </translation>
+ </message>
+</context>
+<context>
+ <name>LightApp_PreferencesDlg</name>
+ <message>
+ <source>IMPORT_PREFERENCES</source>
+ <translation>Importer les préférences</translation>
+ </message>
+ <message>
+ <source>CAPTION</source>
+ <translation>Préférences</translation>
+ </message>
+ <message>
+ <source>WARNING</source>
+ <translation>Avertissement</translation>
+ </message>
+ <message>
+ <source>IMPORT_BTN_TEXT</source>
+ <translation>Importer</translation>
+ </message>
+ <message>
+ <source>DEFAULT_QUESTION</source>
+ <translation>Voulez-vous restaurer les préférences par défaut ?</translation>
+ </message>
+ <message>
+ <source>DEFAULT_BTN_TEXT</source>
+ <translation>Défauts</translation>
+ </message>
+</context>
+<context>
+ <name>LightApp_ModuleAction</name>
+ <message>
+ <source>ACTIVATE_MODULE_TOP</source>
+ <translation>Activer/désactiver le module %1</translation>
+ </message>
+</context>
+</TS>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="fr_FR">
+<context>
+ <name>LogWindow</name>
+ <message>
+ <location filename="../LogWindow.cxx" line="293"/>
+ <source>EDIT_COPY_CMD</source>
+ <translation>&Copier</translation>
+ </message>
+ <message>
+ <location filename="../LogWindow.cxx" line="298"/>
+ <source>EDIT_CLEAR_CMD</source>
+ <translation>&Effacer</translation>
+ </message>
+ <message>
+ <location filename="../LogWindow.cxx" line="303"/>
+ <source>EDIT_SELECTALL_CMD</source>
+ <translation>&Tout sélectionner</translation>
+ </message>
+ <message>
+ <location filename="../LogWindow.cxx" line="308"/>
+ <source>EDIT_SAVETOFILE_CMD</source>
+ <translation>&Sauvegarder le journal dans un fichier...</translation>
+ </message>
+ <message>
+ <location filename="../LogWindow.cxx" line="368"/>
+ <source>ERR_ERROR</source>
+ <translation>Erreur</translation>
+ </message>
+ <message>
+ <location filename="../LogWindow.cxx" line="368"/>
+ <source>ERR_CANT_SAVE_FILE</source>
+ <translation>Impossible de sauvegarder le fichier</translation>
+ </message>
+ <message>
+ <location filename="../LogWindow.cxx" line="368"/>
+ <source>BUT_OK</source>
+ <translation>&OK</translation>
+ </message>
+</context>
+</TS>
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "OCCViewer_CubeAxesDlg.h"
+
+#include "OCCViewer_FontWidget.h"
+#include "OCCViewer_ViewPort3d.h"
+#include "OCCViewer_ViewWindow.h"
+
+#include "QtxAction.h"
+#include "QtxIntSpinBox.h"
+
+#include <Basics_OCCTVersion.hxx>
+
+#include <QCheckBox>
+#include <QGroupBox>
+#include <QLineEdit>
+
+/*!
+ \class OCCViewer_CubeAxesDlg::AxisWidget
+ \brief Axis tab widget of the "Graduated axis" dialog box
+ \internal
+*/
+
+/*!
+ Constructor
+*/
+OCCViewer_AxisWidget::OCCViewer_AxisWidget (QWidget* theParent)
+: ViewerTools_AxisWidgetBase(theParent)
+{
+}
+
+/*!
+ Destructor
+*/
+OCCViewer_AxisWidget::~OCCViewer_AxisWidget()
+{
+}
+
+/*!
+ Create font widget
+*/
+ViewerTools_FontWidgetBase* OCCViewer_AxisWidget::createFontWidget( QWidget* theParent )
+{
+ OCCViewer_FontWidget* aFontWidget = new OCCViewer_FontWidget( theParent );
+ aFontWidget->Initialize();
+ return aFontWidget;
+}
+
+/*!
+ Set axis data
+*/
+void OCCViewer_AxisWidget::SetData( const AxisData& theAxisData )
+{
+ myNameGrp->setChecked( theAxisData.DrawName );
+ myAxisName->setText( theAxisData.Name );
+ myNameFont->SetData( theAxisData.NameColor, 0, false, false, false );
+
+ myLabelsGrp->setChecked( theAxisData.DrawValues );
+ myLabelNumber->setValue( theAxisData.NbValues );
+ myLabelOffset->setValue( theAxisData.Offset );
+ myLabelsFont->SetData( theAxisData.Color, 0, false, false, false );
+
+ myTicksGrp->setChecked( theAxisData.DrawTickmarks );
+ myTickLength->setValue( theAxisData.TickmarkLength );
+}
+
+/*!
+ Get axis data
+*/
+void OCCViewer_AxisWidget::GetData( AxisData& theAxisData )
+{
+ theAxisData.DrawName = myNameGrp->isChecked();
+ theAxisData.Name = myAxisName->text();
+
+ int aNameFamily;
+ bool aNameBold, aNameItalic, aNameShadow;
+ myNameFont->GetData( theAxisData.NameColor, aNameFamily, aNameBold, aNameItalic, aNameShadow );
+
+ theAxisData.DrawValues = myLabelsGrp->isChecked();
+ theAxisData.NbValues = myLabelNumber->value();
+ theAxisData.Offset = myLabelOffset->value();
+
+ int aLabelFamily;
+ bool aLabelBold, aLabelItalic, aLabelShadow;
+ myLabelsFont->GetData( theAxisData.Color, aLabelFamily, aLabelBold, aLabelItalic, aLabelShadow );
+
+ theAxisData.DrawTickmarks = myTicksGrp->isChecked();
+ theAxisData.TickmarkLength = myTickLength->value();
+}
+
+/*
+ Class : OCCViewer_CubeAxesDlg
+ Description : Dialog for specifying cube axes properties
+*/
+
+/*!
+ Constructor
+*/
+OCCViewer_CubeAxesDlg::OCCViewer_CubeAxesDlg(QtxAction* theAction,
+ OCCViewer_ViewWindow* theParent,
+ const char* theName):
+ ViewerTools_CubeAxesDlgBase(theAction,
+ theParent,
+ theName),
+ myMainWindow(theParent)
+{
+}
+
+/*!
+ Destructor
+*/
+OCCViewer_CubeAxesDlg::~OCCViewer_CubeAxesDlg()
+{
+}
+
+/*!
+ Create axis widget
+*/
+ViewerTools_AxisWidgetBase* OCCViewer_CubeAxesDlg::createAxisWidget( QWidget* theParent )
+{
+ OCCViewer_AxisWidget* anAxisWidget = new OCCViewer_AxisWidget( theParent );
+ anAxisWidget->initialize();
+ return anAxisWidget;
+}
+
+/*!
+ Update dialog fields, connect signals and slots, show dialog
+*/
+void OCCViewer_CubeAxesDlg::initialize()
+{
+ ViewerTools_CubeAxesDlgBase::initialize();
+
+ for( int i = 0; i < 3; i++ )
+ {
+ if( OCCViewer_AxisWidget* anAxisWidget = dynamic_cast<OCCViewer_AxisWidget*>( myAxes[ i ] ) )
+ {
+ OCCViewer_AxisWidget::AxisData anAxisData;
+ switch( i )
+ {
+ case 0:
+ anAxisData.Name = "X";
+ anAxisData.NameColor = anAxisData.Color = Qt::red;
+ break;
+ case 1:
+ anAxisData.Name = "Y";
+ anAxisData.NameColor = anAxisData.Color = Qt::green;
+ break;
+ case 2:
+ anAxisData.Name = "Z";
+ anAxisData.NameColor = anAxisData.Color = Qt::blue;
+ break;
+ }
+ anAxisData.DrawName = true;
+ anAxisData.DrawValues = true;
+ anAxisData.NbValues = 3;
+ anAxisData.Offset = 2;
+ anAxisData.DrawTickmarks = true;
+ anAxisData.TickmarkLength = 5;
+ anAxisWidget->SetData( anAxisData );
+ }
+ }
+}
+
+/*!
+ Update dialog fields, connect signals and slots, show dialog
+*/
+void OCCViewer_CubeAxesDlg::Update()
+{
+ ViewerTools_CubeAxesDlgBase::Update();
+}
+
+/*!
+ Verify validity of entry data
+*/
+bool OCCViewer_CubeAxesDlg::onApply()
+{
+ bool isOk = ViewerTools_CubeAxesDlgBase::onApply();
+
+ try
+ {
+ QWidget *aCurrWid = this->focusWidget();
+ aCurrWid->clearFocus();
+ aCurrWid->setFocus();
+
+ if( OCCViewer_ViewPort3d* aViewPort = myMainWindow->getViewPort() )
+ {
+ Handle(V3d_View) aView = aViewPort->getView();
+ if( !aView.IsNull() )
+ ApplyData( aView );
+ }
+ }
+ catch(...)
+ {
+ isOk = false;
+ }
+
+ return isOk;
+}
+
+/*!
+ Get graduated trihedron parameters
+*/
+void OCCViewer_CubeAxesDlg::GetData( bool& theIsVisible, OCCViewer_AxisWidget::AxisData theAxisData[3] )
+{
+ theIsVisible = myIsVisible->isChecked();
+ for( int i = 0; i < 3; i++ )
+ if( OCCViewer_AxisWidget* anAxisWidget = dynamic_cast<OCCViewer_AxisWidget*>( myAxes[ i ] ) )
+ anAxisWidget->GetData( theAxisData[i] );
+}
+
+/*!
+ Set graduated trihedron parameters
+*/
+void OCCViewer_CubeAxesDlg::SetData( bool theIsVisible, OCCViewer_AxisWidget::AxisData theAxisData[3] )
+{
+ myIsVisible->setChecked( theIsVisible );
+ for( int i = 0; i < 3; i++ )
+ if( OCCViewer_AxisWidget* anAxisWidget = dynamic_cast<OCCViewer_AxisWidget*>( myAxes[ i ] ) )
+ anAxisWidget->SetData( theAxisData[i] );
+}
+
+/*!
+ Apply graduated trihedron parameters
+*/
+void OCCViewer_CubeAxesDlg::ApplyData( const Handle(V3d_View)& theView )
+{
+#if OCC_VERSION_LARGE > 0x06030009 // available only with OCC-6.3-sp10 and higher version
+ if( theView.IsNull() )
+ return;
+
+ if( myIsVisible->isChecked() )
+ {
+ OCCViewer_AxisWidget::AxisData anAxisData[3];
+ for( int i = 0; i < 3; i++ )
+ if( OCCViewer_AxisWidget* anAxisWidget = dynamic_cast<OCCViewer_AxisWidget*>( myAxes[ i ] ) )
+ anAxisWidget->GetData( anAxisData[i] );
+
+ // A gap used offset of axis names' offset
+ // (this hard-coded value will be removed when the
+ // font support will be introduced in OCC-6.4)
+ int aGap = 20;
+
+ theView->GraduatedTrihedronDisplay(
+ anAxisData[0].Name.toLatin1().constData(),
+ anAxisData[1].Name.toLatin1().constData(),
+ anAxisData[2].Name.toLatin1().constData(),
+ anAxisData[0].DrawName,
+ anAxisData[1].DrawName,
+ anAxisData[2].DrawName,
+ anAxisData[0].DrawValues,
+ anAxisData[1].DrawValues,
+ anAxisData[2].DrawValues,
+ Standard_True, // draw grid
+ Standard_False, // draw axes
+ anAxisData[0].NbValues - 1,
+ anAxisData[1].NbValues - 1,
+ anAxisData[2].NbValues - 1,
+ anAxisData[0].Offset,
+ anAxisData[1].Offset,
+ anAxisData[2].Offset,
+ anAxisData[0].Offset + aGap, // see above
+ anAxisData[1].Offset + aGap, // see above
+ anAxisData[2].Offset + aGap, // see above
+ anAxisData[0].DrawTickmarks,
+ anAxisData[1].DrawTickmarks,
+ anAxisData[2].DrawTickmarks,
+ anAxisData[0].TickmarkLength,
+ anAxisData[1].TickmarkLength,
+ anAxisData[2].TickmarkLength,
+ Quantity_NOC_WHITE, // grid color
+ Quantity_Color( anAxisData[0].NameColor.redF(),
+ anAxisData[0].NameColor.greenF(),
+ anAxisData[0].NameColor.blueF(),
+ Quantity_TOC_RGB ),
+ Quantity_Color( anAxisData[1].NameColor.redF(),
+ anAxisData[1].NameColor.greenF(),
+ anAxisData[1].NameColor.blueF(),
+ Quantity_TOC_RGB ),
+ Quantity_Color( anAxisData[2].NameColor.redF(),
+ anAxisData[2].NameColor.greenF(),
+ anAxisData[2].NameColor.blueF(),
+ Quantity_TOC_RGB ),
+ Quantity_Color( anAxisData[0].Color.redF(),
+ anAxisData[0].Color.greenF(),
+ anAxisData[0].Color.blueF(),
+ Quantity_TOC_RGB ),
+ Quantity_Color( anAxisData[1].Color.redF(),
+ anAxisData[1].Color.greenF(),
+ anAxisData[1].Color.blueF(),
+ Quantity_TOC_RGB ),
+ Quantity_Color( anAxisData[2].Color.redF(),
+ anAxisData[2].Color.greenF(),
+ anAxisData[2].Color.blueF(),
+ Quantity_TOC_RGB ) );
+ }
+ else
+ theView->GraduatedTrihedronErase();
+
+ theView->Redraw();
+#endif
+}
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef OCCVIEWER_CUBEAXESDLG_H
+#define OCCVIEWER_CUBEAXESDLG_H
+
+#include "OCCViewer.h"
+
+#include <ViewerTools_CubeAxesDlgBase.h>
+
+#include <V3d_View.hxx>
+
+class OCCViewer_ViewWindow;
+
+/*!
+ * Class : OCCViewer_AxisWidget
+ * Description : Axis tab widget of the "Graduated axis" dialog box
+*/
+class OCCVIEWER_EXPORT OCCViewer_AxisWidget : public ViewerTools_AxisWidgetBase
+{
+public:
+ struct AxisData
+ {
+ bool DrawName;
+ QString Name;
+ QColor NameColor;
+ bool DrawValues;
+ int NbValues;
+ int Offset;
+ QColor Color;
+ bool DrawTickmarks;
+ int TickmarkLength;
+ };
+
+public:
+ OCCViewer_AxisWidget( QWidget* );
+ ~OCCViewer_AxisWidget();
+
+public:
+ void SetData( const AxisData& );
+ void GetData( AxisData& );
+
+protected:
+ virtual ViewerTools_FontWidgetBase* createFontWidget( QWidget* );
+};
+
+/*!
+ * Class : OCCViewer_CubeAxesDlg
+ * Description : Dialog for specifynig cube axes properties
+ */
+class OCCVIEWER_EXPORT OCCViewer_CubeAxesDlg : public ViewerTools_CubeAxesDlgBase
+{
+ Q_OBJECT
+
+public:
+ OCCViewer_CubeAxesDlg(QtxAction* theAction,
+ OCCViewer_ViewWindow* theParent,
+ const char* theName);
+ virtual ~OCCViewer_CubeAxesDlg();
+
+ virtual void initialize();
+
+ void GetData( bool& theIsVisible, OCCViewer_AxisWidget::AxisData theAxisData[3] );
+ void SetData( bool theIsVisible, OCCViewer_AxisWidget::AxisData theAxisData[3] );
+
+ void ApplyData( const Handle(V3d_View)& theView );
+
+ virtual void Update();
+
+private slots:
+ virtual bool onApply();
+
+private:
+ virtual ViewerTools_AxisWidgetBase* createAxisWidget( QWidget* );
+
+private:
+ OCCViewer_ViewWindow* myMainWindow;
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "OCCViewer_FontWidget.h"
+
+#include <QComboBox>
+
+//#include <vtkTextProperty.h>
+
+/*!
+ * Class : OCCViewer_FontWidget
+ * Description : Dialog for specifynig font
+ */
+
+/*!
+ Constructor
+*/
+OCCViewer_FontWidget::OCCViewer_FontWidget( QWidget* theParent )
+: ViewerTools_FontWidgetBase( theParent )
+{
+}
+
+/*!
+ Destructor
+*/
+OCCViewer_FontWidget::~OCCViewer_FontWidget()
+{
+}
+
+void OCCViewer_FontWidget::InitializeFamilies()
+{
+ //myFamily->insertItem( myFamily->count(), tr( "ARIAL" ) );
+ //myFamily->insertItem( myFamily->count(), tr( "COURIER" ) );
+ //myFamily->insertItem( myFamily->count(), tr( "TIMES" ) );
+}
+
+void OCCViewer_FontWidget::SetData( const QColor& theColor,
+ const int theFamily,
+ const bool theBold,
+ const bool theItalic,
+ const bool theShadow )
+{
+ ViewerTools_FontWidgetBase::SetData( theColor,
+ theFamily,
+ theBold,
+ theItalic,
+ theShadow );
+
+ /*
+ if ( theFamily == VTK_ARIAL )
+ myFamily->setCurrentIndex( 0 );
+ else if ( theFamily == VTK_COURIER )
+ myFamily->setCurrentIndex( 1 );
+ else
+ myFamily->setCurrentIndex( 2 );
+ */
+}
+
+void OCCViewer_FontWidget::GetData( QColor& theColor,
+ int& theFamily,
+ bool& theBold,
+ bool& theItalic,
+ bool& theShadow ) const
+{
+ ViewerTools_FontWidgetBase::GetData( theColor,
+ theFamily,
+ theBold,
+ theItalic,
+ theShadow );
+
+ /*
+ int anItem = myFamily->currentIndex();
+ if ( anItem == 0 )
+ theFamily = VTK_ARIAL;
+ else if ( anItem == 1 )
+ theFamily = VTK_COURIER;
+ else
+ theFamily = VTK_TIMES;
+ */
+}
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef OCCVIEWER_FONTWIDGET_H
+#define OCCVIEWER_FONTWIDGET_H
+
+#include "OCCViewer.h"
+
+#include <ViewerTools_FontWidgetBase.h>
+
+/*!
+ * Class : OCCViewer_FontWidget
+ * Description : Dialog for specifynig font
+ */
+class OCCVIEWER_EXPORT OCCViewer_FontWidget : public ViewerTools_FontWidgetBase
+{
+ Q_OBJECT
+
+public:
+ OCCViewer_FontWidget( QWidget* );
+ virtual ~OCCViewer_FontWidget();
+
+ virtual void SetData( const QColor&, const int, const bool, const bool, const bool );
+
+ virtual void GetData( QColor&, int&, bool&, bool&, bool& ) const;
+
+protected:
+ virtual void InitializeFamilies();
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "OCCViewer_ViewFrame.h"
+#include "OCCViewer_ViewWindow.h"
+#include "OCCViewer_ViewModel.h"
+
+#include <SUIT_ViewManager.h>
+
+#include <QFrame>
+#include <QLayout>
+#include <QApplication>
+
+OCCViewer_ViewFrame::OCCViewer_ViewFrame(SUIT_Desktop* theDesktop, OCCViewer_Viewer* theModel)
+ : OCCViewer_ViewWindow( theDesktop, theModel ), myPopupRequestedView(0)
+{
+ QFrame* centralFrame = new QFrame( this );
+ setCentralWidget( centralFrame );
+
+ OCCViewer_ViewWindow* view0 = theModel->createSubWindow();
+ view0->setParent( centralFrame );
+ myViews.append( view0 ); // MAIN_VIEW
+
+ myLayout = new QGridLayout( centralFrame );
+ myLayout->setMargin( 0 );
+ myLayout->setSpacing( 1 );
+
+ myLayout->addWidget( view0, 1, 1 );
+ connectViewSignals(view0);
+}
+
+OCCViewer_ViewFrame::~OCCViewer_ViewFrame()
+{
+}
+
+//**************************************************************************************
+OCCViewer_ViewWindow* OCCViewer_ViewFrame::getView( const int i ) const
+{
+ return ( i >= 0 && i < myViews.count() ) ? myViews.at( i ) : 0 ;
+}
+
+//**************************************************************************************
+void OCCViewer_ViewFrame::setViewManager( SUIT_ViewManager* theMgr )
+{
+ OCCViewer_ViewWindow::setViewManager(theMgr);
+ foreach (OCCViewer_ViewWindow* aView, myViews) {
+ aView->setViewManager(theMgr);
+ }
+}
+
+
+//**************************************************************************************
+void OCCViewer_ViewFrame::onMaximizedView( OCCViewer_ViewWindow* theView, bool isMaximized)
+{
+ if (isMaximized) {
+ if (myViews.count() <= 1)
+ return;
+
+ myLayout->setColumnStretch(0, 0);
+ myLayout->setColumnStretch(1, 0);
+ int i = 0;
+ OCCViewer_ViewWindow* view = 0;
+ for ( i = BOTTOM_RIGHT; i <= TOP_RIGHT; i++) {
+ view = myViews.at(i);
+ view->setVisible( view == theView );
+ view->setMaximized( view == theView, false );
+ }
+ }
+ else {
+ OCCViewer_Viewer* aModel = dynamic_cast<OCCViewer_Viewer*>(myManager->getViewModel());
+ if (!aModel) return;
+
+ myLayout->setColumnStretch(0, 10);
+ myLayout->setColumnStretch(1, 10);
+
+ int i = 0;
+ if (myViews.count() == 1) {
+ //QColor aColor = myViews.at( MAIN_VIEW )->backgroundColor();
+ OCCViewer_ViewWindow* view = 0;
+ for ( i = BOTTOM_LEFT; i <= TOP_RIGHT; i++) {
+ view = aModel->createSubWindow();
+ view->set2dMode( (Mode2dType) i );
+ view->setParent( centralWidget() );
+ view->setViewManager(myManager);
+ myViews.append( view );
+ aModel->initView(view);
+ view->setMaximized(false, false);
+ view->setDropDownButtons( dropDownButtons() );
+ connectViewSignals(view);
+ view->setBackground(aModel->background(i));
+ }
+ myLayout->addWidget( myViews.at(BOTTOM_LEFT), 1, 0 );
+ myLayout->addWidget( myViews.at(TOP_LEFT), 0, 0 );
+ myLayout->addWidget( myViews.at(TOP_RIGHT), 0, 1 );
+ }
+ OCCViewer_ViewWindow* view = 0;
+ for ( i = BOTTOM_RIGHT; i <= TOP_RIGHT; i++) {
+ view = myViews.at(i);
+ view->show();
+ view->setMaximized( false, false );
+ ///////////////QApplication::processEvents(); // VSR: hangs up ?
+ if (view != theView)
+ view->onViewFitAll();
+ }
+ }
+ myLayout->invalidate();
+}
+
+OCCViewer_ViewPort3d* OCCViewer_ViewFrame::getViewPort(int theView)
+{
+ return getView(theView)? getView(theView)->getViewPort() : 0;
+}
+
+void OCCViewer_ViewFrame::updateEnabledDrawMode()
+{
+ foreach (OCCViewer_ViewWindow* aView, myViews) {
+ aView->updateEnabledDrawMode();
+ }
+}
+
+void OCCViewer_ViewFrame::setCuttingPlane( bool on, const double x , const double y , const double z,
+ const double dx, const double dy, const double dz)
+{
+ foreach (OCCViewer_ViewWindow* aView, myViews) {
+ aView->setCuttingPlane(on, x, y, z, dx, dy, dz);
+ aView->update();
+ }
+}
+
+//**************************************************************************************
+void OCCViewer_ViewFrame::setCuttingPlane( bool on, const gp_Pln thePln )
+{
+ foreach (OCCViewer_ViewWindow* aView, myViews) {
+ aView->setCuttingPlane(on, thePln);
+ aView->update();
+ }
+}
+
+//**************************************************************************************
+void OCCViewer_ViewFrame::setInteractionStyle( const int i )
+{
+ foreach (OCCViewer_ViewWindow* aView, myViews) {
+ aView->setInteractionStyle(i);
+ }
+}
+
+//**************************************************************************************
+void OCCViewer_ViewFrame::setZoomingStyle( const int i )
+{
+ foreach (OCCViewer_ViewWindow* aView, myViews) {
+ aView->setZoomingStyle(i);
+ }
+}
+
+//**************************************************************************************
+void OCCViewer_ViewFrame::connectViewSignals(OCCViewer_ViewWindow* theView)
+{
+ connect( theView, SIGNAL( maximized( OCCViewer_ViewWindow*, bool ) ),
+ this, SLOT( onMaximizedView( OCCViewer_ViewWindow*, bool ) ) );
+
+ connect( theView, SIGNAL( wheeling(SUIT_ViewWindow*, QWheelEvent*) ),
+ this, SIGNAL( wheeling(SUIT_ViewWindow*, QWheelEvent*) ) );
+
+ connect( theView, SIGNAL( keyReleased(SUIT_ViewWindow*, QKeyEvent*) ),
+ this, SIGNAL( keyReleased(SUIT_ViewWindow*, QKeyEvent*) ) );
+ connect( theView, SIGNAL( keyPressed(SUIT_ViewWindow*, QKeyEvent*) ),
+ this, SIGNAL( keyPressed(SUIT_ViewWindow*, QKeyEvent*) ) );
+
+ connect( theView, SIGNAL( mouseDoubleClicked(SUIT_ViewWindow*, QMouseEvent*) ),
+ this, SIGNAL( mouseDoubleClicked(SUIT_ViewWindow*, QMouseEvent*) ) );
+ connect( theView, SIGNAL( mousePressed(SUIT_ViewWindow*, QMouseEvent*) ),
+ this, SIGNAL( mousePressed(SUIT_ViewWindow*, QMouseEvent*) ) );
+ connect( theView, SIGNAL( mouseReleased(SUIT_ViewWindow*, QMouseEvent*) ),
+ this, SIGNAL( mouseReleased(SUIT_ViewWindow*, QMouseEvent*) ) );
+ connect( theView, SIGNAL( mouseMoving(SUIT_ViewWindow*, QMouseEvent*) ),
+ this, SIGNAL( mouseMoving(SUIT_ViewWindow*, QMouseEvent*) ) );
+
+ // The signal is used to process get/set background color from popup
+ connect( theView, SIGNAL( contextMenuRequested(QContextMenuEvent*) ),
+ this, SLOT( onContextMenuRequested(QContextMenuEvent*) ) );
+
+ connect( theView, SIGNAL( contextMenuRequested(QContextMenuEvent*) ),
+ this, SIGNAL( contextMenuRequested(QContextMenuEvent*) ) );
+}
+
+// obsolete
+void OCCViewer_ViewFrame::setBackgroundColor( const QColor& theColor )
+{
+ if (myPopupRequestedView)
+ myPopupRequestedView->setBackgroundColor(theColor);
+ else {
+ foreach (OCCViewer_ViewWindow* aView, myViews) {
+ if (aView->isVisible())
+ aView->setBackgroundColor(theColor);
+ }
+ }
+}
+void OCCViewer_ViewFrame::setBackground( const Qtx::BackgroundData& theBackground )
+{
+ if (myPopupRequestedView)
+ myPopupRequestedView->setBackground(theBackground);
+ else {
+ foreach (OCCViewer_ViewWindow* aView, myViews) {
+ if (aView->isVisible())
+ aView->setBackground(theBackground);
+ }
+ }
+}
+
+void OCCViewer_ViewFrame::onViewFitAll()
+{
+ foreach (OCCViewer_ViewWindow* aView, myViews) {
+ aView->onViewFitAll();
+ }
+}
+
+void OCCViewer_ViewFrame::onFitAll()
+{
+ foreach (OCCViewer_ViewWindow* aView, myViews) {
+ aView->onFitAll();
+ }
+}
+
+// obsolete
+QColor OCCViewer_ViewFrame::backgroundColor() const
+{
+ if (myPopupRequestedView)
+ return myPopupRequestedView->backgroundColor();
+
+ foreach (OCCViewer_ViewWindow* aView, myViews) {
+ if (aView->isVisible())
+ return aView->backgroundColor();
+ }
+ return getView(MAIN_VIEW)->backgroundColor();
+}
+
+Qtx::BackgroundData OCCViewer_ViewFrame::background() const
+{
+ if (myPopupRequestedView)
+ return myPopupRequestedView->background();
+
+ foreach (OCCViewer_ViewWindow* aView, myViews) {
+ if (aView->isVisible())
+ return aView->background();
+ }
+ return getView(MAIN_VIEW)->background();
+}
+
+QImage OCCViewer_ViewFrame::dumpView()
+{
+ foreach (OCCViewer_ViewWindow* aView, myViews) {
+ if (aView->isVisible())
+ return aView->dumpView();
+ }
+ return QImage();
+}
+
+bool OCCViewer_ViewFrame::dumpViewToFormat( const QImage& image, const QString& fileName, const QString& format )
+{
+ foreach (OCCViewer_ViewWindow* aView, myViews) {
+ if (aView->isVisible())
+ return aView->dumpViewToFormat( image, fileName, format );
+ }
+ return false;
+}
+
+void OCCViewer_ViewFrame::onContextMenuRequested(QContextMenuEvent*)
+{
+ myPopupRequestedView = dynamic_cast<OCCViewer_ViewWindow*>(sender());
+}
+
+void OCCViewer_ViewFrame::onDumpView()
+{
+ if (myPopupRequestedView) {
+ myPopupRequestedView->onDumpView();
+ }
+ else {
+ getView(MAIN_VIEW)->onDumpView();
+ }
+}
+
+void OCCViewer_ViewFrame::setDropDownButtons( bool on )
+{
+ foreach( OCCViewer_ViewWindow* aView, myViews ) {
+ aView->setDropDownButtons( on );
+ }
+ OCCViewer_ViewWindow::setDropDownButtons( on );
+}
+
+QString OCCViewer_ViewFrame::getVisualParameters()
+{
+ QStringList params;
+ int maximizedView = 999;
+ for ( int i = BOTTOM_RIGHT; i <= TOP_RIGHT && i < myViews.count(); i++) {
+ if ( getView(i)->isVisible() )
+ maximizedView = ( maximizedView != -1 ) ? ( maximizedView == 999 ? i : -1 ) : ( maximizedView );
+ params << getView(i)->getVisualParameters();
+ }
+ params.prepend( QString::number( maximizedView ) );
+ return params.join( "|" );
+}
+
+void OCCViewer_ViewFrame::setVisualParameters( const QString& parameters )
+{
+ QStringList params = parameters.split( "|" );
+ if ( params.count() > 1 ) {
+ int maximizedView = params[0].toInt();
+ if ( myViews.count() < params.count()-1 )
+ onMaximizedView( getView(MAIN_VIEW), false ); // secondary views are not created yet, but should be
+ for ( int i = 1; i < params.count(); i++ ) {
+ int idx = i-1;
+ getView( idx )->setVisualParameters( params[i] );
+ }
+ onMaximizedView( getView( maximizedView ), maximizedView != -1 ); // set proper sib-window maximized
+ }
+ else {
+ // handle obsolete versions - no parameters for xy, yz, xz views
+ getView(MAIN_VIEW)->setVisualParameters( parameters );
+ }
+}
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef OCCVIEWER_VIEWFRAME_H
+#define OCCVIEWER_VIEWFRAME_H
+
+#include "OCCViewer.h"
+#include "OCCViewer_ViewWindow.h"
+
+#include <gp_Pln.hxx>
+
+class SUIT_Desktop;
+class OCCViewer_Viewer;
+class QGridLayout;
+
+class OCCVIEWER_EXPORT OCCViewer_ViewFrame : public OCCViewer_ViewWindow
+{
+ Q_OBJECT
+public:
+ enum { MAIN_VIEW, BOTTOM_RIGHT=MAIN_VIEW, BOTTOM_LEFT, TOP_LEFT, TOP_RIGHT };
+
+ OCCViewer_ViewFrame(SUIT_Desktop* theDesktop, OCCViewer_Viewer* theModel);
+ virtual ~OCCViewer_ViewFrame();
+
+ OCCViewer_ViewWindow* getView( const int ) const;
+
+ virtual OCCViewer_ViewPort3d* getViewPort() { return getView(MAIN_VIEW)->getViewPort(); }
+ OCCViewer_ViewPort3d* getViewPort(int theView);
+
+ virtual void performRestoring( const viewAspect& theAspect) { getView(MAIN_VIEW)->performRestoring(theAspect); }
+ virtual void initLayout() {}
+
+ virtual void updateEnabledDrawMode();
+ virtual void setCuttingPlane( bool on, const double x = 0 , const double y = 0 , const double z = 0,
+ const double dx = 0, const double dy = 0, const double dz = 1);
+
+ virtual void setCuttingPlane( bool on, const gp_Pln thePln );
+
+ virtual bool isCuttingPlane() { return getView(MAIN_VIEW)->isCuttingPlane(); }
+
+ virtual QString getVisualParameters();
+ virtual void setVisualParameters( const QString& parameters );
+
+ virtual void initSketchers() { getView(MAIN_VIEW)->initSketchers(); }
+ virtual OCCViewer_ViewSketcher* getSketcher( const int i) { return getView(MAIN_VIEW)->getSketcher(i); }
+ virtual void activateSketching( int i ) { getView(MAIN_VIEW)->activateSketching(i); }
+
+ virtual int interactionStyle() const { return getView(MAIN_VIEW)->interactionStyle(); }
+ virtual void setInteractionStyle( const int i );
+
+ virtual int zoomingStyle() const { return getView(MAIN_VIEW)->zoomingStyle(); }
+ virtual void setZoomingStyle( const int );
+
+ virtual void setViewManager( SUIT_ViewManager* );
+
+ virtual bool eventFilter(QObject* watched, QEvent* e) { return SUIT_ViewWindow::eventFilter(watched, e); }
+
+ virtual QColor backgroundColor() const; // obsolete
+ virtual void setBackgroundColor( const QColor& ); // obsolete
+
+ virtual Qtx::BackgroundData background() const;
+ virtual void setBackground( const Qtx::BackgroundData& );
+
+ virtual void setDropDownButtons( bool );
+
+public slots:
+ virtual void onFrontView() { getView(MAIN_VIEW)->onFrontView(); }
+ virtual void onViewFitAll();
+ virtual void onBackView() { getView(MAIN_VIEW)->onBackView(); }
+ virtual void onTopView() { getView(MAIN_VIEW)->onTopView(); }
+ virtual void onBottomView() { getView(MAIN_VIEW)->onBottomView(); }
+ virtual void onLeftView() { getView(MAIN_VIEW)->onLeftView(); }
+ virtual void onRightView() { getView(MAIN_VIEW)->onRightView(); }
+ virtual void onClockWiseView() { getView(MAIN_VIEW)->onClockWiseView(); }
+ virtual void onAntiClockWiseView() { getView(MAIN_VIEW)->onAntiClockWiseView(); }
+ virtual void onResetView() { getView(MAIN_VIEW)->onResetView(); }
+ virtual void onFitAll();
+ virtual void activateZoom() {}
+ virtual void activateWindowFit() {}
+ virtual void activateRotation() {}
+ virtual void activatePanning() {}
+ virtual void activateGlobalPanning() {}
+ virtual void onSetRotationPoint( bool on ) {}
+ virtual void onAxialScale() {}
+ virtual void onAmbientToogle() {}
+ virtual void onMemorizeView() {}
+ virtual void onRestoreView() {}
+ virtual void onSwitchInteractionStyle( bool on ) {}
+
+ virtual void activateSetRotationGravity() {}
+ virtual void activateSetRotationSelected( double theX, double theY, double theZ ) {}
+ virtual void activateStartPointSelection() {}
+ virtual void updateGravityCoords() {}
+
+ void onMaximizedView( OCCViewer_ViewWindow*, bool );
+
+ virtual void onDumpView();
+
+protected:
+ virtual QImage dumpView();
+ virtual bool dumpViewToFormat( const QImage&, const QString&, const QString& );
+
+private slots:
+ void onContextMenuRequested(QContextMenuEvent*);
+
+private:
+ void connectViewSignals(OCCViewer_ViewWindow* theView);
+
+
+ QList<OCCViewer_ViewWindow*> myViews;
+ QGridLayout* myLayout;
+
+ OCCViewer_ViewWindow* myPopupRequestedView;
+};
+
+#endif
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="fr_FR" sourcelanguage="en_US">
+<context>
+ <name>@default</name>
+ <message>
+ <source>MNU_FRONT_VIEW</source>
+ <translation>Avant</translation>
+ </message>
+ <message>
+ <source>ERROR</source>
+ <translation>Erreur</translation>
+ </message>
+ <message>
+ <source>MNU_DUMP_VIEW</source>
+ <translation>Sauvegarder la scène</translation>
+ </message>
+ <message>
+ <source>DSC_TOP_VIEW</source>
+ <translation>Vue de dessus</translation>
+ </message>
+ <message>
+ <source>MNU_PAN_VIEW</source>
+ <translation>Panoramique</translation>
+ </message>
+ <message>
+ <source>MNU_CLONE_VIEW</source>
+ <translation>Dupliquer la scène</translation>
+ </message>
+ <message>
+ <source>DSC_SHOW_TRIHEDRE</source>
+ <translation>Afficher/cacher le trièdre dans la scène</translation>
+ </message>
+ <message>
+ <source>MNU_SHOW_TRIHEDRE</source>
+ <translation>Afficher/cacher le trièdre</translation>
+ </message>
+ <message>
+ <source>MNU_TOP_VIEW</source>
+ <translation>Dessus</translation>
+ </message>
+ <message>
+ <source>DSC_GLOBALPAN_VIEW</source>
+ <translation>Sélection d'un nouveau centre de vue</translation>
+ </message>
+ <message>
+ <source>DSC_ROTATE_VIEW</source>
+ <translation>Tourner le point de vue autour du centre de la scène</translation>
+ </message>
+ <message>
+ <source>MNU_ZOOM_VIEW</source>
+ <translation>Zoom</translation>
+ </message>
+ <message>
+ <source>DSC_PAN_VIEW</source>
+ <translation>Déplacer la vue</translation>
+ </message>
+ <message>
+ <source>DSC_LEFT_VIEW</source>
+ <translation>Vue de gauche</translation>
+ </message>
+ <message>
+ <source>DSC_SHOOT_VIEW</source>
+ <translation>Memoriser l'état courant de la scène et l'ajouter dans la liste</translation>
+ </message>
+ <message>
+ <source>DSC_FITALL</source>
+ <translation>Redimentionner la scène pour montrer tous les objets</translation>
+ </message>
+ <message>
+ <source>MNU_FITALL</source>
+ <translation>Tout afficher</translation>
+ </message>
+ <message>
+ <source>MNU_ROTATE_VIEW</source>
+ <translation>Rotation</translation>
+ </message>
+ <message>
+ <source>DSC_FRONT_VIEW</source>
+ <translation>Vue de devant</translation>
+ </message>
+ <message>
+ <source>MNU_ROTATIONPOINTGRAVITY_VIEW</source>
+ <translation>Point de Rotation : le centre de gravité</translation>
+ </message>
+ <message>
+ <source>MNU_GLOBALPAN_VIEW</source>
+ <translation>Panoramique global</translation>
+ </message>
+ <message>
+ <source>INF_APP_DUMP_VIEW</source>
+ <translation>Sauvegarder la vue</translation>
+ </message>
+ <message>
+ <source>DSC_CLIPPING</source>
+ <translation>Définir le plan de coupe</translation>
+ </message>
+ <message>
+ <source>DSC_CLONE_VIEW</source>
+ <translation>Ouvrir une nouvelle fenêtre de visualisation pour la scène en cours</translation>
+ </message>
+ <message>
+ <source>INF_APP_SHOOT_VIEW</source>
+ <translation>Mémoriser la scène</translation>
+ </message>
+ <message>
+ <source>MNU_CLIPPING</source>
+ <translation>Plan de coupe</translation>
+ </message>
+ <message>
+ <source>MNU_BACK_VIEW</source>
+ <translation>Arrière</translation>
+ </message>
+ <message>
+ <source>MNU_SHOOT_VIEW</source>
+ <translation>Memoriser la vue</translation>
+ </message>
+ <message>
+ <source>DSC_CHANGINGROTATIONPOINT_VIEW</source>
+ <translation>Changer le point autour duquel la scène est tournée</translation>
+ </message>
+ <message>
+ <source>MNU_BOTTOM_VIEW</source>
+ <translation>Dessous</translation>
+ </message>
+ <message>
+ <source>MNU_RESET_VIEW</source>
+ <translation>Restaurer le point de vue</translation>
+ </message>
+ <message>
+ <source>MNU_LEFT_VIEW</source>
+ <translation>Gauche</translation>
+ </message>
+ <message>
+ <source>DSC_RIGHT_VIEW</source>
+ <translation>Vue de droite</translation>
+ </message>
+ <message>
+ <source>DSC_ANTICLOCKWISE_VIEW</source>
+ <translation>Tourner la vue à gauche</translation>
+ </message>
+ <message>
+ <source>DSC_CLOCKWISE_VIEW</source>
+ <translation>Tourner la vue à droite</translation>
+ </message>
+ <message>
+ <source>MNU_CHANGINGROTATIONPOINT_VIEW</source>
+ <translation>Changer le point de rotation</translation>
+ </message>
+ <message>
+ <source>DSC_FITRECT</source>
+ <translation>Redimensionner la scène pour ne montrer que sa partie choisie par l'encadré</translation>
+ </message>
+ <message>
+ <source>MNU_FITRECT</source>
+ <translation>Afficher la zone</translation>
+ </message>
+ <message>
+ <source>DSC_BOTTOM_VIEW</source>
+ <translation>Vue de dessous</translation>
+ </message>
+ <message>
+ <source>DSC_DUMP_VIEW</source>
+ <translation>Sauvegarder la scène en cours dans un fichier image</translation>
+ </message>
+ <message>
+ <source>DSC_ZOOM_VIEW</source>
+ <translation>Zoom la vue</translation>
+ </message>
+ <message>
+ <source>MNU_ROTATIONPOINT000_VIEW</source>
+ <translation>Point de Rotation : (0,0,0)</translation>
+ </message>
+ <message>
+ <source>MNU_ROTATIONPOINTSELECTED_VIEW</source>
+ <translation>Point de Rotation : le point choisi par l'utilisateur</translation>
+ </message>
+ <message>
+ <source>DSC_RESET_VIEW</source>
+ <translation>Restaurer le point de vue</translation>
+ </message>
+ <message>
+ <source>ERR_DOC_CANT_SAVE_FILE</source>
+ <translation>Impossible de sauvegarder le fichier</translation>
+ </message>
+ <message>
+ <source>DSC_PRESETS_VIEW</source>
+ <translation>Restaurer d'un état mémorisé de la scène courante</translation>
+ </message>
+ <message>
+ <source>MNU_PRESETS_VIEW</source>
+ <translation>Restaurer la vue</translation>
+ </message>
+ <message>
+ <source>MNU_ANTICLOCKWISE_VIEW</source>
+ <translation>Tourner à gauche</translation>
+ </message>
+ <message>
+ <source>MNU_CLOCKWISE_VIEW</source>
+ <translation>Tourner à droite</translation>
+ </message>
+ <message>
+ <source>MNU_RIGHT_VIEW</source>
+ <translation>Droit</translation>
+ </message>
+ <message>
+ <source>INF_APP_PRESETS_VIEW</source>
+ <translation>Restaurer la scène</translation>
+ </message>
+ <message>
+ <source>LBL_XYTOOLBAR_LABEL</source>
+ <translation>Opérations sur la vue XY</translation>
+ </message>
+ <message>
+ <source>LBL_XZTOOLBAR_LABEL</source>
+ <translation>Opérations sur la vue XZ</translation>
+ </message>
+ <message>
+ <source>LBL_YZTOOLBAR_LABEL</source>
+ <translation>Opérations sur la vue YZ</translation>
+ </message>
+ <message>
+ <source>LBL_3DTOOLBAR_LABEL</source>
+ <translation>Opérations sur la vue 3D</translation>
+ </message>
+ <message>
+ <source>DSC_BACK_VIEW</source>
+ <translation>Vue arrière</translation>
+ </message>
+ <message>
+ <source>DSC_SCALING</source>
+ <translation>Changer l'échelle des axes de coordonnées</translation>
+ </message>
+ <message>
+ <source>MNU_SCALING</source>
+ <translation>Changer l'échelle</translation>
+ </message>
+ <message>
+ <source>DSC_GRADUATED_AXES</source>
+ <translation>Axes gradués</translation>
+ </message>
+ <message>
+ <source>MNU_GRADUATED_AXES</source>
+ <translation>Axes gradués</translation>
+ </message>
+ <message>
+ <source>DSC_AMBIENT</source>
+ <translation>Ne montrer que la lumière d'ambiance</translation>
+ </message>
+ <message>
+ <source>MNU_AMBIENT</source>
+ <translation>Ne montrer que la lumière d'ambiance</translation>
+ </message>
+ <message>
+ <source>DSC_STYLE_SWITCH</source>
+ <translation>Changer le style d'intéraction</translation>
+ </message>
+ <message>
+ <source>MNU_STYLE_SWITCH</source>
+ <translation>Changer le style d'intéraction</translation>
+ </message>
+ <message>
+ <source>DSC_ZOOMING_STYLE_SWITCH</source>
+ <translation>Changer le style de zoom</translation>
+ </message>
+ <message>
+ <source>MNU_ZOOMING_STYLE_SWITCH</source>
+ <translation>Changer le style de zoom</translation>
+ </message>
+ <message>
+ <source>OCC_IMAGE_FILES</source>
+ <translation>Fichiers images (*.bmp *.png *.jpg *.jpeg *.eps *.ps)</translation>
+ </message>
+ <message>
+ <source>OCC_TEXTURE_FILES</source>
+ <translation>Fichiers images (*.bmp *.gif *.pix *.xwd *.rgb *.rs)</translation>
+ </message>
+ <message>
+ <source>DSC_MAXIMIZE_VIEW</source>
+ <translation>Maximiser la vue</translation>
+ </message>
+ <message>
+ <source>DSC_MINIMIZE_VIEW</source>
+ <translation>Minimiser la vue</translation>
+ </message>
+ <message>
+ <source>DSC_SYNCHRONIZE_VIEW</source>
+ <translation>Synchroniser la vue</translation>
+ </message>
+ <message>
+ <source>MNU_MAXIMIZE_VIEW</source>
+ <translation>Maximiser</translation>
+ </message>
+ <message>
+ <source>MNU_MINIMIZE_VIEW</source>
+ <translation>Minimiser</translation>
+ </message>
+ <message>
+ <source>MNU_SYNCHRONIZE_VIEW</source>
+ <translation>Synchroniser</translation>
+ </message>
+ <message>
+ <source>MNU_SYNC_NO_VIEW</source>
+ <translation>[ Pas de vue appropriée ]</translation>
+ </message>
+</context>
+<context>
+ <name>OCCViewer_CreateRestoreViewDlg</name>
+ <message>
+ <source>CAPTION</source>
+ <translation>Restaurer la vue</translation>
+ </message>
+</context>
+<context>
+ <name>OCCViewer_SetRotationPointDlg</name>
+ <message>
+ <source>LBL_X</source>
+ <translation>X:</translation>
+ </message>
+ <message>
+ <source>LBL_Y</source>
+ <translation>Y:</translation>
+ </message>
+ <message>
+ <source>LBL_Z</source>
+ <translation>Z:</translation>
+ </message>
+ <message>
+ <source>USE_BBCENTER</source>
+ <translation>Utiliser le centre de la boîte englobante</translation>
+ </message>
+ <message>
+ <source>LBL_TOORIGIN</source>
+ <translation>Définir à l'origine</translation>
+ </message>
+ <message>
+ <source>CAPTION</source>
+ <translation>Indiquer le point de rotation</translation>
+ </message>
+ <message>
+ <source>LBL_SELECTPOINT</source>
+ <translation>Choisir le point dans la vue</translation>
+ </message>
+</context>
+<context>
+ <name>OCCViewer_ViewManager</name>
+ <message>
+ <source>OCC_VIEW_TITLE</source>
+ <translation>Scène OCC :%M - visualiseur:%V</translation>
+ </message>
+</context>
+<context>
+ <name>OCCViewer_Viewer</name>
+ <message>
+ <source>MEN_DUMP_VIEW</source>
+ <translation>Sauvegarder la vue</translation>
+ </message>
+ <message>
+ <source>MEN_SHOW_TOOLBAR</source>
+ <translation>Montrer la Barre d'Outils</translation>
+ </message>
+ <message>
+ <source>MEN_CHANGE_BACKGROUND</source>
+ <translation>Changer l'arrière-plan</translation>
+ </message>
+ <message>
+ <source>MEN_CHANGE_IMAGE</source>
+ <translation>Régler/Changer l''image d'arrière-plan...</translation>
+ </message>
+ <message>
+ <source>SELECT_IMAGE</source>
+ <translation>Sélectionner l'image</translation>
+ </message>
+ <message>
+ <source>CENTERED</source>
+ <translation>en mode centré</translation>
+ </message>
+ <message>
+ <source>TILED</source>
+ <translation>en mode pavé</translation>
+ </message>
+ <message>
+ <source>STRETCHED</source>
+ <translation>en mode étiré</translation>
+ </message>
+ <message>
+ <source>GT_HORIZONTALGRADIENT</source>
+ <translation>Gradient horizontal</translation>
+ </message>
+ <message>
+ <source>GT_VERTICALGRADIENT</source>
+ <translation>Gradient vertical</translation>
+ </message>
+ <message>
+ <source>GT_FIRSTDIAGONALGRADIENT</source>
+ <translation>Gradient de la première diagonale</translation>
+ </message>
+ <message>
+ <source>GT_SECONDDIAGONALGRADIENT</source>
+ <translation>Gradient de la seconde diagonale</translation>
+ </message>
+ <message>
+ <source>GT_FIRSTCORNERGRADIENT</source>
+ <translation>Gradient du premier coin</translation>
+ </message>
+ <message>
+ <source>GT_SECONDCORNERGRADIENT</source>
+ <translation>Gradient du second coin</translation>
+ </message>
+ <message>
+ <source>GT_THIRDCORNERGRADIENT</source>
+ <translation>Gradient du troisième coin</translation>
+ </message>
+ <message>
+ <source>GT_FORTHCORNERGRADIENT</source>
+ <translation>Gradient du quatrième coin</translation>
+ </message>
+ <message>
+ <source>BG_IMAGE_FILES</source>
+ <translation>Fichiers images (*.bmp *.gif *.pix *.xwd *.rgb *.rs)</translation>
+ </message>
+</context>
+<context>
+ <name>OCCViewer_AxialScaleDlg</name>
+ <message>
+ <source>DLG_SCALING</source>
+ <translation>Changer l'échelle des axes</translation>
+ </message>
+ <message>
+ <source>LBL_X</source>
+ <translation>X:</translation>
+ </message>
+ <message>
+ <source>LBL_Y</source>
+ <translation>Y:</translation>
+ </message>
+ <message>
+ <source>LBL_Z</source>
+ <translation>Z:</translation>
+ </message>
+</context>
+</TS>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="fr_FR">
+<context>
+ <name>OB_Browser</name>
+ <message>
+ <source>MEN_EXPAND_ALL</source>
+ <translation>Tout déplier</translation>
+ </message>
+ <message>
+ <source>MEN_COLLAPSE_ALL</source>
+ <translation>Tout réduire</translation>
+ </message>
+ <message>
+ <source>MEN_FIND</source>
+ <translation>Chercher</translation>
+ </message>
+</context>
+<context>
+ <name>OB_FindDlg</name>
+ <message>
+ <source>FIND</source>
+ <translation>Chercher</translation>
+ </message>
+ <message>
+ <source>CLOSE</source>
+ <translation>Fermer</translation>
+ </message>
+ <message>
+ <source>CASE_SENSITIVE</source>
+ <translation>Sensible à la casse</translation>
+ </message>
+ <message>
+ <source>IS_REG_EXP</source>
+ <translation>Expression régulière</translation>
+ </message>
+</context>
+</TS>
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : Plot2d_Algorithm.cxx
+
+#include "Plot2d_Algorithm.h"
+
+/*!
+ Constructor
+*/
+Plot2d_Algorithm::Plot2d_Algorithm(QObject *parent) :
+ QObject(parent),
+ myDataChanged(false)
+{
+}
+
+/*!
+ Destructor
+*/
+Plot2d_Algorithm::~Plot2d_Algorithm()
+{
+}
+
+/*!
+ Sets input data values
+*/
+void Plot2d_Algorithm::setInput(AlgoPlot2dInputData theInuptData)
+{
+ clear();
+ myInuptData = theInuptData;
+ myDataChanged = true;
+}
+
+/*!
+ Gets result data values
+*/
+AlgoPlot2dOutputData Plot2d_Algorithm::getOutput()
+{
+ return myResultData;
+}
+
+/*!
+ Check the data values changed
+*/
+bool Plot2d_Algorithm::isDataChanged()
+{
+ return myDataChanged;
+}
+
+void Plot2d_Algorithm::clear() {
+ myDataChanged=false;
+ myInuptData.clear();
+ myResultData.clear();
+}
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : Plot2d_Algorithm.h
+
+#ifndef PLOT2D_ALGORITHM_H
+#define PLOT2D_ALGORITHM_H
+
+#include "Plot2d.h"
+
+#include <QPair>
+#include <QList>
+#include <QMap>
+
+class Plot2d_Object;
+
+typedef QList< QPair<double,double> > AlgoPlot2dItem;
+typedef QList<Plot2d_Object*> AlgoPlot2dInputData;
+typedef QMap<Plot2d_Object*,AlgoPlot2dItem> AlgoPlot2dOutputData;
+
+class PLOT2D_EXPORT Plot2d_Algorithm : public QObject {
+ Q_OBJECT
+public:
+ Plot2d_Algorithm(QObject *parent = 0);
+ ~Plot2d_Algorithm();
+
+ void setInput(AlgoPlot2dInputData);
+ AlgoPlot2dOutputData getOutput();
+ virtual void execute() = 0;
+ virtual void clear();
+
+ bool isDataChanged();
+
+protected:
+ AlgoPlot2dInputData myInuptData;
+ AlgoPlot2dOutputData myResultData;
+ bool myDataChanged;
+};
+
+#endif //PLOT2D_ALGORITHM_H
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : Plot2d_AnalyticalCurve.cxx
+// Author : Roman NIKOLAEV, Open CASCADE S.A.S. (roman.nikolaev@opencascade.com)
+
+#include "Plot2d_AnalyticalParser.h"
+#include "Plot2d_AnalyticalCurve.h"
+#include "Plot2d_PlotItems.h"
+#include "Plot2d_Object.h"
+
+#include <qwt_scale_div.h>
+
+
+//Init static data;
+
+int Plot2d_AnalyticalCurve::myNbCurves = 0;
+
+/*!
+ Constructor
+*/
+Plot2d_AnalyticalCurve::Plot2d_AnalyticalCurve() :
+ myAutoAssign(true),
+ myColor( 0, 0, 0 ),
+ myMarker( Plot2d::Circle ),
+ myMarkerSize( 0 ),
+ myLine( Plot2d::Solid ),
+ myLineWidth( 0 ),
+ myRangeBegin(0.0),
+ myRangeEnd(100.0),
+ myNbIntervals(100),
+ myExpression(""),
+ myAction(Plot2d_AnalyticalCurve::ActAddInView),
+ myState(Plot2d_AnalyticalCurve::StateNeedUpdate),
+ myCurve(0),
+ myActive(true),
+ myIsSelected(false)
+{
+ myName = QString("Analytical Curve %1").arg(++myNbCurves);
+}
+
+
+/*!
+ Destructor
+*/
+Plot2d_AnalyticalCurve::~Plot2d_AnalyticalCurve()
+{
+}
+
+/*!
+ Copy constructor. Makes deep copy of data
+*/
+Plot2d_AnalyticalCurve::Plot2d_AnalyticalCurve( const Plot2d_AnalyticalCurve& curve )
+{
+ myAutoAssign = curve.isAutoAssign();
+ myColor = curve.getColor();
+ myMarker = curve.getMarker();
+ myMarkerSize = curve.getMarkerSize();
+ myLine = curve.getLine();
+ myLineWidth = curve.getLineWidth();
+ myRangeBegin = curve.getRangeBegin();
+ myRangeEnd = curve.getRangeEnd();
+ myNbIntervals= curve.getNbIntervals();
+ myPoints = curve.myPoints;
+ myAction = curve.getAction();
+ myName = curve.getName();
+ myExpression = curve.getExpression();
+ myState = curve.state();
+ myCurve = curve.myCurve;
+ myActive = curve.isActive();
+}
+
+/*!
+ operator=. Makes deep copy of data
+*/
+Plot2d_AnalyticalCurve& Plot2d_AnalyticalCurve::operator=( const Plot2d_AnalyticalCurve& curve )
+{
+ myAutoAssign = curve.isAutoAssign();
+ myColor = curve.getColor();
+ myMarker = curve.getMarker();
+ myMarkerSize = curve.getMarkerSize();
+ myLine = curve.getLine();
+ myLineWidth = curve.getLineWidth();
+ myRangeBegin = curve.getRangeBegin();
+ myRangeEnd = curve.getRangeEnd();
+ myNbIntervals= curve.getNbIntervals();
+ myPoints = curve.myPoints;
+ myAction = curve.getAction();
+ myName = curve.getName();
+ myExpression = curve.getExpression();
+ myState = curve.state();
+ myCurve = curve.myCurve;
+ myActive = curve.isActive();
+ return *this;
+}
+
+/*!
+ Create plot object for the curve
+*/
+QwtPlotItem* Plot2d_AnalyticalCurve::plotItem()
+{
+ if(!myCurve) {
+ myCurve = new Plot2d_QwtPlotCurve(QString(""));
+ updatePlotItem();
+ }
+ return myCurve;
+}
+
+/*!
+ Auto fill parameters of object by plot view
+*/
+void Plot2d_AnalyticalCurve::autoFill( const QwtPlot* thePlot )
+{
+ QwtSymbol::Style typeMarker;
+ QColor color;
+ Qt::PenStyle typeLine;
+ Plot2d::getNextMarker( QwtPlotItem::Rtti_PlotCurve, thePlot, typeMarker, color, typeLine );
+
+ setColor( color );
+ setLine( Plot2d::qwt2plotLine( typeLine ));
+ setLineWidth(1);
+ setMarker( Plot2d::qwt2plotMarker( typeMarker ) );
+}
+
+/*!
+ Updates curve fields
+*/
+void Plot2d_AnalyticalCurve::updatePlotItem()
+{
+ if ( !myCurve )
+ return;
+
+ Plot2d_QwtPlotCurve* aCurve = dynamic_cast<Plot2d_QwtPlotCurve*>(myCurve);
+
+ if(!aCurve)
+ return;
+
+ Qt::PenStyle ps = Plot2d::plot2qwtLine( getLine() );
+ QwtSymbol::Style ms = Plot2d::plot2qwtMarker( getMarker() );
+
+ QColor aColor = isSelected() ? Plot2d_Object::selectionColor() : getColor();
+ int lineW = getLineWidth();
+ if ( isSelected() ) lineW += (lineW == 0 ? 3 : 2);
+
+ int markerS = isSelected() ? getMarkerSize() + 2 : getMarkerSize();
+
+ aCurve->setSelected(isSelected());
+
+ aCurve->setPen( QPen(aColor , lineW, ps ) );
+ aCurve->setSymbol( QwtSymbol( ms, QBrush( aColor ),
+ QPen( aColor ),
+ QSize( markerS , markerS ) ) );
+
+ aCurve->setLegendPen(QPen(getColor(), getLineWidth(), ps ));
+ aCurve->setLegendSymbol( QwtSymbol( ms, QBrush( getColor() ),
+ QPen( getColor() ),
+ QSize( getMarkerSize() , getMarkerSize() )));
+
+ double *x, *y;
+ long nb = getData( &x, &y );
+ aCurve->setData( x, y, nb );
+ aCurve->setTitle(getName());
+}
+
+
+/*!
+ Calculate the curve points.
+*/
+void Plot2d_AnalyticalCurve::calculate() {
+ if( state() == Plot2d_AnalyticalCurve::StateOk )
+ return;
+
+ if(myRangeBegin > myRangeEnd)
+ return;
+
+ Plot2d_AnalyticalParser* parser = Plot2d_AnalyticalParser::parser();
+ double* x = 0;
+ double* y = 0;
+ int nb = parser->calculate(getExpression(), getRangeBegin(), getRangeEnd(),
+ getNbIntervals(),&x,&y);
+ if( nb > 0 ) {
+ myPoints.clear();
+ for( int i = 0; i < nb; i++ ) {
+ Plot2d_Point pnt(x[i], y[i]);
+ myPoints.append(pnt);
+ }
+ delete x;
+ delete y;
+ myState = Plot2d_AnalyticalCurve::StateOk;
+ setAction(Plot2d_AnalyticalCurve::ActUpdateInView);
+ }
+}
+/*!
+ Checks that this curve can be computed for the input QwtPlot
+*/
+bool Plot2d_AnalyticalCurve::checkCurve( const QwtPlot* thePlot) {
+ if( !myExpression.isEmpty() && thePlot ) {
+ const QwtScaleDiv* div = thePlot->axisScaleDiv(QwtPlot::xBottom);
+ setRangeBegin(div->lowerBound());
+ setRangeEnd(div->upperBound());
+ calculate();
+ }
+ return myState == Plot2d_AnalyticalCurve::StateOk;
+}
+
+
+/*!
+ Gets object's data
+*/
+long Plot2d_AnalyticalCurve::getData( double** theX, double** theY ) const
+{
+ int aNPoints = myPoints.size();
+ *theX = new double[aNPoints];
+ *theY = new double[aNPoints];
+ for (int i = 0; i < aNPoints; i++) {
+ (*theX)[i] = myPoints[i].x;
+ (*theY)[i] = myPoints[i].y;
+ }
+ return aNPoints;
+}
+
+/*!
+ Sets curves's AutoAssign flag - in this case attributes will be set automatically
+*/
+void Plot2d_AnalyticalCurve::setAutoAssign( bool on )
+{
+ if( myAutoAssign != on ) {
+ myAutoAssign = on;
+ setAction(Plot2d_AnalyticalCurve::ActUpdateInView);
+ }
+}
+
+/*!
+ Gets curve's AutoAssign flag state
+*/
+bool Plot2d_AnalyticalCurve::isAutoAssign() const
+{
+ return myAutoAssign;
+}
+
+/*!
+ Sets curve's color.
+*/
+void Plot2d_AnalyticalCurve::setColor( const QColor& color )
+{
+ if(myColor != color) {
+ myColor = color;
+ setAction(Plot2d_AnalyticalCurve::ActUpdateInView);
+ }
+}
+
+/*!
+ Gets curve's color
+*/
+QColor Plot2d_AnalyticalCurve::getColor() const
+{
+ return myColor;
+}
+
+
+/*!
+ Sets marker type ( and resets AutoAssign flag )
+*/
+void Plot2d_AnalyticalCurve::setMarker( Plot2d::MarkerType marker )
+{
+ if(myMarker != marker) {
+ myMarker = marker;
+ setAction(Plot2d_AnalyticalCurve::ActUpdateInView);
+ }
+}
+
+/*!
+ Gets marker type
+*/
+Plot2d::MarkerType Plot2d_AnalyticalCurve::getMarker() const
+{
+ return myMarker;
+}
+
+/*!
+ Sets new marker size
+*/
+void Plot2d_AnalyticalCurve::setMarkerSize( const int theSize )
+{
+ if( myMarkerSize != theSize ) {
+ myMarkerSize = theSize < 0 ? 0 : theSize;
+ setAction(Plot2d_AnalyticalCurve::ActUpdateInView);
+ }
+}
+
+/*!
+ Gets marker size
+*/
+int Plot2d_AnalyticalCurve::getMarkerSize() const
+{
+ return myMarkerSize;
+}
+
+/*!
+ Sets line type
+*/
+void Plot2d_AnalyticalCurve::setLine( Plot2d::LineType line )
+{
+ if(myLine != line) {
+ myLine = line;
+ setAction(Plot2d_AnalyticalCurve::ActUpdateInView);
+ }
+}
+
+/*!
+ Gets line type
+*/
+Plot2d::LineType Plot2d_AnalyticalCurve::getLine() const
+{
+ return myLine;
+}
+
+
+/*!
+ Sets line width
+*/
+void Plot2d_AnalyticalCurve::setLineWidth( const int lineWidth )
+{
+ if( myLineWidth != lineWidth ) {
+ myLineWidth = lineWidth < 0 ? 0 : lineWidth;
+ setAction(Plot2d_AnalyticalCurve::ActUpdateInView);
+ }
+}
+
+/*!
+ Gets line width
+*/
+int Plot2d_AnalyticalCurve::getLineWidth() const
+{
+ return myLineWidth;
+}
+
+/*!
+ Sets number of points
+*/
+void Plot2d_AnalyticalCurve::setNbIntervals( const long nb )
+{
+ if( myNbIntervals != nb ) {
+ myNbIntervals = nb < 1 ? 1 : nb;
+ myState = Plot2d_AnalyticalCurve::StateNeedUpdate;
+ }
+}
+
+/*!
+ Gets number of points
+*/
+long Plot2d_AnalyticalCurve::getNbIntervals() const
+{
+ return myNbIntervals;
+}
+
+/*!
+ Sets X coordinate of the first curve points
+*/
+void Plot2d_AnalyticalCurve::setRangeBegin( const double coord) {
+ if( myRangeBegin != coord ) {
+ myRangeBegin = coord;
+ myState = Plot2d_AnalyticalCurve::StateNeedUpdate;
+ }
+}
+
+/*!
+ Gets X coordinate of the first curve points
+*/
+double Plot2d_AnalyticalCurve::getRangeBegin() const {
+ return myRangeBegin;
+}
+
+/*!
+ Sets X coordinate of the last curve points
+*/
+void Plot2d_AnalyticalCurve::setRangeEnd( const double coord) {
+ if( myRangeEnd != coord ) {
+ myRangeEnd = coord;
+ myState = Plot2d_AnalyticalCurve::StateNeedUpdate;
+ }
+}
+
+/*!
+ Gets X coordinate of the last curve points
+*/
+double Plot2d_AnalyticalCurve::getRangeEnd() const {
+ return myRangeEnd;
+}
+
+/*!
+ Sets the curve expression.
+*/
+void Plot2d_AnalyticalCurve::setExpression( const QString& expr ) {
+ if( myExpression != expr ) {
+ myExpression = expr;
+ myState = Plot2d_AnalyticalCurve::StateNeedUpdate;
+ }
+}
+
+/*!
+ Gets the curve expression.
+*/
+QString Plot2d_AnalyticalCurve::getExpression() const {
+ return myExpression;
+}
+
+/*!
+ Sets the curve name.
+*/
+void Plot2d_AnalyticalCurve::setName( const QString& name ) {
+ if( myName != name ) {
+ myName = name;
+ setAction(Plot2d_AnalyticalCurve::ActUpdateInView);
+ }
+}
+
+/*!
+ Gets the curve name.
+*/
+QString Plot2d_AnalyticalCurve::getName() const {
+ return myName;
+}
+
+
+/*!
+ Sets the curve action.
+*/
+void Plot2d_AnalyticalCurve::setAction(const int act) {
+ if( act == Plot2d_AnalyticalCurve::ActNothing ) {
+ myAction = act;
+ return;
+ }
+
+ if(myAction != Plot2d_AnalyticalCurve::ActAddInView &&
+ myAction != Plot2d_AnalyticalCurve::ActRemoveFromView) {
+ myAction = act;
+ }
+}
+
+/*!
+ Gets the curve action.
+*/
+int Plot2d_AnalyticalCurve::getAction() const {
+ return myAction;
+}
+
+/*!
+ Gets the curve state.
+*/
+int Plot2d_AnalyticalCurve::state() const {
+ return myState;
+}
+
+/*!
+ Sets the curve active status.
+*/
+void Plot2d_AnalyticalCurve::setActive(const bool on) {
+ if( myActive != on ) {
+ if(myActive && !on)
+ setAction(Plot2d_AnalyticalCurve::ActUpdateInView);
+ else if(!myActive && on) {
+ setAction(Plot2d_AnalyticalCurve::ActAddInView);
+ myState = Plot2d_AnalyticalCurve::StateNeedUpdate;
+ }
+ myActive = on;
+ }
+}
+
+/*!
+ Gets the curve active status.
+*/
+bool Plot2d_AnalyticalCurve::isActive() const {
+ return myActive;
+}
+
+
+/*!
+ Sets curve's selected property.
+*/
+void Plot2d_AnalyticalCurve::setSelected(const bool on) {
+ if(myIsSelected != on) {
+ myIsSelected = on;
+ setAction(Plot2d_AnalyticalCurve::ActUpdateInView);
+ }
+
+}
+
+/*!
+ Gets curve's selected property.
+*/
+bool Plot2d_AnalyticalCurve::isSelected() const {
+ return myIsSelected;
+}
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : Plot2d_AnalyticalCurve.h
+// Author : Roman NIKOLAEV, Open CASCADE S.A.S. (roman.nikolaev@opencascade.com)
+
+#ifndef PLOT2D_ANALYTICAL_CURVE_H
+#define PLOT2D_ANALYTICAL_CURVE_H
+
+#include "Plot2d.h"
+
+
+class QwtPlot;
+class QwtPlotItem;
+
+
+class PLOT2D_EXPORT Plot2d_AnalyticalCurve
+{
+public:
+
+ /*
+ Action enumeration.
+ */
+ enum {
+ ActAddInView = 0, //! Add curve in view
+ ActRemoveFromView, //! Remove curve from view
+ ActUpdateInView, //! Update curve in view
+ ActNothing //! Do nothing
+ };
+
+ /*
+ State enumeration.
+ */
+ enum {
+ StateOk = 0,
+ StateNeedUpdate
+ };
+
+ Plot2d_AnalyticalCurve();
+ Plot2d_AnalyticalCurve( const Plot2d_AnalyticalCurve& );
+ Plot2d_AnalyticalCurve& operator= ( const Plot2d_AnalyticalCurve& );
+
+ virtual ~Plot2d_AnalyticalCurve();
+
+ virtual QwtPlotItem* plotItem();
+ virtual void autoFill( const QwtPlot* );
+ virtual void updatePlotItem();
+ virtual bool checkCurve( const QwtPlot* );
+
+ virtual void calculate();
+
+ long getData( double** , double** ) const;
+
+ void setSelected(const bool);
+ bool isSelected() const;
+
+
+
+ void setAutoAssign( bool );
+ bool isAutoAssign( ) const;
+
+ void setColor( const QColor& );
+ QColor getColor() const;
+
+ void setMarker( Plot2d::MarkerType );
+ Plot2d::MarkerType getMarker() const;
+
+ void setMarkerSize( const int );
+ int getMarkerSize() const;
+
+ void setLine( Plot2d::LineType );
+ Plot2d::LineType getLine() const;
+
+ void setLineWidth( const int );
+ int getLineWidth() const;
+
+ void setNbIntervals( const long );
+ long getNbIntervals() const;
+
+ void setRangeBegin( const double );
+ double getRangeBegin() const;
+
+ void setRangeEnd( const double );
+ double getRangeEnd() const;
+
+ void setExpression( const QString& );
+ QString getExpression() const;
+
+ void setName( const QString& );
+ QString getName() const;
+
+ void setActive(const bool);
+ bool isActive() const;
+
+ void setAction(const int);
+ int getAction() const;
+ int state() const;
+
+
+protected:
+
+ bool myAutoAssign;
+ QColor myColor;
+ Plot2d::MarkerType myMarker;
+ int myMarkerSize;
+ Plot2d::LineType myLine;
+ int myLineWidth;
+ long myNbIntervals;
+ pointList myPoints;
+ double myRangeBegin;
+ double myRangeEnd;
+ QString myExpression;
+ QString myName;
+ int myAction;
+ int myState;
+ QwtPlotItem* myCurve;
+ bool myActive;
+ bool myIsSelected;
+
+private:
+ static int myNbCurves;
+
+};
+
+typedef QList<Plot2d_AnalyticalCurve*> AnalyticalCurveList;
+
+class PLOT2D_EXPORT Plot2d_CurveContainer
+{
+public:
+ virtual void addAnalyticalCurve( Plot2d_AnalyticalCurve* ) = 0;
+ virtual void removeAnalyticalCurve( Plot2d_AnalyticalCurve* ) = 0;
+ virtual void updateAnalyticalCurve( Plot2d_AnalyticalCurve*, bool = false ) = 0;
+ virtual void updateAnalyticalCurves() = 0;
+ virtual AnalyticalCurveList getAnalyticalCurves() const = 0;
+};
+
+#endif //PLOT2D_ANALYTICAL_CURVE_H
+
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// File : Plot2d_AnalyticalCurveDlg.cxx
+// Author : Roman NIKOLAEV, Open CASCADE S.A.S. (roman.nikolaev@opencascade.com)
+
+
+
+// TODO : check what happens if invalid formula is given, e.g. x/0
+// TODO : check what happens if curve formala is valid in general but some there are some problems with calculating (e.g. logarithmic formulas and negative x)
+
+//Local includes
+#include "Plot2d_AnalyticalCurveDlg.h"
+#include "Plot2d_AnalyticalCurve.h"
+#include "Plot2d_ViewFrame.h"
+
+//Qtx includes
+#include <QtxIntSpinBox.h>
+#include <QtxColorButton.h>
+
+//SUIT includes
+#include <SUIT_MessageBox.h>
+#include <SUIT_Session.h>
+#include <SUIT_Application.h>
+
+//Qt includes
+#include <QListWidget>
+#include <QGroupBox>
+#include <QFrame>
+#include <QHBoxLayout>
+#include <QLabel>
+#include <QLineEdit>
+#include <QCheckBox>
+#include <QComboBox>
+#include <QPushButton>
+
+//qwt includes
+#include <qwt_plot.h>
+
+// Controls
+const int MIN_NB_INTERVALS = 1;
+const int MAX_NB_INTERVALS = 10000;
+const int STEP = 1;
+const int MIN_LINE_WIDTH = 0;
+const int MAX_LINE_WIDTH = 10;
+
+const char* PROP_TITLE = "title";
+const char* PROP_VISIBLE = "visible";
+const char* PROP_STATUS = "status";
+const char* PROP_FORMULA = "formula";
+const char* PROP_NBINTERVALS = "nb_intervals";
+const char* PROP_AUTOASSIGN = "auto_assign";
+const char* PROP_MARKERTYPE = "marker_type";
+const char* PROP_LINETYPE = "line_type";
+const char* PROP_LINEWIDTH = "line_width";
+const char* PROP_COLOR = "color";
+
+/*
+ \class Plot2d_AnalyticalCurveDlg::UpdateLocker
+ \brief Update locker class
+ \internal
+*/
+class Plot2d_AnalyticalCurveDlg::UpdateLocker
+{
+public:
+ UpdateLocker( QObject* );
+ ~UpdateLocker();
+private:
+ QObject* myObject;
+ bool myLocked;
+};
+
+Plot2d_AnalyticalCurveDlg::UpdateLocker::UpdateLocker( QObject* object ) : myObject( object )
+{
+ myLocked = myObject->blockSignals( true );
+}
+
+Plot2d_AnalyticalCurveDlg::UpdateLocker::~UpdateLocker()
+{
+ myObject->blockSignals( myLocked );
+}
+
+/*
+ \class Plot2d_AnalyticalCurveDlg::Updater
+ \brief Auxiliary class used for handle update requests from sub-widgets
+ \internal
+*/
+
+Plot2d_AnalyticalCurveDlg::Updater::Updater( QWidget* parent ) : QObject( parent )
+{/*nothing to do*/}
+
+Plot2d_AnalyticalCurveDlg::Updater::~Updater()
+{/*nothing to do*/}
+
+/*!
+ Constructor
+*/
+Plot2d_AnalyticalCurveDlg::Plot2d_AnalyticalCurveDlg( Plot2d_CurveContainer* container, QWidget* parent )
+ : QDialog( parent ), myContainer( container )
+{
+ setModal( true );
+ setWindowTitle( tr( "ANALYTICAL_CURVE_TLT" ) );
+ setSizeGripEnabled( true );
+
+ // Curves list widget
+ myCurvesList = new QListWidget( this );
+ myCurvesList->setSelectionMode( QAbstractItemView::SingleSelection );
+
+ // Curve parameters group box
+ myCurveParams = new QGroupBox( tr( "AC_CURVE_PARAMS" ), this );
+
+ QLabel* formulaLabel = new QLabel( tr( "AC_FORMULA" ), myCurveParams );
+ myFormula = new QLineEdit( myCurveParams );
+ QLabel* nbIntervalsLabel = new QLabel( tr( "AC_NB_INTERVALS" ), myCurveParams );
+ myNbIntervals = new QtxIntSpinBox( MIN_NB_INTERVALS, MAX_NB_INTERVALS, STEP, myCurveParams );
+
+ QGridLayout* paramsLayout = new QGridLayout( myCurveParams );
+ paramsLayout->addWidget( formulaLabel, 0, 0 );
+ paramsLayout->addWidget( myFormula, 0, 1 );
+ paramsLayout->addWidget( nbIntervalsLabel, 1, 0 );
+ paramsLayout->addWidget( myNbIntervals, 1, 1 );
+
+ // Curve properties group box
+ myCurveProps = new QGroupBox( tr( "AC_CURVE_PROPS" ), this );
+
+ myAutoAssign = new QCheckBox( tr( "AC_AUTO_ASSIGN" ), myCurveProps );
+ myPropsGrp = new QWidget( myCurveProps );
+ QLabel* markerLabel = new QLabel( tr( "AC_MARKER_TYPE" ), myPropsGrp );
+ myMarkerType = new QComboBox( myPropsGrp );
+ QLabel* lineTypeLabel = new QLabel( tr( "AC_LINE_TYPE" ), myPropsGrp );
+ myLineType = new QComboBox( myPropsGrp );
+ QLabel* lineWidthLabel = new QLabel( tr( "AC_LINE_WIDTH" ), myPropsGrp );
+ myLineWidth = new QtxIntSpinBox( MIN_LINE_WIDTH, MAX_LINE_WIDTH, STEP, myPropsGrp );
+ QLabel* colorLabel = new QLabel( tr("AC_CURVE_COLOR"), myPropsGrp );
+ myColor = new QtxColorButton( myPropsGrp );
+
+ QGridLayout* propsGrpLayout = new QGridLayout( myPropsGrp );
+ propsGrpLayout->addWidget( markerLabel, 0, 0 );
+ propsGrpLayout->addWidget( myMarkerType, 0, 1 );
+ propsGrpLayout->addWidget( lineTypeLabel, 1, 0 );
+ propsGrpLayout->addWidget( myLineType, 1, 1 );
+ propsGrpLayout->addWidget( lineWidthLabel, 2, 0 );
+ propsGrpLayout->addWidget( myLineWidth, 2, 1 );
+ propsGrpLayout->addWidget( colorLabel, 3, 0 );
+ propsGrpLayout->addWidget( myColor, 3, 1 );
+
+ QVBoxLayout* propsLayout = new QVBoxLayout( myCurveProps );
+ propsLayout->addWidget( myAutoAssign );
+ propsLayout->addWidget( myPropsGrp );
+
+ // Add && Remove buttons
+ myAddButton = new QPushButton( tr("AC_ADD_BTN"), this );
+ myAddButton->setAutoDefault( true );
+ myRemoveButton = new QPushButton( tr("AC_REM_BTN"), this );
+ myRemoveButton->setAutoDefault( true );
+
+ // OK, Apply, Close, Help buttons
+ QPushButton* okButton = new QPushButton( tr( "AC_OK_BTN" ), this );
+ okButton->setDefault( true );
+ okButton->setAutoDefault( true );
+
+ QPushButton* applyButton = new QPushButton( tr( "AC_APPLY_BTN" ), this );
+ applyButton->setAutoDefault( true );
+
+ QPushButton* cancelButton = new QPushButton( tr( "AC_CLOSE_BTN" ), this );
+ cancelButton->setAutoDefault( true );
+ QPushButton* helpButton = new QPushButton( tr( "AC_HELP_BTN" ), this );
+ helpButton->setAutoDefault( true );
+ QHBoxLayout* btnLayout = new QHBoxLayout;
+ btnLayout->addWidget( okButton );
+ btnLayout->addWidget( applyButton );
+ btnLayout->addStretch();
+ btnLayout->addWidget( cancelButton );
+ btnLayout->addWidget( helpButton );
+
+ QGridLayout* mainLayout = new QGridLayout( this );
+ mainLayout->addWidget( myCurvesList, 0, 0, 3, 1 );
+ mainLayout->addWidget( myCurveParams, 0, 1, 1, 2 );
+ mainLayout->addWidget( myCurveProps, 1, 1, 1, 2 );
+ mainLayout->addWidget( myAddButton, 2, 1 );
+ mainLayout->addWidget( myRemoveButton, 2, 2 );
+ mainLayout->addLayout( btnLayout, 3, 0, 1, 3 );
+
+ // Fill combo boxes
+ QColor cl = myMarkerType->palette().color( QPalette::Text ); // color to draw markers
+ QSize sz = QSize( 16, 16 ); // size of the icons for markers
+ myMarkerType->setIconSize( sz );
+
+ myMarkerType->addItem( Plot2d::markerIcon( sz, cl, Plot2d::None ), tr( "NONE_MARKER_LBL" ) );
+ myMarkerType->addItem( Plot2d::markerIcon( sz, cl, Plot2d::Circle ), tr( "CIRCLE_MARKER_LBL" ) );
+ myMarkerType->addItem( Plot2d::markerIcon( sz, cl, Plot2d::Rectangle ), tr( "RECTANGLE_MARKER_LBL" ) );
+ myMarkerType->addItem( Plot2d::markerIcon( sz, cl, Plot2d::Diamond ), tr( "DIAMOND_MARKER_LBL" ) );
+ myMarkerType->addItem( Plot2d::markerIcon( sz, cl, Plot2d::DTriangle ), tr( "DTRIANGLE_MARKER_LBL" ) );
+ myMarkerType->addItem( Plot2d::markerIcon( sz, cl, Plot2d::UTriangle ), tr( "UTRIANGLE_MARKER_LBL" ) );
+ myMarkerType->addItem( Plot2d::markerIcon( sz, cl, Plot2d::LTriangle ), tr( "LTRIANGLE_MARKER_LBL" ) );
+ myMarkerType->addItem( Plot2d::markerIcon( sz, cl, Plot2d::RTriangle ), tr( "RTRIANGLE_MARKER_LBL" ) );
+ myMarkerType->addItem( Plot2d::markerIcon( sz, cl, Plot2d::Cross ), tr( "CROSS_MARKER_LBL" ) );
+ myMarkerType->addItem( Plot2d::markerIcon( sz, cl, Plot2d::XCross ), tr( "XCROSS_MARKER_LBL" ) );
+
+ cl = myLineType->palette().color( QPalette::Text ); // color to draw line types
+ sz = QSize( 40, 16 ); // size of the icons for line types
+ myLineType->setIconSize( sz );
+
+ myLineType->addItem( Plot2d::lineIcon( sz, cl, Plot2d::NoPen ), tr( "NONE_LINE_LBL" ) );
+ myLineType->addItem( Plot2d::lineIcon( sz, cl, Plot2d::Solid ), tr( "SOLID_LINE_LBL" ) );
+ myLineType->addItem( Plot2d::lineIcon( sz, cl, Plot2d::Dash ), tr( "DASH_LINE_LBL" ) );
+ myLineType->addItem( Plot2d::lineIcon( sz, cl, Plot2d::Dot ), tr( "DOT_LINE_LBL" ) );
+ myLineType->addItem( Plot2d::lineIcon( sz, cl, Plot2d::DashDot ), tr( "DASHDOT_LINE_LBL" ) );
+ myLineType->addItem( Plot2d::lineIcon( sz, cl, Plot2d::DashDotDot ), tr( "DAHSDOTDOT_LINE_LBL" ) );
+
+ // Connections
+ myUpdater = new Updater( this );
+ connect( myUpdater, SIGNAL( update() ), this, SLOT( updateCurve() ) );
+ connect( myFormula, SIGNAL( textChanged( QString ) ), myUpdater, SIGNAL( update() ) );
+ connect( myNbIntervals, SIGNAL( valueChanged( int ) ), myUpdater, SIGNAL( update() ) );
+ connect( myAutoAssign, SIGNAL( stateChanged( int ) ), myUpdater, SIGNAL( update() ) );
+ connect( myMarkerType, SIGNAL( activated( int ) ), myUpdater, SIGNAL( update() ) );
+ connect( myLineType, SIGNAL( activated( int ) ), myUpdater, SIGNAL( update() ) );
+ connect( myLineWidth, SIGNAL( valueChanged( int ) ), myUpdater, SIGNAL( update() ) );
+ connect( myColor, SIGNAL( changed( QColor ) ), myUpdater, SIGNAL( update() ) );
+ connect( myCurvesList, SIGNAL( itemChanged( QListWidgetItem* ) ), myUpdater, SIGNAL( update() ) );
+ connect( myCurvesList, SIGNAL( itemSelectionChanged() ), this, SLOT( selectionChanged() ) );
+ connect( myAddButton, SIGNAL( clicked() ), this, SLOT( addCurve() ) );
+ connect( myRemoveButton, SIGNAL( clicked()), this, SLOT( removeCurve() ) );
+ connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) );
+ connect( applyButton, SIGNAL( clicked() ), this, SLOT( apply() ) );
+ connect( cancelButton, SIGNAL( clicked() ), this, SLOT( reject() ) );
+ connect( helpButton, SIGNAL( clicked() ), this, SLOT( help() ) );
+
+ // Initialize dialog box
+ init();
+}
+
+/*!
+ Destructor
+*/
+Plot2d_AnalyticalCurveDlg::~Plot2d_AnalyticalCurveDlg()
+{
+}
+
+void Plot2d_AnalyticalCurveDlg::init()
+{
+ AnalyticalCurveList curves = myContainer->getAnalyticalCurves();
+ foreach ( Plot2d_AnalyticalCurve* curve, curves ) {
+ QListWidgetItem* item = new QListWidgetItem( curve->getName() );
+ item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled );
+ item->setCheckState( curve->isActive() ? Qt::Checked : Qt::Unchecked );
+ initPropsFromCurve(curve);
+ QVariant var;
+ var.setValue( (void*)curve );
+ item->setData( Qt::UserRole, var );
+ myCurvesList->addItem( item );
+
+ if ( !myCurvesList->currentItem() )
+ myCurvesList->setCurrentItem( item );
+ }
+
+ selectionChanged();
+}
+
+/*!
+ /brief Store curve properties in the local map.
+*/
+void Plot2d_AnalyticalCurveDlg::initPropsFromCurve(Plot2d_AnalyticalCurve* curve) {
+ myProperties[ curve ][ PROP_TITLE ] = curve->getName();
+ myProperties[ curve ][ PROP_VISIBLE ] = curve->isActive();
+ myProperties[ curve ][ PROP_FORMULA ] = curve->getExpression();
+ myProperties[ curve ][ PROP_NBINTERVALS ] = (int)curve->getNbIntervals();
+ myProperties[ curve ][ PROP_AUTOASSIGN ] = curve->isAutoAssign();
+ myProperties[ curve ][ PROP_MARKERTYPE ] = curve->getMarker();
+ myProperties[ curve ][ PROP_LINETYPE ] = curve->getLine();
+ myProperties[ curve ][ PROP_LINEWIDTH ] = curve->getLineWidth();
+ myProperties[ curve ][ PROP_COLOR ] = curve->getColor();
+ myProperties[ curve ][ PROP_STATUS ] = ItemExisting;
+}
+
+QwtPlot* Plot2d_AnalyticalCurveDlg::getPlot() {
+ Plot2d_ViewFrame* frame = dynamic_cast<Plot2d_ViewFrame*>(myContainer);
+ if( frame )
+ return frame->getPlot();
+ return 0;
+}
+
+/*!
+ /brief Store local copy on the curves properties into curves.
+*/
+bool Plot2d_AnalyticalCurveDlg::processCurves() {
+ // update curves
+
+ QwtPlot* plot = getPlot();
+ if(!plot)
+ return false;
+
+ PropMap::Iterator it;
+ for ( it = myProperties.begin(); it != myProperties.end(); ++it ) {
+ Plot2d_AnalyticalCurve* curve = it.key();
+ if ( propStatus( curve ) == ItemRemoved ) {
+ myContainer->removeAnalyticalCurve( curve );
+ continue;
+ }
+ curve->setName( propTitle( curve ) );
+ curve->setActive( propVisible( curve ) );
+ curve->setExpression( propFormula( curve ) );
+ curve->setNbIntervals( propIntervals(curve) );
+ bool prevValue = curve->isAutoAssign();
+ curve->setAutoAssign( propAutoAssign( curve ) );
+ if ( !curve->isAutoAssign() ) {
+ curve->setMarker( propMarkerType( curve ) );
+ curve->setLine( propLineType( curve ) );
+ curve->setLineWidth( propLineWidth( curve ) );
+ curve->setColor( propColor( curve ) );
+ } else {
+ if(!prevValue){
+ curve->autoFill(plot);
+ }
+ }
+
+ if (! curve->checkCurve(plot) ) {
+ QListWidgetItem* item = getItem(curve);
+ if(item) {
+ myCurvesList->setCurrentItem( item );
+ SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "AC_CANT_CALCULATE" ) );
+ }
+ return false;
+ }
+
+ if ( propStatus( curve ) == ItemAdded ) {
+ myContainer->addAnalyticalCurve( curve );
+ myProperties[ curve ][ PROP_STATUS ] = ItemExisting;
+ }
+ }
+ return true;
+}
+
+/*!
+ \brief Private slot. Called when "Apply" button is clicked
+*/
+void Plot2d_AnalyticalCurveDlg::apply() {
+ if(processCurves()) {
+ Plot2d_ViewFrame* f = dynamic_cast<Plot2d_ViewFrame*>(myContainer);
+ if(f)
+ f->updateAnalyticalCurves();
+
+ AnalyticalCurveList curves = myContainer->getAnalyticalCurves();
+ foreach ( Plot2d_AnalyticalCurve* curve, curves ) {
+ initPropsFromCurve(curve);
+ }
+ selectionChanged();
+ }
+}
+
+/*!
+ \brief Private slot. Called when "Ok" button is clicked
+*/
+void Plot2d_AnalyticalCurveDlg::accept()
+{
+ if(processCurves())
+ QDialog::accept();
+}
+
+/*!
+ \brief Private slot. Called when "Close" button is clicked
+*/
+void Plot2d_AnalyticalCurveDlg::reject()
+{
+ // clean-up curves just created
+ PropMap::Iterator it;
+ for ( it = myProperties.begin(); it != myProperties.end(); ++it ) {
+ Plot2d_AnalyticalCurve* curve = it.key();
+ if ( propStatus( curve ) == ItemAdded )
+ delete curve;
+ }
+ QDialog::reject();
+}
+
+/*!
+ \brief Private slot. Called when "Add curve" button is clicked
+*/
+void Plot2d_AnalyticalCurveDlg::addCurve()
+{
+ Plot2d_AnalyticalCurve* curve = new Plot2d_AnalyticalCurve();
+
+ if(curve->isAutoAssign()) {
+ QwtPlot* plot = getPlot();
+ if(plot)
+ curve->autoFill(plot);
+ }
+
+ QListWidgetItem* item = new QListWidgetItem(curve->getName());
+ item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled );
+ item->setCheckState( Qt::Checked );
+ QVariant var;
+ var.setValue( (void*)curve );
+ item->setData( Qt::UserRole, var );
+ myCurvesList->addItem( item );
+
+ myProperties[ curve ][ PROP_STATUS ] = ItemAdded;
+
+ myCurvesList->setCurrentItem( item );
+}
+
+/*!
+ \brief Private slot. Called when "Remove curve" button is clicked
+*/
+void Plot2d_AnalyticalCurveDlg::removeCurve()
+{
+ QList<QListWidgetItem*> items = myCurvesList->selectedItems();
+ foreach( QListWidgetItem* item, items ) {
+ Plot2d_AnalyticalCurve* curve = (Plot2d_AnalyticalCurve*)( item->data( Qt::UserRole ).value<void*>() );
+ delete item;
+ if ( propStatus( curve ) == ItemAdded ) {
+ myProperties.remove( curve );
+ delete curve;
+ }
+ else {
+ myProperties[ curve ][ PROP_STATUS ] = ItemRemoved;
+ }
+ }
+}
+
+/*!
+ \brief Private slot. Called when any curve property is changed.
+*/
+void Plot2d_AnalyticalCurveDlg::updateCurve()
+{
+ UpdateLocker lock( myUpdater );
+
+ QListWidgetItem* item = selected();
+ Plot2d_AnalyticalCurve* curve = selectedCurve();
+ if ( item && curve ) {
+ myProperties[ curve ][ PROP_TITLE ] = item->text();
+ myProperties[ curve ][ PROP_VISIBLE ] = item->checkState() == Qt::Checked;
+ myProperties[ curve ][ PROP_FORMULA ] = myFormula->text();
+ myProperties[ curve ][ PROP_NBINTERVALS ] = myNbIntervals->value();
+ myProperties[ curve ][ PROP_AUTOASSIGN ] = myAutoAssign->isChecked();
+ myProperties[ curve ][ PROP_MARKERTYPE ] = myMarkerType->currentIndex();
+ myProperties[ curve ][ PROP_LINETYPE ] = myLineType->currentIndex();
+ myProperties[ curve ][ PROP_LINEWIDTH ] = myLineWidth->value();
+ myProperties[ curve ][ PROP_COLOR ] = myColor->color();
+ }
+
+ updateState();
+}
+
+/*!
+ \brief Private slot. Update widgets state.
+*/
+void Plot2d_AnalyticalCurveDlg::updateState()
+{
+ myPropsGrp->setEnabled( !myAutoAssign->isChecked() );
+ myCurveParams->setEnabled( selectedCurve() != 0 );
+ myCurveProps->setEnabled( selectedCurve() != 0 );
+ myRemoveButton->setEnabled( selectedCurve() != 0 );
+}
+
+/*!
+ \brief Private slot. Called when selection in the curve list is changed.
+*/
+void Plot2d_AnalyticalCurveDlg::selectionChanged()
+{
+ UpdateLocker lock( myUpdater );
+
+ Plot2d_AnalyticalCurve* curve = selectedCurve();
+
+ myFormula->setText( propFormula( curve ) );
+ myNbIntervals->setValue( propIntervals( curve ) );
+ myMarkerType->setCurrentIndex( (int)propMarkerType( curve ) );
+ myLineType->setCurrentIndex( (int)propLineType( curve ) );
+ myLineWidth->setValue( propLineWidth( curve ) );
+ myColor->setColor( propColor( curve ) );
+ myAutoAssign->setChecked( propAutoAssign( curve ) );
+
+ updateState();
+}
+
+/*!
+ \brief Show help page
+*/
+void Plot2d_AnalyticalCurveDlg::help()
+{
+ SUIT_Application* app = SUIT_Session::session()->activeApplication();
+ if ( app )
+ app->onHelpContextModule( "GUI", "plot2d_viewer_page.html", "analytical_curve" );
+}
+
+/*!
+ \brief Get currently selected list widget item
+*/
+QListWidgetItem* Plot2d_AnalyticalCurveDlg::selected() const
+{
+ QList<QListWidgetItem*> items = myCurvesList->selectedItems();
+ return items.count() > 0 ? items[0] : 0;
+}
+
+/*!
+ \brief Get widget item by the curve
+*/
+QListWidgetItem* Plot2d_AnalyticalCurveDlg::getItem(Plot2d_AnalyticalCurve* theCurve) const
+{
+ int nb = myCurvesList->count();
+ QListWidgetItem* item = 0;
+ for(int i = 0; i < nb ; i++) {
+ item = myCurvesList->item(i);
+ if(item->data( Qt::UserRole ).value<void*>() == theCurve)
+ break;
+ }
+ return item;
+}
+
+/*!
+ \brief Get currently selected curve
+*/
+Plot2d_AnalyticalCurve* Plot2d_AnalyticalCurveDlg::selectedCurve() const
+{
+ return selected() ? (Plot2d_AnalyticalCurve*)( selected()->data( Qt::UserRole ).value<void*>() ) : 0;
+}
+
+/*!
+ \brief Get curve property: status
+*/
+int Plot2d_AnalyticalCurveDlg::propStatus( Plot2d_AnalyticalCurve* curve, const int def )
+{
+ int val = def;
+ if ( curve ) {
+ if ( !myProperties.contains( curve ) )
+ myProperties[ curve ] = CurveProps();
+ if ( !myProperties[ curve ].contains( PROP_STATUS ) )
+ myProperties[ curve ][ PROP_STATUS ] = def;
+ QVariant v = myProperties[ curve ][ PROP_STATUS ];
+ if ( v.isValid() && v.type() == QVariant::Int ) val = v.toInt();
+ }
+ return val;
+}
+
+/*!
+ \brief Get curve property: title
+*/
+QString Plot2d_AnalyticalCurveDlg::propTitle( Plot2d_AnalyticalCurve* curve, const QString& def )
+{
+ QString val = def;
+ if ( curve ) {
+ if ( !myProperties.contains( curve ) )
+ myProperties[ curve ] = CurveProps();
+ if ( !myProperties[ curve ].contains( PROP_TITLE ) )
+ myProperties[ curve ][ PROP_TITLE ] = def;
+ QVariant v = myProperties[ curve ][ PROP_TITLE ];
+ if ( v.isValid() && v.type() == QVariant::String ) val = v.toString();
+ }
+ return val;
+}
+
+/*!
+ \brief Get curve property: visible flag
+*/
+bool Plot2d_AnalyticalCurveDlg::propVisible( Plot2d_AnalyticalCurve* curve, bool def )
+{
+ bool val = def;
+ if ( curve ) {
+ if ( !myProperties.contains( curve ) )
+ myProperties[ curve ] = CurveProps();
+ if ( !myProperties[ curve ].contains( PROP_VISIBLE ) )
+ myProperties[ curve ][ PROP_VISIBLE ] = def;
+ QVariant v = myProperties[ curve ][ PROP_VISIBLE ];
+ if ( v.isValid() && v.type() == QVariant::Bool ) val = v.toBool();
+ }
+ return val;
+}
+
+/*!
+ \brief Get curve property: formula
+*/
+QString Plot2d_AnalyticalCurveDlg::propFormula( Plot2d_AnalyticalCurve* curve, const QString& def )
+{
+ QString val = def;
+ if ( curve ) {
+ if ( !myProperties.contains( curve ) )
+ myProperties[ curve ] = CurveProps();
+ if ( !myProperties[ curve ].contains( PROP_FORMULA ) )
+ myProperties[ curve ][ PROP_FORMULA ] = def;
+ QVariant v = myProperties[ curve ][ PROP_FORMULA ];
+ if ( v.isValid() && v.type() == QVariant::String ) val = v.toString();
+ }
+ return val;
+}
+
+/*!
+ \brief Get curve property: nb intervals
+*/
+int Plot2d_AnalyticalCurveDlg::propIntervals( Plot2d_AnalyticalCurve* curve, int def )
+{
+ int val = def;
+ if ( curve ) {
+ if ( !myProperties.contains( curve ) )
+ myProperties[ curve ] = CurveProps();
+ if ( !myProperties[ curve ].contains( PROP_NBINTERVALS ) )
+ myProperties[ curve ][ PROP_NBINTERVALS ] = def;
+ QVariant v = myProperties[ curve ][ PROP_NBINTERVALS ];
+ if ( v.isValid() && v.type() == QVariant::Int ) val = v.toInt();
+ }
+ return val;
+}
+
+/*!
+ \brief Get curve property: marker type
+*/
+Plot2d::MarkerType Plot2d_AnalyticalCurveDlg::propMarkerType( Plot2d_AnalyticalCurve* curve, Plot2d::MarkerType def )
+{
+ Plot2d::MarkerType val = def;
+ if ( curve ) {
+ if ( !myProperties.contains( curve ) )
+ myProperties[ curve ] = CurveProps();
+ if ( !myProperties[ curve ].contains( PROP_MARKERTYPE ) )
+ myProperties[ curve ][ PROP_MARKERTYPE ] = def;
+ QVariant v = myProperties[ curve ][ PROP_MARKERTYPE ];
+ if ( v.isValid() && v.type() == QVariant::Int ) val = (Plot2d::MarkerType)( v.toInt() );
+ }
+ return val;
+}
+
+/*!
+ \brief Get curve property: line type
+*/
+Plot2d::LineType Plot2d_AnalyticalCurveDlg::propLineType( Plot2d_AnalyticalCurve* curve, Plot2d::LineType def )
+{
+ Plot2d::LineType val = def;
+ if ( curve ) {
+ if ( !myProperties.contains( curve ) )
+ myProperties[ curve ] = CurveProps();
+ if ( !myProperties[ curve ].contains( PROP_LINETYPE ) )
+ myProperties[ curve ][ PROP_LINETYPE ] = def;
+ QVariant v = myProperties[ curve ][ PROP_LINETYPE ];
+ if ( v.isValid() && v.type() == QVariant::Int ) val = (Plot2d::LineType)( v.toInt() );
+ }
+ return val;
+}
+
+/*!
+ \brief Get curve property: line width
+*/
+int Plot2d_AnalyticalCurveDlg::propLineWidth( Plot2d_AnalyticalCurve* curve, int def )
+{
+ int val = def;
+ if ( curve ) {
+ if ( !myProperties.contains( curve ) )
+ myProperties[ curve ] = CurveProps();
+ if ( !myProperties[ curve ].contains( PROP_LINEWIDTH ) )
+ myProperties[ curve ][ PROP_LINEWIDTH ] = def;
+ QVariant v = myProperties[ curve ][ PROP_LINEWIDTH ];
+ if ( v.isValid() && v.type() == QVariant::Int ) val = v.toInt();
+ }
+ return val;
+}
+
+/*!
+ \brief Get curve property: color
+*/
+QColor Plot2d_AnalyticalCurveDlg::propColor( Plot2d_AnalyticalCurve* curve, const QColor& def )
+{
+ QColor val = def;
+ if ( curve ) {
+ if ( !myProperties.contains( curve ) )
+ myProperties[ curve ] = CurveProps();
+ if ( !myProperties[ curve ].contains( PROP_COLOR ) )
+ myProperties[ curve ][ PROP_COLOR ] = def;
+ QVariant v = myProperties[ curve ][ PROP_COLOR ];
+ if ( v.isValid() && v.type() == QVariant::Color ) val = v.value<QColor>();
+ }
+ return val;
+}
+
+/*!
+ \brief Get curve property: auto-assign flag
+*/
+bool Plot2d_AnalyticalCurveDlg::propAutoAssign( Plot2d_AnalyticalCurve* curve, bool def )
+{
+ bool val = def;
+ if ( curve ) {
+ if ( !myProperties.contains( curve ) )
+ myProperties[ curve ] = CurveProps();
+ if ( !myProperties[ curve ].contains( PROP_AUTOASSIGN ) )
+ myProperties[ curve ][ PROP_AUTOASSIGN ] = def;
+ QVariant v = myProperties[ curve ][ PROP_AUTOASSIGN ];
+ if ( v.isValid() && v.type() == QVariant::Bool ) val = v.toBool();
+ }
+ return val;
+}
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : Plot2d_AnalyticalCurveDlg.h
+// Author : Roman NIKOLAEV, Open CASCADE S.A.S. (roman.nikolaev@opencascade.com)
+
+
+#ifndef PLOT2D_ANALYTICAL_CURVE_DLG_H
+#define PLOT2D_ANALYTICAL_CURVE_DLG_H
+
+#include "Plot2d.h"
+#include "Plot2d_AnalyticalCurve.h"
+
+#include <QDialog>
+#include <QMap>
+
+class QListWidget;
+class QListWidgetItem;
+class QGroupBox;
+class QLineEdit;
+class QCheckBox;
+class QComboBox;
+class QPushButton;
+
+class QtxIntSpinBox;
+class QtxColorButton;
+class QwtPlot;
+
+class Plot2d_AnalyticalCurve;
+class Plot2d_CurveContainer;
+class Plot2d_ViewFrame;
+
+class PLOT2D_EXPORT Plot2d_AnalyticalCurveDlg : public QDialog
+{
+ Q_OBJECT
+
+ class Updater;
+ class UpdateLocker;
+
+ enum { ItemExisting, ItemAdded, ItemRemoved };
+
+public:
+ Plot2d_AnalyticalCurveDlg( Plot2d_CurveContainer*, QWidget* );
+ ~Plot2d_AnalyticalCurveDlg();
+
+ void accept();
+ void reject();
+
+private:
+
+ void init();
+ void initPropsFromCurve(Plot2d_AnalyticalCurve*);
+ QListWidgetItem* selected() const;
+ Plot2d_AnalyticalCurve* selectedCurve() const;
+ QListWidgetItem* getItem(Plot2d_AnalyticalCurve*) const;
+ bool processCurves();
+ QwtPlot* getPlot();
+ int propStatus( Plot2d_AnalyticalCurve* = 0, const int def = ItemExisting );
+ QString propTitle( Plot2d_AnalyticalCurve* = 0, const QString& def = "" );
+ bool propVisible( Plot2d_AnalyticalCurve* = 0, bool def = true );
+ QString propFormula( Plot2d_AnalyticalCurve* = 0, const QString& def = "" );
+ int propIntervals( Plot2d_AnalyticalCurve* = 0, int def = 100 );
+ Plot2d::MarkerType propMarkerType( Plot2d_AnalyticalCurve* = 0, Plot2d::MarkerType def = Plot2d::None );
+ Plot2d::LineType propLineType( Plot2d_AnalyticalCurve* = 0, Plot2d::LineType def = Plot2d::NoPen );
+ int propLineWidth( Plot2d_AnalyticalCurve* = 0, int def = 0 );
+ QColor propColor( Plot2d_AnalyticalCurve* = 0, const QColor& def = QColor() );
+ bool propAutoAssign( Plot2d_AnalyticalCurve* = 0, bool def = true );
+
+private slots:
+ void addCurve();
+ void removeCurve();
+ void updateCurve();
+ void updateState();
+ void selectionChanged();
+ void help();
+ void apply();
+
+private:
+ typedef QMap <QString, QVariant> CurveProps;
+ typedef QMap <Plot2d_AnalyticalCurve*, CurveProps> PropMap;
+
+ Plot2d_CurveContainer* myContainer;
+ PropMap myProperties;
+ Updater* myUpdater;
+
+ QListWidget* myCurvesList;
+ QGroupBox* myCurveParams;
+ QLineEdit* myFormula;
+ QtxIntSpinBox* myNbIntervals;
+ QGroupBox* myCurveProps;
+ QCheckBox* myAutoAssign;
+ QWidget* myPropsGrp;
+ QComboBox* myMarkerType;
+ QComboBox* myLineType;
+ QtxIntSpinBox* myLineWidth;
+ QtxColorButton* myColor;
+ QPushButton* myAddButton;
+ QPushButton* myRemoveButton;
+};
+
+class Plot2d_AnalyticalCurveDlg::Updater : public QObject
+{
+ Q_OBJECT
+public:
+ Updater( QWidget* parent );
+ ~Updater();
+signals:
+ void update();
+};
+
+#endif //PLOT2D_ANALYTICAL_CURVE_DLG_H
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : Plot2d_AnalyticalParser.cxx
+// Author : Roman NIKOLAEV, Open CASCADE S.A.S. (roman.nikolaev@opencascade.com)
+#include "Plot2d_AnalyticalParser.h"
+#include <structmember.h>
+
+
+/* ==================================
+ * =========== PYTHON ==============
+ * ==================================*/
+
+typedef struct {
+ PyObject_HEAD
+ int softspace;
+ std::string *out;
+ } PyStdOut;
+
+static void
+PyStdOut_dealloc(PyStdOut *self)
+{
+ PyObject_Del(self);
+}
+
+static PyObject *
+PyStdOut_write(PyStdOut *self, PyObject *args)
+{
+ char *c;
+ int l;
+ if (!PyArg_ParseTuple(args, "t#:write",&c, &l))
+ return NULL;
+
+ //std::cerr << c ;
+ *(self->out)=*(self->out)+c;
+
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+static PyMethodDef PyStdOut_methods[] = {
+ {"write", (PyCFunction)PyStdOut_write, METH_VARARGS,
+ PyDoc_STR("write(string) -> None")},
+ {NULL, NULL} /* sentinel */
+};
+
+static PyMemberDef PyStdOut_memberlist[] = {
+ {(char*)"softspace", T_INT, offsetof(PyStdOut, softspace), 0,
+ (char*)"flag indicating that a space needs to be printed; used by print"},
+ {NULL} /* Sentinel */
+};
+
+static PyTypeObject PyStdOut_Type = {
+ /* The ob_type field must be initialized in the module init function
+ * to be portable to Windows without using C++. */
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "PyOut", /*tp_name*/
+ sizeof(PyStdOut), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor)PyStdOut_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ /* softspace is writable: we must supply tp_setattro */
+ PyObject_GenericSetAttr, /* tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT, /*tp_flags*/
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ PyStdOut_methods, /*tp_methods*/
+ PyStdOut_memberlist, /*tp_members*/
+ 0, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ 0, /*tp_init*/
+ 0, /*tp_alloc*/
+ 0, /*tp_new*/
+ 0, /*tp_free*/
+ 0, /*tp_is_gc*/
+};
+
+PyObject * newPyStdOut( std::string& out )
+{
+ PyStdOut *self;
+ self = PyObject_New(PyStdOut, &PyStdOut_Type);
+ if (self == NULL)
+ return NULL;
+ self->softspace = 0;
+ self->out=&out;
+ return (PyObject*)self;
+}
+
+
+////////////////////////END PYTHON///////////////////////////
+
+
+//! The only one instance of Parser
+Plot2d_AnalyticalParser* Plot2d_AnalyticalParser::myParser = 0;
+
+//Define the script
+QString Plot2d_AnalyticalParser::myScript = QString("");
+
+/*!
+ \brief Return the only instance of the Plot2d_AnalyticalParser
+ \return instance of the Plot2d_AnalyticalParser
+*/
+Plot2d_AnalyticalParser* Plot2d_AnalyticalParser::parser()
+{
+ if ( !myParser )
+ myParser = new Plot2d_AnalyticalParser();
+ return myParser;
+}
+
+/*!
+ \brief Constructor.
+
+ Construct the Parser and initialize python interpritator.
+*/
+Plot2d_AnalyticalParser::Plot2d_AnalyticalParser()
+{
+ /* Initialize the Python interpreter */
+ if (Py_IsInitialized()) {
+ PyGILState_STATE gstate = PyGILState_Ensure();
+ myMainMod = PyImport_AddModule("__main__");
+ myMainDict = PyModule_GetDict(myMainMod);
+ PyGILState_Release(gstate);
+ initScript();
+ }
+}
+
+int Plot2d_AnalyticalParser::calculate( const QString& theExpr,
+ const double theMin,
+ const double theMax,
+ const int theNbStep,
+ double** theX,
+ double** theY) {
+
+ QString aPyScript = myScript;
+ aPyScript = aPyScript.arg(theExpr);
+ int result = -1;
+ PyGILState_STATE gstate = PyGILState_Ensure();
+ PyObject* obj = PyRun_String(qPrintable(aPyScript), Py_file_input, myMainDict, NULL);
+
+ if(obj == NULL) {
+ PyErr_Print();
+ PyGILState_Release(gstate);
+ return result;
+
+ } else {
+ Py_DECREF(obj);
+ }
+
+ PyObject* func = NULL;
+ PyObject* f_y = NULL;
+
+ if(PyObject_HasAttrString(myMainMod, "Y")) {
+ f_y = PyObject_GetAttrString(myMainMod, "Y");
+ }
+
+ if(PyObject_HasAttrString(myMainMod, "coordCalculator")) {
+ func = PyObject_GetAttrString(myMainMod, "coordCalculator");
+ }
+
+ PyObject* new_stderr = NULL;
+
+ if( f_y == NULL || func == NULL ) {
+ fflush(stderr);
+ std::string err_description="";
+ new_stderr = newPyStdOut(err_description);
+ PySys_SetObject((char*)"stderr", new_stderr);
+ PyErr_Print();
+ PySys_SetObject((char*)"stderr", PySys_GetObject((char*)"__stderr__"));
+ Py_DECREF(new_stderr);
+ PyGILState_Release(gstate);
+ return result;
+ }
+
+ PyObject* coords;
+ coords = PyObject_CallFunction(func,(char*)"(d, d, i)", theMin, theMax, theNbStep );
+
+ new_stderr = NULL;
+
+ if (coords == NULL){
+ fflush(stderr);
+ std::string err_description="";
+ new_stderr = newPyStdOut(err_description);
+ PySys_SetObject((char*)"stderr", new_stderr);
+ PyErr_Print();
+ PySys_SetObject((char*)"stderr", PySys_GetObject((char*)"__stderr__"));
+ Py_DECREF(new_stderr);
+ PyGILState_Release(gstate);
+ return result;
+ }
+
+ Py_ssize_t size = PyList_Size( coords );
+ if( size <= 0 ) {
+ Py_DECREF(coords);
+ return result;
+ }
+
+ result = size;
+
+ *theX = new double[size];
+ *theY = new double[size];
+
+ for ( Py_ssize_t i = 0; i< size; ++i ) {
+ PyObject* coord = PyList_GetItem( coords, i );
+ (*theX)[i] = PyFloat_AsDouble(PyList_GetItem(coord, 0));
+ (*theY)[i] = PyFloat_AsDouble(PyList_GetItem(coord, 1));
+ }
+
+ PyGILState_Release(gstate);
+ return result;
+}
+
+/*!
+ \brief Initialize python script.
+*/
+void Plot2d_AnalyticalParser::initScript() {
+ myScript.clear();
+ myScript += "from math import * \n";
+ myScript += "def Y(x): \n";
+ myScript += " return ";
+ myScript += "%1\n";
+
+ myScript += "def coordCalculator(xmin, xmax, nstep): \n";
+ myScript += " coords = [] \n";
+ myScript += " xstep = (xmax - xmin) / nstep \n";
+ myScript += " n = 0 \n";
+ myScript += " while n <= nstep : \n";
+ myScript += " x = xmin + n*xstep \n";
+ myScript += " try: \n";
+ myScript += " y = Y(x) \n";
+ myScript += " coords.append([x,y]) \n";
+ myScript += " except ValueError, ZeroDivisionError: \n";
+ myScript += " pass \n";
+ myScript += " n = n+1 \n";
+ myScript += " return coords \n";
+}
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : Plot2d_AnalyticalParser.h
+// Author : Roman NIKOLAEV, Open CASCADE S.A.S. (roman.nikolaev@opencascade.com)
+
+#ifndef PLOT2D_ANALYTICAL_Parser_H
+#define PLOT2D_ANALYTICAL_Parser_H
+#include <Python.h>
+
+#include "Plot2d.h"
+
+class PLOT2D_EXPORT Plot2d_AnalyticalParser {
+public:
+ ~Plot2d_AnalyticalParser();
+
+
+ static Plot2d_AnalyticalParser* parser();
+ int calculate( const QString&, const double,
+ const double, const int,
+ double**, double**);
+
+private:
+ Plot2d_AnalyticalParser();
+ void initScript();
+
+private:
+ static Plot2d_AnalyticalParser* myParser; //!< instance of the Parser
+ PyObject* myMainMod; //!< main python module
+ PyObject* myMainDict; //!< main python dictionary
+ static QString myScript; //!< python script
+};
+
+#endif //PLOT2D_ANALYTICAL_Parser_H
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : Plot2d_Histogram.cxx
+// Author : Natalia ERMOLAEVA, Open CASCADE S.A.S. (natalia.donis@opencascade.com)
+
+#include "Plot2d_Histogram.h"
+#include "Plot2d_PlotItems.h"
+
+#include <qwt_plot_curve.h>
+
+const int MAX_ATTEMPTS = 10; // max attempts
+
+/*!
+ Constructor.
+*/
+Plot2d_Histogram::Plot2d_Histogram()
+: Plot2d_Object(),
+ myColor( 0, 0, 0 ),
+ myWidth( 0 ),
+ myDefWidth( 0 )
+{
+}
+
+/*!
+ Destructor.
+*/
+Plot2d_Histogram::~Plot2d_Histogram()
+{
+}
+
+/*!
+ Copy constructor. Makes deep copy of data.
+*/
+Plot2d_Histogram::Plot2d_Histogram( const Plot2d_Histogram& hist )
+: Plot2d_Object( hist )
+{
+ myColor = hist.myColor;
+ myWidth = hist.myWidth;
+ myDefWidth = hist.myDefWidth;
+}
+
+/*!
+ operator=. Makes deep copy of data.
+*/
+Plot2d_Histogram& Plot2d_Histogram::operator=( const Plot2d_Histogram& hist )
+{
+ Plot2d_Object::operator=(hist);
+ myColor = hist.myColor;
+ myWidth = hist.myWidth;
+ myDefWidth = hist.myDefWidth;
+ return *this;
+}
+
+/*!
+ Get typeid for the plot2d histogram class
+*/
+int Plot2d_Histogram::rtti()
+{
+ return QwtPlotItem::Rtti_PlotHistogram;
+}
+
+/*!
+ Create plot object for the histogram
+*/
+QwtPlotItem* Plot2d_Histogram::createPlotItem()
+{
+ Plot2d_HistogramItem* anItem = new Plot2d_HistogramItem();
+ updatePlotItem( anItem );
+ return anItem;
+}
+
+/*!
+ Auto fill parameters of object by plot view
+*/
+void Plot2d_Histogram::autoFill( const QwtPlot* thePlot )
+{
+ setColor( getNextColor( thePlot ) );
+}
+
+/*!
+ Updates histogram fields
+*/
+void Plot2d_Histogram::updatePlotItem( QwtPlotItem* theItem )
+{
+ if ( theItem->rtti() != rtti() )
+ return;
+
+ Plot2d_HistogramItem* anItem = dynamic_cast<Plot2d_HistogramItem*>( theItem );
+ if ( !anItem )
+ return;
+
+ Plot2d_Object::updatePlotItem( theItem );
+
+ anItem->setData( getData() );
+ anItem->setLegendPen(getColor());
+ anItem->setSelected(isSelected());
+ anItem->setColor( isSelected() ? Plot2d_Object::selectionColor() : getColor() );
+}
+
+/*!
+ Sets data to object
+*/
+void Plot2d_Histogram::setData( const QList<double>& theXVals,
+ const QList<double>& theYVals )
+{
+ pointList aPoints;
+ int aSize = theXVals.size();
+ for ( int i = 0; i < aSize; i++ )
+ aPoints.append( Plot2d_Point( theXVals[i], theYVals[i] ) );
+ setPointList( aPoints );
+
+ myDefWidth = getMinInterval( theXVals )*(2./3.);
+ myWidth = 0; // myDefWidth // VSR: width should not be automatically reset to myDefWidth
+}
+
+/*!
+ Gets data
+*/
+QwtIntervalData Plot2d_Histogram::getData() const
+{
+ pointList aPoints = getPointList();
+ int aSize = aPoints.size();
+
+ QwtArray<QwtDoubleInterval> anIntervals( aSize );
+ QwtArray<double> aValues( aSize );
+ double aX;
+ double aWidth = myWidth <= 0 ? myDefWidth : myWidth; // VSR: width is either manually assigned or auto-calculated
+ for ( int i = 0; i < aSize; i++ ) {
+ aX = aPoints[i].x;
+ anIntervals[i] = QwtDoubleInterval( aX - aWidth/2, aX + aWidth/2 );
+ aValues[i] = aPoints[i].y;
+ }
+
+ return QwtIntervalData( anIntervals, aValues );
+}
+
+/*!
+ Sets color of histogram
+*/
+void Plot2d_Histogram::setColor( const QColor& theColor )
+{
+ myColor = theColor;
+ setAutoAssign( false );
+}
+
+/*!
+ Returns color of histogram
+*/
+QColor Plot2d_Histogram::getColor() const
+{
+ return myColor;
+}
+
+/*!
+ Sets custom width of a histogram bar
+*/
+void Plot2d_Histogram::setWidth( const double theWidth )
+{
+ myWidth = theWidth;
+ //setAutoAssign( false ); // VSR: width attribute is not auto-assigned
+}
+
+/*!
+ Returns custom or automatic width for a histogram bar
+*/
+double Plot2d_Histogram::getWidth( const bool isDef ) const
+{
+ return isDef ? myDefWidth : myWidth;
+}
+
+/*!
+ Gets new unique marker for item if possible
+*/
+QColor Plot2d_Histogram::getNextColor( const QwtPlot* thePlot )
+{
+ bool bOk = false;
+ int cnt = 0;
+ QColor aColor;
+ while ( !bOk ) {
+ int aRed = (int)( 256.0 * rand() / RAND_MAX); // generate random color
+ int aGreen = (int)( 256.0 * rand() / RAND_MAX); // ...
+ int aBlue = (int)( 256.0 * rand() / RAND_MAX); // ...
+ aColor = QColor( aRed, aGreen, aBlue );
+ bOk = ( ++cnt == MAX_ATTEMPTS ) || !existColor( thePlot, aColor );
+ }
+ return aColor;
+}
+
+/*!
+ Checks if color is already user by other histogram entity
+*/
+bool Plot2d_Histogram::existColor( const QwtPlot* thePlot, const QColor& theColor )
+{
+ bool ok = false;
+
+ QColor bgColor = thePlot->palette().color( QPalette::Background );
+ if ( Plot2d::closeColors( theColor, bgColor ) ) {
+ ok = true;
+ }
+ else {
+ QwtPlotItemList anItems = thePlot->itemList();
+ QwtPlotItemIterator anIt = anItems.begin(), aLast = anItems.end();
+ QwtPlotItem* anItem;
+ for( ; anIt != aLast && !ok; anIt++ ) {
+ anItem = *anIt;
+ if ( !anItem )
+ continue;
+ if ( anItem->rtti() == rtti() ) {
+ Plot2d_HistogramItem* aHItem = dynamic_cast<Plot2d_HistogramItem*>( anItem );
+ ok = aHItem && Plot2d::closeColors( theColor, aHItem->color() );
+ }
+ else if ( anItem->rtti() == QwtPlotItem::Rtti_PlotCurve ) {
+ QwtPlotCurve* aCurve = dynamic_cast<QwtPlotCurve*>( anItem );
+ ok = aCurve && Plot2d::closeColors( theColor, aCurve->pen().color() );
+ }
+ }
+ }
+ return ok;
+}
+
+/*!
+ Return min interval from values
+*/
+double Plot2d_Histogram::getMinInterval( const QList<double>& theVals )
+{
+ double aValue = -1;
+ int aSize = theVals.size();
+ if ( aSize > 1 ) {
+ aValue = qAbs( theVals[1] - theVals[0] );
+ double aDelta;
+ for ( int i = 2; i < aSize; i++ ) {
+ aDelta = qAbs( theVals[i] - theVals[i-1] );
+ aValue = qMin( aValue, qMax( aDelta, 0. ) );
+ }
+ aValue = aValue/2;
+ }
+ return aValue;
+}
+
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : Plot2d_Histogram.h
+// Author : Natalia ERMOLAEVA, Open CASCADE S.A.S. (natalia.donis@opencascade.com)
+
+#ifndef PLOT2D_HISTOGRAM_H
+#define PLOT2D_HISTOGRAM_H
+
+#include "Plot2d.h"
+#include "Plot2d_Object.h"
+
+#include <qwt_interval_data.h>
+
+class PLOT2D_EXPORT Plot2d_Histogram : public Plot2d_Object
+{
+public:
+ Plot2d_Histogram();
+ Plot2d_Histogram( const Plot2d_Histogram& );
+
+ virtual ~Plot2d_Histogram();
+ Plot2d_Histogram& operator= ( const Plot2d_Histogram& );
+
+ virtual int rtti();
+ virtual QwtPlotItem* createPlotItem();
+ virtual void autoFill( const QwtPlot* );
+ virtual void updatePlotItem( QwtPlotItem* );
+
+ void setData( const QList<double>&, const QList<double>& );
+ QwtIntervalData getData() const;
+
+ void setColor( const QColor& );
+ QColor getColor() const;
+
+ void setWidth( const double );
+ double getWidth( const bool ) const;
+
+ static double getMinInterval( const QList<double>& );
+
+protected:
+ QColor getNextColor( const QwtPlot* );
+ bool existColor( const QwtPlot*, const QColor& );
+
+private:
+ QColor myColor;
+ double myWidth;
+ double myDefWidth;
+};
+
+#endif // PLOT2D_HISTOGRAM_H
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : Plot2d_NormalizeAlgorithm.cxx
+
+#include "Plot2d_NormalizeAlgorithm.h"
+#include <QMap>
+#include <algorithm>
+#include "Plot2d_Object.h"
+
+/*!
+ Constructor
+*/
+Plot2d_NormalizeAlgorithm::Plot2d_NormalizeAlgorithm(QObject *parent) :
+ Plot2d_Algorithm(parent),
+ myNormalizationMode(NormalizeNone)
+{
+}
+
+/*!
+ Destructor
+*/
+Plot2d_NormalizeAlgorithm::~Plot2d_NormalizeAlgorithm()
+{
+}
+
+/*!
+ Sets normalozation mode
+*/
+void Plot2d_NormalizeAlgorithm::setNormalizationMode(NormalizationMode theMode) {
+ if(myNormalizationMode != theMode) {
+ myNormalizationMode = theMode;
+ myDataChanged = true;
+ }
+}
+
+/*!
+ Gets normalozation mode
+*/
+Plot2d_NormalizeAlgorithm::NormalizationMode Plot2d_NormalizeAlgorithm::getNormalizationMode()const {
+ return myNormalizationMode;
+}
+
+/*!
+ Gets k normalization coefficient
+*/
+double Plot2d_NormalizeAlgorithm::getKkoef(Plot2d_Object* theObj)
+{
+ QMap<Plot2d_Object*,double>::iterator it = myKkoefs.find(theObj);
+ if(it != myKkoefs.end())
+ return it.value();
+ return 0;
+}
+
+/*!
+ Gets b normalization coefficient
+*/
+double Plot2d_NormalizeAlgorithm::getBkoef(Plot2d_Object* theObj)
+{
+ QMap<Plot2d_Object*,double>::iterator it = myBkoefs.find(theObj);
+ if(it != myBkoefs.end())
+ return it.value();
+ return 0;
+
+}
+
+void Plot2d_NormalizeAlgorithm::execute() {
+ if (!isDataChanged() || myInuptData.isEmpty())
+ return;
+
+ if (myNormalizationMode != NormalizeNone) {
+ QList<double> yMinLst, yMaxLst;
+ QList<double> aKkoefs,aBkoefs;
+ double _pMin, _pMax;
+ for (int i = 0; i < myInuptData.size(); ++i) {
+ QList<double> aTmpItemValues;
+ Plot2d_Object* object = myInuptData.at(i);
+ double *x, *y;
+ long nb = object->getData( &x, &y );
+ for (int j = 0; j < nb; ++j) {
+ aTmpItemValues<<object->getPoint(j).y;
+ }
+ delete x;
+ delete y;
+ yMaxLst<<*(std::max_element(aTmpItemValues.begin(), aTmpItemValues.end()));
+ yMinLst<<*(std::min_element(aTmpItemValues.begin(), aTmpItemValues.end()));
+ }
+ _pMin = *(std::min_element(yMinLst.begin(), yMinLst.end()));
+ _pMax = *(std::max_element(yMaxLst.begin(), yMaxLst.end()));
+
+ double pMin, pMax, kKoef, bKoef, yMin, yMax;
+ switch( getNormalizationMode() ) {
+ case NormalizeToMin:
+ pMin = _pMin;
+ for (int i = 0; i < yMaxLst.size(); ++i) {
+ yMin = yMinLst.at(i);
+ yMax = yMaxLst.at(i);
+ pMax = yMax;
+ kKoef = (pMax - pMin)/(yMax - yMin);
+ bKoef = pMin - kKoef * yMin;
+ aBkoefs<<bKoef;
+ aKkoefs<<kKoef;
+ }
+ break;
+ case NormalizeToMax:
+ pMax = _pMax;
+ for (int i = 0; i < yMaxLst.size(); ++i) {
+ yMin = yMinLst.at(i);
+ yMax = yMaxLst.at(i);
+ pMin = yMin;
+ kKoef = (pMax - pMin)/(yMax - yMin);
+ bKoef = pMin - kKoef * yMin;
+ aBkoefs<<bKoef;
+ aKkoefs<<kKoef;
+ }
+ break;
+ case NormalizeToMinMax:
+ pMax = _pMax;
+ pMin = _pMin;
+ for (int i = 0; i < yMaxLst.size(); ++i) {
+ yMin = yMinLst.at(i);
+ yMax = yMaxLst.at(i);
+ kKoef = (pMax - pMin)/(yMax - yMin);
+ bKoef = pMin - kKoef * yMin;
+ aBkoefs<<bKoef;
+ aKkoefs<<kKoef;
+ }
+ break;
+ }
+
+ for (int i = 0; i < myInuptData.size(); ++i) {
+ double yOld,xOld,yNew;
+ AlgoPlot2dItem tmpItem;
+ for (int j = 0; j < myInuptData.at(i)->nbPoints(); ++j) {
+ yOld = myInuptData.at(i)->getPoint(j).y;
+ xOld = myInuptData.at(i)->getPoint(j).x;
+ yNew = aKkoefs.at(i) * yOld + aBkoefs.at(i);
+ tmpItem.append( qMakePair(xOld, yNew) );
+ }
+ myResultData.insert(myInuptData.at(i),tmpItem);
+ myKkoefs.insert(myInuptData.at(i),aKkoefs.at(i));
+ myBkoefs.insert(myInuptData.at(i),aBkoefs.at(i));
+ }
+ } else {
+ for (int i = 0; i < myInuptData.size(); ++i) {
+ double yOld,xOld;
+ AlgoPlot2dItem tmpItem;
+ for (int j = 0; j < myInuptData.at(i)->nbPoints(); ++j) {
+ yOld = myInuptData.at(i)->getPoint(j).y;
+ xOld = myInuptData.at(i)->getPoint(j).x;
+ tmpItem.append( qMakePair(xOld, yOld) );
+ }
+ myResultData.insert(myInuptData.at(i),tmpItem);
+ }
+ }
+ myDataChanged = false;
+}
+
+
+void Plot2d_NormalizeAlgorithm::clear() {
+ Plot2d_Algorithm::clear();
+ myBkoefs.clear();
+ myKkoefs.clear();
+}
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : Plot2d_NormalizeAlgorithm.h
+
+#ifndef PLOT2D_NORMALIZEALGORITHM_H
+#define PLOT2D_NORMALIZEALGORITHM_H
+
+#include "Plot2d.h"
+#include "Plot2d_Algorithm.h"
+#include <QList>
+
+class Plot2d_Object;
+
+class PLOT2D_EXPORT Plot2d_NormalizeAlgorithm : public Plot2d_Algorithm {
+ Q_OBJECT
+public:
+ Plot2d_NormalizeAlgorithm(QObject *parent);
+ ~Plot2d_NormalizeAlgorithm();
+
+ enum NormalizationMode { NormalizeToMin, NormalizeToMax, NormalizeToMinMax, NormalizeNone };
+
+ void setNormalizationMode(NormalizationMode);
+ NormalizationMode getNormalizationMode() const;
+ double getKkoef(Plot2d_Object*);
+ double getBkoef(Plot2d_Object*);
+ virtual void execute();
+ virtual void clear();
+
+private:
+ NormalizationMode myNormalizationMode;
+ QMap<Plot2d_Object*, double> myBkoefs;
+ QMap<Plot2d_Object*, double> myKkoefs;
+};
+
+#endif //PLOT2D_NORMALIZEALGORITHM_H
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : Plot2d_Object.cxx
+// Author : Natalia ERMOLAEVA, Open CASCADE S.A.S. (natalia.donis@opencascade.com)
+//
+
+#include "Plot2d_Object.h"
+
+
+#include <SUIT_Session.h>
+#include <SUIT_ResourceMgr.h>
+
+// Static members
+QColor Plot2d_Object::mySelectionColor;
+QColor Plot2d_Object::myHighlightedLegendTextColor;
+
+/*
+ * Read colors from the resource manager.
+*/
+void Plot2d_Object::initColors() {
+ SUIT_Session* session = SUIT_Session::session();
+ if(!session)
+ return;
+
+ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+ if(resMgr) {
+ mySelectionColor = resMgr->colorValue( "Plot2d", "SelectionColor", QColor(80,80,80) );
+ myHighlightedLegendTextColor = resMgr->colorValue( "Plot2d", "SelectedLegendFontColor", QColor(255,255,255) );
+ }
+}
+
+/*!
+ Constructor
+*/
+Plot2d_Object::Plot2d_Object()
+: myAutoAssign( true ),
+ myHorTitle( "" ), myVerTitle( "" ),
+ myHorUnits( "" ), myVerUnits( "" ),
+ myName( "" ),
+ myXAxis( QwtPlot::xBottom ),
+ myYAxis( QwtPlot::yLeft ),
+ myIsSelected(false),
+ myScale ( 1.0 )
+{
+}
+
+/*!
+ Destructor
+*/
+Plot2d_Object::~Plot2d_Object()
+{
+}
+
+/*!
+ Copy constructor. Makes deep copy of data.
+*/
+Plot2d_Object::Plot2d_Object( const Plot2d_Object& object )
+{
+ myAutoAssign = object.isAutoAssign();
+ myHorTitle = object.getHorTitle();
+ myVerTitle = object.getVerTitle();
+ myHorUnits = object.getHorUnits();
+ myVerUnits = object.getVerUnits();
+ myName = object.getName();
+ myXAxis = object.getXAxis();
+ myYAxis = object.getYAxis();
+ myPoints = object.getPointList();
+ myScale = object.getScale();
+}
+
+/*!
+ operator=. Makes deep copy of data.
+*/
+Plot2d_Object& Plot2d_Object::operator=( const Plot2d_Object& object )
+{
+ myAutoAssign = object.isAutoAssign();
+ myHorTitle = object.getHorTitle();
+ myVerTitle = object.getVerTitle();
+ myHorUnits = object.getHorUnits();
+ myVerUnits = object.getVerUnits();
+ myName = object.getName();
+ myXAxis = object.getXAxis();
+ myYAxis = object.getYAxis();
+ myPoints = object.getPointList();
+ myScale = object.getScale();
+ return *this;
+}
+
+/*!
+ Auto fill parameters of object by plot view
+*/
+void Plot2d_Object::autoFill( const QwtPlot* )
+{
+}
+
+/*!
+ * Updates object fields
+ */
+void Plot2d_Object::updatePlotItem( QwtPlotItem* theItem )
+{
+ if ( !theItem || theItem->rtti() != rtti() )
+ return;
+
+ if ( theItem->yAxis() != getYAxis() || theItem->xAxis() != getXAxis() ) {
+ theItem->setAxis( getXAxis(), getYAxis() );
+
+ QwtPlot* aPlot = theItem->plot();
+ if ( aPlot ) {
+ theItem->detach();
+ theItem->attach( aPlot );
+ }
+ }
+ QString name = !getName().isEmpty() ? getName() : getVerTitle();
+ if( myScale != 1.0 )
+ name = name + QString("( *%1 )").arg(myScale);
+ theItem->setTitle( name );
+}
+
+/*!
+ \return title of table
+*/
+QString Plot2d_Object::getTableTitle() const
+{
+ return QString();
+}
+
+/*!
+ Sets object's horizontal title
+*/
+void Plot2d_Object::setHorTitle( const QString& title )
+{
+ myHorTitle = title;
+}
+
+/*!
+ Gets object's horizontal title
+*/
+QString Plot2d_Object::getHorTitle() const
+{
+ return myHorTitle;
+}
+
+/*!
+ Sets object's vertical title
+*/
+void Plot2d_Object::setVerTitle( const QString& title )
+{
+ myVerTitle = title;
+}
+
+/*!
+ Gets object's vertical title
+*/
+QString Plot2d_Object::getVerTitle() const
+{
+ return myVerTitle;
+}
+
+/*!
+ Sets object's horizontal units
+*/
+void Plot2d_Object::setHorUnits( const QString& units )
+{
+ myHorUnits = units;
+}
+
+/*!
+ Gets object's horizontal units
+*/
+QString Plot2d_Object::getHorUnits() const
+{
+ return myHorUnits;
+}
+
+/*!
+ Sets object's vertical units
+*/
+void Plot2d_Object::setVerUnits( const QString& units )
+{
+ myVerUnits = units;
+}
+
+/*!
+ Gets object's vertical units
+*/
+QString Plot2d_Object::getVerUnits() const
+{
+ return myVerUnits;
+}
+
+/*!
+ Sets object's name
+ */
+void Plot2d_Object::setName( const QString& theName )
+{
+ myName = theName;
+}
+/*!
+ Gets object's name
+ */
+QString Plot2d_Object::getName() const
+{
+ return myName;
+}
+
+/*!
+ Sets object's scale factor
+ */
+void Plot2d_Object::setScale( double theScale )
+{
+ myScale = theScale;
+}
+/*!
+ Gets object's scale factor
+ */
+double Plot2d_Object::getScale() const
+{
+ return myScale;
+}
+
+/*!
+ Adds one point for object.
+*/
+void Plot2d_Object::addPoint( double theX, double theY, const QString& theText )
+{
+ addPoint( Plot2d_Point( theX, theY, theText ) );
+}
+
+/*!
+ Adds one point for object.
+*/
+void Plot2d_Object::addPoint( const Plot2d_Point& thePoint )
+{
+ myPoints.append( thePoint );
+}
+
+/*!
+ Insert one point for object on some position.
+*/
+void Plot2d_Object::insertPoint( int thePos, double theX, double theY,
+ const QString& theText )
+{
+ insertPoint( thePos, Plot2d_Point( theX, theY, theText ) );
+}
+
+/*!
+ Insert one point for object on some position.
+*/
+void Plot2d_Object::insertPoint( int thePos, const Plot2d_Point& thePoint )
+{
+ if ( thePos < 0 )
+ myPoints.append( thePoint );
+ else
+ myPoints.insert( thePos, thePoint );
+}
+
+/*!
+ Delete one point for object on some position.
+*/
+void Plot2d_Object::deletePoint(int thePos)
+{
+ if ( thePos >= 0 && thePos < myPoints.count() )
+ myPoints.removeAt( thePos );
+}
+
+/*!
+ Remove all points for object.
+*/
+void Plot2d_Object::clearAllPoints()
+{
+ myPoints.clear();
+}
+
+/*!
+ Gets object's data : abscissas of points
+*/
+pointList Plot2d_Object::getPointList() const
+{
+ return myPoints;
+}
+
+/*!
+ Gets points by index.
+*/
+
+Plot2d_Point& Plot2d_Object::getPoint(int index) {
+ return myPoints[index];
+}
+
+/*!
+ Gets object's data : abscissas of points
+*/
+void Plot2d_Object::setPointList( const pointList& points )
+{
+ myPoints = points;
+}
+
+/*!
+ Sets object's data.
+*/
+void Plot2d_Object::setData( const double* hData, const double* vData, long size, const QStringList& lst )
+{
+ clearAllPoints();
+ QStringList::const_iterator anIt = lst.begin(), aLast = lst.end();
+ for ( long i = 0; i < size; i++, anIt++ )
+ addPoint( hData[i], vData[i], anIt==aLast ? QString() : *anIt );
+}
+
+/*!
+ Gets object's data : abscissas of points
+*/
+double* Plot2d_Object::horData() const
+{
+ int aNPoints = nbPoints();
+ double* aX = new double[aNPoints];
+ for (int i = 0; i < aNPoints; i++) {
+ aX[i] = myPoints[i].x;
+ }
+ return aX;
+}
+
+/*!
+ Gets object's data : ordinates of points
+*/
+double* Plot2d_Object::verData() const
+{
+ int aNPoints = nbPoints();
+ double* aY = new double[aNPoints];
+ for (int i = 0; i < aNPoints; i++) {
+ aY[i] = myScale * myPoints[i].y;
+ }
+ return aY;
+}
+
+/*!
+ Gets object's data
+*/
+long Plot2d_Object::getData( double** theX, double** theY ) const
+{
+ int aNPoints = nbPoints();
+ *theX = new double[aNPoints];
+ *theY = new double[aNPoints];
+ for (int i = 0; i < aNPoints; i++) {
+ (*theX)[i] = myPoints[i].x;
+ (*theY)[i] = myScale * myPoints[i].y;
+ }
+ return aNPoints;
+}
+
+/*!
+ Changes text assigned to point of object
+ \param ind -- index of point
+ \param txt -- new text
+*/
+void Plot2d_Object::setText( const int ind, const QString& txt )
+{
+ if ( ind >= 0 && ind < myPoints.count() )
+ myPoints[ind].text = txt;
+}
+
+/*!
+ \return text assigned to point
+ \param ind -- index of point
+*/
+QString Plot2d_Object::text( const int ind ) const
+{
+ return ( ind >= 0 && ind < myPoints.count() ) ? myPoints[ind].text : QString();
+}
+
+/*!
+ Gets object's data : number of points
+*/
+int Plot2d_Object::nbPoints() const
+{
+ return myPoints.count();
+}
+
+/*!
+ Returns true if object has no data
+*/
+bool Plot2d_Object::isEmpty() const
+{
+ return myPoints.isEmpty();
+}
+
+/*!
+ Sets object's AutoAssign flag - in this case attributes will be set automatically
+*/
+void Plot2d_Object::setAutoAssign( bool on )
+{
+ myAutoAssign = on;
+}
+
+/*!
+ Gets object's AutoAssign flag state
+*/
+bool Plot2d_Object::isAutoAssign() const
+{
+ return myAutoAssign;
+}
+
+/*!
+ Sets object's x axis
+*/
+void Plot2d_Object::setXAxis(QwtPlot::Axis theXAxis)
+{
+ if (theXAxis == QwtPlot::xBottom || theXAxis == QwtPlot::xTop)
+ myXAxis = theXAxis;
+}
+
+/*!
+ Gets object's x axis
+*/
+QwtPlot::Axis Plot2d_Object::getXAxis() const
+{
+ return myXAxis;
+}
+
+/*!
+ Sets object's y axis
+*/
+void Plot2d_Object::setYAxis(QwtPlot::Axis theYAxis)
+{
+ if (theYAxis == QwtPlot::yLeft || theYAxis == QwtPlot::yRight)
+ myYAxis = theYAxis;
+}
+
+/*!
+ Gets object's y axis
+*/
+QwtPlot::Axis Plot2d_Object::getYAxis() const
+{
+ return myYAxis;
+}
+
+/*!
+ Gets object's minimal abscissa
+*/
+double Plot2d_Object::getMinX() const
+{
+ double aMinX = 1e150;
+ pointList::const_iterator aIt;
+ for (aIt = myPoints.begin(); aIt != myPoints.end(); ++aIt)
+ aMinX = qMin( aMinX, (*aIt).x );
+ return aMinX;
+}
+
+/*!
+ Gets object's maximal abscissa
+*/
+double Plot2d_Object::getMaxX() const
+{
+ double aMaxX = -1e150;
+ pointList::const_iterator aIt;
+ for (aIt = myPoints.begin(); aIt != myPoints.end(); ++aIt)
+ aMaxX = qMax( aMaxX, (*aIt).x );
+ return aMaxX;
+}
+
+/*!
+ Gets object's minimal ordinate
+*/
+double Plot2d_Object::getMinY() const
+{
+ double aMinY = 1e150;
+ pointList::const_iterator aIt;
+ for (aIt = myPoints.begin(); aIt != myPoints.end(); ++aIt)
+ aMinY = qMin( aMinY, myScale * (*aIt).y );
+ return aMinY;
+}
+
+/*!
+ Gets object's maximal ordinate
+*/
+double Plot2d_Object::getMaxY() const
+{
+ double aMaxY = -1e150;
+ pointList::const_iterator aIt;
+ for (aIt = myPoints.begin(); aIt != myPoints.end(); ++aIt)
+ aMaxY = qMax( aMaxY, myScale * (*aIt).y );
+ return aMaxY;
+}
+
+/*!
+ Sets object's selected property
+*/
+void Plot2d_Object::setSelected(const bool on) {
+ myIsSelected = on;
+}
+
+/*!
+ Gets object's selected property
+*/
+bool Plot2d_Object::isSelected() const {
+ return myIsSelected;
+}
+
+/*!
+ * Sets selection color of the object.
+*/
+void Plot2d_Object::setSelectionColor(const QColor& c) {
+ mySelectionColor = c;
+}
+
+/*!
+ * Return selection color of the object.
+*/
+QColor Plot2d_Object::selectionColor() {
+ return mySelectionColor;
+}
+
+/*!
+ * Sets font color of the selected legend item.
+*/
+void Plot2d_Object::setHighlightedLegendTextColor(const QColor& c) {
+ myHighlightedLegendTextColor = c;
+}
+
+/*!
+ * Sets font color of the selected legend item.
+*/
+QColor Plot2d_Object::highlightedLegendTextColor() {
+ return myHighlightedLegendTextColor;
+}
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : Plot2d_Object.h
+// Author : Natalia ERMOLAEVA, Open CASCADE S.A.S. (natalia.donis@opencascade.com)
+//
+
+#ifndef PLOT2D_OBJECT_H
+#define PLOT2D_OBJECT_H
+
+#include "Plot2d.h"
+
+#include <QList>
+#include <qwt_plot.h>
+
+
+class PLOT2D_EXPORT Plot2d_Object
+{
+public:
+ Plot2d_Object();
+ Plot2d_Object( const Plot2d_Object& );
+
+ virtual ~Plot2d_Object();
+ Plot2d_Object& operator= ( const Plot2d_Object& );
+
+ virtual int rtti() = 0;
+ virtual QwtPlotItem* createPlotItem() = 0;
+ virtual void autoFill( const QwtPlot* );
+ virtual void updatePlotItem( QwtPlotItem* );
+
+ virtual QString getTableTitle() const;
+
+ void setHorTitle( const QString& );
+ QString getHorTitle() const;
+ void setVerTitle( const QString& );
+ QString getVerTitle() const;
+
+ void setHorUnits( const QString& );
+ QString getHorUnits() const;
+ void setVerUnits( const QString& );
+ QString getVerUnits() const;
+
+ void setName( const QString& );
+ QString getName() const;
+
+ void setScale( double );
+ double getScale() const;
+
+ void addPoint( double, double, const QString& = QString() );
+ void addPoint( const Plot2d_Point& );
+ void insertPoint( int, double, double, const QString& = QString() );
+ void insertPoint( int, const Plot2d_Point& );
+ void deletePoint( int );
+ void clearAllPoints();
+ pointList getPointList() const;
+ void setPointList( const pointList& points );
+ Plot2d_Point& getPoint(int index);
+
+ void setData( const double*, const double*,
+ long, const QStringList& = QStringList() );
+ double* horData() const;
+ double* verData() const;
+ long getData( double**, double** ) const;
+
+ void setText( const int, const QString& );
+ QString text( const int ) const;
+
+ int nbPoints() const;
+ bool isEmpty() const;
+
+ void setAutoAssign( bool );
+ bool isAutoAssign() const;
+
+ void setXAxis( QwtPlot::Axis );
+ QwtPlot::Axis getXAxis() const;
+ void setYAxis( QwtPlot::Axis );
+ QwtPlot::Axis getYAxis() const;
+
+ // Protection against QwtObject::drawLines() bug in Qwt 0.4.x:
+ // it crashes if switched to X/Y logarithmic mode, when one or more points have
+ // non-positive X/Y coordinate
+ virtual double getMinX() const;
+ virtual double getMaxX() const;
+ virtual double getMinY() const;
+ virtual double getMaxY() const;
+
+ void setSelected(const bool);
+ bool isSelected() const;
+
+ static void initColors();
+
+ static void setSelectionColor(const QColor& c);
+ static QColor selectionColor();
+
+ static void setHighlightedLegendTextColor(const QColor& c);
+ static QColor highlightedLegendTextColor();
+
+protected:
+ bool myAutoAssign;
+ QString myHorTitle;
+ QString myVerTitle;
+ QString myHorUnits;
+ QString myVerUnits;
+ QString myName;
+ QwtPlot::Axis myXAxis;
+ QwtPlot::Axis myYAxis;
+
+ double myScale;
+
+ pointList myPoints;
+ bool myIsSelected;
+
+ private:
+ static QColor mySelectionColor; //!< Color of the selected curve or histogram
+ static QColor myHighlightedLegendTextColor; //!< Color of the selected legend item font
+};
+
+typedef QList<Plot2d_Object*> objectList;
+
+#endif
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : Plot2d_HistogramItem.cxx
+// Author : Natalia ERMOLAEVA, Open CASCADE S.A.S. (natalia.donis@opencascade.com)
+
+#include "Plot2d_PlotItems.h"
+#include "Plot2d_Object.h"
+
+#include <QPainter>
+#include <QPalette>
+#include <QLayout>
+#include <QLine>
+#include <QVariant>
+#include <qwt_plot.h>
+#include <qwt_painter.h>
+#include <qwt_scale_map.h>
+#include <qwt_legend.h>
+#include <qwt_legend_item.h>
+#include <qwt_plot_dict.h>
+
+const char* yAxisLeft[] = {
+ "12 12 2 1",
+ " c None",
+ ". c #000000",
+ " ",
+ " . ",
+ " ... ",
+ " . . . ",
+ " . ",
+ " . ",
+ " . . ",
+ " . . ",
+ " ........ ",
+ " . ",
+ " . ",
+ " "};
+
+const char* yAxisRight[] = {
+ "12 12 2 1",
+ " c None",
+ ". c #000000",
+ " ",
+ " . ",
+ " ... ",
+ " . . . ",
+ " . ",
+ " . ",
+ " . . ",
+ " . . ",
+ " ........ ",
+ " . ",
+ " . ",
+ " "};
+
+/*!
+ Constructor of Plot2d_QwtLegendItem
+*/
+Plot2d_QwtLegendItem::Plot2d_QwtLegendItem( QWidget* parent ) :
+ QwtLegendItem( parent ),
+ myYAxisIdentifierMode( IM_None ),
+ myIsSelected(false)
+{
+ myYAxisLeftIcon = yAxisLeft;
+ myYAxisRightIcon = yAxisRight;
+ int anIconWidth = qMax( myYAxisLeftIcon.width(), myYAxisRightIcon.width() );
+
+ mySpacingCollapsed = spacing();
+ mySpacingExpanded = anIconWidth - mySpacingCollapsed;
+}
+
+/*!
+ Destructor of Plot2d_QwtLegendItem
+*/
+Plot2d_QwtLegendItem::~Plot2d_QwtLegendItem()
+{
+}
+
+/*!
+ Set Y axis identifier displaying mode
+*/
+void Plot2d_QwtLegendItem::setYAxisIdentifierMode( const int theMode )
+{
+ myYAxisIdentifierMode = theMode;
+ setSpacing( theMode == IM_None ? mySpacingCollapsed : mySpacingExpanded );
+}
+
+/*!
+ Redefined method of drawing identifier of legend item
+*/
+void Plot2d_QwtLegendItem::drawIdentifier( QPainter* painter, const QRect& rect ) const
+{
+ QwtLegendItem::drawIdentifier( painter, rect );
+
+ if( myYAxisIdentifierMode != IM_None ) {
+ QPixmap aPixmap( myYAxisIdentifierMode == IM_Left ? yAxisLeft : yAxisRight );
+ painter->save();
+ painter->drawPixmap( rect.topRight() + QPoint( mySpacingExpanded/2, mySpacingExpanded/2 ), aPixmap );
+ painter->restore();
+ }
+}
+
+/*!
+ Update highliting on the item.
+*/
+void Plot2d_QwtLegendItem::updateHighlit() {
+ QwtText txt = text();
+ if(isSelected()) {
+ QColor highlightColor = Plot2d_Object::selectionColor();
+ if(highlightColor != txt.backgroundBrush().color()) {
+ txt.setBackgroundBrush(highlightColor);
+ setText(txt);
+ }
+ } else if( QWidget* parent = qobject_cast<QWidget*>(this->parent()->parent()) ) {
+ QPalette aPal = parent->palette();
+ if(aPal.color(QPalette::Background) != txt.backgroundBrush().color()) {
+ txt.setBackgroundBrush(aPal.color(QPalette::Background));
+ setText(txt);
+ }
+ }
+}
+
+/*!
+ Sets selected property.
+*/
+void Plot2d_QwtLegendItem::setSelected(const bool on) {
+ myIsSelected = on;
+}
+
+/*!
+ Gets selected property.
+*/
+bool Plot2d_QwtLegendItem::isSelected() const {
+ return myIsSelected;
+}
+
+
+/*
+ Draw text of the item.
+*/
+void Plot2d_QwtLegendItem::drawText(QPainter * painter, const QRect &rect) {
+ painter->setPen( isSelected() ? Plot2d_Object::highlightedLegendTextColor() :
+ getColorFromPalette( QPalette::Text) );
+
+ QwtLegendItem::drawText( painter, rect );
+}
+
+/*
+ Get color from the legend pallete by 'role' flag.
+*/
+QColor Plot2d_QwtLegendItem::getColorFromPalette(QPalette::ColorRole role) {
+ QWidget* pw = parentWidget();
+ QColor col = palette().color( role );
+ while( pw ) {
+ if ( qobject_cast<QwtLegend*>( pw ) ) {
+ col = pw->palette().color(role );
+ break;
+ }
+ pw = pw->parentWidget();
+ }
+ return col;
+}
+/*
+ * Internal class to store deviation data on the curve.
+ */
+class Plot2d_QwtPlotCurve::Plot2d_DeviationData {
+public:
+ Plot2d_DeviationData(const double *min, const double *max,const QList<int>& idx)
+ {
+ foreach(int index,idx) {
+ myMin[index] = min[index];
+ myMax[index] = max[index];
+ }
+ }
+ ~Plot2d_DeviationData(){}
+
+ size_t size() const
+ {
+ return qwtMin(myMin.size(), myMax.size());
+ }
+ bool values(size_t i, double &min, double &max) {
+ if(myMin.contains(i) && myMax.contains(i)) {
+ min = myMin[i];
+ max = myMax[i];
+ return true;
+ }
+ return false;
+ }
+private:
+ QMap<int,double> myMin;
+ QMap<int,double> myMax;
+};
+
+
+/*!
+ Constructor of Plot2d_QwtPlotCurve
+*/
+Plot2d_QwtPlotCurve::Plot2d_QwtPlotCurve( const QString& title,
+ QwtPlot::Axis yAxis /*const int index*/ ) :
+ Plot2d_SelectableItem(),
+ QwtPlotCurve( title ),
+ myYAxis( yAxis ),
+ myYAxisIdentifierEnabled( false ),
+ myDeviationData(0)
+{
+}
+
+/*!
+ Destructor of Plot2d_QwtPlotCurve
+*/
+Plot2d_QwtPlotCurve::~Plot2d_QwtPlotCurve()
+{
+ clearDeviationData();
+}
+
+/*!
+ Enable / disable Y axis identifier
+*/
+void Plot2d_QwtPlotCurve::setYAxisIdentifierEnabled( const bool on )
+{
+ myYAxisIdentifierEnabled = on;
+}
+
+/*!
+ Redefined method, which updates legend of the curve
+*/
+void Plot2d_QwtPlotCurve::updateLegend( QwtLegend* legend ) const
+{
+ if ( !legend )
+ return;
+
+ QWidget* widget = legend->find( this );
+
+ if ( testItemAttribute(QwtPlotItem::Legend)) {
+
+ if ( widget == NULL ) {
+ widget = legendItem();
+ if ( widget ) {
+ if ( widget->inherits("QwtLegendItem") ) {
+ QwtLegendItem *label = (QwtLegendItem *)widget;
+ label->setItemMode(legend->itemMode());
+
+ if ( plot() ) {
+ QObject::connect(label, SIGNAL(clicked()),
+ plot(), SLOT(legendItemClicked()));
+ QObject::connect(label, SIGNAL(checked(bool)),
+ plot(), SLOT(legendItemChecked(bool)));
+ }
+ }
+ legend->contentsWidget()->layout()->addWidget(widget);
+ legend->insert(this, widget);
+ }
+ }
+
+ QwtPlotCurve::updateLegend( legend );
+
+
+ if( Plot2d_QwtLegendItem* anItem = dynamic_cast<Plot2d_QwtLegendItem*>( widget ) ) {
+ int aMode = Plot2d_QwtLegendItem::IM_None;
+ if( myYAxisIdentifierEnabled )
+ aMode = myYAxis == QwtPlot::yRight ?
+ Plot2d_QwtLegendItem::IM_Right :
+ Plot2d_QwtLegendItem::IM_Left;
+ anItem->setYAxisIdentifierMode( aMode );
+ if(isSelected()) {
+ anItem->setCurvePen(legendPen());
+ anItem->setSymbol(legendSymbol());
+ }
+ anItem->setSelected(isSelected());
+ anItem->updateHighlit();
+ }
+ }
+}
+
+/*!
+ Redefined method, which creates and returns legend item of the curve
+*/
+QWidget* Plot2d_QwtPlotCurve::legendItem() const
+{
+ return new Plot2d_QwtLegendItem;
+}
+
+/*!
+ Redefined method, which draw a set of points of a curve.
+*/
+void Plot2d_QwtPlotCurve::draw(QPainter *painter,
+ const QwtScaleMap &xMap, const QwtScaleMap &yMap,
+ int from, int to) const
+{
+ if (to < 0)
+ to = dataSize() - 1;
+ QwtPlotCurve::draw(painter, xMap, yMap, from, to);
+
+ //draw deviation data
+ if(hasDeviationData()) {
+ painter->save();
+ int lineW = deviationMarkerLineWidth();
+ int tickSz = deviationMarkerTickSize() + qRound(lineW/2);
+ double min, max, xi, yi;
+ int xp, ytop, ybtm, tickl, tickr;
+ QColor c = isSelected() ? Plot2d_Object::selectionColor() : deviationMarkerColor();
+ QPen p = QPen(c, lineW, Qt::SolidLine);
+ painter->setPen(p);
+ for (int i = from; i <= to; i++) {
+ if(!myDeviationData->values(i,min,max)) continue;
+ xi = x(i);
+ yi = y(i);
+ xp = xMap.transform(xi);
+ ytop = yMap.transform(yi + max);
+ ybtm = yMap.transform(yi - min);
+ tickl = xp - tickSz;
+ tickr = xp + tickSz;
+ painter->drawLine(tickl,ytop,tickr,ytop);
+ painter->drawLine(xp,ytop,xp,ybtm);
+ painter->drawLine(tickl,ybtm,tickr,ybtm);
+ }
+ painter->restore();
+ }
+}
+
+/*!
+ * Return color of the deviation marker.
+ */
+QColor Plot2d_QwtPlotCurve::deviationMarkerColor() const {
+ QColor c(0, 0, 127);
+ if(plot()) {
+ QVariant var = plot()->property(PLOT2D_DEVIATION_COLOR);
+ if(var.isValid())
+ c = var.value<QColor>();
+ }
+ return c;
+}
+/*!
+ * Return line width of the deviation marker.
+ */
+int Plot2d_QwtPlotCurve::deviationMarkerLineWidth() const {
+ int lw = 1;
+ if(plot()) {
+ QVariant var = plot()->property(PLOT2D_DEVIATION_LW);
+ if(var.isValid())
+ lw = var.toInt();
+ }
+ return lw;
+}
+
+/*!
+ * Return tick size of the deviation marker.
+ */
+int Plot2d_QwtPlotCurve::deviationMarkerTickSize() const {
+ int ts = 2;
+ if(plot()) {
+ QVariant var = plot()->property(PLOT2D_DEVIATION_TS);
+ if(var.isValid())
+ ts = var.toInt();
+ }
+ return ts;
+}
+
+/*!
+ * Sets deviation data for the plot item.
+ */
+void Plot2d_QwtPlotCurve::setDeviationData(const double* min, const double* max,const QList<int> &idx) {
+ clearDeviationData();
+ myDeviationData = new Plot2d_DeviationData(min,max,idx);
+}
+
+/*!
+ * Return true if deviation is assigned to the plot item,
+ false otherwise.
+ */
+bool Plot2d_QwtPlotCurve::hasDeviationData() const {
+ return myDeviationData != 0;
+}
+
+/*!
+ * Remove deviation data from the plot item.
+ */
+void Plot2d_QwtPlotCurve::clearDeviationData()
+{
+ if(myDeviationData)
+ delete myDeviationData;
+ myDeviationData = 0;
+}
+
+
+
+/*!
+ Constructor.
+*/
+Plot2d_SelectableItem::Plot2d_SelectableItem():
+ myIsSelected(false)
+{
+}
+
+/*!
+ Destructor.
+*/
+Plot2d_SelectableItem::~Plot2d_SelectableItem()
+{
+}
+
+/*!
+ Sets selected property.
+*/
+void Plot2d_SelectableItem::setSelected( const bool on) {
+ myIsSelected = on;
+}
+
+/*!
+ Return selected property.
+*/
+bool Plot2d_SelectableItem::isSelected() const {
+ return myIsSelected;
+}
+
+/*!
+ Sets legend pen property.
+*/
+void Plot2d_SelectableItem::setLegendPen( const QPen & p) {
+ myLegendPen = p;
+}
+
+/*!
+ Return legend pen property.
+*/
+QPen Plot2d_SelectableItem::legendPen() const {
+ return myLegendPen;
+}
+
+/*!
+ Sets legend symbol property.
+*/
+void Plot2d_SelectableItem::setLegendSymbol(const QwtSymbol& s) {
+ myLegendSymbol = s;
+}
+
+/*!
+ Sets legend symbol property.
+*/
+QwtSymbol Plot2d_SelectableItem::legendSymbol() const {
+ return myLegendSymbol;
+}
+
+/*!
+ Constructor
+*/
+Plot2d_HistogramQwtItem::Plot2d_HistogramQwtItem( const QwtText& theTitle )
+: QwtPlotItem( theTitle )
+{
+ init();
+}
+
+/*!
+ Constructor
+*/
+Plot2d_HistogramQwtItem::Plot2d_HistogramQwtItem( const QString& theTitle )
+: QwtPlotItem( QwtText( theTitle ) )
+{
+ init();
+}
+
+/*!
+ Destructor
+*/
+Plot2d_HistogramQwtItem::~Plot2d_HistogramQwtItem()
+{
+}
+
+/*!
+ Initialization of object
+*/
+void Plot2d_HistogramQwtItem::init()
+{
+ myReference = 0.0;
+ myAttributes = Plot2d_HistogramQwtItem::Auto;
+
+ setItemAttribute( QwtPlotItem::AutoScale, true );
+ setItemAttribute( QwtPlotItem::Legend, true );
+
+ setZ( 20.0 );
+}
+
+/*!
+ Sets base line to object
+ @param theRef
+*/
+void Plot2d_HistogramQwtItem::setBaseline( double theRef )
+{
+ if ( myReference != theRef ) {
+ myReference = theRef;
+ itemChanged();
+ }
+}
+
+/*!
+ Returns base line of object
+*/
+double Plot2d_HistogramQwtItem::baseline() const
+{
+ return myReference;
+}
+
+/*!
+ Sets data to object
+*/
+void Plot2d_HistogramQwtItem::setData( const QwtIntervalData& theData )
+{
+ myData = theData;
+ itemChanged();
+}
+
+/*!
+ Returns data from object
+*/
+const QwtIntervalData& Plot2d_HistogramQwtItem::data() const
+{
+ return myData;
+}
+
+/*!
+ Sets color to object
+*/
+void Plot2d_HistogramQwtItem::setColor( const QColor& theColor )
+{
+ if ( myColor != theColor ) {
+ myColor = theColor;
+ itemChanged();
+ }
+}
+
+/*!
+ Returns color from object
+*/
+QColor Plot2d_HistogramQwtItem::color() const
+{
+ return myColor;
+}
+
+/*!
+ Returns bounding rect of object
+*/
+QwtDoubleRect Plot2d_HistogramQwtItem::boundingRect() const
+{
+ QwtDoubleRect aRect = myData.boundingRect();
+ if ( !aRect.isValid() )
+ return aRect;
+
+ if ( myAttributes & Xfy ) {
+ aRect = QwtDoubleRect( aRect.y(), aRect.x(),
+ aRect.height(), aRect.width() );
+ if ( aRect.left() > myReference )
+ aRect.setLeft( myReference );
+ else if ( aRect.right() < myReference )
+ aRect.setRight( myReference );
+ }
+ else {
+ if ( aRect.bottom() < myReference )
+ aRect.setBottom( myReference );
+ else if ( aRect.top() > myReference )
+ aRect.setTop( myReference );
+ }
+ return aRect;
+}
+
+/*!
+ Returns type of plot object
+*/
+int Plot2d_HistogramQwtItem::rtti() const
+{
+ return QwtPlotItem::Rtti_PlotHistogram;
+}
+
+/*!
+ Sets histogram attributes
+*/
+void Plot2d_HistogramQwtItem::setHistogramAttribute( HistogramAttribute theAttr,
+ bool isOn )
+{
+ if ( testHistogramAttribute( theAttr ) != isOn ) {
+ if ( isOn )
+ myAttributes |= theAttr;
+ else
+ myAttributes &= ~theAttr;
+
+ itemChanged();
+ }
+}
+
+/*!
+ Tests histogram attributes
+*/
+bool Plot2d_HistogramQwtItem::testHistogramAttribute( HistogramAttribute theAttr ) const
+{
+ return myAttributes & theAttr;
+}
+
+/*!
+ Draws histogram object
+*/
+void Plot2d_HistogramQwtItem::draw( QPainter* thePainter,
+ const QwtScaleMap& theXMap,
+ const QwtScaleMap& theYMap,
+ const QRect& ) const
+{
+ thePainter->setPen( QPen( myColor ) );
+
+ const int x0 = theXMap.transform( baseline() );
+ const int y0 = theYMap.transform( baseline() );
+
+ for ( int i = 0; i < (int)myData.size(); i++ ) {
+ if ( myAttributes & Plot2d_HistogramQwtItem::Xfy ) {
+ const int x2 = theXMap.transform( myData.value( i ) );
+ if ( x2 == x0 )
+ continue;
+ int y1 = theYMap.transform( myData.interval( i ).minValue() );
+ int y2 = theYMap.transform( myData.interval( i ).maxValue() );
+ if ( y1 > y2 )
+ qSwap( y1, y2 );
+
+ if ( i < (int)myData.size() - 2 ) {
+ const int yy1 = theYMap.transform( myData.interval(i+1).minValue() );
+ const int yy2 = theYMap.transform( myData.interval(i+1).maxValue() );
+ if ( y2 == qwtMin( yy1, yy2 ) ) {
+ const int xx2 = theXMap.transform( myData.interval(i+1).minValue() );
+ if ( xx2 != x0 && ( ( xx2 < x0 && x2 < x0 ) ||
+ ( xx2 > x0 && x2 > x0 ) ) ) {
+ // One pixel distance between neighboured bars
+ y2++;
+ }
+ }
+ }
+ drawBar( thePainter, Qt::Horizontal, QRect( x0, y1, x2 - x0, y2 - y1 ) );
+ }
+ else {
+ const int y2 = theYMap.transform( myData.value( i ) );
+ if ( y2 == y0 )
+ continue;
+ int x1 = theXMap.transform( myData.interval( i ).minValue() );
+ int x2 = theXMap.transform( myData.interval( i ).maxValue() );
+ if ( x1 > x2 )
+ qSwap( x1, x2 );
+
+ if ( i < (int)myData.size() - 2 ) {
+ const int xx1 = theXMap.transform( myData.interval(i+1).minValue() );
+ const int xx2 = theXMap.transform( myData.interval(i+1).maxValue() );
+ if ( x2 == qwtMin( xx1, xx2 ) ) {
+ const int yy2 = theYMap.transform( myData.value(i+1) );
+ if ( yy2 != y0 && ( ( yy2 < y0 && y2 < y0 ) ||
+ ( yy2 > y0 && y2 > y0 ) ) ) {
+ // One pixel distance between neighboured bars
+ x2--;
+ }
+ }
+ }
+ drawBar( thePainter, Qt::Vertical, QRect( x1, y0, x2 - x1, y2 - y0 ) );
+ }
+ }
+}
+
+/*!
+ Draws single bar of histogram
+*/
+void Plot2d_HistogramQwtItem::drawBar( QPainter* thePainter,
+ Qt::Orientation,
+ const QRect& theRect ) const
+{
+ thePainter->save();
+
+ const QColor color( thePainter->pen().color() );
+ QRect r = theRect.normalized();
+
+ const int factor = 125;
+ const QColor light( color.light( factor ) );
+ const QColor dark( color.dark( factor ) );
+
+ thePainter->setBrush( color );
+ thePainter->setPen( Qt::NoPen );
+ QwtPainter::drawRect( thePainter, r.x() + 1, r.y() + 1,
+ r.width() - 2, r.height() - 2 );
+ thePainter->setBrush( Qt::NoBrush );
+
+ thePainter->setPen( QPen( light, 2 ) );
+ QwtPainter::drawLine( thePainter, r.left() + 1, r.top() + 2,
+ r.right() + 1, r.top() + 2 );
+
+ thePainter->setPen( QPen( dark, 2 ) );
+ QwtPainter::drawLine( thePainter, r.left() + 1, r.bottom(),
+ r.right() + 1, r.bottom() );
+ thePainter->setPen( QPen( light, 1 ) );
+
+ QwtPainter::drawLine( thePainter, r.left(), r.top() + 1,
+ r.left(), r.bottom() );
+ QwtPainter::drawLine( thePainter, r.left() + 1, r.top() + 2,
+ r.left() + 1, r.bottom() - 1 );
+ thePainter->setPen( QPen( dark, 1 ) );
+
+ QwtPainter::drawLine( thePainter, r.right() + 1, r.top() + 1,
+ r.right() + 1, r.bottom() );
+ QwtPainter::drawLine(thePainter, r.right(), r.top() + 2,
+ r.right(), r.bottom() - 1 );
+ thePainter->restore();
+}
+
+/*!
+ Constructor
+*/
+Plot2d_HistogramItem::Plot2d_HistogramItem( const QwtText& theTitle )
+: Plot2d_HistogramQwtItem( theTitle ),
+ Plot2d_SelectableItem(),
+ myCrossed( true )
+{
+}
+
+/*!
+ Constructor
+*/
+Plot2d_HistogramItem::Plot2d_HistogramItem( const QString& theTitle )
+: Plot2d_HistogramQwtItem( theTitle ),
+ myCrossed( true )
+{
+}
+
+/*!
+ Destructor
+*/
+Plot2d_HistogramItem::~Plot2d_HistogramItem()
+{
+}
+
+/*!
+ Get histogram bar items
+*/
+QList<QRect> Plot2d_HistogramItem::getBars() const
+{
+ return myBarItems;
+}
+
+/*!
+ Set to legend item symbol with color of item
+*/
+void Plot2d_HistogramItem::updateLegend( QwtLegend* theLegend ) const
+{
+ if ( !theLegend )
+ return;
+
+ Plot2d_HistogramQwtItem::updateLegend( theLegend );
+
+ QWidget* theWidget = theLegend->find( this );
+ if ( !theWidget || !theWidget->inherits( "QwtLegendItem" ) )
+ return;
+
+ Plot2d_QwtLegendItem* anItem = ( Plot2d_QwtLegendItem* )theWidget;
+ QFontMetrics aFMetrics( anItem->font() );
+ int aSize = aFMetrics.height();
+ QwtSymbol aSymbol( QwtSymbol::Rect, QBrush( legendPen().color() ),
+ QPen( legendPen().color() ), QSize( aSize, aSize ) );
+ anItem->setSymbol( aSymbol );
+ anItem->setIdentifierMode( theLegend->identifierMode()
+ | QwtLegendItem::ShowSymbol );
+ anItem->setSelected(isSelected());
+ anItem->updateHighlit();
+ anItem->update();
+}
+
+/*!
+ Draws histogram object
+*/
+void Plot2d_HistogramItem::draw( QPainter* thePainter,
+ const QwtScaleMap& theXMap,
+ const QwtScaleMap& theYMap,
+ const QRect& ) const
+{
+ // nds: clear list of bar items
+ Plot2d_HistogramItem* anItem = (Plot2d_HistogramItem*)this;
+ anItem->myBarItems.clear();
+
+ thePainter->setPen( QPen( color() ) );
+ const int x0 = theXMap.transform( baseline() );
+ const int y0 = theYMap.transform( baseline() );
+
+ const QwtIntervalData& iData = data();
+
+ for ( int i = 0; i < (int)iData.size(); i++ ) {
+ if ( testHistogramAttribute( Plot2d_HistogramItem::Xfy ) ) {
+ const int x2 = theXMap.transform( iData.value( i ) );
+ if ( x2 == x0 )
+ continue;
+ int y1 = theYMap.transform( iData.interval( i ).minValue() );
+ int y2 = theYMap.transform( iData.interval( i ).maxValue() );
+ if ( y1 > y2 )
+ qSwap( y1, y2 );
+
+ if ( i < (int)iData.size() - 2 ) {
+ const int yy1 = theYMap.transform( iData.interval(i+1).minValue() );
+ const int yy2 = theYMap.transform( iData.interval(i+1).maxValue() );
+ if ( y2 == qwtMin( yy1, yy2 ) ) {
+ const int xx2 = theXMap.transform( iData.interval(i+1).minValue() );
+ if ( xx2 != x0 && ( ( xx2 < x0 && x2 < x0 ) ||
+ ( xx2 > x0 && x2 > x0 ) ) ) {
+ // One pixel distance between neighboured bars
+ y2++;
+ }
+ }
+ }
+ // nds: draw rect with the other lower rects
+ QRect aRect( x0, y1, x2 - x0, y2 - y1 );
+ drawRectAndLowers( thePainter, Qt::Horizontal, aRect );
+ anItem->myBarItems.append( aRect );
+ }
+ else {
+ const int y2 = theYMap.transform( iData.value( i ) );
+ if ( y2 == y0 )
+ continue;
+ int x1 = theXMap.transform( iData.interval( i ).minValue() );
+ int x2 = theXMap.transform( iData.interval( i ).maxValue() );
+ if ( x1 > x2 )
+ qSwap( x1, x2 );
+
+ if ( i < (int)iData.size() - 2 ) {
+ const int xx1 = theXMap.transform( iData.interval(i+1).minValue() );
+ const int xx2 = theXMap.transform( iData.interval(i+1).maxValue() );
+ if ( x2 == qwtMin( xx1, xx2 ) ) {
+ const int yy2 = theYMap.transform( iData.value(i+1) );
+ if ( yy2 != y0 && ( ( yy2 < y0 && y2 < y0 ) ||
+ ( yy2 > y0 && y2 > y0 ) ) ) {
+ // One pixel distance between neighboured bars
+ x2--;
+ }
+ }
+ }
+ // nds: draw rect with the other lower rects
+ QRect aRect(x1, y0, x2 - x1, y2 - y0 );
+ drawRectAndLowers( thePainter, Qt::Vertical, aRect );
+ anItem->myBarItems.append( aRect );
+ }
+ }
+}
+
+/*!
+ Set/clear "cross items" option
+*/
+void Plot2d_HistogramItem::setCrossItems( bool theCross )
+{
+ myCrossed = theCross;
+}
+
+/*!
+ Get "cross items" option
+*/
+bool Plot2d_HistogramItem::isCrossItems() const
+{
+ return myCrossed;
+}
+
+/*!
+ Redefined method, which creates and returns legend item of the curve
+*/
+QWidget* Plot2d_HistogramItem::legendItem() const
+{
+ return new Plot2d_QwtLegendItem;
+}
+
+
+/*!
+ Draws bar of histogram and on it bars of histograms with lower height.
+*/
+void Plot2d_HistogramItem::drawRectAndLowers( QPainter* thePainter,
+ Qt::Orientation theOr,
+ const QRect& theRect ) const
+{
+ QRect aRect = theRect;
+ // theRect has inversed coordinates on Y axis.
+ // The top of the rect is bottom in standard QRect coordinates,
+ // and it bottom is the top.
+ if ( myCrossed )//&& theOr == Qt::Horizontal )
+ aRect.setTop( getCrossedTop( theRect ) );
+
+ drawBar( thePainter, Qt::Horizontal, aRect );
+}
+
+/*!
+ Returns top value of the given rect in the context of other bars.
+
+ It's necessary to remember, that \a theRect has inverted coordinate Y.
+*/
+int Plot2d_HistogramItem::getCrossedTop( const QRect& theRect ) const
+{
+ int aRes = theRect.top();
+ QwtPlot* aPlot = plot();
+ // int aHeight = theRect.height();
+ if ( aPlot ) {
+ QwtPlotItemList anItems = aPlot->itemList();
+ QwtPlotItemIterator anIt = anItems.begin(), aLast = anItems.end();
+ Plot2d_HistogramItem* anItem;
+ QList<QRect> aRects;
+ for ( ; anIt != aLast; anIt++ ) {
+ if ( !(*anIt)->rtti() == QwtPlotItem::Rtti_PlotHistogram )
+ continue;
+ anItem = dynamic_cast<Plot2d_HistogramItem*>( *anIt );
+ if( !anItem || anItem == this )
+ continue;
+ aRects.clear();
+ aRects = anItem->getBars();
+ for ( int i = 0, aSize = aRects.size(); i < aSize; i++ ) {
+ if ( qMax( theRect.x(), aRects[i].x() ) <=
+ qMin( theRect.left(), aRects[i].left() ) ) {
+ if ( theRect.bottom() < aRects[i].bottom() )
+ if ( aRects[i].bottom() < aRes )
+ aRes = aRects[i].bottom();
+ }
+ }
+ }
+ }
+ return aRes;
+}
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : Plot2d_HistogramItem.h
+// Author : Natalia ERMOLAEVA, Open CASCADE S.A.S. (natalia.donis@opencascade.com)
+
+#ifndef PLOT2D_PLOTITEMS_H
+#define PLOT2D_PLOTITEMS_H
+
+#include "Plot2d.h"
+
+#include <qwt_legend_item.h>
+#include <qwt_plot_item.h>
+#include <qwt_plot_curve.h>
+#include <qwt_interval_data.h>
+#include <qwt_plot.h>
+
+class PLOT2D_EXPORT Plot2d_QwtLegendItem : public QwtLegendItem
+{
+public:
+ enum YAxisIdentifierMode { IM_None = 0, IM_Left, IM_Right };
+
+public:
+ Plot2d_QwtLegendItem( QWidget* = 0 );
+ virtual ~Plot2d_QwtLegendItem();
+
+public:
+ void setYAxisIdentifierMode( const int );
+ void updateHighlit();
+ void setSelected(const bool on);
+ bool isSelected() const;
+ QColor getColorFromPalette(QPalette::ColorRole role);
+
+protected:
+ virtual void drawIdentifier( QPainter*, const QRect& ) const;
+ virtual void drawText(QPainter *, const QRect &);
+
+private:
+
+private:
+ int myYAxisIdentifierMode;
+ QPixmap myYAxisLeftIcon;
+ QPixmap myYAxisRightIcon;
+ int mySpacingCollapsed;
+ int mySpacingExpanded;
+ bool myIsSelected;
+};
+
+class PLOT2D_EXPORT Plot2d_SelectableItem {
+public:
+ Plot2d_SelectableItem();
+ ~Plot2d_SelectableItem();
+
+ void setSelected( const bool );
+ bool isSelected() const;
+
+ void setLegendPen( const QPen & );
+ QPen legendPen() const;
+
+ void setLegendSymbol( const QwtSymbol& );
+ QwtSymbol legendSymbol() const;
+
+private:
+ bool myIsSelected;
+ QPen myLegendPen;
+ QwtSymbol myLegendSymbol;
+};
+
+class PLOT2D_EXPORT Plot2d_QwtPlotCurve : public QwtPlotCurve, public Plot2d_SelectableItem
+{
+public:
+ Plot2d_QwtPlotCurve( const QString&, QwtPlot::Axis = QwtPlot::yLeft );
+ virtual ~Plot2d_QwtPlotCurve();
+
+public:
+ virtual void setYAxisIdentifierEnabled( const bool );
+ virtual void draw(QPainter *p,
+ const QwtScaleMap &xMap,
+ const QwtScaleMap &yMap,
+ int from, int to) const;
+
+ void setDeviationData(const double* min, const double* max, const QList<int> &idx);
+ bool hasDeviationData() const;
+ void clearDeviationData();
+
+
+protected:
+ virtual void updateLegend( QwtLegend* ) const;
+ virtual QWidget* legendItem() const;
+
+ QColor deviationMarkerColor() const;
+ int deviationMarkerLineWidth() const;
+ int deviationMarkerTickSize() const;
+
+private:
+ QwtPlot::Axis myYAxis;
+ bool myYAxisIdentifierEnabled;
+
+ class Plot2d_DeviationData;
+ Plot2d_DeviationData* myDeviationData;
+};
+
+class PLOT2D_EXPORT Plot2d_HistogramQwtItem: public QwtPlotItem
+{
+public:
+ enum HistogramAttribute
+ {
+ Auto = 0,
+ Xfy = 1
+ };
+
+ explicit Plot2d_HistogramQwtItem( const QString& = QString() );
+ explicit Plot2d_HistogramQwtItem( const QwtText& );
+ virtual ~Plot2d_HistogramQwtItem();
+
+ void setData( const QwtIntervalData& );
+ const QwtIntervalData& data() const;
+
+ void setColor( const QColor& );
+ QColor color() const;
+
+ virtual QwtDoubleRect boundingRect() const;
+ virtual int rtti() const;
+ virtual void draw( QPainter*, const QwtScaleMap&,
+ const QwtScaleMap&, const QRect& ) const;
+
+ void setBaseline( double );
+ double baseline() const;
+
+ void setHistogramAttribute( HistogramAttribute, bool = true );
+ bool testHistogramAttribute( HistogramAttribute ) const;
+
+protected:
+ virtual void drawBar( QPainter*, Qt::Orientation, const QRect& ) const;
+
+private:
+ void init();
+
+private:
+ int myAttributes;
+ QwtIntervalData myData;
+ QColor myColor;
+ double myReference;
+};
+
+class PLOT2D_EXPORT Plot2d_HistogramItem : public Plot2d_HistogramQwtItem, public Plot2d_SelectableItem
+{
+public:
+ explicit Plot2d_HistogramItem( const QString& = QString() );
+ explicit Plot2d_HistogramItem( const QwtText& );
+ virtual ~Plot2d_HistogramItem();
+
+ QList<QRect> getBars() const;
+
+ virtual void updateLegend( QwtLegend* ) const;
+ virtual void draw( QPainter*, const QwtScaleMap&,
+ const QwtScaleMap&, const QRect& ) const;
+
+ void setCrossItems( bool theCross );
+ bool isCrossItems() const;
+
+protected:
+ void drawRectAndLowers( QPainter*, Qt::Orientation,
+ const QRect& ) const;
+ int getCrossedTop( const QRect& ) const;
+
+ virtual QWidget* legendItem() const;
+
+protected:
+ QList<QRect> myBarItems;
+ bool myCrossed;
+};
+
+#endif // PLOT2D_PLOTITEMS_H
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// File : Plot2d_SetupCurveScaleDlg.cxx
+//
+#include "Plot2d_SetupCurveScaleDlg.h"
+
+#include <SUIT_Tools.h>
+
+#include <QGroupBox>
+#include <QHBoxLayout>
+#include <QVBoxLayout>
+#include <QLabel>
+#include <QPushButton>
+
+#include <QtxDoubleSpinBox.h>
+
+const int MARGIN_SIZE = 11;
+const int SPACING_SIZE = 6;
+const int MIN_COMBO_WIDTH = 100;
+const int MIN_SPIN_WIDTH = 50;
+
+/*!
+ \class Plot2d_SetupCurveScaleDlg
+ \brief Dialog box for modifying 2d curve scale factor.
+*/
+
+/*!
+ \brief Constructor.
+ \param parent parent widget
+*/
+Plot2d_SetupCurveScaleDlg::Plot2d_SetupCurveScaleDlg( /*curveList lst, */QWidget* parent )
+: QDialog( parent )
+{
+ setModal( true );
+ setWindowTitle( tr("TLT_SETUP_CURVE_SCALE") );
+ setSizeGripEnabled( true );
+
+ /************************************************************************/
+ QGroupBox* GroupC1 = new QGroupBox( this );
+ QHBoxLayout* GroupC1Layout = new QHBoxLayout( GroupC1 );
+ GroupC1Layout->setSpacing( SPACING_SIZE );
+ GroupC1Layout->setMargin( MARGIN_SIZE );
+
+ QLabel* aScaleLab = new QLabel( tr( "CURVE_SCALE_FACTOR" ), GroupC1 );
+ myValueSpin = new QtxDoubleSpinBox( GroupC1 );
+ myValueSpin->setMinimum( 0.01 );
+ myValueSpin->setSingleStep( 0.1 );
+ myValueSpin->setMinimumWidth( MIN_SPIN_WIDTH );
+
+ GroupC1Layout->addWidget( aScaleLab );
+ GroupC1Layout->addWidget( myValueSpin );
+
+ /************************************************************************/
+ QGroupBox* GroupButtons = new QGroupBox( this );
+ QHBoxLayout* GroupButtonsLayout = new QHBoxLayout( GroupButtons );
+ GroupButtonsLayout->setSpacing( SPACING_SIZE );
+ GroupButtonsLayout->setMargin( MARGIN_SIZE );
+
+ myOkBtn = new QPushButton( tr( "BUT_OK" ), this );
+ myCancelBtn = new QPushButton( tr( "BUT_CANCEL" ), this );
+
+ GroupButtonsLayout->addWidget( myOkBtn );
+ GroupButtonsLayout->addSpacing( 10 );
+ GroupButtonsLayout->addWidget( myCancelBtn );
+
+ /************************************************************************/
+ QVBoxLayout* topLayout = new QVBoxLayout( this );
+ topLayout->setSpacing( SPACING_SIZE );
+ topLayout->setMargin( MARGIN_SIZE );
+ topLayout->addWidget( GroupC1 );
+ topLayout->addWidget( GroupButtons );
+
+ // default settings
+ setScale( 1.0 ); // no scale
+
+ // connections
+ connect( myOkBtn, SIGNAL( clicked() ), this, SLOT( accept() ) );
+ connect( myCancelBtn, SIGNAL( clicked() ), this, SLOT( reject() ) );
+
+ SUIT_Tools::centerWidget( this, parent );
+}
+
+/*!
+ \brief Destructor.
+*/
+Plot2d_SetupCurveScaleDlg::~Plot2d_SetupCurveScaleDlg()
+{
+}
+
+/*!
+ \brief Set scale factor.
+ \param coef scale factor
+ \sa getScale()
+*/
+void Plot2d_SetupCurveScaleDlg::setScale( const double coef )
+{
+ if ( coef > myValueSpin->maximum() ){
+ myValueSpin->setMaximum( coef );
+ }
+ myValueSpin->setValue( coef );
+}
+
+/*!
+ \brief Get scale factor.
+ \return chosen scale factor
+ \sa setScale()
+*/
+double Plot2d_SetupCurveScaleDlg::getScale() const
+{
+ return myValueSpin->value();
+}
+/*!
+ \brief Clear value in the "Scale factor" spinbox.
+*/
+void Plot2d_SetupCurveScaleDlg::setUndefinedValue() {
+ myValueSpin->setCleared(true);
+ myValueSpin->setSpecialValueText("");
+}
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// File : Plot2d_SetupCurveScaleDlg.h
+//
+#ifndef PLOT2D_SETUPCURVESCALEDLG_H
+#define PLOT2D_SETUPCURVESCALEDLG_H
+
+#include "Plot2d.h"
+
+#include <QDialog>
+
+class QPushButton;
+class QLabel;
+
+class QtxDoubleSpinBox;
+
+class PLOT2D_EXPORT Plot2d_SetupCurveScaleDlg : public QDialog
+{
+ Q_OBJECT
+
+public:
+ Plot2d_SetupCurveScaleDlg( /*curveList,*/ QWidget* = 0 );
+ ~Plot2d_SetupCurveScaleDlg();
+
+public:
+ void setScale( const double );
+ double getScale() const;
+
+ void setUndefinedValue();
+
+private:
+ QPushButton* myOkBtn;
+ QPushButton* myCancelBtn;
+ QtxDoubleSpinBox* myValueSpin;
+};
+
+#endif // PLOT2D_SETUPCURVESCALEDLG_H
+
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="fr_FR">
+<context>
+ <name>@default</name>
+ <message>
+ <source>PLOT2D_CURVE_TYPE_LBL</source>
+ <translation>Type de courbe:</translation>
+ </message>
+ <message>
+ <source>ERROR</source>
+ <translation>Erreur</translation>
+ </message>
+ <message>
+ <source>PLOT2D_SET_AS_DEFAULT_CHECK</source>
+ <translation>Enregistrer comme paramètres par défaut</translation>
+ </message>
+ <message>
+ <source>TLT_SETUP_CURVE</source>
+ <translation>Initialiser une courbe</translation>
+ </message>
+ <message>
+ <source>MNU_DUMP_VIEW</source>
+ <translation>Enregistrer la vue...</translation>
+ </message>
+ <message>
+ <source>PLOT2D_SCALE_MODE_HOR</source>
+ <translation>Axe horizontal:</translation>
+ </message>
+ <message>
+ <source>PLOT2D_NORMALIZE_TLT</source>
+ <translation>Normalisation</translation>
+ </message>
+ <message>
+ <source>PLOT2D_NORMALIZE_MODE_MIN</source>
+ <translation>Normaliser sur le minimum</translation>
+ </message>
+ <message>
+ <source>PLOT2D_NORMALIZE_MODE_MAX</source>
+ <translation>Normaliser sur le maximum</translation>
+ </message>
+ <message>
+ <source>PLOT2D_NORMALIZE_LEFT_AXIS</source>
+ <translation>Axe Y gauche: </translation>
+ </message>
+ <message>
+ <source>PLOT2D_NORMALIZE_RIGHT_AXIS</source>
+ <translation>Axe Y droite: </translation>
+ </message>
+ <message>
+ <source>PLOT2D_SCALE_MODE_VER</source>
+ <translation>Axe vertical:</translation>
+ </message>
+ <message>
+ <source>MNU_PAN_VIEW</source>
+ <translation>Déplacement</translation>
+ </message>
+ <message>
+ <source>MNU_CLONE_VIEW</source>
+ <translation>Dupliquer la vue</translation>
+ </message>
+ <message>
+ <source>MNU_PRINT_VIEW</source>
+ <translation>Imprimer la vue</translation>
+ </message>
+ <message>
+ <source>POSTSCRIPT_FILES</source>
+ <translation>Fichiers PostScript (*.ps)</translation>
+ </message>
+ <message>
+ <source>ENCAPSULATED_POSTSCRIPT_FILES</source>
+ <translation>Fichiers PostScript encapsulés (*.eps)</translation>
+ </message>
+ <message>
+ <source>DSC_GLOBALPAN_VIEW</source>
+ <translation>Sélection d'un nouveau centre de vue</translation>
+ </message>
+ <message>
+ <source>PRP_PLOT2D_MODE_LINEAR_VER</source>
+ <translation>Changer la vue de l'axe vertical au mode d'échelle linéaire</translation>
+ </message>
+ <message>
+ <source>PRP_PLOT2D_MODE_LINEAR_HOR</source>
+ <translation>Changer la vue de l'axe horizontal au mode d'échelle linéaire</translation>
+ </message>
+ <message>
+ <source>CURVE_LINE_WIDTH_LAB</source>
+ <translation>Epaisseur du trait:</translation>
+ </message>
+ <message>
+ <source>CURVE_TYPE_POPUP</source>
+ <translation>Type de courbe</translation>
+ </message>
+ <message>
+ <source>NORMALIZATION_TYPE_POPUP</source>
+ <translation>Normalisation</translation>
+ </message>
+ <message>
+ <source>TOT_PLOT2D_MODE_LINEAR_VER</source>
+ <translation>Axe vertical: linéaire</translation>
+ </message>
+ <message>
+ <source>TOT_PLOT2D_MODE_LINEAR_HOR</source>
+ <translation>Axe horizontal: linéaire</translation>
+ </message>
+ <message>
+ <source>FIT_DATA_TLT</source>
+ <translation>Ajuster à la plage de données</translation>
+ </message>
+ <message>
+ <source>MNU_ZOOM_VIEW</source>
+ <translation>Zoom</translation>
+ </message>
+ <message>
+ <source>PLOT2D_GRID_TLT</source>
+ <translation>Marques de la grille et des axes</translation>
+ </message>
+ <message>
+ <source>DSC_PAN_VIEW</source>
+ <translation>Déplacer la vue</translation>
+ </message>
+ <message>
+ <source>DASHDOT_LINE_LBL</source>
+ <translation>TiretPoint</translation>
+ </message>
+ <message>
+ <source>PRP_PLOT2D_CURVES_SPLINES</source>
+ <translation>Changer la vue en mode splines</translation>
+ </message>
+ <message>
+ <source>INF_AXES_X</source>
+ <translation>Axe X</translation>
+ </message>
+ <message>
+ <source>PLOT2D_SCALE_TLT</source>
+ <translation>Mode d'échelle</translation>
+ </message>
+ <message>
+ <source>DSC_FITALL</source>
+ <translation>Ajuster la scène pour afficher tous les objets</translation>
+ </message>
+ <message>
+ <source>MNU_FITALL</source>
+ <translation>Tout afficher</translation>
+ </message>
+ <message>
+ <source>TOT_PLOT2D_MODE_LOGARITHMIC_HOR</source>
+ <translation>Axe horizontal: logarithmique</translation>
+ </message>
+ <message>
+ <source>TOT_PLOT2D_MODE_LOGARITHMIC_VER</source>
+ <translation>Axe vertical: logarithmique</translation>
+ </message>
+ <message>
+ <source>MNU_GLOBALPAN_VIEW</source>
+ <translation>Déplacement global</translation>
+ </message>
+ <message>
+ <source>INF_APP_DUMP_VIEW</source>
+ <translation>Enregistrer la vue</translation>
+ </message>
+ <message>
+ <source>PLOT2D_LEGEND_POSITION_BOTTOM</source>
+ <translation>Dessous</translation>
+ </message>
+ <message>
+ <source>INF_COORDINATES</source>
+ <translation>Coordonnées: X : %1, Y : %2</translation>
+ </message>
+ <message>
+ <source>DSC_CLONE_VIEW</source>
+ <translation>Ouvrir un nouveau visualiseur OCC pour la scène actuelle</translation>
+ </message>
+ <message>
+ <source>DSC_PRINT_VIEW</source>
+ <translation>Imprimer la vue actuelle</translation>
+ </message>
+ <message>
+ <source>DASH_LINE_LBL</source>
+ <translation>Tiret</translation>
+ </message>
+ <message>
+ <source>DTRIANGLE_MARKER_LBL</source>
+ <translation>Triangle orienté vers le bas</translation>
+ </message>
+ <message>
+ <source>UTRIANGLE_MARKER_LBL</source>
+ <translation>Triangle orienté en haut</translation>
+ </message>
+ <message>
+ <source>LTRIANGLE_MARKER_LBL</source>
+ <translation>Triangle orienté à gauche </translation>
+ </message>
+ <message>
+ <source>RTRIANGLE_MARKER_LBL</source>
+ <translation>Triangle orienté à droite</translation>
+ </message>
+ <message>
+ <source>RECTANGLE_MARKER_LBL</source>
+ <translation>Rectangle</translation>
+ </message>
+ <message>
+ <source>TLT_SETUP_PLOT2D_VIEW</source>
+ <translation>Paramètres de visualisation Plot 2d</translation>
+ </message>
+ <message>
+ <source>CURVE_LINE_TYPE_LAB</source>
+ <translation>Type de trait:</translation>
+ </message>
+ <message>
+ <source>CROSS_MARKER_LBL</source>
+ <translation>Croix</translation>
+ </message>
+ <message>
+ <source>XCROSS_MARKER_LBL</source>
+ <translation>Croix diagonale</translation>
+ </message>
+ <message>
+ <source>PLOT2D_ENABLE_VER_TITLE</source>
+ <translation>Titre de l'axe vertical</translation>
+ </message>
+ <message>
+ <source>PLOT2D_ENABLE_HOR_TITLE</source>
+ <translation>Titre de l'axe horizontal</translation>
+ </message>
+ <message>
+ <source>TOT_PLOT2D_SETTINGS</source>
+ <translation>Paramètres</translation>
+ </message>
+ <message>
+ <source>TOT_PLOT2D_ANALYTICAL_CURVES</source>
+ <translation>Courbes analytiques</translation>
+ </message>
+ <message>
+ <source>TOT_PLOT2D_NORMALIZE_MODE_LMAX</source>
+ <translation>Axe Y gauche: Normaliser sur le maximum global</translation>
+ </message>
+ <message>
+ <source>TOT_PLOT2D_NORMALIZE_MODE_LMIN</source>
+ <translation>Axe Y gauche: Normaliser sur le minimum global</translation>
+ </message>
+ <message>
+ <source>TOT_PLOT2D_NORMALIZE_MODE_RMAX</source>
+ <translation>Axe Y droite: Normaliser sur le maximum global</translation>
+ </message>
+ <message>
+ <source>TOT_PLOT2D_NORMALIZE_MODE_RMIN</source>
+ <translation>Axe Y droite: Normaliser sur le minimum global</translation>
+ </message>
+ <message>
+ <source>PLOT2D_CURVE_TYPE_LINES</source>
+ <translation>Lignes</translation>
+ </message>
+ <message>
+ <source>MEN_PLOT2D_CURVES_SPLINES</source>
+ <translation>Dessiner les splines</translation>
+ </message>
+ <message>
+ <source>PRP_PLOT2D_MODE_LOGARITHMIC_HOR</source>
+ <translation>Changer la vue de l'axe horizontal au mode d'échelle logarithmique</translation>
+ </message>
+ <message>
+ <source>PRP_PLOT2D_MODE_LOGARITHMIC_VER</source>
+ <translation>Changer la vue de l'axe vertical au mode d'échelle logarithmique</translation>
+ </message>
+ <message>
+ <source>PLOT2D_IMAGE_FILES</source>
+ <translation>Fichiers images (*.bmp *.png *.jpg *.jpeg)</translation>
+ </message>
+ <message>
+ <source>PLOT2D_MAX_INTERVALS</source>
+ <translation>Intervalles max</translation>
+ </message>
+ <message>
+ <source>INF_AXES_Y_LEFT</source>
+ <translation>Axe Y gauche</translation>
+ </message>
+ <message>
+ <source>CURVE_COLOR_LAB</source>
+ <translation>Couleur:</translation>
+ </message>
+ <message>
+ <source>CURVE_PREVIEW_LAB</source>
+ <translation>Prévisualiser</translation>
+ </message>
+ <message>
+ <source>DIAMOND_MARKER_LBL</source>
+ <translation>Diamant</translation>
+ </message>
+ <message>
+ <source>PLOT2D_LEGEND_POSITION_TOP</source>
+ <translation>Dessus</translation>
+ </message>
+ <message>
+ <source>TOT_PLOT2D_CHANGE_BACKGROUND</source>
+ <translation>Changer l'arrière-plan</translation>
+ </message>
+ <message>
+ <source>MEN_PLOT2D_CHANGE_BACKGROUND</source>
+ <translation>Changer l'arrière-plan...</translation>
+ </message>
+ <message>
+ <source>PRP_PLOT2D_CHANGE_BACKGROUND</source>
+ <translation>Changer la couleur d'arrière plan</translation>
+ </message>
+ <message>
+ <source>SOLID_LINE_LBL</source>
+ <translation>Solide</translation>
+ </message>
+ <message>
+ <source>PLOT2D_GRID_ENABLE_VER_MAJOR</source>
+ <translation>Verticale principale</translation>
+ </message>
+ <message>
+ <source>PLOT2D_GRID_ENABLE_HOR_MAJOR</source>
+ <translation>Horizontale principale</translation>
+ </message>
+ <message>
+ <source>PLOT2D_GRID_ENABLE_VER_MINOR</source>
+ <translation>Verticale secondaire</translation>
+ </message>
+ <message>
+ <source>TOT_PLOT2D_CURVES_POINTS</source>
+ <translation>Dessiner des points</translation>
+ </message>
+ <message>
+ <source>PLOT2D_GRID_ENABLE_HOR_MINOR</source>
+ <translation>Horizontale secondaire</translation>
+ </message>
+ <message>
+ <source>PLOT2D_BACKGROUND_COLOR_LBL</source>
+ <translation>Couleur d'arrière-plan:</translation>
+ </message>
+ <message>
+ <source>PLOT2D_DEVIATION_MARKER_TLT</source>
+ <translation>Marqueur de déviation</translation>
+ </message>
+ <message>
+ <source>PLOT2D_DEVIATION_LW_LBL</source>
+ <translation>Epaisseur de ligne</translation>
+ </message>
+ <message>
+ <source>PLOT2D_DEVIATION_TS_LBL</source>
+ <translation>Taille des coches</translation>
+ </message>
+ <message>
+ <source>PLOT2D_DEVIATION_CL_LBL</source>
+ <translation>Couleur</translation>
+ </message>
+ <message>
+ <source>WRN_XLOG_NOT_ALLOWED</source>
+ <translation>On a détecté des points avec les valeurs non-positives sur l'abscisse.
+L'échelle logarithmique de l'abscisse n'est pas permise.</translation>
+ </message>
+ <message>
+ <source>WRN_YLOG_NOT_ALLOWED</source>
+ <translation>On a détecté des points avec les valeurs non-positives sur l'ordonnée.
+L'échelle logarithmique de l'ordonnée n'est pas permise.</translation>
+ </message>
+ <message>
+ <source>DSC_FITRECT</source>
+ <translation>Ajuster la scène à la zone choisie par l'encadré</translation>
+ </message>
+ <message>
+ <source>PLOT2D_LEGEND_POSITION_LEFT</source>
+ <translation>Gauche</translation>
+ </message>
+ <message>
+ <source>MNU_FITRECT</source>
+ <translation>Afficher la zone</translation>
+ </message>
+ <message>
+ <source>DOT_LINE_LBL</source>
+ <translation>Point</translation>
+ </message>
+ <message>
+ <source>MEN_PLOT2D_CURVES_POINTS</source>
+ <translation>Dessiner les points</translation>
+ </message>
+ <message>
+ <source>PRP_PLOT2D_CURVES_POINTS</source>
+ <translation>Changer la vue en mode points</translation>
+ </message>
+ <message>
+ <source>PLOT2D_SCALE_MODE_LOGARITHMIC</source>
+ <translation>Logarithmique</translation>
+ </message>
+ <message>
+ <source>PLOT2D_LEGEND_POSITION_RIGHT</source>
+ <translation>Droite</translation>
+ </message>
+ <message>
+ <source>DSC_DUMP_VIEW</source>
+ <translation>Sauvegarder la vue actuelle dans un fichier image</translation>
+ </message>
+ <message>
+ <source>WARNING</source>
+ <translation>Avertissement</translation>
+ </message>
+ <message>
+ <source>PLOT2D_ENABLE_LEGEND</source>
+ <translation>Afficher la légende</translation>
+ </message>
+ <message>
+ <source>PLOT2D_LEGEND_FONT</source>
+ <translation>Police de la légende</translation>
+ </message>
+ <message>
+ <source>DSC_ZOOM_VIEW</source>
+ <translation>Zoomer la vue</translation>
+ </message>
+ <message>
+ <source>PRP_PLOT2D_ANALYTICAL_CURVES</source>
+ <translation>Réglage des propriétés des courbes analytiques</translation>
+ </message>
+ <message>
+ <source>PRP_PLOT2D_NORMALIZE_MODE_LMAX</source>
+ <translation>Bascule la vue vers le mode de normalisation sur le maximum pour l'axe Y gauche</translation>
+ </message>
+ <message>
+ <source>PRP_PLOT2D_NORMALIZE_MODE_LMIN</source>
+ <translation>Bascule la vue vers le mode de normalisation sur le minimum pour l'axe Y gauche</translation>
+ </message>
+ <message>
+ <source>PRP_PLOT2D_NORMALIZE_MODE_RMAX</source>
+ <translation>Bascule la vue vers le mode de normalisation sur le maximum pour l'axe Y droite</translation>
+ </message>
+ <message>
+ <source>PRP_PLOT2D_NORMALIZE_MODE_RMIN</source>
+ <translation>Bascule la vue vers le mode de normalisation sur le minimum pour l'axe Y droite</translation>
+ </message>
+ <message>
+ <source>PRP_PLOT2D_SETTINGS</source>
+ <translation>Définit les paramètres de visualisation</translation>
+ </message>
+ <message>
+ <source>INF_COORDINATES_SOME_Y</source>
+ <translation>Coordonnées: X : %1, Y : %2 ( %3 )</translation>
+ </message>
+ <message>
+ <source>SCALING_POPUP</source>
+ <translation>Echelle</translation>
+ </message>
+ <message>
+ <source>PLOT2D_SCALE_MODE_LINEAR</source>
+ <translation>Linéaire</translation>
+ </message>
+ <message>
+ <source>TOT_PLOT2D_FITDATA</source>
+ <translation>Ajuster à l'intervalle</translation>
+ </message>
+ <message>
+ <source>PLOT2D_CURVE_TYPE_POINTS</source>
+ <translation>Points</translation>
+ </message>
+ <message>
+ <source>PLOT2D_CURVE_TYPE_SPLINE</source>
+ <translation>Spline</translation>
+ </message>
+ <message>
+ <source>MEN_PLOT2D_FITDATA</source>
+ <translation>&Ajuster à l'intervalle</translation>
+ </message>
+ <message>
+ <source>MEN_PLOT2D_MODE_LOGARITHMIC_HOR</source>
+ <translation>Axe horizontal: logarithmique</translation>
+ </message>
+ <message>
+ <source>MEN_PLOT2D_MODE_LOGARITHMIC_VER</source>
+ <translation>Axe vertical: logarithmique</translation>
+ </message>
+ <message>
+ <source>MEN_PLOT2D_NORMALIZE_MODE_LMIN</source>
+ <translation>Axe Y gauche: Minimum</translation>
+ </message>
+ <message>
+ <source>MEN_PLOT2D_NORMALIZE_MODE_LMAX</source>
+ <translation>Axe Y gauche: Maximum</translation>
+ </message>
+ <message>
+ <source>MEN_PLOT2D_NORMALIZE_MODE_RMIN</source>
+ <translation>Axe Y droite: Minimum</translation>
+ </message>
+ <message>
+ <source>MEN_PLOT2D_NORMALIZE_MODE_RMAX</source>
+ <translation>Axe Y droite: Maximum</translation>
+ </message>
+ <message>
+ <source>PRP_PLOT2D_FITDATA</source>
+ <translation>Ajuster la vue à la plage de données indiquée</translation>
+ </message>
+ <message>
+ <source>MEN_PLOT2D_MODE_LINEAR_VER</source>
+ <translation>Axe vertical: linéaire</translation>
+ </message>
+ <message>
+ <source>MEN_PLOT2D_MODE_LINEAR_HOR</source>
+ <translation>Axe horizontal: linéaire</translation>
+ </message>
+ <message>
+ <source>NONE_MARKER_LBL</source>
+ <translation>Aucun</translation>
+ </message>
+ <message>
+ <source>ERR_DOC_CANT_SAVE_FILE</source>
+ <translation>Impossible de sauvegarder le fichier</translation>
+ </message>
+ <message>
+ <source>MEN_PLOT2D_SHOW_LEGEND</source>
+ <translation>Afficher la &légende</translation>
+ </message>
+ <message>
+ <source>PRP_PLOT2D_SHOW_LEGEND</source>
+ <translation>Activer/désactiver la légende</translation>
+ </message>
+ <message>
+ <source>TOT_PLOT2D_SHOW_LEGEND</source>
+ <translation>Afficher la légende</translation>
+ </message>
+ <message>
+ <source>INF_AXES_Y_RIGHT</source>
+ <translation>Axe Y droite</translation>
+ </message>
+ <message>
+ <source>DAHSDOTDOT_LINE_LBL</source>
+ <translation>TiretPointPoint</translation>
+ </message>
+ <message>
+ <source>TOT_PLOT2D_CURVES_SPLINES</source>
+ <translation>Dessiner des splines</translation>
+ </message>
+ <message>
+ <source>CURVE_MARKER_TYPE_LAB</source>
+ <translation>Type de marqueur:</translation>
+ </message>
+ <message>
+ <source>MEN_PLOT2D_SETTINGS</source>
+ <translation>&Paramètres</translation>
+ </message>
+ <message>
+ <source>MEN_PLOT2D_ANALYTICAL_CURVES</source>
+ <translation>Courbes analytiques</translation>
+ </message>
+ <message>
+ <source>CIRCLE_MARKER_LBL</source>
+ <translation>Cercle</translation>
+ </message>
+ <message>
+ <source>LBL_TOOLBAR_LABEL</source>
+ <translation>Opérations de visualisation</translation>
+ </message>
+ <message>
+ <source>NONE_LINE_LBL</source>
+ <translation>Aucun</translation>
+ </message>
+ <message>
+ <source>PLOT2D_MARKER_SIZE_LBL</source>
+ <translation>Taille du marqueur:</translation>
+ </message>
+ <message>
+ <source>PLOT2D_ENABLE_MAIN_TITLE</source>
+ <translation>Titre principal</translation>
+ </message>
+ <message>
+ <source>TOT_PLOT2D_CURVES_LINES</source>
+ <translation>Dessiner des lignes</translation>
+ </message>
+ <message>
+ <source>PRP_PLOT2D_CURVES_LINES</source>
+ <translation>Changer la vue en mode lignes</translation>
+ </message>
+ <message>
+ <source>MEN_PLOT2D_CURVES_LINES</source>
+ <translation>Dessiner les lignes</translation>
+ </message>
+</context>
+<context>
+ <name>Plot2d_FitDataDlg</name>
+ <message>
+ <source>FIT_HORIZONTAL</source>
+ <translation>Ajuster horizontalement</translation>
+ </message>
+ <message>
+ <source>MIN_VALUE_LAB</source>
+ <translation>Min:</translation>
+ </message>
+ <message>
+ <source>VERTICAL_AXIS</source>
+ <translation>Axe vertical</translation>
+ </message>
+ <message>
+ <source>MAX_VALUE_LAB</source>
+ <translation>Max:</translation>
+ </message>
+ <message>
+ <source>HORIZONTAL_AXIS</source>
+ <translation>Axe horizontal</translation>
+ </message>
+ <message>
+ <source>VERTICAL_LEFT_AXIS</source>
+ <translation>Axe vertical gauche</translation>
+ </message>
+ <message>
+ <source>FIT_ALL</source>
+ <translation>Tout ajuster</translation>
+ </message>
+ <message>
+ <source>VERTICAL_RIGHT_AXIS</source>
+ <translation>Axe vertical droite</translation>
+ </message>
+ <message>
+ <source>FIT_VERTICAL</source>
+ <translation>Ajuster verticalement</translation>
+ </message>
+</context>
+<context>
+ <name>Plot2d_ViewManager</name>
+ <message>
+ <source>PLOT2D_VIEW_TITLE</source>
+ <translation>Scène Plot2d:%M - visualiseur:%V</translation>
+ </message>
+ <message>
+ <source>PREF_GROUP_PLOT2DVIEWER</source>
+ <translation>Visualiseur Plot2d</translation>
+ </message>
+ <message>
+ <source>PREF_SHOW_LEGEND</source>
+ <translation>Afficher la légende</translation>
+ </message>
+ <message>
+ <source>PREF_LEGEND_POSITION</source>
+ <translation>Position de la légende:</translation>
+ </message>
+ <message>
+ <source>PREF_LEFT</source>
+ <translation>Gauche</translation>
+ </message>
+ <message>
+ <source>PREF_RIGHT</source>
+ <translation>Droite</translation>
+ </message>
+ <message>
+ <source>PREF_TOP</source>
+ <translation>Haut</translation>
+ </message>
+ <message>
+ <source>PREF_BOTTOM</source>
+ <translation>Bas</translation>
+ </message>
+ <message>
+ <source>PREF_CURVE_TYPE</source>
+ <translation>Type de courbe:</translation>
+ </message>
+ <message>
+ <source>PREF_POINTS</source>
+ <translation>Points</translation>
+ </message>
+ <message>
+ <source>PREF_LINES</source>
+ <translation>Lignes</translation>
+ </message>
+ <message>
+ <source>PREF_SPLINE</source>
+ <translation>Spline</translation>
+ </message>
+ <message>
+ <source>PREF_MARKER_SIZE</source>
+ <translation>Taille du repère:</translation>
+ </message>
+ <message>
+ <source>PREF_LINEAR</source>
+ <translation>Linéaire</translation>
+ </message>
+ <message>
+ <source>PREF_LOGARITHMIC</source>
+ <translation>Logarithmique</translation>
+ </message>
+ <message>
+ <source>PREF_HOR_AXIS_SCALE</source>
+ <translation>Echelle de l'axe horizontal:</translation>
+ </message>
+ <message>
+ <source>PREF_VERT_AXIS_SCALE</source>
+ <translation>Echelle de l'axe vertical:</translation>
+ </message>
+ <message>
+ <source>PREF_VIEWER_BACKGROUND</source>
+ <translation>Couleur du fond</translation>
+ </message>
+</context>
+<context>
+ <name>Plot2d_AnalyticalCurveDlg</name>
+ <message>
+ <source>ANALYTICAL_CURVE_TLT</source>
+ <translation>Propriétés des courbes analytiques</translation>
+ </message>
+ <message>
+ <source>AC_CURVE_PARAMS</source>
+ <translation>Paramètres de la courbe</translation>
+ </message>
+ <message>
+ <source>AC_CURVE_PROPS</source>
+ <translation>Propriétés de la courbe</translation>
+ </message>
+ <message>
+ <source>AC_FORMULA</source>
+ <translation>y(x) = </translation>
+ </message>
+ <message>
+ <source>AC_NB_INTERVALS</source>
+ <translation>Nb. intervalles</translation>
+ </message>
+ <message>
+ <source>AC_AUTO_ASSIGN</source>
+ <translation>Affectation auto.</translation>
+ </message>
+ <message>
+ <source>AC_MARKER_TYPE</source>
+ <translation>Type de marqueur</translation>
+ </message>
+ <message>
+ <source>AC_LINE_TYPE</source>
+ <translation>Type de ligne</translation>
+ </message>
+ <message>
+ <source>AC_LINE_WIDTH</source>
+ <translation>Epaisseur de ligne</translation>
+ </message>
+ <message>
+ <source>AC_CURVE_COLOR</source>
+ <translation>Couleur de la courbe</translation>
+ </message>
+ <message>
+ <source>AC_ADD_BTN</source>
+ <translation>Ajouter une courbe</translation>
+ </message>
+ <message>
+ <source>AC_REM_BTN</source>
+ <translation>Supprimer une courbe</translation>
+ </message>
+ <message>
+ <source>AC_UPD_BTN</source>
+ <translation>Mettre à jour la courbe</translation>
+ </message>
+ <message>
+ <source>AC_APPLY_BTN</source>
+ <translation>Appliquer</translation>
+ </message>
+ <message>
+ <source>AC_CANT_CALCULATE</source>
+ <translation>La courbe ne peut pas être calculée.
+Merci de vérifier les paramètres d'entrée</translation>
+ </message>
+ <message>
+ <source>AC_CLOSE_BTN</source>
+ <translation>&Fermer</translation>
+ </message>
+ <message>
+ <source>AC_HELP_BTN</source>
+ <translation>Aide</translation>
+ </message>
+</context>
+<context>
+ <name>Plot2d_SetupCurveScaleDlg</name>
+ <message>
+ <source>TLT_SETUP_CURVE_SCALE</source>
+ <translation>Mise à l'échelle de courbe(s)</translation>
+ </message>
+ <message>
+ <source>CURVE_SCALE_FACTOR</source>
+ <translation>Facteur d'échelle</translation>
+ </message>
+</context>
+</TS>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="fr_FR">
+<context>
+ <name>PyConsole_Console</name>
+ <message>
+ <location filename="../PyConsole_Console.cxx" line="216"/>
+ <source>EDIT_COPY_CMD</source>
+ <translation>&Copier</translation>
+ </message>
+ <message>
+ <location filename="../PyConsole_Console.cxx" line="221"/>
+ <source>EDIT_PASTE_CMD</source>
+ <translation>C&oller</translation>
+ </message>
+ <message>
+ <location filename="../PyConsole_Console.cxx" line="226"/>
+ <source>EDIT_CLEAR_CMD</source>
+ <translation>&Effacer</translation>
+ </message>
+ <message>
+ <location filename="../PyConsole_Console.cxx" line="231"/>
+ <source>EDIT_SELECTALL_CMD</source>
+ <translation>&Tout sélectionner</translation>
+ </message>
+ <message>
+ <source>EDIT_DUMPCOMMANDS_CMD</source>
+ <translation>&Générer le script des commandes</translation>
+ </message>
+</context>
+<context>
+ <name>PyConsole_Editor</name>
+ <message>
+ <source>TOT_DUMP_PYCOMMANDS</source>
+ <translation>&Générer le script des commandes</translation>
+ </message>
+ <message>
+ <source>PYTHON_FILES_FILTER</source>
+ <translation>Fichiers PYTHON (*.py)</translation>
+ </message>
+</context>
+</TS>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="fr_FR">
+<context>
+ <name>QDS_Datum</name>
+ <message>
+ <source>DATA_ERR_TITLE</source>
+ <translation>Valeur du paramètre incorrecte</translation>
+ </message>
+ <message>
+ <source>DATA_STRING</source>
+ <translation> chaîne de caractères non-vide</translation>
+ </message>
+ <message>
+ <source>DATA_NON_EMPTY</source>
+ <translation> non-vide</translation>
+ </message>
+ <message>
+ <source>DATA_MIN_LIMIT</source>
+ <translation> est supérieur à %1</translation>
+ </message>
+ <message>
+ <source>DATA_FLOAT</source>
+ <translation> réel</translation>
+ </message>
+ <message>
+ <source>DATA_RANGE</source>
+ <translation> dans l'intervalle [%1, %2]</translation>
+ </message>
+ <message>
+ <source>DATA_SHOULD_BE_VALUE</source>
+ <translation>Devrait avoir la valeur %1</translation>
+ </message>
+ <message>
+ <source>DATA_INTEGER</source>
+ <translation> entier</translation>
+ </message>
+ <message>
+ <source>DATA_INCORRECT_VALUE</source>
+ <translation>La valeur du paramètre "%1" n'est pas correcte.</translation>
+ </message>
+ <message>
+ <source>DATA_MAX_LIMIT</source>
+ <translation> est inférieur à %1</translation>
+ </message>
+ <message>
+ <source>DATA_INPUT_VALUE</source>
+ <translation>Indiquez une valeur correcte.</translation>
+ </message>
+</context>
+</TS>
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// File: QtxBackgroundTool.cxx
+// Author: Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
+
+#include "QtxBackgroundTool.h"
+#include "QtxColorButton.h"
+
+#include <QCheckBox>
+#include <QComboBox>
+#include <QFileDialog>
+#include <QHBoxLayout>
+#include <QLabel>
+#include <QLineEdit>
+#include <QPushButton>
+#include <QStackedWidget>
+#include <QVBoxLayout>
+
+
+/*!
+ \class QtxBackgroundTool
+ \brief Implementation of the widget managing background data
+
+ The background data can be specified as:
+ - image (by assigning the file name to be used as background texture)
+ - single color (by assigning any color)
+ - simple two-color gradient (with the gradient type id and two colors)
+ - complex gradient (by assigning arbitrary gradient data) (NOT IMPLEMENTED YET)
+
+ To enable / disable any background type, setModeAllowed() function can be used.
+ Widget's orientation can be specified via the constructor parameter of changed with
+ setOrientation() function.
+
+ To specify two-color gradient modes, use setGradient() function. By default, no gradient modes
+ are provided by the widget.
+
+ Arbitrary gradient mode is not implemented yet, it is remaining for future improvement.
+
+ Typical usage can be as follows:
+ \code
+ // create tool widget
+ QtxBackgroundTool* tool = new QtxBackgroundTool( Qt::Vertical, this );
+ // assign gradients types
+ QStringList sl;
+ sl << "Horizontal" << "Vertical" << "First diagonal" << "Second diagonal";
+ tool->setGradients(sl);
+ // disable image texture and custom gradient modes
+ tool->setModeAllowed(Qtx::ImageBackground, false);
+ tool->setModeAllowed(Qtx::CustomGradientBackground, false);
+ // initialize widget with the some background data
+ tool->setData( bgData );
+ \endcode
+
+ \todo Complete support of custom gradient (QLinearGradient, QRadialGradient, QConicalGradient).
+ \sa Qtx::BackgroundData, QtxBackgroundDialog, Qtx::stringToBackground(), Qtx::backgroundToString()
+*/
+
+/*!
+ \brief Constructor.
+
+ Creates a background data widget with horizontal orientation.
+
+ \param parent parent widget
+*/
+QtxBackgroundTool::QtxBackgroundTool( QWidget* parent )
+ : QWidget( parent ), myTextureAllowed( true ), myLastGradient( -1 )
+{
+ init( Qt::Horizontal );
+}
+
+/*!
+ \brief Constructor.
+
+ Creates a background data widget with specified orientation.
+
+ \param o widget orientation
+ \param parent parent widget
+*/
+QtxBackgroundTool::QtxBackgroundTool( Qt::Orientation o, QWidget* parent )
+ : QWidget( parent ), myTextureAllowed( true ), myLastGradient( -1 )
+{
+ init( o );
+}
+
+/*!
+ \brief Perform internal initialization
+*/
+void QtxBackgroundTool::init( Qt::Orientation o )
+{
+ // mode combo box
+ myModeCombo = new QComboBox( this );
+ // color / gradient sub-widgets container
+ myCContainer = new QStackedWidget( this );
+ // texture sub-widgets container
+ myTContainer = new QWidget( this );
+
+ QWidget* wrap;
+ QHBoxLayout* wrapLayout;
+
+ // add image controls
+ wrapLayout = new QHBoxLayout( myTContainer );
+ wrapLayout->setMargin( 0 );
+ wrapLayout->setSpacing( 5 );
+ myTextureCheck = new QCheckBox( tr( "Image" ), myTContainer );
+ myFileName = new QLineEdit( myTContainer );
+ myFileName->setMinimumWidth(100);
+ myBrowseBtn = new QPushButton( tr( "Browse..." ), myTContainer );
+ myTextureMode = new QComboBox( myTContainer );
+ wrapLayout->addWidget( myTextureCheck );
+ wrapLayout->addWidget( myFileName );
+ wrapLayout->addWidget( myBrowseBtn );
+ wrapLayout->addWidget( myTextureMode );
+ wrapLayout->setStretchFactor(myFileName, 10);
+ // add color controls
+ wrap = new QWidget( this );
+ wrapLayout = new QHBoxLayout( wrap );
+ wrapLayout->setMargin( 0 );
+ wrapLayout->setSpacing( 5 );
+ myFirstColor = new QtxColorButton( wrap );
+ mySecondColor = new QtxColorButton( wrap );
+ wrapLayout->addWidget( myFirstColor );
+ wrapLayout->addWidget( mySecondColor );
+ wrapLayout->setStretchFactor(myFirstColor, 5);
+ wrapLayout->setStretchFactor(mySecondColor, 5);
+ myCContainer->addWidget( wrap ); // Color
+ // add gradient controls ... NOT IMPLEMENTED YET
+ wrap = new QWidget( this );
+ wrapLayout = new QHBoxLayout( wrap );
+ wrapLayout->setMargin( 0 );
+ wrapLayout->setSpacing( 5 );
+ QLabel* foo = new QLabel( tr( "Not implemented yet" ), wrap );
+ foo->setAlignment( Qt::AlignCenter );
+ wrapLayout->addWidget( foo );
+ myCContainer->addWidget( wrap ); // Gradient
+
+ // initialize widget
+ myFirstColor->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
+ mySecondColor->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
+
+ connect( myModeCombo, SIGNAL( currentIndexChanged( int ) ), this, SLOT( updateState() ) );
+ connect( myTextureCheck, SIGNAL( toggled( bool ) ), this, SLOT( updateState() ) );
+ connect( myBrowseBtn, SIGNAL( clicked() ), this, SLOT( browse() ) );
+
+ setModeAllowed( Qtx::ColorBackground );
+ setModeAllowed( Qtx::SimpleGradientBackground );
+ setModeAllowed( Qtx::CustomGradientBackground );
+ setTextureModeAllowed( Qtx::CenterTexture );
+ setTextureModeAllowed( Qtx::TileTexture );
+ setTextureModeAllowed( Qtx::StretchTexture );
+ setTextureAllowed();
+ setImageFormats( QString() );
+ setOrientation( o );
+}
+
+/*!
+ \brief Destructor.
+*/
+QtxBackgroundTool::~QtxBackgroundTool()
+{
+}
+
+/*!
+ \brief Get background data from the widget
+ \return background data
+ \sa setData()
+*/
+Qtx::BackgroundData QtxBackgroundTool::data() const
+{
+ Qtx::BackgroundData bgData;
+ int idx = myModeCombo->currentIndex();
+ if ( idx != -1 ) {
+ // get currently selected mode
+ int id = myModeCombo->itemData( idx, TypeRole ).toInt();
+ // texture data
+ if ( isTextureAllowed() && myTextureMode->currentIndex() != -1 ) {
+ bgData.setTexture( myFileName->text().trimmed(),
+ Qtx::TextureMode( myTextureMode->itemData( myTextureMode->currentIndex() ).toInt() ) );
+ bgData.setTextureShown( myTextureCheck->isChecked() );
+ }
+ // single-color data
+ if ( isModeAllowed( Qtx::ColorBackground ) ) {
+ bgData.setColor( myFirstColor->color() );
+ }
+ // simple two-color gradient data
+ if ( isModeAllowed( Qtx::SimpleGradientBackground ) ) {
+ bgData.setGradient( myLastGradient, myFirstColor->color(), mySecondColor->color() );
+ }
+ // custom gradient data
+ if ( isModeAllowed( Qtx::CustomGradientBackground ) ) {
+ // bgData.setGradient( ... );
+ // NOT IMPLEMENTED YET
+ }
+
+ // set current mode
+ bgData.setMode( Qtx::BackgroundMode( id ) );
+ }
+ return bgData;
+}
+
+/*!
+ \brief Set background data from the widget
+ \param bgData background data being set to the widget
+ \sa data()
+*/
+void QtxBackgroundTool::setData( const Qtx::BackgroundData& bgData )
+{
+ Qtx::BackgroundMode m = bgData.mode();
+ QColor c1, c2;
+ int gtype = bgData.gradient( c1, c2 );
+ QString fileName;
+ int tmode = bgData.texture( fileName );
+ bool tshown = bgData.isTextureShown();
+
+ // texture data
+ myFileName->setText( fileName );
+ for ( int i = 0; i < myTextureMode->count(); i++ ) {
+ if ( myTextureMode->itemData( i ).toInt() == tmode ) {
+ myTextureMode->setCurrentIndex( i );
+ break;
+ }
+ }
+ myTextureCheck->setChecked( tshown );
+
+ // color / simple gradient data
+ myFirstColor->setColor( c1 );
+ mySecondColor->setColor( c2 );
+
+ // gradient data
+ // ... NOT IMPLEMENTED YET
+
+ // set current mode index
+ int idx = -1;
+ for ( int i = 0; i < myModeCombo->count() && idx == -1; i++ ) {
+ int im = myModeCombo->itemData( i, TypeRole ).toInt();
+ // for simple gradient mode we also check gradient type
+ if ( m == Qtx::SimpleGradientBackground && im == Qtx::SimpleGradientBackground ) {
+ int it = myModeCombo->itemData( i, IdRole ).toInt();
+ if ( it == gtype ) idx = i;
+ }
+ // for other modes we just check mode itself
+ else if ( im == m ) {
+ idx = i;
+ }
+ }
+ // if background data is invalid, we set-up widget to the first available type
+ if ( idx == -1 && myModeCombo->count() > 0 ) idx = 0;
+ myModeCombo->setCurrentIndex( idx );
+}
+
+/*!
+ \brief Get allowed two-color gradients to the widget
+ \param gradients gradients names are returned via this parameter
+ \param ids gradients identifiers are returned via this parameter (empty list can be returned)
+*/
+void QtxBackgroundTool::gradients( QStringList& gradList, QIntList& idList ) const
+{
+ gradList = myGradients;
+ idList = myGradientsIds;
+}
+
+/*!
+ \brief Set allowed two-color gradients to the widget
+ \param gradients gradients names
+ \param ids optional gradients identifiers; if not specified, gradients are automatically numbered starting from 0
+*/
+void QtxBackgroundTool::setGradients( const QStringList& gradList, const QIntList& idList )
+{
+ Qtx::BackgroundData d = data(); // get current state
+ myGradients = gradList; // store new gradient data
+ myGradientsIds = idList; // ...
+ myLastGradient = -1; // ...
+ internalUpdate(); // re-initialize
+ setData( d ); // restore current state (if possible)
+}
+
+/*!
+ \brief Check if specific background mode is allowed
+ \param mode background mode
+ \return \c true if specified background mode is enabled or \c false otherwise
+ \sa setModeAllowed()
+*/
+bool QtxBackgroundTool::isModeAllowed( Qtx::BackgroundMode mode ) const
+{
+ return myTypesAllowed.contains( mode ) ? myTypesAllowed[ mode ] : false;
+}
+
+/*!
+ \brief Enable / disable specific background mode
+ \param mode background mode
+ \param on enable / disable flag (\c true by default)
+ \sa isModeAllowed()
+*/
+void QtxBackgroundTool::setModeAllowed( Qtx::BackgroundMode mode, bool on )
+{
+ if ( mode == Qtx::CustomGradientBackground )
+ return; // NOT IMPLEMENTED YET //
+
+ if ( isModeAllowed( mode ) != on ) {
+ Qtx::BackgroundData d = data(); // get current state
+ myTypesAllowed[ mode ] = on; // store new background mode state
+ internalUpdate(); // re-initialize
+ setData( d ); // restore current state (if possible)
+ }
+}
+
+/*!
+ \brief Check if specific texture mode is allowed
+ \param mode texture mode
+ \return \c true if specified texture mode is enabled or \c false otherwise
+ \sa setTextureModeAllowed(), setTextureAllowed()
+*/
+bool QtxBackgroundTool::isTextureModeAllowed( Qtx::TextureMode mode ) const
+{
+ return myTextureTypesAllowed.contains( mode ) ? myTextureTypesAllowed[ mode ] : false;
+}
+
+/*!
+ \brief Enable / disable specific texture mode
+ \param mode texture mode
+ \param on enable / disable flag (\c true by default)
+ \sa isTextureModeAllowed(), setTextureAllowed()
+*/
+void QtxBackgroundTool::setTextureModeAllowed( Qtx::TextureMode mode, bool on )
+{
+ if ( isTextureModeAllowed( mode ) != on ) {
+ Qtx::BackgroundData d = data(); // get current state
+ myTextureTypesAllowed[ mode ] = on; // store new texture mode
+ internalUpdate(); // re-initialize
+ setData( d ); // restore current state (if possible)
+ }
+}
+
+/*!
+ \brief Check if texture controls are allowed (shown)
+ \return \c true if texture controls are enabled or \c false otherwise
+ \sa setTextureAllowed(), setTextureModeAllowed()
+*/
+bool QtxBackgroundTool::isTextureAllowed() const
+{
+ return myTextureAllowed;
+}
+
+/*!
+ \brief Enable / disable texture controls
+ \param on enable / disable flag (\c true by default)
+ \sa isTextureAllowed(), setTextureModeAllowed()
+*/
+void QtxBackgroundTool::setTextureAllowed( bool on )
+{
+ if ( myTextureAllowed != on ) {
+ myTextureAllowed = on;
+ setOrientation( orientation() );
+ }
+}
+
+/*!
+ \brief Get allowed image formats
+ \return image formats
+ \sa setImageFormats()
+*/
+QString QtxBackgroundTool::imageFormats() const
+{
+ return myImageFormats;
+}
+
+/*!
+ \brief Set allowed image formats
+ \param formats image formats
+ \sa imageFormats()
+*/
+void QtxBackgroundTool::setImageFormats( const QString& formats )
+{
+ myImageFormats = formats.isEmpty() ? tr( "Images Files (*.bmp *.png *.jpg *.jpeg *.gif *.tiff)" ) : formats;
+}
+
+/*!
+ \brief Get widget editor orientation
+ \return orientation
+ \sa setOrientation()
+*/
+Qt::Orientation QtxBackgroundTool::orientation() const
+{
+ return qobject_cast<QVBoxLayout*>( layout() ) ? Qt::Vertical : Qt::Horizontal;
+}
+
+/*!
+ \brief Change widget orientation
+ \param orientation new widget orientation
+ \sa orientation()
+*/
+void QtxBackgroundTool::setOrientation( Qt::Orientation orientation )
+{
+ QBoxLayout* l = (orientation == Qt::Horizontal) ? (QBoxLayout*)(new QHBoxLayout) : (QBoxLayout*)(new QVBoxLayout);
+ l->setMargin( 0 );
+ l->setSpacing( 5 );
+ l->addWidget( myModeCombo );
+ l->addWidget( myCContainer );
+ myTContainer->setVisible( isTextureAllowed() );
+ if ( isTextureAllowed() )
+ l->addWidget( myTContainer );
+ delete layout();
+ setLayout( l );
+}
+
+/*!
+ \brief Initialization: fill in the widget with items according to the
+ available modes
+*/
+void QtxBackgroundTool::internalUpdate()
+{
+ myModeCombo->clear();
+ if ( isModeAllowed( Qtx::ColorBackground ) ) {
+ myModeCombo->addItem( tr( "Single Color" ) );
+ myModeCombo->setItemData( 0, (int)Qtx::ColorBackground, TypeRole );
+ }
+ if ( isModeAllowed( Qtx::SimpleGradientBackground ) ) {
+// if ( myGradients.count() > 0 && myModeCombo->count() > 0 )
+// myModeCombo->insertSeparator( myModeCombo->count() );
+ for ( int i = 0; i < myGradients.count(); i++ ) {
+ myModeCombo->addItem( myGradients[i] );
+ int idx = myModeCombo->count()-1;
+ myModeCombo->setItemData( idx, (int)Qtx::SimpleGradientBackground, TypeRole );
+ myModeCombo->setItemData( idx, myGradientsIds.count() > i ? myGradientsIds[i] : i, IdRole );
+ }
+ }
+ if ( isModeAllowed( Qtx::CustomGradientBackground ) ) {
+// if ( myModeCombo->count() > 0 )
+// myModeCombo->insertSeparator( myModeCombo->count() );
+ myModeCombo->addItem( tr( "Custom" ) );
+ int idx = myModeCombo->count()-1;
+ myModeCombo->setItemData( idx, (int)Qtx::CustomGradientBackground, TypeRole );
+ }
+
+ myTextureMode->clear();
+ if ( isTextureModeAllowed( Qtx::CenterTexture ) )
+ myTextureMode->addItem( tr( "Center" ), Qtx::CenterTexture );
+ if ( isTextureModeAllowed( Qtx::TileTexture ) )
+ myTextureMode->addItem( tr( "Tile" ), Qtx::TileTexture );
+ if ( isTextureModeAllowed( Qtx::StretchTexture ) )
+ myTextureMode->addItem( tr( "Stretch" ), Qtx::StretchTexture );
+
+ updateState();
+}
+
+/*!
+ \brief Update widget state
+*/
+void QtxBackgroundTool::updateState()
+{
+ int idx = myModeCombo->currentIndex();
+ int id = -1;
+ if ( idx >= 0 ) {
+ id = myModeCombo->itemData( idx, TypeRole ).toInt();
+ switch( id ) {
+ case Qtx::ColorBackground:
+ myCContainer->setCurrentIndex( Color );
+ break;
+ case Qtx::SimpleGradientBackground:
+ myCContainer->setCurrentIndex( Color );
+ myLastGradient = myModeCombo->itemData( idx, IdRole ).toInt();
+ break;
+ case Qtx::CustomGradientBackground:
+ myCContainer->setCurrentIndex( Gradient );
+ break;
+ }
+ }
+ myModeCombo->setEnabled( idx >= 0 );
+ myCContainer->setEnabled( idx >= 0 );
+ mySecondColor->setEnabled( id == Qtx::SimpleGradientBackground );
+ myTContainer->setEnabled( idx >= 0 );
+ myFileName->setEnabled( myTextureCheck->isChecked() );
+ myBrowseBtn->setEnabled( myTextureCheck->isChecked() );
+ myTextureMode->setEnabled( myTextureCheck->isChecked() );
+}
+
+/*!
+ \brief Called when "Browse..." button is pressed
+*/
+void QtxBackgroundTool::browse()
+{
+ QString fileName = QFileDialog::getOpenFileName( this, tr( "Select Picture" ), myFileName->text().trimmed(), myImageFormats );
+ if ( !fileName.isEmpty() )
+ myFileName->setText( fileName );
+}
+
+/*!
+ \class QtxBackgroundDialog
+ \brief Dialog box that can be used to set-up the background data
+
+ Usage example:
+ \code
+ // create dialog box
+ QtxBackgroundDialog dlg( this );
+ // assign gradients types
+ QStringList sl;
+ sl << "Horizontal" << "Vertical" << "First diagonal" << "Second diagonal";
+ dlg.setGradients(sl);
+ // disable image texture and custom gradient modes
+ dlg.setModeAllowed(Qtx::ImageBackground, false);
+ dlg.setModeAllowed(Qtx::CustomGradientBackground, false);
+ // initialize dialog box with the some background data
+ dlg.setData(backgroundData);
+ // execute dialog box and obtain result background data
+ if ( dlg.exec() ) {
+ Qtx::BackgroundData bgData = dlg.getBackgroundData();
+ }
+ \endcode
+
+ Also it is possible to use static function:
+ \code
+ Qtx::BackgroundData bgData = QtxBackgroundDialog::getBackground( this );
+ if ( bgData.isValid() )
+ doSomething( bgData );
+ \endcode
+*/
+
+/*!
+ \brief Constructor
+ \param parent parent widget
+*/
+QtxBackgroundDialog::QtxBackgroundDialog( QWidget* parent )
+ : QtxDialog( parent, true, true, OK | Cancel )
+{
+ init();
+}
+
+/*!
+ \brief Constructor
+ \param bgData initial background data
+ \param parent parent widget
+*/
+QtxBackgroundDialog::QtxBackgroundDialog( const Qtx::BackgroundData& bgData, QWidget* parent )
+ : QtxDialog( parent, true, true, OK | Cancel )
+{
+ init();
+ setData( bgData );
+}
+
+/*!
+ \brief Destructor
+*/
+QtxBackgroundDialog::~QtxBackgroundDialog()
+{
+}
+
+/*!
+ \brief Perform internal initialization
+*/
+void QtxBackgroundDialog::init()
+{
+ // title
+ setWindowTitle( tr( "Change background" ) );
+ // flags
+ setDialogFlags( SetFocus );
+ // move "Cancel" button to the right
+ setButtonPosition( Right, Cancel );
+ // set OK button to be default (activated by Enter key)
+ qobject_cast<QPushButton*>( button( OK ) )->setDefault( true );
+
+ // main layout
+ QVBoxLayout* main = new QVBoxLayout( mainFrame() );
+ main->setMargin( 0 );
+ main->setSpacing( 5 );
+
+ // background widget
+ myTool = new QtxBackgroundTool( Qt::Vertical, mainFrame() );
+ main->addWidget( myTool );
+}
+
+/*!
+ \brief Set background data
+ \param bgData background data
+*/
+void QtxBackgroundDialog::setData( const Qtx::BackgroundData& bgData )
+{
+ myTool->setData( bgData );
+}
+
+/*!
+ \brief Get background data
+ \return background data
+*/
+Qtx::BackgroundData QtxBackgroundDialog::data() const
+{
+ return myTool->data();
+}
+
+/*!
+ \brief Set allowed two-color gradients to the widget
+ \param gradients gradients names
+ \param ids optional gradients identifiers; if not specified, gradients are automatically numbered starting from 0
+*/
+void QtxBackgroundDialog::setGradients( const QStringList& gradList, const QIntList& idList )
+{
+ myTool->setGradients( gradList, idList );
+}
+
+/*!
+ \brief Enable / disable specific background mode
+ \param mode background mode
+ \param on enable / disable flag
+*/
+void QtxBackgroundDialog::setModeAllowed( Qtx::BackgroundMode mode, bool on )
+{
+ myTool->setModeAllowed( mode, on );
+}
+
+/*!
+ \brief Enable / disable texture controls
+ \param on enable / disable flag
+ \sa setTextureModeAllowed()
+*/
+void QtxBackgroundDialog::setTextureAllowed( bool on )
+{
+ myTool->setTextureAllowed( on );
+}
+
+/*!
+ \brief Enable / disable specific texture mode
+ \param mode texture mode
+ \param on enable / disable flag (\c true by default)
+ \sa setTextureAllowed()
+*/
+void QtxBackgroundDialog::setTextureModeAllowed( Qtx::TextureMode mode, bool on )
+{
+ myTool->setTextureModeAllowed( mode, on );
+}
+
+/*!
+ \brief Set allowed image formats
+ \param formats image formats
+*/
+void QtxBackgroundDialog::setImageFormats( const QString& formats )
+{
+ myTool->setImageFormats( formats );
+}
+
+/*!
+ \brief This is a convenience static function that returns an background data selected by the user.
+ If the user presses Cancel, it returns an invalid background data.
+
+ By default:
+ - all background modes are enabled
+ - texture controls are shown
+ - all texture modes are enabled
+ - simple gradient types list is empty
+ - all image formats are supported
+
+ To customize the dialog box behavior, initialize it passing the corresponding options to the function.
+
+ \param bgData initial background data
+ \param parent parent widget
+ \param enableSolidColor "enable solid colored background mode" flag
+ \param enableGradient "enable simple gradient background mode" flag
+ \param enableCustom "enable custom gradient background mode" flag
+ \param enableTexture "show texture controls" flag
+ \param gradList list of simple gradients names
+ \param idList list of simple gradients identifiers
+ \param formats image formats
+ \return resulting background data chosen by the user or invalid data if users cancels operation
+*/
+Qtx::BackgroundData QtxBackgroundDialog::getBackground( const Qtx::BackgroundData& bgData,
+ QWidget* parent,
+ bool enableSolidColor,
+ bool enableGradient,
+ bool enableCustom,
+ bool enableTexture,
+ const QStringList& gradList,
+ const QIntList& idList,
+ const QString& formats )
+{
+ QtxBackgroundDialog dlg( parent );
+ dlg.setTextureAllowed( enableTexture );
+ dlg.setModeAllowed( Qtx::ColorBackground, enableSolidColor );
+ dlg.setModeAllowed( Qtx::SimpleGradientBackground, enableGradient );
+ dlg.setModeAllowed( Qtx::CustomGradientBackground, enableCustom );
+ dlg.setGradients( gradList, idList );
+ dlg.setImageFormats( formats );
+ dlg.setData( bgData );
+ Qtx::BackgroundData res;
+ int rc = dlg.exec();
+ if ( rc ) res = dlg.data();
+ return res;
+}
+
+/*!
+ \brief This is a convenience static function that returns an background data selected by the user.
+ If the user presses Cancel, it returns an invalid background data.
+
+ By default:
+ - all background modes are enabled
+ - texture controls are shown
+ - all texture modes are disabled
+ - simple gradient types list is empty
+ - all image formats are supported
+
+ To customize the dialog box behavior, initialize it passing the corresponding options to the function.
+
+ \param bgData initial background data
+ \param parent parent widget
+ \param tmList allowed texture modes
+ \param enableSolidColor "enable solid colored background mode" flag
+ \param enableGradient "enable simple gradient background mode" flag
+ \param enableCustom "enable custom gradient background mode" flag
+ \param enableTexture "show texture controls" flag
+ \param gradList list of simple gradients names
+ \param idList list of simple gradients identifiers
+ \param formats image formats
+ \return resulting background data chosen by the user or invalid data if users cancels operation
+*/
+Qtx::BackgroundData QtxBackgroundDialog::getBackground( const Qtx::BackgroundData& bgData,
+ QWidget* parent,
+ const QIntList& tmList,
+ bool enableSolidColor,
+ bool enableGradient,
+ bool enableCustom,
+ bool enableTexture,
+ const QStringList& gradList,
+ const QIntList& idList,
+ const QString& formats )
+{
+ QtxBackgroundDialog dlg( parent );
+ dlg.setTextureAllowed( enableTexture );
+ for ( int i = Qtx::CenterTexture; i <= Qtx::StretchTexture; i++ )
+ dlg.setTextureModeAllowed( (Qtx::TextureMode)i, tmList.contains( i ) );
+ dlg.setModeAllowed( Qtx::ColorBackground, enableSolidColor );
+ dlg.setModeAllowed( Qtx::SimpleGradientBackground, enableGradient );
+ dlg.setModeAllowed( Qtx::CustomGradientBackground, enableCustom );
+ dlg.setGradients( gradList, idList );
+ dlg.setImageFormats( formats );
+ dlg.setData( bgData );
+ Qtx::BackgroundData res;
+ int rc = dlg.exec();
+ if ( rc ) res = dlg.data();
+ return res;
+}
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// File: QtxBackgroundTool.h
+// Author: Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
+
+#ifndef QTXBACKGROUNDTOOL_H
+#define QTXBACKGROUNDTOOL_H
+
+#include "Qtx.h"
+#include "QtxDialog.h"
+
+#include <QWidget>
+#include <QMap>
+
+class QCheckBox;
+class QComboBox;
+class QStackedWidget;
+class QLineEdit;
+class QPushButton;
+class QtxColorButton;
+
+class QTX_EXPORT QtxBackgroundTool : public QWidget
+{
+ enum { Color, Gradient };
+ enum { TypeRole = Qt::UserRole, IdRole };
+
+ Q_OBJECT
+
+public:
+ QtxBackgroundTool( QWidget* = 0 );
+ QtxBackgroundTool( Qt::Orientation, QWidget* = 0 );
+ virtual ~QtxBackgroundTool();
+
+ Qtx::BackgroundData data() const;
+ void setData( const Qtx::BackgroundData& );
+
+ void gradients( QStringList&, QIntList& ) const;
+ void setGradients( const QStringList&, const QIntList& = QIntList() );
+
+ bool isModeAllowed( Qtx::BackgroundMode ) const;
+ void setModeAllowed( Qtx::BackgroundMode, bool = true );
+
+ bool isTextureModeAllowed( Qtx::TextureMode ) const;
+ void setTextureModeAllowed( Qtx::TextureMode, bool = true );
+
+ bool isTextureAllowed() const;
+ void setTextureAllowed( bool = true );
+
+ QString imageFormats() const;
+ void setImageFormats( const QString& );
+
+ Qt::Orientation orientation() const;
+ void setOrientation( Qt::Orientation );
+
+private:
+ void init( Qt::Orientation );
+ void internalUpdate();
+
+private slots:
+ void updateState();
+ void browse();
+
+private:
+ QComboBox* myModeCombo;
+ QStackedWidget* myCContainer;
+ QWidget* myTContainer;
+ QCheckBox* myTextureCheck;
+ QLineEdit* myFileName;
+ QPushButton* myBrowseBtn;
+ QComboBox* myTextureMode;
+ QtxColorButton* myFirstColor;
+ QtxColorButton* mySecondColor;
+ QStringList myGradients;
+ QIntList myGradientsIds;
+ bool myTextureAllowed;
+ QMap<int, bool> myTypesAllowed;
+ QMap<int, bool> myTextureTypesAllowed;
+ QString myImageFormats;
+ int myLastGradient;
+};
+
+class QTX_EXPORT QtxBackgroundDialog : public QtxDialog
+{
+ Q_OBJECT
+
+public:
+ QtxBackgroundDialog( QWidget* = 0 );
+ QtxBackgroundDialog( const Qtx::BackgroundData&, QWidget* = 0 );
+ virtual ~QtxBackgroundDialog();
+
+ void setData( const Qtx::BackgroundData& );
+ Qtx::BackgroundData data() const;
+
+ static Qtx::BackgroundData getBackground( const Qtx::BackgroundData& = Qtx::BackgroundData(),
+ QWidget* = 0,
+ bool = true, bool = true, bool = true, bool = true,
+ const QStringList& = QStringList(),
+ const QIntList& = QIntList(),
+ const QString& = QString() );
+ static Qtx::BackgroundData getBackground( const Qtx::BackgroundData&,
+ QWidget*,
+ const QIntList&,
+ bool = true, bool = true, bool = true, bool = true,
+ const QStringList& = QStringList(),
+ const QIntList& = QIntList(),
+ const QString& = QString() );
+
+
+ void setGradients( const QStringList&, const QIntList& = QIntList() );
+ void setModeAllowed( Qtx::BackgroundMode, bool = true );
+ void setTextureAllowed( bool = true );
+ void setTextureModeAllowed( Qtx::TextureMode, bool = true );
+ void setImageFormats( const QString& );
+
+private:
+ void init();
+
+private:
+ QtxBackgroundTool* myTool;
+};
+
+#endif // QTXBACKGROUNDTOOL_H
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// File: QtxBiColorTool.cxx
+// Author: Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
+
+#include "QtxBiColorTool.h"
+#include "QtxColorButton.h"
+
+#include <QHBoxLayout>
+#include <QLabel>
+#include <QPainter>
+#include <QSlider>
+#include <QStyle>
+
+const int BICOLOR_MAX_DELTA = 100;
+
+/*!
+ \class QtxBiColorTool::ColorLabel
+ \brief Draw colored label (for secondary color)
+ \internal
+*/
+class QtxBiColorTool::ColorLabel: public QFrame
+{
+public:
+ ColorLabel( QWidget* parent) : QFrame( parent )
+ {
+ setFrameStyle( QFrame::Box | QFrame::Plain );
+ setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
+ }
+ ~ColorLabel() {}
+ QSize sizeHint() const
+ {
+ return minimumSizeHint();
+ }
+ QSize minimumSizeHint() const
+ {
+ int pm = style()->pixelMetric(QStyle::PM_ButtonMargin);
+ QFontMetrics fm ( font() );
+ return QSize( fm.height() + pm, fm.height() + pm );
+ }
+ void paintEvent( QPaintEvent* e )
+ {
+ QPainter p( this );
+ drawFrame( &p );
+ QRect r = contentsRect();
+ if ( myColor.isValid() ) {
+ p.fillRect( r, QBrush( myColor ) );
+ }
+ else {
+ p.fillRect( r, QBrush( palette().color( foregroundRole() ), Qt::BDiagPattern ) );
+ }
+ p.end();
+ }
+ void setColor( const QColor& c )
+ {
+ myColor = c;
+ update();
+ }
+
+private:
+ QColor myColor;
+};
+
+/*!
+ \class QtxBiColorTool
+ \brief Implementation of the widget managing a couple of colors.
+
+ The main color is specified explicitly. The secondary color is calculated
+ by changing "value" of the main color in HSV notation to the specified delta.
+*/
+
+/*!
+ \brief Constructor.
+ \param parent parent widget
+*/
+QtxBiColorTool::QtxBiColorTool( QWidget* parent )
+ : QWidget( parent )
+{
+ QHBoxLayout* l = new QHBoxLayout( this );
+ l->setMargin( 0 );
+ l->setSpacing( 5 );
+
+ myMainColor = new QtxColorButton( this );
+ myMainColor->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
+ myExtraText = new QLabel( this );
+ myRuler = new QSlider( Qt::Horizontal, this );
+ myRuler->setMinimum( -BICOLOR_MAX_DELTA );
+ myRuler->setMaximum( +BICOLOR_MAX_DELTA );
+ myRuler->setSingleStep( 1 );
+ myRuler->setPageStep( 10 );
+ myRuler->setValue( 0 );
+ myRuler->setTickPosition( QSlider::NoTicks );
+ myDelta = new ColorLabel( this );
+
+ l->addWidget( myMainColor );
+ l->addWidget( myExtraText );
+ l->addWidget( myRuler );
+ l->addWidget( myDelta );
+
+ connect( myMainColor, SIGNAL( changed( QColor ) ), this, SLOT( updateState() ) );
+ connect( myRuler, SIGNAL( valueChanged( int ) ), this, SLOT( updateState() ) );
+
+ updateState();
+}
+
+/*!
+ \brief Destructor.
+*/
+QtxBiColorTool::~QtxBiColorTool()
+{
+}
+
+/*!
+ \brief Get currently selected main color
+
+ Returns invalid QColor if no color is selected.
+
+ \return selected main color
+ \sa setMainColor()
+*/
+QColor QtxBiColorTool::mainColor() const
+{
+ return myMainColor->color();
+}
+
+/*!
+ \brief Set main color.
+ \param c color to be set as current main color
+ \sa mainColor()
+*/
+void QtxBiColorTool::setMainColor( const QColor& c )
+{
+ myMainColor->setColor( c );
+ updateState();
+}
+
+/*!
+ \brief Get current value delta for the secondary color
+ \return curent color value delta
+ \sa setDelta(), secondaryColor()
+*/
+int QtxBiColorTool::delta() const
+{
+ return myRuler->value();
+}
+
+/*!
+ \brief Set value delta for the secondary color
+ \param d new color value delta
+ \sa delta(), secondaryColor()
+*/
+void QtxBiColorTool::setDelta( int d )
+{
+ myRuler->setValue( d );
+ updateState();
+}
+
+/*!
+ \brief Get secondary color.
+
+ Returns invalid QColor if no main color is selected.
+ Secondary color is calculated by changing "value" of the main color
+ in HSV notation to the specified delta.
+
+ \return secondary color
+ \sa mainColor(), setMainColor(), delta(), setDelta()
+*/
+QColor QtxBiColorTool::secondaryColor() const
+{
+ return Qtx::mainColorToSecondary( mainColor(), delta() );
+}
+
+/*!
+ \brief Returns auxiliary text assigned to the widget
+ \return current widget text
+ \sa setText()
+*/
+QString QtxBiColorTool::text() const
+{
+ return myExtraText->text();
+}
+
+/*!
+ \brief Assign auxiliary text to the widet
+ \param txt new widget text
+ \sa text()
+*/
+void QtxBiColorTool::setText( const QString& txt )
+{
+ myExtraText->setText( txt );
+}
+
+/*!
+ \brief Update widget state
+*/
+void QtxBiColorTool::updateState()
+{
+ myDelta->setColor( secondaryColor() );
+}
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// File: QtxBiColorTool.h
+// Author: Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
+
+#ifndef QTXBICOLORTOOL_H
+#define QTXBICOLORTOOL_H
+
+#include "Qtx.h"
+
+#include <QColor>
+#include <QWidget>
+
+class QLabel;
+class QSlider;
+class QtxColorButton;
+
+class QTX_EXPORT QtxBiColorTool : public QWidget
+{
+ class ColorLabel;
+
+ Q_OBJECT
+
+public:
+ QtxBiColorTool( QWidget* = 0 );
+ virtual ~QtxBiColorTool();
+
+ QColor mainColor() const;
+ void setMainColor( const QColor& );
+
+ int delta() const;
+ void setDelta( int );
+
+ QColor secondaryColor() const;
+
+ QString text() const;
+ void setText( const QString& );
+
+private slots:
+ void updateState();
+
+private:
+ QtxColorButton* myMainColor;
+ QLabel* myExtraText;
+ QSlider* myRuler;
+ ColorLabel* myDelta;
+};
+
+#endif // QTXBICOLORTOOL_H
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "QtxShortcutEdit.h"
+
+#include <QWidget>
+#include <QLayout>
+#include <QList>
+
+#include <QToolButton>
+#include <QLineEdit>
+#include <QTableWidgetItem>
+#include <QMessageBox>
+
+#include <QKeyEvent>
+#include <QKeySequence>
+
+#define COLUMN_SIZE 500
+
+static const char* delete_icon[] = {
+"16 16 3 1",
+"` c #810000",
+" c none",
+"# c #ffffff",
+" ",
+" ",
+" ``# ``# ",
+" ````# ``# ",
+" ````# ``# ",
+" ```# `# ",
+" `````# ",
+" ```# ",
+" `````# ",
+" ```# ``# ",
+" ```# ``# ",
+" ```# `# ",
+" ```# `# ",
+" `# `# ",
+" ",
+" "
+};
+
+/*!
+ \brief Constructor
+ \param parent parent widget
+*/
+QtxShortcutEdit::QtxShortcutEdit( QWidget* parent )
+: QFrame( parent )
+{
+ initialize();
+ myShortcut->installEventFilter(this);
+}
+
+/*!
+ \brief Destructor
+*/
+QtxShortcutEdit::~QtxShortcutEdit()
+{
+}
+
+/*!
+ \brief Sets custom shortcut
+ \param seq a key sequence describes a combination of keys
+ \sa shortcut()
+*/
+void QtxShortcutEdit::setShortcut( const QKeySequence& seq )
+{
+ QString txt = seq.toString();
+ myPrevShortcutText = txt;
+ myShortcut->setText( txt );
+}
+
+/*!
+ \brief Gets custom shortcut
+ \return a key sequence describes a combination of keys
+ \sa setShortcut()
+*/
+QKeySequence QtxShortcutEdit::shortcut()
+{
+ return QKeySequence::fromString( myShortcut->text() );
+}
+
+/*!
+ \brief Gets the key sequence from keys that were pressed
+ \param e a key event
+ \return a string representation of the key sequence
+*/
+QString QtxShortcutEdit::parseEvent( QKeyEvent* e )
+{
+ bool isShiftPressed = e->modifiers() & Qt::ShiftModifier;
+ bool isControlPressed = e->modifiers() & Qt::ControlModifier;
+ bool isAltPressed = e->modifiers() & Qt::AltModifier;
+ bool isMetaPressed = e->modifiers() & Qt::MetaModifier;
+ bool isModifiersPressed = isShiftPressed || isControlPressed || isAltPressed || isMetaPressed;
+ int result=0;
+ if( isControlPressed )
+ result += Qt::CTRL;
+ if( isAltPressed )
+ result += Qt::ALT;
+ if( isShiftPressed )
+ result += Qt::SHIFT;
+ if( isMetaPressed )
+ result += Qt::META;
+
+ int aKey = e->key();
+ if ( ( isValidKey( aKey ) && isModifiersPressed ) || ( ( aKey >= Qt::Key_F1 ) && ( aKey <= Qt::Key_F12 ) ) )
+ result += aKey;
+
+ return QKeySequence( result ).toString();
+}
+
+/*!
+ \brief Check if the key event contains a 'valid' key
+ \param aKey the code of the key
+ \return \c true if the key is 'valid'
+*/
+
+bool QtxShortcutEdit::isValidKey( int aKey )
+{
+ if ( aKey == Qt::Key_Underscore || aKey == Qt::Key_Escape ||
+ ( aKey >= Qt::Key_Backspace && aKey <= Qt::Key_Delete ) ||
+ ( aKey >= Qt::Key_Home && aKey <= Qt::Key_PageDown ) ||
+ ( aKey >= Qt::Key_F1 && aKey <= Qt::Key_F12 ) ||
+ ( aKey >= Qt::Key_Space && aKey <= Qt::Key_Asterisk ) ||
+ ( aKey >= Qt::Key_Comma && aKey <= Qt::Key_Question ) ||
+ ( aKey >= Qt::Key_A && aKey <= Qt::Key_AsciiTilde ) )
+ return true;
+ return false;
+}
+
+/*!
+ \brief Called when "Clear" button is clicked.
+*/
+void QtxShortcutEdit::onCliked()
+{
+ myShortcut->setText( "" );
+}
+
+/*!
+ \brief Called when myShortcut loses focus.
+*/
+void QtxShortcutEdit::onEditingFinished()
+{
+ if ( myShortcut->text().endsWith("+") )
+ myShortcut->setText( myPrevShortcutText );
+}
+
+/*!
+ \brief Custom event filter.
+ \param obj event receiver object
+ \param event event
+ \return \c true if further event processing should be stopped
+*/
+bool QtxShortcutEdit::eventFilter(QObject* obj, QEvent* event)
+{
+ if ( obj == myShortcut ) {
+ if (event->type() == QEvent::KeyPress ) {
+ QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event);
+ QString text = parseEvent( keyEvent );
+ if ( keyEvent->key() == Qt::Key_Delete || keyEvent->key() == Qt::Key_Backspace )
+ onCliked();
+ if ( text != "" )
+ myShortcut->setText( text );
+ return true;
+ }
+ if ( event->type() == QEvent::KeyRelease ) {
+ if ( myShortcut->text().endsWith("+") )
+ myShortcut->setText( myPrevShortcutText );
+ else myPrevShortcutText = myShortcut->text();
+
+ return true;
+ }
+ }
+ return false;
+}
+
+/*
+ \brief Perform internal intialization.
+*/
+void QtxShortcutEdit::initialize()
+{
+ myPrevShortcutText = QString();
+
+ QHBoxLayout* base = new QHBoxLayout( this );
+ base->setMargin( 0 );
+ base->setSpacing( 5 );
+
+ base->addWidget( myShortcut = new QLineEdit( this ) );
+
+ QToolButton* deleteBtn = new QToolButton();
+ deleteBtn->setIcon( QPixmap( delete_icon ) );
+ base->addWidget( deleteBtn );
+
+ myShortcut->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Fixed );
+ deleteBtn->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
+
+ connect( deleteBtn, SIGNAL( clicked() ), this, SLOT( onCliked() ) );
+ connect( myShortcut, SIGNAL( editingFinished() ), this, SLOT( onEditingFinished() ) );
+}
+
+/*!
+ \brief Constructor
+ \param parent parent widget
+*/
+QtxShortcutTree::QtxShortcutTree( QWidget * parent ) : QTreeWidget( parent )
+{
+ setColumnCount( 2 );
+ setSelectionMode( QAbstractItemView::SingleSelection );
+ setColumnWidth ( 0, COLUMN_SIZE);
+ setSortingEnabled(false);
+ headerItem()->setHidden ( true );
+
+ this->installEventFilter(this);
+ connect( this, SIGNAL( currentItemChanged ( QTreeWidgetItem*, QTreeWidgetItem* ) ), this, SLOT( onCurrentItemChanged ( QTreeWidgetItem*, QTreeWidgetItem* ) ) );
+
+}
+
+/*!
+ \brief Destructor
+*/
+QtxShortcutTree::~QtxShortcutTree(){}
+
+/*!
+ \brief Custom event filter.
+ \param obj event receiver object
+ \param event event
+ \return \c true if further event processing should be stopped
+*/
+bool QtxShortcutTree::eventFilter(QObject* obj, QEvent* event)
+{
+ if ( currentItem() && currentItem()->isSelected() ) {
+
+ if (event->type() == QEvent::KeyPress ) {
+ QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event);
+ QString text = QtxShortcutEdit::parseEvent( keyEvent );
+ if ( keyEvent->key() == Qt::Key_Delete || keyEvent->key() == Qt::Key_Backspace )
+ currentItem()->setText( 1, "" );
+ if ( text != "" ) {
+ if ( text.endsWith( "+" ) || checkUniqueness( currentItem(), text ) )
+ currentItem()->setText( 1, text );
+ }
+ return true;
+ }
+ if ( event->type() == QEvent::KeyRelease ) {
+ if ( currentItem()->text( 1 ).endsWith( "+" ) )
+ currentItem()->setText( 1, myPrevBindings[ currentItem()->parent()->text( 0 ) ][ currentItem()->text( 0 ) ] );
+ else myPrevBindings[ currentItem()->parent()->text( 0 ) ][ currentItem()->text( 0 ) ] = currentItem()->text( 1 );
+
+ return true;
+ }
+ }
+ return false;
+}
+
+/*!
+ \brief Called when the current item changes.
+ \param cur the current item
+ \param prev the previous current item
+*/
+void QtxShortcutTree::onCurrentItemChanged( QTreeWidgetItem* cur, QTreeWidgetItem* prev )
+{
+ if ( prev && prev->text( 1 ).endsWith( "+" ) )
+ prev->setText( 1, myPrevBindings[ prev->parent()->text( 0 ) ][ prev->text( 0 ) ] );
+}
+
+/*!
+ \brief Set key bindings to the tree
+ \param title the name of top-level item
+ \param theShortcutMap map of key bindings
+*/
+void QtxShortcutTree::setBindings( const QString& title, const ShortcutMap& theShortcutMap )
+{
+ QTreeWidgetItem* item= new QTreeWidgetItem();
+ QFont font = item->font(0);
+ font.setBold(true);
+
+ if ( findItems( title, Qt::MatchFixedString ).isEmpty() ) {
+ item->setText( 0, title );
+ item->setFont( 0, font );
+ addTopLevelItem( item );
+ item->setFlags( Qt::ItemIsEnabled );
+ } else {
+ item = findItems( title, Qt::MatchFixedString ).first();
+ item->takeChildren();
+ }
+ for( ShortcutMap::const_iterator it = theShortcutMap.constBegin(); it != theShortcutMap.constEnd(); ++it )
+ item->addChild( new QTreeWidgetItem( QStringList() << it.key() << it.value() ) );
+ myPrevBindings.insert( title, theShortcutMap);
+}
+
+/*!
+ \brief Get all sections names.
+ \return list of section names
+*/
+QStringList QtxShortcutTree::sections() const
+{
+ QStringList lst;
+ for( int i = 0; i < topLevelItemCount(); i++ )
+ lst << topLevelItem( i )->text( 0 );
+ return lst;
+}
+
+ShortcutMap* QtxShortcutTree::bindings( const QString& sec ) const
+{
+ ShortcutMap* aMap = new ShortcutMap();
+ QTreeWidgetItem* item = findItems( sec, Qt::MatchFixedString ).first();
+ int nbChildren = item->childCount();
+
+ for( int i = 0; i < nbChildren; i++ ) {
+ QTreeWidgetItem* child = item->child(i);
+ aMap->insert( child->text( 0 ), child->text( 1 ) );
+ }
+
+ return aMap;
+}
+
+void QtxShortcutTree::focusOutEvent ( QFocusEvent* event )
+{
+ QWidget::focusOutEvent( event );
+ if ( currentItem() && currentItem()->isSelected() )
+ currentItem()->setText( 1, myPrevBindings[ currentItem()->parent()->text( 0 ) ][ currentItem()->text( 0 ) ] );
+}
+
+/*!
+ \brief Set the list of shortcuts general sections.
+
+ Key combinations in general sections should not intersect
+ with any other key combinations.
+
+ \param sectionsList list of common section names
+*/
+void QtxShortcutTree::setGeneralSections( const QStringList& sectionsList )
+{
+ myGeneralSections = sectionsList;
+}
+
+/*!
+ \brief Check uniqueness of the shortcut.
+ \param item current item of the shortcut tree
+ \param shortcut shortcut appointed for the current item
+ \return \c true if the given shortcut is allowed
+*/
+bool QtxShortcutTree::checkUniqueness( QTreeWidgetItem* item, const QString& shortcut )
+{
+ // List of sections to check shortcut intersections
+ QStringList sectionsList;
+
+ // Current section
+ QString currentSection = currentItem()->parent()->text( 0 );
+
+ // If the current section is general
+ if ( myGeneralSections.contains(currentSection) ) {
+ sectionsList = sections();
+ int currentSectionIndex = sectionsList.indexOf(currentSection);
+ sectionsList.move( currentSectionIndex, 0);
+ }
+ else {
+ sectionsList = myGeneralSections;
+ sectionsList.prepend(currentSection);
+ }
+
+ // Iterate on sections
+ QStringList::const_iterator it;
+ for( it = sectionsList.constBegin(); it != sectionsList.constEnd(); ++it ) {
+ QString section = *it;
+
+ // Iterate on actual section
+ QTreeWidgetItem* sectionRoot = findItems( section, Qt::MatchFixedString ).first();
+ int nbChildren = sectionRoot->childCount();
+
+ for( int i = 0; i < nbChildren; i++ ) {
+ QTreeWidgetItem* child = sectionRoot->child(i);
+
+ if ( (child != item) && (shortcut == child->text( 1 )) ) {
+ bool res = QMessageBox::warning( parentWidget(), tr("Warning"),
+ tr("The \"%1\" shortcut has already used by the \"%2\" action.\n")
+ .arg(shortcut, section + ":" + child->text( 0 ) ) +
+ tr("Do you want to reassign it from that action to the current one?"),
+ QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes;
+ if (res)
+ child->setText( 1, "" );
+ return res;
+ }
+ }
+ }
+
+ return true;
+}
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef QTXSHORTCUTEDIT_H
+#define QTXSHORTCUTEDIT_H
+
+#include "Qtx.h"
+
+#include <QFrame>
+#include <QTreeWidget>
+
+class QLineEdit;
+class QPushButton;
+class QTreeWidgetItem;
+
+typedef QMap< QString, QString > ShortcutMap;
+
+class QTX_EXPORT QtxShortcutEdit : public QFrame
+{
+ Q_OBJECT
+
+public:
+ QtxShortcutEdit( QWidget* = 0 );
+ virtual ~QtxShortcutEdit();
+ void setShortcut( const QKeySequence& );
+ QKeySequence shortcut();
+ static QString parseEvent( QKeyEvent* );
+ static bool isValidKey( int );
+
+
+private slots:
+ void onCliked();
+ void onEditingFinished();
+
+protected:
+ virtual bool eventFilter( QObject*, QEvent* );
+
+private:
+ void initialize();
+
+private:
+ QLineEdit* myShortcut;
+ QString myPrevShortcutText;
+};
+
+class QTX_EXPORT QtxShortcutTree : public QTreeWidget
+{
+ Q_OBJECT
+
+public:
+ QtxShortcutTree( QWidget * parent = 0 );
+ virtual ~QtxShortcutTree();
+ void setBindings( const QString&, const ShortcutMap& );
+ ShortcutMap* bindings( const QString& ) const;
+ QStringList sections() const;
+ void setGeneralSections( const QStringList& );
+
+protected:
+ virtual bool eventFilter( QObject*, QEvent* );
+ virtual void focusOutEvent( QFocusEvent* );
+ virtual bool checkUniqueness( QTreeWidgetItem*, const QString& );
+
+private slots:
+ void onCurrentItemChanged( QTreeWidgetItem*, QTreeWidgetItem* );
+
+private:
+ QMap< QString, ShortcutMap > myPrevBindings;
+ QStringList myGeneralSections;
+};
+
+#endif // QTXSHORTCUTEDIT_H
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// File: QtxWebBrowser.cxx
+// Author: Roman NIKOLAEV
+//
+#include "QtxWebBrowser.h"
+#include "QtxSearchTool.h"
+
+#include <QApplication>
+#include <QFileInfo>
+#include <QWebView>
+#include <QMenuBar>
+#include <QToolBar>
+#include <QMenu>
+#include <QStatusBar>
+#include <QVBoxLayout>
+
+/*!
+ \class WebViewSearcher
+ \brief A class is used with QtxSearchTool in order to search text within the web page
+ \internal
+*/
+class WebViewSearcher : public QtxSearchTool::Searcher
+{
+public:
+ WebViewSearcher( QWebView* );
+ ~WebViewSearcher();
+
+ bool find( const QString&, QtxSearchTool* );
+ bool findNext( const QString&, QtxSearchTool* );
+ bool findPrevious( const QString&, QtxSearchTool* );
+ bool findFirst( const QString&, QtxSearchTool* );
+ bool findLast( const QString&, QtxSearchTool* );
+
+private:
+ QWebView* myView;
+};
+
+WebViewSearcher::WebViewSearcher( QWebView* view ) : myView( view )
+{
+}
+
+WebViewSearcher::~WebViewSearcher()
+{
+}
+
+bool WebViewSearcher::find( const QString& text, QtxSearchTool* st )
+{
+ QWebPage::FindFlags fl = 0;
+ if ( st->isCaseSensitive() ) fl = fl | QWebPage::FindCaseSensitively;
+ if ( st->isSearchWrapped() ) fl = fl | QWebPage::FindWrapsAroundDocument;
+ return myView->findText( text, fl );
+}
+
+bool WebViewSearcher::findNext( const QString& text, QtxSearchTool* st )
+{
+ return find( text, st );
+}
+
+bool WebViewSearcher::findPrevious( const QString& text, QtxSearchTool* st )
+{
+ QWebPage::FindFlags fl = QWebPage::FindBackward;
+ if ( st->isCaseSensitive() ) fl = fl | QWebPage::FindCaseSensitively;
+ if ( st->isSearchWrapped() ) fl = fl | QWebPage::FindWrapsAroundDocument;
+ return myView->findText( text, fl );
+}
+
+bool WebViewSearcher::findFirst( const QString&, QtxSearchTool* )
+{
+ return false;
+}
+
+bool WebViewSearcher::findLast( const QString&, QtxSearchTool* )
+{
+ return false;
+}
+
+/*!
+ \class QtxWebBrowser
+
+ \brief The QtxWebBrowser provides a window that can display html pages.
+
+ Only one instance of the QtxWebBrowser class can be created. To access the browser
+ window, use static method QtxWebBrowser::webBrowser(), which creates an
+ instance of the QtxWebBrowser widget (if it is not yet created) and returns a
+ pointer to it.
+
+ You should not destroy this instance - it is done automatically after
+ closing of the browser window. To close window programmatically use
+ method close().
+
+ To set visual properties of the browser use static method setData().
+
+ The following sample demonstrates how to use web browser.
+ In this code the browser window is created, /data/index.html file is opened
+ and scrolled to the "anchor1" anchor on this page.
+
+ \code
+ int main(int argc, char *argv[])
+ {
+ QApplication app(argc, argv);
+
+ // set icon, title and menu items.
+ QtxWebBrowser::setData("browser:title", tr("Web Browser"));
+ QtxWebBrowser::setData("browser:icon", QPixmap(":/icon.png"));
+ QtxWebBrowser::setData("menu:file:title", tr("&File"));
+ QtxWebBrowser::setData("action:close:title", tr("&Close"));
+
+ // show HTML page
+ QtxWebBrowser::loadUrl("file:///data/index.html", "anchor1");
+
+ return app.exec();
+ }
+ \endcode
+
+*/
+
+//! The only one instance of web browser
+QtxWebBrowser* QtxWebBrowser::myBrowser = 0;
+
+//! Internal data map to store resources of the browser.
+QMap<QString, QVariant> QtxWebBrowser::myData;
+
+/*!
+ \brief Constructor.
+
+ Construct the web browser.
+*/
+QtxWebBrowser::QtxWebBrowser() : QMainWindow( 0 )
+{
+ setAttribute( Qt::WA_DeleteOnClose );
+ statusBar();
+
+ QWidget* frame = new QWidget( this );
+
+ myWebView = new QWebView( frame );
+ myWebView->page()->setLinkDelegationPolicy( QWebPage::DelegateAllLinks );
+ myFindPanel = new QtxSearchTool( frame, myWebView,
+ QtxSearchTool::Basic | QtxSearchTool::Case | QtxSearchTool::Wrap,
+ Qt::Horizontal );
+ myFindPanel->setFrameStyle( QFrame::NoFrame | QFrame::Plain );
+ myFindPanel->setActivators( QtxSearchTool::SlashKey );
+ myFindPanel->setSearcher( new WebViewSearcher( myWebView ) );
+ myFindPanel->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
+
+ myToolbar = addToolBar( tr( "Navigation" ) );
+ myToolbar->addAction( myWebView->pageAction( QWebPage::Back ) );
+ myToolbar->addAction( myWebView->pageAction( QWebPage::Forward ) );
+
+ myMenus[ File ] = menuBar()->addMenu( tr( "&File" ) );
+ myActions[ Find ] = myMenus[ File ]->addAction( tr( "&Find in text..." ), myFindPanel, SLOT( find() ), QKeySequence( QKeySequence::Find ) );
+ myActions[ FindNext ] = myMenus[ File ]->addAction( tr( "&Find next" ), myFindPanel, SLOT( findNext() ), QKeySequence( QKeySequence::FindNext ) );
+ myActions[ FindPrev ] = myMenus[ File ]->addAction( tr( "&Find previous" ), myFindPanel, SLOT( findPrevious() ), QKeySequence( QKeySequence::FindPrevious ) );
+ myMenus[ File ]->addSeparator();
+ myActions[ Close ] = myMenus[ File ]->addAction( tr( "&Close" ), this, SLOT( close() ) );
+
+ QVBoxLayout* main = new QVBoxLayout( frame );
+ main->addWidget( myWebView );
+ main->addWidget( myFindPanel );
+ main->setMargin( 0 );
+ main->setSpacing( 3 );
+
+ connect( myWebView, SIGNAL( titleChanged( QString ) ), SLOT( adjustTitle() ) );
+ connect( myWebView, SIGNAL( linkClicked( QUrl ) ), SLOT( linkClicked( QUrl ) ) );
+ connect( myWebView->page(), SIGNAL( linkHovered( QString, QString, QString ) ), SLOT( linkHovered( QString, QString, QString ) ) );
+
+ setCentralWidget( frame );
+ setFocusProxy( myWebView );
+ updateData();
+ qAddPostRoutine( QtxWebBrowser::clearData );
+}
+
+/*!
+ \brief Destructor.
+*/
+QtxWebBrowser::~QtxWebBrowser()
+{
+ myBrowser = 0;
+}
+
+/*!
+ \brief Return the only instance of the QtxWebBrowser
+ \return instance of the QtxWebBrowser
+*/
+QtxWebBrowser* QtxWebBrowser::webBrowser()
+{
+ if ( !myBrowser )
+ myBrowser = new QtxWebBrowser();
+ return myBrowser;
+}
+
+/*!
+ \brief Load given url address and optional scroll to the specified anchor
+ \param url an url address to load
+ \param anchor an anchor to scroll page to
+*/
+void QtxWebBrowser::loadUrl( const QString& url, const QString& anchor )
+{
+ QString anUrl = url;
+ if( !anchor.isEmpty() ) anUrl += "#" + anchor;
+ anUrl.replace('\\', '/');
+
+ Qtx::alignWidget( webBrowser(), (QWidget*)QApplication::desktop(), Qtx::AlignCenter );
+
+ webBrowser()->show();
+ webBrowser()->myWebView->load( QUrl( anUrl ) );
+ webBrowser()->setFocus();
+ webBrowser()->activateWindow();
+ webBrowser()->raise();
+}
+
+/*!
+ \brief Set browser settings from.
+
+ This method can be used to setup the browser properties.
+ - \c "browser:title" : title of the browser window
+ - \c "browser:icon" : icon of the browser window
+ - \c "toolbar:title" : title of the toolbar
+ - \c "menu:file:title" : File menu of the browser
+ - \c "action:close:title" : File/Close menu item title
+ - \c "action:close:icon" : File/Close menu item icon
+ - \c "action:back:title" : Navigation/Back menu item title
+ - \c "action:back:icon" : Navigation/Back menu item icon
+ - \c "action:forward:title" : Navigation/Forward menu item title
+ - \c "action:forward:icon" : Navigation/Forward menu item icon
+ - \c "action:find:title" : File/Find menu item title
+ - \c "action:find:icon" : File/Find menu item icon
+ - \c "action:findnext:title" : File/Find Next menu item title
+ - \c "action:findnext:icon" : File/Find Next menu item icon
+ - \c "action:findprev:title" : File/Find Previous menu item title
+ - \c "action:findprev:icon" : File/Find Previous menu item icon
+
+ \param key name of the property
+ \param val value of the property
+
+*/
+void QtxWebBrowser::setData( const QString& key, const QVariant& val )
+{
+ myData.insert( key, val );
+ if ( myBrowser ) myBrowser->updateData();
+}
+
+/*!
+ \brief Get string value by key from the internal data map
+ \param key data key identifier
+ \return string value assigned to the key (null string if data is not assigned to the key)
+ \internal
+*/
+QString QtxWebBrowser::getStringValue( const QString& key )
+{
+ QString val;
+ if ( myData.contains( key ) && myData[key].canConvert( QVariant::String ) )
+ val = myData[key].toString();
+ return val;
+}
+
+/*!
+ \brief Get icon value by key from the internal data map
+ \param key data key identifier
+ \return icon assigned to the key (null icon if data is not assigned to the key)
+ \internal
+*/
+QIcon QtxWebBrowser::getIconValue(const QString& key)
+{
+ QIcon val;
+ if ( myData.contains( key ) ) {
+ if ( myData[key].canConvert( QVariant::Pixmap ) )
+ val = myData[key].value<QPixmap>();
+ else if ( myData[key].canConvert( QVariant::Icon ) )
+ val = myData[key].value<QIcon>();
+ }
+ return val;
+}
+
+/*!
+ \brief Update web browser properties from internal data map
+*/
+void QtxWebBrowser::updateData()
+{
+ // main title
+ adjustTitle();
+
+ // window icon
+ QIcon icon = getIconValue( "browser:icon" );
+ if ( !icon.isNull() )
+ setWindowIcon( icon );
+
+ // toolbar title
+ QString tbTitle = getStringValue( "toolbar:title" );
+ if ( myToolbar && !tbTitle.isEmpty() )
+ myToolbar->setWindowTitle( tbTitle );
+
+ // File menu
+ QString fmenu = getStringValue( "menu:file:title" );
+ if ( myMenus.contains( File ) && !fmenu.isEmpty() )
+ myMenus[ File ]->setTitle( fmenu );
+
+ // File/Close menu
+ QString closeTlt = getStringValue( "action:close:title" );
+ QIcon closeIco = getIconValue( "action:close:icon" );
+ if ( myActions.contains( Close ) ) {
+ if ( !closeTlt.isEmpty() )
+ myActions[ Close ]->setText( closeTlt );
+ if ( !closeIco.isNull() )
+ myActions[ Close ]->setIcon( closeIco );
+ }
+
+ // Navigation/Go Back menu
+ QString backTlt = getStringValue( "action:back:title" );
+ QIcon backIco = getIconValue( "action:back:icon" );
+ if ( !backTlt.isEmpty() )
+ myWebView->pageAction( QWebPage::Back )->setText( backTlt );
+ if ( !backIco.isNull() )
+ myWebView->pageAction( QWebPage::Back )->setIcon( backIco );
+
+ // Navigation/Go Forward menu
+ QString fwdTlt = getStringValue( "action:forward:title" );
+ QIcon fwdIco = getIconValue( "action:forward:icon" );
+ if ( !fwdTlt.isEmpty() )
+ myWebView->pageAction( QWebPage::Forward )->setText( fwdTlt );
+ if ( !fwdIco.isNull() )
+ myWebView->pageAction( QWebPage::Forward )->setIcon( fwdIco );
+
+ // File/Find menu
+ QString findTlt = getStringValue( "action:find:title" );
+ QIcon findIco = getIconValue( "action:find:icon" );
+ if ( myActions.contains( Find ) ) {
+ if ( !findTlt.isEmpty() )
+ myActions[ Find ]->setText( findTlt );
+ if ( !findIco.isNull() )
+ myActions[ Find ]->setIcon( findIco );
+ }
+
+ // File/Find Next menu
+ QString findNextTlt = getStringValue( "action:findnext:title" );
+ QIcon findNextIco = getIconValue( "action:findnext:icon" );
+ if ( myActions.contains( FindNext ) ) {
+ if ( !findNextTlt.isEmpty() )
+ myActions[ FindNext ]->setText( findNextTlt );
+ if ( !findNextIco.isNull() )
+ myActions[ FindNext ]->setIcon( findNextIco );
+ }
+
+ // File/Find Previous menu
+ QString findPrevTlt = getStringValue( "action:findprev:title" );
+ QIcon findPrevIco = getIconValue( "action:findprev:icon" );
+ if ( myActions.contains( FindPrev ) ) {
+ if ( !findPrevTlt.isEmpty() )
+ myActions[ FindPrev ]->setText( findPrevTlt );
+ if ( !findPrevIco.isNull() )
+ myActions[ FindPrev ]->setIcon( findPrevIco );
+ }
+}
+
+/*!
+ \brief Clear internal data map
+ \internal
+*/
+void QtxWebBrowser::clearData()
+{
+ myData.clear();
+}
+
+/*!
+ \brief Called when users activated any link at the page
+ \param url URL being clicked
+ \internal
+*/
+void QtxWebBrowser::linkClicked( const QUrl& url )
+{
+ myWebView->page()->setLinkDelegationPolicy( QWebPage::DontDelegateLinks );
+ myWebView->load( url );
+ if ( url.scheme() == "file" ) {
+ QString filename = url.toLocalFile();
+ if ( QFileInfo( filename ).suffix().toLower() == "pdf" ) {
+#ifdef WIN32
+ ::system( QString( "start %2" ).arg( filename ).toLatin1().constData() );
+#else
+ // special processing of PDF files
+ QStringList readers;
+ readers << "xdg-open" << "acroread" << "kpdf" << "kghostview" << "xpdf";
+ foreach ( QString r, readers ) {
+ QString reader = QString( "/usr/bin/%1" ).arg( r );
+ if ( QFileInfo( reader ).exists() ) {
+ ::system( QString( "unset LD_LIBRARY_PATH; %1 %2 &" ).arg( reader ).arg( url.toLocalFile() ).toLatin1().constData() );
+ break;
+ }
+ }
+#endif // WIN32
+ }
+ }
+ myWebView->page()->setLinkDelegationPolicy( QWebPage::DelegateAllLinks );
+}
+
+/*!
+ \brief Called when link is hovered
+ \param link link being hovered
+ \param title link title (if it is specified in the markup)
+ \param content provides text within the link element, e.g., text inside an HTML anchor tag
+ \internal
+*/
+void QtxWebBrowser::linkHovered( const QString& link, const QString& /*title*/, const QString& /*context*/ )
+{
+ statusBar()->showMessage( link );
+}
+
+/*!
+ \brief Update title of the window
+ \internal
+*/
+void QtxWebBrowser::adjustTitle()
+{
+ QString title = getStringValue( "browser:title" );
+ setWindowTitle( title.isEmpty() ? myWebView->title() : title + QString( " [%1]" ).arg( myWebView->title() ) );
+}
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// File: QtxWebBrowser.h
+// Author: Roman NIKOLAEV
+//
+
+#ifndef QTXWEBBROWSER_H
+#define QTXWEBBROWSER_H
+
+#include "Qtx.h"
+
+#include <QMainWindow>
+#include <QMap>
+
+class QAction;
+class QMenu;
+class QToolBar;
+class QWebView;
+class QUrl;
+class QtxSearchTool;
+
+class QTX_EXPORT QtxWebBrowser : public QMainWindow
+{
+ Q_OBJECT
+
+ enum { File };
+ enum { Find, FindNext, FindPrev, Close };
+
+private:
+ QtxWebBrowser();
+
+public:
+ virtual ~QtxWebBrowser();
+
+ static QtxWebBrowser* webBrowser();
+ static void loadUrl( const QString&, const QString& = QString() );
+ static void setData( const QString&, const QVariant& );
+
+private:
+ static QString getStringValue( const QString& );
+ static QIcon getIconValue( const QString& );
+ void updateData();
+ static void clearData();
+
+protected slots:
+ virtual void linkClicked( const QUrl& );
+ virtual void linkHovered( const QString&, const QString&, const QString& );
+
+private slots:
+ void adjustTitle();
+
+private:
+ static QMap<QString, QVariant> myData;
+ static QtxWebBrowser* myBrowser;
+ QWebView* myWebView;
+ QToolBar* myToolbar;
+ QMap<int, QMenu*> myMenus;
+ QMap<int, QAction*> myActions;
+ QtxSearchTool* myFindPanel;
+};
+
+#endif // QTXWEBBROWSER_H
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="fr_FR">
+<context>
+ <name>@default</name>
+ <message>
+ <source>MEN_CHANGE_BACKGROUND</source>
+ <translation>Changer l'arrière-plan...</translation>
+ </message>
+ <message>
+ <source>MNU_PAN_VIEW</source>
+ <translation>Déplacement</translation>
+ </message>
+ <message>
+ <source>DSC_PAN_VIEW</source>
+ <translation>Déplacer la vue</translation>
+ </message>
+ <message>
+ <source>MNU_RESET_VIEW</source>
+ <translation>Restaurer</translation>
+ </message>
+ <message>
+ <source>DSC_RESET_VIEW</source>
+ <translation>Restaurer le point de vue</translation>
+ </message>
+ <message>
+ <source>LBL_TOOLBAR_LABEL</source>
+ <translation>Opérations de Visualisation</translation>
+ </message>
+</context>
+</TS>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="fr_FR">
+<context>
+ <name>@default</name>
+ <message>
+ <source>MEN_CHANGE_BACKGROUND</source>
+ <translation>Changer l'arrière-plan</translation>
+ </message>
+ <message>
+ <source>MNU_PAN_VIEW</source>
+ <translation>Déplacement</translation>
+ </message>
+ <message>
+ <source>DSC_PAN_VIEW</source>
+ <translation>Déplacer la vue</translation>
+ </message>
+ <message>
+ <source>MNU_RESET_VIEW</source>
+ <translation>Restaurer</translation>
+ </message>
+ <message>
+ <source>DSC_RESET_VIEW</source>
+ <translation>Restaurer le point de vue</translation>
+ </message>
+ <message>
+ <source>LBL_TOOLBAR_LABEL</source>
+ <translation>Opérations de visualisation</translation>
+ </message>
+</context>
+<context>
+ <name>QxScene_ViewManager</name>
+ <message>
+ <source>QXSCENE_VIEW_TITLE</source>
+ <translation>Scène QGraphics:%M - visualisateur:%V</translation>
+ </message>
+</context>
+</TS>
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : SPlot2d_Histogram.cxx
+// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
+
+#include "SPlot2d_Histogram.h"
+
+/*!
+ Constructor
+*/
+SPlot2d_Histogram::SPlot2d_Histogram()
+:Plot2d_Histogram()
+{
+}
+
+/*!
+ Destructor
+*/
+SPlot2d_Histogram::~SPlot2d_Histogram()
+{
+}
+
+/*!
+ Copy constructor. Makes deep copy of data.
+*/
+SPlot2d_Histogram::SPlot2d_Histogram( const SPlot2d_Histogram& hist )
+: Plot2d_Histogram( hist )
+{
+ myIO = hist.getIO();
+}
+
+/*!
+ operator=. Makes deep copy of data.
+*/
+SPlot2d_Histogram& SPlot2d_Histogram::operator=( const SPlot2d_Histogram& hist )
+{
+ Plot2d_Histogram::operator=(hist);
+ myIO = hist.getIO();
+ return *this;
+}
+
+/*!
+ \return corresponding SALOME_InteractiveObject
+*/
+Handle(SALOME_InteractiveObject) SPlot2d_Histogram::getIO() const
+{
+ return myIO;
+}
+
+/*!
+ Sets corresponding SALOME_InteractiveObject
+ \param io - SALOME_InteractiveObject
+*/
+void SPlot2d_Histogram::setIO( const Handle(SALOME_InteractiveObject)& io )
+{
+ myIO = io;
+}
+
+/*!
+ \return SALOME_InteractiveObject
+*/
+bool SPlot2d_Histogram::hasIO() const
+{
+ return !myIO.IsNull();
+}
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : SPlot2d_Histogram.h
+// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
+
+#ifndef SPlot2d_Histogram_h
+#define SPlot2d_Histogram_h
+
+#include "SPlot2d.h"
+
+#include "Plot2d_Histogram.h"
+
+#ifndef _Handle_SALOME_InteractiveObject_HeaderFile
+#include <Handle_SALOME_InteractiveObject.hxx>
+#endif
+#include "SALOME_InteractiveObject.hxx"
+
+class SPLOT2D_EXPORT SPlot2d_Histogram : public Plot2d_Histogram
+{
+public:
+
+ SPlot2d_Histogram();
+ virtual ~SPlot2d_Histogram();
+ SPlot2d_Histogram( const SPlot2d_Histogram& hist );
+ SPlot2d_Histogram& operator= ( const SPlot2d_Histogram& hist );
+
+ virtual bool hasIO() const;
+ virtual Handle(SALOME_InteractiveObject) getIO() const;
+ virtual void setIO( const Handle(SALOME_InteractiveObject)& );
+
+private:
+ Handle(SALOME_InteractiveObject) myIO;
+};
+
+#endif // SPlot2d_Histogram_h
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="fr_FR">
+<context>
+ <name>@default</name>
+ <message>
+ <source>TOT_DESK_EDIT_CUT</source>
+ <translation>Couper</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_EDIT_CUT</source>
+ <translation>Couper la sélection et la placer dans la presse-papier</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_EDIT_CUT</source>
+ <translation>Co&uper</translation>
+ </message>
+ <message>
+ <source>ERR_APP_NOAPP</source>
+ <translation>Pas d'application</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_WINDOW</source>
+ <translation>&Fenêtre</translation>
+ </message>
+ <message>
+ <source>TOT_DESK_EDIT_COPY</source>
+ <translation>Copier</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_WINDOW_CASCADE</source>
+ <translation>Cascade</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_EDIT_COPY</source>
+ <translation>Copier la sélection dans le presse-papiers</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_WINDOW_CASCADE</source>
+ <translation>Ranger les fenêtres en cascade</translation>
+ </message>
+ <message>
+ <source>TOT_DESK_FILE_SAVEAS</source>
+ <translation>Enregistrer le document sous...</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_EDIT_COPY</source>
+ <translation>&Copier</translation>
+ </message>
+ <message>
+ <source>MSG_CANT_SAVE</source>
+ <translation>Impossible de sauvegarder le fichier "%1".</translation>
+ </message>
+ <message>
+ <source>INF_DESK_TOOLBAR_STANDARD</source>
+ <translation>Standard</translation>
+ </message>
+ <message>
+ <source>ALL_FILES</source>
+ <translation>Tous les fichiers (*.*)</translation>
+ </message>
+ <message>
+ <source>DESK_DEFAULTTITLE</source>
+ <translation>Qt Framework d'Applications</translation>
+ </message>
+ <message>
+ <source>QUE_DESK_EXIT</source>
+ <translation>Voulez-vous vraiment quitter ?</translation>
+ </message>
+ <message>
+ <source>INF_INFO</source>
+ <translation>Information</translation>
+ </message>
+ <message>
+ <source>ERR_DOC_UNKNOWNTYPE_OPEN</source>
+ <translation>Vous essayez d'ouvrir un document de type inconnu
+( %1 )</translation>
+ </message>
+ <message>
+ <source>ERR_DOC_UNKNOWNTYPE_SAVE</source>
+ <translation>Vous essayez de sauvegarder le document sous un type inconnu
+( %1 )</translation>
+ </message>
+ <message>
+ <source>TOT_DESK_NEWWINDOW</source>
+ <translation>Créer une nouvelle fenêtre</translation>
+ </message>
+ <message>
+ <source>BUT_CANCEL</source>
+ <translation>&Annuler</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_HELP_ABOUT</source>
+ <translation>&A propos de...</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_NEWWINDOW</source>
+ <translation>Créer une nouvelle fenêtre</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_VIEW_STATUSBAR</source>
+ <translation>&Barre de status</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_NEWWINDOW</source>
+ <translation>&Nouvelle fenêtre</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_VIEW_STATUSBAR</source>
+ <translation>Activer ou désactiver la barre de status</translation>
+ </message>
+ <message>
+ <source>ERR_DOC_DIRWITHNAMEEXIST_SAVE</source>
+ <translation>Impossible de sauvegarder le fichier %1.
+Un répertoire avec ce nom existe déjà sur le disque. Essayez d'utiliser un autre nom</translation>
+ </message>
+ <message>
+ <source>BUT_NO</source>
+ <translation>N&on</translation>
+ </message>
+ <message>
+ <source>BUT_OK</source>
+ <translation>O&k</translation>
+ </message>
+ <message>
+ <source>FILTER_FILES</source>
+ <translation>Fichiers %1 (%2)</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_WINDOW_ACTIVATE</source>
+ <translation>Activer la fenêtre</translation>
+ </message>
+ <message>
+ <source>TOT_DESK_FILE_PRINT</source>
+ <translation>Imprimer un document</translation>
+ </message>
+ <message>
+ <source>TOT_DESK_FILE_CLOSE</source>
+ <translation>Fermer le document</translation>
+ </message>
+ <message>
+ <source>TOT_DESK_FILE_NEW</source>
+ <translation>Créer un nouveau document</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_FILE_NEW</source>
+ <translation>Crée un nouveau document</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_FILE_MRU</source>
+ <translation>Ouvre un document</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_FILE_NEW</source>
+ <translation>&Nouveau</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_FILE_MRU</source>
+ <translation>&Fichiers récents</translation>
+ </message>
+ <message>
+ <source>TOT_DESK_EDIT_PASTE</source>
+ <translation>Coller</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_VIEW_DOCKWINDOWS</source>
+ <translation>Fenêtres</translation>
+ </message>
+ <message>
+ <source>BUT_YES</source>
+ <translation>O&ui</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_VIEW</source>
+ <translation>&Affichage</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_HELP_ABOUT</source>
+ <translation>Montre la boîte de dialogue 'A propos'</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_FILE</source>
+ <translation>Fic&hier</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_EDIT</source>
+ <translation>&Edition</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_HELP</source>
+ <translation>A&ide</translation>
+ </message>
+ <message>
+ <source>ERR_ERROR</source>
+ <translation>Erreur</translation>
+ </message>
+ <message>
+ <source>ERR_DESK_NOAPP</source>
+ <translation>Pas d'application enregistrée</translation>
+ </message>
+ <message>
+ <source>INF_DESK_DOC_CREATE</source>
+ <translation>Créer un nouveau document</translation>
+ </message>
+ <message>
+ <source>QUE_DOC_ALREADYOPEN</source>
+ <translation>Le document %1 est déjà ouvert.
+Voulez-vous le réouvrir?</translation>
+ </message>
+ <message>
+ <source>BUT_APPLY</source>
+ <translation>A&ppliquer</translation>
+ </message>
+ <message>
+ <source>BUT_CLOSE</source>
+ <translation>&Fermer</translation>
+ </message>
+ <message>
+ <source>INF_DESK_EXIT</source>
+ <translation>&Quitter</translation>
+ </message>
+ <message>
+ <source>ERR_UNKNOWN</source>
+ <translation>Erreur inconnue</translation>
+ </message>
+ <message>
+ <source>BUT_HELP</source>
+ <translation>A&ide</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_FILE_CLOSE</source>
+ <translation>Ferme le document actuel</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_FILE_PRINT</source>
+ <translation>Imprime le document actuel</translation>
+ </message>
+ <message>
+ <source>WRN_WARNING</source>
+ <translation>Avertissement</translation>
+ </message>
+ <message>
+ <source>TOT_DESK_HELP_ABOUT</source>
+ <translation>A propos...</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_VIEW_TOOLBARS</source>
+ <translation>Barres d'&outils</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_WINDOW_HSPLIT</source>
+ <translation>Diviser la fenêtre actuelle en deux parties horizontales</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_WINDOW_HSPLIT</source>
+ <translation>Séparation horizontale</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_EDIT_PASTE</source>
+ <translation>Insérer le contenu du presse-papiers au point d'insertion</translation>
+ </message>
+ <message>
+ <source>DLG_LOAD_STUDY_CAPTION</source>
+ <translation>Ouvrir une étude</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_HELP_SEARCH</source>
+ <translation>Chercher de l'information sur le sujet</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_FILE_SAVEAS</source>
+ <translation>Sauvegarder le document actuel sous un nouveau nom</translation>
+ </message>
+ <message>
+ <source>INF_READY</source>
+ <translation>Prêt</translation>
+ </message>
+ <message>
+ <source>INF_CANCELLED</source>
+ <translation>Annulé</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_WINDOW_VSPLIT</source>
+ <translation>Diviser la fenêtre actuelle en deux parties verticales</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_WINDOW_VSPLIT</source>
+ <translation>Séparation verticale</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_WINDOW_TILE</source>
+ <translation>Ranger les fenêtres en mosaïque</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_HELP_CONTENTS</source>
+ <translation>&Contenu</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_HELP_CONTENTS</source>
+ <translation>Afficher le sommaire de la référence documentaire</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_WINDOW_HTILE</source>
+ <translation>Mosaïque horizontale</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_WINDOW_VTILE</source>
+ <translation>Mosaïque verticale</translation>
+ </message>
+ <message>
+ <source>ERR_DOC_PERMISSIONDENIED_SAVE</source>
+ <translation>Impossible de sauvegarder le fichier %1. Autorisaton refusée.</translation>
+ </message>
+ <message>
+ <source>INF_DESK_DOCALREADYOPEN</source>
+ <translation>Impossible de sauvegarder le document sous le nom d'un document déjà ouvert.
+Indiquez un autre nom pour le document que vous voulez sauvegarder.
+( %1 )</translation>
+ </message>
+ <message>
+ <source>TIT_FILE_SAVEAS</source>
+ <translation>Enregistrer sous</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_FILE_CLOSE</source>
+ <translation>Fer&mer</translation>
+ </message>
+ <message>
+ <source>MSG_FILE_EXISTS</source>
+ <translation>Le fichier "%1" existe déjà.
+Voulez-vous l'écraser ?</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_FILE_PRINT</source>
+ <translation>&Imprimer</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_HELP_SEARCH</source>
+ <translation>&Recherche...</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_VIEW_STDTOOLBAR</source>
+ <translation>&Standard</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_FILE_SAVEAS</source>
+ <translation>Enre&gistrer sous...</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_VIEW_STDTOOLBAR</source>
+ <translation>Activer ou désactiver la barre standard</translation>
+ </message>
+ <message>
+ <source>TOT_DESK_FILE_SAVE</source>
+ <translation>Enregistrer le document</translation>
+ </message>
+ <message>
+ <source>TOT_DESK_FILE_EXIT</source>
+ <translation>Quitter l'application</translation>
+ </message>
+ <message>
+ <source>TOT_DESK_FILE_LOAD</source>
+ <translation>Charger le document</translation>
+ </message>
+ <message>
+ <source>TOT_DESK_FILE_OPEN</source>
+ <translation>Ouvrir un document</translation>
+ </message>
+ <message>
+ <source>TOT_DESK_FILE_REOPEN</source>
+ <translation>Réouvrir un document</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_FILE_EXIT</source>
+ <translation>Quitte l'application</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_FILE_OPEN</source>
+ <translation>Ouvre un document existant</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_FILE_REOPEN</source>
+ <translation>Réouvrir le document actuel à partir d'un fichier</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_FILE_SAVE</source>
+ <translation>Sauvegarder le document actuel</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_FILE_LOAD</source>
+ <translation>Charge un document</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_WINDOW_HTILE</source>
+ <translation>Ranger les fenêtres en mosaïque horizontale</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_WINDOW_VTILE</source>
+ <translation>Ranger les fenêtres en mosaïque verticale</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_WINDOW_TILE</source>
+ <translation>Mosaïque</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_FILE_EXIT</source>
+ <translation>&Quitter</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_FILE_OPEN</source>
+ <translation>&Ouvrir...</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_FILE_REOPEN</source>
+ <translation>&Réouvrir</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_FILE_LOAD</source>
+ <translation>Connec&ter...</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_FILE_SAVE</source>
+ <translation>&Enregistrer</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_EDIT_PASTE</source>
+ <translation>Co&ller</translation>
+ </message>
+ <message>
+ <source>MEN_STUDIES_CHOICE</source>
+ <translation>Choisir une étude existante</translation>
+ </message>
+</context>
+<context>
+ <name>STD_Application</name>
+ <message>
+ <source>INF_DOC_MODIFIED</source>
+ <translation>Le document a été modifié.
+Voulez-vous sauvegarder les modifications?</translation>
+ </message>
+ <message>
+ <source>INF_DOC_SAVING</source>
+ <translation>Sauvegarde de l'étude en cours</translation>
+ </message>
+ <message>
+ <source>INF_DOC_SAVED</source>
+ <translation>L'étude %1 est sauvegardée</translation>
+ </message>
+ <message>
+ <source>TOT_DOCK_WINDOWS</source>
+ <translation>Montrer / cacher les fenêtres ancrables et les barres d'outils</translation>
+ </message>
+ <message>
+ <source>MEN_DOCK_WINDOWS</source>
+ <translation>Fenêtres et Barres d'outils</translation>
+ </message>
+ <message>
+ <source>ABOUT_INFO</source>
+ <translation>Application SUIT Std</translation>
+ </message>
+ <message>
+ <source>INF_DOC_SAVING_FAILS</source>
+ <translation>Impossible de sauvegarder le fichier "%1".
+Les raisons possibles sont:
+- un problème de droit;
+- l'espace disque restant est insuffisant;
+- erreur de l'application;
+Essayez d'utiliser un autre nom de fichier.</translation>
+ </message>
+ <message>
+ <source>INF_DOCUMENT_MODIFIED</source>
+ <translation>Le document "%1" a été modifié.
+Voulez-vous sauvegarder les changements?</translation>
+ </message>
+ <message>
+ <source>CLOSE_STUDY</source>
+ <translation>Fermer l'étude actuelle</translation>
+ </message>
+ <message>
+ <source>CLOSE_QUESTION</source>
+ <translation>Voulez-vous sauvegarder l'étude avant de la fermer?</translation>
+ </message>
+ <message>
+ <source>REOPEN_STUDY</source>
+ <translation>Réouvrir l'étude</translation>
+ </message>
+ <message>
+ <source>REOPEN_QUESTION</source>
+ <translation>Voulez-vous vraiment réouvrir l'étude?
+Toutes les modifications introduites après le dernier enregistrement seront perdues.</translation>
+ </message>
+</context>
+</TS>
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "SUIT_ShortcutMgr.h"
+
+#include "SUIT_Session.h"
+#include "SUIT_ResourceMgr.h"
+
+#include <QtxAction.h>
+
+#include <QApplication>
+#include <QActionEvent>
+
+SUIT_ShortcutMgr* SUIT_ShortcutMgr::myShortcutMgr = NULL;
+
+/*!
+ \brief Constructor
+*/
+SUIT_ShortcutMgr::SUIT_ShortcutMgr()
+: QObject()
+{
+ qApp->installEventFilter( this );
+}
+
+/*!
+ \brief Destructor
+*/
+SUIT_ShortcutMgr::~SUIT_ShortcutMgr()
+{
+ qApp->removeEventFilter( this );
+}
+
+/*!
+ \brief Create new instance of shortcut manager.
+*/
+void SUIT_ShortcutMgr::Init()
+{
+ if( myShortcutMgr==NULL )
+ myShortcutMgr = new SUIT_ShortcutMgr();
+}
+
+/*!
+ \brief Return shortcut manager.
+*/
+SUIT_ShortcutMgr* SUIT_ShortcutMgr::getShortcutMgr()
+{
+ Init();
+
+ return myShortcutMgr;
+}
+
+/*!
+ \brief Custom event filter for qapplication .
+
+ Redefined from QObject::eventFilter();
+*/
+bool SUIT_ShortcutMgr::eventFilter( QObject* o, QEvent* e )
+{
+ if ( e->type() == QEvent::ActionAdded ) {
+ QActionEvent* anActionEvent = (QActionEvent*)e;
+ if (anActionEvent) {
+ QtxAction* anAction = qobject_cast<QtxAction*>( anActionEvent->action() );
+ if ( anAction )
+ processAction( anAction );
+ }
+ }
+
+ return QObject::eventFilter( o, e );
+}
+
+/*!
+ \brief Return key sequence for shortcut action name.
+ \param actionName name of shortcut action in preferences
+ \return key sequence defined in preferences or empty sequence
+*/
+QKeySequence SUIT_ShortcutMgr::getShortcutByActionName( const QString& actionName ) const
+{
+ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+
+ QString section = actionName.section( resMgr->sectionsToken(), 0, 0 );
+ section.prepend( QString("shortcuts") + resMgr->sectionsToken() );
+ QString parameter = actionName.section( resMgr->sectionsToken(), 1, 1 );
+
+ QString shortcutValue;
+ bool hasValue = resMgr->value( section, parameter, shortcutValue, false );
+
+ if ( !hasValue )
+ return QKeySequence();
+
+ return QKeySequence::fromString( shortcutValue );
+}
+
+/*!
+ \brief Set shortcut to the given action if the shortcut is defined.
+ \param action action to process
+ */
+void SUIT_ShortcutMgr::processAction( QtxAction* action )
+{
+ QString shortcutActionName = action->shortcutActionName();
+
+ if ( !shortcutActionName.isEmpty() ) {
+ // Add action to the actions map
+ if ( !myShortcutActions.contains( shortcutActionName, action ) ) {
+ myShortcutActions.insert( shortcutActionName, action );
+ connect( action, SIGNAL( destroyed( QObject* ) ),
+ this, SLOT ( onActionDestroyed( QObject* ) ) );
+ }
+
+ QKeySequence keySeq = getShortcutByActionName( shortcutActionName );
+ action->setShortcut( keySeq );
+ }
+}
+
+/*!
+ \brief Enable/disable a shortcuts section.
+
+ Enables or disables actions which belong to the given shortcuts section.
+ Only actions which have an active desktop as a parent widget
+ are taken into account.
+
+ \param section shorcuts section
+ \param on if \c true - action will be enabled, otherwise - disabled
+*/
+void SUIT_ShortcutMgr::setSectionEnabled( const QString& section, const bool on )
+{
+ QMap<QString, QtxAction*>::ConstIterator it;
+ for ( it = myShortcutActions.constBegin(); it != myShortcutActions.constEnd(); ++it ) {
+ QtxAction* action = it.value();
+ QString shortcutActionName = action->shortcutActionName();
+ QString actionSection = shortcutActionName.section( ":", 0, 0 );
+ if ( actionSection == section ) {
+ // Check if the action parent widget equals to the active desktop
+ SUIT_Application* app = SUIT_Session::session()->activeApplication();
+ if ( !app )
+ return;
+ if ( action->parentWidget() == (QWidget*)app->desktop() )
+ action->setEnabled( on );
+ }
+ }
+}
+
+/*!
+ \brief Update shortcuts from preferences.
+*/
+void SUIT_ShortcutMgr::updateShortcuts()
+{
+ QMap<QString, QtxAction*>::ConstIterator it;
+ for ( it = myShortcutActions.constBegin(); it != myShortcutActions.constEnd(); ++it ) {
+ QtxAction* action = it.value();
+ QKeySequence keySeq = getShortcutByActionName( action->shortcutActionName() );
+ action->setShortcut( keySeq );
+ }
+}
+
+/*!
+ \brief Called when the corresponding action is destroyed.
+
+ Removes destroyed action from the actions list.
+
+ \param obj action being destroyed
+*/
+void SUIT_ShortcutMgr::onActionDestroyed( QObject* obj )
+{
+ QtxAction* anAction = (QtxAction*)obj;
+
+ if ( anAction )
+ myShortcutActions.remove( anAction->shortcutActionName(), anAction );
+}
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef SUIT_SHORTCUTMGR_H
+#define SUIT_SHORTCUTMGR_H
+
+#include "SUIT.h"
+
+#include <QObject>
+#include <QMultiMap>
+
+class QtxAction;
+
+class QKeySequence;
+
+#if defined WIN32
+#pragma warning( disable: 4251 )
+#endif
+
+/*!
+ \class SUIT_ShortcutMgr
+ \brief Class which manages shortcuts customization.
+*/
+class SUIT_EXPORT SUIT_ShortcutMgr: public QObject
+{
+ Q_OBJECT
+public:
+ static void Init();
+ static SUIT_ShortcutMgr* getShortcutMgr();
+
+ void setSectionEnabled( const QString&, const bool = true );
+ void updateShortcuts();
+
+protected:
+ SUIT_ShortcutMgr();
+ virtual ~SUIT_ShortcutMgr();
+
+private slots:
+ void onActionDestroyed( QObject* );
+
+private:
+ virtual bool eventFilter( QObject* o, QEvent* e );
+
+ void processAction( QtxAction* );
+ QKeySequence getShortcutByActionName( const QString& ) const;
+
+private:
+ static SUIT_ShortcutMgr* myShortcutMgr;
+ QMultiMap<QString, QtxAction*> myShortcutActions;
+};
+
+#if defined WIN32
+#pragma warning( default: 4251 )
+#endif
+
+#endif
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="en_US">
+<context>
+ <name>@default</name>
+ <message>
+ <source>ICON_DATAOBJ_VISIBLE</source>
+ <translation>icon_visibility_on.png</translation>
+ </message>
+ <message>
+ <source>ICON_DATAOBJ_INVISIBLE</source>
+ <translation>icon_visibility_off.png</translation>
+ </message>
+</context>
+</TS>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="fr_FR">
+<context>
+ <name>@default</name>
+ <message>
+ <source>MEN_DESK_WINDOW</source>
+ <translation>&Fenêtre</translation>
+ </message>
+ <message>
+ <source>ERR_CANT_DUMP_VIEW</source>
+ <translation>Impossible de sauvegarder le contenu de la vue dans le fichier.</translation>
+ </message>
+ <message>
+ <source>TLT_IMAGE_FILES</source>
+ <translation>Fichiers images (*.bmp *.png *.jpg *.jpeg)</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_WINDOW_CASCADE</source>
+ <translation>&Cascade</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_WINDOW_CASCADE</source>
+ <translation>Superpose les fenêtres</translation>
+ </message>
+ <message>
+ <source>ERR_DIR_NOT_EXIST</source>
+ <translation>Le répertoire "%1" n'existe pas !</translation>
+ </message>
+ <message>
+ <source>ERR_FILE_NOT_DIR</source>
+ <translation>"%1" n'est pas un répertoire !</translation>
+ </message>
+ <message>
+ <source>CONTINUE</source>
+ <translation>Continuer</translation>
+ </message>
+ <message>
+ <source>CANCEL</source>
+ <translation>Annuler</translation>
+ </message>
+ <message>
+ <source>ERR_FILE_NOT_EXIST</source>
+ <translation>Le fichier "%1" n'existe pas !</translation>
+ </message>
+ <message>
+ <source>QUE_DOC_FILEEXISTS</source>
+ <translation>Le fichier %1 existe déjà.
+Voulez-vous l'écraser ?</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_WINDOW_ACTIVATE</source>
+ <translation>Active la fenêtre</translation>
+ </message>
+ <message>
+ <source>ERR_PERMISSION_DENIED</source>
+ <translation>Impossible de sauvegarder le fichier "%1".
+Autorisation interdite.</translation>
+ </message>
+ <message>
+ <source>ERR_OPEN_PERMISSION_DENIED</source>
+ <translation>Impossible d'ouvrir le fichier "%1".
+Autorisation interdite.</translation>
+ </message>
+ <message>
+ <source>ERR_DIR_READ_PERMISSION_DENIED</source>
+ <translation>Impossible de lire le répertoire "%1".
+Autorisation interdite.</translation>
+ </message>
+ <message>
+ <source>ERR_DIR_WRITE_PERMISSION_DENIED</source>
+ <translation>Impossible d'écrire dans le répertoire "%1".
+Autorisation interdite.</translation>
+ </message>
+ <message>
+ <source>ERR_ERROR</source>
+ <translation>Erreur</translation>
+ </message>
+ <message>
+ <source>QUE_FILE_EXISTS</source>
+ <translation>Le fichier %1 existe déjà.
+Voulez-vous l'écraser ?</translation>
+ </message>
+ <message>
+ <source>WRN_WARNING</source>
+ <translation>Avertissement</translation>
+ </message>
+ <message>
+ <source>TLT_DUMP_VIEW</source>
+ <translation>Enregistrer la vue dans le fichier</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_WINDOW_TILE</source>
+ <translation>Place les fenêtres en mosaïque</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_WINDOW_VTILE</source>
+ <translation>Mosaïque &verticale</translation>
+ </message>
+ <message>
+ <source>INF_DIRECTORIES_FILTER</source>
+ <translation>Répertoires</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_WINDOW_VTILE</source>
+ <translation>Place les fenêtres en mosaïque verticale</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_WINDOW_TILE</source>
+ <translation>&Mosaïque</translation>
+ </message>
+ <message>
+ <source>NAME_COLUMN</source>
+ <translation>Nom</translation>
+ </message>
+</context>
+<context>
+ <name>SUIT_Study</name>
+ <message>
+ <source>OPERATION_LAUNCH</source>
+ <translation>Lancer l'opération</translation>
+ </message>
+ <message>
+ <source>PREVIOUS_NOT_FINISHED</source>
+ <translation>L'opération précédente n'est pas aboutie et sera interrompue</translation>
+ </message>
+</context>
+<context>
+ <name>SUIT_FileDlg</name>
+ <message>
+ <source>LAB_QUICK_PATH</source>
+ <translation>Emplacement :</translation>
+ </message>
+ <message>
+ <source>BUT_ADD_PATH</source>
+ <translation>Ajouter un chemin</translation>
+ </message>
+ <message>
+ <source>INF_DESK_DOC_OPEN</source>
+ <translation>Ouvrir un fichier</translation>
+ </message>
+ <message>
+ <source>INF_DESK_DOC_SAVE</source>
+ <translation>Sauvegarder un fichier</translation>
+ </message>
+ <message>
+ <source>ALL_FILES_FILTER</source>
+ <translation>Tous les fichiers (*)</translation>
+ </message>
+</context>
+</TS>
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// Author : Roman NIKOLAEV, Open CASCADE S.A.S. (roman.nikolaev@opencascade.com)
+// Date : 22/06/2007
+//
+#include "SUITApp_init_python.hxx"
+
+
+PyThreadState* SUIT_PYTHON::_gtstate = NULL;
+PyObject *SUIT_PYTHON::salome_shared_modules_module = NULL;
+PyInterpreterState* SUIT_PYTHON::_interp = NULL;
+bool SUIT_PYTHON::initialized = false;
+
+void SUIT_PYTHON::init_python(int argc, char **argv)
+{
+ if (Py_IsInitialized())
+ {
+ return;
+ }
+ Py_SetProgramName(argv[0]);
+ Py_Initialize(); // Initialize the interpreter
+ PySys_SetArgv(argc, argv);
+ SUIT_PYTHON::_interp = PyThreadState_Get()->interp;
+ PyEval_InitThreads(); // Create (and acquire) the interpreter lock
+ SUIT_PYTHON::_gtstate = PyEval_SaveThread(); // Release global thread state
+ SUIT_PYTHON::initialized = true;
+}
+
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// Author : Roman NIKOLAEV, Open CASCADE S.A.S. (roman.nikolaev@opencascade.com)
+// Date : 22/06/2007
+//
+#ifndef _SUITAPP_INIT_PYTHON_
+#define _SUITAPP_INIT_PYTHON_
+
+#include <pthread.h>
+
+// rnv: avoid compilation warning on Linux : "_POSIX_C_SOURCE" and "_XOPEN_SOURCE" are redefined
+#ifdef _POSIX_C_SOURCE
+#undef _POSIX_C_SOURCE
+#endif
+
+#ifdef _XOPEN_SOURCE
+#undef _XOPEN_SOURCE
+#endif
+
+#include <Python.h>
+
+#ifdef WNT
+# if defined SUITAPP_EXPORTS || defined SUITApp_EXPORTS
+# define SUITAPP_EXPORT __declspec(dllexport)
+# else
+# define SUITAPP_EXPORT __declspec(dllimport)
+# endif
+#else
+# define SUITAPP_EXPORT
+#endif
+
+struct SUITAPP_EXPORT SUIT_PYTHON
+{
+ static PyThreadState *_gtstate;
+ static PyInterpreterState *_interp;
+ static PyObject *salome_shared_modules_module;
+ static bool initialized;
+ static void init_python(int argc, char **argv);
+
+};
+
+#endif // _SUITAPP_INIT_PYTHON_
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="fr_FR">
+<context>
+ <name>@default</name>
+ <message>
+ <source>APP_OK</source>
+ <translation>Ok</translation>
+ </message>
+ <message>
+ <source>APP_ERROR</source>
+ <translation>Erreur</translation>
+ </message>
+ <message>
+ <source>APP_UNK_EXCEPTION</source>
+ <translation>Exception inconnue</translation>
+ </message>
+</context>
+</TS>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="fr_FR">
+<context>
+ <name>@default</name>
+ <message>
+ <source>MNU_PAN_VIEW</source>
+ <translation>Déplacement</translation>
+ </message>
+ <message>
+ <source>DSC_PAN_VIEW</source>
+ <translation>Déplacement de la vue</translation>
+ </message>
+ <message>
+ <source>MNU_RESET_VIEW</source>
+ <translation>Restaurer</translation>
+ </message>
+ <message>
+ <source>DSC_RESET_VIEW</source>
+ <translation>Restaurer le point de vue</translation>
+ </message>
+ <message>
+ <source>LBL_TOOLBAR_LABEL</source>
+ <translation>Opérations de visualisation</translation>
+ </message>
+</context>
+</TS>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="fr_FR">
+<context>
+ <name>@default</name>
+ <message>
+ <source>DSC_ANTICLOCKWISE_VIEW</source>
+ <translation>Tourner la vue à gauche</translation>
+ </message>
+ <message>
+ <source>DSC_CLOCKWISE_VIEW</source>
+ <translation>Tourner la vue à droite</translation>
+ </message>
+ <message>
+ <source>MNU_ANTICLOCKWISE_VIEW</source>
+ <translation>Tourner la vue à gauche</translation>
+ </message>
+ <message>
+ <source>MNU_CLOCKWISE_VIEW</source>
+ <translation>Tourner la vue à droite</translation>
+ </message>
+ <message>
+ <source>MNU_FRONT_VIEW</source>
+ <translation>Avant</translation>
+ </message>
+ <message>
+ <source>ERROR</source>
+ <translation>Erreur</translation>
+ </message>
+ <message>
+ <source>MNU_DUMP_VIEW</source>
+ <translation>Sauvegarder la scène...</translation>
+ </message>
+ <message>
+ <source>DSC_TOP_VIEW</source>
+ <translation>Vue de dessus</translation>
+ </message>
+ <message>
+ <source>MNU_PAN_VIEW</source>
+ <translation>Déplacement</translation>
+ </message>
+ <message>
+ <source>MNU_TOP_VIEW</source>
+ <translation>Dessus</translation>
+ </message>
+ <message>
+ <source>DSC_GLOBALPAN_VIEW</source>
+ <translation>Sélection d'un nouveau centre de la vue</translation>
+ </message>
+ <message>
+ <source>DSC_ROTATE_VIEW</source>
+ <translation>Tourner le point de vue autour du centre de la scène</translation>
+ </message>
+ <message>
+ <source>MNU_ZOOM_VIEW</source>
+ <translation>Zoom</translation>
+ </message>
+ <message>
+ <source>DSC_PAN_VIEW</source>
+ <translation>Déplacer la vue</translation>
+ </message>
+ <message>
+ <source>DSC_LEFT_VIEW</source>
+ <translation>Vue de gauche</translation>
+ </message>
+ <message>
+ <source>DSC_FITALL</source>
+ <translation>Redimensionner la scène pour montrer tous les objets</translation>
+ </message>
+ <message>
+ <source>MNU_FITALL</source>
+ <translation>Tout afficher</translation>
+ </message>
+ <message>
+ <source>MNU_ROTATE_VIEW</source>
+ <translation>Rotation</translation>
+ </message>
+ <message>
+ <source>DSC_SHOW_TRIHEDRON</source>
+ <translation>Montrer/cacher le trièdre</translation>
+ </message>
+ <message>
+ <source>DSC_FRONT_VIEW</source>
+ <translation>Vue de face</translation>
+ </message>
+ <message>
+ <source>MNU_GLOBALPAN_VIEW</source>
+ <translation>Panoramique global</translation>
+ </message>
+ <message>
+ <source>INF_APP_DUMP_VIEW</source>
+ <translation>Sauvegarder la vue</translation>
+ </message>
+ <message>
+ <source>MNU_BACK_VIEW</source>
+ <translation>Arrière</translation>
+ </message>
+ <message>
+ <source>MNU_SHOW_TRIHEDRON</source>
+ <translation>Afficher/cacher le trièdre</translation>
+ </message>
+ <message>
+ <source>DSC_CHANGINGROTATIONPOINT_VIEW</source>
+ <translation>Changer le point autour duquel la scène est tournée</translation>
+ </message>
+ <message>
+ <source>MNU_BOTTOM_VIEW</source>
+ <translation>Dessous</translation>
+ </message>
+ <message>
+ <source>MNU_RESET_VIEW</source>
+ <translation>Restaurer</translation>
+ </message>
+ <message>
+ <source>MNU_LEFT_VIEW</source>
+ <translation>Gauche</translation>
+ </message>
+ <message>
+ <source>DSC_RIGHT_VIEW</source>
+ <translation>Vue de droite</translation>
+ </message>
+ <message>
+ <source>MNU_CHANGINGROTATIONPOINT_VIEW</source>
+ <translation>Changer le point de rotation</translation>
+ </message>
+ <message>
+ <source>DSC_FITRECT</source>
+ <translation>Redimensionner la scène pour ne montrer que sa partie choisie par l'encadré</translation>
+ </message>
+ <message>
+ <source>MNU_FITRECT</source>
+ <translation>Afficher la zone</translation>
+ </message>
+ <message>
+ <source>DSC_BOTTOM_VIEW</source>
+ <translation>Vue de dessous</translation>
+ </message>
+ <message>
+ <source>DSC_DUMP_VIEW</source>
+ <translation>Sauvegarder la scène actuelle dans un fichier image</translation>
+ </message>
+ <message>
+ <source>DSC_ZOOM_VIEW</source>
+ <translation>Zoomer la vue</translation>
+ </message>
+ <message>
+ <source>VTK_IMAGE_FILES</source>
+ <translation>Fichiers images (*.bmp *.png *.jpg *.jpeg)</translation>
+ </message>
+ <message>
+ <source>DSC_RESET_VIEW</source>
+ <translation>Restaurer le point de vue</translation>
+ </message>
+ <message>
+ <source>ERR_DOC_CANT_SAVE_FILE</source>
+ <translation>Impossible de sauvegarder le fichier</translation>
+ </message>
+ <message>
+ <source>MNU_RIGHT_VIEW</source>
+ <translation>Droite</translation>
+ </message>
+ <message>
+ <source>LBL_TOOLBAR_LABEL</source>
+ <translation>Opérations de visualisation</translation>
+ </message>
+ <message>
+ <source>DSC_BACK_VIEW</source>
+ <translation>Vue arrière</translation>
+ </message>
+ <message>
+ <source>SVTK_IMAGE_FILES</source>
+ <translation>Fichiers images (*.bmp *.png *.jpg *.jpeg *.pdf *.ps *.eps)</translation>
+ </message>
+ <message>
+ <source>MNU_VIEWPARAMETERS_VIEW</source>
+ <translation>Changer les paramètres de visualisation</translation>
+ </message>
+ <message>
+ <source>DSC_VIEWPARAMETERS_VIEW</source>
+ <translation>Changer les paramètres de la vue</translation>
+ </message>
+ <message>
+ <source>MNU_SYNCHRONIZE_VIEW</source>
+ <translation>Synchroniser</translation>
+ </message>
+ <message>
+ <source>DSC_SYNCHRONIZE_VIEW</source>
+ <translation>Synchroniser la vue</translation>
+ </message>
+ <message>
+ <source>MNU_SYNC_NO_VIEW</source>
+ <translation>[ Pas de vue appropriée ]</translation>
+ </message>
+ <message>
+ <source>MNU_SVTK_PARALLEL_MODE</source>
+ <translation>Mode orthogonal</translation>
+ </message>
+ <message>
+ <source>DSC_SVTK_PARALLEL_MODE</source>
+ <translation>Choisir la projection orthogonale</translation>
+ </message>
+ <message>
+ <source>MNU_SVTK_PERSPECTIVE_MODE</source>
+ <translation>Mode perspective</translation>
+ </message>
+ <message>
+ <source>DSC_SVTK_PERSPECTIVE_MODE</source>
+ <translation>Choisir la projection en perspective</translation>
+ </message>
+ <message>
+ <source>DSC_SVTK_STYLE_SWITCH</source>
+ <translation>Changer le style d'intéraction</translation>
+ </message>
+ <message>
+ <source>MNU_SVTK_STYLE_SWITCH</source>
+ <translation>Changer le style d'interaction</translation>
+ </message>
+ <message>
+ <source>DSC_SVTK_ZOOMING_STYLE_SWITCH</source>
+ <translation>Changer le style de zoom</translation>
+ </message>
+ <message>
+ <source>MNU_SVTK_ZOOMING_STYLE_SWITCH</source>
+ <translation>Changer le style de zoom</translation>
+ </message>
+ <message>
+ <source>DSC_SVTK_DYNAMIC_PRESLECTION_SWITCH</source>
+ <translation>Pré-sélection dynamique</translation>
+ </message>
+ <message>
+ <source>MNU_SVTK_DYNAMIC_PRESLECTION_SWITCH</source>
+ <translation>Pré-sélection dynamique</translation>
+ </message>
+</context>
+<context>
+ <name>SVTK_FontWidget</name>
+ <message>
+ <source>ARIAL</source>
+ <translation>Arial</translation>
+ </message>
+ <message>
+ <source>TIMES</source>
+ <translation>Times</translation>
+ </message>
+ <message>
+ <source>COURIER</source>
+ <translation>Courier</translation>
+ </message>
+</context>
+<context>
+ <name>SVTK_ViewWindow</name>
+ <message>
+ <source>DSC_SVTK_UPDATE_RATE</source>
+ <translation>Fréquence de mise à jour</translation>
+ </message>
+ <message>
+ <source>DSC_SVTK_SCALING</source>
+ <translation>Mise à l'échelle</translation>
+ </message>
+ <message>
+ <source>MNU_SVTK_SCALING</source>
+ <translation>Mise à l'échelle</translation>
+ </message>
+ <message>
+ <source>MNU_SVTK_GRADUATED_AXES</source>
+ <translation>Axes gradués</translation>
+ </message>
+ <message>
+ <source>DSC_SVTK_GRADUATED_AXES</source>
+ <translation>Axes gradués</translation>
+ </message>
+ <message>
+ <source>MNU_SVTK_UPDATE_RATE</source>
+ <translation>Fréquence de mise à jour</translation>
+ </message>
+ <message>
+ <source>DSC_SVTK_RECORDING_START</source>
+ <translation>Commencer l'enregistrement</translation>
+ </message>
+ <message>
+ <source>MNU_SVTK_RECORDING_START</source>
+ <translation>Commencer l'enregistrement</translation>
+ </message>
+ <message>
+ <source>DSC_SVTK_RECORDING_PLAY</source>
+ <translation>Commencer l'enregistrement</translation>
+ </message>
+ <message>
+ <source>MNU_SVTK_RECORDING_PLAY</source>
+ <translation>Commencer l'enregistrement</translation>
+ </message>
+ <message>
+ <source>DSC_SVTK_RECORDING_PAUSE</source>
+ <translation>Mettre en pause l'enregistrement</translation>
+ </message>
+ <message>
+ <source>MNU_SVTK_RECORDING_PAUSE</source>
+ <translation>Mettre en pause l'enregistrement</translation>
+ </message>
+ <message>
+ <source>DSC_SVTK_RECORDING_STOP</source>
+ <translation>Arrêter l'enregistrement</translation>
+ </message>
+ <message>
+ <source>MNU_SVTK_RECORDING_STOP</source>
+ <translation>Arrêter l'enregistrement</translation>
+ </message>
+ <message>
+ <source>LBL_TOOLBAR_RECORD_LABEL</source>
+ <translation>Opérations d'enregistrement</translation>
+ </message>
+ <message>
+ <source>MSG_NO_AVI_MAKER</source>
+ <translation>L'outil jpeg2yuv, requis pour enregistrer les fichiers AVI, n'est pas disponible.
+Veuillez consulter la documentation.</translation>
+ </message>
+</context>
+<context>
+ <name>SVTK_NonIsometricDlg</name>
+ <message>
+ <source>LBL_X</source>
+ <translation>X:</translation>
+ </message>
+ <message>
+ <source>LBL_Y</source>
+ <translation>Y:</translation>
+ </message>
+ <message>
+ <source>LBL_Z</source>
+ <translation>Z:</translation>
+ </message>
+ <message>
+ <source>MEN_SCALING</source>
+ <translation>Echelle</translation>
+ </message>
+ <message>
+ <source>DLG_TITLE</source>
+ <translation>Mise à l'échelle</translation>
+ </message>
+</context>
+<context>
+ <name>SVTK_RecorderDlg</name>
+ <message>
+ <source>ALL_DISLPAYED_FRAMES</source>
+ <translation>Enregistrer toutes les images affichées</translation>
+ </message>
+ <message>
+ <source>CLOSE</source>
+ <translation>Fermer</translation>
+ </message>
+ <message>
+ <source>DLG_RECORDER_TITLE</source>
+ <translation>Magnéto</translation>
+ </message>
+ <message>
+ <source>FILE_NAME</source>
+ <translation>Sauvegarder dans le fichier : </translation>
+ </message>
+ <message>
+ <source>FLT_ALL_FILES</source>
+ <translation>Tous les fichiers (*.*)</translation>
+ </message>
+ <message>
+ <source>FLT_AVI_FILES</source>
+ <translation>Fichiers AVI (*.avi)</translation>
+ </message>
+ <message>
+ <source>FPS</source>
+ <translation>FPS : </translation>
+ </message>
+ <message>
+ <source>HELP</source>
+ <translation>Aide</translation>
+ </message>
+ <message>
+ <source>PROGRESSIVE</source>
+ <translation>Progressive</translation>
+ </message>
+ <message>
+ <source>QUALITY</source>
+ <translation>Qualité : </translation>
+ </message>
+ <message>
+ <source>RECORDING_MODE</source>
+ <translation>Mode : </translation>
+ </message>
+ <message>
+ <source>SETTINGS</source>
+ <translation>Réglages</translation>
+ </message>
+ <message>
+ <source>SKIPPED_FRAMES</source>
+ <translation>Enregistrer à FPS donné</translation>
+ </message>
+ <message>
+ <source>START</source>
+ <translation>Commencer</translation>
+ </message>
+</context>
+<context>
+ <name>SVTK_SetRotationPointDlg</name>
+ <message>
+ <source>LBL_X</source>
+ <translation>X:</translation>
+ </message>
+ <message>
+ <source>LBL_Y</source>
+ <translation>Y:</translation>
+ </message>
+ <message>
+ <source>LBL_Z</source>
+ <translation>Z:</translation>
+ </message>
+ <message>
+ <source>LBL_CENTER_OF_BOUNDING_BOX</source>
+ <translation>Centre de la boîte englobante</translation>
+ </message>
+ <message>
+ <source>RBUTTONGROUP_TITLE</source>
+ <translation>Le type du point de rotation</translation>
+ </message>
+ <message>
+ <source>USE_BBCENTER</source>
+ <translation>Utiliser le centre de la boîte englobante</translation>
+ </message>
+ <message>
+ <source>LBL_ORIGIN</source>
+ <translation>Origine du système de coordonnées</translation>
+ </message>
+ <message>
+ <source>LBL_SELECTED_POINT</source>
+ <translation>Point sélectionné</translation>
+ </message>
+ <message>
+ <source>LBL_TOORIGIN</source>
+ <translation>Réinitialiser à l'origine</translation>
+ </message>
+ <message>
+ <source>LBL_SELECTPOINT</source>
+ <translation>Choisir un point dans la vue</translation>
+ </message>
+ <message>
+ <source>DLG_TITLE</source>
+ <translation>Définir le point de rotation </translation>
+ </message>
+</context>
+<context>
+ <name>SVTK_ViewParameterDlg</name>
+ <message>
+ <source>LBL_X</source>
+ <translation>X :</translation>
+ </message>
+ <message>
+ <source>LBL_Y</source>
+ <translation>Y :</translation>
+ </message>
+ <message>
+ <source>LBL_Z</source>
+ <translation>Z :</translation>
+ </message>
+ <message>
+ <source>LBL_DX</source>
+ <translation>DX :</translation>
+ </message>
+ <message>
+ <source>LBL_DY</source>
+ <translation>DY :</translation>
+ </message>
+ <message>
+ <source>LBL_DZ</source>
+ <translation>DZ :</translation>
+ </message>
+ <message>
+ <source>PROJECTION_MODE</source>
+ <translation>Mode de projection </translation>
+ </message>
+ <message>
+ <source>ORTHOGONAL_MODE</source>
+ <translation>Orthogonal</translation>
+ </message>
+ <message>
+ <source>PERSPECTIVE_MODE</source>
+ <translation>Perspective</translation>
+ </message>
+ <message>
+ <source>USE_BBCENTER</source>
+ <translation>Utiliser le centre de la boîte englobante</translation>
+ </message>
+ <message>
+ <source>LBL_TOBBCENTER</source>
+ <translation>Définir au centre de la boîte englobante</translation>
+ </message>
+ <message>
+ <source>LBL_TOORIGIN</source>
+ <translation>Initialiser à l'origine</translation>
+ </message>
+ <message>
+ <source>LBL_SELECTPOINT</source>
+ <translation>Choisir un point de la vue</translation>
+ </message>
+ <message>
+ <source>FOCAL_POINT</source>
+ <translation>Point focal </translation>
+ </message>
+ <message>
+ <source>CAMERA_POSITION</source>
+ <translation>Position de la caméra</translation>
+ </message>
+ <message>
+ <source>WORLD_COORDINATES</source>
+ <translation>Coordonnées obsolues</translation>
+ </message>
+ <message>
+ <source>FOCAL_RELATIVE</source>
+ <translation>Relatif au point focal</translation>
+ </message>
+ <message>
+ <source>PROJECTION_DIRECTION</source>
+ <translation>Direction de la projection :</translation>
+ </message>
+ <message>
+ <source>FOCAL_DISTANCE</source>
+ <translation>Distance focale :</translation>
+ </message>
+ <message>
+ <source>VIEW_UP_DIRECTION</source>
+ <translation>Direction pour la vue verticale :</translation>
+ </message>
+ <message>
+ <source>ZOOMING</source>
+ <translation>Zoom</translation>
+ </message>
+ <message>
+ <source>LBL_SCALE</source>
+ <translation>Echelle</translation>
+ </message>
+ <message>
+ <source>LBL_VIEW_ANGLE</source>
+ <translation>Angle de visualisation</translation>
+ </message>
+ <message>
+ <source>DLG_TITLE</source>
+ <translation>Paramètres de visualisation</translation>
+ </message>
+</context>
+<context>
+ <name>SVTK_UpdateRateDlg</name>
+ <message>
+ <source>INFORMATION_FRAME_TITLE</source>
+ <translation>Informations</translation>
+ </message>
+ <message>
+ <source>STILL</source>
+ <translation>Fréquence réduite de mise à jour , FPS</translation>
+ </message>
+ <message>
+ <source>INPUT_FRAME_TITLE</source>
+ <translation>Activer</translation>
+ </message>
+ <message>
+ <source>NUMBER_CELLS</source>
+ <translation>Nombre de cellules, -</translation>
+ </message>
+ <message>
+ <source>DESIRED</source>
+ <translation>Fréquence de mise à jour requise, FPS</translation>
+ </message>
+ <message>
+ <source>CURRENT_FPS</source>
+ <translation>Fréquence actuelle de mise à jour , FPS</translation>
+ </message>
+ <message>
+ <source>DLG_TITLE</source>
+ <translation>Fréquence de mise à jour </translation>
+ </message>
+</context>
+<context>
+ <name>SVTK_ViewManager</name>
+ <message>
+ <source>VTK_VIEW_TITLE</source>
+ <translation>Scène VTK:%1 - visualiseur:%2</translation>
+ </message>
+</context>
+<context>
+ <name>SVTK_Viewer</name>
+ <message>
+ <source>MEN_DUMP_VIEW</source>
+ <translation>Sauvegarder la vue...</translation>
+ </message>
+ <message>
+ <source>MEN_SHOW_TOOLBAR</source>
+ <translation>Montrer la barre d'outils</translation>
+ </message>
+ <message>
+ <source>MEN_CHANGE_BACKGROUND</source>
+ <translation>Changer l'arrière-plan...</translation>
+ </message>
+ <message>
+ <source>GT_VERTICALGRADIENT</source>
+ <translation>Gradient vertical</translation>
+ </message>
+ <message>
+ <source>BG_IMAGE_FILES</source>
+ <translation>Fichiers images (*.png *.jpg *.jpeg *.bmp *.tif *.tiff *.mhd *.mha)</translation>
+ </message>
+</context>
+</TS>
--- /dev/null
+/*=========================================================================
+
+ Program: ParaView
+ Module: $RCSfile$
+
+ Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc.
+ All rights reserved.
+
+ ParaView is a free software; you can redistribute it and/or modify it
+ under the terms of the ParaView license version 1.2.
+
+ See License_v1.2.txt for the full ParaView license.
+ A copy of this license can be obtained by contacting
+ Kitware Inc.
+ 28 Corporate Drive
+ Clifton Park, NY 12065
+ USA
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+=========================================================================*/
+#include "vtkPVAxesActor.h"
+#include "vtkObject.h"
+#include "vtkObjectFactory.h"
+
+#include "vtkActor.h"
+#include "vtkPropCollection.h"
+#include "vtkProperty.h"
+#include "vtkRenderWindow.h"
+#include "vtkTransform.h"
+#include "vtkCylinderSource.h"
+#include "vtkPolyDataMapper.h"
+#include "vtkLineSource.h"
+#include "vtkPolyData.h"
+#include "vtkConeSource.h"
+#include "vtkSphereSource.h"
+#include "vtkVectorText.h"
+#include "vtkFollower.h"
+#include "vtkRenderer.h"
+
+#include <math.h>
+
+vtkCxxRevisionMacro(vtkPVAxesActor, "$Revision$");
+vtkStandardNewMacro(vtkPVAxesActor);
+
+vtkCxxSetObjectMacro( vtkPVAxesActor, UserDefinedTip, vtkPolyData );
+vtkCxxSetObjectMacro( vtkPVAxesActor, UserDefinedShaft, vtkPolyData );
+
+//-----------------------------------------------------------------------------
+vtkPVAxesActor::vtkPVAxesActor()
+{
+ this->XAxisLabelText = NULL;
+ this->YAxisLabelText = NULL;
+ this->ZAxisLabelText = NULL;
+
+ this->SetXAxisLabelText("X");
+ this->SetYAxisLabelText("Y");
+ this->SetZAxisLabelText("Z");
+
+ //colors chosen to match the output of vtkAxes.cxx's LUT.
+ this->XAxisShaft = vtkActor::New();
+ this->XAxisShaft->GetProperty()->SetColor(1, 0, 0);
+ this->YAxisShaft = vtkActor::New();
+ this->YAxisShaft->GetProperty()->SetColor(1, 1, 0);
+ this->ZAxisShaft = vtkActor::New();
+ this->ZAxisShaft->GetProperty()->SetColor(0, 1, 0);
+
+ this->XAxisTip = vtkActor::New();
+ this->XAxisTip->GetProperty()->SetColor(1, 0, 0);
+ this->YAxisTip = vtkActor::New();
+ this->YAxisTip->GetProperty()->SetColor(1, 1, 0);
+ this->ZAxisTip = vtkActor::New();
+ this->ZAxisTip->GetProperty()->SetColor(0, 1, 0);
+
+ this->CylinderSource = vtkCylinderSource::New();
+ this->CylinderSource->SetHeight(1.0);
+
+ this->LineSource = vtkLineSource::New();
+ this->LineSource->SetPoint1( 0.0, 0.0, 0.0 );
+ this->LineSource->SetPoint2( 0.0, 1.0, 0.0 );
+
+ this->ConeSource = vtkConeSource::New();
+ this->ConeSource->SetDirection( 0, 1, 0 );
+ this->ConeSource->SetHeight( 1.0 );
+
+ this->SphereSource = vtkSphereSource::New();
+
+ vtkPolyDataMapper *shaftMapper = vtkPolyDataMapper::New();
+
+ this->XAxisShaft->SetMapper( shaftMapper );
+ this->YAxisShaft->SetMapper( shaftMapper );
+ this->ZAxisShaft->SetMapper( shaftMapper );
+
+ shaftMapper->Delete();
+
+ vtkPolyDataMapper *tipMapper = vtkPolyDataMapper::New();
+
+ this->XAxisTip->SetMapper( tipMapper );
+ this->YAxisTip->SetMapper( tipMapper );
+ this->ZAxisTip->SetMapper( tipMapper );
+
+ tipMapper->Delete();
+
+ this->TotalLength[0] = 1.0;
+ this->TotalLength[1] = 1.0;
+ this->TotalLength[2] = 1.0;
+
+ this->NormalizedShaftLength[0] = 0.8;
+ this->NormalizedShaftLength[1] = 0.8;
+ this->NormalizedShaftLength[2] = 0.8;
+
+ this->NormalizedTipLength[0] = 0.2;
+ this->NormalizedTipLength[1] = 0.2;
+ this->NormalizedTipLength[2] = 0.2;
+
+ this->ConeResolution = 16;
+ this->SphereResolution = 16;
+ this->CylinderResolution = 16;
+
+ this->ConeRadius = 0.4;
+ this->SphereRadius = 0.5;
+ this->CylinderRadius = 0.05;
+
+ this->XAxisLabelPosition = 1;
+ this->YAxisLabelPosition = 1;
+ this->ZAxisLabelPosition = 1;
+
+ this->ShaftType = vtkPVAxesActor::LINE_SHAFT;
+ this->TipType = vtkPVAxesActor::CONE_TIP;
+
+ this->UserDefinedTip = NULL;
+ this->UserDefinedShaft = NULL;
+
+ this->XAxisVectorText = vtkVectorText::New();
+ this->YAxisVectorText = vtkVectorText::New();
+ this->ZAxisVectorText = vtkVectorText::New();
+
+ this->XAxisLabel = vtkFollower::New();
+ this->YAxisLabel = vtkFollower::New();
+ this->ZAxisLabel = vtkFollower::New();
+
+ vtkPolyDataMapper *xmapper = vtkPolyDataMapper::New();
+ vtkPolyDataMapper *ymapper = vtkPolyDataMapper::New();
+ vtkPolyDataMapper *zmapper = vtkPolyDataMapper::New();
+
+ xmapper->SetInput( this->XAxisVectorText->GetOutput() );
+ ymapper->SetInput( this->YAxisVectorText->GetOutput() );
+ zmapper->SetInput( this->ZAxisVectorText->GetOutput() );
+
+ this->XAxisLabel->SetMapper( xmapper );
+ this->YAxisLabel->SetMapper( ymapper );
+ this->ZAxisLabel->SetMapper( zmapper );
+
+ xmapper->Delete();
+ ymapper->Delete();
+ zmapper->Delete();
+
+ this->UpdateProps();
+}
+
+//-----------------------------------------------------------------------------
+vtkPVAxesActor::~vtkPVAxesActor()
+{
+ this->CylinderSource->Delete();
+ this->LineSource->Delete();
+ this->ConeSource->Delete();
+ this->SphereSource->Delete();
+
+ this->XAxisShaft->Delete();
+ this->YAxisShaft->Delete();
+ this->ZAxisShaft->Delete();
+
+ this->XAxisTip->Delete();
+ this->YAxisTip->Delete();
+ this->ZAxisTip->Delete();
+
+ this->SetUserDefinedTip( NULL );
+ this->SetUserDefinedShaft( NULL );
+
+ this->SetXAxisLabelText( NULL );
+ this->SetYAxisLabelText( NULL );
+ this->SetZAxisLabelText( NULL );
+
+ this->XAxisVectorText->Delete();
+ this->YAxisVectorText->Delete();
+ this->ZAxisVectorText->Delete();
+
+ this->XAxisLabel->Delete();
+ this->YAxisLabel->Delete();
+ this->ZAxisLabel->Delete();
+}
+
+//-----------------------------------------------------------------------------
+// Shallow copy of an actor.
+void vtkPVAxesActor::ShallowCopy(vtkProp *prop)
+{
+ vtkPVAxesActor *a = vtkPVAxesActor::SafeDownCast(prop);
+ if ( a != NULL )
+ {
+ }
+
+ // Now do superclass
+ this->vtkProp3D::ShallowCopy(prop);
+}
+
+//-----------------------------------------------------------------------------
+void vtkPVAxesActor::GetActors(vtkPropCollection *ac)
+{
+ ac->AddItem(this->XAxisShaft);
+ ac->AddItem(this->YAxisShaft);
+ ac->AddItem(this->ZAxisShaft);
+ ac->AddItem(this->XAxisTip);
+ ac->AddItem(this->YAxisTip);
+ ac->AddItem(this->ZAxisTip);
+ ac->AddItem(this->XAxisLabel);
+ ac->AddItem(this->YAxisLabel);
+ ac->AddItem(this->ZAxisLabel);
+
+}
+
+//-----------------------------------------------------------------------------
+int vtkPVAxesActor::RenderOpaqueGeometry(vtkViewport *vp)
+{
+ int renderedSomething = 0;
+
+ vtkRenderer *ren = vtkRenderer::SafeDownCast( vp );
+
+ this->UpdateProps();
+
+ this->XAxisLabel->SetCamera( ren->GetActiveCamera() );
+ this->YAxisLabel->SetCamera( ren->GetActiveCamera() );
+ this->ZAxisLabel->SetCamera( ren->GetActiveCamera() );
+
+ this->XAxisShaft->RenderOpaqueGeometry(vp);
+ this->YAxisShaft->RenderOpaqueGeometry(vp);
+ this->ZAxisShaft->RenderOpaqueGeometry(vp);
+
+ this->XAxisTip->RenderOpaqueGeometry(vp);
+ this->YAxisTip->RenderOpaqueGeometry(vp);
+ this->ZAxisTip->RenderOpaqueGeometry(vp);
+
+ this->XAxisLabel->RenderOpaqueGeometry(vp);
+ this->YAxisLabel->RenderOpaqueGeometry(vp);
+ this->ZAxisLabel->RenderOpaqueGeometry(vp);
+
+ return renderedSomething;
+}
+
+//-----------------------------------------------------------------------------
+#if (VTK_MINOR_VERSION>=2)
+// porting to VTK 5.0.x
+int vtkPVAxesActor::RenderTranslucentPolygonalGeometry(vtkViewport *vp)
+{
+ int renderedSomething=0;
+
+ this->UpdateProps();
+
+ renderedSomething += this->XAxisShaft->RenderTranslucentPolygonalGeometry(vp);
+ renderedSomething += this->YAxisShaft->RenderTranslucentPolygonalGeometry(vp);
+ renderedSomething += this->ZAxisShaft->RenderTranslucentPolygonalGeometry(vp);
+
+ renderedSomething += this->XAxisTip->RenderTranslucentPolygonalGeometry(vp);
+ renderedSomething += this->YAxisTip->RenderTranslucentPolygonalGeometry(vp);
+ renderedSomething += this->ZAxisTip->RenderTranslucentPolygonalGeometry(vp);
+
+ renderedSomething += this->XAxisLabel->RenderTranslucentPolygonalGeometry(vp);
+ renderedSomething += this->YAxisLabel->RenderTranslucentPolygonalGeometry(vp);
+ renderedSomething += this->ZAxisLabel->RenderTranslucentPolygonalGeometry(vp);
+
+ return renderedSomething;
+}
+
+//-----------------------------------------------------------------------------
+// porting to VTK 5.0.x
+int vtkPVAxesActor::HasTranslucentPolygonalGeometry()
+{
+ int result = 0;
+
+ this->UpdateProps();
+
+ result |= this->XAxisShaft->HasTranslucentPolygonalGeometry();
+ result |= this->YAxisShaft->HasTranslucentPolygonalGeometry();
+ result |= this->ZAxisShaft->HasTranslucentPolygonalGeometry();
+
+ result |= this->XAxisTip->HasTranslucentPolygonalGeometry();
+ result |= this->YAxisTip->HasTranslucentPolygonalGeometry();
+ result |= this->ZAxisTip->HasTranslucentPolygonalGeometry();
+
+ result |= this->XAxisLabel->HasTranslucentPolygonalGeometry();
+ result |= this->YAxisLabel->HasTranslucentPolygonalGeometry();
+ result |= this->ZAxisLabel->HasTranslucentPolygonalGeometry();
+
+ return result;
+}
+
+#else
+//-----------------------------------------------------------------------------
+// porting to VTK 5.0.x
+int vtkPVAxesActor::RenderTranslucentGeometry(vtkViewport *vp)
+{
+ int renderedSomething=0;
+
+ this->UpdateProps();
+
+ renderedSomething += this->XAxisShaft->RenderTranslucentGeometry(vp);
+ renderedSomething += this->YAxisShaft->RenderTranslucentGeometry(vp);
+ renderedSomething += this->ZAxisShaft->RenderTranslucentGeometry(vp);
+
+ renderedSomething += this->XAxisTip->RenderTranslucentGeometry(vp);
+ renderedSomething += this->YAxisTip->RenderTranslucentGeometry(vp);
+ renderedSomething += this->ZAxisTip->RenderTranslucentGeometry(vp);
+
+ renderedSomething += this->XAxisLabel->RenderTranslucentGeometry(vp);
+ renderedSomething += this->YAxisLabel->RenderTranslucentGeometry(vp);
+ renderedSomething += this->ZAxisLabel->RenderTranslucentGeometry(vp);
+
+ return renderedSomething;
+}
+#endif
+
+//-----------------------------------------------------------------------------
+void vtkPVAxesActor::ReleaseGraphicsResources(vtkWindow *win)
+{
+ this->XAxisShaft->ReleaseGraphicsResources( win );
+ this->YAxisShaft->ReleaseGraphicsResources( win );
+ this->ZAxisShaft->ReleaseGraphicsResources( win );
+
+ this->XAxisTip->ReleaseGraphicsResources( win );
+ this->YAxisTip->ReleaseGraphicsResources( win );
+ this->ZAxisTip->ReleaseGraphicsResources( win );
+
+ this->XAxisLabel->ReleaseGraphicsResources( win );
+ this->YAxisLabel->ReleaseGraphicsResources( win );
+ this->ZAxisLabel->ReleaseGraphicsResources( win );
+}
+
+//-----------------------------------------------------------------------------
+void vtkPVAxesActor::GetBounds(double bounds[6])
+{
+ double *bds = this->GetBounds();
+ bounds[0] = bds[0];
+ bounds[1] = bds[1];
+ bounds[2] = bds[2];
+ bounds[3] = bds[3];
+ bounds[4] = bds[4];
+ bounds[5] = bds[5];
+}
+
+//-----------------------------------------------------------------------------
+// Get the bounds for this Actor as (Xmin,Xmax,Ymin,Ymax,Zmin,Zmax).
+double *vtkPVAxesActor::GetBounds()
+{
+ double bounds[6];
+ int i;
+
+ this->XAxisShaft->GetBounds(this->Bounds);
+
+ this->YAxisShaft->GetBounds(bounds);
+ for (i=0; i<3; i++)
+ {
+ this->Bounds[2*i+1] =
+ (bounds[2*i+1]>this->Bounds[2*i+1])?(bounds[2*i+1]):(this->Bounds[2*i+1]);
+ }
+
+ this->ZAxisShaft->GetBounds(bounds);
+ for (i=0; i<3; i++)
+ {
+ this->Bounds[2*i+1] =
+ (bounds[2*i+1]>this->Bounds[2*i+1])?(bounds[2*i+1]):(this->Bounds[2*i+1]);
+ }
+
+ this->XAxisTip->GetBounds(bounds);
+ for (i=0; i<3; i++)
+ {
+ this->Bounds[2*i+1] =
+ (bounds[2*i+1]>this->Bounds[2*i+1])?(bounds[2*i+1]):(this->Bounds[2*i+1]);
+ }
+
+ this->YAxisTip->GetBounds(bounds);
+ for (i=0; i<3; i++)
+ {
+ this->Bounds[2*i+1] =
+ (bounds[2*i+1]>this->Bounds[2*i+1])?(bounds[2*i+1]):(this->Bounds[2*i+1]);
+ }
+
+ this->ZAxisTip->GetBounds(bounds);
+ for (i=0; i<3; i++)
+ {
+ this->Bounds[2*i+1] =
+ (bounds[2*i+1]>this->Bounds[2*i+1])?(bounds[2*i+1]):(this->Bounds[2*i+1]);
+ }
+
+ double dbounds[6];
+ (vtkPolyDataMapper::SafeDownCast(this->YAxisShaft->GetMapper()))->
+ GetInput()->GetBounds( dbounds );
+
+ for (i=0; i<3; i++)
+ {
+ this->Bounds[2*i+1] =
+ (dbounds[2*i+1]>this->Bounds[2*i+1])?(dbounds[2*i+1]):(this->Bounds[2*i+1]);
+ }
+
+ // We want this actor to rotate / re-center about the origin, so give it
+ // the bounds it would have if the axes were symmetrical.
+ for (i = 0; i < 3; i++)
+ {
+ this->Bounds[2*i] = -this->Bounds[2*i+1];
+ }
+
+ return this->Bounds;
+}
+
+//-----------------------------------------------------------------------------
+unsigned long int vtkPVAxesActor::GetMTime()
+{
+ unsigned long mTime=this->Superclass::GetMTime();
+
+
+ return mTime;
+}
+
+//-----------------------------------------------------------------------------
+unsigned long int vtkPVAxesActor::GetRedrawMTime()
+{
+ unsigned long mTime=this->GetMTime();
+
+ return mTime;
+}
+
+//-----------------------------------------------------------------------------
+vtkProperty *vtkPVAxesActor::GetXAxisTipProperty()
+{
+ return this->XAxisTip->GetProperty();
+}
+
+//-----------------------------------------------------------------------------
+vtkProperty *vtkPVAxesActor::GetYAxisTipProperty()
+{
+ return this->YAxisTip->GetProperty();
+}
+
+//-----------------------------------------------------------------------------
+vtkProperty *vtkPVAxesActor::GetZAxisTipProperty()
+{
+ return this->ZAxisTip->GetProperty();
+}
+
+//-----------------------------------------------------------------------------
+vtkProperty *vtkPVAxesActor::GetXAxisShaftProperty()
+{
+ return this->XAxisShaft->GetProperty();
+}
+
+//-----------------------------------------------------------------------------
+vtkProperty *vtkPVAxesActor::GetYAxisShaftProperty()
+{
+ return this->YAxisShaft->GetProperty();
+}
+
+//-----------------------------------------------------------------------------
+vtkProperty *vtkPVAxesActor::GetZAxisShaftProperty()
+{
+ return this->ZAxisShaft->GetProperty();
+}
+
+//-----------------------------------------------------------------------------
+vtkProperty *vtkPVAxesActor::GetXAxisLabelProperty()
+{
+ return this->XAxisLabel->GetProperty();
+}
+
+//-----------------------------------------------------------------------------
+vtkProperty *vtkPVAxesActor::GetYAxisLabelProperty()
+{
+ return this->YAxisLabel->GetProperty();
+}
+
+//-----------------------------------------------------------------------------
+vtkProperty *vtkPVAxesActor::GetZAxisLabelProperty()
+{
+ return this->ZAxisLabel->GetProperty();
+}
+
+//-----------------------------------------------------------------------------
+void vtkPVAxesActor::SetTotalLength( float x, float y, float z )
+{
+ if ( this->TotalLength[0] != x ||
+ this->TotalLength[1] != y ||
+ this->TotalLength[2] != z )
+ {
+ this->TotalLength[0] = x;
+ this->TotalLength[1] = y;
+ this->TotalLength[2] = z;
+
+ this->Modified();
+
+ this->UpdateProps();
+ }
+}
+
+//-----------------------------------------------------------------------------
+void vtkPVAxesActor::SetNormalizedShaftLength( float x, float y, float z )
+{
+ if ( this->NormalizedShaftLength[0] != x ||
+ this->NormalizedShaftLength[1] != y ||
+ this->NormalizedShaftLength[2] != z )
+ {
+ this->NormalizedShaftLength[0] = x;
+ this->NormalizedShaftLength[1] = y;
+ this->NormalizedShaftLength[2] = z;
+
+ this->Modified();
+
+ this->UpdateProps();
+ }
+}
+
+//-----------------------------------------------------------------------------
+void vtkPVAxesActor::SetNormalizedTipLength( float x, float y, float z )
+{
+ if ( this->NormalizedTipLength[0] != x ||
+ this->NormalizedTipLength[1] != y ||
+ this->NormalizedTipLength[2] != z )
+ {
+ this->NormalizedTipLength[0] = x;
+ this->NormalizedTipLength[1] = y;
+ this->NormalizedTipLength[2] = z;
+
+ this->Modified();
+
+ this->UpdateProps();
+ }
+}
+
+//-----------------------------------------------------------------------------
+void vtkPVAxesActor::SetShaftType( int type )
+{
+ if ( this->ShaftType != type )
+ {
+ this->ShaftType = type;
+
+ this->Modified();
+
+ this->UpdateProps();
+ }
+}
+
+//-----------------------------------------------------------------------------
+void vtkPVAxesActor::SetTipType( int type )
+{
+ if ( this->TipType != type )
+ {
+ this->TipType = type;
+
+ this->Modified();
+
+ this->UpdateProps();
+ }
+}
+
+//-----------------------------------------------------------------------------
+void vtkPVAxesActor::UpdateProps()
+{
+ this->CylinderSource->SetRadius(this->CylinderRadius);
+ this->CylinderSource->SetResolution(this->CylinderResolution);
+
+
+ this->ConeSource->SetResolution(this->ConeResolution);
+ this->ConeSource->SetRadius(this->ConeRadius);
+
+ this->SphereSource->SetThetaResolution( this->SphereResolution );
+ this->SphereSource->SetPhiResolution( this->SphereResolution );
+ this->SphereSource->SetRadius(this->SphereRadius);
+
+ switch ( this->ShaftType )
+ {
+ case vtkPVAxesActor::CYLINDER_SHAFT:
+ (vtkPolyDataMapper::SafeDownCast(this->XAxisShaft->GetMapper()))->
+ SetInput( this->CylinderSource->GetOutput() );
+ break;
+ case vtkPVAxesActor::LINE_SHAFT:
+ (vtkPolyDataMapper::SafeDownCast(this->XAxisShaft->GetMapper()))->
+ SetInput( this->LineSource->GetOutput() );
+ break;
+ case vtkPVAxesActor::USER_DEFINED_SHAFT:
+ (vtkPolyDataMapper::SafeDownCast(this->XAxisShaft->GetMapper()))->
+ SetInput( this->UserDefinedShaft );
+ }
+
+ switch ( this->TipType )
+ {
+ case vtkPVAxesActor::CONE_TIP:
+ (vtkPolyDataMapper::SafeDownCast(this->XAxisTip->GetMapper()))->
+ SetInput( this->ConeSource->GetOutput() );
+ break;
+ case vtkPVAxesActor::SPHERE_TIP:
+ (vtkPolyDataMapper::SafeDownCast(this->XAxisTip->GetMapper()))->
+ SetInput( this->SphereSource->GetOutput() );
+ break;
+ case vtkPVAxesActor::USER_DEFINED_TIP:
+ (vtkPolyDataMapper::SafeDownCast(this->XAxisTip->GetMapper()))->
+ SetInput( this->UserDefinedTip );
+ }
+
+ (vtkPolyDataMapper::SafeDownCast(this->XAxisTip->GetMapper()))->
+ GetInput()->Update();
+ (vtkPolyDataMapper::SafeDownCast(this->XAxisShaft->GetMapper()))->
+ GetInput()->Update();
+
+
+
+ float scale[3];
+ double bounds[6];
+
+ (vtkPolyDataMapper::SafeDownCast(this->XAxisShaft->GetMapper()))->
+ GetInput()->GetBounds( bounds );
+
+ int i;
+ for ( i = 0; i < 3; i++ )
+ {
+ scale[i] =
+ this->NormalizedShaftLength[i]*this->TotalLength[i] /
+ (bounds[3] - bounds[2]);
+ }
+
+ vtkTransform *xTransform = vtkTransform::New();
+ vtkTransform *yTransform = vtkTransform::New();
+ vtkTransform *zTransform = vtkTransform::New();
+
+ xTransform->RotateZ( -90 );
+ zTransform->RotateX( 90 );
+
+ xTransform->Scale( scale[0], scale[0], scale[0] );
+ yTransform->Scale( scale[1], scale[1], scale[1] );
+ zTransform->Scale( scale[2], scale[2], scale[2] );
+
+ xTransform->Translate( -(bounds[0]+bounds[1])/2,
+ -bounds[2],
+ -(bounds[4]+bounds[5])/2 );
+ yTransform->Translate( -(bounds[0]+bounds[1])/2,
+ -bounds[2],
+ -(bounds[4]+bounds[5])/2 );
+ zTransform->Translate( -(bounds[0]+bounds[1])/2,
+ -bounds[2],
+ -(bounds[4]+bounds[5])/2 );
+
+
+
+ this->XAxisShaft->SetUserTransform( xTransform );
+ this->YAxisShaft->SetUserTransform( yTransform );
+ this->ZAxisShaft->SetUserTransform( zTransform );
+
+ xTransform->Delete();
+ yTransform->Delete();
+ zTransform->Delete();
+
+ (vtkPolyDataMapper::SafeDownCast(this->XAxisTip->GetMapper()))->
+ GetInput()->GetBounds( bounds );
+
+ xTransform = vtkTransform::New();
+ yTransform = vtkTransform::New();
+ zTransform = vtkTransform::New();
+
+ xTransform->RotateZ( -90 );
+ zTransform->RotateX( 90 );
+
+ xTransform->Scale( this->TotalLength[0], this->TotalLength[0], this->TotalLength[0] );
+ yTransform->Scale( this->TotalLength[1], this->TotalLength[1], this->TotalLength[1] );
+ zTransform->Scale( this->TotalLength[2], this->TotalLength[2], this->TotalLength[2] );
+
+ xTransform->Translate( 0, (1.0 - this->NormalizedTipLength[0]), 0 );
+ yTransform->Translate( 0, (1.0 - this->NormalizedTipLength[1]), 0 );
+ zTransform->Translate( 0, (1.0 - this->NormalizedTipLength[2]), 0 );
+
+ xTransform->Scale( this->NormalizedTipLength[0],
+ this->NormalizedTipLength[0],
+ this->NormalizedTipLength[0] );
+
+ yTransform->Scale( this->NormalizedTipLength[1],
+ this->NormalizedTipLength[1],
+ this->NormalizedTipLength[1] );
+
+ zTransform->Scale( this->NormalizedTipLength[2],
+ this->NormalizedTipLength[2],
+ this->NormalizedTipLength[2] );
+
+ xTransform->Translate( -(bounds[0]+bounds[1])/2,
+ -bounds[2],
+ -(bounds[4]+bounds[5])/2 );
+ yTransform->Translate( -(bounds[0]+bounds[1])/2,
+ -bounds[2],
+ -(bounds[4]+bounds[5])/2 );
+ zTransform->Translate( -(bounds[0]+bounds[1])/2,
+ -bounds[2],
+ -(bounds[4]+bounds[5])/2 );
+
+
+ this->XAxisTip->SetUserTransform( xTransform );
+ this->YAxisTip->SetUserTransform( yTransform );
+ this->ZAxisTip->SetUserTransform( zTransform );
+
+ xTransform->Delete();
+ yTransform->Delete();
+ zTransform->Delete();
+
+ this->XAxisVectorText->SetText( this->XAxisLabelText );
+ this->YAxisVectorText->SetText( this->YAxisLabelText );
+ this->ZAxisVectorText->SetText( this->ZAxisLabelText );
+
+
+ float avgScale =
+ (this->TotalLength[0] + this->TotalLength[1] + this->TotalLength[2])/15;
+
+ this->XAxisShaft->GetBounds(bounds);
+ this->XAxisLabel->SetScale( avgScale, avgScale, avgScale );
+ this->XAxisLabel->SetPosition( bounds[0] + this->XAxisLabelPosition *
+ (bounds[1]-bounds[0]),
+ bounds[2] - (bounds[3]-bounds[2])*2.0,
+ bounds[5] + (bounds[5]-bounds[4])/2.0 );
+
+ this->YAxisShaft->GetBounds(bounds);
+ this->YAxisLabel->SetScale( avgScale, avgScale, avgScale );
+ this->YAxisLabel->SetPosition( (bounds[0]+bounds[1])/2,
+ bounds[2] + this->YAxisLabelPosition *
+ (bounds[3]-bounds[2]),
+ bounds[5] + (bounds[5]-bounds[4])/2.0 );
+
+ this->ZAxisShaft->GetBounds(bounds);
+ this->ZAxisLabel->SetScale( avgScale, avgScale, avgScale );
+ this->ZAxisLabel->SetPosition( bounds[0],
+ bounds[2] - (bounds[3]-bounds[2])*2.0,
+ bounds[4] + this->ZAxisLabelPosition *
+ (bounds[5]-bounds[4]) );
+}
+
+//-----------------------------------------------------------------------------
+void vtkPVAxesActor::PrintSelf(ostream& os, vtkIndent indent)
+{
+ this->Superclass::PrintSelf(os,indent);
+
+ os << indent << "UserDefinedShaft: ";
+ if (this->UserDefinedShaft)
+ {
+ os << this->UserDefinedShaft << endl;
+ }
+ else
+ {
+ os << "(none)" << endl;
+ }
+
+ os << indent << "UserDefinedTip: ";
+ if (this->UserDefinedTip)
+ {
+ os << this->UserDefinedTip << endl;
+ }
+ else
+ {
+ os << "(none)" << endl;
+ }
+
+ os << indent << "XAxisLabelText: " << (this->XAxisLabelText ?
+ this->XAxisLabelText : "(none)")
+ << endl;
+ os << indent << "YAxisLabelText: " << (this->YAxisLabelText ?
+ this->YAxisLabelText : "(none)")
+ << endl;
+ os << indent << "ZAxisLabelText: " << (this->ZAxisLabelText ?
+ this->ZAxisLabelText : "(none)")
+ << endl;
+ os << indent << "XAxisLabelPosition: " << this->XAxisLabelPosition << endl;
+ os << indent << "YAxisLabelPosition: " << this->YAxisLabelPosition << endl;
+ os << indent << "ZAxisLabelPosition: " << this->ZAxisLabelPosition << endl;
+
+ os << indent << "SphereRadius: " << this->SphereRadius << endl;
+ os << indent << "SphereResolution: " << this->SphereResolution << endl;
+ os << indent << "CylinderRadius: " << this->CylinderRadius << endl;
+ os << indent << "CylinderResolution: " << this->CylinderResolution << endl;
+ os << indent << "ConeRadius: " << this->ConeRadius << endl;
+ os << indent << "ConeResolution: " << this->ConeResolution << endl;
+
+ os << indent << "NormalizedShaftLength: "
+ << this->NormalizedShaftLength[0] << ","
+ << this->NormalizedShaftLength[1] << ","
+ << this->NormalizedShaftLength[2] << endl;
+ os << indent << "NormalizedTipLength: "
+ << this->NormalizedTipLength[0] << ","
+ << this->NormalizedTipLength[1] << ","
+ << this->NormalizedTipLength[2] << endl;
+ os << indent << "TotalLength: "
+ << this->TotalLength[0] << ","
+ << this->TotalLength[1] << ","
+ << this->TotalLength[2] << endl;
+}
+
+//-----------------------------------------------------------------------------
+// porting to VTK 5.0.x
+void vtkPVAxesActor::AddToRender( vtkRenderer* theRenderer )
+{
+ theRenderer->AddActor(this->XAxisLabel);
+ theRenderer->AddActor(this->YAxisLabel);
+ theRenderer->AddActor(this->ZAxisLabel);
+}
--- /dev/null
+/*=========================================================================
+
+ Program: ParaView
+ Module: $RCSfile$
+
+ Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc.
+ All rights reserved.
+
+ ParaView is a free software; you can redistribute it and/or modify it
+ under the terms of the ParaView license version 1.2.
+
+ See License_v1.2.txt for the full ParaView license.
+ A copy of this license can be obtained by contacting
+ Kitware Inc.
+ 28 Corporate Drive
+ Clifton Park, NY 12065
+ USA
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+=========================================================================*/
+// .NAME vtkPVAxesActor - a 3D axes representation
+// .SECTION Description
+//
+// vtkPVAxesActor is used to represent 3D axes in the scene. The user can
+// define the geometry to use for the shaft and the tip, and the user can
+// set the text for the three axes. The text will follow the camera.
+
+
+#ifndef __vtkPVAxesActor_h
+#define __vtkPVAxesActor_h
+
+#include "SVTK.h"
+#include "vtkProp3D.h"
+
+class vtkRenderer;
+class vtkPropCollection;
+class vtkMapper;
+class vtkProperty;
+class vtkActor;
+class vtkFollower;
+class vtkCylinderSource;
+class vtkLineSource;
+class vtkConeSource;
+class vtkSphereSource;
+class vtkPolyData;
+class vtkVectorText;
+
+class SVTK_EXPORT vtkPVAxesActor : public vtkProp3D
+{
+public:
+ static vtkPVAxesActor *New();
+ vtkTypeRevisionMacro(vtkPVAxesActor,vtkProp3D);
+ void PrintSelf(ostream& os, vtkIndent indent);
+
+
+ // Description:
+ // For some exporters and other other operations we must be
+ // able to collect all the actors or volumes. These methods
+ // are used in that process.
+ virtual void GetActors(vtkPropCollection *);
+
+ // Description:
+ // Support the standard render methods.
+ virtual int RenderOpaqueGeometry(vtkViewport *viewport);
+#if (VTK_MINOR_VERSION>=2)
+ virtual int RenderTranslucentPolygonalGeometry(vtkViewport *viewport); // porting to VTK 5.0.x
+ virtual int HasTranslucentPolygonalGeometry(); // porting to VTK 5.0.x
+#else
+ virtual int RenderTranslucentGeometry(vtkViewport *viewport); // porting to VTK 5.0.x
+#endif
+
+ // Description:
+ // Shallow copy of an axes actor. Overloads the virtual vtkProp method.
+ void ShallowCopy(vtkProp *prop);
+
+ // 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.
+ void ReleaseGraphicsResources(vtkWindow *);
+
+ // Description:
+ // Get the bounds for this Actor as (Xmin,Xmax,Ymin,Ymax,Zmin,Zmax). (The
+ // method GetBounds(double bounds[6]) is available from the superclass.)
+ void GetBounds(double bounds[6]);
+ double *GetBounds();
+
+ // Description:
+ // Get the actors mtime plus consider its properties and texture if set.
+ unsigned long int GetMTime();
+
+ // Description:
+ // Return the mtime of anything that would cause the rendered image to
+ // appear differently. Usually this involves checking the mtime of the
+ // prop plus anything else it depends on such as properties, textures
+ // etc.
+ virtual unsigned long GetRedrawMTime();
+
+ // Description:
+ // Set the total length of the axes in 3 dimensions.
+ void SetTotalLength( float v[3] )
+ { this->SetTotalLength( v[0], v[1], v[2] ); }
+ void SetTotalLength( float x, float y, float z );
+ vtkGetVectorMacro( TotalLength, float, 3 );
+
+ // Description:
+ // Set the normalized (0-1) length of the shaft.
+ void SetNormalizedShaftLength( float v[3] )
+ { this->SetNormalizedShaftLength( v[0], v[1], v[2] ); }
+ void SetNormalizedShaftLength( float x, float y, float z );
+ vtkGetVectorMacro( NormalizedShaftLength, float, 3 );
+
+ // Description:
+ // Set the normalized (0-1) length of the tip.
+ void SetNormalizedTipLength( float v[3] )
+ { this->SetNormalizedTipLength( v[0], v[1], v[2] ); }
+ void SetNormalizedTipLength( float x, float y, float z );
+ vtkGetVectorMacro( NormalizedTipLength, float, 3 );
+
+ // Description:
+ // Set/get the resolution of the pieces of the axes actor
+ vtkSetClampMacro(ConeResolution, int, 3, 128);
+ vtkGetMacro(ConeResolution, int);
+ vtkSetClampMacro(SphereResolution, int, 3, 128);
+ vtkGetMacro(SphereResolution, int);
+ vtkSetClampMacro(CylinderResolution, int, 3, 128);
+ vtkGetMacro(CylinderResolution, int);
+
+ // Description:
+ // Set/get the radius of the pieces of the axes actor
+ vtkSetClampMacro(ConeRadius, float, 0, VTK_LARGE_FLOAT);
+ vtkGetMacro(ConeRadius, float);
+ vtkSetClampMacro(SphereRadius, float, 0, VTK_LARGE_FLOAT);
+ vtkGetMacro(SphereRadius, float);
+ vtkSetClampMacro(CylinderRadius, float, 0, VTK_LARGE_FLOAT);
+ vtkGetMacro(CylinderRadius, float);
+
+ // Description:
+ // Set/get the positions of the axis labels
+ vtkSetClampMacro(XAxisLabelPosition, float, 0, 1);
+ vtkGetMacro(XAxisLabelPosition, float);
+ vtkSetClampMacro(YAxisLabelPosition, float, 0, 1);
+ vtkGetMacro(YAxisLabelPosition, float);
+ vtkSetClampMacro(ZAxisLabelPosition, float, 0, 1);
+ vtkGetMacro(ZAxisLabelPosition, float);
+
+ // Description:
+ // Set the type of the shaft to a cylinder, line, or user defined geometry.
+ void SetShaftType( int type );
+ void SetShaftTypeToCylinder()
+ { this->SetShaftType( vtkPVAxesActor::CYLINDER_SHAFT ); }
+ void SetShaftTypeToLine()
+ { this->SetShaftType( vtkPVAxesActor::LINE_SHAFT ); }
+ void SetShaftTypeToUserDefined()
+ { this->SetShaftType( vtkPVAxesActor::USER_DEFINED_SHAFT ); }
+
+ // Description:
+ // Set the type of the tip to a cone, sphere, or user defined geometry.
+ void SetTipType( int type );
+ void SetTipTypeToCone()
+ { this->SetTipType( vtkPVAxesActor::CONE_TIP ); }
+ void SetTipTypeToSphere()
+ { this->SetTipType( vtkPVAxesActor::SPHERE_TIP ); }
+ void SetTipTypeToUserDefined()
+ { this->SetTipType( vtkPVAxesActor::USER_DEFINED_TIP ); }
+
+ //BTX
+ // Description:
+ // Set the user defined tip polydata.
+ void SetUserDefinedTip( vtkPolyData * );
+ vtkGetObjectMacro( UserDefinedTip, vtkPolyData );
+
+ // Description:
+ // Set the user defined shaft polydata.
+ void SetUserDefinedShaft( vtkPolyData * );
+ vtkGetObjectMacro( UserDefinedShaft, vtkPolyData );
+
+ // Description:
+ // Get the tip properties.
+ vtkProperty *GetXAxisTipProperty();
+ vtkProperty *GetYAxisTipProperty();
+ vtkProperty *GetZAxisTipProperty();
+
+ // Description:
+ // Get the shaft properties.
+ vtkProperty *GetXAxisShaftProperty();
+ vtkProperty *GetYAxisShaftProperty();
+ vtkProperty *GetZAxisShaftProperty();
+
+ // Description:
+ // Get the label properties.
+ vtkProperty *GetXAxisLabelProperty();
+ vtkProperty *GetYAxisLabelProperty();
+ vtkProperty *GetZAxisLabelProperty();
+ //ETX
+ //
+ // Description:
+ // Set the label text.
+ vtkSetStringMacro( XAxisLabelText );
+ vtkSetStringMacro( YAxisLabelText );
+ vtkSetStringMacro( ZAxisLabelText );
+
+//BTX
+ enum
+ {
+ CYLINDER_SHAFT,
+ LINE_SHAFT,
+ USER_DEFINED_SHAFT
+ };
+
+
+ enum
+ {
+ CONE_TIP,
+ SPHERE_TIP,
+ USER_DEFINED_TIP
+ };
+
+//ETX
+
+ void AddToRender( vtkRenderer* theRenderer ); // porting to VTK 5.0.x
+
+protected:
+ vtkPVAxesActor();
+ ~vtkPVAxesActor();
+
+ vtkCylinderSource *CylinderSource;
+ vtkLineSource *LineSource;
+ vtkConeSource *ConeSource;
+ vtkSphereSource *SphereSource;
+
+ vtkActor *XAxisShaft;
+ vtkActor *YAxisShaft;
+ vtkActor *ZAxisShaft;
+
+ vtkActor *XAxisTip;
+ vtkActor *YAxisTip;
+ vtkActor *ZAxisTip;
+
+ void UpdateProps();
+
+ float TotalLength[3];
+ float NormalizedShaftLength[3];
+ float NormalizedTipLength[3];
+
+ int ShaftType;
+ int TipType;
+
+ vtkPolyData *UserDefinedTip;
+ vtkPolyData *UserDefinedShaft;
+
+ char *XAxisLabelText;
+ char *YAxisLabelText;
+ char *ZAxisLabelText;
+
+ vtkVectorText *XAxisVectorText;
+ vtkVectorText *YAxisVectorText;
+ vtkVectorText *ZAxisVectorText;
+
+ vtkFollower *XAxisLabel;
+ vtkFollower *YAxisLabel;
+ vtkFollower *ZAxisLabel;
+
+ int ConeResolution;
+ int SphereResolution;
+ int CylinderResolution;
+
+ float ConeRadius;
+ float SphereRadius;
+ float CylinderRadius;
+
+ float XAxisLabelPosition;
+ float YAxisLabelPosition;
+ float ZAxisLabelPosition;
+
+private:
+ vtkPVAxesActor(const vtkPVAxesActor&); // Not implemented.
+ void operator=(const vtkPVAxesActor&); // Not implemented.
+};
+
+#endif
+
--- /dev/null
+/*=========================================================================
+
+ Program: ParaView
+ Module: $RCSfile$
+
+ Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc.
+ All rights reserved.
+
+ ParaView is a free software; you can redistribute it and/or modify it
+ under the terms of the ParaView license version 1.2.
+
+ See License_v1.2.txt for the full ParaView license.
+ A copy of this license can be obtained by contacting
+ Kitware Inc.
+ 28 Corporate Drive
+ Clifton Park, NY 12065
+ USA
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+=========================================================================*/
+#include "vtkPVAxesWidget.h"
+
+#include "vtkActor2D.h"
+#include "vtkCallbackCommand.h"
+#include "vtkCamera.h"
+#include "vtkCoordinate.h"
+#include "vtkObjectFactory.h"
+#include "vtkPoints.h"
+#include "vtkPolyData.h"
+#include "vtkPolyDataMapper2D.h"
+#include "vtkProperty.h"
+#include "vtkProperty2D.h"
+#include "vtkPVAxesActor.h"
+#include "vtkRenderer.h"
+#include "vtkRenderWindow.h"
+#include "vtkRenderWindowInteractor.h"
+
+vtkStandardNewMacro(vtkPVAxesWidget);
+vtkCxxRevisionMacro(vtkPVAxesWidget, "$Revision$");
+
+vtkCxxSetObjectMacro(vtkPVAxesWidget, AxesActor, vtkPVAxesActor);
+vtkCxxSetObjectMacro(vtkPVAxesWidget, ParentRenderer, vtkRenderer);
+
+//----------------------------------------------------------------------------
+class vtkPVAxesWidgetObserver : public vtkCommand
+{
+public:
+ static vtkPVAxesWidgetObserver *New()
+ {return new vtkPVAxesWidgetObserver;};
+
+ vtkPVAxesWidgetObserver()
+ {
+ this->AxesWidget = 0;
+ }
+
+ virtual void Execute(vtkObject* wdg, unsigned long event, void *calldata)
+ {
+ if (this->AxesWidget)
+ {
+ this->AxesWidget->ExecuteEvent(wdg, event, calldata);
+ }
+ }
+
+ vtkPVAxesWidget *AxesWidget;
+};
+
+//----------------------------------------------------------------------------
+vtkPVAxesWidget::vtkPVAxesWidget()
+{
+ this->StartEventObserverId = 0;
+
+ this->EventCallbackCommand->SetCallback(vtkPVAxesWidget::ProcessEvents);
+
+ this->Observer = vtkPVAxesWidgetObserver::New();
+ this->Observer->AxesWidget = this;
+ this->Renderer = vtkRenderer::New();
+ this->Renderer->SetViewport(0.0, 0.0, 0.2, 0.2);
+ this->Renderer->SetLayer(1);
+ this->Renderer->InteractiveOff();
+ this->Priority = 0.55;
+ this->AxesActor = vtkPVAxesActor::New();
+ this->Renderer->AddActor(this->AxesActor);
+ this->AxesActor->AddToRender(this->Renderer); // tmp
+
+ this->ParentRenderer = NULL;
+
+ this->Moving = 0;
+ this->MouseCursorState = vtkPVAxesWidget::Outside;
+
+ this->StartTag = 0;
+
+ this->Interactive = 1;
+
+ this->Outline = vtkPolyData::New();
+ this->Outline->Allocate();
+ vtkPoints *points = vtkPoints::New();
+ vtkIdType ptIds[5];
+ ptIds[4] = ptIds[0] = points->InsertNextPoint(1, 1, 0);
+ ptIds[1] = points->InsertNextPoint(2, 1, 0);
+ ptIds[2] = points->InsertNextPoint(2, 2, 0);
+ ptIds[3] = points->InsertNextPoint(1, 2, 0);
+ this->Outline->SetPoints(points);
+ this->Outline->InsertNextCell(VTK_POLY_LINE, 5, ptIds);
+ vtkCoordinate *tcoord = vtkCoordinate::New();
+ tcoord->SetCoordinateSystemToDisplay();
+ vtkPolyDataMapper2D *mapper = vtkPolyDataMapper2D::New();
+ mapper->SetInput(this->Outline);
+ mapper->SetTransformCoordinate(tcoord);
+ this->OutlineActor = vtkActor2D::New();
+ this->OutlineActor->SetMapper(mapper);
+ this->OutlineActor->SetPosition(0, 0);
+ this->OutlineActor->SetPosition2(1, 1);
+
+ points->Delete();
+ mapper->Delete();
+ tcoord->Delete();
+}
+
+//----------------------------------------------------------------------------
+vtkPVAxesWidget::~vtkPVAxesWidget()
+{
+ this->Observer->Delete();
+ this->AxesActor->Delete();
+ this->OutlineActor->Delete();
+ this->Outline->Delete();
+ this->SetParentRenderer(NULL);
+ this->Renderer->Delete();
+}
+
+//----------------------------------------------------------------------------
+void vtkPVAxesWidget::SetEnabled(int enabling)
+{
+ if (!this->Interactor)
+ {
+ vtkErrorMacro("The interactor must be set prior to enabling/disabling widget");
+ }
+
+ if (enabling)
+ {
+ if (this->Enabled)
+ {
+ return;
+ }
+ if (!this->ParentRenderer)
+ {
+ vtkErrorMacro("The parent renderer must be set prior to enabling this widget");
+ return;
+ }
+
+ this->Enabled = 1;
+
+ if ( this->EventCallbackCommand )
+ {
+ vtkRenderWindowInteractor *i = this->Interactor;
+ i->AddObserver(vtkCommand::MouseMoveEvent,
+ this->EventCallbackCommand, this->Priority);
+ i->AddObserver(vtkCommand::LeftButtonPressEvent,
+ this->EventCallbackCommand, this->Priority);
+ i->AddObserver(vtkCommand::LeftButtonReleaseEvent,
+ this->EventCallbackCommand, this->Priority);
+ }
+
+ this->ParentRenderer->GetRenderWindow()->AddRenderer(this->Renderer);
+ if (this->ParentRenderer->GetRenderWindow()->GetNumberOfLayers() < 2)
+ {
+ this->ParentRenderer->GetRenderWindow()->SetNumberOfLayers(2);
+ }
+ this->AxesActor->SetVisibility(1);
+ // We need to copy the camera before the compositing observer is called.
+ // Compositing temporarily changes the camera to display an image.
+ this->StartEventObserverId =
+ this->ParentRenderer->AddObserver(vtkCommand::StartEvent,this->Observer,1);
+ this->InvokeEvent(vtkCommand::EnableEvent, NULL);
+ }
+ else
+ {
+ if (!this->Enabled)
+ {
+ return;
+ }
+
+ this->Enabled = 0;
+ this->Interactor->RemoveObserver(this->EventCallbackCommand);
+
+ this->AxesActor->SetVisibility(0);
+ if (this->ParentRenderer)
+ {
+ if (this->ParentRenderer->GetRenderWindow())
+ {
+ this->ParentRenderer->GetRenderWindow()->RemoveRenderer(this->Renderer);
+ this->AxesActor->ReleaseGraphicsResources(this->ParentRenderer->GetRenderWindow());
+ }
+ if (this->StartEventObserverId != 0)
+ {
+ this->ParentRenderer->RemoveObserver(this->StartEventObserverId);
+ }
+ }
+
+ this->InvokeEvent(vtkCommand::DisableEvent, NULL);
+ }
+}
+
+//----------------------------------------------------------------------------
+void vtkPVAxesWidget::ExecuteEvent(vtkObject *vtkNotUsed(o),
+ unsigned long vtkNotUsed(event),
+ void *vtkNotUsed(calldata))
+{
+ if (!this->ParentRenderer)
+ {
+ return;
+ }
+
+ vtkCamera *cam = this->ParentRenderer->GetActiveCamera();
+ double pos[3], fp[3], viewup[3];
+ cam->GetPosition(pos);
+ cam->GetFocalPoint(fp);
+ cam->GetViewUp(viewup);
+
+ cam = this->Renderer->GetActiveCamera();
+ cam->SetPosition(pos);
+ cam->SetFocalPoint(fp);
+ cam->SetViewUp(viewup);
+ this->Renderer->ResetCamera();
+
+ this->SquareRenderer();
+}
+
+void vtkPVAxesWidget::UpdateCursorIcon()
+{
+ if (!this->Enabled)
+ {
+ this->SetMouseCursor(vtkPVAxesWidget::Outside);
+ return;
+ }
+
+ if (this->Moving)
+ {
+ return;
+ }
+
+ int *parentSize = this->ParentRenderer->GetSize();
+
+ int x = this->Interactor->GetEventPosition()[0];
+ int y = this->Interactor->GetEventPosition()[1];
+ double xNorm = x / (double)parentSize[0];
+ double yNorm = y / (double)parentSize[1];
+
+ double pos[4];
+ this->Renderer->GetViewport(pos);
+
+ int pState = this->MouseCursorState;
+
+ if (xNorm > pos[0] && xNorm < pos[2] && yNorm > pos[1] && yNorm < pos[3])
+ {
+ this->MouseCursorState = vtkPVAxesWidget::Inside;
+ }
+ else if (fabs(xNorm-pos[0]) < .02 && fabs(yNorm-pos[3]) < .02)
+ {
+ this->MouseCursorState = vtkPVAxesWidget::TopLeft;
+ }
+ else if (fabs(xNorm-pos[2]) < .02 && fabs(yNorm-pos[3]) < .02)
+ {
+ this->MouseCursorState = vtkPVAxesWidget::TopRight;
+ }
+ else if (fabs(xNorm-pos[0]) < .02 && fabs(yNorm-pos[1]) < .02)
+ {
+ this->MouseCursorState = vtkPVAxesWidget::BottomLeft;
+ }
+ else if (fabs(xNorm-pos[2]) < .02 && fabs(yNorm-pos[1]) < .02)
+ {
+ this->MouseCursorState = vtkPVAxesWidget::BottomRight;
+ }
+ else
+ {
+ this->MouseCursorState = vtkPVAxesWidget::Outside;
+ }
+
+ if (pState == this->MouseCursorState)
+ {
+ return;
+ }
+
+ if (this->MouseCursorState == vtkPVAxesWidget::Outside)
+ {
+ this->Renderer->RemoveActor(this->OutlineActor);
+ }
+ else
+ {
+ this->Renderer->AddActor(this->OutlineActor);
+ }
+ this->Interactor->Render();
+
+ this->SetMouseCursor(this->MouseCursorState);
+}
+
+//----------------------------------------------------------------------------
+void vtkPVAxesWidget::SetMouseCursor(int cursorState)
+{
+ switch (cursorState)
+ {
+ case vtkPVAxesWidget::Outside:
+ this->Interactor->GetRenderWindow()->SetCurrentCursor(VTK_CURSOR_DEFAULT);
+ break;
+ case vtkPVAxesWidget::Inside:
+ this->Interactor->GetRenderWindow()->SetCurrentCursor(VTK_CURSOR_SIZEALL);
+ break;
+ case vtkPVAxesWidget::TopLeft:
+ this->Interactor->GetRenderWindow()->SetCurrentCursor(VTK_CURSOR_SIZENW);
+ break;
+ case vtkPVAxesWidget::TopRight:
+ this->Interactor->GetRenderWindow()->SetCurrentCursor(VTK_CURSOR_SIZENE);
+ break;
+ case vtkPVAxesWidget::BottomLeft:
+ this->Interactor->GetRenderWindow()->SetCurrentCursor(VTK_CURSOR_SIZESW);
+ break;
+ case vtkPVAxesWidget::BottomRight:
+ this->Interactor->GetRenderWindow()->SetCurrentCursor(VTK_CURSOR_SIZESE);
+ break;
+ }
+}
+
+//----------------------------------------------------------------------------
+void vtkPVAxesWidget::ProcessEvents(vtkObject* vtkNotUsed(object),
+ unsigned long event,
+ void *clientdata,
+ void* vtkNotUsed(calldata))
+{
+ vtkPVAxesWidget *self =
+ reinterpret_cast<vtkPVAxesWidget*>(clientdata);
+
+ if (!self->GetInteractive())
+ {
+ return;
+ }
+
+ switch (event)
+ {
+ case vtkCommand::LeftButtonPressEvent:
+ self->OnButtonPress();
+ break;
+ case vtkCommand::MouseMoveEvent:
+ self->OnMouseMove();
+ break;
+ case vtkCommand::LeftButtonReleaseEvent:
+ self->OnButtonRelease();
+ break;
+ }
+}
+
+//----------------------------------------------------------------------------
+void vtkPVAxesWidget::OnButtonPress()
+{
+ if (this->MouseCursorState == vtkPVAxesWidget::Outside)
+ {
+ return;
+ }
+
+ this->SetMouseCursor(this->MouseCursorState);
+
+ this->StartPosition[0] = this->Interactor->GetEventPosition()[0];
+ this->StartPosition[1] = this->Interactor->GetEventPosition()[1];
+
+ this->Moving = 1;
+ this->EventCallbackCommand->SetAbortFlag(1);
+ this->StartInteraction();
+ this->InvokeEvent(vtkCommand::StartInteractionEvent, NULL);
+}
+
+//----------------------------------------------------------------------------
+void vtkPVAxesWidget::OnButtonRelease()
+{
+ if (this->MouseCursorState == vtkPVAxesWidget::Outside)
+ {
+ return;
+ }
+
+ this->Moving = 0;
+ this->EndInteraction();
+ this->InvokeEvent(vtkCommand::EndInteractionEvent, NULL);
+}
+
+//----------------------------------------------------------------------------
+void vtkPVAxesWidget::OnMouseMove()
+{
+ if (this->Moving)
+ {
+ switch (this->MouseCursorState)
+ {
+ case vtkPVAxesWidget::Inside:
+ this->MoveWidget();
+ break;
+ case vtkPVAxesWidget::TopLeft:
+ this->ResizeTopLeft();
+ break;
+ case vtkPVAxesWidget::TopRight:
+ this->ResizeTopRight();
+ break;
+ case vtkPVAxesWidget::BottomLeft:
+ this->ResizeBottomLeft();
+ break;
+ case vtkPVAxesWidget::BottomRight:
+ this->ResizeBottomRight();
+ break;
+ }
+
+ this->UpdateCursorIcon();
+ this->EventCallbackCommand->SetAbortFlag(1);
+ this->InvokeEvent(vtkCommand::InteractionEvent, NULL);
+ }
+ else
+ {
+ this->UpdateCursorIcon();
+ }
+}
+
+//----------------------------------------------------------------------------
+void vtkPVAxesWidget::MoveWidget()
+{
+ int x = this->Interactor->GetEventPosition()[0];
+ int y = this->Interactor->GetEventPosition()[1];
+
+ int dx = x - this->StartPosition[0];
+ int dy = y - this->StartPosition[1];
+
+ this->StartPosition[0] = x;
+ this->StartPosition[1] = y;
+
+ int *size = this->ParentRenderer->GetSize();
+ double dxNorm = dx / (double)size[0];
+ double dyNorm = dy / (double)size[1];
+
+ double *vp = this->Renderer->GetViewport();
+
+ double newPos[4];
+ newPos[0] = vp[0] + dxNorm;
+ newPos[1] = vp[1] + dyNorm;
+ newPos[2] = vp[2] + dxNorm;
+ newPos[3] = vp[3] + dyNorm;
+
+ if (newPos[0] < 0)
+ {
+ this->StartPosition[0] = 0;
+ newPos[0] = 0;
+ newPos[2] = vp[2] - vp[0];
+ }
+ if (newPos[1] < 0)
+ {
+ this->StartPosition[1] = 0;
+ newPos[1] = 0;
+ newPos[3] = vp[3] - vp[1];
+ }
+ if (newPos[2] > 1)
+ {
+ this->StartPosition[0] = (int)(size[0] - size[0] * (vp[2]-vp[0]));
+ newPos[0] = 1 - (vp[2]-vp[0]);
+ newPos[2] = 1;
+ }
+ if (newPos[3] > 1)
+ {
+ this->StartPosition[1] = (int)(size[1] - size[1]*(vp[3]-vp[1]));
+ newPos[1] = 1 - (vp[3]-vp[1]);
+ newPos[3] = 1;
+ }
+
+ this->Renderer->SetViewport(newPos);
+ this->Interactor->Render();
+}
+
+//----------------------------------------------------------------------------
+void vtkPVAxesWidget::ResizeTopLeft()
+{
+ int x = this->Interactor->GetEventPosition()[0];
+ int y = this->Interactor->GetEventPosition()[1];
+
+ int dx = x - this->StartPosition[0];
+ int dy = y - this->StartPosition[1];
+
+ int *size = this->ParentRenderer->GetSize();
+ double dxNorm = dx / (double)size[0];
+ double dyNorm = dy / (double)size[1];
+
+ int useX;
+ double change;
+ double absDx = fabs(dxNorm);
+ double absDy = fabs(dyNorm);
+
+ if (absDx > absDy)
+ {
+ change = dxNorm;
+ useX = 1;
+ }
+ else
+ {
+ change = dyNorm;
+ useX = 0;
+ }
+
+ double *vp = this->Renderer->GetViewport();
+
+ this->StartPosition[0] = x;
+ this->StartPosition[1] = y;
+
+ double newPos[4];
+ newPos[0] = useX ? vp[0] + change : vp[0] - change;
+ newPos[1] = vp[1];
+ newPos[2] = vp[2];
+ newPos[3] = useX ? vp[3] - change : vp[3] + change;
+
+ if (newPos[0] < 0)
+ {
+ this->StartPosition[0] = 0;
+ newPos[0] = 0;
+ }
+ if (newPos[0] >= newPos[2]-0.01)
+ {
+ newPos[0] = newPos[2] - 0.01;
+ }
+ if (newPos[3] > 1)
+ {
+ this->StartPosition[1] = size[1];
+ newPos[3] = 1;
+ }
+ if (newPos[3] <= newPos[1]+0.01)
+ {
+ newPos[3] = newPos[1] + 0.01;
+ }
+
+ this->Renderer->SetViewport(newPos);
+ this->Interactor->Render();
+}
+
+//----------------------------------------------------------------------------
+void vtkPVAxesWidget::ResizeTopRight()
+{
+ int x = this->Interactor->GetEventPosition()[0];
+ int y = this->Interactor->GetEventPosition()[1];
+
+ int dx = x - this->StartPosition[0];
+ int dy = y - this->StartPosition[1];
+
+ int *size = this->ParentRenderer->GetSize();
+ double dxNorm = dx / (double)size[0];
+ double dyNorm = dy / (double)size[1];
+
+ double change;
+ double absDx = fabs(dxNorm);
+ double absDy = fabs(dyNorm);
+
+ if (absDx > absDy)
+ {
+ change = dxNorm;
+ }
+ else
+ {
+ change = dyNorm;
+ }
+
+ double *vp = this->Renderer->GetViewport();
+
+ this->StartPosition[0] = x;
+ this->StartPosition[1] = y;
+
+ double newPos[4];
+ newPos[0] = vp[0];
+ newPos[1] = vp[1];
+ newPos[2] = vp[2] + change;
+ newPos[3] = vp[3] + change;
+
+ if (newPos[2] > 1)
+ {
+ this->StartPosition[0] = size[0];
+ newPos[2] = 1;
+ }
+ if (newPos[2] <= newPos[0]+0.01)
+ {
+ newPos[2] = newPos[0] + 0.01;
+ }
+ if (newPos[3] > 1)
+ {
+ this->StartPosition[1] = size[1];
+ newPos[3] = 1;
+ }
+ if (newPos[3] <= newPos[1]+0.01)
+ {
+ newPos[3] = newPos[1] + 0.01;
+ }
+
+ this->Renderer->SetViewport(newPos);
+ this->Interactor->Render();
+}
+
+//----------------------------------------------------------------------------
+void vtkPVAxesWidget::ResizeBottomLeft()
+{
+ int x = this->Interactor->GetEventPosition()[0];
+ int y = this->Interactor->GetEventPosition()[1];
+
+ int dx = x - this->StartPosition[0];
+ int dy = y - this->StartPosition[1];
+
+ int *size = this->ParentRenderer->GetSize();
+ double dxNorm = dx / (double)size[0];
+ double dyNorm = dy / (double)size[1];
+ double *vp = this->Renderer->GetViewport();
+
+ double change;
+ double absDx = fabs(dxNorm);
+ double absDy = fabs(dyNorm);
+
+ if (absDx > absDy)
+ {
+ change = dxNorm;
+ }
+ else
+ {
+ change = dyNorm;
+ }
+
+ this->StartPosition[0] = x;
+ this->StartPosition[1] = y;
+
+ double newPos[4];
+ newPos[0] = vp[0] + change;
+ newPos[1] = vp[1] + change;
+ newPos[2] = vp[2];
+ newPos[3] = vp[3];
+
+ if (newPos[0] < 0)
+ {
+ this->StartPosition[0] = 0;
+ newPos[0] = 0;
+ }
+ if (newPos[0] >= newPos[2]-0.01)
+ {
+ newPos[0] = newPos[2] - 0.01;
+ }
+ if (newPos[1] < 0)
+ {
+ this->StartPosition[1] = 0;
+ newPos[1] = 0;
+ }
+ if (newPos[1] >= newPos[3]-0.01)
+ {
+ newPos[1] = newPos[3] - 0.01;
+ }
+
+ this->Renderer->SetViewport(newPos);
+ this->Interactor->Render();
+}
+
+//----------------------------------------------------------------------------
+void vtkPVAxesWidget::ResizeBottomRight()
+{
+ int x = this->Interactor->GetEventPosition()[0];
+ int y = this->Interactor->GetEventPosition()[1];
+
+ int dx = x - this->StartPosition[0];
+ int dy = y - this->StartPosition[1];
+
+ int *size = this->ParentRenderer->GetSize();
+ double dxNorm = dx / (double)size[0];
+ double dyNorm = dy / (double)size[1];
+
+ double *vp = this->Renderer->GetViewport();
+
+ int useX;
+ double change;
+ double absDx = fabs(dxNorm);
+ double absDy = fabs(dyNorm);
+
+ if (absDx > absDy)
+ {
+ change = dxNorm;
+ useX = 1;
+ }
+ else
+ {
+ change = dyNorm;
+ useX = 0;
+ }
+
+ this->StartPosition[0] = x;
+ this->StartPosition[1] = y;
+
+ double newPos[4];
+ newPos[0] = vp[0];
+ newPos[1] = useX ? vp[1] - change : vp[1] + change;
+ newPos[2] = useX ? vp[2] + change : vp[2] - change;
+ newPos[3] = vp[3];
+
+ if (newPos[2] > 1)
+ {
+ this->StartPosition[0] = size[0];
+ newPos[2] = 1;
+ }
+ if (newPos[2] <= newPos[0]+0.01)
+ {
+ newPos[2] = newPos[0] + 0.01;
+ }
+ if (newPos[1] < 0)
+ {
+ this->StartPosition[1] = 0;
+ newPos[1] = 0;
+ }
+ if (newPos[1] >= newPos[3]-0.01)
+ {
+ newPos[1] = newPos[3]-0.01;
+ }
+
+ this->Renderer->SetViewport(newPos);
+ this->Interactor->Render();
+}
+
+//----------------------------------------------------------------------------
+void vtkPVAxesWidget::SquareRenderer()
+{
+ int *size = this->Renderer->GetSize();
+ if (size[0] == 0 || size[1] == 0)
+ {
+ return;
+ }
+
+ double vp[4];
+ this->Renderer->GetViewport(vp);
+
+ double deltaX = vp[2] - vp[0];
+ double newDeltaX = size[1] * deltaX / (double)size[0];
+ double deltaY = vp[3] - vp[1];
+ double newDeltaY = size[0] * deltaY / (double)size[1];
+
+ if (newDeltaX > 1)
+ {
+ if (newDeltaY > 1)
+ {
+ if (size[0] > size[1])
+ {
+ newDeltaX = size[1] / (double)size[0];
+ newDeltaY = 1;
+ }
+ else
+ {
+ newDeltaX = 1;
+ newDeltaY = size[0] / (double)size[1];
+ }
+ vp[0] = vp[1] = 0;
+ vp[2] = newDeltaX;
+ vp[3] = newDeltaY;
+ }
+ else
+ {
+ vp[3] = vp[1] + newDeltaY;
+ if (vp[3] > 1)
+ {
+ vp[3] = 1;
+ vp[1] = vp[3] - newDeltaY;
+ }
+ }
+ }
+ else
+ {
+ vp[2] = vp[0] + newDeltaX;
+ if (vp[2] > 1)
+ {
+ vp[2] = 1;
+ vp[0] = vp[2] - newDeltaX;
+ }
+ }
+
+ this->Renderer->SetViewport(vp);
+
+ this->Renderer->NormalizedDisplayToDisplay(vp[0], vp[1]);
+ this->Renderer->NormalizedDisplayToDisplay(vp[2], vp[3]);
+
+ vtkPoints *points = this->Outline->GetPoints();
+ points->SetPoint(0, vp[0]+1, vp[1]+1, 0);
+ points->SetPoint(1, vp[2]-1, vp[1]+1, 0);
+ points->SetPoint(2, vp[2]-1, vp[3]-1, 0);
+ points->SetPoint(3, vp[0]+1, vp[3]-1, 0);
+}
+
+//----------------------------------------------------------------------------
+void vtkPVAxesWidget::SetInteractive(int state)
+{
+ if (this->Interactive != state)
+ {
+ this->Interactive = state;
+ }
+
+ if (!state)
+ {
+ this->OnButtonRelease();
+ this->MouseCursorState = vtkPVAxesWidget::Outside;
+ this->Renderer->RemoveActor(this->OutlineActor);
+ if (this->Interactor)
+ {
+ this->SetMouseCursor(this->MouseCursorState);
+ // this->Interactor->Render();
+ }
+ }
+}
+
+//----------------------------------------------------------------------------
+void vtkPVAxesWidget::SetOutlineColor(double r, double g, double b)
+{
+ this->OutlineActor->GetProperty()->SetColor(r, g, b);
+ if (this->Interactor)
+ {
+// this->Interactor->Render();
+ }
+}
+
+//----------------------------------------------------------------------------
+double* vtkPVAxesWidget::GetOutlineColor()
+{
+ return this->OutlineActor->GetProperty()->GetColor();
+}
+
+//----------------------------------------------------------------------------
+void vtkPVAxesWidget::SetAxisLabelColor(double r, double g, double b)
+{
+ this->AxesActor->GetXAxisLabelProperty()->SetColor(r, g, b);
+ this->AxesActor->GetYAxisLabelProperty()->SetColor(r, g, b);
+ this->AxesActor->GetZAxisLabelProperty()->SetColor(r, g, b);
+}
+
+//----------------------------------------------------------------------------
+double* vtkPVAxesWidget::GetAxisLabelColor()
+{
+ return this->AxesActor->GetXAxisLabelProperty()->GetColor();
+}
+
+//----------------------------------------------------------------------------
+vtkRenderer* vtkPVAxesWidget::GetParentRenderer()
+{
+ return this->ParentRenderer;
+}
+
+//----------------------------------------------------------------------------
+void vtkPVAxesWidget::SetViewport(double minX, double minY,
+ double maxX, double maxY)
+{
+ this->Renderer->SetViewport(minX, minY, maxX, maxY);
+}
+
+//----------------------------------------------------------------------------
+double* vtkPVAxesWidget::GetViewport()
+{
+ return this->Renderer->GetViewport();
+}
+
+//----------------------------------------------------------------------------
+void vtkPVAxesWidget::PrintSelf(ostream& os, vtkIndent indent)
+{
+ this->Superclass::PrintSelf(os, indent);
+
+ os << indent << "AxesActor: " << this->AxesActor << endl;
+ os << indent << "Interactive: " << this->Interactive << endl;
+}
--- /dev/null
+/*=========================================================================
+
+ Program: ParaView
+ Module: $RCSfile$
+
+ Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc.
+ All rights reserved.
+
+ ParaView is a free software; you can redistribute it and/or modify it
+ under the terms of the ParaView license version 1.2.
+
+ See License_v1.2.txt for the full ParaView license.
+ A copy of this license can be obtained by contacting
+ Kitware Inc.
+ 28 Corporate Drive
+ Clifton Park, NY 12065
+ USA
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+=========================================================================*/
+// .NAME vtkPVAxesWidget - A widget to manipulate an axe
+//
+// .SECTION Description
+// This widget creates and manages its own vtkPVAxesActor.
+
+
+#ifndef __vtkPVAxesWidget_h
+#define __vtkPVAxesWidget_h
+
+#include "SVTK.h"
+#include "vtkInteractorObserver.h"
+
+class vtkActor2D;
+class vtkKWApplication;
+class vtkPolyData;
+class vtkPVAxesActor;
+class vtkPVAxesWidgetObserver;
+class vtkRenderer;
+
+class SVTK_EXPORT vtkPVAxesWidget : public vtkInteractorObserver
+{
+public:
+ static vtkPVAxesWidget* New();
+ vtkTypeRevisionMacro(vtkPVAxesWidget, vtkInteractorObserver);
+ void PrintSelf(ostream& os, vtkIndent indent);
+
+ // Description:
+ // Set/get the axes actor to be displayed in this 3D widget.
+ void SetAxesActor(vtkPVAxesActor *actor);
+ vtkGetObjectMacro(AxesActor, vtkPVAxesActor);
+
+ // Description:
+ // Enable the 3D widget.
+ virtual void SetEnabled(int);
+
+ //BTX
+ // Description:
+ // Set the renderer this 3D widget will be contained in.
+ void SetParentRenderer(vtkRenderer *ren);
+ vtkRenderer* GetParentRenderer();
+ //ETX
+
+ // Description:
+ // Callback to keep the camera for the axes actor up to date with the
+ // camera in the parent renderer
+ void ExecuteEvent(vtkObject *o, unsigned long event, void *calldata);
+
+ // Description:
+ // Set/get whether to allow this 3D widget to be interactively moved/scaled.
+ void SetInteractive(int state);
+ vtkGetMacro(Interactive, int);
+ vtkBooleanMacro(Interactive, int);
+
+ // Description:
+ // Set/get the color of the outline of this widget. The outline is visible
+ // when (in interactive mode) the cursor is over this 3D widget.
+ void SetOutlineColor(double r, double g, double b);
+ double *GetOutlineColor();
+
+ // Description:
+ // Set/get the color of the axis labels of this widget.
+ void SetAxisLabelColor(double r, double g, double b);
+ double *GetAxisLabelColor();
+
+ // Description:
+ // Set/get the viewport to position/size this 3D widget.
+ void SetViewport(double minX, double minY, double maxX, double maxY);
+ double* GetViewport();
+
+protected:
+ vtkPVAxesWidget();
+ ~vtkPVAxesWidget();
+
+ vtkRenderer *Renderer;
+ vtkRenderer *ParentRenderer;
+
+ vtkPVAxesActor *AxesActor;
+ vtkPolyData *Outline;
+ vtkActor2D *OutlineActor;
+
+ static void ProcessEvents(vtkObject *object, unsigned long event,
+ void *clientdata, void *calldata);
+
+ vtkPVAxesWidgetObserver *Observer;
+ int StartTag;
+
+ int MouseCursorState;
+ int Moving;
+ int StartPosition[2];
+
+ int Interactive;
+
+ void UpdateCursorIcon();
+ void SetMouseCursor(int cursorState);
+
+//BTX
+ int State;
+
+ enum AxesWidgetState
+ {
+ Outside = 0,
+ Inside,
+ TopLeft,
+ TopRight,
+ BottomLeft,
+ BottomRight
+ };
+//ETX
+
+ void OnButtonPress();
+ void OnMouseMove();
+ void OnButtonRelease();
+
+ void MoveWidget();
+ void ResizeTopLeft();
+ void ResizeTopRight();
+ void ResizeBottomLeft();
+ void ResizeBottomRight();
+
+ void SquareRenderer();
+
+ unsigned long StartEventObserverId;
+private:
+ vtkPVAxesWidget(const vtkPVAxesWidget&); // Not implemented
+ void operator=(const vtkPVAxesWidget&); // Not implemented
+};
+
+#endif
--- /dev/null
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+import os
+import os.path
+
+def addvars2notebook(filename):
+ #
+ vars_and_values = []
+ contents = []
+ #
+ directory = os.path.dirname(filename)
+ base = os.path.basename(filename)
+ prefix = base[:-3] # remove ".py"
+ prefix = prefix + '_'
+ from os import listdir
+ l = listdir(directory)
+ for f in l:
+ if f.find(prefix) != 0: continue
+ if f[-3:] != ".py": continue
+ module = f[len(prefix):-3]
+ try:
+ mod = __import__("addvars2notebook_%s"%(module))
+ except ImportError:
+ continue
+ try:
+ func = mod.addvars2notebook
+ except AttributeError:
+ continue
+ fff = os.path.join(directory, f)
+ content = func(fff, vars_and_values)
+ contents.append([fff, content])
+ pass
+ #
+ if vars_and_values:
+ stream = open(filename)
+ content = stream.read()
+ stream.close()
+ fields = content.split("import iparameters")
+ if len(fields) == 2:
+ begin = fields[0]
+ if begin.find("## NoteBook E.A.") >= 0:
+ begin = begin.split("## NoteBook E.A.")[0]
+ pass
+ end = "import iparameters" + fields[1]
+ content = begin
+ content += "## NoteBook E.A.\n"
+ for var, value in vars_and_values:
+ content += "notebook.set(%s,%s)\n"%(var.__repr__(), value)
+ pass
+ content += end
+ stream = open(filename, "w")
+ stream.write(content)
+ stream.close()
+ #
+ for fff, content in contents:
+ stream = open(fff, "w")
+ stream.write(content)
+ stream.close()
+ pass
+ pass
+ pass
+ #
+ return
+
+if __name__ == "__main__":
+ import sys
+ addvars2notebook(sys.argv[1])
+ pass
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="fr_FR">
+<context>
+ <name>@default</name>
+ <message>
+ <source>WRN_FILE_NAME_BAD</source>
+ <translation>Indiquez un nom de fichier correct.
+Un fichier Python ne doit être composé que de lettres, chiffres et tirets bas et doit commencer avec une lettre ou un tiret bas.</translation>
+ </message>
+ <message>
+ <source>WRN_FILE_NOT_EXIST</source>
+ <translation>Le fichier %1 n'existe pas.</translation>
+ </message>
+ <message>
+ <source>CLOSE_LOCKED_STUDY</source>
+ <translation>Fermer l'étude verrouillée ?</translation>
+ </message>
+ <message>
+ <source>PUBLISH_IN_STUDY</source>
+ <translation>Publier dans l'étude</translation>
+ </message>
+ <message>
+ <source>MULTI_FILE_DUMP</source>
+ <translation>Dump multi-fichiers</translation>
+ </message>
+ <message>
+ <source>BUT_NEW</source>
+ <translation>&Nouvelle</translation>
+ </message>
+ <message>
+ <source>SAVE_POINT_ROOT_NAME</source>
+ <translation>Etats d'IHM</translation>
+ </message>
+ <message>
+ <source>SAVE_POINT_ROOT_TOOLTIP</source>
+ <translation>Etats d'IHM persistents</translation>
+ </message>
+ <message>
+ <source>SAVE_GUI_STATE</source>
+ <translation>Sauvegarder l'état d'IHM</translation>
+ </message>
+ <message>
+ <source>BUT_LOAD</source>
+ <translation>&Charger</translation>
+ </message>
+ <message>
+ <source>BUT_OPEN</source>
+ <translation>&Ouvrir</translation>
+ </message>
+ <message>
+ <source>SAVE_POINT_OBJECT_TOOLTIP</source>
+ <translation>Etat d'IHM: %1 sauvegardé</translation>
+ </message>
+ <message>
+ <source>SAVE_POINT_DEF_NAME</source>
+ <translation>Etat d'IHM: </translation>
+ </message>
+ <message>
+ <source>VALUE_COLUMN</source>
+ <translation>Valeur</translation>
+ </message>
+ <message>
+ <source>IOR_COLUMN</source>
+ <translation>IOR</translation>
+ </message>
+ <message>
+ <source>REFENTRY_COLUMN</source>
+ <translation>Entrée de réf.</translation>
+ </message>
+ <message>
+ <source>ERR_INCOMPATIBLE_TYPE</source>
+ <translation>Le type numérique de la variable "%1" n'est pas compatible</translation>
+ </message>
+ <message>
+ <source>ERR_INVALID_VALUE</source>
+ <translation>La valeur n'a pas été validée</translation>
+ </message>
+ <message>
+ <source>ERR_NO_VARIABLE</source>
+ <translation>La variable "%1" n'existe pas.</translation>
+ </message>
+</context>
+<context>
+ <name>SalomeApp_Application</name>
+ <message>
+ <source>ALL_FILES_FILTER</source>
+ <translation>Tous les fichiers (*.*)</translation>
+ </message>
+ <message>
+ <source>APPCLOSE_UNLOAD</source>
+ <translation>&Déconnecter</translation>
+ </message>
+ <message>
+ <source>APPCLOSE_CLOSE</source>
+ <translation>&Fermer sans sauvegarder</translation>
+ </message>
+ <message>
+ <source>MEN_WINDOWS_NEW</source>
+ <translation>Nouvelle fenêtre</translation>
+ </message>
+ <message>
+ <source>MEN_DELETE_INVALID_REFERENCE</source>
+ <translation>Supprimer la référence invalide</translation>
+ </message>
+ <message>
+ <source>TOT_FILE_DESK_PREFERENCES</source>
+ <translation>Préférences</translation>
+ </message>
+ <message>
+ <source>MEN_DELETE_VS</source>
+ <translation>Supprimer</translation>
+ </message>
+ <message>
+ <source>MEN_OPENWITH</source>
+ <translation>Activer module %1 </translation>
+ </message>
+ <message>
+ <source>MEN_DESK_REGISTRY_DISPLAY</source>
+ <translation>Affichage du registre CORBA</translation>
+ </message>
+ <message>
+ <source>APPCLOSE_SAVE</source>
+ <translation>&Sauvegarder && Fermer</translation>
+ </message>
+ <message>
+ <source>TOT_DESK_FILE_LOAD_SCRIPT</source>
+ <translation>Exécuter un script python</translation>
+ </message>
+ <message>
+ <source>PREF_PYDUMP_PUBLISH</source>
+ <translation>Publier dans l'étude dans un scrypt Python</translation>
+ </message>
+ <message>
+ <source>PREF_PYDUMP_MULTI_FILE</source>
+ <translation>Dump Python multi-fichiers</translation>
+ </message>
+ <message>
+ <source>PREF_PYDUMP_SAVE_GUI</source>
+ <translation>Enregistrer l'état de l'IHM dans un script Python</translation>
+ </message>
+ <message>
+ <source>PREF_STORE_VISUAL_STATE</source>
+ <translation>Sauvegarder/restaurer le dernier état d'IHM</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_FILE_SAVE_GUI_STATE</source>
+ <translation>Sauvegarder l'état actuel des vues 3D, des objets affichés, etc.</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_FILE_SAVE_GUI_STATE</source>
+ <translation>Sauvegarder l'état d'IHM</translation>
+ </message>
+ <message>
+ <source>TOT_DESK_FILE_SAVE_GUI_STATE</source>
+ <translation>Sauvegarder l'état d'IHM</translation>
+ </message>
+ <message>
+ <source>MEN_RESTORE_VS</source>
+ <translation>Restaurer</translation>
+ </message>
+ <message>
+ <source>WRN_DUMP_STUDY_FAILED</source>
+ <translation>Impossible de générer le script de l'étude</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_PROPERTIES</source>
+ <translation>Pro&priétés...</translation>
+ </message>
+ <message>
+ <source>QUE_DOC_ALREADYEXIST</source>
+ <translation>Le document %1 existe déjà dans le gestionnaire d'études.
+Voulez-vous le recharger ?</translation>
+ </message>
+ <message>
+ <source>MEN_RENAME_VS</source>
+ <translation>Renommer</translation>
+ </message>
+ <message>
+ <source>TOT_DESK_CATALOG_GENERATOR</source>
+ <translation>Générateur de catalogue</translation>
+ </message>
+ <message>
+ <source>TOT_DESK_ADD_VARS_TO_NOTEBOOK</source>
+ <translation>Ajouter les variables au registre</translation>
+ </message>
+ <message>
+ <source>PUBLISH_IN_STUDY</source>
+ <translation>Publier dans l'étude</translation>
+ </message>
+ <message>
+ <source>PREF_OBJ_BROWSER_SETTINGS</source>
+ <translation>Paramètres</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_REGISTRY_DISPLAY</source>
+ <translation>Visualiser le contenu du registre du serveur CORBA</translation>
+ </message>
+ <message>
+ <source>PYTHON_FILES_FILTER</source>
+ <translation>Fichiers PYTHON (*.py)</translation>
+ </message>
+ <message>
+ <source>APPCLOSE_DESCRIPTION</source>
+ <translation>Voulez-vous fermer ou décharger l'étude avant de la fermer ?</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_PROPERTIES</source>
+ <translation>Editer les propriétés de l'étude</translation>
+ </message>
+ <message>
+ <source>PREF_TAB_OBJBROWSER</source>
+ <translation>Arbre d'étude</translation>
+ </message>
+ <message>
+ <source>STUDY_LOCKED</source>
+ <translation>VERROUILLEE</translation>
+ </message>
+ <message>
+ <source>APPCLOSE_CANCEL</source>
+ <translation>&Annuler</translation>
+ </message>
+ <message>
+ <source>OBJ_BROWSER_NAME</source>
+ <translation>Objet</translation>
+ </message>
+ <message>
+ <source>TOT_DESK_REGISTRY_DISPLAY</source>
+ <translation>Visualiser le registre CORBA</translation>
+ </message>
+ <message>
+ <source>OBJ_BROWSER_COLUMN_0</source>
+ <translation>Entrée</translation>
+ </message>
+ <message>
+ <source>OBJ_BROWSER_COLUMN_1</source>
+ <translation>Valeur</translation>
+ </message>
+ <message>
+ <source>OBJ_BROWSER_COLUMN_2</source>
+ <translation>IOR</translation>
+ </message>
+ <message>
+ <source>OBJ_BROWSER_COLUMN_3</source>
+ <translation>Entrée de référence</translation>
+ </message>
+ <message>
+ <source>PREF_CATEGORY_SALOME</source>
+ <translation>SALOME</translation>
+ </message>
+ <message>
+ <source>PYTHON_CONSOLE</source>
+ <translation>Console Python</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_FILE_LOAD_SCRIPT</source>
+ <translation>Exécuter un scrip&t...</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_TOOLS</source>
+ <translation>&Outils</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_PLUGINS_TOOLS</source>
+ <translation>Outils</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_PLUGINS</source>
+ <translation>Extensions</translation>
+ </message>
+ <message>
+ <source>TOT_DESK_FILE_DUMP_STUDY</source>
+ <translation>Générer le script de l'étude</translation>
+ </message>
+ <message>
+ <source>MEN_VIEW_WNDS</source>
+ <translation>Fenêtres</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_FILE_DUMP_STUDY</source>
+ <translation>&Générer le script de l'étude...</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_CATALOG_GENERATOR</source>
+ <translation>Génére un catalogue XML de l'interface du composant</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_ADD_VARS_TO_NOTEBOOK</source>
+ <translation>Ajouter les variables de l'étude au registre</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_FILE_DUMP_STUDY</source>
+ <translation>Génère le script python de l'étude</translation>
+ </message>
+ <message>
+ <source>TOT_DESK_FILE_NOTEBOOK</source>
+ <translation>Ouvrir le registre</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_FILE_NOTEBOOK</source>
+ <translation>Re&gistre...</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_FILE_NOTEBOOK</source>
+ <translation>Ouvrir le registre</translation>
+ </message>
+ <message>
+ <source>TOT_DESK_PROPERTIES</source>
+ <translation>Propriétés de l'étude</translation>
+ </message>
+ <message>
+ <source>PREF_GROUP_DEF_COLUMNS</source>
+ <translation>Colonnes par défaut</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_FILE_LOAD_SCRIPT</source>
+ <translation>Exécute un script Python à partir d'un fichier</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_CATALOG_GENERATOR</source>
+ <translation>&Genérateur de catalogue</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_ADD_VARS_TO_NOTEBOOK</source>
+ <translation>Ajouter les variables au registre</translation>
+ </message>
+ <message>
+ <source>APPCLOSE_CAPTION</source>
+ <translation>Fermer l'étude actuelle</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_MRU</source>
+ <translation>Dernières études ouvertes</translation>
+ </message>
+ <message>
+ <source>TOT_DESK_MRU</source>
+ <translation>Dernières études ouvertes</translation>
+ </message>
+ <message>
+ <source>ACTIVATE_MODULE_OP_LOAD</source>
+ <translation>&Charger...</translation>
+ </message>
+ <message>
+ <source>ACTIVATE_MODULE_OP_SCRIPT</source>
+ <translation>Charger un &script...</translation>
+ </message>
+</context>
+<context>
+ <name>SalomeApp_StudyPropertiesDlg</name>
+ <message>
+ <source>PRP_MODE_FROM_SCRATCH</source>
+ <translation>du début</translation>
+ </message>
+ <message>
+ <source>PRP_AUTHOR</source>
+ <translation>Auteur</translation>
+ </message>
+ <message>
+ <source>PRP_LOCKED</source>
+ <translation>Verrouillée</translation>
+ </message>
+ <message>
+ <source>PRP_MODIFICATIONS</source>
+ <translation>Modifications</translation>
+ </message>
+ <message>
+ <source>PRP_DATE_MODIF</source>
+ <translation>Date</translation>
+ </message>
+ <message>
+ <source>PRP_UNITS</source>
+ <translation>Unités de longueur</translation>
+ </message>
+ <message>
+ <source>PRP_COMMENT</source>
+ <translation>Commentaires</translation>
+ </message>
+ <message>
+ <source>PRP_NO</source>
+ <translation>Non</translation>
+ </message>
+ <message>
+ <source>PRP_YES</source>
+ <translation>Oui</translation>
+ </message>
+ <message>
+ <source>PRP_MODIFIED</source>
+ <translation>Modifiée</translation>
+ </message>
+ <message>
+ <source>PRP_NOT_MODIFIED</source>
+ <translation>Non modifiée</translation>
+ </message>
+ <message>
+ <source>PRP_DATE</source>
+ <translation>Date de création</translation>
+ </message>
+ <message>
+ <source>PRP_MODE</source>
+ <translation>Mode</translation>
+ </message>
+ <message>
+ <source>PRP_MODE_FROM_COPYFROM</source>
+ <translation>copier de</translation>
+ </message>
+ <message>
+ <source>TLT_STUDY_PROPERTIES</source>
+ <translation>Propriétés de l'étude</translation>
+ </message>
+</context>
+<context>
+ <name>SalomeApp_ExitDlg</name>
+ <message>
+ <source>SHUTDOWN_SERVERS</source>
+ <translation>Arrêter les serveurs</translation>
+ </message>
+</context>
+<context>
+ <name>NoteBook_Table</name>
+ <message>
+ <source>REMOVE_VARIABLE_IS_USED</source>
+ <translation>La variable "%1" est utilisée dans l'étude.
+Voulez-vous vraiment la supprimer?</translation>
+ </message>
+ <message>
+ <source>RENAME_VARIABLE_IS_USED</source>
+ <translation>La variable "%1" est utilisée dans l'étude.
+Voulez-vous vraiment la renommer?</translation>
+ </message>
+ <message>
+ <source>VARNAME_COLUMN</source>
+ <translation>Nom de la variable</translation>
+ </message>
+ <message>
+ <source>VARVALUE_COLUMN</source>
+ <translation>Valeur de la variable</translation>
+ </message>
+ <message>
+ <source>VARVALUE_INCORRECT</source>
+ <translation>La valeur de la variable n'est pas correcte: %1</translation>
+ </message>
+ <message>
+ <source>VARNAME_INCORRECT</source>
+ <translation>Le nom de la variable n'est pas correct: %1</translation>
+ </message>
+ <message>
+ <source>VARNAME_EXISTS</source>
+ <translation>La variable "%1" existe</translation>
+ </message>
+</context>
+<context>
+ <name>SalomeApp_NoteBookDlg</name>
+ <message>
+ <source>NOTEBOOK_TITLE</source>
+ <translation>Registre Salome</translation>
+ </message>
+ <message>
+ <source>BUT_UPDATE_STUDY</source>
+ <translation>&Mettre l'étude à jour</translation>
+ </message>
+ <message>
+ <source>BUT_REMOVE</source>
+ <translation>&Supprimer</translation>
+ </message>
+ <message>
+ <source>BUT_APPLY_AND_CLOSE</source>
+ <translation>A&ppliquer et Fermer</translation>
+ </message>
+ <message>
+ <source>BUT_HELP</source>
+ <translation>&Aide</translation>
+ </message>
+ <message>
+ <source>CLOSE_CAPTION</source>
+ <translation>Fermer le registre</translation>
+ </message>
+ <message>
+ <source>CLOSE_DESCRIPTION</source>
+ <translation>Voulez-vous sauvegarder les changements faits au registre ?</translation>
+ </message>
+ <message>
+ <source>INCORRECT_DATA</source>
+ <translation>Au moins une variable a été définie incorrectement.
+Editez ses paramètres ou retirez la de la liste.</translation>
+ </message>
+ <message>
+ <source>ERR_UPDATE_STUDY_FAILED</source>
+ <translation>Impossible de mettre l'étude à jour !</translation>
+ </message>
+</context>
+<context>
+ <name>SalomeApp_DoubleSpinBox</name>
+ <message>
+ <source>VALID_RANGE_VAR_MSG</source>
+ <translation>Indiquez un nom de variable ou
+une valeur réelle dans l'intervalle ( %1; %2 )
+avec une précision de %3 décimales</translation>
+ </message>
+ <message>
+ <source>VALID_RANGE_NOVAR_MSG</source>
+ <translation>Indiquez une valeur réelle dans l'intervalle ( %1; %2 )
+avec une précision de %3 décimales</translation>
+ </message>
+</context>
+<context>
+ <name>SalomeApp_IntSpinBox</name>
+ <message>
+ <source>VALID_RANGE_VAR_MSG</source>
+ <translation>Indiquez un nom de variable ou
+une valeur entière dans l'intervalle ( %1; %2 )</translation>
+ </message>
+ <message>
+ <source>VALID_RANGE_NOVAR_MSG</source>
+ <translation>Indiquez une valeur entière dans l'intervalle ( %1; %2 )</translation>
+ </message>
+</context>
+</TS>
--- /dev/null
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+"""
+This module is imported from C++ SalomeApp_Application and initialized
+(call to initialize function with 4 parameters) module : 0 if it's
+plugins manager at the application level 1 if it is at the module
+level name : the name of the plugins manager. This name is used to
+build the name of the plugins files basemenuname : the name of the
+menu into we want to add the menu of the plugins ("Tools" for example)
+menuname : the name of plugins menu
+
+A plugins manager is created when calling initialize.
+
+The plugins manager creates a submenu <menuname> in the <basemenuname>
+menu.
+
+The plugins manager searches in $HOME/.config/salome/Plugins,
+$HOME/$APPLI/Plugins, $SALOME_PLUGINS_PATH directories files named
+<name>_plugins.py and executes them.
+
+These files should contain python code that register functions into
+the plugins manager.
+
+Example of a plugins manager with name salome. It searches files with
+name salome_plugins.py (example follows)::
+
+ import salome_pluginsmanager
+
+ def about(context):
+ from PyQt4.QtGui import QMessageBox
+ QMessageBox.about(None, "About SALOME pluginmanager", "SALOME plugins manager in SALOME virtual application ")
+
+ salome_pluginsmanager.AddFunction('About plugins','About SALOME pluginmanager',about)
+
+All entries in menu are added in the same order as the calls to
+AddFunction. It is possible to customize this presentation by getting
+the entries list (salome_pluginsmanager.entries()) and modifying it in
+place. For example, you can do that :
+salome_pluginsmanager.entries().sort() to order them alphabetically or
+salome_pluginsmanager.entries().remove("a") to remove the entry named
+"a".
+
+It is possible to put entries in submenus. You only need to give a
+name with / to the entry. for example::
+
+ salome_pluginsmanager.AddFunction('a/b/About','About SALOME pluginmanager',about)
+
+will add 2 submenus a and b before creating the entry.
+
+In short to add a plugin:
+
+ 1. import the python module salome_pluginsmanager (in your
+ salome_plugins.py or <module>_plugins.py)
+
+ 2. write a function with one argument context (it's an object with 3
+ attributes)
+
+ 3. register the function with a call to AddFunction (entry in menu plugins,
+ tooltip, function)
+
+context attributes:
+
+ - sg : the SALOME Swig interface
+ - studyId : the SALOME studyId that must be used to execute the plugin
+ - study : the SALOME study object that must be used to execute the plugin
+
+"""
+
+import os,sys,traceback
+from PyQt4 import QtGui
+from PyQt4 import QtCore
+
+import salome
+
+SEP=":"
+if sys.platform == "win32":
+ SEP = ";"
+
+# Get SALOME PyQt interface
+import SalomePyQt
+sgPyQt = SalomePyQt.SalomePyQt()
+
+# Get SALOME Swig interface
+import libSALOME_Swig
+sg = libSALOME_Swig.SALOMEGUI_Swig()
+
+plugins={}
+current_plugins_manager=None
+
+def initialize(module,name,basemenuname,menuname):
+ if not plugins.has_key(name):
+ if module:
+ plugins[name]={}
+ else:
+ plugins[name]=[]
+ if module:
+ studyId=sg.getActiveStudyId()
+ if plugins[name].has_key(studyId):return
+ plugins[name][studyId]=PluginsManager(module,name,basemenuname,menuname)
+ else:
+ plugins[name].append(PluginsManager(module,name,basemenuname,menuname))
+
+class Context:
+ def __init__(self,sgpyqt):
+ self.sg=sgpyqt
+ self.studyId=salome.sg.getActiveStudyId()
+ self.study= salome.myStudyManager.GetStudyByID(self.studyId)
+
+def find_menu(smenu):
+ lmenus=smenu.split("|")
+ main=lmenus.pop(0).strip()
+ menu=sgPyQt.getPopupMenu(main)
+ return findMenu(lmenus,menu)
+
+def findMenu(lmenu,menu):
+ if not lmenu:return menu
+ m=lmenu.pop(0).strip()
+ for a in menu.actions():
+ if a.menu():
+ if a.text() == m:
+ return findMenu(lmenu,a.menu())
+
+PLUGIN_PATH_PATTERN="share/salome/plugins"
+MATCH_ENDING_PATTERN="_plugins.py"
+from salome.kernel.syshelper import walktree
+from salome.kernel.logger import Logger
+#from salome.kernel.termcolor import GREEN
+logger=Logger("PluginsManager") #,color=GREEN)
+# VSR 21/11/2011 : do not show infos in the debug mode
+#logger.showDebug()
+
+class PluginsManager:
+ def __init__(self,module,name,basemenuname,menuname):
+ self.name=name
+ self.basemenuname=basemenuname
+ self.menuname=menuname
+ self.module=module
+ self.registry={}
+ self.handlers={}
+ self.entries=[]
+ self.lasttime=0
+ self.plugindirs=[]
+ self.plugins_files=[]
+
+ # MODULES plugins directory.
+ # The SALOME modules may provides natively some plugins. These
+ # MODULES plugins are supposed to be located in the
+ # installation folder of the module, in the subdirectory
+ # "share/salome/plugins". We first look for these directories.
+ for key in os.environ.keys():
+ if key.endswith("_ROOT_DIR"):
+ rootpath=os.environ[key]
+ dirpath=os.path.join(rootpath,PLUGIN_PATH_PATTERN)
+ if os.path.isdir(dirpath) and dirpath not in self.plugindirs:
+ logger.debug("Looking for plugins in the directory %s ..."%dirpath)
+ walktree(dirpath,self.analyseFile)
+
+ # USER plugins directory
+ user_dir = os.path.expanduser("~/.config/salome/Plugins")
+ self.plugindirs.append(user_dir)
+ logger.info("The user directory %s has been added to plugin paths"%user_dir)
+ # obsolete: USER plugins directory
+ # (for compatibility reasons only; new plugins should be stored in ~/.config/salome/Plugins)
+ user_obsolete_dir = os.path.expanduser("~/.salome/Plugins")
+ self.plugindirs.append(user_obsolete_dir)
+ logger.info("The user directory %s has been added to plugin paths (deprecated)"%user_obsolete_dir)
+
+ # APPLI plugins directory
+ appli=os.getenv("APPLI")
+ if appli:
+ appli_dir=os.path.join(os.path.expanduser("~"),appli,"Plugins")
+ self.plugindirs.append(appli_dir)
+ logger.info("The APPLI directory %s has been added to plugin paths"%appli_dir)
+
+ #SALOME_PLUGINS_PATH environment variable (list of directories separated by ":")
+ pluginspath=os.getenv("SALOME_PLUGINS_PATH")
+ if pluginspath:
+ for directory in pluginspath.split(SEP):
+ self.plugindirs.append(directory)
+ logger.info("The directory %s has been added to plugin paths"%directory)
+
+ self.basemenu = find_menu(self.basemenuname)
+
+ if self.module:
+ self.menu=QtGui.QMenu(self.menuname)
+ mid=sgPyQt.createMenu(self.menu.menuAction(),self.basemenuname)
+ else:
+ self.menu=QtGui.QMenu(self.menuname,self.basemenu)
+ self.basemenu.addMenu(self.menu)
+
+ self.menu.menuAction().setVisible(False)
+
+ self.basemenu.connect(self.basemenu, QtCore.SIGNAL("aboutToShow()"), self.importPlugins)
+
+ def analyseFile(self,filename):
+ """
+ This function checks if the specified file is a plugins python
+ module and add the directory name of this file to the list of
+ plugin paths. This function is aimed to be used as the callback
+ function of the walktree algorithm.
+ """
+ if str(filename).endswith(MATCH_ENDING_PATTERN):
+ dirpath=os.path.dirname(filename)
+ if dirpath not in self.plugindirs:
+ self.plugindirs.append(dirpath)
+ logger.debug("The directory %s has been added to plugin paths"%dirpath)
+
+ def AddFunction(self,name,description,script):
+ """ Add a plugin function
+ """
+ self.registry[name]=script,description
+ self.entries.append(name)
+
+ def handler(obj=self,script=script):
+ try:
+ script(Context(sgPyQt))
+ except:
+ s=traceback.format_exc()
+ QtGui.QMessageBox.warning(None,"Exception occured",s)
+
+ self.handlers[name]=handler
+
+ def importPlugins(self):
+ """Execute the salome_plugins file that contains plugins definition """
+ studyId=sg.getActiveStudyId()
+ if studyId == 0:
+ self.menu.clear()
+ self.menu.menuAction().setVisible(False)
+ return
+ elif self.lasttime ==0:
+ salome.salome_init(embedded=1)
+
+ lasttime=0
+
+ plugins_files=[]
+ plugins_file_name=self.name+MATCH_ENDING_PATTERN
+ for directory in self.plugindirs:
+ plugins_file = os.path.join(directory,plugins_file_name)
+ if os.path.isfile(plugins_file):
+ plugins_files.append((directory,plugins_file))
+ lasttime=max(lasttime,os.path.getmtime(plugins_file))
+
+ plugins_files.sort()
+
+ if not plugins_files:
+ self.registry.clear()
+ self.handlers.clear()
+ self.entries=[]
+ self.lasttime=0
+ self.menu.clear()
+ self.menu.menuAction().setVisible(False)
+ return
+
+ if self.plugins_files != plugins_files or lasttime > self.lasttime:
+ global current_plugins_manager
+ current_plugins_manager=self
+ self.registry.clear()
+ self.handlers.clear()
+ self.entries=[]
+ self.lasttime=lasttime
+ for directory,plugins_file in plugins_files:
+ if directory not in sys.path:
+ sys.path.insert(0,directory)
+ try:
+ execfile(plugins_file,globals(),{})
+ except:
+ logger.fatal("Error while loading plugins from file %s"%plugins_file)
+ traceback.print_exc()
+
+ self.updateMenu()
+
+ def updateMenu(self):
+ """Update the Plugins menu"""
+ self.menu.clear()
+ for entry in self.entries:
+ names=entry.split("/")
+ if len(names) < 1:continue
+ parentMenu=self.menu
+
+ if len(names) > 1:
+ #create or get submenus
+ submenus={}
+ for action in parentMenu.actions():
+ menu=action.menu()
+ if menu:
+ submenus[str(menu.title())]=menu
+ while len(names) > 1:
+ name=names.pop(0)
+ if submenus.has_key(name):
+ amenu=submenus[name]
+ else:
+ amenu=QtGui.QMenu(name,parentMenu)
+ parentMenu.addMenu(amenu)
+ submenus[name]=amenu
+ parentMenu=amenu
+
+ name=names.pop(0)
+ act=parentMenu.addAction(name,self.handlers[entry])
+ act.setStatusTip(self.registry[entry][1])
+
+ self.menu.menuAction().setVisible(True)
+
+def AddFunction(name,description,script):
+ """ Add a plugin function
+ Called by a user to register a function (script)
+ """
+ return current_plugins_manager.AddFunction(name,description,script)
+
+def entries():
+ """ Return the list of entries in menu: can be sorted or modified in place to customize menu content """
+ return current_plugins_manager.entries
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="fr_FR">
+<context>
+ <name>Style_PrefDlg</name>
+ <message>
+ <source>Quick</source>
+ <translation>Rapide</translation>
+ </message>
+ <message>
+ <source>Auto</source>
+ <translation>Auto</translation>
+ </message>
+ <message>
+ <source>Base colors</source>
+ <translation>Couleurs de base</translation>
+ </message>
+ <message>
+ <source>Additional colors</source>
+ <translation>Couleurs supplémentaires</translation>
+ </message>
+ <message>
+ <source>Active</source>
+ <translation>Actif</translation>
+ </message>
+ <message>
+ <source>Inactive</source>
+ <translation>Inactif</translation>
+ </message>
+ <message>
+ <source>Disabled</source>
+ <translation>Désactivé</translation>
+ </message>
+ <message>
+ <source>Window text</source>
+ <translation>Texte de la fenêtre</translation>
+ </message>
+ <message>
+ <source>Button</source>
+ <translation>Bouton</translation>
+ </message>
+ <message>
+ <source>Light</source>
+ <translation>Clair</translation>
+ </message>
+ <message>
+ <source>Midlight</source>
+ <translation>Demi-clair</translation>
+ </message>
+ <message>
+ <source>Dark</source>
+ <translation>Foncé</translation>
+ </message>
+ <message>
+ <source>Mid</source>
+ <translation>Moyen</translation>
+ </message>
+ <message>
+ <source>Text</source>
+ <translation>Texte</translation>
+ </message>
+ <message>
+ <source>Bright text</source>
+ <translation>Texte éclairé</translation>
+ </message>
+ <message>
+ <source>Button text</source>
+ <translation>Texte du bouton</translation>
+ </message>
+ <message>
+ <source>Base</source>
+ <translation>Base</translation>
+ </message>
+ <message>
+ <source>Window</source>
+ <translation>Fenêtre</translation>
+ </message>
+ <message>
+ <source>Shadow</source>
+ <translation>Ombre</translation>
+ </message>
+ <message>
+ <source>Highlight</source>
+ <translation>Surligner</translation>
+ </message>
+ <message>
+ <source>Highlighted text</source>
+ <translation>Texte surligné</translation>
+ </message>
+ <message>
+ <source>Link</source>
+ <translation>Lien</translation>
+ </message>
+ <message>
+ <source>Visited link</source>
+ <translation>Lien visité</translation>
+ </message>
+ <message>
+ <source>Alternate base</source>
+ <translation>Base alternative</translation>
+ </message>
+ <message>
+ <source>Tooltip base</source>
+ <translation>Base d'infobulle</translation>
+ </message>
+ <message>
+ <source>Tooltip text</source>
+ <translation>Texte d'infobulle</translation>
+ </message>
+ <message>
+ <source>Border top</source>
+ <translation>Frontière de dessus</translation>
+ </message>
+ <message>
+ <source>Border bottom</source>
+ <translation>Frontière de dessous</translation>
+ </message>
+ <message>
+ <source>Tab border top</source>
+ <translation>Frontière de dessus de l'onglet</translation>
+ </message>
+ <message>
+ <source>Tab border bottom</source>
+ <translation>Frontière de dessous de l'onglet</translation>
+ </message>
+ <message>
+ <source>Field light</source>
+ <translation>Champ clair</translation>
+ </message>
+ <message>
+ <source>Field dark</source>
+ <translation>Champ foncé</translation>
+ </message>
+ <message>
+ <source>Slider</source>
+ <translation>Barre de défilement</translation>
+ </message>
+ <message>
+ <source>Lines</source>
+ <translation>Lignes</translation>
+ </message>
+ <message>
+ <source>Widget center</source>
+ <translation>Composant central</translation>
+ </message>
+ <message>
+ <source>Widget border</source>
+ <translation>Composant de frontière</translation>
+ </message>
+ <message>
+ <source>Header</source>
+ <translation>Titre</translation>
+ </message>
+ <message>
+ <source>Progress bar</source>
+ <translation>Barre d'avancement</translation>
+ </message>
+ <message>
+ <source>Pointer</source>
+ <translation>Pointeur</translation>
+ </message>
+ <message>
+ <source>Checked</source>
+ <translation>Coché</translation>
+ </message>
+ <message>
+ <source>Table grid</source>
+ <translation>Quadrillage du tableau</translation>
+ </message>
+ <message>
+ <source>SALOME style preferences</source>
+ <translation>Préférences de style Salomé</translation>
+ </message>
+ <message>
+ <source>Enable SALOME Style</source>
+ <translation>Activer le style Salomé</translation>
+ </message>
+ <message>
+ <source>Font</source>
+ <translation>Caractères</translation>
+ </message>
+ <message>
+ <source>Type</source>
+ <translation>Type</translation>
+ </message>
+ <message>
+ <source>None</source>
+ <translation>Aucun</translation>
+ </message>
+ <message>
+ <source>Horizontal</source>
+ <translation>Horizontal</translation>
+ </message>
+ <message>
+ <source>Inclined</source>
+ <translation>Incliné</translation>
+ </message>
+ <message>
+ <source>Transparency</source>
+ <translation>Transparence</translation>
+ </message>
+ <message>
+ <source>Widgets rounding</source>
+ <translation>Arrondi des objets-fenêtres</translation>
+ </message>
+ <message>
+ <source>Buttons</source>
+ <translation>Boutons</translation>
+ </message>
+ <message>
+ <source>Edit boxes</source>
+ <translation>Champs d'édition</translation>
+ </message>
+ <message>
+ <source>Frames</source>
+ <translation>Cadres</translation>
+ </message>
+ <message>
+ <source>Sliders</source>
+ <translation>Barres de défilement</translation>
+ </message>
+ <message>
+ <source>Anti-aliased borders</source>
+ <translation>Frontières anticrénelées</translation>
+ </message>
+ <message>
+ <source>Handle</source>
+ <translation>Poignée</translation>
+ </message>
+ <message>
+ <source>Horizontal spacing</source>
+ <translation>Espacement horizontal</translation>
+ </message>
+ <message>
+ <source>Vertical spacing</source>
+ <translation>Espacement vertical</translation>
+ </message>
+ <message>
+ <source>Splitter handle size</source>
+ <translation>Taille de poignée du diviseur</translation>
+ </message>
+ <message>
+ <source>Slider handle size</source>
+ <translation>Taille de poignée de la barre de défilement</translation>
+ </message>
+ <message>
+ <source>Widget effect</source>
+ <translation>Effet des composants</translation>
+ </message>
+ <message>
+ <source>Highlight widgets</source>
+ <translation>Mettre en valeur les composants</translation>
+ </message>
+ <message>
+ <source>Auto raise widgets</source>
+ <translation>Activer les composants automatiquement</translation>
+ </message>
+ <message>
+ <source>Colors</source>
+ <translation>Couleurs</translation>
+ </message>
+ <message>
+ <source>Properties</source>
+ <translation>Paramètres</translation>
+ </message>
+ <message>
+ <source>[ Current ]</source>
+ <translation>[ Actuel ]</translation>
+ </message>
+ <message>
+ <source>[ Default ]</source>
+ <translation>[ Défaut ]</translation>
+ </message>
+ <message>
+ <source>Delete user theme</source>
+ <translation>Supprimer le thème utilisateur</translation>
+ </message>
+ <message>
+ <source>Remove theme %1?</source>
+ <translation>Supprimer le thème %1?</translation>
+ </message>
+ <message>
+ <source>Custom schema</source>
+ <translation>Schéma personnalisé</translation>
+ </message>
+</context>
+</TS>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="fr_FR">
+<context>
+ <name>@default</name>
+ <message>
+ <source>TOOLS_WRN_WARNING</source>
+ <translation>Avertissement</translation>
+ </message>
+ <message>
+ <source>TOOLS_BUT_BROWSE</source>
+ <translation>Naviguer...</translation>
+ </message>
+ <message>
+ <source>TOOLS_ERR_ERROR</source>
+ <translation>Erreur</translation>
+ </message>
+ <message>
+ <source>TOOLS_ERR_FILE_NOT_EXIST</source>
+ <translation>%1
+Le fichier n'existe pas</translation>
+ </message>
+ <message>
+ <source>TOOLS_BUT_OK</source>
+ <translation>&Ok</translation>
+ </message>
+ <message>
+ <source>TOOLS_BUT_APPLY</source>
+ <translation>&Appliquer</translation>
+ </message>
+ <message>
+ <source>TOOLS_BUT_CLOSE</source>
+ <translation>&Fermer</translation>
+ </message>
+</context>
+<context>
+ <name>ToolsGUI_CatalogGeneratorDlg</name>
+ <message>
+ <source>TOOLS_MEN_EXPORT</source>
+ <translation>Exporter</translation>
+ </message>
+ <message>
+ <source>TOOLS_MEN_IMPORT</source>
+ <translation>Importer</translation>
+ </message>
+ <message>
+ <source>TOOLS_VERSION</source>
+ <translation>Version : </translation>
+ </message>
+ <message>
+ <source>TOOLS_COMP_NAME</source>
+ <translation>Nom : </translation>
+ </message>
+ <message>
+ <source>TOOLS_COMP_TYPE</source>
+ <translation>Type : </translation>
+ </message>
+ <message>
+ <source>TOOLS_XML_FILE</source>
+ <translation>XML : </translation>
+ </message>
+ <message>
+ <source>TOOLS_PNG_FILE</source>
+ <translation>Icône : </translation>
+ </message>
+ <message>
+ <source>TOOLS_SUPPLEMENT</source>
+ <translation>Données supplémentaires du composant</translation>
+ </message>
+ <message>
+ <source>TOOLS_AUTHOR</source>
+ <translation>Auteur : </translation>
+ </message>
+ <message>
+ <source>TOOLS_COMP_MULTISTD</source>
+ <translation>Multi-étude : </translation>
+ </message>
+ <message>
+ <source>TOOLS_COMP_USERNAME</source>
+ <translation>Nom utilisateur : </translation>
+ </message>
+ <message>
+ <source>TOOLS_CATALOG_GENERATOR</source>
+ <translation>Générateur du catalogue</translation>
+ </message>
+ <message>
+ <source>TOOLS_FILES</source>
+ <translation>Fichiers</translation>
+ </message>
+ <message>
+ <source>TOOLS_MEN_IMPORT_PNG</source>
+ <translation>Fichiers PNG ( *.png )</translation>
+ </message>
+ <message>
+ <source>TOOLS_MEN_IMPORT_IDL</source>
+ <translation>Fichiers IDL ( *.idl )</translation>
+ </message>
+ <message>
+ <source>TOOLS_MEN_EXPORT_XML</source>
+ <translation>Fichiers XML ( *.xml )</translation>
+ </message>
+ <message>
+ <source>TOOLS_IDL_FILE</source>
+ <translation>IDL : </translation>
+ </message>
+</context>
+<context>
+ <name>ToolsGUI_RegWidget</name>
+ <message>
+ <source>TLT_REFRESH_INTERVAL</source>
+ <translation>Fréquence d'actualisation</translation>
+ </message>
+ <message>
+ <source>LAB_REFRESH_INTERVAL</source>
+ <translation>Nouvelle fréquence d'actualisation (en secondes)</translation>
+ </message>
+ <message>
+ <source>TLT_REGISTRY</source>
+ <translation>Registre</translation>
+ </message>
+ <message>
+ <source>MNU_ACTIONS</source>
+ <translation>Actions</translation>
+ </message>
+ <message>
+ <source>TB_ACTIONS</source>
+ <translation>Actions</translation>
+ </message>
+ <message>
+ <source>MEN_REFRESH</source>
+ <translation>Actualiser</translation>
+ </message>
+ <message>
+ <source>STB_REFRESH</source>
+ <translation>Met à jour la liste des composants</translation>
+ </message>
+ <message>
+ <source>MEN_INTERVAL</source>
+ <translation>Fréquence d'actualisation...</translation>
+ </message>
+ <message>
+ <source>STB_INTERVAL</source>
+ <translation>Changer la fréquence d'actualisation</translation>
+ </message>
+ <message>
+ <source>MEN_CLOSE</source>
+ <translation>Fermer</translation>
+ </message>
+ <message>
+ <source>STB_CLOSE</source>
+ <translation>Fermer la fenêtre du Registre</translation>
+ </message>
+ <message>
+ <source>TAB_RUNNING</source>
+ <translation>En cours</translation>
+ </message>
+ <message>
+ <source>TAB_HISTORY</source>
+ <translation>Historique</translation>
+ </message>
+ <message>
+ <source>HDR_COMPONENT</source>
+ <translation>Composant</translation>
+ </message>
+ <message>
+ <source>HDR_PID</source>
+ <translation>PID</translation>
+ </message>
+ <message>
+ <source>HDR_USERNAME</source>
+ <translation>Nom de l'utilisateur</translation>
+ </message>
+ <message>
+ <source>HDR_HOSTNAME</source>
+ <translation>Nom de l'hôte</translation>
+ </message>
+ <message>
+ <source>HDR_STARTED</source>
+ <translation>Commencé</translation>
+ </message>
+ <message>
+ <source>HDR_FINISHED</source>
+ <translation>Terminé</translation>
+ </message>
+ <message>
+ <source>HDR_HELLO</source>
+ <translation>Dernier ping</translation>
+ </message>
+ <message>
+ <source>ERR_NO_REGISTRY</source>
+ <translation>Erreur: le serveur de registre n'est pas trouvé</translation>
+ </message>
+ <message>
+ <source>INFO_SERVICE</source>
+ <translation>Service : %1</translation>
+ </message>
+ <message>
+ <source>INFO_PROCESS</source>
+ <translation>Le procédé ( PID : %1 ) sur la station %2 ( adresse IP : %3 ); lancé par l'utilisateur %4 ( UID : %5 ) au répertoire %6.</translation>
+ </message>
+ <message>
+ <source>INFO_STARTED</source>
+ <translation>Commencé : %1</translation>
+ </message>
+ <message>
+ <source>INFO_LAST_PING</source>
+ <translation>Dernier signal : %1</translation>
+ </message>
+ <message>
+ <source>INFO_FINISHED</source>
+ <translation>Fini : %1</translation>
+ </message>
+ <message>
+ <source>INFO_RUNNING</source>
+ <translation>En cours</translation>
+ </message>
+ <message>
+ <source>INFO_TIME_DIFF</source>
+ <translation>Le temps de la station %1 est différent du temps du serveur. La différence est %2 secondes.</translation>
+ </message>
+</context>
+</TS>
--- /dev/null
+ <!DOCTYPE RCC><RCC version="1.0">
+ <qresource>
+ <file>textures/texture1.dat</file>
+ <file>textures/texture2.dat</file>
+ <file>textures/texture3.dat</file>
+ <file>textures/texture4.dat</file>
+ <file>textures/texture5.dat</file>
+ <file>textures/texture6.dat</file>
+ <file>textures/texture7.dat</file>
+ <file>textures/texture8.dat</file>
+ <file>textures/texture9.dat</file>
+ </qresource>
+ </RCC>
+
\ No newline at end of file
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "VTKViewer_Algorithm.h"
+
+namespace VTK
+{
+ ActorCollectionCopy::ActorCollectionCopy( vtkActorCollection* theActorCollection )
+ {
+ myActorCollection = vtkActorCollection::New();
+ theActorCollection->InitTraversal();
+ while(vtkActor* anActor = theActorCollection->GetNextActor())
+ myActorCollection->AddItem(anActor);
+ }
+
+ ActorCollectionCopy::~ActorCollectionCopy()
+ {
+ myActorCollection->Delete();
+ myActorCollection = NULL;
+ }
+
+ vtkActorCollection* ActorCollectionCopy::GetActors() const
+ {
+ return myActorCollection;
+ }
+}
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// File : VTKViewer_ArcBuilder.cxx
+// Author : Roman NIKOLAEV
+// Module : GUI
+//
+#include "VTKViewer_ArcBuilder.h"
+
+#include <math.h>
+#include <float.h>
+
+//VTK includes
+#include <vtkMath.h>
+#include <vtkUnstructuredGrid.h>
+#include <vtkTransformFilter.h>
+#include <vtkTransform.h>
+#include <vtkPoints.h>
+#include <vtkVertex.h>
+#include <vtkCellArray.h>
+#include <vtkTriangle.h>
+#include <vtkPolyData.h>
+#include <vtkPointData.h>
+
+#define PRECISION 10e-4
+#define ANGLE_PRECISION 0.5
+//#define _MY_DEBUG_
+
+#ifdef _MY_DEBUG_
+#include <iostream>
+#endif
+
+
+bool CheckAngle(const double compare, const double angle){
+ if((angle <= compare - ANGLE_PRECISION) || (angle >= compare + ANGLE_PRECISION))
+ return true;
+ else
+ return false;
+}
+
+//------------------------------------------------------------------------
+/*!
+ *Class XYZ
+ *Constructor
+ */
+XYZ::XYZ(double X, double Y, double Z):
+ x(X),y(Y),z(Z) {}
+
+/*!
+ * Empty Constructor
+ */
+XYZ::XYZ(){}
+
+/*!
+ * Destructor
+ */
+XYZ::~XYZ()
+{}
+
+/*
+ * Calculate modulus
+ */
+double XYZ::Modulus () const {
+ return sqrt (x * x + y * y + z * z);
+}
+
+//------------------------------------------------------------------------
+/*!
+ * Class Pnt
+ * Constructor
+ */
+Pnt::Pnt(double X,
+ double Y,
+ double Z,
+ double ScalarValue):
+ coord(X,Y,Z),
+ scalarValue(ScalarValue)
+{
+}
+
+Pnt::Pnt()
+{
+}
+
+/*!
+ * Destructor
+ */
+Pnt::~Pnt()
+{
+}
+
+//------------------------------------------------------------------------
+/*!
+ * Class Vec
+ * Constructor
+ */
+Vec::Vec (const double Xv,
+ const double Yv,
+ const double Zv)
+{
+ double D = sqrt (Xv * Xv + Yv * Yv + Zv * Zv);
+ if(D != 0) {
+ coord.SetX(Xv / D);
+ coord.SetY(Yv / D);
+ coord.SetZ(Zv / D);
+ }
+}
+
+/*!
+ * Destructor
+ */
+Vec::~Vec(){}
+
+
+/*!
+ * Calculate angle between vectors in radians
+ */
+double Vec::AngleBetween(const Vec & Other)
+{
+ double res;
+ double numerator = GetXYZ().X()*Other.GetXYZ().X()+GetXYZ().Y()*Other.GetXYZ().Y()+GetXYZ().Z()*Other.GetXYZ().Z();
+ double denumerator = GetXYZ().Modulus()*Other.GetXYZ().Modulus();
+ double d = numerator/denumerator;
+ if( d < -1 && d > -1 - PRECISION )
+ d = -1;
+ else if( d > 1 && d < 1 + PRECISION )
+ d = 1;
+ res = acos( d );
+ return res;
+}
+
+/*!
+ * Calculate angle between vectors in degrees
+ */
+double Vec::AngleBetweenInGrad(const Vec & Other){
+ return AngleBetween(Other)*vtkMath::DegreesFromRadians(1.);
+}
+
+/*
+ * Calculate vector multiplication
+*/
+Vec Vec::VectMultiplication(const Vec & Other) const{
+ double x = GetXYZ().Y()*Other.GetXYZ().Z() - GetXYZ().Z()*Other.GetXYZ().Y();
+ double y = GetXYZ().Z()*Other.GetXYZ().X() - GetXYZ().X()*Other.GetXYZ().Z();
+ double z = GetXYZ().X()*Other.GetXYZ().Y() - GetXYZ().Y()*Other.GetXYZ().X();
+ Vec *aRes = new Vec(x,y,z);
+ return *aRes;
+}
+
+/*---------------------Class Plane --------------------------------*/
+/*!
+ * Constructor
+ */
+Plane::Plane(const Pnt& thePnt1, const Pnt& thePnt2, const Pnt& thePnt3)
+{
+ CalculatePlane(thePnt1,thePnt2,thePnt3);
+}
+
+/*!
+ * Destructor
+ */
+Plane::~Plane()
+{}
+
+/*
+ * Return plane normale
+ */
+Vec Plane::GetNormale() const{
+ return Vec(myA,myB,myC);
+}
+
+/*
+ * Calculate A,B,C coeefs of plane
+ */
+void Plane::CalculatePlane(const Pnt& thePnt1, const Pnt& thePnt2, const Pnt& thePnt3){
+
+ double x1 = thePnt1.GetXYZ().X();
+ double x2 = thePnt2.GetXYZ().X();
+ double x3 = thePnt3.GetXYZ().X();
+
+ double y1 = thePnt1.GetXYZ().Y();
+ double y2 = thePnt2.GetXYZ().Y();
+ double y3 = thePnt3.GetXYZ().Y();
+
+ double z1 = thePnt1.GetXYZ().Z();
+ double z2 = thePnt2.GetXYZ().Z();
+ double z3 = thePnt3.GetXYZ().Z();
+
+ myA = y1*(z2 - z3) + y2*(z3 - z1) + y3*(z1 - z2);
+ myB = z1*(x2 - x3) + z2*(x3 - x1) + z3*(x1 - x2);
+ myC = x1*(y2 - y3) + x2*(y3 - y1) + x3*(y1 - y2);
+
+#ifdef _MY_DEBUG_
+ cout<<"Plane A: "<<myA<<endl;
+ cout<<"Plane B: "<<myB<<endl;
+ cout<<"Plane C: "<<myC<<endl;
+#endif
+
+}
+
+
+/*---------------------Class VTKViewer_ArcBuilder --------------------------------*/
+/*!
+ * Constructor
+ */
+VTKViewer_ArcBuilder::VTKViewer_ArcBuilder(const Pnt& thePnt1,
+ const Pnt& thePnt2,
+ const Pnt& thePnt3,
+ double theAngle):
+ myStatus(Arc_Error),
+ myAngle(theAngle)
+{
+ Vec V1(thePnt2.GetXYZ().X()-thePnt1.GetXYZ().X(),
+ thePnt2.GetXYZ().Y()-thePnt1.GetXYZ().Y(),
+ thePnt2.GetXYZ().Z()-thePnt1.GetXYZ().Z());
+
+ Vec V2(thePnt2.GetXYZ().X()-thePnt3.GetXYZ().X(),
+ thePnt2.GetXYZ().Y()-thePnt3.GetXYZ().Y(),
+ thePnt2.GetXYZ().Z()-thePnt3.GetXYZ().Z());
+
+ double angle = V1.AngleBetweenInGrad(V2);
+
+ //Check that points are not belong one line
+#ifdef _MY_DEBUG_
+ cout<<"Angle for check: "<<angle<<endl;
+#endif
+ if(CheckAngle(180,angle)) {
+
+ // Build plane by three points
+ Plane aPlane(thePnt1,thePnt2,thePnt3);
+
+ //Plane normales
+ Vec aPlaneNormale = aPlane.GetNormale();
+#ifdef _MY_DEBUG_
+ std::cout<<"X Normale: "<<aPlaneNormale.GetXYZ().X()<<std::endl;
+ std::cout<<"Y Normale: "<<aPlaneNormale.GetXYZ().Y()<<std::endl;
+ std::cout<<"Z Normale: "<<aPlaneNormale.GetXYZ().Z()<<std::endl;
+#endif
+ //OZ vector
+ Vec OZ(0,0,1);
+
+ //Projection plane normale on XOY
+ Vec aNormaleProjection (aPlaneNormale.GetXYZ().X(),
+ aPlaneNormale.GetXYZ().Y(),
+ 0);
+#ifdef _MY_DEBUG_
+ std::cout<<"X Normale Projection: "<<aNormaleProjection.GetXYZ().X()<<std::endl;
+ std::cout<<"Y Normale Projection: "<<aNormaleProjection.GetXYZ().Y()<<std::endl;
+ std::cout<<"Z Normale Projection: "<<aNormaleProjection.GetXYZ().Z()<<std::endl;
+#endif
+
+ //Rotation axis
+ Vec aAxis = aNormaleProjection.VectMultiplication(OZ);
+#ifdef _MY_DEBUG_
+ std::cout<<"X Axis: "<<aAxis.GetXYZ().X()<<std::endl;
+ std::cout<<"Y Axis: "<<aAxis.GetXYZ().Y()<<std::endl;
+ std::cout<<"Z Axis: "<<aAxis.GetXYZ().Z()<<std::endl;
+#endif
+ //Rotation angle
+ double anAngle = OZ.AngleBetweenInGrad(aPlaneNormale);
+#ifdef _MY_DEBUG_
+ std::cout<<"Rotation Angle :"<<anAngle<<endl;
+#endif
+ PntList aInputPnts;
+ aInputPnts.push_back(thePnt1);
+ aInputPnts.push_back(thePnt2);
+ aInputPnts.push_back(thePnt3);
+
+ vtkUnstructuredGrid* aGrid = BuildGrid(aInputPnts);
+
+ bool needRotation = true;
+ if(anAngle == 0 || anAngle == 180)
+ needRotation = false;
+
+ if(aGrid) {
+ vtkUnstructuredGrid* aTransformedGrid;
+ if(needRotation) {
+ aTransformedGrid = TransformGrid(aGrid,aAxis,anAngle);
+ aTransformedGrid->Update();
+#ifdef _MY_DEBUG_
+ cout<<"Need Rotation!!!"<<endl;
+#endif
+ }
+ else {
+ aTransformedGrid = aGrid;
+#ifdef _MY_DEBUG_
+ cout<<"Rotation does not need!!!"<<endl;
+#endif
+ }
+
+ double coords[3];
+ aTransformedGrid->GetPoint(0,coords);
+ myPnt1 = Pnt(coords[0],coords[1],coords[2], thePnt1.GetScalarValue());
+ aTransformedGrid->GetPoint(1,coords);
+ myPnt2 = Pnt(coords[0],coords[1],coords[2], thePnt2.GetScalarValue());
+ aTransformedGrid->GetPoint(2,coords);
+ myPnt3 = Pnt(coords[0],coords[1],coords[2], thePnt3.GetScalarValue());
+ std::vector<double> aScalarValues;
+ vtkUnstructuredGrid* anArc = BuildArc(aScalarValues);
+ vtkUnstructuredGrid* anTransArc;
+ if(needRotation) {
+ anTransArc = TransformGrid(anArc,aAxis,-anAngle);
+ anTransArc->Update();
+ }
+ else
+ anTransArc = anArc;
+
+ myPoints = anTransArc->GetPoints();
+ myScalarValues = aScalarValues;
+ myStatus = Arc_Done;
+ }
+ }
+ else{
+#ifdef _MY_DEBUG_
+ std::cout<<"Points lay on the one line !"<<endl;
+#endif
+ PntList aList;
+ aList.push_back(thePnt1);
+ aList.push_back(thePnt2);
+ aList.push_back(thePnt3);
+ vtkUnstructuredGrid* aGrid = BuildGrid(aList);
+ aGrid->Update();
+ myPoints = aGrid->GetPoints();
+
+ myScalarValues.clear();
+ myScalarValues.push_back(thePnt1.GetScalarValue());
+ myScalarValues.push_back(thePnt2.GetScalarValue());
+ myScalarValues.push_back(thePnt3.GetScalarValue());
+ myStatus = Arc_Done;
+ }
+}
+
+/*!
+ * Destructor
+ */
+VTKViewer_ArcBuilder::~VTKViewer_ArcBuilder()
+{}
+
+
+/*
+ * Add to the vtkUnstructuredGrid points from input list
+ */
+vtkUnstructuredGrid* VTKViewer_ArcBuilder::BuildGrid(const PntList& theList) const
+{
+ int aListsize = theList.size();
+ vtkUnstructuredGrid* aGrid = NULL;
+
+ if(aListsize != 0) {
+ aGrid = vtkUnstructuredGrid::New();
+ vtkPoints* aPoints = vtkPoints::New();
+ aPoints->SetNumberOfPoints(aListsize);
+
+ aGrid->Allocate(aListsize);
+
+ PntList::const_iterator it = theList.begin();
+ int aCounter = 0;
+ for(;it != theList.end();it++) {
+ Pnt aPnt = *it;
+ aPoints->InsertPoint(aCounter,
+ aPnt.GetXYZ().X(),
+ aPnt.GetXYZ().Y(),
+ aPnt.GetXYZ().Z());
+ vtkVertex* aVertex = vtkVertex::New();
+ aVertex->GetPointIds()->SetId(0, aCounter);
+ aGrid->InsertNextCell(aVertex->GetCellType(), aVertex->GetPointIds());
+ aCounter++;
+ aVertex->Delete();
+ }
+ aGrid->SetPoints(aPoints);
+ aPoints->Delete();
+ }
+ return aGrid;
+}
+
+
+vtkUnstructuredGrid*
+VTKViewer_ArcBuilder::TransformGrid(vtkUnstructuredGrid* theGrid,
+ const Vec& theAxis, const double angle) const
+{
+ vtkTransform *aTransform = vtkTransform::New();
+ aTransform->RotateWXYZ(angle, theAxis.GetXYZ().X(), theAxis.GetXYZ().Y(), theAxis.GetXYZ().Z());
+ vtkTransformFilter* aTransformFilter = vtkTransformFilter::New();
+ aTransformFilter->SetTransform(aTransform);
+ aTransformFilter->SetInput(theGrid);
+ aTransform->Delete();
+ return aTransformFilter->GetUnstructuredGridOutput();
+}
+
+
+void VTKViewer_ArcBuilder::GetAngle(const double theAngle){
+ myAngle = theAngle;
+}
+
+double InterpolateScalarValue(int index, int count, double firstValue, double middleValue, double lastValue)
+{
+ bool isFirstHalf = index <= count / 2;
+ double first = isFirstHalf ? firstValue : lastValue;
+ double last = isFirstHalf ? middleValue : middleValue;
+ double ratio = (double)index / (double)count;
+ double position = isFirstHalf ? ratio * 2 : ( 1 - ratio ) * 2;
+ double value = first + (last - first) * position;
+ return value;
+}
+
+vtkUnstructuredGrid* VTKViewer_ArcBuilder::BuildArc(std::vector<double>& theScalarValues){
+ double x1 = myPnt1.GetXYZ().X(); double x2 = myPnt2.GetXYZ().X(); double x3 = myPnt3.GetXYZ().X();
+ double y1 = myPnt1.GetXYZ().Y(); double y2 = myPnt2.GetXYZ().Y(); double y3 = myPnt3.GetXYZ().Y();
+ double z = myPnt1.GetXYZ().Z(); //Points on plane || XOY
+
+
+ theScalarValues.clear();
+
+ double K1 = 0;
+ double K2 = 0;
+ bool okK1 = false, okK2 = false;
+ if ( fabs(x2 - x1) > DBL_MIN )
+ K1 = (y2 - y1)/(x2 - x1), okK1 = true;
+ if ( fabs(x3 - x2) > DBL_MIN )
+ K2 = (y3 - y2)/(x3 - x2), okK2 = true;
+
+#ifdef _MY_DEBUG_
+ std::cout<<"K1 : "<< K1 <<endl;
+ std::cout<<"K2 : "<< K2 <<endl;
+#endif
+ double xCenter;
+ if( !okK2 ) //K2 --> infinity
+ xCenter = (K1*(y1-y3) + (x1+x2))/2.0;
+
+ else if( !okK1 ) //K1 --> infinity
+ xCenter = (K2*(y1-y3) - (x2+x3))/(-2.0);
+
+ else
+ xCenter = (K1*K2*(y1-y3) + K2*(x1+x2) - K1*(x2+x3))/ (2.0*(K2-K1));
+
+ double yCenter;
+
+ if ( K1 == 0 )
+ yCenter = (-1/K2)*(xCenter - (x2+x3)/2.0) + (y2 + y3)/2.0;
+ else
+ yCenter = (-1/K1)*(xCenter - (x1+x2)/2.0) + (y1 + y2)/2.0;
+
+#ifdef _MY_DEBUG_
+ double zCenter = z;
+ std::cout<<"xCenter : "<<xCenter<<endl;
+ std::cout<<"yCenter : "<<yCenter<<endl;
+ std::cout<<"zCenter : "<<zCenter<<endl;
+#endif
+ double aRadius = sqrt((x1 - xCenter)*(x1 - xCenter) + (y1 - yCenter)*(y1 - yCenter));
+
+ double angle1 = GetPointAngleOnCircle(xCenter,yCenter,x1,y1);
+ double angle2 = GetPointAngleOnCircle(xCenter,yCenter,x2,y2);
+ double angle3 = GetPointAngleOnCircle(xCenter,yCenter,x3,y3);
+
+
+ double aMaxAngle = vtkMath::RadiansFromDegrees(1.)*myAngle*2;
+
+ /* double aTotalAngle = fabs(angle3 - angle1);
+
+ if (aTotalAngle > vtkMath::DoublePi())
+ aTotalAngle = 2*vtkMath::DoublePi()-aTotalAngle;
+ */
+
+ double aTotalAngle = 0;
+ IncOrder aOrder = GetArcAngle(angle1,angle2,angle3,&aTotalAngle);
+
+ vtkUnstructuredGrid *aC = NULL;
+
+ if(aTotalAngle > aMaxAngle) {
+ int nbSteps = int(aTotalAngle/aMaxAngle)+1;
+ double anIncrementAngle = aTotalAngle/nbSteps;
+ double aCurrentAngle = angle1;
+ if(aOrder == VTKViewer_ArcBuilder::MINUS)
+ aCurrentAngle-=anIncrementAngle;
+ else
+ aCurrentAngle+=anIncrementAngle;
+#ifdef _MY_DEBUG_
+ cout<<"Total angle :"<<aTotalAngle<<endl;
+ cout<<"Max Increment Angle :"<<aMaxAngle<<endl;
+ cout<<"Real Increment angle :"<<anIncrementAngle<<endl;
+ cout<<"Nb Steps : "<<nbSteps<<endl;
+#endif
+
+ PntList aList;
+ aList.push_back(myPnt1);
+ theScalarValues.push_back(myPnt1.GetScalarValue());
+ for(int i=1;i<=nbSteps-1;i++){
+ double x = xCenter + aRadius*cos(aCurrentAngle);
+ double y = yCenter + aRadius*sin(aCurrentAngle);
+ double value = InterpolateScalarValue(i, nbSteps, myPnt1.GetScalarValue(), myPnt2.GetScalarValue(), myPnt3.GetScalarValue());
+ Pnt aPnt(x,y,z,value);
+
+ aList.push_back(aPnt);
+ theScalarValues.push_back(aPnt.GetScalarValue());
+ if(aOrder == VTKViewer_ArcBuilder::MINUS)
+ aCurrentAngle-=anIncrementAngle;
+ else
+ aCurrentAngle+=anIncrementAngle;
+ }
+ aList.push_back(myPnt3);
+ theScalarValues.push_back(myPnt3.GetScalarValue());
+
+ aC = BuildGrid(aList);
+#ifdef _MY_DEBUG_
+ cout<<"angle1 : "<<angle1*vtkMath::DoubleRadiansToDegrees()<<endl;
+ cout<<"angle2 : "<<angle2*vtkMath::DoubleRadiansToDegrees()<<endl;
+ cout<<"angle3 : "<<angle3*vtkMath::DoubleRadiansToDegrees()<<endl;
+#endif
+ }
+ else{
+ PntList aList;
+ aList.push_back(myPnt1);
+ aList.push_back(myPnt2);
+ aList.push_back(myPnt3);
+ aC = BuildGrid(aList);
+
+ theScalarValues.push_back(myPnt1.GetScalarValue());
+ theScalarValues.push_back(myPnt2.GetScalarValue());
+ theScalarValues.push_back(myPnt3.GetScalarValue());
+ }
+ return aC;
+}
+
+double VTKViewer_ArcBuilder::
+GetPointAngleOnCircle(const double theXCenter, const double theYCenter,
+ const double theXPoint, const double theYPoint){
+ double result = atan2(theYCenter - theYPoint, theXPoint - theXCenter);
+ if(result < 0 )
+ result = result+vtkMath::DoublePi()*2;
+ return vtkMath::DoublePi()*2-result;
+ return result;
+}
+
+vtkPoints* VTKViewer_ArcBuilder::GetPoints(){
+ return myPoints;
+}
+
+const std::vector<double>& VTKViewer_ArcBuilder::GetScalarValues()
+{
+ return myScalarValues;
+}
+
+VTKViewer_ArcBuilder::IncOrder VTKViewer_ArcBuilder::GetArcAngle( const double& P1, const double& P2, const double& P3,double* Ang){
+ IncOrder aResult;
+ if(P1 < P2 && P2 < P3){
+ *Ang = P3 - P1;
+ aResult = VTKViewer_ArcBuilder::PLUS;
+ }
+ else if((P1 < P3 && P3 < P2) || (P2 < P1 && P1 < P3)){
+ *Ang = 2*vtkMath::DoublePi() - P3 + P1;
+ aResult = VTKViewer_ArcBuilder::MINUS;
+ }
+ else if((P2 < P3 && P3 < P1) || (P3 < P1 && P1 < P2)){
+ *Ang = 2*vtkMath::DoublePi() - P1 + P3;
+ aResult = VTKViewer_ArcBuilder::PLUS;
+ }
+ else if(P3 < P2 && P2 < P1){
+ *Ang = P1 - P3;
+ aResult = VTKViewer_ArcBuilder::MINUS;
+ }
+ return aResult;
+}
+
+//------------------------------------------------------------------------
+Pnt CreatePnt(vtkCell* cell, vtkDataArray* scalars, vtkIdType index)
+{
+ vtkFloatingPointType coord[3];
+ cell->GetPoints()->GetPoint(index, coord);
+ vtkIdType pointId = cell->GetPointId(index);
+ double scalarValue = scalars ? scalars->GetTuple1(pointId) : 0;
+ Pnt point(coord[0], coord[1], coord[2], scalarValue);
+ return point;
+}
+
+//------------------------------------------------------------------------
+vtkIdType Build1DArc(vtkIdType cellId, vtkUnstructuredGrid* input,
+ vtkPolyData *output,vtkIdType *pts,
+ vtkFloatingPointType myMaxArcAngle){
+
+ vtkIdType aResult = -1;
+ vtkIdType *aNewPoints;
+
+ vtkDataArray* inputScalars = input->GetPointData()->GetScalars();
+ vtkDataArray* outputScalars = output->GetPointData()->GetScalars();
+
+ vtkCell* aCell = input->GetCell(cellId);
+ //Get All points from input cell
+ Pnt P0 = CreatePnt( aCell, inputScalars, 0 );
+ Pnt P1 = CreatePnt( aCell, inputScalars, 1 );
+ Pnt P2 = CreatePnt( aCell, inputScalars, 2 );
+
+ VTKViewer_ArcBuilder aBuilder(P0,P2,P1,myMaxArcAngle);
+ if (aBuilder.GetStatus() != VTKViewer_ArcBuilder::Arc_Done) {
+ return aResult;
+ }
+ else{
+ vtkPoints* aPoints = aBuilder.GetPoints();
+ std::vector<double> aScalarValues = aBuilder.GetScalarValues();
+ vtkIdType aNbPts = aPoints->GetNumberOfPoints();
+ aNewPoints = new vtkIdType[aNbPts];
+ vtkIdType curID;
+ vtkIdType aCellType = VTK_POLY_LINE;
+
+ aNewPoints[0] = pts[0];
+ for(vtkIdType idx = 1; idx < aNbPts-1;idx++) {
+ curID = output->GetPoints()->InsertNextPoint(aPoints->GetPoint(idx));
+ if( outputScalars )
+ outputScalars->InsertNextTuple1(aScalarValues[idx]);
+ aNewPoints[idx] = curID;
+ }
+ aNewPoints[aNbPts-1] = pts[1];
+
+ aResult = output->InsertNextCell(aCellType,aNbPts,aNewPoints);
+ return aResult;
+ }
+}
+
+/*!
+ * Add all points from the input vector theCollection into thePoints.
+ * Array theIds - it is array with ids of added points.
+ */
+vtkIdType MergevtkPoints(const std::vector<vtkPoints*>& theCollection,
+ const std::vector< std::vector<double> >& theScalarCollection,
+ vtkPoints* thePoints,
+ std::map<int, double>& thePntId2ScalarValue,
+ vtkIdType* &theIds){
+ vtkIdType aNbPoints = 0;
+ vtkIdType anIdCounter = 0;
+ vtkIdType aNewPntId = 0;
+
+ //Compute number of points
+ std::vector<vtkPoints*>::const_iterator it = theCollection.begin();
+ for(;it != theCollection.end();it++){
+ vtkPoints* aPoints = *it;
+ if(aPoints) {
+ aNbPoints += aPoints->GetNumberOfPoints()-1; //Because we add all points except last
+ }
+ }
+ it = theCollection.begin();
+ std::vector< std::vector<double> >::const_iterator itScalar = theScalarCollection.begin();
+ theIds = new vtkIdType[aNbPoints];
+ // ..and add all points
+ for(;it != theCollection.end() && itScalar != theScalarCollection.end(); it++, itScalar++){
+ vtkPoints* aPoints = *it;
+ std::vector<double> aScalarValues = *itScalar;
+
+ if(aPoints){
+ for(vtkIdType idx = 0;idx < aPoints->GetNumberOfPoints()-1;idx++){
+ aNewPntId = thePoints->InsertNextPoint(aPoints->GetPoint(idx));
+ theIds[anIdCounter] = aNewPntId;
+ thePntId2ScalarValue[ aNewPntId ] = aScalarValues[idx];
+ anIdCounter++;
+ }
+ }
+ }
+ return aNbPoints;
+}
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef VTKVIEWER_ARCBUILDER_H
+#define VTKVIEWER_ARCBUILDER_H
+
+#include "VTKViewer.h"
+#include <list>
+#include <map>
+#include <vector>
+
+class vtkCell;
+class vtkDataArray;
+class vtkPoints;
+class vtkPolyData;
+class vtkUnstructuredGrid;
+
+class Pnt;
+
+typedef std::list<Pnt> PntList;
+
+vtkIdType MergevtkPoints(const std::vector<vtkPoints*>& theCollection,
+ const std::vector< std::vector<double> >& theScalarCollection,
+ vtkPoints* thePoints,
+ std::map<int, double>& thePntId2ScalarValue,
+ vtkIdType* &theIds);
+
+vtkIdType Build1DArc(vtkIdType cellId,
+ vtkUnstructuredGrid* input,
+ vtkPolyData *output,
+ vtkIdType *pts,
+ vtkFloatingPointType myMaxArcAngle);
+
+Pnt CreatePnt(vtkCell* cell,
+ vtkDataArray* scalars,
+ vtkIdType index);
+
+/*!
+ * Class for represenation coordinates X,Y,Z
+ */
+class XYZ{
+ public:
+
+ XYZ();
+ XYZ(double , double , double);
+ ~XYZ();
+
+ double X()const {return x;}
+ double Y()const {return y;}
+ double Z()const {return z;}
+
+ void SetX(const double X) { x=X; }
+ void SetY(const double Y) { y=Y; }
+ void SetZ(const double Z) { z=Z; }
+
+ void Coord (double& X, double& Y, double& Z) const { X = x; Y = y; Z = z; }
+
+ double Modulus () const;
+
+ private:
+ double x;
+ double y;
+ double z;
+};
+
+/*!
+ Class for the representation point in the 3D space.
+*/
+class Pnt{
+ public:
+ Pnt();
+ Pnt(double, double, double, double);
+ ~Pnt();
+
+ void Coord (double& X, double& Y, double& Z) const {coord.Coord(X,Y,Z);}
+ XYZ GetXYZ() const {return coord;}
+ double GetScalarValue() const { return scalarValue; }
+
+ private:
+ XYZ coord;
+ double scalarValue;
+};
+
+/*!
+ Class for the representation Vector in the 3D space.
+*/
+class Vec{
+ public:
+
+ Vec(const double Xv, const double Yv, const double Zv);
+ ~Vec();
+
+ XYZ GetXYZ() const {return coord;}
+
+ double AngleBetween(const Vec & Other);
+ double AngleBetweenInGrad(const Vec & Other);
+
+ Vec VectMultiplication(const Vec & Other) const;
+
+ private:
+ XYZ coord;
+};
+
+/*!
+ Class for the representation plane in the 3D.
+*/
+class Plane{
+
+ public:
+ Plane(const Pnt& thePnt1, const Pnt& thePnt2, const Pnt& thePnt3);
+ ~Plane();
+
+ double A() const {return myA;}
+ double B() const {return myB;}
+ double C() const {return myC;}
+
+ Vec GetNormale() const;
+
+ private:
+ void CalculatePlane(const Pnt& thePnt1, const Pnt& thePnt2, const Pnt& thePnt3);
+
+ private:
+ double myA;
+ double myB;
+ double myC;
+};
+
+
+class VTKViewer_ArcBuilder{
+ public:
+ enum ArcStatus {Arc_Done=0, Arc_Error};
+ VTKViewer_ArcBuilder(const Pnt& thePnt1,
+ const Pnt& thePnt2,
+ const Pnt& thePnt3,
+ double theAngle);
+
+ ~VTKViewer_ArcBuilder();
+
+ Vec GetNormale();
+
+ ArcStatus GetStatus(){return myStatus;}
+
+ void GetAngle(const double theAngle);
+
+ static double GetPointAngleOnCircle(const double theXCenter, const double theYCenter,
+ const double theXPoint, const double theYPoint);
+
+ vtkPoints* GetPoints();
+ const std::vector<double>& GetScalarValues();
+
+ private:
+
+ enum IncOrder{MINUS=0,PLUS};
+
+ vtkUnstructuredGrid* BuildGrid(const PntList& theList) const;
+ vtkUnstructuredGrid* TransformGrid(vtkUnstructuredGrid* theGrid, const Vec& theAxis, const double angle) const;
+ vtkUnstructuredGrid* BuildArc(std::vector<double>& theScalarValues);
+ IncOrder GetArcAngle( const double& P1, const double& P2, const double& P3, double* Ang);
+
+
+
+ private:
+ Pnt myPnt1;
+ Pnt myPnt2;
+ Pnt myPnt3;
+
+ double myAngle;
+ ArcStatus myStatus;
+ vtkPoints* myPoints;
+ std::vector<double> myScalarValues;
+};
+
+#endif //VTKVIEWER_ARCBUILDER_H
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "VTKViewer_CellCenters.h"
+
+#include <vtkCell.h>
+#include <vtkCellData.h>
+#include <vtkDataSet.h>
+#include <vtkInformation.h>
+#include <vtkInformationVector.h>
+#include <vtkObjectFactory.h>
+#include <vtkPointData.h>
+#include <vtkPoints.h>
+#include <vtkPolyData.h>
+#include <vtkCellArray.h>
+
+vtkCxxRevisionMacro(VTKViewer_CellCenters, "$Revision$");
+vtkStandardNewMacro(VTKViewer_CellCenters);
+
+/*!
+ * Class : VTKViewer_CellCenters
+ * Description : Filter computing geometrical centers of given cells
+ * (differs from native vtk filter by small fix for VTK_CONVEX_POINT_SET cells)
+ */
+
+/*!
+ Constructor
+*/
+VTKViewer_CellCenters::VTKViewer_CellCenters()
+{
+}
+
+/*!
+ Redefined main method
+*/
+int VTKViewer_CellCenters::RequestData(
+ vtkInformation *vtkNotUsed(request),
+ vtkInformationVector **inputVector,
+ vtkInformationVector *outputVector)
+{
+ // get the info objects
+ vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
+ vtkInformation *outInfo = outputVector->GetInformationObject(0);
+
+ // get the input and ouptut
+ vtkDataSet *input = vtkDataSet::SafeDownCast(
+ inInfo->Get(vtkDataObject::DATA_OBJECT()));
+ vtkPolyData *output = vtkPolyData::SafeDownCast(
+ outInfo->Get(vtkDataObject::DATA_OBJECT()));
+
+ vtkIdType cellId, numCells;
+ int subId;
+ vtkCellData *inCD;
+ vtkPointData *outPD;
+ vtkPoints *newPts;
+ vtkCell *cell;
+ double x[3], pcoords[3];
+ double *weights;
+
+ inCD=input->GetCellData();
+ outPD=output->GetPointData();
+
+ if ( (numCells = input->GetNumberOfCells()) < 1 )
+ {
+ vtkWarningMacro(<<"No cells to generate center points for");
+ return 1;
+ }
+
+ newPts = vtkPoints::New();
+ newPts->SetNumberOfPoints(numCells);
+ weights = new double [input->GetMaxCellSize()];
+
+ int abort=0;
+ vtkIdType progressInterval = numCells/10 + 1;
+ int hasEmptyCells = 0;
+ for (cellId=0; cellId < numCells && !abort; cellId++)
+ {
+ if ( ! (cellId % progressInterval) )
+ {
+ vtkDebugMacro(<<"Processing #" << cellId);
+ this->UpdateProgress (0.5*cellId/numCells);
+ abort = this->GetAbortExecute();
+ }
+
+ cell = input->GetCell(cellId);
+ if (cell->GetCellType() != VTK_EMPTY_CELL)
+ {
+ // fix for VTK_CONVEX_POINT_SET cells
+ if (cell->GetCellType() == VTK_CONVEX_POINT_SET )
+ {
+ x[0] = x[1] = x[2] = 0;
+ vtkPoints* aPoints = cell->GetPoints();
+ int aNbPoints = aPoints->GetNumberOfPoints();
+ for( int i = 0; i < aNbPoints; i++ )
+ {
+ double aCoord[3];
+ aPoints->GetPoint( i, aCoord );
+ x[0] += aCoord[0];
+ x[1] += aCoord[1];
+ x[2] += aCoord[2];
+ }
+ x[0] /= aNbPoints;
+ x[1] /= aNbPoints;
+ x[2] /= aNbPoints;
+ }
+ else
+ {
+ subId = cell->GetParametricCenter(pcoords);
+ cell->EvaluateLocation(subId, pcoords, x, weights);
+ }
+ newPts->SetPoint(cellId,x);
+ }
+ else
+ {
+ hasEmptyCells = 1;
+ }
+ }
+
+ if ( this->VertexCells )
+ {
+ vtkIdType pts[1];
+ vtkCellData *outCD=output->GetCellData();
+ vtkCellArray *verts = vtkCellArray::New();
+ verts->Allocate(verts->EstimateSize(1,numCells),1);
+
+ for (cellId=0; cellId < numCells && !abort; cellId++)
+ {
+ if ( ! (cellId % progressInterval) )
+ {
+ vtkDebugMacro(<<"Processing #" << cellId);
+ this->UpdateProgress (0.5+0.5*cellId/numCells);
+ abort = this->GetAbortExecute();
+ }
+
+ cell = input->GetCell(cellId);
+ if (cell->GetCellType() != VTK_EMPTY_CELL)
+ {
+ pts[0] = cellId;
+ verts->InsertNextCell(1,pts);
+ }
+ }
+
+ output->SetVerts(verts);
+ verts->Delete();
+ if (!hasEmptyCells)
+ {
+ outCD->PassData(inCD); //only if verts are generated
+ }
+ }
+
+ // clean up and update output
+ output->SetPoints(newPts);
+ newPts->Delete();
+
+ if (!hasEmptyCells)
+ {
+ outPD->PassData(inCD); //because number of points = number of cells
+ }
+ if (weights)
+ {
+ delete [] weights;
+ }
+
+ return 1;
+}
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef VTKVIEWER_CELLCENTERS_H
+#define VTKVIEWER_CELLCENTERS_H
+
+#include "VTKViewer.h"
+
+#include <vtkCellCenters.h>
+
+#ifdef WIN32
+#pragma warning ( disable:4251 )
+#endif
+
+/*!
+ * Class : VTKViewer_CellCenters
+ * Description : Filter computing geometrical centers of given cells
+ * (differs from native vtk filter by small fix for VTK_CONVEX_POINT_SET cells)
+ */
+class VTKVIEWER_EXPORT VTKViewer_CellCenters : public vtkCellCenters
+{
+public:
+ vtkTypeRevisionMacro(VTKViewer_CellCenters,vtkCellCenters);
+
+ static VTKViewer_CellCenters *New();
+
+protected:
+ VTKViewer_CellCenters();
+
+ virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
+
+private:
+ VTKViewer_CellCenters(const VTKViewer_CellCenters&); // Not implemented.
+ void operator=(const VTKViewer_CellCenters&); // Not implemented.
+};
+
+#ifdef WIN32
+#pragma warning ( default:4251 )
+#endif
+
+#endif
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "VTKViewer_DataSetMapper.h"
+#include "VTKViewer_PolyDataMapper.h"
+
+#include <vtkDataSetSurfaceFilter.h>
+#include <vtkObjectFactory.h>
+
+vtkCxxRevisionMacro(VTKViewer_DataSetMapper, "Revision$");
+vtkStandardNewMacro(VTKViewer_DataSetMapper);
+
+//----------------------------------------------------------------------------
+VTKViewer_DataSetMapper::VTKViewer_DataSetMapper()
+{
+ this->MarkerEnabled = false;
+ this->MarkerType = VTK::MT_NONE;
+ this->MarkerScale = VTK::MS_NONE;
+ this->MarkerId = 0;
+}
+
+//----------------------------------------------------------------------------
+VTKViewer_DataSetMapper::~VTKViewer_DataSetMapper()
+{
+}
+
+//----------------------------------------------------------------------------
+void VTKViewer_DataSetMapper::Render(vtkRenderer *ren, vtkActor *act)
+{
+ // just to create VTKViewer_PolyDataMapper instead of vtkPolyDataMapper
+ if( this->PolyDataMapper == NULL )
+ {
+ vtkDataSetSurfaceFilter *gf = vtkDataSetSurfaceFilter::New();
+ VTKViewer_PolyDataMapper *pm = VTKViewer_PolyDataMapper::New();
+ pm->SetInput(gf->GetOutput());
+
+ pm->SetMarkerEnabled( this->MarkerEnabled );
+ if( this->MarkerType != VTK::MT_USER )
+ pm->SetMarkerStd( this->MarkerType, this->MarkerScale );
+ else
+ pm->SetMarkerTexture( this->MarkerId, this->MarkerTexture );
+
+ this->GeometryExtractor = gf;
+ this->PolyDataMapper = pm;
+ }
+ vtkDataSetMapper::Render(ren, act);
+}
+
+//-----------------------------------------------------------------------------
+void VTKViewer_DataSetMapper::SetMarkerEnabled( bool theMarkerEnabled )
+{
+ this->MarkerEnabled = theMarkerEnabled;
+ if( this->PolyDataMapper )
+ if( VTKViewer_PolyDataMapper* aMapper = dynamic_cast<VTKViewer_PolyDataMapper*>( this->PolyDataMapper ) )
+ aMapper->SetMarkerEnabled( theMarkerEnabled );
+}
+
+//----------------------------------------------------------------------------
+void VTKViewer_DataSetMapper::SetMarkerStd( VTK::MarkerType theMarkerType, VTK::MarkerScale theMarkerScale )
+{
+ this->MarkerType = theMarkerType;
+ this->MarkerScale = theMarkerScale;
+ if( this->PolyDataMapper )
+ if( VTKViewer_PolyDataMapper* aMapper = dynamic_cast<VTKViewer_PolyDataMapper*>( this->PolyDataMapper ) )
+ aMapper->SetMarkerStd( theMarkerType, theMarkerScale );
+}
+
+//----------------------------------------------------------------------------
+void VTKViewer_DataSetMapper::SetMarkerTexture( int theMarkerId, VTK::MarkerTexture theMarkerTexture )
+{
+ this->MarkerType = VTK::MT_USER;
+ this->MarkerId = theMarkerId;
+ this->MarkerTexture = theMarkerTexture;
+ if( this->PolyDataMapper )
+ if( VTKViewer_PolyDataMapper* aMapper = dynamic_cast<VTKViewer_PolyDataMapper*>( this->PolyDataMapper ) )
+ aMapper->SetMarkerTexture( theMarkerId, theMarkerTexture );
+}
+
+//-----------------------------------------------------------------------------
+VTK::MarkerType VTKViewer_DataSetMapper::GetMarkerType()
+{
+ return this->MarkerType;
+}
+
+//-----------------------------------------------------------------------------
+VTK::MarkerScale VTKViewer_DataSetMapper::GetMarkerScale()
+{
+ return this->MarkerScale;
+}
+
+//-----------------------------------------------------------------------------
+int VTKViewer_DataSetMapper::GetMarkerTexture()
+{
+ return this->MarkerId;
+}
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef VTKViewer_DATASETMAPPER_H
+#define VTKViewer_DATASETMAPPER_H
+
+#include "VTKViewer.h"
+#include "VTKViewer_MarkerDef.h"
+
+#include <vtkDataSetMapper.h>
+
+class VTKVIEWER_EXPORT VTKViewer_DataSetMapper : public vtkDataSetMapper
+{
+public:
+ static VTKViewer_DataSetMapper *New();
+ vtkTypeRevisionMacro(VTKViewer_DataSetMapper,vtkDataSetMapper);
+
+ //! Set point marker enabled
+ void SetMarkerEnabled( bool );
+
+ //! Set standard point marker
+ void SetMarkerStd( VTK::MarkerType, VTK::MarkerScale );
+
+ //! Set custom point marker
+ void SetMarkerTexture( int, VTK::MarkerTexture );
+
+ //! Get type of the point marker
+ VTK::MarkerType GetMarkerType();
+
+ //! Get scale of the point marker
+ VTK::MarkerScale GetMarkerScale();
+
+ //! Get texture identifier of the point marker
+ int GetMarkerTexture();
+
+ //! Implement superclass render method.
+ void Render(vtkRenderer *ren, vtkActor *act);
+
+protected:
+ VTKViewer_DataSetMapper();
+ ~VTKViewer_DataSetMapper();
+
+private:
+ VTKViewer_DataSetMapper(const VTKViewer_DataSetMapper&); // Not implemented.
+ void operator=(const VTKViewer_DataSetMapper&); // Not implemented.
+
+private:
+ bool MarkerEnabled;
+ VTK::MarkerType MarkerType;
+ VTK::MarkerScale MarkerScale;
+ int MarkerId;
+ VTK::MarkerTexture MarkerTexture;
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "VTKViewer_FramedTextActor.h"
+
+#include <vtkCellArray.h>
+#include <vtkObjectFactory.h>
+#include <vtkPoints.h>
+#include <vtkPolyData.h>
+#include <vtkPolyDataMapper2D.h>
+#include <vtkProperty2D.h>
+#include <vtkRenderer.h>
+#include <vtkTextActor.h>
+#include <vtkTextMapper.h>
+#include <vtkTextProperty.h>
+#include <vtkTimeStamp.h>
+#include <vtkViewport.h>
+#include <vtkWindow.h>
+
+#include <QStringList>
+
+#define TEXT_MARGIN 4
+#define OFFSET_SPACING 2
+
+//==================================================================
+vtkCxxRevisionMacro(VTKViewer_FramedTextActor, "$Revision$");
+vtkStandardNewMacro(VTKViewer_FramedTextActor);
+
+//==================================================================
+// function : VTKViewer_FramedTextActor
+// purpose :
+//==================================================================
+VTKViewer_FramedTextActor::VTKViewer_FramedTextActor()
+{
+ PositionCoordinate->SetCoordinateSystemToNormalizedViewport();
+
+ myTransparency=0.;
+ myBar = vtkPolyData::New();
+ myBarMapper = vtkPolyDataMapper2D::New();
+ myBarMapper->SetInput(myBar);
+ myBarActor = vtkActor2D::New();
+ myBarActor->SetMapper(myBarMapper);
+ myBarActor->GetProperty()->SetOpacity(1.-myTransparency);
+ myBarActor->GetProperty()->SetColor(.5, .5, .5);
+
+ myTextProperty = vtkTextProperty::New();
+ myTextProperty->SetFontSize(12);
+ myTextProperty->SetBold(0);
+ myTextProperty->SetItalic(0);
+ myTextProperty->SetShadow(1);
+ myTextProperty->SetFontFamilyToArial();
+
+ myTextMapper=vtkTextMapper::New();
+ myTextMapper->SetInput("");
+ myTextMapper->GetTextProperty()->ShallowCopy(myTextProperty);
+ myTextActor=vtkActor2D::New();
+ myTextActor->SetMapper(myTextMapper);
+
+ myBarActor->SetVisibility(1);
+ myTextActor->SetVisibility(1);
+ myBarActor->SetPickable(0);
+ myTextActor->SetPickable(0);
+
+ myModePosition = BelowPoint;
+ myLayoutType = Vertical;
+
+ for(int i=0; i<4; i++) {
+ myWorldPoint[i] = 0.;
+ }
+ myDistance=10.;
+
+ myTextMargin = TEXT_MARGIN;
+
+ myHorizontalOffset = 0;
+ myVerticalOffset = 0;
+
+ myMoveFrameFlag = 0;
+}
+
+//==================================================================
+// function : ~
+// purpose :
+//==================================================================
+VTKViewer_FramedTextActor::~VTKViewer_FramedTextActor()
+{
+ myTextActor->Delete();
+ myTextMapper->Delete();
+ myTextProperty->Delete();
+ myBarActor->Delete();
+ myBarMapper->Delete();
+ myBar->Delete();
+}
+
+//==================================================================
+// function : SetVisibility
+// purpose :
+//==================================================================
+void VTKViewer_FramedTextActor::SetVisibility (int theVisibility)
+{
+ myBarActor->SetVisibility(theVisibility);
+ myTextActor->SetVisibility(theVisibility);
+}
+
+//==================================================================
+// function : GetVisibility
+// purpose :
+//==================================================================
+int VTKViewer_FramedTextActor::GetVisibility()
+{
+ return myBarActor->GetVisibility();
+}
+
+//==================================================================
+// function : SetPickable
+// purpose :
+//==================================================================
+void VTKViewer_FramedTextActor::SetPickable (int thePickability)
+{
+ myBarActor->SetPickable(thePickability);
+ myTextActor->SetPickable(thePickability);
+}
+
+//==================================================================
+// function : GetPickable
+// purpose :
+//==================================================================
+int VTKViewer_FramedTextActor::GetPickable()
+{
+ return myBarActor->GetPickable();
+}
+
+//==================================================================
+// function : GetSize
+// purpose :
+//==================================================================
+void VTKViewer_FramedTextActor::GetSize(vtkRenderer* theRenderer, int theSize[2]) const
+{
+ myTextMapper->GetSize(theRenderer, theSize);
+ theSize[0] = theSize[0] + 2 * GetTextMargin() + OFFSET_SPACING;
+ theSize[1] = theSize[1] + 2 * GetTextMargin() + OFFSET_SPACING;
+}
+
+//==================================================================
+// function : SetForegroundColor
+// purpose :
+//==================================================================
+void VTKViewer_FramedTextActor::SetForegroundColor(const vtkFloatingPointType r,
+ const vtkFloatingPointType g,
+ const vtkFloatingPointType b)
+{
+ myTextProperty->SetColor(r, g, b);
+ myTextMapper->GetTextProperty()->ShallowCopy(myTextProperty);
+ Modified();
+}
+
+//==================================================================
+// function : GetForegroundColor
+// purpose :
+//==================================================================
+void VTKViewer_FramedTextActor::GetForegroundColor(vtkFloatingPointType& r,
+ vtkFloatingPointType& g,
+ vtkFloatingPointType& b)
+{
+ vtkFloatingPointType aColor[3];
+ myTextProperty->GetColor(aColor);
+ r = aColor[0];
+ g = aColor[1];
+ b = aColor[2];
+}
+
+//==================================================================
+// function : SetBackgroundColor
+// purpose :
+//==================================================================
+void VTKViewer_FramedTextActor::SetBackgroundColor(const vtkFloatingPointType r,
+ const vtkFloatingPointType g,
+ const vtkFloatingPointType b)
+{
+ myBarActor->GetProperty()->SetColor(r, g, b);
+ Modified();
+}
+
+//==================================================================
+// function : GetBackgroundColor
+// purpose :
+//==================================================================
+void VTKViewer_FramedTextActor::GetBackgroundColor(vtkFloatingPointType& r,
+ vtkFloatingPointType& g,
+ vtkFloatingPointType& b)
+{
+ vtkFloatingPointType aColor[3];
+ myBarActor->GetProperty()->GetColor(aColor);
+ r = aColor[0];
+ g = aColor[1];
+ b = aColor[2];
+}
+
+//==================================================================
+// function : SetTransparency
+// purpose :
+//==================================================================
+void VTKViewer_FramedTextActor::SetTransparency(const vtkFloatingPointType theTransparency)
+{
+ if (theTransparency>=0. && theTransparency<=1.){
+ myTransparency=theTransparency;
+ myBarActor->GetProperty()->SetOpacity(1.-myTransparency);
+ Modified();
+ }
+}
+
+//==================================================================
+// function : GetTransparency
+// purpose :
+//==================================================================
+vtkFloatingPointType VTKViewer_FramedTextActor::GetTransparency()const
+{
+ return myTransparency;
+}
+
+//==================================================================
+// function : SetTextMargin
+// purpose :
+//==================================================================
+void VTKViewer_FramedTextActor::SetTextMargin(const int theMargin)
+{
+ if( theMargin >= 0 ) {
+ myTextMargin = theMargin;
+ Modified();
+ }
+}
+
+//==================================================================
+// function : GetTextMargin
+// purpose :
+//==================================================================
+int VTKViewer_FramedTextActor::GetTextMargin() const
+{
+ return myTextMargin;
+}
+
+//==================================================================
+// function : SetOffset
+// purpose :
+//==================================================================
+void VTKViewer_FramedTextActor::SetOffset(const int theOffset[2])
+{
+ myHorizontalOffset = theOffset[0];
+ myVerticalOffset = theOffset[1];
+ Modified();
+}
+
+//==================================================================
+// function : SetText
+// purpose :
+//==================================================================
+void VTKViewer_FramedTextActor::SetText(const char* theText)
+{
+ // remove whitespaces from from the start and the end
+ // additionally, consider a case of multi-string text
+ QString aString(theText);
+
+ QStringList aTrimmedStringList;
+ QStringList aStringList = aString.split("\n");
+ QStringListIterator anIter(aStringList);
+ while(anIter.hasNext())
+ aTrimmedStringList.append(anIter.next().trimmed());
+
+ myTextMapper->SetInput(aTrimmedStringList.join("\n").toLatin1().constData());
+ Modified();
+}
+
+//==================================================================
+// function : GetText
+// purpose :
+//==================================================================
+char* VTKViewer_FramedTextActor::GetText()
+{
+ return myTextMapper->GetInput();
+}
+
+//==================================================================
+// function : SetModePosition
+// purpose :
+//==================================================================
+void VTKViewer_FramedTextActor::SetModePosition(const int theMode)
+{
+ myModePosition = theMode;
+ Modified();
+}
+
+//==================================================================
+// function : GetModePosition
+// purpose :
+//==================================================================
+int VTKViewer_FramedTextActor::GetModePosition()const
+{
+ return myModePosition;
+}
+
+//==================================================================
+// function : SetLayoutType
+// purpose :
+//==================================================================
+void VTKViewer_FramedTextActor::SetLayoutType(const int theType)
+{
+ myLayoutType = theType;
+ Modified();
+}
+
+//==================================================================
+// function : GetLayoutType
+// purpose :
+//==================================================================
+int VTKViewer_FramedTextActor::GetLayoutType() const
+{
+ return myLayoutType;
+}
+
+//==================================================================
+// function : SetWorldPoint
+// purpose :
+//==================================================================
+void VTKViewer_FramedTextActor::SetWorldPoint(const vtkFloatingPointType theWorldPoint[4])
+{
+ for(int i = 0; i<4; ++i) {
+ myWorldPoint[i] = theWorldPoint[i];
+ }
+ Modified();
+}
+
+//==================================================================
+// function : GetWorldPoint
+// purpose :
+//==================================================================
+const vtkFloatingPointType* VTKViewer_FramedTextActor::GetWorldPoint()const
+{
+ return myWorldPoint;
+}
+
+//==================================================================
+// function : SetDistance
+// purpose :
+//==================================================================
+void VTKViewer_FramedTextActor::SetDistance(const vtkFloatingPointType theDistance)
+{
+ myDistance=theDistance;
+}
+
+//==================================================================
+// function : GetDistance
+// purpose :
+//==================================================================
+vtkFloatingPointType VTKViewer_FramedTextActor::GetDistance()const
+{
+ return myDistance;
+}
+
+//==================================================================
+// function : SetMoveFrameFlag
+// purpose : If moveFrameFlag is true, then frame with text is moved
+// under world point
+//==================================================================
+void VTKViewer_FramedTextActor::SetMoveFrameFlag(const int theMoveFrameFlag)
+{
+ if(myMoveFrameFlag != theMoveFrameFlag) {
+ myMoveFrameFlag = theMoveFrameFlag;
+ Modified();
+ }
+}
+
+//==================================================================
+// function : GetDistance
+// purpose :
+//==================================================================
+int VTKViewer_FramedTextActor::GetMoveFrameFlag() const
+{
+ return myMoveFrameFlag;
+}
+
+
+//==================================================================
+// function : ReleaseGraphicsResources
+// purpose :
+//==================================================================
+void VTKViewer_FramedTextActor::ReleaseGraphicsResources(vtkWindow *win)
+{
+ myTextActor->ReleaseGraphicsResources(win);
+ myBarActor->ReleaseGraphicsResources(win);
+}
+
+//==================================================================
+// function : RenderOverlay
+// purpose :
+//==================================================================
+int VTKViewer_FramedTextActor::RenderOverlay(vtkViewport *viewport)
+{
+ int renderedSomething = 0;
+ myBarActor->RenderOverlay(viewport);
+ renderedSomething +=myTextActor->RenderOverlay(viewport);
+ return renderedSomething;
+}
+
+//==================================================================
+// function : RenderOpaqueGeometry
+// purpose :
+//==================================================================
+int
+VTKViewer_FramedTextActor
+::RenderOpaqueGeometry(vtkViewport *theViewport)
+{
+ int anIsRenderedSomething = 0;
+
+ int* aViewportSize = theViewport->GetSize();
+ int aViewPortWidth = aViewportSize[0];
+ int aViewPortHeight = aViewportSize[1];
+ if(aViewPortWidth == 1 || aViewPortHeight == 1)
+ return anIsRenderedSomething;
+
+ if(!myTextMapper->GetInput())
+ return anIsRenderedSomething;
+
+ myBar->Initialize();
+
+ int aNbPoints = 4;
+ vtkPoints *aPoints = vtkPoints::New();
+ aPoints->SetNumberOfPoints(aNbPoints);
+ myBar->SetPoints(aPoints);
+ aPoints->Delete();
+
+ vtkCellArray *aPolys = vtkCellArray::New();
+ aPolys->Allocate(aPolys->EstimateSize(1,4));
+ vtkIdType aPointsIds[4] = {0, 1, 3, 2};
+ aPolys->InsertNextCell(4,aPointsIds);
+ myBar->SetPolys(aPolys);
+ aPolys->Delete();
+
+ int aTextSize[2];
+ myTextMapper->GetSize(theViewport, aTextSize);
+ int aBarWidth = aTextSize[0];
+ int aBarHeight = aTextSize[1];
+
+ int aTextMargin = GetTextMargin();
+
+ vtkFloatingPointType xMin = 0.0;
+ vtkFloatingPointType xMax = 0.0;
+ vtkFloatingPointType yMin = -aBarHeight/2 - aTextMargin;
+ vtkFloatingPointType yMax = aBarHeight/2 + aTextMargin;
+
+ int aHorizontalOffset = GetLayoutType() == Horizontal ? myHorizontalOffset : 0;
+ int aVerticalOffset = GetLayoutType() == Vertical ? myVerticalOffset : 0;
+
+ if( myModePosition == BelowPoint )
+ {
+ theViewport->SetWorldPoint(myWorldPoint);
+ theViewport->WorldToDisplay();
+
+ vtkFloatingPointType aSelectionPoint[3];
+ theViewport->GetDisplayPoint(aSelectionPoint);
+ vtkFloatingPointType u = aSelectionPoint[0];
+ vtkFloatingPointType v = aSelectionPoint[1] - myDistance;
+ if(myMoveFrameFlag)
+ v -= aBarHeight/2.;
+ theViewport->ViewportToNormalizedViewport(u, v);
+ PositionCoordinate->SetValue(u, v);
+
+ myTextProperty->SetJustificationToCentered();
+
+ xMin = -aBarWidth/2 - aTextMargin;
+ xMax = aBarWidth/2 + aTextMargin;
+ }
+ else // except BelowPoint, only TopLeft and TopRight modes are supported at this moment
+ {
+ vtkFloatingPointType x = 0, xOffset = aHorizontalOffset + aTextMargin + OFFSET_SPACING;
+ vtkFloatingPointType y = 0, yOffset = aVerticalOffset + aTextMargin + OFFSET_SPACING;
+
+ if( myModePosition == TopLeft )
+ {
+ x = xOffset;
+ y = aViewPortHeight - yOffset - aBarHeight/2;
+ myTextProperty->SetJustificationToLeft();
+
+ xMin = - aTextMargin;
+ xMax = aBarWidth + aTextMargin;
+ }
+ else if( myModePosition == TopRight )
+ {
+ x = aViewPortWidth - xOffset;
+ y = aViewPortHeight - yOffset - aBarHeight/2;
+ myTextProperty->SetJustificationToRight();
+
+ xMin = -aBarWidth - aTextMargin;
+ xMax = aTextMargin;
+ }
+
+ PositionCoordinate->SetValue(x / (vtkFloatingPointType)aViewPortWidth,
+ y / (vtkFloatingPointType)aViewPortHeight);
+ }
+
+ aPoints->SetPoint(0, xMin, yMax, 0.0);
+ aPoints->SetPoint(1, xMin, yMin, 0.0);
+ aPoints->SetPoint(2, xMax, yMax, 0.0);
+ aPoints->SetPoint(3, xMax, yMin, 0.0);
+
+ myTextProperty->SetVerticalJustificationToCentered();
+
+ myTextMapper->GetTextProperty()->ShallowCopy(myTextProperty);
+ myBarActor ->GetPositionCoordinate()->SetReferenceCoordinate(PositionCoordinate);
+ myTextActor->GetPositionCoordinate()->SetReferenceCoordinate(PositionCoordinate);
+
+ myBuildTime.Modified();
+
+ return anIsRenderedSomething;
+}
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef VTKVIEWER_FRAMEDTEXTACTOR_H
+#define VTKVIEWER_FRAMEDTEXTACTOR_H
+
+#include "VTKViewer.h"
+
+#include <vtkActor2D.h>
+
+class vtkPolyData;
+class vtkPolyDataMapper2D;
+class vtkRenderer;
+class vtkTimeStamp;
+class vtkTextMapper;
+class vtkTextProperty;
+class vtkViewport;
+class vtkWindow;
+
+class VTKVIEWER_EXPORT VTKViewer_FramedTextActor : public vtkActor2D
+{
+public:
+ enum ModePosition { BelowPoint = 0, TopLeft, TopRight, BottomLeft, BottomRight };
+ enum LayoutType { Vertical = 0, Horizontal };
+
+public:
+ vtkTypeRevisionMacro(VTKViewer_FramedTextActor,vtkActor2D);
+ static VTKViewer_FramedTextActor *New();
+
+ virtual int RenderOpaqueGeometry(vtkViewport*);
+ virtual int RenderTranslucentGeometry(vtkViewport*) { return 0; }
+ virtual int RenderOverlay(vtkViewport*);
+ virtual void ReleaseGraphicsResources(vtkWindow*);
+
+ virtual void SetVisibility(int);
+ virtual int GetVisibility();
+ virtual void SetPickable(int);
+ virtual int GetPickable();
+
+ virtual void GetSize(vtkRenderer* theRenderer, int theSize[2]) const;
+
+ void SetText(const char* theText);
+ char* GetText();
+
+ void SetModePosition(const int theMode);
+ int GetModePosition() const;
+
+ void SetLayoutType(const int theType);
+ int GetLayoutType() const;
+
+ void SetWorldPoint(const vtkFloatingPointType theWorldPoint[4]);
+ const vtkFloatingPointType* GetWorldPoint() const;
+
+ void SetDistance(const vtkFloatingPointType theDistance);
+ vtkFloatingPointType GetDistance() const;
+
+ void SetMoveFrameFlag(const int flag);
+ int GetMoveFrameFlag() const;
+
+ void SetForegroundColor(const vtkFloatingPointType r,
+ const vtkFloatingPointType g,
+ const vtkFloatingPointType b);
+ void GetForegroundColor(vtkFloatingPointType& r,
+ vtkFloatingPointType& g,
+ vtkFloatingPointType& b);
+
+ void SetBackgroundColor(const vtkFloatingPointType r,
+ const vtkFloatingPointType g,
+ const vtkFloatingPointType b);
+ void GetBackgroundColor(vtkFloatingPointType& r,
+ vtkFloatingPointType& g,
+ vtkFloatingPointType& b);
+
+ void SetTransparency(const vtkFloatingPointType theTransparency);
+ vtkFloatingPointType GetTransparency() const;
+
+ void SetTextMargin(const int theMargin);
+ int GetTextMargin() const;
+
+ void SetOffset(const int theOffset[2]);
+
+protected:
+ VTKViewer_FramedTextActor();
+ ~VTKViewer_FramedTextActor();
+
+protected:
+ vtkPolyData* myBar;
+ vtkPolyDataMapper2D* myBarMapper;
+ vtkActor2D* myBarActor;
+
+ vtkTextProperty* myTextProperty;
+ vtkTextMapper* myTextMapper;
+ vtkActor2D* myTextActor;
+
+ vtkTimeStamp myBuildTime;
+
+ int myModePosition;
+ int myLayoutType;
+ int myMoveFrameFlag;
+
+ vtkFloatingPointType myWorldPoint[4];
+ vtkFloatingPointType myDistance;
+ vtkFloatingPointType myTransparency;
+
+ int myTextMargin;
+
+ int myHorizontalOffset;
+ int myVerticalOffset;
+
+private:
+ VTKViewer_FramedTextActor(const VTKViewer_FramedTextActor&); // Not implemented.
+ void operator=(const VTKViewer_FramedTextActor&); // Not implemented.
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef VTKVIEWER_MARKERDEF_H
+#define VTKVIEWER_MARKERDEF_H
+
+#include <list>
+#include <map>
+#include <string>
+
+namespace VTK
+{
+ //! Type of standard marker for advanced rendering of vtk points
+ typedef int MarkerType;
+ const MarkerType MT_NONE = 0;
+ const MarkerType MT_POINT = 1;
+ const MarkerType MT_PLUS = 2;
+ const MarkerType MT_STAR = 3;
+ const MarkerType MT_O = 4;
+ const MarkerType MT_X = 5;
+ const MarkerType MT_O_POINT = 6;
+ const MarkerType MT_O_PLUS = 7;
+ const MarkerType MT_O_STAR = 8;
+ const MarkerType MT_O_X = 9;
+ const MarkerType MT_USER = 10;
+
+ //! Scale of standard marker for advanced rendering of vtk points
+ typedef int MarkerScale;
+ const MarkerScale MS_NONE = 0;
+ const MarkerScale MS_10 = 1;
+ const MarkerScale MS_15 = 2;
+ const MarkerScale MS_20 = 3;
+ const MarkerScale MS_25 = 4;
+ const MarkerScale MS_30 = 5;
+ const MarkerScale MS_35 = 6;
+ const MarkerScale MS_40 = 7;
+ const MarkerScale MS_45 = 8;
+ const MarkerScale MS_50 = 9;
+ const MarkerScale MS_55 = 10;
+ const MarkerScale MS_60 = 11;
+ const MarkerScale MS_65 = 12;
+ const MarkerScale MS_70 = 13;
+
+ typedef std::list<unsigned short> MarkerTexture;
+ typedef std::pair<std::string, MarkerTexture> MarkerData;
+ typedef std::map<int, MarkerData> MarkerMap;
+}
+
+#endif
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "VTKViewer_MarkerDlg.h"
+#include "VTKViewer_MarkerWidget.h"
+
+#include <SUIT_Application.h>
+#include <SUIT_MessageBox.h>
+#include <SUIT_ResourceMgr.h>
+#include <SUIT_Session.h>
+
+#include <QFrame>
+#include <QHBoxLayout>
+#include <QKeyEvent>
+
+/*!
+ * Class : VTKViewer_MarkerDlg
+ * Description : Dialog for specifying point marker parameters
+ */
+
+/*!
+ Constructor
+*/
+VTKViewer_MarkerDlg::VTKViewer_MarkerDlg( QWidget* theParent )
+: QtxDialog( theParent, true, true )
+{
+ setWindowTitle( tr( "SET_MARKER_TLT" ) );
+
+ myMarkerWidget = new VTKViewer_MarkerWidget( mainFrame() );
+
+ QBoxLayout* aTopLayout = new QHBoxLayout( mainFrame() );
+ aTopLayout->setSpacing( 0 );
+ aTopLayout->setMargin( 0 );
+ aTopLayout->addWidget( myMarkerWidget );
+
+ connect( this, SIGNAL( dlgHelp() ), this, SLOT( onHelp() ) );
+}
+
+/*!
+ Destructor
+*/
+VTKViewer_MarkerDlg::~VTKViewer_MarkerDlg()
+{
+}
+
+void VTKViewer_MarkerDlg::setHelpData( const QString& theModuleName,
+ const QString& theHelpFileName )
+{
+ myModuleName = theModuleName;
+ myHelpFileName = theHelpFileName;
+}
+
+void VTKViewer_MarkerDlg::keyPressEvent( QKeyEvent* e )
+{
+ QtxDialog::keyPressEvent( e );
+ if ( e->isAccepted() )
+ return;
+
+ if ( e->key() == Qt::Key_F1 ) {
+ e->accept();
+ onHelp();
+ }
+}
+
+void VTKViewer_MarkerDlg::onHelp()
+{
+ if( myModuleName.isNull() || myHelpFileName.isNull() )
+ return;
+
+ SUIT_Application* app = SUIT_Session::session()->activeApplication();
+ if (app)
+ app->onHelpContextModule(myModuleName, myHelpFileName);
+ else {
+ QString platform;
+#ifdef WIN32
+ platform = "winapplication";
+#else
+ platform = "application";
+#endif
+ SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
+ tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+ arg(app->resourceMgr()->stringValue("ExternalBrowser",
+ platform)).
+ arg(myHelpFileName));
+ }
+}
+
+void VTKViewer_MarkerDlg::setCustomMarkerMap( VTK::MarkerMap theMarkerMap )
+{
+ myMarkerWidget->setCustomMarkerMap( theMarkerMap );
+}
+
+VTK::MarkerMap VTKViewer_MarkerDlg::getCustomMarkerMap()
+{
+ return myMarkerWidget->getCustomMarkerMap();
+}
+
+void VTKViewer_MarkerDlg::setStandardMarker( VTK::MarkerType theMarkerType, VTK::MarkerScale theMarkerScale )
+{
+ myMarkerWidget->setStandardMarker( theMarkerType, theMarkerScale );
+}
+
+void VTKViewer_MarkerDlg::setCustomMarker( int theId )
+{
+ myMarkerWidget->setCustomMarker( theId );
+}
+
+VTK::MarkerType VTKViewer_MarkerDlg::getMarkerType() const
+{
+ return myMarkerWidget->getMarkerType();
+}
+
+VTK::MarkerScale VTKViewer_MarkerDlg::getStandardMarkerScale() const
+{
+ return myMarkerWidget->getStandardMarkerScale();
+}
+
+int VTKViewer_MarkerDlg::getCustomMarkerID() const
+{
+ return myMarkerWidget->getCustomMarkerID();
+}
+
+void VTKViewer_MarkerDlg::addExtraStdMarker( VTK::MarkerType theMarkerType, const QPixmap& thePixmap )
+{
+ myMarkerWidget->addExtraStdMarker( theMarkerType, thePixmap );
+}
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef VTKVIEWER_MARKERDLG_H
+#define VTKVIEWER_MARKERDLG_H
+
+#include "VTKViewer.h"
+#include "VTKViewer_MarkerDef.h"
+
+#include <QtxDialog.h>
+
+class VTKViewer_MarkerWidget;
+
+/*!
+ * Class : VTKViewer_MarkerDlg
+ * Description : Dialog for specifying point marker parameters
+ */
+class VTKVIEWER_EXPORT VTKViewer_MarkerDlg : public QtxDialog
+{
+ Q_OBJECT
+
+public:
+ VTKViewer_MarkerDlg( QWidget* = 0 );
+ virtual ~VTKViewer_MarkerDlg();
+
+ void setHelpData( const QString& theModuleName,
+ const QString& theHelpFileName );
+
+ void setCustomMarkerMap( VTK::MarkerMap );
+ VTK::MarkerMap getCustomMarkerMap();
+
+ void setStandardMarker( VTK::MarkerType, VTK::MarkerScale );
+ void setCustomMarker( int );
+ VTK::MarkerType getMarkerType() const;
+ VTK::MarkerScale getStandardMarkerScale() const;
+ int getCustomMarkerID() const;
+
+ void addExtraStdMarker( VTK::MarkerType, const QPixmap& );
+
+protected:
+ void keyPressEvent( QKeyEvent* );
+
+private slots:
+ void onHelp();
+
+private:
+ VTKViewer_MarkerWidget* myMarkerWidget;
+
+ QString myModuleName;
+ QString myHelpFileName;
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "VTKViewer_MarkerUtils.h"
+
+// VTK Includes
+#include <vtkImageData.h>
+
+// QT Includes
+#include <QFile>
+#include <QImage>
+#include <QString>
+#include <QTextStream>
+
+namespace VTK
+{
+ bool LoadTextureData( const QString& theFileName,
+ VTK::MarkerScale theMarkerScale,
+ VTK::MarkerTexture& theMarkerTexture )
+ {
+ theMarkerTexture.clear();
+
+ QFile aFile( theFileName );
+ if( !aFile.open( QIODevice::ReadOnly | QIODevice::Text ) )
+ return false;
+
+ bool ok;
+ int aWidth = 0, aHeight = 0;
+
+ int aTextureIndex = theMarkerScale == VTK::MS_NONE ? 0 : (int)theMarkerScale-1;
+ int aCurrentTexture = 0;
+
+ QTextStream aTextStream( &aFile );
+ while( !aTextStream.atEnd() )
+ {
+ QString aLine = aTextStream.readLine();
+ if( aLine.isEmpty() )
+ {
+ aCurrentTexture++;
+ continue;
+ }
+
+ if( aCurrentTexture != aTextureIndex )
+ continue;
+
+ int aLineSize = aLine.size();
+ for( int i = 0; i < aLineSize; i++ )
+ {
+ ok = false;
+ unsigned int aPixel = QString( aLine.at( i ) ).toUInt( &ok );
+ if( ok )
+ theMarkerTexture.push_back( aPixel );
+ }
+ if( aWidth == 0 )
+ aWidth = aLineSize;
+ aHeight++;
+ }
+
+ if( theMarkerTexture.size() != aWidth * aHeight )
+ return false;
+
+ theMarkerTexture.push_front( aWidth );
+ theMarkerTexture.push_front( aHeight );
+ return true;
+ }
+
+ vtkSmartPointer<vtkImageData> MakeVTKImage( const VTK::MarkerTexture& theMarkerTexture,
+ bool theWhiteForeground )
+ {
+ VTK::MarkerTexture::const_iterator anIter = theMarkerTexture.begin();
+
+ int aWidth = *anIter++;
+ int aHeight = *anIter++;
+
+ vtkSmartPointer<vtkImageData> anImageData = vtkImageData::New();
+ anImageData->Delete();
+
+ anImageData->SetExtent( 0, aWidth-1, 0, aHeight-1, 0, 0 );
+ anImageData->SetScalarTypeToUnsignedChar();
+ anImageData->SetNumberOfScalarComponents( 4 );
+ anImageData->AllocateScalars();
+
+ unsigned char* aDataPtr = (unsigned char*)anImageData->GetScalarPointer();
+
+ int anId = 0;
+ int aSize = aWidth * aHeight * 4;
+ int aCoef = theWhiteForeground ? 1 : 0;
+ while( anId < aSize )
+ {
+ int aValue = (*anIter++) * 255;
+ aDataPtr[ anId++ ] = aValue * aCoef;
+ aDataPtr[ anId++ ] = aValue * aCoef;
+ aDataPtr[ anId++ ] = aValue * aCoef;
+ aDataPtr[ anId++ ] = aValue;
+ }
+ anImageData->Update();
+
+ return anImageData;
+ }
+
+ QImage ConvertToQImage( vtkImageData* theImageData )
+ {
+ if( theImageData->GetScalarType() != VTK_UNSIGNED_CHAR )
+ return QImage();
+
+ int extent[6];
+ theImageData->GetExtent( extent );
+ int width = extent[1] - extent[0] + 1;
+ int height = extent[3] - extent[2] + 1;
+
+ QImage anImage(width, height, QImage::Format_ARGB32);
+ for( int i = 0; i < height; i++ )
+ {
+ QRgb* bits = reinterpret_cast<QRgb*>( anImage.scanLine(i) );
+ unsigned char* row = static_cast<unsigned char*>(
+ theImageData->GetScalarPointer( extent[0], extent[2] + height - i - 1, extent[4] ) );
+ for( int j = 0; j < width; j++ )
+ {
+ unsigned char* data = &row[ j*4 ];
+ bits[j] = qRgba( data[0], data[1], data[2], data[3] );
+ }
+ }
+ return anImage;
+ }
+
+ int GetUniqueId( const VTK::MarkerMap& theMarkerMap )
+ {
+ int anId = 0;
+ while( anId++ < 100 ) {
+ bool anOk = true;
+ VTK::MarkerMap::const_iterator anIter = theMarkerMap.begin();
+ for( ; anIter != theMarkerMap.end(); anIter++ ) {
+ if( anId == anIter->first ) {
+ anOk = false;
+ continue;
+ }
+ }
+ if( anOk )
+ return anId;
+ }
+ return theMarkerMap.size() + 1;
+ }
+}
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef VTKVIEWER_MARKERUTILS_H
+#define VTKVIEWER_MARKERUTILS_H
+
+#include "VTKViewer.h"
+#include "VTKViewer_MarkerDef.h"
+
+// VTK Includes
+#include <vtkSmartPointer.h>
+
+class vtkImageData;
+
+class QImage;
+class QString;
+
+namespace VTK
+{
+ VTKVIEWER_EXPORT bool LoadTextureData( const QString& theFileName,
+ VTK::MarkerScale theMarkerScale,
+ VTK::MarkerTexture& theTextureData );
+
+ VTKVIEWER_EXPORT vtkSmartPointer<vtkImageData> MakeVTKImage( const VTK::MarkerTexture& theTextureData,
+ bool theWhiteForeground = true );
+
+ VTKVIEWER_EXPORT QImage ConvertToQImage( vtkImageData* theImageData );
+
+ VTKVIEWER_EXPORT int GetUniqueId( const VTK::MarkerMap& theMarkerMap );
+}
+
+#endif
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "VTKViewer_MarkerWidget.h"
+#include "VTKViewer_MarkerUtils.h"
+
+#include <QtxComboBox.h>
+
+#include <SUIT_ResourceMgr.h>
+#include <SUIT_Session.h>
+
+#include <vtkImageData.h>
+
+#include <QButtonGroup>
+#include <QGridLayout>
+#include <QHBoxLayout>
+#include <QLabel>
+#include <QPushButton>
+#include <QRadioButton>
+#include <QStackedWidget>
+
+#define MARGIN 9
+#define SPACING 6
+
+/*!
+ * Class : VTKViewer_MarkerWidget
+ * Description : Widget for specifying point marker parameters
+ */
+
+/*!
+ Constructor
+*/
+VTKViewer_MarkerWidget::VTKViewer_MarkerWidget( QWidget* theParent )
+: QWidget( theParent )
+{
+ QRadioButton* aStandardTypeRB = new QRadioButton( tr( "STANDARD_MARKER" ), this );
+ QRadioButton* aCustomTypeRB = new QRadioButton( tr( "CUSTOM_MARKER" ), this );
+ myTypeGroup = new QButtonGroup( this );
+ myTypeGroup->addButton( aStandardTypeRB, 0 );
+ myTypeGroup->addButton( aCustomTypeRB, 1 );
+
+ QHBoxLayout* aRadioLayout = new QHBoxLayout;
+ aRadioLayout->setMargin( 0 );
+ aRadioLayout->setSpacing( SPACING );
+ aRadioLayout->addWidget( aStandardTypeRB );
+ aRadioLayout->addWidget( aCustomTypeRB );
+
+ // ---
+
+ myWGStack = new QStackedWidget( this );
+ myWGStack->setFrameStyle( QFrame::Box | QFrame::Sunken );
+
+ // ---
+
+ QWidget* aStdWidget = new QWidget( myWGStack );
+
+ QLabel* aTypeLab = new QLabel( tr( "TYPE" ), aStdWidget );
+ QLabel* aScaleLab = new QLabel( tr( "SCALE" ), aStdWidget );
+
+ myStdTypeCombo = new QtxComboBox( aStdWidget );
+ myStdScaleCombo = new QtxComboBox( aStdWidget );
+
+ QGridLayout* aStdLayout = new QGridLayout;
+ aStdLayout->setMargin( MARGIN );
+ aStdLayout->setSpacing( SPACING );
+ aStdLayout->addWidget( aTypeLab, 0, 0 );
+ aStdLayout->addWidget( myStdTypeCombo, 0, 1 );
+ aStdLayout->addWidget( aScaleLab, 1, 0 );
+ aStdLayout->addWidget( myStdScaleCombo, 1, 1 );
+ aStdWidget->setLayout( aStdLayout );
+
+ // ---
+
+ QWidget* aCustomWidget = new QWidget( myWGStack );
+
+ QLabel* aCustomLab = new QLabel( tr( "CUSTOM" ), aCustomWidget );
+ myCustomTypeCombo = new QtxComboBox( aCustomWidget );
+ QPushButton* aBrowseBtn = new QPushButton( tr( "BROWSE" ), aCustomWidget );
+
+ QGridLayout* aCustomLayout = new QGridLayout;
+ aCustomLayout->setMargin( MARGIN );
+ aCustomLayout->setSpacing( SPACING );
+ aCustomLayout->addWidget( aCustomLab, 0, 0 );
+ aCustomLayout->addWidget( myCustomTypeCombo, 0, 1 );
+ aCustomLayout->addWidget( aBrowseBtn, 0, 2 );
+ aCustomLayout->setRowStretch( 1, 5 );
+ aCustomWidget->setLayout( aCustomLayout );
+
+ // ---
+
+ myWGStack->insertWidget( 0, aStdWidget );
+ myWGStack->insertWidget( 1, aCustomWidget );
+
+ // ---
+
+ QVBoxLayout* aTopLayout = new QVBoxLayout;
+ aTopLayout->setMargin( MARGIN );
+ aTopLayout->setSpacing( SPACING );
+ aTopLayout->addLayout( aRadioLayout );
+ aTopLayout->addWidget( myWGStack );
+ setLayout( aTopLayout );
+
+ // ---
+
+ connect( myTypeGroup, SIGNAL( buttonClicked( int ) ), myWGStack, SLOT( setCurrentIndex( int ) ) );
+ connect( myStdTypeCombo, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onStdMarkerChanged( int ) ) );
+ connect( aBrowseBtn, SIGNAL( clicked() ), this, SLOT( onBrowse() ) );
+
+ // ---
+
+ aStandardTypeRB->setChecked( true );
+ init();
+}
+
+/*!
+ Destructor
+*/
+VTKViewer_MarkerWidget::~VTKViewer_MarkerWidget()
+{
+}
+
+void VTKViewer_MarkerWidget::setCustomMarkerMap( VTK::MarkerMap theMarkerMap )
+{
+ myCustomMarkerMap = theMarkerMap;
+
+ VTK::MarkerMap::const_iterator it = theMarkerMap.begin(), itEnd = theMarkerMap.end();
+ for( ; it != itEnd; it++ )
+ {
+ int anId = it->first;
+ VTK::MarkerData aMarkerData = it->second;
+ QPixmap aPixmap = markerFromData( aMarkerData );
+ if( !aPixmap.isNull() )
+ {
+ myCustomTypeCombo->addItem( aPixmap, QString::number( anId ) );
+ myCustomTypeCombo->setId( myCustomTypeCombo->count()-1, anId );
+ }
+ }
+}
+
+VTK::MarkerMap VTKViewer_MarkerWidget::getCustomMarkerMap()
+{
+ return myCustomMarkerMap;
+}
+
+void VTKViewer_MarkerWidget::setStandardMarker( VTK::MarkerType theMarkerType, VTK::MarkerScale theMarkerScale )
+{
+ if ( ( theMarkerType > VTK::MT_NONE && theMarkerType < VTK::MT_USER ) ||
+ myExtraMarkerList.contains( theMarkerType ) ) {
+ myTypeGroup->button( 0 )->setChecked( true );
+ myWGStack->setCurrentIndex( 0 );
+ myStdTypeCombo->setCurrentId( theMarkerType );
+ int aMarkerScale = std::max( (int)VTK::MS_10, std::min( (int)VTK::MS_70, (int)theMarkerScale ) );
+ myStdScaleCombo->setCurrentId( aMarkerScale );
+ }
+}
+
+void VTKViewer_MarkerWidget::setCustomMarker( int theId )
+{
+ if ( theId > 0 ) {
+ myTypeGroup->button( 1 )->setChecked( true );
+ myWGStack->setCurrentIndex( 1 );
+ addTexture( theId );
+ myCustomTypeCombo->setCurrentId( theId );
+ }
+}
+
+VTK::MarkerType VTKViewer_MarkerWidget::getMarkerType() const
+{
+ return myWGStack->currentIndex() == 0 ? (VTK::MarkerType)myStdTypeCombo->currentId() : VTK::MT_USER;
+}
+
+VTK::MarkerScale VTKViewer_MarkerWidget::getStandardMarkerScale() const
+{
+ return myWGStack->currentIndex() == 0 ? (VTK::MarkerScale)myStdScaleCombo->currentId() : VTK::MS_NONE;
+}
+
+int VTKViewer_MarkerWidget::getCustomMarkerID() const
+{
+ return myWGStack->currentIndex() == 1 ? myCustomTypeCombo->currentId() : 0;
+}
+
+void VTKViewer_MarkerWidget::addExtraStdMarker( VTK::MarkerType theMarkerType, const QPixmap& thePixmap )
+{
+ if( myExtraMarkerList.isEmpty() )
+ myStdTypeCombo->insertSeparator( myStdTypeCombo->count() );
+ myStdTypeCombo->addItem( thePixmap, QString() );
+ myStdTypeCombo->setId( myStdTypeCombo->count()-1, theMarkerType );
+
+ myExtraMarkerList.append( theMarkerType );
+}
+
+void VTKViewer_MarkerWidget::init()
+{
+ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+
+ for ( int i = VTK::MT_POINT; i < VTK::MT_USER; i++ ) {
+ QString icoFile = QString( "ICON_VERTEX_MARKER_%1" ).arg( i );
+ QPixmap pixmap = resMgr->loadPixmap( "VTKViewer", tr( qPrintable( icoFile ) ) );
+ myStdTypeCombo->addItem( pixmap, QString() );
+ myStdTypeCombo->setId( myStdTypeCombo->count()-1, i );
+ }
+
+ for ( int i = VTK::MS_10; i <= VTK::MS_70; i++ ) {
+ myStdScaleCombo->addItem( QString::number( (i-1)*0.5 + 1.0 ) );
+ myStdScaleCombo->setId( myStdScaleCombo->count()-1, i );
+ }
+}
+
+void VTKViewer_MarkerWidget::addTexture( int id, bool select )
+{
+ if ( id > 0 && myCustomTypeCombo->index( id ) == -1 &&
+ myCustomMarkerMap.find( id ) != myCustomMarkerMap.end() ) {
+ VTK::MarkerData aMarkerData = myCustomMarkerMap[ id ];
+ QPixmap pixmap = markerFromData( aMarkerData );
+ if( !pixmap.isNull() ) {
+ myCustomTypeCombo->addItem( pixmap, QString::number( id ) );
+ myCustomTypeCombo->setId( myCustomTypeCombo->count()-1, id );
+ if ( select ) myCustomTypeCombo->setCurrentId( id );
+ }
+ }
+}
+
+QPixmap VTKViewer_MarkerWidget::markerFromData( const VTK::MarkerData& theMarkerData )
+{
+ const VTK::MarkerTexture& aMarkerTexture = theMarkerData.second;
+ vtkSmartPointer<vtkImageData> anImageData = VTK::MakeVTKImage( aMarkerTexture, false );
+
+ QImage anImage = VTK::ConvertToQImage( anImageData.GetPointer() );
+ if( anImage.isNull() )
+ return QPixmap();
+
+ return QPixmap::fromImage( anImage );
+}
+
+void VTKViewer_MarkerWidget::onStdMarkerChanged( int index )
+{
+ VTK::MarkerType aMarkerType = (VTK::MarkerType)myStdTypeCombo->id( index );
+ bool anIsExtraMarker = myExtraMarkerList.contains( aMarkerType );
+ myStdScaleCombo->setEnabled( !anIsExtraMarker );
+}
+
+void VTKViewer_MarkerWidget::onBrowse()
+{
+ QStringList filters;
+ filters << tr( "Texture files (*.dat)" ) << tr( "All files (*)" );
+ QString aFileName = SUIT_Session::session()->activeApplication()->getFileName( true, QString(), filters.join( ";;" ), tr( "LOAD_TEXTURE_TLT" ), this );
+ if ( !aFileName.isEmpty() ) {
+ VTK::MarkerTexture aMarkerTexture;
+ if ( VTK::LoadTextureData( aFileName, VTK::MS_NONE, aMarkerTexture ) ) {
+ int anId = VTK::GetUniqueId( myCustomMarkerMap );
+ VTK::MarkerData& aMarkerData = myCustomMarkerMap[ anId ];
+ aMarkerData.first = aFileName.toStdString();
+ aMarkerData.second = aMarkerTexture;
+ addTexture( anId, true );
+ }
+ }
+}
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef VTKVIEWER_MARKERWIDGET_H
+#define VTKVIEWER_MARKERWIDGET_H
+
+#include "VTKViewer.h"
+#include "VTKViewer_MarkerDef.h"
+
+#include <QWidget>
+
+class QButtonGroup;
+class QStackedWidget;
+
+class QtxComboBox;
+
+/*!
+ * Class : VTKViewer_MarkerWidget
+ * Description : Widget for specifying point marker parameters
+ */
+class VTKVIEWER_EXPORT VTKViewer_MarkerWidget : public QWidget
+{
+ Q_OBJECT
+
+public:
+ VTKViewer_MarkerWidget( QWidget* );
+ virtual ~VTKViewer_MarkerWidget();
+
+ void setCustomMarkerMap( VTK::MarkerMap );
+ VTK::MarkerMap getCustomMarkerMap();
+
+ void setStandardMarker( VTK::MarkerType, VTK::MarkerScale );
+ void setCustomMarker( int );
+ VTK::MarkerType getMarkerType() const;
+ VTK::MarkerScale getStandardMarkerScale() const;
+ int getCustomMarkerID() const;
+
+ void addExtraStdMarker( VTK::MarkerType, const QPixmap& );
+
+private:
+ void init();
+ void addTexture( int, bool = false );
+ QPixmap markerFromData( const VTK::MarkerData& );
+
+private slots:
+ void onStdMarkerChanged( int );
+ void onBrowse();
+
+private:
+ QButtonGroup* myTypeGroup;
+ QStackedWidget* myWGStack;
+ QtxComboBox* myStdTypeCombo;
+ QtxComboBox* myStdScaleCombo;
+ QtxComboBox* myCustomTypeCombo;
+
+ VTK::MarkerMap myCustomMarkerMap;
+
+ QList<VTK::MarkerType> myExtraMarkerList;
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "VTKViewer_OpenGLRenderer.h"
+#include "VTKViewer_Texture.h"
+
+#include <vtkCuller.h>
+#include <vtkLightCollection.h>
+#include <vtkObjectFactory.h>
+#include <vtkOpenGLCamera.h>
+#include <vtkOpenGLLight.h>
+#include <vtkOpenGLProperty.h>
+#include <vtkRenderWindow.h>
+#include <vtkOpenGLExtensionManager.h>
+#include <vtkgl.h> // vtkgl namespace
+#include <vtkImageImport.h>
+#include <vtkPNGWriter.h>
+#include <vtkOpenGLTexture.h>
+#include <vtkTimerLog.h>
+#include <vtkOpenGL.h>
+#include <vtkObjectFactory.h>
+
+vtkStandardNewMacro(VTKViewer_OpenGLRenderer);
+
+VTKViewer_OpenGLRenderer::VTKViewer_OpenGLRenderer()
+{
+ this->GradientType = HorizontalGradient;
+}
+
+VTKViewer_OpenGLRenderer::~VTKViewer_OpenGLRenderer()
+{
+}
+
+void VTKViewer_OpenGLRenderer::SetGradientType( const int theGradientType )
+{
+ this->GradientType = theGradientType;
+}
+
+void VTKViewer_OpenGLRenderer::Clear(void)
+{
+ GLbitfield clear_mask = 0;
+
+ if( !this->Transparent() )
+ {
+ glClearColor( static_cast<GLclampf>(this->Background[0]),
+ static_cast<GLclampf>(this->Background[1]),
+ static_cast<GLclampf>(this->Background[2]),
+ static_cast<GLclampf>(0.0));
+ clear_mask |= GL_COLOR_BUFFER_BIT;
+ }
+
+ if( !this->GetPreserveDepthBuffer() )
+ {
+ glClearDepth(static_cast<GLclampf>(1.0));
+ clear_mask |= GL_DEPTH_BUFFER_BIT;
+ }
+
+ vtkDebugMacro(<< "glClear\n");
+ glClear(clear_mask);
+
+ // If gradient background is turned on, draw it now.
+ if( !this->Transparent() &&
+ ( this->GradientBackground || this->TexturedBackground ) )
+ {
+ double aTileViewport[4];
+ this->GetRenderWindow()->GetTileViewport( aTileViewport );
+ glPushAttrib( GL_ENABLE_BIT | GL_TRANSFORM_BIT | GL_TEXTURE_BIT );
+ glDisable( GL_ALPHA_TEST );
+ glDisable( GL_DEPTH_TEST );
+ glDisable( GL_LIGHTING );
+ glDisable( GL_TEXTURE_1D );
+ glDisable( GL_TEXTURE_2D );
+ glDisable( GL_BLEND );
+ glShadeModel( GL_SMOOTH ); // color interpolation
+
+ glMatrixMode( GL_PROJECTION );
+ glPushMatrix();
+ glLoadIdentity();
+ glMatrixMode( GL_MODELVIEW );
+ glPushMatrix();
+ glLoadIdentity();
+
+ glOrtho( aTileViewport[0], aTileViewport[2], aTileViewport[1], aTileViewport[3], -1.0, 1.0 );
+
+ if( this->GradientBackground )
+ {
+ double* corner1 = 0;
+ double* corner2 = 0;
+ double* corner3 = 0;
+ double* corner4 = 0;
+ double dcorner1[3];
+ double dcorner2[3];
+
+ switch( this->GradientType )
+ {
+ case HorizontalGradient:
+ corner1 = this->Background;
+ corner2 = this->Background2;
+ corner3 = this->Background2;
+ corner4 = this->Background;
+ break;
+ case VerticalGradient:
+ corner1 = this->Background2;
+ corner2 = this->Background2;
+ corner3 = this->Background;
+ corner4 = this->Background;
+ break;
+ case FirstDiagonalGradient:
+ corner2 = this->Background2;
+ corner4 = this->Background;
+ dcorner1[0] = dcorner2[0] = 0.5F * ( corner2[0] + corner4[0] );
+ dcorner1[1] = dcorner2[1] = 0.5F * ( corner2[1] + corner4[1] );
+ dcorner1[2] = dcorner2[2] = 0.5F * ( corner2[2] + corner4[2] );
+ corner1 = dcorner1;
+ corner3 = dcorner2;
+ break;
+ case SecondDiagonalGradient:
+ corner1 = this->Background2;
+ corner3 = this->Background;
+ dcorner1[0] = dcorner2[0] = 0.5F * ( corner1[0] + corner3[0] );
+ dcorner1[1] = dcorner2[1] = 0.5F * ( corner1[1] + corner3[1] );
+ dcorner1[2] = dcorner2[2] = 0.5F * ( corner1[2] + corner3[2] );
+ corner2 = dcorner1;
+ corner4 = dcorner2;
+ break;
+ case FirstCornerGradient:
+ corner1 = this->Background2;
+ corner2 = this->Background2;
+ corner3 = this->Background2;
+ corner4 = this->Background;
+ break;
+ case SecondCornerGradient:
+ corner1 = this->Background2;
+ corner2 = this->Background2;
+ corner3 = this->Background;
+ corner4 = this->Background2;
+ break;
+ case ThirdCornerGradient:
+ corner1 = this->Background2;
+ corner2 = this->Background;
+ corner3 = this->Background2;
+ corner4 = this->Background2;
+ break;
+ case FourthCornerGradient:
+ corner1 = this->Background;
+ corner2 = this->Background2;
+ corner3 = this->Background2;
+ corner4 = this->Background2;
+ break;
+ default: // just in case
+ corner1 = this->Background;
+ corner2 = this->Background;
+ corner3 = this->Background;
+ corner4 = this->Background;
+ break;
+ }
+
+ glBegin( GL_TRIANGLE_FAN );
+ if( this->GradientType != FirstCornerGradient && this->GradientType != ThirdCornerGradient )
+ {
+ glColor3f( corner1[0], corner1[1], corner1[2] ); glVertex2f( 0.F, 0.F );
+ glColor3f( corner2[0], corner2[1], corner2[2] ); glVertex2f( 1.F, 0.F );
+ glColor3f( corner3[0], corner3[1], corner3[2] ); glVertex2f( 1.F, 1.F );
+ glColor3f( corner4[0], corner4[1], corner4[2] ); glVertex2f( 0.F, 1.F );
+ }
+ else //if( this->GradientType == FirstCornerGradient || this->GradientType == ThirdCornerGradient )
+ {
+ glColor3f( corner2[0], corner2[1], corner2[2] ); glVertex2f( 1.F, 0.F );
+ glColor3f( corner3[0], corner3[1], corner3[2] ); glVertex2f( 1.F, 1.F );
+ glColor3f( corner4[0], corner4[1], corner4[2] ); glVertex2f( 0.F, 1.F );
+ glColor3f( corner1[0], corner1[1], corner1[2] ); glVertex2f( 0.F, 0.F );
+ }
+ glEnd();
+ }
+
+ if( this->TexturedBackground && this->BackgroundTexture )
+ {
+ if( VTKViewer_Texture* aTexture = VTKViewer_Texture::SafeDownCast( this->BackgroundTexture ) )
+ {
+ glEnable( GL_TEXTURE_2D );
+
+ aTexture->Render( this );
+
+ // NOTE: By default the mode is GL_MODULATE. Since the user
+ // cannot set the mode, the default is set to replace.
+ glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE );
+ glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
+ glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
+
+ // NOTE: vtkTexture Render enables the alpha test
+ // so that no buffer is affected if alpha of incoming fragment is
+ // below the threshold. Here we have to enable it so that it won't
+ // rejects the fragments of the quad as the alpha is set to 0 on it.
+ glDisable( GL_ALPHA_TEST );
+
+ GLfloat texX = 1.F; // texture <s> coordinate
+ GLfloat texY = 1.F; // texture <t> coordinate
+ GLfloat x_offset = 0.5, y_offset = 0.5;
+ GLfloat coeff = 0.5;
+
+ // OCCT issue 0023102: Change the algorithm of rendering the
+ // 3d viewer background using tiled texture
+ // Setting this coefficient to -1.F allows to tile textures relatively
+ // to the top-left corner of the view (value 1.F corresponds to the
+ // initial behaviour - tiling from the bottom-left corner)
+ GLfloat aCoef = -1.F;
+
+ int aPosition = aTexture->GetPosition();
+ int aWidth = aTexture->GetWidth();
+ int aHeight = aTexture->GetHeight();
+ int aViewWidth = this->RenderWindow->GetSize()[0];
+ int aViewHeight = this->RenderWindow->GetSize()[1];
+ if( aPosition == VTKViewer_Texture::Centered )
+ {
+ x_offset = ( (GLfloat)aWidth / (GLfloat)aViewWidth ) / 2.;
+ y_offset = ( (GLfloat)aHeight / (GLfloat)aViewHeight ) / 2.;
+ }
+ else if( aPosition == VTKViewer_Texture::Tiled )
+ {
+ texX = (GLfloat)aViewWidth / (GLfloat)aWidth;
+ texY = (GLfloat)aViewHeight / (GLfloat)aHeight;
+ }
+
+ // Note that texture is mapped using GL_REPEAT wrapping mode so integer part
+ // is simply ignored, and negative multiplier is here for convenience only
+ // and does not result e.g. in texture mirroring
+ glBegin( GL_QUADS );
+ glTexCoord2f( 0.F, 0.F ); glVertex2f( -x_offset + coeff, -aCoef * y_offset + coeff );
+ glTexCoord2f( texX, 0.F ); glVertex2f( x_offset + coeff, -aCoef * y_offset + coeff );
+ glTexCoord2f( texX, aCoef * texY ); glVertex2f( x_offset + coeff, aCoef * y_offset + coeff );
+ glTexCoord2f( 0.F, aCoef * texY ); glVertex2f( -x_offset + coeff, aCoef * y_offset + coeff );
+ glEnd();
+ }
+ }
+
+ glPopMatrix();
+ glMatrixMode( GL_PROJECTION );
+ glPopMatrix();
+ glMatrixMode( GL_MODELVIEW );
+
+ glPopAttrib();
+ }
+}
--- /dev/null
+// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// SALOME VTKViewer : build VTK viewer into Salome desktop
+// File :
+// Author :
+// Module :
+// $Header$
+//
+
+#ifndef VTKVIEWER_OPENGLRENDERER_H
+#define VTKVIEWER_OPENGLRENDERER_H
+
+#include "VTKViewer.h"
+#include "vtkOpenGLRenderer.h"
+
+class VTKVIEWER_EXPORT VTKViewer_OpenGLRenderer : public vtkOpenGLRenderer
+{
+public:
+ enum {
+ HorizontalGradient,
+ VerticalGradient,
+ FirstDiagonalGradient,
+ SecondDiagonalGradient,
+ FirstCornerGradient,
+ SecondCornerGradient,
+ ThirdCornerGradient,
+ FourthCornerGradient
+ };
+
+public:
+ static VTKViewer_OpenGLRenderer *New();
+ vtkTypeMacro(VTKViewer_OpenGLRenderer,vtkOpenGLRenderer);
+
+ virtual void SetGradientType( const int );
+
+ virtual void Clear(void);
+
+protected:
+ VTKViewer_OpenGLRenderer();
+ ~VTKViewer_OpenGLRenderer();
+
+private:
+ int GradientType;
+
+private:
+ VTKViewer_OpenGLRenderer(const VTKViewer_OpenGLRenderer&); // Not implemented.
+ void operator=(const VTKViewer_OpenGLRenderer&); // Not implemented.
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "VTKViewer_PolyDataMapper.h"
+#include "VTKViewer_MarkerUtils.h"
+
+#include <utilities.h>
+
+#include <QString>
+
+#include <vtkCellArray.h>
+#include <vtkImageData.h>
+#include <vtkObjectFactory.h>
+#include <vtkPointData.h>
+#include <vtkPolyData.h>
+#include <vtkProperty.h>
+#include <vtkRenderer.h>
+#include <vtkSmartPointer.h>
+#include <vtkTimerLog.h>
+#include <vtkWindow.h>
+
+#ifndef WNT
+# ifndef GLX_GLXEXT_LEGACY
+# define GLX_GLXEXT_LEGACY
+# endif
+# include <GL/glx.h>
+# include <dlfcn.h>
+#else
+# include <wingdi.h>
+#endif
+
+#ifndef VTK_IMPLEMENT_MESA_CXX
+vtkCxxRevisionMacro(VTKViewer_PolyDataMapper, "Revision$");
+vtkStandardNewMacro(VTKViewer_PolyDataMapper);
+#endif
+
+// some definitions for what the polydata has in it
+#define VTK_PDPSM_COLORS 0x0001
+#define VTK_PDPSM_CELL_COLORS 0x0002
+#define VTK_PDPSM_POINT_TYPE_FLOAT 0x0004
+#define VTK_PDPSM_POINT_TYPE_DOUBLE 0x0008
+#define VTK_PDPSM_NORMAL_TYPE_FLOAT 0x0010
+#define VTK_PDPSM_NORMAL_TYPE_DOUBLE 0x0020
+#define VTK_PDPSM_OPAQUE_COLORS 0x0040
+
+#ifndef APIENTRY
+#define APIENTRY
+#endif
+#ifndef APIENTRYP
+#define APIENTRYP APIENTRY *
+#endif
+
+#ifndef GL_VERTEX_PROGRAM_POINT_SIZE_ARB
+#define GL_VERTEX_PROGRAM_POINT_SIZE_ARB 0x8642
+#endif
+
+#ifndef GL_ARB_point_sprite
+#define GL_POINT_SPRITE_ARB 0x8861
+#define GL_COORD_REPLACE_ARB 0x8862
+#endif
+
+#ifndef GL_ARB_vertex_buffer_object
+typedef ptrdiff_t GLsizeiptrARB;
+
+#define GL_ARRAY_BUFFER_ARB 0x8892
+#define GL_STATIC_DRAW_ARB 0x88E4
+#endif
+
+typedef void (APIENTRYP PFNGLBINDBUFFERARBPROC) (GLenum target, GLuint buffer);
+typedef void (APIENTRYP PFNGLDELETEBUFFERSARBPROC) (GLsizei n, const GLuint *buffers);
+typedef void (APIENTRYP PFNGLGENBUFFERSARBPROC) (GLsizei n, GLuint *buffers);
+typedef void (APIENTRYP PFNGLBUFFERDATAARBPROC) (GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage);
+
+static PFNGLGENBUFFERSARBPROC vglGenBuffersARB = NULL;
+static PFNGLBINDBUFFERARBPROC vglBindBufferARB = NULL;
+static PFNGLBUFFERDATAARBPROC vglBufferDataARB = NULL;
+static PFNGLDELETEBUFFERSARBPROC vglDeleteBuffersARB = NULL;
+
+#ifndef WNT
+#define GL_GetProcAddress( x ) glXGetProcAddressARB( (const GLubyte*)x )
+#else
+#define GL_GetProcAddress( x ) wglGetProcAddress( (const LPCSTR)x )
+#endif
+
+bool InitializeBufferExtensions()
+{
+ vglGenBuffersARB = (PFNGLGENBUFFERSARBPROC)GL_GetProcAddress( "glGenBuffersARB" );
+ if( !vglGenBuffersARB )
+ return false;
+
+ vglBindBufferARB = (PFNGLBINDBUFFERARBPROC)GL_GetProcAddress( "glBindBufferARB" );
+ if( !vglBindBufferARB )
+ return false;
+
+ vglBufferDataARB = (PFNGLBUFFERDATAARBPROC)GL_GetProcAddress( "glBufferDataARB" );
+ if( !vglBufferDataARB )
+ return false;
+
+ vglDeleteBuffersARB = (PFNGLDELETEBUFFERSARBPROC)GL_GetProcAddress( "glDeleteBuffersARB" );
+ if( !vglDeleteBuffersARB )
+ return false;
+
+ return true;
+};
+
+static bool IsBufferExtensionsInitialized = InitializeBufferExtensions();
+
+//-----------------------------------------------------------------------------
+VTKViewer_PolyDataMapper::VTKViewer_PolyDataMapper()
+{
+ Q_INIT_RESOURCE( VTKViewer );
+
+ this->ExtensionsInitialized = ES_None;
+
+ this->PointSpriteTexture = 0;
+
+ this->MarkerEnabled = false;
+ this->MarkerType = VTK::MT_NONE;
+ this->MarkerScale = VTK::MS_NONE;
+ this->MarkerId = 0;
+}
+
+//-----------------------------------------------------------------------------
+VTKViewer_PolyDataMapper::~VTKViewer_PolyDataMapper()
+{
+ if( PointSpriteTexture > 0 )
+ glDeleteTextures( 1, &PointSpriteTexture );
+}
+
+//-----------------------------------------------------------------------------
+void VTKViewer_PolyDataMapper::SetMarkerEnabled( bool theMarkerEnabled )
+{
+ if( this->MarkerEnabled == theMarkerEnabled )
+ return;
+
+ this->MarkerEnabled = theMarkerEnabled;
+ this->Modified();
+}
+
+//-----------------------------------------------------------------------------
+void VTKViewer_PolyDataMapper::SetMarkerStd( VTK::MarkerType theMarkerType, VTK::MarkerScale theMarkerScale )
+{
+ if( this->MarkerType == theMarkerType && this->MarkerScale == theMarkerScale )
+ return;
+
+ this->MarkerType = theMarkerType;
+ this->MarkerScale = theMarkerScale;
+
+ if( this->MarkerType == VTK::MT_NONE || this->MarkerType == VTK::MT_USER ) {
+ this->ImageData = NULL;
+ this->Modified();
+ return;
+ }
+
+ int aMarkerType = (int)this->MarkerType;
+ int aMarkerScale = (int)this->MarkerScale;
+
+ int anId = (int)VTK::MS_70 * aMarkerType + aMarkerScale;
+
+ if( this->StandardTextures.find( anId ) == this->StandardTextures.end() )
+ {
+ QString aFileName = QString( ":/textures/texture%1.dat" ).arg( aMarkerType );
+ VTK::MarkerTexture aMarkerTexture;
+ if( VTK::LoadTextureData( aFileName, theMarkerScale, aMarkerTexture ) )
+ this->StandardTextures[ anId ] = VTK::MakeVTKImage( aMarkerTexture );
+ }
+
+ this->ImageData = this->StandardTextures[ anId ];
+ this->Modified();
+}
+
+//-----------------------------------------------------------------------------
+void VTKViewer_PolyDataMapper::SetMarkerTexture( int theMarkerId, VTK::MarkerTexture theMarkerTexture )
+{
+ if( this->MarkerType == VTK::MT_USER && this->MarkerId == theMarkerId )
+ return;
+
+ this->MarkerType = VTK::MT_USER;
+ this->MarkerId = theMarkerId;
+
+ if( this->CustomTextures.find( theMarkerId ) == this->CustomTextures.end() )
+ this->CustomTextures[ theMarkerId ] = VTK::MakeVTKImage( theMarkerTexture );
+
+ this->ImageData = this->CustomTextures[ theMarkerId ];
+ this->Modified();
+}
+
+//-----------------------------------------------------------------------------
+VTK::MarkerType VTKViewer_PolyDataMapper::GetMarkerType()
+{
+ return this->MarkerType;
+}
+
+//-----------------------------------------------------------------------------
+VTK::MarkerScale VTKViewer_PolyDataMapper::GetMarkerScale()
+{
+ return this->MarkerScale;
+}
+
+//-----------------------------------------------------------------------------
+int VTKViewer_PolyDataMapper::GetMarkerTexture()
+{
+ return this->MarkerId;
+}
+
+//-----------------------------------------------------------------------------
+int VTKViewer_PolyDataMapper::InitExtensions()
+{
+ char* ext = (char*)glGetString( GL_EXTENSIONS );
+ if( !IsBufferExtensionsInitialized ||
+ strstr( ext, "GL_ARB_point_sprite" ) == NULL ||
+ strstr( ext, "GL_ARB_vertex_buffer_object" ) == NULL )
+ {
+ MESSAGE("Initializing ARB extensions failed");
+ return ES_Error;
+ }
+
+ return ES_Ok;
+}
+
+//-----------------------------------------------------------------------------
+void VTKViewer_PolyDataMapper::InitPointSprites()
+{
+ glEnable( GL_POINT_SPRITE_ARB );
+ glEnable( GL_VERTEX_PROGRAM_POINT_SIZE_ARB );
+
+ glPushAttrib( GL_COLOR_BUFFER_BIT | GL_CURRENT_BIT | GL_DEPTH_BUFFER_BIT | GL_ENABLE_BIT | GL_LIGHTING_BIT );
+
+ glDepthFunc( GL_LEQUAL );
+ glEnable( GL_DEPTH_TEST );
+
+ glEnable( GL_ALPHA_TEST );
+ glAlphaFunc( GL_GREATER, 0.0 );
+
+ glDisable( GL_LIGHTING );
+
+ glDisable( GL_COLOR_MATERIAL );
+}
+
+//-----------------------------------------------------------------------------
+void VTKViewer_PolyDataMapper::CleanupPointSprites()
+{
+ glPopAttrib();
+
+ glDisable( GL_VERTEX_PROGRAM_POINT_SIZE_ARB );
+ glDisable( GL_POINT_SPRITE_ARB );
+}
+
+//-----------------------------------------------------------------------------
+void VTKViewer_PolyDataMapper::InitTextures()
+{
+ if( !this->ImageData.GetPointer() )
+ return;
+
+ glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
+ glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
+ glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
+ glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
+
+ int* aSize = this->ImageData->GetDimensions();
+ unsigned char* dataPtr = (unsigned char*)this->ImageData->GetScalarPointer();
+ glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, aSize[0], aSize[1], 0,
+ GL_RGBA, GL_UNSIGNED_BYTE, dataPtr );
+
+ //glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
+ glEnable( GL_TEXTURE_2D );
+ glTexEnvf( GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, GL_TRUE );
+ glBindTexture( GL_TEXTURE_2D, this->PointSpriteTexture );
+}
+
+//-----------------------------------------------------------------------------
+void VTKViewer_PolyDataMapper::RenderPiece( vtkRenderer* ren, vtkActor* act )
+{
+ bool isUsePointSprites = this->MarkerEnabled && this->MarkerType != VTK::MT_NONE;
+ if( isUsePointSprites )
+ {
+ if( this->ExtensionsInitialized == ES_None )
+ this->ExtensionsInitialized = this->InitExtensions();
+ this->InitPointSprites();
+ this->InitTextures();
+ }
+
+ MAPPER_SUPERCLASS::RenderPiece( ren, act );
+
+ if( isUsePointSprites )
+ this->CleanupPointSprites();
+}
+
+//-----------------------------------------------------------------------------
+// Definition of structures and fuctions used in Draw() method
+namespace VTK
+{
+ //-----------------------------------------------------------------------------
+ struct TVertex
+ {
+ GLfloat r, g, b, a;
+ GLfloat vx, vy, vz;
+ };
+
+ //-----------------------------------------------------------------------------
+ struct TColorFunctorBase
+ {
+ vtkFloatingPointType myAlpha;
+
+ TColorFunctorBase( vtkProperty* theProperty )
+ {
+ myAlpha = theProperty->GetOpacity();
+ }
+
+ virtual
+ void
+ get( TVertex& theVertex, vtkIdType thePointId, vtkIdType theCellId ) = 0;
+ };
+
+ //-----------------------------------------------------------------------------
+ struct TPropertyColor : TColorFunctorBase
+ {
+ vtkFloatingPointType myColor[3];
+
+ TPropertyColor( vtkProperty* theProperty ):
+ TColorFunctorBase( theProperty )
+ {
+ theProperty->GetColor( myColor );
+ }
+
+ virtual
+ void
+ get( TVertex& theVertex, vtkIdType thePointId, vtkIdType theCellId )
+ {
+ theVertex.r = myColor[0];
+ theVertex.g = myColor[1];
+ theVertex.b = myColor[2];
+ theVertex.a = myAlpha;
+ }
+ };
+
+ //-----------------------------------------------------------------------------
+ struct TColors2Color : TColorFunctorBase
+ {
+ vtkUnsignedCharArray* myColors;
+
+ TColors2Color( vtkProperty* theProperty,
+ vtkUnsignedCharArray* theColors ):
+ TColorFunctorBase( theProperty ),
+ myColors( theColors )
+ {}
+
+ virtual
+ void
+ get( TVertex& theVertex, vtkIdType thePointId, vtkIdType theCellId )
+ {
+ vtkIdType aTupleId = GetTupleId( thePointId, theCellId );
+ unsigned char* aColor = myColors->GetPointer( aTupleId << 2 );
+
+ theVertex.r = int( aColor[0] ) / 255.0;
+ theVertex.g = int( aColor[1] ) / 255.0;
+ theVertex.b = int( aColor[2] ) / 255.0;
+ theVertex.a = myAlpha;
+ }
+
+ virtual
+ vtkIdType
+ GetTupleId( vtkIdType thePointId, vtkIdType theCellId ) = 0;
+ };
+
+ //-----------------------------------------------------------------------------
+ struct TPointColors2Color : TColors2Color
+ {
+ TPointColors2Color( vtkProperty* theProperty,
+ vtkUnsignedCharArray* theColors ):
+ TColors2Color( theProperty, theColors )
+ {}
+
+ virtual
+ vtkIdType
+ GetTupleId( vtkIdType thePointId, vtkIdType theCellId )
+ {
+ return thePointId;
+ }
+ };
+
+ //-----------------------------------------------------------------------------
+ struct TCellColors2Color : TColors2Color
+ {
+ TCellColors2Color( vtkProperty* theProperty,
+ vtkUnsignedCharArray* theColors ):
+ TColors2Color( theProperty, theColors )
+ {}
+
+ virtual
+ vtkIdType
+ GetTupleId( vtkIdType thePointId, vtkIdType theCellId )
+ {
+ return theCellId;
+ }
+ };
+
+ //-----------------------------------------------------------------------------
+ template < class TCoordinates >
+ void DrawPoints( TCoordinates* theStartPoints,
+ vtkCellArray* theCells,
+ TColorFunctorBase* theColorFunctor,
+ TVertex* theVertexArr,
+ vtkIdType &theCellId,
+ vtkIdType &theVertexId )
+ {
+ vtkIdType* ptIds = theCells->GetPointer();
+ vtkIdType* endPtIds = ptIds + theCells->GetNumberOfConnectivityEntries();
+
+ while ( ptIds < endPtIds ) {
+ vtkIdType nPts = *ptIds;
+ ++ptIds;
+
+ while ( nPts > 0 ) {
+ TVertex& aVertex = theVertexArr[ theVertexId ];
+ vtkIdType aPointId = *ptIds;
+
+ TCoordinates* anOffsetPoints = theStartPoints + 3 * aPointId;
+ aVertex.vx = anOffsetPoints[0];
+ aVertex.vy = anOffsetPoints[1];
+ aVertex.vz = anOffsetPoints[2];
+
+ theColorFunctor->get( aVertex, aPointId, theCellId );
+
+ ++theVertexId;
+ ++ptIds;
+ --nPts;
+ }
+
+ ++theCellId;
+ }
+ }
+
+ //-----------------------------------------------------------------------------
+ template < class TCoordinates >
+ void DrawCellsPoints( vtkPolyData* theInput,
+ vtkPoints* thePoints,
+ TColorFunctorBase* theColorFunctor,
+ TVertex* theVertexArr )
+ {
+ vtkIdType aCellId = 0, aVertexId = 0;
+
+ TCoordinates* aStartPoints = (TCoordinates*)thePoints->GetVoidPointer(0);
+
+ if ( vtkCellArray* aCellArray = theInput->GetVerts() )
+ DrawPoints( aStartPoints, aCellArray, theColorFunctor, theVertexArr, aCellId, aVertexId );
+
+ if ( vtkCellArray* aCellArray = theInput->GetLines() )
+ DrawPoints( aStartPoints, aCellArray, theColorFunctor, theVertexArr, aCellId, aVertexId );
+
+ if ( vtkCellArray* aCellArray = theInput->GetPolys() )
+ DrawPoints( aStartPoints, aCellArray, theColorFunctor, theVertexArr, aCellId, aVertexId );
+
+ if ( vtkCellArray* aCellArray = theInput->GetStrips() )
+ DrawPoints( aStartPoints, aCellArray, theColorFunctor, theVertexArr, aCellId, aVertexId );
+ }
+} // namespace VTK
+
+//-----------------------------------------------------------------------------
+int VTKViewer_PolyDataMapper::Draw( vtkRenderer* ren, vtkActor* act )
+{
+ if( !this->MarkerEnabled || this->MarkerType == VTK::MT_NONE || !this->ImageData.GetPointer() )
+ return MAPPER_SUPERCLASS::Draw( ren, act );
+
+ vtkUnsignedCharArray* colors = NULL;
+ vtkPolyData* input = this->GetInput();
+ vtkPoints* points;
+ int noAbort = 1;
+ int cellScalars = 0;
+ vtkProperty* prop = act->GetProperty();
+
+ points = input->GetPoints();
+
+ if ( this->Colors )
+ {
+ colors = this->Colors;
+ if ( (this->ScalarMode == VTK_SCALAR_MODE_USE_CELL_DATA ||
+ this->ScalarMode == VTK_SCALAR_MODE_USE_CELL_FIELD_DATA ||
+ !input->GetPointData()->GetScalars() )
+ && this->ScalarMode != VTK_SCALAR_MODE_USE_POINT_FIELD_DATA)
+ cellScalars = 1;
+ }
+
+ {
+ vtkIdType aTotalConnectivitySize = 0;
+
+ if ( vtkCellArray* aCellArray = input->GetVerts() )
+ aTotalConnectivitySize += aCellArray->GetNumberOfConnectivityEntries() - aCellArray->GetNumberOfCells();
+
+ if ( vtkCellArray* aCellArray = input->GetLines() )
+ aTotalConnectivitySize += aCellArray->GetNumberOfConnectivityEntries() - aCellArray->GetNumberOfCells();
+
+ if ( vtkCellArray* aCellArray = input->GetPolys() )
+ aTotalConnectivitySize += aCellArray->GetNumberOfConnectivityEntries() - aCellArray->GetNumberOfCells();
+
+ if ( vtkCellArray* aCellArray = input->GetStrips() )
+ aTotalConnectivitySize += aCellArray->GetNumberOfConnectivityEntries() - aCellArray->GetNumberOfCells();
+
+ if ( aTotalConnectivitySize > 0 ) {
+ VTK::TVertex* aVertexArr = new VTK::TVertex[ aTotalConnectivitySize ];
+
+ int* aSize = this->ImageData->GetDimensions();
+ glPointSize( std::max( aSize[0], aSize[1] ) );
+
+ int aMode = 0; // to remove
+ {
+ VTK::TColorFunctorBase* aColorFunctor = NULL;
+ if( colors && aMode != 1 ) {
+ if ( cellScalars )
+ aColorFunctor = new VTK::TCellColors2Color( prop, colors );
+ else
+ aColorFunctor = new VTK::TPointColors2Color( prop, colors );
+ } else {
+ aColorFunctor = new VTK::TPropertyColor( prop );
+ }
+ if ( points->GetDataType() == VTK_FLOAT )
+ VTK::DrawCellsPoints< float >( input, points, aColorFunctor, aVertexArr );
+ else
+ VTK::DrawCellsPoints< double >( input, points, aColorFunctor, aVertexArr );
+
+ delete aColorFunctor;
+ }
+
+ if( this->ExtensionsInitialized == ES_Ok ) {
+ GLuint aBufferObjectID = 0;
+ vglGenBuffersARB( 1, &aBufferObjectID );
+ vglBindBufferARB( GL_ARRAY_BUFFER_ARB, aBufferObjectID );
+
+ int anArrayObjectSize = sizeof( VTK::TVertex ) * aTotalConnectivitySize;
+ vglBufferDataARB( GL_ARRAY_BUFFER_ARB, anArrayObjectSize, aVertexArr, GL_STATIC_DRAW_ARB );
+
+ delete [] aVertexArr;
+
+ vglBindBufferARB( GL_ARRAY_BUFFER_ARB, 0 );
+ vglBindBufferARB( GL_ARRAY_BUFFER_ARB, aBufferObjectID );
+
+ glColorPointer( 4, GL_FLOAT, sizeof(VTK::TVertex), (void*)0 );
+ glVertexPointer( 3, GL_FLOAT, sizeof(VTK::TVertex), (void*)(4*sizeof(GLfloat)) );
+
+ glEnableClientState( GL_VERTEX_ARRAY );
+ glEnableClientState( GL_COLOR_ARRAY );
+
+ glDrawArrays( GL_POINTS, 0, aTotalConnectivitySize );
+
+ glDisableClientState( GL_COLOR_ARRAY );
+ glDisableClientState( GL_VERTEX_ARRAY );
+
+ vglDeleteBuffersARB( 1, &aBufferObjectID );
+ } else { // there are no extensions
+ glColorPointer( 4, GL_FLOAT, sizeof(VTK::TVertex), aVertexArr );
+ glVertexPointer( 3, GL_FLOAT, sizeof(VTK::TVertex),
+ (void*)((GLfloat*)((void*)(aVertexArr)) + 4));
+
+ glEnableClientState( GL_VERTEX_ARRAY );
+ glEnableClientState( GL_COLOR_ARRAY );
+
+ glDrawArrays( GL_POINTS, 0, aTotalConnectivitySize );
+
+ glDisableClientState( GL_COLOR_ARRAY );
+ glDisableClientState( GL_VERTEX_ARRAY );
+
+ delete [] aVertexArr;
+ }
+ }
+ }
+
+ this->UpdateProgress(1.0);
+ return noAbort;
+}
--- /dev/null
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef VTKViewer_POLYDATAMAPPER_H
+#define VTKViewer_POLYDATAMAPPER_H
+
+#include "VTKViewer.h"
+#include "VTKViewer_MarkerDef.h"
+
+#ifdef WNT
+#include <windows.h>
+#endif
+
+#include <map>
+
+#include <GL/gl.h>
+
+#include <vtkSmartPointer.h>
+
+class vtkImageData;
+
+#ifndef VTK_IMPLEMENT_MESA_CXX
+#include <vtkOpenGLPolyDataMapper.h>
+#define MAPPER_SUPERCLASS vtkOpenGLPolyDataMapper
+#else
+#include <vtkMesaPolyDataMapper.h>
+#define MAPPER_SUPERCLASS vtkMesaPolyDataMapper
+#endif
+
+//----------------------------------------------------------------------------
+//! OpenGL Point Sprites PolyData Mapper.
+/*!
+ * VTKViewer_PolyDataMapper is a class that maps polygonal data
+ * (i.e., vtkPolyData) to graphics primitives. It is performing the mapping
+ * to the rendering/graphics hardware/software. It is now possible to set a
+ * memory limit for the pipeline in the mapper. If the total estimated memory
+ * usage of the pipeline is larger than this limit, the mapper will divide
+ * the data into pieces and render each in a for loop.
+ */
+class VTKVIEWER_EXPORT VTKViewer_PolyDataMapper : public MAPPER_SUPERCLASS
+{
+public:
+ enum ExtensionsState { ES_None = 0, ES_Error, ES_Ok };
+
+public:
+ static VTKViewer_PolyDataMapper* New();
+ vtkTypeRevisionMacro( VTKViewer_PolyDataMapper, MAPPER_SUPERCLASS );
+
+ //! Set point marker enabled
+ void SetMarkerEnabled( bool );
+
+ //! Set standard point marker
+ void SetMarkerStd( VTK::MarkerType, VTK::MarkerScale );
+
+ //! Set custom point marker
+ void SetMarkerTexture( int, VTK::MarkerTexture );
+
+ //! Get type of the point marker
+ VTK::MarkerType GetMarkerType();
+
+ //! Get scale of the point marker
+ VTK::MarkerScale GetMarkerScale();
+
+ //! Get texture identifier of the point marker
+ int GetMarkerTexture();
+
+ //! Implement superclass render method.
+ virtual void RenderPiece( vtkRenderer*, vtkActor* );
+
+ //! Draw method for OpenGL.
+ virtual int Draw( vtkRenderer*, vtkActor* );
+
+protected:
+ VTKViewer_PolyDataMapper();
+ ~VTKViewer_PolyDataMapper();
+
+ //! Initializing OpenGL extensions.
+ int InitExtensions();
+
+ //! Activate Point Sprites.
+ void InitPointSprites();
+
+ //! Deactivate Point Sprites.
+ void CleanupPointSprites();
+
+ //! Initializing textures for Point Sprites.
+ void InitTextures();
+
+private:
+ int ExtensionsInitialized;
+
+ GLuint PointSpriteTexture;
+
+ vtkSmartPointer<vtkImageData> ImageData;
+
+ bool MarkerEnabled;
+ VTK::MarkerType MarkerType;
+ VTK::MarkerScale MarkerScale;
+ int MarkerId;
+
+ typedef std::map< int, vtkSmartPointer<vtkImageData> > ImageDataMap;
+ ImageDataMap StandardTextures;
+ ImageDataMap CustomTextures;
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+#include "VTKViewer_Texture.h"
+
+#include "vtkHomogeneousTransform.h"
+#include "vtkImageData.h"
+#include "vtkLookupTable.h"
+#include "vtkObjectFactory.h"
+#include "vtkOpenGLRenderer.h"
+#include "vtkPointData.h"
+#include "vtkRenderWindow.h"
+#include "vtkOpenGLExtensionManager.h"
+#include "vtkOpenGLRenderWindow.h"
+#include "vtkTransform.h"
+#include "vtkPixelBufferObject.h"
+#include "vtkOpenGL.h"
+#include "vtkgl.h" // vtkgl namespace
+#include <vtkObjectFactory.h>
+
+vtkStandardNewMacro(VTKViewer_Texture);
+
+
+// ----------------------------------------------------------------------------
+VTKViewer_Texture::VTKViewer_Texture()
+{
+ myWidth = 0;
+ myHeight = 0;
+ myPosition = VTKViewer_Texture::Centered;
+}
+
+// ----------------------------------------------------------------------------
+VTKViewer_Texture::~VTKViewer_Texture()
+{
+}
+
+// ----------------------------------------------------------------------------
+// Implement base class method.
+void VTKViewer_Texture::Load(vtkRenderer *ren)
+{
+ GLenum format = GL_LUMINANCE;
+ vtkImageData *input = this->GetInput();
+
+ this->Initialize(ren);
+
+ // Need to reload the texture.
+ // There used to be a check on the render window's mtime, but
+ // this is too broad of a check (e.g. it would cause all textures
+ // to load when only the desired update rate changed).
+ // If a better check is required, check something more specific,
+ // like the graphics context.
+ vtkOpenGLRenderWindow* renWin =
+ static_cast<vtkOpenGLRenderWindow*>(ren->GetRenderWindow());
+
+ if(this->BlendingMode != VTK_TEXTURE_BLENDING_MODE_NONE
+ && vtkgl::ActiveTexture)
+ {
+ glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, vtkgl::COMBINE);
+
+ switch(this->BlendingMode)
+ {
+ case VTK_TEXTURE_BLENDING_MODE_REPLACE:
+ {
+ glTexEnvf (GL_TEXTURE_ENV, vtkgl::COMBINE_RGB, GL_REPLACE);
+ glTexEnvf (GL_TEXTURE_ENV, vtkgl::COMBINE_ALPHA, GL_REPLACE);
+ break;
+ }
+ case VTK_TEXTURE_BLENDING_MODE_MODULATE:
+ {
+ glTexEnvf (GL_TEXTURE_ENV, vtkgl::COMBINE_RGB, GL_MODULATE);
+ glTexEnvf (GL_TEXTURE_ENV, vtkgl::COMBINE_ALPHA, GL_MODULATE);
+ break;
+ }
+ case VTK_TEXTURE_BLENDING_MODE_ADD:
+ {
+ glTexEnvf (GL_TEXTURE_ENV, vtkgl::COMBINE_RGB, GL_ADD);
+ glTexEnvf (GL_TEXTURE_ENV, vtkgl::COMBINE_ALPHA, GL_ADD);
+ break;
+ }
+ case VTK_TEXTURE_BLENDING_MODE_ADD_SIGNED:
+ {
+ glTexEnvf (GL_TEXTURE_ENV, vtkgl::COMBINE_RGB, vtkgl::ADD_SIGNED);
+ glTexEnvf (GL_TEXTURE_ENV, vtkgl::COMBINE_ALPHA, vtkgl::ADD_SIGNED);
+ break;
+ }
+ case VTK_TEXTURE_BLENDING_MODE_INTERPOLATE:
+ {
+ glTexEnvf (GL_TEXTURE_ENV, vtkgl::COMBINE_RGB, vtkgl::INTERPOLATE);
+ glTexEnvf (GL_TEXTURE_ENV, vtkgl::COMBINE_ALPHA, vtkgl::INTERPOLATE);
+ break;
+ }
+ case VTK_TEXTURE_BLENDING_MODE_SUBTRACT:
+ {
+ glTexEnvf (GL_TEXTURE_ENV, vtkgl::COMBINE_RGB, vtkgl::SUBTRACT);
+ glTexEnvf (GL_TEXTURE_ENV, vtkgl::COMBINE_ALPHA, vtkgl::SUBTRACT);
+ break;
+ }
+ default:
+ {
+ glTexEnvf (GL_TEXTURE_ENV, vtkgl::COMBINE_RGB, GL_ADD);
+ glTexEnvf (GL_TEXTURE_ENV, vtkgl::COMBINE_ALPHA, GL_ADD);
+ }
+ }
+ }
+
+ if (this->GetMTime() > this->LoadTime.GetMTime() ||
+ input->GetMTime() > this->LoadTime.GetMTime() ||
+ (this->GetLookupTable() && this->GetLookupTable()->GetMTime () >
+ this->LoadTime.GetMTime()) ||
+ renWin != this->RenderWindow.GetPointer() ||
+ renWin->GetContextCreationTime() > this->LoadTime)
+ {
+ int bytesPerPixel;
+ int size[3];
+ vtkDataArray *scalars;
+ unsigned char *dataPtr;
+ unsigned char *resultData=NULL;
+ int xsize, ysize;
+ unsigned int xs,ys;
+ GLuint tempIndex=0;
+
+ // Get the scalars the user choose to color with.
+ scalars = this->GetInputArrayToProcess(0, input);
+
+ // make sure scalars are non null
+ if (!scalars)
+ {
+ vtkErrorMacro(<< "No scalar values found for texture input!");
+ return;
+ }
+
+ // get some info
+ input->GetDimensions(size);
+
+ if (input->GetNumberOfCells() == scalars->GetNumberOfTuples())
+ {
+ // we are using cell scalars. Adjust image size for cells.
+ for (int kk=0; kk < 3; kk++)
+ {
+ if (size[kk]>1)
+ {
+ size[kk]--;
+ }
+ }
+ }
+
+ bytesPerPixel = scalars->GetNumberOfComponents();
+
+ // make sure using unsigned char data of color scalars type
+ if (this->MapColorScalarsThroughLookupTable ||
+ scalars->GetDataType() != VTK_UNSIGNED_CHAR )
+ {
+ dataPtr = this->MapScalarsToColors (scalars);
+ bytesPerPixel = 4;
+ }
+ else
+ {
+ dataPtr = static_cast<vtkUnsignedCharArray *>(scalars)->GetPointer(0);
+ }
+
+ // we only support 2d texture maps right now
+ // so one of the three sizes must be 1, but it
+ // could be any of them, so lets find it
+ if (size[0] == 1)
+ {
+ xsize = size[1]; ysize = size[2];
+ }
+ else
+ {
+ xsize = size[0];
+ if (size[1] == 1)
+ {
+ ysize = size[2];
+ }
+ else
+ {
+ ysize = size[1];
+ if (size[2] != 1)
+ {
+ vtkErrorMacro(<< "3D texture maps currently are not supported!");
+ return;
+ }
+ }
+ }
+
+
+ if(!this->CheckedHardwareSupport)
+ {
+ vtkOpenGLExtensionManager *m=renWin->GetExtensionManager();
+ this->CheckedHardwareSupport=true;
+ this->SupportsNonPowerOfTwoTextures=
+ m->ExtensionSupported("GL_VERSION_2_0")
+ || m->ExtensionSupported("GL_ARB_texture_non_power_of_two");
+ this->SupportsPBO=vtkPixelBufferObject::IsSupported(renWin);
+ }
+
+ // -- decide whether the texture needs to be resampled --
+
+ GLint maxDimGL;
+ glGetIntegerv(GL_MAX_TEXTURE_SIZE,&maxDimGL);
+ // if larger than permitted by the graphics library then must resample
+ bool resampleNeeded=xsize > maxDimGL || ysize > maxDimGL;
+ if(resampleNeeded)
+ {
+ vtkDebugMacro( "Texture too big for gl, maximum is " << maxDimGL);
+ }
+
+ if(!resampleNeeded && !this->SupportsNonPowerOfTwoTextures)
+ {
+ // xsize and ysize must be a power of 2 in OpenGL
+ xs = static_cast<unsigned int>(xsize);
+ ys = static_cast<unsigned int>(ysize);
+ while (!(xs & 0x01))
+ {
+ xs = xs >> 1;
+ }
+ while (!(ys & 0x01))
+ {
+ ys = ys >> 1;
+ }
+ // if not a power of two then resampling is required
+ resampleNeeded= (xs>1) || (ys>1);
+ }
+
+ if(resampleNeeded)
+ {
+ vtkDebugMacro(<< "Resampling texture to power of two for OpenGL");
+ resultData = this->ResampleToPowerOfTwo(xsize, ysize, dataPtr,
+ bytesPerPixel);
+ }
+
+ if ( resultData == NULL )
+ {
+ resultData = dataPtr;
+ }
+
+ // free any old display lists (from the old context)
+ if (this->RenderWindow)
+ {
+ this->ReleaseGraphicsResources(this->RenderWindow);
+ }
+
+ this->RenderWindow = ren->GetRenderWindow();
+
+ // make the new context current before we mess with opengl
+ this->RenderWindow->MakeCurrent();
+
+ // define a display list for this texture
+ // get a unique display list id
+
+#ifdef GL_VERSION_1_1
+ glGenTextures(1, &tempIndex);
+ this->Index = static_cast<long>(tempIndex);
+ glBindTexture(GL_TEXTURE_2D, this->Index);
+#else
+ this->Index = glGenLists(1);
+ glDeleteLists (static_cast<GLuint>(this->Index), static_cast<GLsizei>(0));
+ glNewList (static_cast<GLuint>(this->Index), GL_COMPILE);
+#endif
+ //seg fault protection for those wackos that don't use an
+ //opengl render window
+ if(this->RenderWindow->IsA("vtkOpenGLRenderWindow"))
+ {
+ static_cast<vtkOpenGLRenderWindow *>(ren->GetRenderWindow())->
+ RegisterTextureResource( this->Index );
+ }
+
+ if (this->Interpolate)
+ {
+ glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
+ GL_LINEAR);
+ glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
+ GL_LINEAR );
+ }
+ else
+ {
+ glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
+ glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
+ }
+ if (this->Repeat)
+ {
+ glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
+ glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
+ }
+ else
+ {
+ vtkOpenGLExtensionManager* manager = renWin->GetExtensionManager();
+ if (this->EdgeClamp &&
+ (manager->ExtensionSupported("GL_VERSION_1_2") ||
+ manager->ExtensionSupported("GL_EXT_texture_edge_clamp")))
+ {
+ glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,
+ vtkgl::CLAMP_TO_EDGE );
+ glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,
+ vtkgl::CLAMP_TO_EDGE );
+ }
+ else
+ {
+ glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
+ glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
+ }
+ }
+ int internalFormat = bytesPerPixel;
+ switch (bytesPerPixel)
+ {
+ case 1: format = GL_LUMINANCE; break;
+ case 2: format = GL_LUMINANCE_ALPHA; break;
+ case 3: format = GL_RGB; break;
+ case 4: format = GL_RGBA; break;
+ }
+ // if we are using OpenGL 1.1, you can force 32 or16 bit textures
+#ifdef GL_VERSION_1_1
+ if (this->Quality == VTK_TEXTURE_QUALITY_32BIT)
+ {
+ switch (bytesPerPixel)
+ {
+ case 1: internalFormat = GL_LUMINANCE8; break;
+ case 2: internalFormat = GL_LUMINANCE8_ALPHA8; break;
+ case 3: internalFormat = GL_RGB8; break;
+ case 4: internalFormat = GL_RGBA8; break;
+ }
+ }
+ else if (this->Quality == VTK_TEXTURE_QUALITY_16BIT)
+ {
+ switch (bytesPerPixel)
+ {
+ case 1: internalFormat = GL_LUMINANCE4; break;
+ case 2: internalFormat = GL_LUMINANCE4_ALPHA4; break;
+ case 3: internalFormat = GL_RGB4; break;
+ case 4: internalFormat = GL_RGBA4; break;
+ }
+ }
+#endif
+ if(this->SupportsPBO)
+ {
+ if(this->PBO==0)
+ {
+ this->PBO=vtkPixelBufferObject::New();
+ this->PBO->SetContext(renWin);
+ }
+ unsigned int dims[2];
+ vtkIdType increments[2];
+ dims[0]=static_cast<unsigned int>(xsize);
+ dims[1]=static_cast<unsigned int>(ysize);
+ increments[0]=0;
+ increments[1]=0;
+ this->PBO->Upload2D(VTK_UNSIGNED_CHAR,resultData,dims,bytesPerPixel,
+ increments);
+ // non-blocking call
+ this->PBO->Bind(vtkPixelBufferObject::UNPACKED_BUFFER);
+ glTexImage2D( GL_TEXTURE_2D, 0 , internalFormat,
+ xsize, ysize, 0, format,
+ GL_UNSIGNED_BYTE,0);
+ myWidth = xsize;
+ myHeight = ysize;
+ this->PBO->UnBind();
+ }
+ else
+ {
+ // blocking call
+ glTexImage2D( GL_TEXTURE_2D, 0 , internalFormat,
+ xsize, ysize, 0, format,
+ GL_UNSIGNED_BYTE,
+ static_cast<const GLvoid *>(resultData) );
+ myWidth = xsize;
+ myHeight = ysize;
+ }
+#ifndef GL_VERSION_1_1
+ glEndList ();
+#endif
+ // modify the load time to the current time
+ this->LoadTime.Modified();
+
+ // free memory
+ if (resultData != dataPtr)
+ {
+ delete [] resultData;
+ }
+ }
+
+ // execute the display list that uses creates the texture
+#ifdef GL_VERSION_1_1
+ glBindTexture(GL_TEXTURE_2D, this->Index);
+#else
+ glCallList(this->Index);
+#endif
+
+ // don't accept fragments if they have zero opacity. this will stop the
+ // zbuffer from be blocked by totally transparent texture fragments.
+ glAlphaFunc (GL_GREATER, static_cast<GLclampf>(0));
+ glEnable (GL_ALPHA_TEST);
+
+ if (this->PremultipliedAlpha)
+ {
+ // save the blend function.
+ glPushAttrib(GL_COLOR_BUFFER_BIT);
+
+ // make the blend function correct for textures premultiplied by alpha.
+ glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ }
+
+ // now bind it
+ glEnable(GL_TEXTURE_2D);
+
+ // clear any texture transform
+ glMatrixMode(GL_TEXTURE);
+ glLoadIdentity();
+
+ // build transformation
+ if (this->Transform)
+ {
+ double *mat = this->Transform->GetMatrix()->Element[0];
+ double mat2[16];
+ mat2[0] = mat[0];
+ mat2[1] = mat[4];
+ mat2[2] = mat[8];
+ mat2[3] = mat[12];
+ mat2[4] = mat[1];
+ mat2[5] = mat[5];
+ mat2[6] = mat[9];
+ mat2[7] = mat[13];
+ mat2[8] = mat[2];
+ mat2[9] = mat[6];
+ mat2[10] = mat[10];
+ mat2[11] = mat[14];
+ mat2[12] = mat[3];
+ mat2[13] = mat[7];
+ mat2[14] = mat[11];
+ mat2[15] = mat[15];
+
+ // insert texture transformation
+ glMultMatrixd(mat2);
+ }
+ glMatrixMode(GL_MODELVIEW);
+
+ GLint uUseTexture=-1;
+ GLint uTexture=-1;
+
+ vtkOpenGLRenderer *oRenderer=static_cast<vtkOpenGLRenderer *>(ren);
+
+/* if(oRenderer->GetDepthPeelingHigherLayer())
+ {
+ uUseTexture=oRenderer->GetUseTextureUniformVariable();
+ uTexture=oRenderer->GetTextureUniformVariable();
+ vtkgl::Uniform1i(uUseTexture,1);
+ vtkgl::Uniform1i(uTexture,0); // active texture 0
+ }
+ */
+}
+
+void VTKViewer_Texture::Initialize(vtkRenderer * vtkNotUsed(ren))
+{
+}
+
+int VTKViewer_Texture::GetWidth() const
+{
+ return myWidth;
+}
+
+int VTKViewer_Texture::GetHeight() const
+{
+ return myHeight;
+}
+
+void VTKViewer_Texture::SetPosition(int pos)
+{
+ myPosition = pos;
+}
+
+int VTKViewer_Texture::GetPosition() const
+{
+ return myPosition;
+}
--- /dev/null
+// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// SALOME VTKViewer : build VTK viewer into Salome desktop
+// File :
+// Author :
+// Module :
+// $Header$
+//
+
+#ifndef VTKVIEWER_TEXTURE_H
+#define VTKVIEWER_TEXTURE_H
+
+#include "VTKViewer.h"
+#include <vtkOpenGLTexture.h>
+
+#ifdef WIN32
+#pragma warning ( disable:4251 )
+#endif
+
+class vtkRenderer;
+
+class VTKVIEWER_EXPORT VTKViewer_Texture : public vtkOpenGLTexture
+{
+public:
+ enum { Stretched = 0, Centered, Tiled };
+
+public:
+ static VTKViewer_Texture *New();
+ vtkTypeMacro(VTKViewer_Texture,vtkOpenGLTexture);
+
+ virtual void Load(vtkRenderer *ren);
+
+ int GetWidth() const;
+ int GetHeight() const;
+
+ void SetPosition(int type);
+ int GetPosition() const;
+
+protected:
+ VTKViewer_Texture();
+ ~VTKViewer_Texture();
+
+ int myWidth;
+ int myHeight;
+ int myPosition;
+
+private:
+ virtual void Initialize(vtkRenderer * ren);
+};
+
+#endif
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="fr_FR">
+<context>
+ <name>@default</name>
+ <message>
+ <source>DSC_ANTICLOCKWISE_VIEW</source>
+ <translation>Tourner la vue à gauche</translation>
+ </message>
+ <message>
+ <source>DSC_CLOCKWISE_VIEW</source>
+ <translation>Tourner la vue à droite</translation>
+ </message>
+ <message>
+ <source>MNU_ANTICLOCKWISE_VIEW</source>
+ <translation>Tourner la vue à gauche</translation>
+ </message>
+ <message>
+ <source>MNU_CLOCKWISE_VIEW</source>
+ <translation>Tourner la vue à droite</translation>
+ </message>
+ <message>
+ <source>MNU_FRONT_VIEW</source>
+ <translation>Avant</translation>
+ </message>
+ <message>
+ <source>ERROR</source>
+ <translation>Erreur</translation>
+ </message>
+ <message>
+ <source>MNU_DUMP_VIEW</source>
+ <translation>Enregistrer la vue...</translation>
+ </message>
+ <message>
+ <source>DSC_TOP_VIEW</source>
+ <translation>Vue de dessus</translation>
+ </message>
+ <message>
+ <source>MNU_PAN_VIEW</source>
+ <translation>Déplacement</translation>
+ </message>
+ <message>
+ <source>MNU_TOP_VIEW</source>
+ <translation>Dessus</translation>
+ </message>
+ <message>
+ <source>DSC_GLOBALPAN_VIEW</source>
+ <translation>Sélection d'un nouveau centre de vue</translation>
+ </message>
+ <message>
+ <source>DSC_ROTATE_VIEW</source>
+ <translation>Tourner le point de vue autour du centre de la scène</translation>
+ </message>
+ <message>
+ <source>MNU_ZOOM_VIEW</source>
+ <translation>Zoom</translation>
+ </message>
+ <message>
+ <source>DSC_PAN_VIEW</source>
+ <translation>Déplacer la vue</translation>
+ </message>
+ <message>
+ <source>DSC_LEFT_VIEW</source>
+ <translation>Vue de gauche</translation>
+ </message>
+ <message>
+ <source>DSC_FITALL</source>
+ <translation>Redimensionner la scène pour montrer tous les objets</translation>
+ </message>
+ <message>
+ <source>MNU_FITALL</source>
+ <translation>Ajuster tout</translation>
+ </message>
+ <message>
+ <source>MNU_ROTATE_VIEW</source>
+ <translation>Rotation</translation>
+ </message>
+ <message>
+ <source>DSC_SHOW_TRIHEDRON</source>
+ <translation>Montrer/Cacher le trièdre dans la vue actuelle</translation>
+ </message>
+ <message>
+ <source>DSC_FRONT_VIEW</source>
+ <translation>Vue de face</translation>
+ </message>
+ <message>
+ <source>MNU_GLOBALPAN_VIEW</source>
+ <translation>Déplacement global</translation>
+ </message>
+ <message>
+ <source>INF_APP_DUMP_VIEW</source>
+ <translation>Enregistrer la vue</translation>
+ </message>
+ <message>
+ <source>MNU_BACK_VIEW</source>
+ <translation>Arrière</translation>
+ </message>
+ <message>
+ <source>MNU_SHOW_TRIHEDRON</source>
+ <translation>Montrer/Cacher le trièdre</translation>
+ </message>
+ <message>
+ <source>MNU_BOTTOM_VIEW</source>
+ <translation>Dessous</translation>
+ </message>
+ <message>
+ <source>MNU_RESET_VIEW</source>
+ <translation>Restaurer le point de vue</translation>
+ </message>
+ <message>
+ <source>MNU_LEFT_VIEW</source>
+ <translation>Gauche</translation>
+ </message>
+ <message>
+ <source>DSC_RIGHT_VIEW</source>
+ <translation>Vue de droite</translation>
+ </message>
+ <message>
+ <source>DSC_FITRECT</source>
+ <translation>Redimensionner la scène à la zone choisie par l'encadré</translation>
+ </message>
+ <message>
+ <source>MNU_FITRECT</source>
+ <translation>Ajuster à la zone</translation>
+ </message>
+ <message>
+ <source>DSC_BOTTOM_VIEW</source>
+ <translation>Vue de dessous</translation>
+ </message>
+ <message>
+ <source>DSC_DUMP_VIEW</source>
+ <translation>Sauvegarde la scène en cours dans un fichier image</translation>
+ </message>
+ <message>
+ <source>DSC_ZOOM_VIEW</source>
+ <translation>Zoom la vue</translation>
+ </message>
+ <message>
+ <source>VTK_IMAGE_FILES</source>
+ <translation>Fichiers images (*.bmp *.png *.jpg *.jpeg)</translation>
+ </message>
+ <message>
+ <source>DSC_RESET_VIEW</source>
+ <translation>Restaurer le Point de Vue </translation>
+ </message>
+ <message>
+ <source>ERR_DOC_CANT_SAVE_FILE</source>
+ <translation>Impossible de sauvegarder le fichier</translation>
+ </message>
+ <message>
+ <source>MNU_RIGHT_VIEW</source>
+ <translation>Droite</translation>
+ </message>
+ <message>
+ <source>LBL_TOOLBAR_LABEL</source>
+ <translation>Opérations de visualisation</translation>
+ </message>
+ <message>
+ <source>DSC_BACK_VIEW</source>
+ <translation>Vue de derrière</translation>
+ </message>
+</context>
+<context>
+ <name>VTKViewer_MarkerDlg</name>
+ <message>
+ <source>SET_MARKER_TLT</source>
+ <translation>Définir le symbole du point</translation>
+ </message>
+</context>
+<context>
+ <name>VTKViewer_MarkerWidget</name>
+ <message>
+ <source>STANDARD_MARKER</source>
+ <translation>Standard</translation>
+ </message>
+ <message>
+ <source>CUSTOM_MARKER</source>
+ <translation>Personnalisé</translation>
+ </message>
+ <message>
+ <source>TYPE</source>
+ <translation>Type:</translation>
+ </message>
+ <message>
+ <source>SCALE</source>
+ <translation>Echelle:</translation>
+ </message>
+ <message>
+ <source>CUSTOM</source>
+ <translation>Texture:</translation>
+ </message>
+ <message>
+ <source>BROWSE</source>
+ <translation>Naviguer...</translation>
+ </message>
+ <message>
+ <source>LOAD_TEXTURE_TLT</source>
+ <translation>Charger une texture</translation>
+ </message>
+</context>
+<context>
+ <name>VTKViewer_ViewManager</name>
+ <message>
+ <source>VTK_VIEW_TITLE</source>
+ <translation>Scène VTK:%M - visualiseur:%V</translation>
+ </message>
+</context>
+<context>
+ <name>VTKViewer_Viewer</name>
+ <message>
+ <source>MEN_DUMP_VIEW</source>
+ <translation>Enregistrer la vue...</translation>
+ </message>
+ <message>
+ <source>MEN_SHOW_TOOLBAR</source>
+ <translation>Afficher la barre d'outils</translation>
+ </message>
+ <message>
+ <source>MEN_CHANGE_BACKGROUND</source>
+ <translation>Changer l'arrière-plan...</translation>
+ </message>
+ <message>
+ <source>GT_VERTICALGRADIENT</source>
+ <translation>Gradient vertical</translation>
+ </message>
+ <message>
+ <source>BG_IMAGE_FILES</source>
+ <translation>Fichiers images (*.png *.jpg *.jpeg *.bmp *.tif *.tiff *.mhd *.mha)</translation>
+ </message>
+</context>
+</TS>