1 // Copyright (C) 2011-2015 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
20 #include "MEDPresentationManager_i.hxx"
21 #include "MEDFactoryClient.hxx"
22 #include "MEDPresentation.hxx"
24 MEDPresentationManager_i* MEDPresentationManager_i::_instance = NULL;
26 MEDPresentationManager_i*
27 MEDPresentationManager_i::getInstance() {
28 if ( _instance == NULL )
29 _instance = new MEDPresentationManager_i();
33 MEDPresentationManager_i::MEDPresentationManager_i()
37 MEDPresentationManager_i::~MEDPresentationManager_i()
40 std::vector<MEDPresentation*>::iterator itr = this->_presentations.begin();
41 for ( ; itr != this->_presentations.end(); ++itr) {
45 this->_presentations.clear();
49 TypeID MEDPresentationManager_i::GenerateID()
51 static TypeID START_ID = -1;
59 MEDPresentationManager_i::setPresentationProperty(TypeID presentationID, const char * propName, const char * propValue)
61 if (_presentations.find(presentationID) != _presentations.end())
63 MEDPresentation * pres(_presentations[presentationID]);
64 pres->setProperty(propName, propValue);
68 std::cerr << "setPresentationProperty(): presentation not found!!" << std::endl;
73 MEDPresentationManager_i::makeScalarMap(const MEDCALC::ScalarMapParameters& params)
75 MEDCALC::MEDDataManager_ptr dataManager(MEDFactoryClient::getDataManager());
77 TypeID fieldHandlerId = params.fieldHandlerId;
78 MEDCALC::MEDPresentationViewMode viewMode = params.viewMode;
80 MEDCALC::FieldHandler* fieldHandler = dataManager->getFieldHandler(fieldHandlerId);
81 MEDCALC::MeshHandler* meshHandler = dataManager->getMesh(fieldHandler->meshid);
82 MEDCALC::DatasourceHandler* dataSHandler = dataManager->getDatasourceHandlerFromID(meshHandler->sourceid);
84 std::cout << "\tfieldHandlerId: " << fieldHandlerId << std::endl;
85 std::cout << "\tviewMode: " << viewMode << std::endl;
86 std::cout << "\tfileName: " << dataSHandler->uri << std::endl;
87 std::cout << "\tfiedName: " << fieldHandler->fieldname << std::endl;
89 // Create a new presentation instance
90 TypeID newID = MEDPresentationManager_i::GenerateID();
91 MEDPresentationScalarMap * scalarMap = new MEDPresentationScalarMap(fieldHandler, true); // on stack or on heap?? stack for now
92 _presentations.insert( std::pair<TypeID, MEDPresentation *>(newID, scalarMap) );
94 scalarMap->generatePipeline();