]> SALOME platform Git repositories - modules/med.git/blob - src/MEDCalc/cmp/MEDPresentationManager_i.cxx
Salome HOME
fix medcoupling api changes
[modules/med.git] / src / MEDCalc / cmp / MEDPresentationManager_i.cxx
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
20 #include "MEDPresentationManager_i.hxx"
21 #include "MEDFactoryClient.hxx"
22
23 // presentations
24 #include "MEDPresentationScalarMap.hxx"
25 #include "MEDPresentationContour.hxx"
26 #include "MEDPresentationVectorField.hxx"
27 #include "MEDPresentationSlices.hxx"
28 #include "MEDPresentationDeflectionShape.hxx"
29 #include "MEDPresentationPointSprite.hxx"
30
31 #include <iostream>
32
33 MEDPresentationManager_i* MEDPresentationManager_i::_instance = NULL;
34
35 MEDPresentationManager_i*
36 MEDPresentationManager_i::getInstance() {
37   if ( _instance == NULL )
38     _instance = new MEDPresentationManager_i();
39   return _instance;
40 }
41
42 MEDPresentationManager_i::MEDPresentationManager_i()
43 {
44 }
45
46 MEDPresentationManager_i::~MEDPresentationManager_i()
47 {
48   /*
49   std::vector<MEDPresentation*>::iterator itr = this->_presentations.begin();
50   for ( ; itr != this->_presentations.end(); ++itr) {
51     delete *itr;
52     *itr = NULL;
53   }
54   this->_presentations.clear();
55   */
56 }
57
58 MEDPresentation::TypeID
59 MEDPresentationManager_i::GenerateID()
60 {
61   static MEDPresentation::TypeID START_ID = -1;
62   START_ID++;
63   return START_ID;
64 }
65
66 void
67 MEDPresentationManager_i::setPresentationProperty(MEDPresentation::TypeID presentationID, const char * propName, const char * propValue)
68 {
69   if (_presentations.find(presentationID) != _presentations.end())
70     {
71       MEDPresentation * pres(_presentations[presentationID]);
72       pres->setProperty(propName, propValue);
73     }
74   else
75     {
76       std::cerr << "setPresentationProperty(): presentation not found!!" << std::endl;
77     }
78 }
79
80 char*
81 MEDPresentationManager_i::getPresentationProperty(MEDPresentation::TypeID presentationID, const char* propName)
82 {
83   if (_presentations.find(presentationID) != _presentations.end()) {
84     MEDPresentation* pres = _presentations[presentationID];
85     return (char*) pres->getProperty(propName).c_str();
86   }
87   else {
88     std::cerr << "getPresentationProperty(): presentation not found!!" << std::endl;
89     return (char*) "";
90   }
91 }
92
93 MEDPresentation::TypeID
94 MEDPresentationManager_i::makeScalarMap(const MEDCALC::ScalarMapParameters& params)
95 {
96   return _makePresentation<MEDPresentationScalarMap>(params);
97 }
98
99 MEDPresentation::TypeID
100 MEDPresentationManager_i::makeContour(const MEDCALC::ContourParameters& params)
101 {
102   return _makePresentation<MEDPresentationContour>(params);
103 }
104
105 MEDPresentation::TypeID
106 MEDPresentationManager_i::makeVectorField(const MEDCALC::VectorFieldParameters& params)
107 {
108   return _makePresentation<MEDPresentationVectorField>(params);
109 }
110
111 MEDPresentation::TypeID
112 MEDPresentationManager_i::makeSlices(const MEDCALC::SlicesParameters& params)
113 {
114   return _makePresentation<MEDPresentationSlices>(params);
115 }
116
117 MEDPresentation::TypeID
118 MEDPresentationManager_i::makeDeflectionShape(const MEDCALC::DeflectionShapeParameters& params)
119 {
120   return _makePresentation<MEDPresentationDeflectionShape>(params);
121 }
122
123 MEDPresentation::TypeID
124 MEDPresentationManager_i::makePointSprite(const MEDCALC::PointSpriteParameters& params)
125 {
126   return _makePresentation<MEDPresentationPointSprite>(params);
127 }