Salome HOME
First scalar map implementation. No GUI (tree browser) update.
[modules/med.git] / src / MEDCalc / cmp / MEDPresentation.hxx
1 // Copyright (C) 2011-2015  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 <Python.h>
25 #include "MEDCALC.hxx"
26
27 #include <SALOMEconfig.h>
28 #include CORBA_SERVER_HEADER(MEDDataManager)
29 #include CORBA_SERVER_HEADER(MEDPresentationManager)
30
31 #include <vector>
32 #include <string>
33
34 class MEDCALC_EXPORT MEDPresentation
35 {
36 public:
37   friend class MEDPresentationManager_i;
38
39   MEDPresentation(MEDCALC::FieldHandler* fieldHdl):
40     _fieldHandler(fieldHdl), _pipeline(0), _display(0)
41   {}
42   virtual ~MEDPresentation() {}
43
44   void setProperty(const char * propName, const char * propValue);
45   std::string getFieldTypeString();
46
47 protected:
48
49   void generatePipeline();
50   virtual void internalGeneratePipeline() = 0;
51   PyObject * getPythonObjectFromMain(const char * var);
52   void pushInternal(PyObject * obj, PyObject * disp = NULL);
53
54 protected:
55
56   ///! field reference - borrowed.
57   MEDCALC::FieldHandler* _fieldHandler;
58
59   ///! Pipeline elements
60   std::vector< PyObject * > _pipeline;
61
62   ///! Corresponding display object, if any:
63   std::vector< PyObject * > _display;
64 };
65
66 class MEDCALC_EXPORT MEDPresentationScalarMap :  public MEDPresentation
67 {
68 public:
69   MEDPresentationScalarMap(MEDCALC::FieldHandler* fieldHdl, bool wireframe) :
70     MEDPresentation(fieldHdl),
71     _isWireframe(wireframe)
72   {}
73   virtual ~MEDPresentationScalarMap() {}
74
75 protected:
76   virtual void internalGeneratePipeline();
77
78 private:
79   bool _isWireframe;
80 };
81
82 #endif /* SRC_MEDCALC_CMP_MEDPRESENTATION_HXX_ */