]> SALOME platform Git repositories - modules/med.git/blob - src/MEDCalc/cmp/MEDPresentation.hxx
Salome HOME
[MEDCalc]: deletion of an existing presentation
[modules/med.git] / src / MEDCalc / cmp / MEDPresentation.hxx
1 // Copyright (C) 2011-2016  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 // Authors: A Bruneton (CEA), C Aguerre (EdF)
20
21 #ifndef SRC_MEDCALC_CMP_MEDPRESENTATION_HXX_
22 #define SRC_MEDCALC_CMP_MEDPRESENTATION_HXX_
23
24 #include "MEDCouplingRefCountObject.hxx"
25 #include <Python.h>
26 #include "MEDCALC.hxx"
27
28 #include <SALOMEconfig.h>
29 #include CORBA_SERVER_HEADER(MEDDataManager)
30 #include CORBA_SERVER_HEADER(MEDPresentationManager)
31
32 #include <vector>
33 #include <map>
34 #include <string>
35
36 class MEDCALC_EXPORT MEDPresentation
37 {
38   friend class MEDPresentationManager_i;
39
40 public:
41
42   typedef ::CORBA::Long TypeID;
43
44   virtual ~MEDPresentation();
45
46   void setProperty(const std::string& propName, const std::string& propValue);
47   const std::string getProperty(const std::string& propName) const;
48
49 protected:
50   typedef std::pair<int, PyObject *> PyObjectId;
51
52   MEDPresentation(MEDPresentation::TypeID fieldHandlerId, const std::string& name);
53   std::string getRenderViewCommand(MEDCALC::MEDPresentationViewMode viewMode) const;
54   std::string getResetCameraCommand() const;
55   std::string getColorMapCommand(MEDCALC::MEDPresentationColorMap colorMap) const;
56
57   virtual void internalGeneratePipeline() = 0;
58   PyObject* getPythonObjectFromMain(const char* var) const;
59   void pushPyObjects(PyObjectId obj, PyObjectId disp);
60   void pushAndExecPyLine(const std::string & lin);
61
62   MEDPresentation::TypeID getID() const { return _fieldHandlerId; }
63
64   static int GeneratePythonId();
65
66 private:
67
68   std::string getFieldTypeString(MEDCoupling::TypeOfField fieldType) const;
69
70   // The following functions are reserved to friend class MEDPresentationManager
71   void generatePipeline();
72
73   template<typename PresentationType, typename PresentationParameters>
74   void updatePipeline(PresentationParameters params);
75
76 protected:
77   std::string _fileName;
78   std::string _fieldName;
79   std::string _fieldType;
80
81   ///! Identifier (in the Python dump) of the render view
82   int _renderViewPyId;
83
84 private:
85   MEDPresentation::TypeID _fieldHandlerId;
86
87   ///! Pipeline elements
88   std::vector<PyObjectId> _pipeline;
89
90   ///! Corresponding display object, if any:
91   std::vector<PyObjectId> _display;
92
93   ///! Presentation properties <key,value>
94   std::map<std::string, std::string> _properties;
95 };
96
97 #include "MEDPresentation.txx"
98
99 #endif /* SRC_MEDCALC_CMP_MEDPRESENTATION_HXX_ */