1 // Copyright (C) 2011-2016 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Authors: A Bruneton (CEA), C Aguerre (EdF)
21 #ifndef SRC_MEDCALC_CMP_MEDPRESENTATION_HXX_
22 #define SRC_MEDCALC_CMP_MEDPRESENTATION_HXX_
24 #include "MEDCouplingRefCountObject.hxx"
26 #include "MEDCALC.hxx"
28 #include <SALOMEconfig.h>
29 #include CORBA_SERVER_HEADER(MEDDataManager)
30 #include CORBA_SERVER_HEADER(MEDPresentationManager)
36 class MEDCALC_EXPORT MEDPresentation
38 friend class MEDPresentationManager_i;
42 typedef ::CORBA::Long TypeID;
44 virtual ~MEDPresentation();
46 void setProperty(const std::string& propName, const std::string& propValue);
47 const std::string getProperty(const std::string& propName) const;
49 void activateView() const;
52 typedef std::pair<int, PyObject *> PyObjectId;
54 MEDPresentation(MEDPresentation::TypeID fieldHandlerId, const std::string& name);
55 std::string getRenderViewCommand(MEDCALC::MEDPresentationViewMode viewMode) const;
56 std::string getResetCameraCommand() const;
57 std::string getColorMapCommand(MEDCALC::MEDPresentationColorMap colorMap) const;
59 virtual void internalGeneratePipeline() = 0;
60 PyObject* getPythonObjectFromMain(const char* var) const;
61 void pushPyObjects(PyObjectId obj, PyObjectId disp);
62 void pushAndExecPyLine(const std::string & lin);
64 MEDPresentation::TypeID getID() const { return _fieldHandlerId; }
65 long getPyViewID() const { return _renderViewPyId; }
67 static int GeneratePythonId();
71 std::string getFieldTypeString(MEDCoupling::TypeOfField fieldType) const;
73 // The following functions are reserved to friend class MEDPresentationManager
74 void generatePipeline();
76 template<typename PresentationType, typename PresentationParameters>
77 void updatePipeline(PresentationParameters params);
80 std::string _fileName;
81 std::string _fieldName;
82 std::string _fieldType;
84 ///! Identifier (in the Python dump) of the render view
88 MEDPresentation::TypeID _fieldHandlerId;
90 ///! Pipeline elements
91 std::vector<PyObjectId> _pipeline;
93 ///! Corresponding display object, if any:
94 std::vector<PyObjectId> _display;
96 ///! Presentation properties <key,value>
97 std::map<std::string, std::string> _properties;
100 #include "MEDPresentation.txx"
102 #endif /* SRC_MEDCALC_CMP_MEDPRESENTATION_HXX_ */