Salome HOME
define the skeloeton for presentations
authorCédric Aguerre <cedric.aguerre@edf.fr>
Tue, 21 Jul 2015 15:04:44 +0000 (17:04 +0200)
committerCédric Aguerre <cedric.aguerre@edf.fr>
Tue, 21 Jul 2015 15:04:44 +0000 (17:04 +0200)
17 files changed:
idl/CMakeLists.txt
idl/MEDOPFactory.idl
idl/MEDPresentationManager.idl [new file with mode: 0644]
src/MEDOP/cmp/CMakeLists.txt
src/MEDOP/cmp/MEDOPFactory_i.cxx
src/MEDOP/cmp/MEDOPFactory_i.hxx
src/MEDOP/cmp/MEDPresentationManager_i.cxx [new file with mode: 0644]
src/MEDOP/cmp/MEDPresentationManager_i.hxx [new file with mode: 0644]
src/MEDOP/gui/DatasourceController.cxx
src/MEDOP/gui/DatasourceController.hxx
src/MEDOP/gui/MED_msg_en.ts
src/MEDOP/gui/MED_msg_fr.ts
src/MEDOP/gui/WorkspaceController.cxx
src/MEDOP/tui/CMakeLists.txt
src/MEDOP/tui/medpresentation/CMakeLists.txt [new file with mode: 0644]
src/MEDOP/tui/medpresentation/__init__.py [new file with mode: 0644]
src/MEDOP/tui/medpresentation/medpresentation.py [new file with mode: 0644]

index 63dbe73187fb5df28a9f59dd1a3cda9055a66bbe..9f47f7c2bc0a48992a3a7e462fc8e29932a678d5 100644 (file)
@@ -31,6 +31,7 @@ SET(SalomeIDLMED_IDLSOURCES
   MEDDataManager.idl
   MEDCalculator.idl
   MEDEventListener.idl
+  MEDPresentationManager.idl
   MEDOPFactory.idl
 )
 
index 14251795a3d43ebedd425285c7d3bea644693671..517a3e69486552d13e579820d9f4f2afdf212e68 100644 (file)
@@ -17,7 +17,6 @@
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
-
 #ifndef __MEDOPFactory_IDL_
 #define __MEDOPFactory_IDL_
 
@@ -25,6 +24,7 @@
 #include "SALOME_Exception.idl"
 #include "MEDDataManager.idl"
 #include "MEDCalculator.idl"
+#include "MEDPresentationManager.idl"
 
 /*!
  * This module contains the interface required for starting with MED
@@ -41,9 +41,9 @@ module MEDOP
 
     MEDOP::MEDDataManager getDataManager();
     MEDOP::MEDCalculator getCalculator();
+    MEDOP::MEDPresentationManager getPresentationManager();
 
   };
 };
 
 #endif
-
diff --git a/idl/MEDPresentationManager.idl b/idl/MEDPresentationManager.idl
new file mode 100644 (file)
index 0000000..4a426f4
--- /dev/null
@@ -0,0 +1,38 @@
+// Copyright (C) 2005-2015  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, or (at your option) any later version.
+//
+// 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 __MED_PRESENTATION_MANAGER_IDL_
+#define __MED_PRESENTATION_MANAGER_IDL_
+
+#include "SALOME_GenericObj.idl"
+#include "MEDDataManager.idl"
+
+module MEDOP
+{
+
+  interface MEDPresentationManager : SALOME::GenericObj
+  {
+
+    void MakeScalarMap(in long fieldHandlerId, in string viewMode);
+
+  };
+
+};
+
+#endif
index e6a2f1bb2003d0042d3219a4fd954aaa48dfa5b9..8c74dbc769e3ec7bafb9e15bbfe5fa8c51e60c22 100644 (file)
@@ -35,8 +35,10 @@ INCLUDE_DIRECTORIES(
 SET(MEDOPFactoryEngine_SOURCES
   MEDDataManager_i.cxx
   MEDCalculator_i.cxx
+  MEDPresentationManager_i.cxx
   MEDOPFactory_i.cxx
 )
+
 SET(COMMON_LIBS
   medloader
   SalomeIDLMED
index 1ddf0511c2a03503d6974b253eb28b8d4bd71474..f954291376b3409247bb7e0a7824b76e8772642c 100644 (file)
@@ -26,6 +26,7 @@
 
 #include "MEDDataManager_i.hxx"
 #include "MEDCalculator_i.hxx"
+#include "MEDPresentationManager_i.hxx"
 
 using namespace std;
 
@@ -63,6 +64,12 @@ MEDOP::MEDCalculator_ptr MEDOPFactory_i::getCalculator() {
   return medCalculatorPtr;
 }
 
+MEDOP::MEDPresentationManager_ptr MEDOPFactory_i::getPresentationManager() {
+  MEDPresentationManager_i * manager = MEDPresentationManager_i::getInstance();
+  MEDOP::MEDPresentationManager_ptr managerPtr = manager->_this();
+  return managerPtr;
+}
+
 extern "C"
 {
   PortableServer::ObjectId * MEDOPFactoryEngine_factory(
index 49a8196baf6e381a727e60601b0966b142a2e252..a724e297cc434faa949d667607924d24f2b9d88d 100644 (file)
 #include CORBA_SERVER_HEADER(MEDOPFactory)
 #include CORBA_SERVER_HEADER(MEDDataManager)
 #include CORBA_SERVER_HEADER(MEDCalculator)
+#include CORBA_SERVER_HEADER(MEDPresentationManager)
 #include "SALOME_Component_i.hxx"
 
 #include "MEDOP.hxx"
 class MEDOP_EXPORT MEDOPFactory_i: public POA_MEDOP::MEDOPFactory,
            public Engines_Component_i
 {
-  
+
 public:
   MEDOPFactory_i(CORBA::ORB_ptr orb,
      PortableServer::POA_ptr poa,
@@ -45,7 +46,9 @@ public:
   MEDOP::MEDDataManager_ptr getDataManager();
   /*! Returns the singleton instance of the calculator */
   MEDOP::MEDCalculator_ptr getCalculator();
-  
+  /*! Returns the singleton instance of the prsentation manager */
+  MEDOP::MEDPresentationManager_ptr getPresentationManager();
+
 };
 
 extern "C"
diff --git a/src/MEDOP/cmp/MEDPresentationManager_i.cxx b/src/MEDOP/cmp/MEDPresentationManager_i.cxx
new file mode 100644 (file)
index 0000000..ad94d0c
--- /dev/null
@@ -0,0 +1,48 @@
+// Copyright (C) 2011-2015  CEA/DEN, EDF R&D
+//
+// 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, or (at your option) any later version.
+//
+// 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 "MEDPresentationManager_i.hxx"
+#include "SALOME_KernelServices.hxx"
+#include "Basics_Utils.hxx"
+
+MEDPresentationManager_i* MEDPresentationManager_i::_instance = NULL;
+
+MEDPresentationManager_i*
+MEDPresentationManager_i::getInstance() {
+  if ( _instance == NULL )
+    _instance = new MEDPresentationManager_i();
+  return _instance;
+}
+
+MEDPresentationManager_i::MEDPresentationManager_i()
+{
+}
+
+MEDPresentationManager_i::~MEDPresentationManager_i()
+{
+}
+
+#include <iostream>
+
+void
+MEDPresentationManager_i::MakeScalarMap(CORBA::Long fieldHandlerId, const char* viewMode)
+{
+  //throw KERNEL::createSalomeException("Not implemented yet");
+  std::cout << "MEDPresentationManager_i::MakeScalarMap: Not implemented yet\n";
+}
diff --git a/src/MEDOP/cmp/MEDPresentationManager_i.hxx b/src/MEDOP/cmp/MEDPresentationManager_i.hxx
new file mode 100644 (file)
index 0000000..c6d1998
--- /dev/null
@@ -0,0 +1,53 @@
+// Copyright (C) 2007-2015  CEA/DEN, EDF R&D
+//
+// 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, or (at your option) any later version.
+//
+// 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 _MED_PRESENTATION_MANAGER_I_HXX_
+#define _MED_PRESENTATION_MANAGER_I_HXX_
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(MEDDataManager)
+#include CORBA_SERVER_HEADER(MEDPresentationManager)
+#include "SALOME_GenericObj_i.hh"
+
+#include "MEDDataManager_i.hxx"
+#include "MEDOP.hxx"
+
+class MEDOP_EXPORT MEDPresentationManager_i: public POA_MEDOP::MEDPresentationManager,
+                                             public SALOME::GenericObj_i
+{
+ public:
+
+  static MEDPresentationManager_i* getInstance();
+
+  void MakeScalarMap(CORBA::Long fieldHandlerId, const char*);
+
+ private:
+
+  MEDPresentationManager_i();
+  virtual ~MEDPresentationManager_i();
+
+ private :
+
+  // The MEDPresentationManager is a singleton, whose instance can be obtained
+  // using the getInstance static method.
+  static MEDPresentationManager_i * _instance;
+
+};
+
+#endif // _MED_PRESENTATION_MANAGER_I_HXX_
index ad7c3f53c504d415723856b2fe6260316d6ebc58..f46e9b5e0bbdab0b72555b958e57f5ef106171dd 100644 (file)
@@ -90,11 +90,11 @@ void DatasourceController::createActions() {
   actionId = _salomeModule->createStandardAction(label,this,SLOT(OnExpandField()),icon);
   _salomeModule->addActionInPopupMenu(actionId);
 
-  // Create a control view
-  label = tr("LAB_VISUALIZE");
+  // Create a view submenu with usual visualization functions
+  label = tr("LAB_VISUALIZE_SCALARMAP");
   icon  = tr("ICO_DATASOURCE_VIEW");
-  actionId = _salomeModule->createStandardAction(label,this,SLOT(OnVisualize()),icon);
-  _salomeModule->addActionInPopupMenu(actionId);
+  actionId = _salomeModule->createStandardAction(label,this,SLOT(OnVisualizeScalarMap()),icon);
+  _salomeModule->addActionInPopupMenu(actionId, tr("LAB_VISUALIZE"));
 
   // Use in workspace
   label = tr("LAB_USE_IN_WORKSPACE");
@@ -282,9 +282,7 @@ void DatasourceController::OnExpandField()
   _salomeModule->updateObjBrowser(true);
 }
 
-void DatasourceController::OnVisualize() {
-  STDLOG("OnVisualize: To Be Implemented");
-
+void DatasourceController::visualize(DatasourceEvent::EventType eventType) {
   // We need a _studyEditor updated on the active study
   _studyEditor->updateActiveStudy();
 
@@ -311,13 +309,16 @@ void DatasourceController::OnVisualize() {
     }
 
     DatasourceEvent * event = new DatasourceEvent();
-    event->eventtype = DatasourceEvent::EVENT_VIEW_OBJECT;
+    event->eventtype = eventType;
     XmedDataObject * dataObject = new XmedDataObject();
     dataObject->setFieldHandler(*fieldHandler);
     event->objectdata  = dataObject;
     emit datasourceSignal(event);
   }
+}
 
+void DatasourceController::OnVisualizeScalarMap() {
+  this->visualize(DatasourceEvent::EVENT_VIEW_OBJECT_SCALAR_MAP);
 }
 
 void DatasourceController::OnUseInWorkspace() {
index 20824f8f22e0ba60ad0d54a02f6df32ae68d4274..435aebec9ac755527f02944e7bd1a941817439c2 100644 (file)
@@ -53,7 +53,7 @@ typedef struct {
     EVENT_IMPORT_OBJECT, // Simply import the object in the workspace
     EVENT_USE_OBJECT,    // Import in the workspace AND define a proxy
                          // variable in the tui console to use it
-    EVENT_VIEW_OBJECT    // View with a salome viewer (SMESH/VISU/PARAVIS)
+    EVENT_VIEW_OBJECT_SCALAR_MAP
   };
   int eventtype;
   XmedDataObject * objectdata;
@@ -87,11 +87,13 @@ protected slots:
   void OnAddDatasource();
   void OnAddImagesource();
   void OnExpandField();
-  void OnVisualize();
+  void OnVisualizeScalarMap();
   void OnUseInWorkspace();
   void OnChangeUnderlyingMesh();
   void OnInterpolateField();
 
+private:
+  void visualize(DatasourceEvent::EventType);
 
 private:
   StandardApp_Module * _salomeModule;
index 4008c8a7bce672bd4ab010ff80a470494400f095..0689fc4f9059da52c9b6aefd2f5c61340c6513a0 100644 (file)
       <source>LAB_EXPAND_FIELD</source>
       <translation>Expand field timeseries</translation>
     </message>
+    <message>
+      <source>LAB_VISUALIZE_SCALARMAP</source>
+      <translation>Scalar map</translation>
+    </message>
     <message>
       <location filename="MEDOP/gui/DatasourceController.cxx" line="69"/>
       <source>LAB_VISUALIZE</source>
index 2254d05497fc8aac912d1dfbde46146a22f62448..d918d30108541908d261abd97184a4776187f93a 100644 (file)
       <source>LAB_EXPAND_FIELD</source>
       <translation>Étendre les series temporelles du champ</translation>
     </message>
+    <message>
+      <source>LAB_VISUALIZE_SCALARMAP</source>
+      <translation>Carte scalaire</translation>
+    </message>
     <message>
       <location filename="MEDOP/gui/DatasourceController.cxx" line="69"/>
       <source>LAB_VISUALIZE</source>
index 017a44c6ef5a45630955c7f8106f8bdc63cb711d..e9930e8467449095ddf2bc7cdaaffdca40593cdd 100644 (file)
@@ -482,9 +482,12 @@ void WorkspaceController::processDatasourceEvent(const DatasourceEvent * event)
           askForOptions,
           QCHARSTAR(event->objectalias));
   }
-  else if ( event->eventtype == DatasourceEvent::EVENT_VIEW_OBJECT ) {
+  else if ( event->eventtype == DatasourceEvent::EVENT_VIEW_OBJECT_SCALAR_MAP ) {
     QStringList commands;
-    commands+=QString("view(get(%1))").arg(dataObject->getFieldHandler()->id);
+    commands += QString("from medpresentation import MakeScalarMap");
+    QString viewMode = "view mode"; // :TODO: change this (get value from dedicated dialog)
+    MEDOP::FieldHandler* fieldHandler = dataObject->getFieldHandler();
+    commands += QString("MakeScalarMap(get(%1), '%2')").arg(fieldHandler->id).arg(viewMode);
     _consoleDriver->exec(commands);
   }
   else {
index f1af30c4ec78321d21063cebdd8b95a360c345db..9e4b18ab7096d3cd2b5b8ead509e6d5c12714eae 100644 (file)
@@ -18,3 +18,4 @@
 #
 
 ADD_SUBDIRECTORY(xmedpy)
+ADD_SUBDIRECTORY(medpresentation)
diff --git a/src/MEDOP/tui/medpresentation/CMakeLists.txt b/src/MEDOP/tui/medpresentation/CMakeLists.txt
new file mode 100644 (file)
index 0000000..c76faf0
--- /dev/null
@@ -0,0 +1,25 @@
+# Copyright (C) 2012-2015  CEA/DEN, EDF R&D
+#
+# 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, or (at your option) any later version.
+#
+# 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
+#
+
+SET(PYFILES_TO_INSTALL
+  __init__.py
+  medpresentation.py
+  )
+
+SALOME_INSTALL_SCRIPTS("${PYFILES_TO_INSTALL}" ${SALOME_INSTALL_PYTHON}/medpresentation)
diff --git a/src/MEDOP/tui/medpresentation/__init__.py b/src/MEDOP/tui/medpresentation/__init__.py
new file mode 100644 (file)
index 0000000..8c9de9e
--- /dev/null
@@ -0,0 +1,21 @@
+# Copyright (C) 2011-2015  CEA/DEN, EDF R&D
+#
+# 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, or (at your option) any later version.
+#
+# 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
+#
+
+from medpresentation import LoadDataSource
+from medpresentation import MakeScalarMap
diff --git a/src/MEDOP/tui/medpresentation/medpresentation.py b/src/MEDOP/tui/medpresentation/medpresentation.py
new file mode 100644 (file)
index 0000000..11b029a
--- /dev/null
@@ -0,0 +1,40 @@
+# Copyright (C) 2011-2015  CEA/DEN, EDF R&D
+#
+# 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, or (at your option) any later version.
+#
+# 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 xmed
+import MEDOP
+import SALOME
+
+__manager = xmed.factory.getPresentationManager()
+
+def LoadDataSource(filename):
+  dataHandler = xmed.dataManager.addDatasource(filename)
+  print data
+  #return data
+#
+
+def MakeScalarMap(proxy, viewMode):
+  # Create the presentation instance in CORBA engine
+  # The engine in turn creates the ParaView pipeline elements
+
+  print "In MakeScalarMap (Python)"
+  __manager.MakeScalarMap(proxy.id, viewMode)
+
+
+#