Salome HOME
Merge 'abn/V8_1_fix' branch into V8_1_BR.
[modules/med.git] / src / MEDCalc / cmp / MEDPresentation.hxx
index b60bb47b9411fe5b2ad4569483ef26f56dea6944..800b7cd91c86e4a74a2bc52819548418e34f6027 100644 (file)
@@ -40,6 +40,8 @@ class MEDCALC_EXPORT MEDPresentation
 public:
   typedef ::CORBA::Long TypeID;
 
+  virtual void initFieldMeshInfos();
+
   virtual ~MEDPresentation();
 
   static const std::string PROP_NAME;                 // name of the presentation
@@ -55,7 +57,10 @@ public:
   virtual void setIntProperty(const std::string& propName, const int propValue);
   int getIntProperty(const std::string& propName) const;
 
-  void activateView();  // non const because generates a Python trace
+  // returns True if the view was still alive, False if it must have been recreated
+  // because the user closed it.
+  bool activateView();
+  virtual void recreateViewSetup();
 
   void dumpIntProperties() const;
   void dumpStringProperties() const;
@@ -69,7 +74,7 @@ protected:
   typedef std::pair<int, PyObject *> PyObjectId;
   static int GeneratePythonId();
 
-  MEDPresentation(MEDPresentation::TypeID fieldHandlerId, const std::string& name,
+  MEDPresentation(MEDPresentation::TypeID handlerId, const std::string& name,
                   const MEDCALC::ViewModeType viewMode,
                   const MEDCALC::ColorMapType colorMap,
                   const MEDCALC::ScalarBarRangeType sbRange);
@@ -80,7 +85,7 @@ protected:
   void createSource();
   void selectFieldComponent();
   void showObject();
-  void colorBy(const std::string & fieldType);
+  void colorBy();
   void showScalarBar();
   void rescaleTransferFunction();
   void selectColorMap();
@@ -89,19 +94,15 @@ protected:
 
   virtual void internalGeneratePipeline();
   PyObject* getPythonObjectFromMain(const char* var) const;
-//  void pushPyObjects(PyObjectId obj, PyObjectId disp);
   void execPyLine(const std::string & lin);
   void pushAndExecPyLine(const std::string & lin);
 
-  MEDPresentation::TypeID getID() const { return _fieldHandlerId; }
+  MEDPresentation::TypeID getID() const { return _handlerId; }
 
   void fillAvailableFieldComponents();
   void applyCellToPointIfNeeded();
-  void convertTo3DVectorField();
-//  double computeCellAverageSize();
-  //void computeFieldRange
-
-//  virtual MEDCALC::ViewModeType getViewMode() = 0;
+  void extractFileName(const std::string& name);
+//  void convertTo3DVectorField();
 
   template<typename PresentationType, typename PresentationParameters>
   void updateComponent(const std::string& newCompo);
@@ -119,7 +120,7 @@ protected:
   void setParameters(const PresentationParameters& params);
 
 private:
-  std::string getFieldTypeString(MEDCoupling::TypeOfField fieldType) const;
+  std::string getPVFieldTypeString(MEDCoupling::TypeOfField fieldType) const;
 
   // The following functions are reserved to friend class MEDPresentationManager
   void generatePipeline();
@@ -131,9 +132,15 @@ protected:
   std::string _meshName;
   std::string _fileName;
   std::string _fieldName;
-  std::string _fieldType;
 
-  MEDPresentation::TypeID _fieldHandlerId;
+  ///! MEDCoupling field type (ON_NODES, ON_CELLS, ON_GAUSS_PT, ON_GAUSS_NE
+  MEDCoupling::TypeOfField _mcFieldType;
+  ///! ParaView field type: "CELLS" or "POINTS"
+  std::string _pvFieldType;
+  ///! ParaView field type: "CELLS" or "POINTS" used in the ColorBy method. Not necessarily equal to _pvFieldType.
+  std::string _colorByType;
+
+  MEDPresentation::TypeID _handlerId;  // either a field or a mesh id (a field ID though, most of the time)
 
   int _selectedComponentIndex;
   MEDCALC::ViewModeType _viewMode;
@@ -154,12 +161,6 @@ protected:
   std::string _rangeVar;
 
 private:
-  ///! Pipeline elements
-//  std::vector<PyObjectId> _pipeline;
-
-  ///! Corresponding display object, if any:
-//  std::vector<PyObjectId> _display;
-
   ///! Presentation properties <key,value>
   std::map<std::string, std::string> _propertiesStr;
   std::map<std::string, int> _propertiesInt;