Salome HOME
Merge branch 'V8_0_0_BR'
authorvsr <vsr@opencascade.com>
Fri, 22 Jan 2016 15:28:52 +0000 (18:28 +0300)
committervsr <vsr@opencascade.com>
Fri, 22 Jan 2016 15:28:52 +0000 (18:28 +0300)
29 files changed:
idl/MEDPresentationManager.idl
src/MEDCalc/cmp/CMakeLists.txt
src/MEDCalc/cmp/MEDPresentation.cxx
src/MEDCalc/cmp/MEDPresentation.hxx
src/MEDCalc/cmp/MEDPresentationContour.cxx [new file with mode: 0644]
src/MEDCalc/cmp/MEDPresentationContour.hxx [new file with mode: 0644]
src/MEDCalc/cmp/MEDPresentationDeflectionShape.cxx [new file with mode: 0644]
src/MEDCalc/cmp/MEDPresentationDeflectionShape.hxx [new file with mode: 0644]
src/MEDCalc/cmp/MEDPresentationException.hxx [new file with mode: 0644]
src/MEDCalc/cmp/MEDPresentationManager_i.cxx
src/MEDCalc/cmp/MEDPresentationManager_i.hxx
src/MEDCalc/cmp/MEDPresentationManager_i.txx [new file with mode: 0644]
src/MEDCalc/cmp/MEDPresentationPointSprite.cxx [new file with mode: 0644]
src/MEDCalc/cmp/MEDPresentationPointSprite.hxx [new file with mode: 0644]
src/MEDCalc/cmp/MEDPresentationScalarMap.cxx [new file with mode: 0644]
src/MEDCalc/cmp/MEDPresentationScalarMap.hxx [new file with mode: 0644]
src/MEDCalc/cmp/MEDPresentationSlices.cxx [new file with mode: 0644]
src/MEDCalc/cmp/MEDPresentationSlices.hxx [new file with mode: 0644]
src/MEDCalc/cmp/MEDPresentationVectorField.cxx [new file with mode: 0644]
src/MEDCalc/cmp/MEDPresentationVectorField.hxx [new file with mode: 0644]
src/MEDCalc/gui/CMakeLists.txt
src/MEDCalc/gui/DatasourceController.cxx
src/MEDCalc/gui/DatasourceController.hxx
src/MEDCalc/gui/MED_msg_en.ts
src/MEDCalc/gui/MED_msg_fr.ts
src/MEDCalc/gui/WorkspaceController.cxx
src/MEDCalc/gui/WorkspaceController.hxx
src/MEDCalc/tui/__init__.py
src/MEDCalc/tui/medpresentation.py

index 2d744bbceb80247a327f8c9f873b7cae66c3a930..e7eac75f4112803312dca7466e534c07db0c282e 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2005-2015  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2005-2016  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
@@ -37,10 +37,42 @@ module MEDCALC
     MEDPresentationViewMode viewMode;
   };
 
+  // A contour is an isoline in 2D and an isosurface in 3D
+  struct ContourParameters {
+    long fieldHandlerId;
+    MEDPresentationViewMode viewMode;
+  };
+
+  struct VectorFieldParameters {
+    long fieldHandlerId;
+    MEDPresentationViewMode viewMode;
+  };
+
+  struct SlicesParameters {
+    long fieldHandlerId;
+    MEDPresentationViewMode viewMode;
+  };
+
+  struct DeflectionShapeParameters {
+    long fieldHandlerId;
+    MEDPresentationViewMode viewMode;
+  };
+
+  struct PointSpriteParameters {
+    long fieldHandlerId;
+    MEDPresentationViewMode viewMode;
+  };
+
   interface MEDPresentationManager : SALOME::GenericObj
   {
 
     long makeScalarMap(in ScalarMapParameters params);
+    long makeContour(in ContourParameters params);
+    long makeVectorField(in VectorFieldParameters params);
+    long makeSlices(in SlicesParameters params);
+    long makeDeflectionShape(in DeflectionShapeParameters params);
+    long makePointSprite(in PointSpriteParameters params);
+
     void setPresentationProperty(in long presId, in string propName, in string propValue);
     string getPresentationProperty(in long presId, in string propName);
 
index 7309619b31b35d90e483d27caf378144fd93d88c..2ba66eb94eb9542d25fc9f4687db0599e5ca3da3 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2015  CEA/DEN, EDF R&D
+# Copyright (C) 2012-2016  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
@@ -37,6 +37,13 @@ SET(COMMON_SOURCES
   MEDCalculator_i.cxx
   MEDPresentationManager_i.cxx
   MEDPresentation.cxx
+  # presentations
+  MEDPresentationScalarMap.cxx
+  MEDPresentationContour.cxx
+  MEDPresentationVectorField.cxx
+  MEDPresentationSlices.cxx
+  MEDPresentationDeflectionShape.cxx
+  MEDPresentationPointSprite.cxx
 )
 
 SET(MEDFactoryEngine_SOURCES
@@ -81,6 +88,8 @@ INSTALL(TARGETS MEDEngine EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME
 
 FILE(GLOB MEDCALC_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx")
 INSTALL(FILES ${MEDCALC_HEADERS_HXX} DESTINATION ${SALOME_INSTALL_HEADERS})
+FILE(GLOB MEDCALC_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.txx")
+INSTALL(FILES ${MEDCALC_HEADERS_HXX} DESTINATION ${SALOME_INSTALL_HEADERS})
 
 IF(SALOME_ENABLE_PYTHON)
   INSTALL(FILES test_medcalc_components.py PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ DESTINATION ${SALOME_INSTALL_BINS}/xmed)
index f84d37eaf17695e1c708b2fe74c0966b1ac173b1..222a439b3875eed356c6a972a3f923d0a0f11a40 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2011-2015  CEA/DEN, EDF R&D
+// Copyright (C) 2011-2016  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
 
 #include "MEDFactoryClient.hxx"
 #include "MEDPresentation.hxx"
+#include "MEDPresentationException.hxx"
 #include "MEDCouplingRefCountObject.hxx"
 #include <iostream>
 
-MEDPresentation::MEDPresentation(MEDCALC::FieldHandler* fieldHdl, std::string name)
-    : _fieldHandler(fieldHdl), _pipeline(0), _display(0), _properties()
+MEDPresentation::MEDPresentation(MEDPresentation::TypeID fieldHandlerId, std::string name)
+    : _fieldHandlerId(fieldHandlerId), _pipeline(0), _display(0), _properties()
 {
+  MEDCALC::MEDDataManager_ptr dataManager(MEDFactoryClient::getDataManager());
+  MEDCALC::FieldHandler* fieldHandler = dataManager->getFieldHandler(fieldHandlerId);
+  MEDCALC::MeshHandler* meshHandler = dataManager->getMesh(fieldHandler->meshid);
+  MEDCALC::DatasourceHandler* dataSHandler = dataManager->getDatasourceHandlerFromID(meshHandler->sourceid);
+
+  _fileName = dataSHandler->uri;
+  _fieldName = fieldHandler->fieldname;
+  _fieldType = getFieldTypeString((MEDCoupling::TypeOfField) fieldHandler->type);
+
+  if (_fileName.substr(0, 7) != std::string("file://")) {
+    const char* msg = "Data source is not a file! Can not proceed.";
+    throw MEDPresentationException(msg);
+  }
+  _fileName = _fileName.substr(7, _fileName.size());
+
   setProperty("name", name);
 }
 
@@ -75,62 +91,16 @@ PyObject * MEDPresentation::getPythonObjectFromMain(const char * python_var)
   return PyDict_GetItemString(global_dict, python_var);
 }
 
-std::string MEDPresentation::getFieldTypeString()
+std::string MEDPresentation::getFieldTypeString(MEDCoupling::TypeOfField fieldType)
 {
-  MEDCoupling::TypeOfField typ = (MEDCoupling::TypeOfField)_fieldHandler->type;
-  switch(typ)
+  switch(fieldType)
   {
     case MEDCoupling::ON_CELLS:
       return "CELLS";
     case MEDCoupling::ON_NODES:
-      return "NODES";
+      return "POINTS";
     default:
       std::cerr << "MEDPresentation::getFieldTypeString() -- Not implemented ! Gauss points?";
       return "";
   }
 }
-
-
-void MEDPresentationScalarMap::internalGeneratePipeline()
-{
-  MEDCALC::MEDDataManager_ptr dataManager(MEDFactoryClient::getDataManager());
-
-  MEDCALC::MeshHandler* meshHandler = dataManager->getMesh(_fieldHandler->meshid);
-  MEDCALC::DatasourceHandler* dataSHandler = dataManager->getDatasourceHandlerFromID(meshHandler->sourceid);
-
-  std::string fileName(dataSHandler->uri);
-  std::string fieldName(_fieldHandler->fieldname);
-  std::string fieldType = getFieldTypeString();
-
-  std::cout << "Generating pipeline for SCALAR MAP:" <<std::endl;
-  std::cout << "\tfileName: " <<  fileName << std::endl;
-  std::cout << "\tfiedName: " << fieldName << std::endl;
-  if (fileName.substr(0, 7) != std::string("file://"))
-    {
-      std::cerr << "\tData source is not a file! Can not proceed." << std::endl;
-      return;
-    }
-
-  fileName = fileName.substr(7, fileName.size());
-  std::cout << "\tfileName: " <<  fileName << std::endl;
-
-  PyGILState_STATE _gil_state = PyGILState_Ensure();
-
-  PyRun_SimpleString("print 'hello world'");
-  std::string cmd = std::string(
-        "import pvsimple as pvs;"
-        "__obj1 = pvs.MEDReader(FileName='") + fileName + std::string("');"
-        "__disp1 = pvs.Show(__obj1);"
-        "pvs.ColorBy(__disp1, ('") + fieldType + std::string("', '") + fieldName + std::string("'));"
-        "pvs.GetActiveViewOrCreate('RenderView').ResetCamera()");
-
-  std::cerr << "Python command:" << std::endl;
-  std::cerr << cmd << std::endl;
-  PyRun_SimpleString(cmd.c_str());
-  // Retrieve Python object for internal storage:
-  PyObject * obj = getPythonObjectFromMain("__obj1");
-  PyObject * disp = getPythonObjectFromMain("__disp1");
-  pushInternal(obj, disp);
-
-  PyGILState_Release(_gil_state);
-}
index 6fb01555a9545924ab4bc3476331976bf1f7ed25..91d8f88f4d8bb7e44cff6cc6f95bc4542a1e26c6 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2011-2015  CEA/DEN, EDF R&D
+// Copyright (C) 2011-2016  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
@@ -21,6 +21,7 @@
 #ifndef SRC_MEDCALC_CMP_MEDPRESENTATION_HXX_
 #define SRC_MEDCALC_CMP_MEDPRESENTATION_HXX_
 
+#include "MEDCouplingRefCountObject.hxx"
 #include <Python.h>
 #include "MEDCALC.hxx"
 
@@ -38,25 +39,35 @@ class MEDCALC_EXPORT MEDPresentation
 
 public:
 
+  typedef ::CORBA::Long TypeID;
+
   virtual ~MEDPresentation() {}
 
   void setProperty(const std::string& propName, const std::string& propValue);
   const std::string getProperty(const std::string& propName);
-  std::string getFieldTypeString();
 
 protected:
 
-  MEDPresentation(MEDCALC::FieldHandler* fieldHdl, std::string name);
+  MEDPresentation(MEDPresentation::TypeID fieldHandlerId, std::string name);
 
-  void generatePipeline();
   virtual void internalGeneratePipeline() = 0;
   PyObject * getPythonObjectFromMain(const char * var);
   void pushInternal(PyObject * obj, PyObject * disp = NULL);
 
+private:
+
+  void generatePipeline(); // reserved to friend class MEDPresentationManager
+  std::string getFieldTypeString(MEDCoupling::TypeOfField fieldType);
+
 protected:
 
-  ///! field reference - borrowed.
-  MEDCALC::FieldHandler* _fieldHandler;
+  std::string _fileName;
+  std::string _fieldName;
+  std::string _fieldType;
+
+private:
+
+  MEDPresentation::TypeID _fieldHandlerId;
 
   ///! Pipeline elements
   std::vector< PyObject * > _pipeline;
@@ -68,20 +79,4 @@ protected:
   std::map<std::string, std::string> _properties;
 };
 
-class MEDCALC_EXPORT MEDPresentationScalarMap :  public MEDPresentation
-{
-public:
-  MEDPresentationScalarMap(MEDCALC::FieldHandler* fieldHdl, bool wireframe) :
-    MEDPresentation(fieldHdl, "MEDPresentationScalarMap"),
-    _isWireframe(wireframe)
-  {}
-  virtual ~MEDPresentationScalarMap() {}
-
-protected:
-  virtual void internalGeneratePipeline();
-
-private:
-  bool _isWireframe;
-};
-
 #endif /* SRC_MEDCALC_CMP_MEDPRESENTATION_HXX_ */
diff --git a/src/MEDCalc/cmp/MEDPresentationContour.cxx b/src/MEDCalc/cmp/MEDPresentationContour.cxx
new file mode 100644 (file)
index 0000000..abd3efb
--- /dev/null
@@ -0,0 +1,7 @@
+#include "MEDPresentationContour.hxx"
+#include "MEDFactoryClient.hxx"
+
+void
+MEDPresentationContour::internalGeneratePipeline()
+{
+}
diff --git a/src/MEDCalc/cmp/MEDPresentationContour.hxx b/src/MEDCalc/cmp/MEDPresentationContour.hxx
new file mode 100644 (file)
index 0000000..9a800d7
--- /dev/null
@@ -0,0 +1,40 @@
+// Copyright (C) 2016  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 SRC_MEDCALC_CMP_MEDPRESENTATION_CONTOUR_HXX_
+#define SRC_MEDCALC_CMP_MEDPRESENTATION_CONTOUR_HXX_
+
+#include "MEDCALC.hxx"
+#include "MEDPresentation.hxx"
+
+class MEDCALC_EXPORT MEDPresentationContour : public MEDPresentation
+{
+public:
+  MEDPresentationContour(const MEDCALC::ContourParameters& params) :
+    MEDPresentation(params.fieldHandlerId, "MEDPresentationContour")
+  {}
+  virtual ~MEDPresentationContour() {}
+
+protected:
+  virtual void internalGeneratePipeline();
+
+private:
+  MEDCALC::ContourParameters _params;
+};
+
+#endif
diff --git a/src/MEDCalc/cmp/MEDPresentationDeflectionShape.cxx b/src/MEDCalc/cmp/MEDPresentationDeflectionShape.cxx
new file mode 100644 (file)
index 0000000..491b0bc
--- /dev/null
@@ -0,0 +1,25 @@
+#include "MEDPresentationDeflectionShape.hxx"
+
+void
+MEDPresentationDeflectionShape::internalGeneratePipeline()
+{
+  PyGILState_STATE _gil_state = PyGILState_Ensure();
+
+  std::string cmd = std::string("import pvsimple as pvs;");
+  cmd += std::string("__obj1 = pvs.MEDReader(FileName='") + _fileName + std::string("');");
+  cmd += std::string("__warpByVector1 = pvs.WarpByVector(Input=__obj1);");
+  cmd += std::string("__disp1 = pvs.Show(__warpByVector1);");
+  cmd += std::string("pvs.ColorBy(__disp1, ('") + _fieldType + std::string("', '") + _fieldName + std::string("'));");
+  cmd += std::string("pvs.GetActiveViewOrCreate('RenderView').ResetCamera();");
+  cmd += std::string("__disp1.RescaleTransferFunctionToDataRangeOverTime();");
+
+  //std::cerr << "Python command:" << std::endl;
+  //std::cerr << cmd << std::endl;
+  PyRun_SimpleString(cmd.c_str());
+  // Retrieve Python object for internal storage:
+  PyObject * obj = getPythonObjectFromMain("__warpByVector1");
+  PyObject * disp = getPythonObjectFromMain("__disp1");
+  pushInternal(obj, disp);
+
+  PyGILState_Release(_gil_state);
+}
diff --git a/src/MEDCalc/cmp/MEDPresentationDeflectionShape.hxx b/src/MEDCalc/cmp/MEDPresentationDeflectionShape.hxx
new file mode 100644 (file)
index 0000000..60278e1
--- /dev/null
@@ -0,0 +1,40 @@
+// Copyright (C) 2016  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 SRC_MEDCALC_CMP_MEDPRESENTATION_DEFLECTIONSHAPE_HXX_
+#define SRC_MEDCALC_CMP_MEDPRESENTATION_DEFLECTIONSHAPE_HXX_
+
+#include "MEDCALC.hxx"
+#include "MEDPresentation.hxx"
+
+class MEDCALC_EXPORT MEDPresentationDeflectionShape : public MEDPresentation
+{
+public:
+  MEDPresentationDeflectionShape(const MEDCALC::DeflectionShapeParameters& params) :
+    MEDPresentation(params.fieldHandlerId, "MEDPresentationDeflectionShape")
+  {}
+  virtual ~MEDPresentationDeflectionShape() {}
+
+protected:
+  virtual void internalGeneratePipeline();
+
+private:
+  MEDCALC::DeflectionShapeParameters _params;
+};
+
+#endif
diff --git a/src/MEDCalc/cmp/MEDPresentationException.hxx b/src/MEDCalc/cmp/MEDPresentationException.hxx
new file mode 100644 (file)
index 0000000..542ce33
--- /dev/null
@@ -0,0 +1,50 @@
+// Copyright (C) 2011-2016  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 SRC_MEDCALC_CMP_MEDPRESENTATION_EXCEPTION_HXX_
+#define SRC_MEDCALC_CMP_MEDPRESENTATION_EXCEPTION_HXX_
+
+#include "MEDCALC.hxx"
+#include <iostream>
+#include <sstream>
+#include <exception>
+
+class MEDCALC_EXPORT MEDPresentationException
+  : public std::exception
+{
+public:
+
+  MEDPresentationException(const char* msg) {
+    std::ostringstream oss;
+    oss << "Error: " << msg;
+    this->_msg = oss.str();
+  }
+
+  virtual ~MEDPresentationException() throw() {}
+
+  virtual const char* what() const throw() {
+    return this->_msg.c_str();
+  }
+
+private:
+
+  std::string _msg;
+
+};
+
+#endif /* SRC_MEDCALC_CMP_MEDPRESENTATION_EXCEPTION_HXX_ */
index a268f47f84e3a569be08c8707ff991f52b7d984e..b6c9ba970a8d378e7d0503d4a99a4a154646ecfb 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2011-2015  CEA/DEN, EDF R&D
+// Copyright (C) 2011-2016  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
 
 #include "MEDPresentationManager_i.hxx"
 #include "MEDFactoryClient.hxx"
-#include "MEDPresentation.hxx"
+
+// presentations
+#include "MEDPresentationScalarMap.hxx"
+#include "MEDPresentationContour.hxx"
+#include "MEDPresentationVectorField.hxx"
+#include "MEDPresentationSlices.hxx"
+#include "MEDPresentationDeflectionShape.hxx"
+#include "MEDPresentationPointSprite.hxx"
+
+#include <iostream>
 
 MEDPresentationManager_i* MEDPresentationManager_i::_instance = NULL;
 
@@ -46,17 +55,16 @@ MEDPresentationManager_i::~MEDPresentationManager_i()
   */
 }
 
-TypeID MEDPresentationManager_i::GenerateID()
+MEDPresentation::TypeID
+MEDPresentationManager_i::GenerateID()
 {
-  static TypeID START_ID = -1;
+  static MEDPresentation::TypeID START_ID = -1;
   START_ID++;
   return START_ID;
 }
 
-#include <iostream>
-
 void
-MEDPresentationManager_i::setPresentationProperty(TypeID presentationID, const char * propName, const char * propValue)
+MEDPresentationManager_i::setPresentationProperty(MEDPresentation::TypeID presentationID, const char * propName, const char * propValue)
 {
   if (_presentations.find(presentationID) != _presentations.end())
     {
@@ -70,7 +78,7 @@ MEDPresentationManager_i::setPresentationProperty(TypeID presentationID, const c
 }
 
 char*
-MEDPresentationManager_i::getPresentationProperty(TypeID presentationID, const char* propName)
+MEDPresentationManager_i::getPresentationProperty(MEDPresentation::TypeID presentationID, const char* propName)
 {
   if (_presentations.find(presentationID) != _presentations.end()) {
     MEDPresentation* pres = _presentations[presentationID];
@@ -82,29 +90,38 @@ MEDPresentationManager_i::getPresentationProperty(TypeID presentationID, const c
   }
 }
 
-TypeID
+MEDPresentation::TypeID
 MEDPresentationManager_i::makeScalarMap(const MEDCALC::ScalarMapParameters& params)
 {
-  MEDCALC::MEDDataManager_ptr dataManager(MEDFactoryClient::getDataManager());
-
-  TypeID fieldHandlerId = params.fieldHandlerId;
-  MEDCALC::MEDPresentationViewMode viewMode = params.viewMode;
+  return _makePresentation<MEDPresentationScalarMap>(params);
+}
 
-  MEDCALC::FieldHandler* fieldHandler = dataManager->getFieldHandler(fieldHandlerId);
-  MEDCALC::MeshHandler* meshHandler = dataManager->getMesh(fieldHandler->meshid);
-  MEDCALC::DatasourceHandler* dataSHandler = dataManager->getDatasourceHandlerFromID(meshHandler->sourceid);
+MEDPresentation::TypeID
+MEDPresentationManager_i::makeContour(const MEDCALC::ContourParameters& params)
+{
+  return _makePresentation<MEDPresentationContour>(params);
+}
 
-  std::cout << "\tfieldHandlerId: " << fieldHandlerId << std::endl;
-  std::cout << "\tviewMode: " << viewMode << std::endl;
-  std::cout << "\tfileName: " <<  dataSHandler->uri << std::endl;
-  std::cout << "\tfiedName: " << fieldHandler->fieldname << std::endl;
+MEDPresentation::TypeID
+MEDPresentationManager_i::makeVectorField(const MEDCALC::VectorFieldParameters& params)
+{
+  return _makePresentation<MEDPresentationVectorField>(params);
+}
 
-  // Create a new presentation instance
-  TypeID newID = MEDPresentationManager_i::GenerateID();
-  MEDPresentationScalarMap * scalarMap = new MEDPresentationScalarMap(fieldHandler, true);  // on stack or on heap?? stack for now
-  _presentations.insert( std::pair<TypeID, MEDPresentation *>(newID, scalarMap) );
+MEDPresentation::TypeID
+MEDPresentationManager_i::makeSlices(const MEDCALC::SlicesParameters& params)
+{
+  return _makePresentation<MEDPresentationSlices>(params);
+}
 
-  scalarMap->generatePipeline();
+MEDPresentation::TypeID
+MEDPresentationManager_i::makeDeflectionShape(const MEDCALC::DeflectionShapeParameters& params)
+{
+  return _makePresentation<MEDPresentationDeflectionShape>(params);
+}
 
-  return newID;
+MEDPresentation::TypeID
+MEDPresentationManager_i::makePointSprite(const MEDCALC::PointSpriteParameters& params)
+{
+  return _makePresentation<MEDPresentationPointSprite>(params);
 }
index 00f87a13454216a2a8cc72153fb431cd986b39c2..5af811002f60044a3aecea53b91a22df5e856bfe 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2015  CEA/DEN, EDF R&D
+// Copyright (C) 2007-2016  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
 #include "SALOME_GenericObj_i.hh"
 
 #include "MEDDataManager_i.hxx"
+#include "MEDPresentation.hxx"
 #include "MEDCALC.hxx"
 
 #include <vector>
 #include <string>
 
-typedef ::CORBA::Long TypeID;
-
-class MEDPresentation;
-
 class MEDPresentationManager_i: public POA_MEDCALC::MEDPresentationManager,
                                                public SALOME::GenericObj_i
 {
@@ -42,24 +39,37 @@ class MEDPresentationManager_i: public POA_MEDCALC::MEDPresentationManager,
 
   static MEDPresentationManager_i* getInstance();
 
-  MEDCALC_EXPORT TypeID makeScalarMap(const MEDCALC::ScalarMapParameters&);
-  MEDCALC_EXPORT void setPresentationProperty(TypeID presentationID, const char * propName, const char * propValue);
-  MEDCALC_EXPORT char* getPresentationProperty(TypeID presentationID, const char* propName);
+  MEDCALC_EXPORT MEDPresentation::TypeID makeScalarMap(const MEDCALC::ScalarMapParameters&);
+  MEDCALC_EXPORT MEDPresentation::TypeID makeContour(const MEDCALC::ContourParameters&);
+  MEDCALC_EXPORT MEDPresentation::TypeID makeVectorField(const MEDCALC::VectorFieldParameters&);
+  MEDCALC_EXPORT MEDPresentation::TypeID makeSlices(const MEDCALC::SlicesParameters&);
+  MEDCALC_EXPORT MEDPresentation::TypeID makeDeflectionShape(const MEDCALC::DeflectionShapeParameters&);
+  MEDCALC_EXPORT MEDPresentation::TypeID makePointSprite(const MEDCALC::PointSpriteParameters&);
+
+  MEDCALC_EXPORT void setPresentationProperty(MEDPresentation::TypeID presentationID, const char * propName, const char * propValue);
+  MEDCALC_EXPORT char* getPresentationProperty(MEDPresentation::TypeID presentationID, const char* propName);
 
  private:
   MEDPresentationManager_i();
   virtual ~MEDPresentationManager_i();
 
+  static MEDPresentation::TypeID GenerateID();
+
+  // Create a new presentation instance and return its unique ID
+  template<typename PresentationType, typename PresentationParameters>
+  MEDPresentation::TypeID _makePresentation(PresentationParameters params);
+
  private :
 
   // The MEDPresentationManager is a singleton, whose instance can be obtained
   // using the getInstance static method.
   static MEDPresentationManager_i * _instance;
-  static TypeID GenerateID();
 
   // Owns a list of MEDPresentation objects
-  std::map< TypeID, MEDPresentation * > _presentations;
+  std::map< MEDPresentation::TypeID, MEDPresentation * > _presentations;
 
 };
 
+#include "MEDPresentationManager_i.txx"
+
 #endif // _MED_PRESENTATION_MANAGER_I_HXX_
diff --git a/src/MEDCalc/cmp/MEDPresentationManager_i.txx b/src/MEDCalc/cmp/MEDPresentationManager_i.txx
new file mode 100644 (file)
index 0000000..79eee1a
--- /dev/null
@@ -0,0 +1,43 @@
+// Copyright (C) 2007-2016  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_TPP_
+#define _MED_PRESENTATION_MANAGER_I_TPP_
+
+template<typename PresentationType, typename PresentationParameters>
+MEDPresentation::TypeID
+MEDPresentationManager_i::_makePresentation(PresentationParameters params)
+{
+  // Create a new presentation instance
+  PresentationType* presentation = NULL;
+  try {
+    presentation = new PresentationType(params);  // on stack or on heap?? stack for now
+  }
+  catch (const std::exception& e) {
+    std::cerr << e.what() << std::endl;
+    return -1;
+  }
+
+  MEDPresentation::TypeID newID = MEDPresentationManager_i::GenerateID();
+  _presentations.insert( std::pair<MEDPresentation::TypeID, MEDPresentation *>(newID, presentation) );
+  presentation->generatePipeline();
+  return newID;
+}
+
+#endif // _MED_PRESENTATION_MANAGER_I_TPP_
diff --git a/src/MEDCalc/cmp/MEDPresentationPointSprite.cxx b/src/MEDCalc/cmp/MEDPresentationPointSprite.cxx
new file mode 100644 (file)
index 0000000..a65ebd8
--- /dev/null
@@ -0,0 +1,25 @@
+#include "MEDPresentationPointSprite.hxx"
+
+void
+MEDPresentationPointSprite::internalGeneratePipeline()
+{
+  PyGILState_STATE _gil_state = PyGILState_Ensure();
+
+  std::string cmd = std::string("import pvsimple as pvs;");
+  cmd += std::string("__obj1 = pvs.MEDReader(FileName='") + _fileName + std::string("');");
+  cmd += std::string("__disp1 = pvs.Show(__obj1);");
+  cmd += std::string("pvs.ColorBy(__disp1, ('") + _fieldType + std::string("', '") + _fieldName + std::string("'));");
+  cmd += std::string("pvs.GetActiveViewOrCreate('RenderView').ResetCamera();");
+  cmd += std::string("__disp1.RescaleTransferFunctionToDataRangeOverTime();");
+  cmd += std::string("__disp1.SetRepresentationType('Point Sprite');");
+
+  //std::cerr << "Python command:" << std::endl;
+  //std::cerr << cmd << std::endl;
+  PyRun_SimpleString(cmd.c_str());
+  // Retrieve Python object for internal storage:
+  PyObject * obj = getPythonObjectFromMain("__obj1");
+  PyObject * disp = getPythonObjectFromMain("__disp1");
+  pushInternal(obj, disp);
+
+  PyGILState_Release(_gil_state);
+}
diff --git a/src/MEDCalc/cmp/MEDPresentationPointSprite.hxx b/src/MEDCalc/cmp/MEDPresentationPointSprite.hxx
new file mode 100644 (file)
index 0000000..2b3f081
--- /dev/null
@@ -0,0 +1,40 @@
+// Copyright (C) 2016  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 SRC_MEDCALC_CMP_MEDPRESENTATION_POINTSPRITE_HXX_
+#define SRC_MEDCALC_CMP_MEDPRESENTATION_POINTSPRITE_HXX_
+
+#include "MEDCALC.hxx"
+#include "MEDPresentation.hxx"
+
+class MEDCALC_EXPORT MEDPresentationPointSprite : public MEDPresentation
+{
+public:
+  MEDPresentationPointSprite(const MEDCALC::PointSpriteParameters& params) :
+    MEDPresentation(params.fieldHandlerId, "MEDPresentationPointSprite")
+  {}
+  virtual ~MEDPresentationPointSprite() {}
+
+protected:
+  virtual void internalGeneratePipeline();
+
+private:
+  MEDCALC::PointSpriteParameters _params;
+};
+
+#endif
diff --git a/src/MEDCalc/cmp/MEDPresentationScalarMap.cxx b/src/MEDCalc/cmp/MEDPresentationScalarMap.cxx
new file mode 100644 (file)
index 0000000..0beac00
--- /dev/null
@@ -0,0 +1,42 @@
+#include "MEDPresentationScalarMap.hxx"
+
+void
+MEDPresentationScalarMap::internalGeneratePipeline()
+{
+  //MEDPresentation::TypeID fieldHandlerId = params.fieldHandlerId;
+  //MEDCALC::MEDPresentationViewMode viewMode = params.viewMode;
+
+  // :TODO: consider viewMode
+
+  /*
+  MEDCALC::MEDDataManager_ptr dataManager(MEDFactoryClient::getDataManager());
+  MEDCALC::FieldHandler* fieldHandler = dataManager->getFieldHandler(fieldHandlerId);
+
+  std::cout << "\tfieldHandlerId: " << fieldHandlerId << std::endl;
+  std::cout << "\tviewMode: " << viewMode << std::endl;
+
+  MEDCALC::MeshHandler* meshHandler = dataManager->getMesh(fieldHandler->meshid);
+  MEDCALC::DatasourceHandler* dataSHandler = dataManager->getDatasourceHandlerFromID(meshHandler->sourceid);
+  std::cout << "\tfileName: " <<  dataSHandler->uri << std::endl;
+  std::cout << "\tfiedName: " << fieldHandler->fieldname << std::endl;
+  */
+
+  PyGILState_STATE _gil_state = PyGILState_Ensure();
+
+  std::string cmd = std::string("import pvsimple as pvs;");
+  cmd += std::string("__obj1 = pvs.MEDReader(FileName='") + _fileName + std::string("');");
+  cmd += std::string("__disp1 = pvs.Show(__obj1);");
+  cmd += std::string("pvs.ColorBy(__disp1, ('") + _fieldType + std::string("', '") + _fieldName + std::string("'));");
+  cmd += std::string("pvs.GetActiveViewOrCreate('RenderView').ResetCamera();");
+  cmd += std::string("__disp1.RescaleTransferFunctionToDataRangeOverTime();");
+
+  //std::cerr << "Python command:" << std::endl;
+  //std::cerr << cmd << std::endl;
+  PyRun_SimpleString(cmd.c_str());
+  // Retrieve Python object for internal storage:
+  PyObject * obj = getPythonObjectFromMain("__obj1");
+  PyObject * disp = getPythonObjectFromMain("__disp1");
+  pushInternal(obj, disp);
+
+  PyGILState_Release(_gil_state);
+}
diff --git a/src/MEDCalc/cmp/MEDPresentationScalarMap.hxx b/src/MEDCalc/cmp/MEDPresentationScalarMap.hxx
new file mode 100644 (file)
index 0000000..d33f610
--- /dev/null
@@ -0,0 +1,40 @@
+// Copyright (C) 2016  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 SRC_MEDCALC_CMP_MEDPRESENTATION_SCALARMAP_HXX_
+#define SRC_MEDCALC_CMP_MEDPRESENTATION_SCALARMAP_HXX_
+
+#include "MEDCALC.hxx"
+#include "MEDPresentation.hxx"
+
+class MEDCALC_EXPORT MEDPresentationScalarMap : public MEDPresentation
+{
+public:
+  MEDPresentationScalarMap(const MEDCALC::ScalarMapParameters& params) :
+    MEDPresentation(params.fieldHandlerId, "MEDPresentationScalarMap")
+  {}
+  virtual ~MEDPresentationScalarMap() {}
+
+protected:
+  virtual void internalGeneratePipeline();
+
+private:
+  MEDCALC::ScalarMapParameters _params;
+};
+
+#endif
diff --git a/src/MEDCalc/cmp/MEDPresentationSlices.cxx b/src/MEDCalc/cmp/MEDPresentationSlices.cxx
new file mode 100644 (file)
index 0000000..164d17c
--- /dev/null
@@ -0,0 +1,7 @@
+#include "MEDPresentationSlices.hxx"
+#include "MEDFactoryClient.hxx"
+
+void
+MEDPresentationSlices::internalGeneratePipeline()
+{
+}
diff --git a/src/MEDCalc/cmp/MEDPresentationSlices.hxx b/src/MEDCalc/cmp/MEDPresentationSlices.hxx
new file mode 100644 (file)
index 0000000..ebabec9
--- /dev/null
@@ -0,0 +1,40 @@
+// Copyright (C) 2016  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 SRC_MEDCALC_CMP_MEDPRESENTATION_SLICES_HXX_
+#define SRC_MEDCALC_CMP_MEDPRESENTATION_SLICES_HXX_
+
+#include "MEDCALC.hxx"
+#include "MEDPresentation.hxx"
+
+class MEDCALC_EXPORT MEDPresentationSlices : public MEDPresentation
+{
+public:
+  MEDPresentationSlices(const MEDCALC::SlicesParameters& params) :
+    MEDPresentation(params.fieldHandlerId, "MEDPresentationSlices")
+  {}
+  virtual ~MEDPresentationSlices() {}
+
+protected:
+  virtual void internalGeneratePipeline();
+
+private:
+  MEDCALC::SlicesParameters _params;
+};
+
+#endif
diff --git a/src/MEDCalc/cmp/MEDPresentationVectorField.cxx b/src/MEDCalc/cmp/MEDPresentationVectorField.cxx
new file mode 100644 (file)
index 0000000..f8d94a5
--- /dev/null
@@ -0,0 +1,25 @@
+#include "MEDPresentationVectorField.hxx"
+
+void
+MEDPresentationVectorField::internalGeneratePipeline()
+{
+  PyGILState_STATE _gil_state = PyGILState_Ensure();
+
+  std::string cmd = std::string("import pvsimple as pvs;");
+  cmd += std::string("__obj1 = pvs.MEDReader(FileName='") + _fileName + std::string("');");
+  cmd += std::string("__disp1 = pvs.Show(__obj1);");
+  cmd += std::string("pvs.ColorBy(__disp1, ('") + _fieldType + std::string("', '") + _fieldName + std::string("'));");
+  cmd += std::string("pvs.GetActiveViewOrCreate('RenderView').ResetCamera();");
+  cmd += std::string("__disp1.RescaleTransferFunctionToDataRangeOverTime();");
+  cmd += std::string("__disp1.SetRepresentationType('3D Glyphs');");
+
+  //std::cerr << "Python command:" << std::endl;
+  //std::cerr << cmd << std::endl;
+  PyRun_SimpleString(cmd.c_str());
+  // Retrieve Python object for internal storage:
+  PyObject * obj = getPythonObjectFromMain("__obj1");
+  PyObject * disp = getPythonObjectFromMain("__disp1");
+  pushInternal(obj, disp);
+
+  PyGILState_Release(_gil_state);
+}
diff --git a/src/MEDCalc/cmp/MEDPresentationVectorField.hxx b/src/MEDCalc/cmp/MEDPresentationVectorField.hxx
new file mode 100644 (file)
index 0000000..f67bd9b
--- /dev/null
@@ -0,0 +1,40 @@
+// Copyright (C) 2016  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 SRC_MEDCALC_CMP_MEDPRESENTATION_VECTORFIELD_HXX_
+#define SRC_MEDCALC_CMP_MEDPRESENTATION_VECTORFIELD_HXX_
+
+#include "MEDCALC.hxx"
+#include "MEDPresentation.hxx"
+
+class MEDCALC_EXPORT MEDPresentationVectorField : public MEDPresentation
+{
+public:
+  MEDPresentationVectorField(const MEDCALC::VectorFieldParameters& params) :
+    MEDPresentation(params.fieldHandlerId, "MEDPresentationVectorField")
+  {}
+  virtual ~MEDPresentationVectorField() {}
+
+protected:
+  virtual void internalGeneratePipeline();
+
+private:
+  MEDCALC::VectorFieldParameters _params;
+};
+
+#endif
index aec534ad0befdbd6bf887a6670965bda05493373..ffad5a4aa64754f52a8ddecb1a8f230824d2b688 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2015  CEA/DEN, EDF R&D
+# Copyright (C) 2012-2016  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
@@ -43,6 +43,7 @@ INCLUDE_DIRECTORIES(
   ${Boost_INCLUDE_DIRS}
   ${PTHREAD_INCLUDE_DIR}
   ${GUI_INCLUDE_DIRS}
+  ${MEDCOUPLING_INCLUDE_DIRS}
   ${CMAKE_CURRENT_BINARY_DIR}
   ${CMAKE_CURRENT_SOURCE_DIR}/dialogs
   ${CMAKE_CURRENT_BINARY_DIR}/dialogs
index 6a9c77204954a103a905c6335439d5207b04439f..636c4d95b036282d71a57d3ec52f52632b662d33 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2015  CEA/DEN, EDF R&D
+// Copyright (C) 2007-2016  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
@@ -119,6 +119,31 @@ void DatasourceController::createActions() {
   actionId = _salomeModule->createStandardAction(label,this,SLOT(OnVisualizeScalarMap()),icon);
   _salomeModule->addActionInPopupMenu(actionId, tr("LAB_VISUALIZE"));
 
+  label = tr("LAB_VISUALIZE_CONTOUR");
+  icon  = tr("ICO_DATASOURCE_VIEW");
+  actionId = _salomeModule->createStandardAction(label,this,SLOT(OnVisualizeContour()),icon);
+  _salomeModule->addActionInPopupMenu(actionId, tr("LAB_VISUALIZE"));
+
+  label = tr("LAB_VISUALIZE_VECTORFIELD");
+  icon  = tr("ICO_DATASOURCE_VIEW");
+  actionId = _salomeModule->createStandardAction(label,this,SLOT(OnVisualizeVectorField()),icon);
+  _salomeModule->addActionInPopupMenu(actionId, tr("LAB_VISUALIZE"));
+
+  label = tr("LAB_VISUALIZE_SLICES");
+  icon  = tr("ICO_DATASOURCE_VIEW");
+  actionId = _salomeModule->createStandardAction(label,this,SLOT(OnVisualizeSlices()),icon);
+  _salomeModule->addActionInPopupMenu(actionId, tr("LAB_VISUALIZE"));
+
+  label = tr("LAB_VISUALIZE_DEFLECTIONSHAPE");
+  icon  = tr("ICO_DATASOURCE_VIEW");
+  actionId = _salomeModule->createStandardAction(label,this,SLOT(OnVisualizeDeflectionShape()),icon);
+  _salomeModule->addActionInPopupMenu(actionId, tr("LAB_VISUALIZE"));
+
+  label = tr("LAB_VISUALIZE_POINTSPRITE");
+  icon  = tr("ICO_DATASOURCE_VIEW");
+  actionId = _salomeModule->createStandardAction(label,this,SLOT(OnVisualizePointSprite()),icon);
+  _salomeModule->addActionInPopupMenu(actionId, tr("LAB_VISUALIZE"));
+
   // Use in workspace
   label = tr("LAB_USE_IN_WORKSPACE");
   icon  = tr("ICO_DATASOURCE_USE");
@@ -338,6 +363,26 @@ void DatasourceController::OnVisualizeScalarMap() {
   this->visualize(DatasourceEvent::EVENT_VIEW_OBJECT_SCALAR_MAP);
 }
 
+void DatasourceController::OnVisualizeContour() {
+  this->visualize(DatasourceEvent::EVENT_VIEW_OBJECT_CONTOUR);
+}
+
+void DatasourceController::OnVisualizeVectorField() {
+  this->visualize(DatasourceEvent::EVENT_VIEW_OBJECT_VECTOR_FIELD);
+}
+
+void DatasourceController::OnVisualizeSlices() {
+  this->visualize(DatasourceEvent::EVENT_VIEW_OBJECT_SLICES);
+}
+
+void DatasourceController::OnVisualizeDeflectionShape() {
+  this->visualize(DatasourceEvent::EVENT_VIEW_OBJECT_DEFLECTION_SHAPE);
+}
+
+void DatasourceController::OnVisualizePointSprite() {
+  this->visualize(DatasourceEvent::EVENT_VIEW_OBJECT_POINT_SPRITE);
+}
+
 void DatasourceController::OnUseInWorkspace() {
   // We need a studyEditor updated on the active study
   _studyEditor->updateActiveStudy();
index a6b2cf68702b3321e0ffd75992de2d677aa923ef..69b9f8cb639f158fceb4cab92e853f310c037293 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2015  CEA/DEN, EDF R&D
+// Copyright (C) 2007-2016  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
@@ -54,7 +54,13 @@ 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
+    // presentations
+    EVENT_VIEW_OBJECT_CONTOUR,
+    EVENT_VIEW_OBJECT_DEFLECTION_SHAPE,
+    EVENT_VIEW_OBJECT_POINT_SPRITE,
     EVENT_VIEW_OBJECT_SCALAR_MAP,
+    EVENT_VIEW_OBJECT_SLICES,
+    EVENT_VIEW_OBJECT_VECTOR_FIELD,
     // these ones forward actions to workspace (and then to python console)
     EVENT_ADD_DATASOURCE,
     EVENT_ADD_IMAGE_AS_DATASOURCE,
@@ -95,6 +101,11 @@ protected slots:
   void OnAddImagesource();
   void OnExpandField();
   void OnVisualizeScalarMap();
+  void OnVisualizeContour();
+  void OnVisualizeVectorField();
+  void OnVisualizeSlices();
+  void OnVisualizeDeflectionShape();
+  void OnVisualizePointSprite();
   void OnUseInWorkspace();
   void OnChangeUnderlyingMesh();
   void OnInterpolateField();
index 3f12bcf9b7d099fce3a061cf024ba5c1fc578cc0..c3e7b4fbbc7f8df147e3af3a8955556d03e3680f 100644 (file)
@@ -5,7 +5,27 @@
     <name>DatasourceController</name>
     <message>
       <source>MEDPresentationScalarMap</source>
-      <translation>Scalar Map</translation>
+      <translation>Scalar map</translation>
+    </message>
+    <message>
+      <source>MEDPresentationContour</source>
+      <translation>Contour</translation>
+    </message>
+    <message>
+      <source>MEDPresentationVectorField</source>
+      <translation>Vector field</translation>
+    </message>
+    <message>
+      <source>MEDPresentationSlices</source>
+      <translation>Slices</translation>
+    </message>
+    <message>
+      <source>MEDPresentationDeflectionShape</source>
+      <translation>Deflection shape</translation>
+    </message>
+    <message>
+      <source>MEDPresentationPointSprite</source>
+      <translation>Point sprite</translation>
     </message>
     <message>
       <location filename="MEDCALC/gui/DatasourceController.cxx" line="45"/>
       <source>LAB_VISUALIZE_SCALARMAP</source>
       <translation>Scalar map</translation>
     </message>
+    <message>
+      <source>LAB_VISUALIZE_CONTOUR</source>
+      <translation>Contour</translation>
+    </message>
+    <message>
+      <source>LAB_VISUALIZE_VECTORFIELD</source>
+      <translation>Vector field</translation>
+    </message>
+    <message>
+      <source>LAB_VISUALIZE_SLICES</source>
+      <translation>Slices</translation>
+    </message>
+    <message>
+      <source>LAB_VISUALIZE_DEFLECTIONSHAPE</source>
+      <translation>Deflection shape</translation>
+    </message>
+    <message>
+      <source>LAB_VISUALIZE_POINTSPRITE</source>
+      <translation>Point sprite</translation>
+    </message>
     <message>
       <location filename="MEDCALC/gui/DatasourceController.cxx" line="69"/>
       <source>LAB_VISUALIZE</source>
index c8d917f5be4c753a5fd6be7e5065580be34c4043..3a1595300cad2ea66ab1ffd2727450ebfb5844b0 100644 (file)
@@ -7,6 +7,26 @@
       <source>MEDPresentationScalarMap</source>
       <translation>Carte scalaire</translation>
     </message>
+    <message>
+      <source>MEDPresentationContour</source>
+      <translation>Contour</translation>
+    </message>
+    <message>
+      <source>MEDPresentationVectorField</source>
+      <translation>Champ de vecteurs</translation>
+    </message>
+    <message>
+      <source>MEDPresentationSlices</source>
+      <translation>Coupes</translation>
+    </message>
+    <message>
+      <source>MEDPresentationDeflectionShape</source>
+      <translation>Déformée</translation>
+    </message>
+    <message>
+      <source>MEDPresentationPointSprite</source>
+      <translation>Point Sprite</translation>
+    </message>
     <message>
       <location filename="MEDCALC/gui/DatasourceController.cxx" line="45"/>
       <source>LAB_ADD_DATA_SOURCE</source>
       <source>LAB_VISUALIZE_SCALARMAP</source>
       <translation>Carte scalaire</translation>
     </message>
+    <message>
+      <source>LAB_VISUALIZE_CONTOUR</source>
+      <translation>Contour</translation>
+    </message>
+    <message>
+      <source>LAB_VISUALIZE_VECTORFIELD</source>
+      <translation>Champ de vecteurs</translation>
+    </message>
+    <message>
+      <source>LAB_VISUALIZE_SLICES</source>
+      <translation>Coupes</translation>
+    </message>
+    <message>
+      <source>LAB_VISUALIZE_DEFLECTIONSHAPE</source>
+      <translation>Déformée</translation>
+    </message>
+    <message>
+      <source>LAB_VISUALIZE_POINTSPRITE</source>
+      <translation>Point sprite</translation>
+    </message>
     <message>
       <location filename="MEDCALC/gui/DatasourceController.cxx" line="69"/>
       <source>LAB_VISUALIZE</source>
index b4c6bd2db9f30861965d5f5c46da65e1beb09328..643bd56f16f53815876720e579d016b45ade9ebc 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2015  CEA/DEN, EDF R&D
+// Copyright (C) 2007-2016  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
@@ -461,6 +461,16 @@ void WorkspaceController::_viewItemList(QStringList itemNameIdList) {
   _consoleDriver->exec(commands);
 }
 
+QString
+WorkspaceController::_getViewMode() {
+#define stringify( name ) # name
+
+  QString viewMode = stringify(MEDCALC::VIEW_MODE_NEW_LAYOUT); // :TODO: change this (get value from dedicated dialog)
+  viewMode.replace("::", ".");
+
+  return viewMode;
+}
+
 /**
  * This slot can process the event coming from the
  * DatasourceController. The connection between the datasource signal
@@ -506,16 +516,47 @@ void WorkspaceController::processDatasourceEvent(const DatasourceEvent * event)
           QCHARSTAR(event->objectalias));
   }
   else if ( event->eventtype == DatasourceEvent::EVENT_VIEW_OBJECT_SCALAR_MAP ) {
-    QStringList commands;
-
-#define stringify( name ) # name
-    QString viewMode = stringify(MEDCALC::VIEW_MODE_NEW_LAYOUT); // :TODO: change this (get value from dedicated dialog)
-    viewMode.replace("::", ".");
-
+    QString viewMode = _getViewMode();
     MEDCALC::FieldHandler* fieldHandler = dataObject->getFieldHandler();
+    QStringList commands;
     commands += QString("medcalc.MakeScalarMap(accessField(%1), %2)").arg(fieldHandler->id).arg(viewMode);
     _consoleDriver->exec(commands);
   }
+  else if ( event->eventtype == DatasourceEvent::EVENT_VIEW_OBJECT_CONTOUR ) {
+    QString viewMode = _getViewMode();
+    MEDCALC::FieldHandler* fieldHandler = dataObject->getFieldHandler();
+    QStringList commands;
+    commands += QString("medcalc.MakeContour(accessField(%1), %2)").arg(fieldHandler->id).arg(viewMode);
+    _consoleDriver->exec(commands);
+  }
+  else if ( event->eventtype == DatasourceEvent::EVENT_VIEW_OBJECT_VECTOR_FIELD ) {
+    QString viewMode = _getViewMode();
+    MEDCALC::FieldHandler* fieldHandler = dataObject->getFieldHandler();
+    QStringList commands;
+    commands += QString("medcalc.MakeVectorField(accessField(%1), %2)").arg(fieldHandler->id).arg(viewMode);
+    _consoleDriver->exec(commands);
+  }
+  else if ( event->eventtype == DatasourceEvent::EVENT_VIEW_OBJECT_SLICES ) {
+    QString viewMode = _getViewMode();
+    MEDCALC::FieldHandler* fieldHandler = dataObject->getFieldHandler();
+    QStringList commands;
+    commands += QString("medcalc.MakeSlices(accessField(%1), %2)").arg(fieldHandler->id).arg(viewMode);
+    _consoleDriver->exec(commands);
+  }
+  else if ( event->eventtype == DatasourceEvent::EVENT_VIEW_OBJECT_DEFLECTION_SHAPE ) {
+    QString viewMode = _getViewMode();
+    MEDCALC::FieldHandler* fieldHandler = dataObject->getFieldHandler();
+    QStringList commands;
+    commands += QString("medcalc.MakeDeflectionShape(accessField(%1), %2)").arg(fieldHandler->id).arg(viewMode);
+    _consoleDriver->exec(commands);
+  }
+  else if ( event->eventtype == DatasourceEvent::EVENT_VIEW_OBJECT_POINT_SPRITE ) {
+    QString viewMode = _getViewMode();
+    MEDCALC::FieldHandler* fieldHandler = dataObject->getFieldHandler();
+    QStringList commands;
+    commands += QString("medcalc.MakePointSprite(accessField(%1), %2)").arg(fieldHandler->id).arg(viewMode);
+    _consoleDriver->exec(commands);
+  }
   else if ( event->eventtype == DatasourceEvent::EVENT_ADD_DATASOURCE ) {
     QStringList commands;
     commands += QString("medcalc.LoadDataSource('%1')").arg(event->objectalias);
index cfbcb8d21b36daa09d6ba9608d8f640e295d2584..969fab86a63015a1fe5101b341973d9ad8d1079c 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2015  CEA/DEN, EDF R&D
+// Copyright (C) 2007-2016  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
@@ -75,6 +75,7 @@ private:
   void _saveItemList(QStringList itemNameIdList);
   void _removeItemList(QStringList itemNameIdList);
   void _viewItemList(QStringList itemNameIdList);
+  QString _getViewMode();
 
 private:
   XmedConsoleDriver * _consoleDriver;
index 49ba854617a6ee5d738ae3a7436c4f9fd8d32fef..3d17786061bf8e44e5066613306071c5e4a4ff04 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2015  CEA/DEN, EDF R&D
+# Copyright (C) 2015, 2016  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
@@ -40,7 +40,7 @@ from medio import LoadImageAsDataSource
 
 # Presentations
 from medpresentation import MakeScalarMap
-from medpresentation import MakeIsoSurface
+from medpresentation import MakeContour
 from medpresentation import MakeVectorField
 from medpresentation import MakeSlices
 from medpresentation import MakeDeflectionShape
index 0395826b586f6d214a8a72bfd7147bb567ae0f44..7c665b505220a0cc7075aae54d222d3e5fd29eb1 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2011-2015  CEA/DEN, EDF R&D
+# Copyright (C) 2011-2016  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
@@ -36,22 +36,34 @@ def MakeScalarMap(proxy, viewMode=MEDCALC.VIEW_MODE_REPLACE):
   notifyGui_addPresentation(proxy.id, presentation_id)
 #
 
-def MakeIsoSurface():
+def MakeContour(proxy, viewMode=MEDCALC.VIEW_MODE_REPLACE):
   print "Not implemented yet"
+  #params = MEDCALC.ContourParameters(proxy.id, viewMode)
+  #presentation_id = __manager.makeContour(params)
+  #notifyGui_addPresentation(proxy.id, presentation_id)
 #
 
-def MakeVectorField():
-  print "Not implemented yet"
+def MakeVectorField(proxy, viewMode=MEDCALC.VIEW_MODE_REPLACE):
+  params = MEDCALC.VectorFieldParameters(proxy.id, viewMode)
+  presentation_id = __manager.makeVectorField(params)
+  notifyGui_addPresentation(proxy.id, presentation_id)
 #
 
-def MakeSlices():
+def MakeSlices(proxy, viewMode=MEDCALC.VIEW_MODE_REPLACE):
   print "Not implemented yet"
+  #params = MEDCALC.SlicesParameters(proxy.id, viewMode)
+  #presentation_id = __manager.makeSlices(params)
+  #notifyGui_addPresentation(proxy.id, presentation_id)
 #
 
-def MakeDeflectionShape():
-  print "Not implemented yet"
+def MakeDeflectionShape(proxy, viewMode=MEDCALC.VIEW_MODE_REPLACE):
+  params = MEDCALC.DeflectionShapeParameters(proxy.id, viewMode)
+  presentation_id = __manager.makeDeflectionShape(params)
+  notifyGui_addPresentation(proxy.id, presentation_id)
 #
 
-def MakePointSprite():
-  print "Not implemented yet"
+def MakePointSprite(proxy, viewMode=MEDCALC.VIEW_MODE_REPLACE):
+  params = MEDCALC.PointSpriteParameters(proxy.id, viewMode)
+  presentation_id = __manager.makePointSprite(params)
+  notifyGui_addPresentation(proxy.id, presentation_id)
 #