From: vsr Date: Fri, 25 Mar 2016 11:11:44 +0000 (+0300) Subject: Merge branch 'V7_dev' X-Git-Tag: V8_1_0a1~14 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0d0b1478f016ab0c9cf4a95ba79e0c7455cf2137;p=modules%2Fmed.git Merge branch 'V7_dev' --- 0d0b1478f016ab0c9cf4a95ba79e0c7455cf2137 diff --cc doc/tut/addfields/addition.py index a762ca992,e0544b085..4b3afe68d --- a/doc/tut/addfields/addition.py +++ b/doc/tut/addfields/addition.py @@@ -1,4 -1,4 +1,4 @@@ - # Copyright (C) 2012-2015 CEA/DEN, EDF R&D -# Copyright (C) 2012-2016 CEA/DEN, EDF R&D, OPEN CASCADE ++# Copyright (C) 2012-2016 CEA/DEN, EDF R&D # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public diff --cc doc/tut/addfields/operations.py index 6002a9b5f,cf3a53691..efd59f76e --- a/doc/tut/addfields/operations.py +++ b/doc/tut/addfields/operations.py @@@ -1,6 -1,6 +1,6 @@@ #!/usr/bin/env python # -*- coding: iso-8859-1 -*- - # Copyright (C) 2012-2015 CEA/DEN, EDF R&D -# Copyright (C) 2012-2016 CEA/DEN, EDF R&D, OPEN CASCADE ++# Copyright (C) 2012-2016 CEA/DEN, EDF R&D # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public diff --cc src/MEDCalc/cmp/MEDPresentationContour.cxx index 8db627f45,000000000..c704099ee mode 100644,000000..100644 --- a/src/MEDCalc/cmp/MEDPresentationContour.cxx +++ b/src/MEDCalc/cmp/MEDPresentationContour.cxx @@@ -1,28 -1,0 +1,47 @@@ ++// Copyright (C) 2016 CEA/DEN, EDF R&D ++// ++// This library is free software; you can redistribute it and/or ++// modify it under the terms of the GNU Lesser General Public ++// License as published by the Free Software Foundation; either ++// version 2.1 of the License, or (at your option) any later version. ++// ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++// Lesser General Public License for more details. ++// ++// You should have received a copy of the GNU Lesser General Public ++// License along with this library; if not, write to the Free Software ++// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++// ++// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com ++// ++ +#include "MEDPresentationContour.hxx" + +void +MEDPresentationContour::internalGeneratePipeline() +{ + PyGILState_STATE _gil_state = PyGILState_Ensure(); + + std::string cmd = std::string("import pvsimple as pvs;"); + cmd += getRenderViewCommand(_params.viewMode); // define __view1 + + cmd += std::string("__obj1 = pvs.MEDReader(FileName='") + _fileName + std::string("');"); + cmd += std::string("__isovolume1 = pvs.IsoVolume(Input=__obj1);"); + cmd += std::string("__disp1 = pvs.Show(__isovolume1, __view1);"); + cmd += std::string("pvs.ColorBy(__disp1, ('") + _fieldType + std::string("', '") + _fieldName + std::string("'));"); + cmd += std::string("__disp1.SetScalarBarVisibility(__view1, True);"); + cmd += std::string("__disp1.RescaleTransferFunctionToDataRangeOverTime();"); + cmd += std::string("pvs.Render();"); + + //std::cerr << "Python command:" << std::endl; + //std::cerr << cmd << std::endl; + PyRun_SimpleString(cmd.c_str()); + // Retrieve Python object for internal storage: + PyObject* obj = getPythonObjectFromMain("__isovolume1"); + PyObject* disp = getPythonObjectFromMain("__disp1"); + pushInternal(obj, disp); + + PyGILState_Release(_gil_state); +} diff --cc src/MEDCalc/cmp/MEDPresentationContour.hxx index 22b9cb3f1,000000000..555dfe770 mode 100644,000000..100644 --- a/src/MEDCalc/cmp/MEDPresentationContour.hxx +++ b/src/MEDCalc/cmp/MEDPresentationContour.hxx @@@ -1,40 -1,0 +1,41 @@@ +// Copyright (C) 2016 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com ++// + +#ifndef SRC_MEDCALC_CMP_MEDPRESENTATION_CONTOUR_HXX_ +#define SRC_MEDCALC_CMP_MEDPRESENTATION_CONTOUR_HXX_ + +#include "MEDCALC.hxx" +#include "MEDPresentation.hxx" + +class MEDCALC_EXPORT MEDPresentationContour : public MEDPresentation +{ +public: + MEDPresentationContour(const MEDCALC::ContourParameters& params) : + MEDPresentation(params.fieldHandlerId, "MEDPresentationContour"), _params(params) + {} + virtual ~MEDPresentationContour() {} + +protected: + virtual void internalGeneratePipeline(); + +private: + MEDCALC::ContourParameters _params; +}; + +#endif diff --cc src/MEDCalc/cmp/MEDPresentationDeflectionShape.cxx index 27a346669,000000000..65da5e468 mode 100644,000000..100644 --- a/src/MEDCalc/cmp/MEDPresentationDeflectionShape.cxx +++ b/src/MEDCalc/cmp/MEDPresentationDeflectionShape.cxx @@@ -1,28 -1,0 +1,47 @@@ ++// Copyright (C) 2016 CEA/DEN, EDF R&D ++// ++// This library is free software; you can redistribute it and/or ++// modify it under the terms of the GNU Lesser General Public ++// License as published by the Free Software Foundation; either ++// version 2.1 of the License, or (at your option) any later version. ++// ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++// Lesser General Public License for more details. ++// ++// You should have received a copy of the GNU Lesser General Public ++// License along with this library; if not, write to the Free Software ++// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++// ++// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com ++// ++ +#include "MEDPresentationDeflectionShape.hxx" + +void +MEDPresentationDeflectionShape::internalGeneratePipeline() +{ + PyGILState_STATE _gil_state = PyGILState_Ensure(); + + std::string cmd = std::string("import pvsimple as pvs;"); + cmd += getRenderViewCommand(_params.viewMode); // define __view1 + + cmd += std::string("__obj1 = pvs.MEDReader(FileName='") + _fileName + std::string("');"); + cmd += std::string("__warpByVector1 = pvs.WarpByVector(Input=__obj1);"); + cmd += std::string("__disp1 = pvs.Show(__warpByVector1, __view1);"); + cmd += std::string("pvs.ColorBy(__disp1, ('") + _fieldType + std::string("', '") + _fieldName + std::string("'));"); + cmd += std::string("__disp1.SetScalarBarVisibility(__view1, True);"); + cmd += std::string("__disp1.RescaleTransferFunctionToDataRangeOverTime();"); + cmd += std::string("pvs.Render();"); + + //std::cerr << "Python command:" << std::endl; + //std::cerr << cmd << std::endl; + PyRun_SimpleString(cmd.c_str()); + // Retrieve Python object for internal storage: + PyObject* obj = getPythonObjectFromMain("__warpByVector1"); + PyObject* disp = getPythonObjectFromMain("__disp1"); + pushInternal(obj, disp); + + PyGILState_Release(_gil_state); +} diff --cc src/MEDCalc/cmp/MEDPresentationDeflectionShape.hxx index e5a121bb7,000000000..9d614bf19 mode 100644,000000..100644 --- a/src/MEDCalc/cmp/MEDPresentationDeflectionShape.hxx +++ b/src/MEDCalc/cmp/MEDPresentationDeflectionShape.hxx @@@ -1,40 -1,0 +1,41 @@@ +// Copyright (C) 2016 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com ++// + +#ifndef SRC_MEDCALC_CMP_MEDPRESENTATION_DEFLECTIONSHAPE_HXX_ +#define SRC_MEDCALC_CMP_MEDPRESENTATION_DEFLECTIONSHAPE_HXX_ + +#include "MEDCALC.hxx" +#include "MEDPresentation.hxx" + +class MEDCALC_EXPORT MEDPresentationDeflectionShape : public MEDPresentation +{ +public: + MEDPresentationDeflectionShape(const MEDCALC::DeflectionShapeParameters& params) : + MEDPresentation(params.fieldHandlerId, "MEDPresentationDeflectionShape"), _params(params) + {} + virtual ~MEDPresentationDeflectionShape() {} + +protected: + virtual void internalGeneratePipeline(); + +private: + MEDCALC::DeflectionShapeParameters _params; +}; + +#endif diff --cc src/MEDCalc/cmp/MEDPresentationException.hxx index 542ce3376,000000000..adebd5179 mode 100644,000000..100644 --- a/src/MEDCalc/cmp/MEDPresentationException.hxx +++ b/src/MEDCalc/cmp/MEDPresentationException.hxx @@@ -1,50 -1,0 +1,51 @@@ +// Copyright (C) 2011-2016 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com ++// + +#ifndef SRC_MEDCALC_CMP_MEDPRESENTATION_EXCEPTION_HXX_ +#define SRC_MEDCALC_CMP_MEDPRESENTATION_EXCEPTION_HXX_ + +#include "MEDCALC.hxx" +#include +#include +#include + +class MEDCALC_EXPORT MEDPresentationException + : public std::exception +{ +public: + + MEDPresentationException(const char* msg) { + std::ostringstream oss; + oss << "Error: " << msg; + this->_msg = oss.str(); + } + + virtual ~MEDPresentationException() throw() {} + + virtual const char* what() const throw() { + return this->_msg.c_str(); + } + +private: + + std::string _msg; + +}; + +#endif /* SRC_MEDCALC_CMP_MEDPRESENTATION_EXCEPTION_HXX_ */ diff --cc src/MEDCalc/cmp/MEDPresentationPointSprite.cxx index 65134ecc5,000000000..381c0716a mode 100644,000000..100644 --- a/src/MEDCalc/cmp/MEDPresentationPointSprite.cxx +++ b/src/MEDCalc/cmp/MEDPresentationPointSprite.cxx @@@ -1,28 -1,0 +1,47 @@@ ++// Copyright (C) 2016 CEA/DEN, EDF R&D ++// ++// This library is free software; you can redistribute it and/or ++// modify it under the terms of the GNU Lesser General Public ++// License as published by the Free Software Foundation; either ++// version 2.1 of the License, or (at your option) any later version. ++// ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++// Lesser General Public License for more details. ++// ++// You should have received a copy of the GNU Lesser General Public ++// License along with this library; if not, write to the Free Software ++// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++// ++// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com ++// ++ +#include "MEDPresentationPointSprite.hxx" + +void +MEDPresentationPointSprite::internalGeneratePipeline() +{ + PyGILState_STATE _gil_state = PyGILState_Ensure(); + + std::string cmd = std::string("import pvsimple as pvs;"); + cmd += getRenderViewCommand(_params.viewMode); // define __view1 + + cmd += std::string("__obj1 = pvs.MEDReader(FileName='") + _fileName + std::string("');"); + cmd += std::string("__disp1 = pvs.Show(__obj1, __view1);"); + cmd += std::string("pvs.ColorBy(__disp1, ('") + _fieldType + std::string("', '") + _fieldName + std::string("'));"); + cmd += std::string("__disp1.SetScalarBarVisibility(__view1, True);"); + cmd += std::string("__disp1.RescaleTransferFunctionToDataRangeOverTime();"); + cmd += std::string("__disp1.SetRepresentationType('Point Sprite');"); + cmd += std::string("pvs.Render();"); + + //std::cerr << "Python command:" << std::endl; + //std::cerr << cmd << std::endl; + PyRun_SimpleString(cmd.c_str()); + // Retrieve Python object for internal storage: + PyObject* obj = getPythonObjectFromMain("__obj1"); + PyObject* disp = getPythonObjectFromMain("__disp1"); + pushInternal(obj, disp); + + PyGILState_Release(_gil_state); +} diff --cc src/MEDCalc/cmp/MEDPresentationPointSprite.hxx index 066691955,000000000..34f0dd170 mode 100644,000000..100644 --- a/src/MEDCalc/cmp/MEDPresentationPointSprite.hxx +++ b/src/MEDCalc/cmp/MEDPresentationPointSprite.hxx @@@ -1,40 -1,0 +1,41 @@@ +// Copyright (C) 2016 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com ++// + +#ifndef SRC_MEDCALC_CMP_MEDPRESENTATION_POINTSPRITE_HXX_ +#define SRC_MEDCALC_CMP_MEDPRESENTATION_POINTSPRITE_HXX_ + +#include "MEDCALC.hxx" +#include "MEDPresentation.hxx" + +class MEDCALC_EXPORT MEDPresentationPointSprite : public MEDPresentation +{ +public: + MEDPresentationPointSprite(const MEDCALC::PointSpriteParameters& params) : + MEDPresentation(params.fieldHandlerId, "MEDPresentationPointSprite"), _params(params) + {} + virtual ~MEDPresentationPointSprite() {} + +protected: + virtual void internalGeneratePipeline(); + +private: + MEDCALC::PointSpriteParameters _params; +}; + +#endif diff --cc src/MEDCalc/cmp/MEDPresentationScalarMap.cxx index 17e9916e9,000000000..b518a4c3f mode 100644,000000..100644 --- a/src/MEDCalc/cmp/MEDPresentationScalarMap.cxx +++ b/src/MEDCalc/cmp/MEDPresentationScalarMap.cxx @@@ -1,29 -1,0 +1,48 @@@ ++// Copyright (C) 2016 CEA/DEN, EDF R&D ++// ++// This library is free software; you can redistribute it and/or ++// modify it under the terms of the GNU Lesser General Public ++// License as published by the Free Software Foundation; either ++// version 2.1 of the License, or (at your option) any later version. ++// ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++// Lesser General Public License for more details. ++// ++// You should have received a copy of the GNU Lesser General Public ++// License along with this library; if not, write to the Free Software ++// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++// ++// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com ++// ++ +#include "MEDPresentationScalarMap.hxx" + +void +MEDPresentationScalarMap::internalGeneratePipeline() +{ + PyGILState_STATE _gil_state = PyGILState_Ensure(); + + std::string cmd = std::string("import pvsimple as pvs;"); + cmd += getRenderViewCommand(_params.viewMode); // define __view1 + + cmd += std::string("__obj1 = pvs.MEDReader(FileName='") + _fileName + std::string("');"); + cmd += std::string("__disp1 = pvs.Show(__obj1, __view1);"); + cmd += std::string("pvs.ColorBy(__disp1, ('") + _fieldType + std::string("', '") + _fieldName + std::string("'));"); + cmd += std::string("__disp1.SetScalarBarVisibility(__view1, True);"); + cmd += std::string("__disp1.RescaleTransferFunctionToDataRangeOverTime();"); + cmd += std::string("__lut = pvs.GetColorTransferFunction('")+_fieldName+std::string("');"); + cmd += std::string("__lut.ApplyPreset('")+getColorMapCommand(_params.colorMap)+std::string("',True);"); + cmd += std::string("pvs.Render();"); + + //std::cerr << "Python command:" << std::endl; + //std::cerr << cmd << std::endl; + PyRun_SimpleString(cmd.c_str()); + // Retrieve Python object for internal storage: + PyObject* obj = getPythonObjectFromMain("__obj1"); + PyObject* disp = getPythonObjectFromMain("__disp1"); + pushInternal(obj, disp); + + PyGILState_Release(_gil_state); +} diff --cc src/MEDCalc/cmp/MEDPresentationScalarMap.hxx index cec568147,000000000..1b26af56f mode 100644,000000..100644 --- a/src/MEDCalc/cmp/MEDPresentationScalarMap.hxx +++ b/src/MEDCalc/cmp/MEDPresentationScalarMap.hxx @@@ -1,40 -1,0 +1,41 @@@ +// Copyright (C) 2016 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com ++// + +#ifndef SRC_MEDCALC_CMP_MEDPRESENTATION_SCALARMAP_HXX_ +#define SRC_MEDCALC_CMP_MEDPRESENTATION_SCALARMAP_HXX_ + +#include "MEDCALC.hxx" +#include "MEDPresentation.hxx" + +class MEDCALC_EXPORT MEDPresentationScalarMap : public MEDPresentation +{ +public: + MEDPresentationScalarMap(const MEDCALC::ScalarMapParameters& params) : + MEDPresentation(params.fieldHandlerId, "MEDPresentationScalarMap"), _params(params) + {} + virtual ~MEDPresentationScalarMap() {} + +protected: + virtual void internalGeneratePipeline(); + +private: + MEDCALC::ScalarMapParameters _params; +}; + +#endif diff --cc src/MEDCalc/cmp/MEDPresentationSlices.cxx index 601bbc5ac,000000000..30386223b mode 100644,000000..100644 --- a/src/MEDCalc/cmp/MEDPresentationSlices.cxx +++ b/src/MEDCalc/cmp/MEDPresentationSlices.cxx @@@ -1,28 -1,0 +1,47 @@@ ++// Copyright (C) 2016 CEA/DEN, EDF R&D ++// ++// This library is free software; you can redistribute it and/or ++// modify it under the terms of the GNU Lesser General Public ++// License as published by the Free Software Foundation; either ++// version 2.1 of the License, or (at your option) any later version. ++// ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++// Lesser General Public License for more details. ++// ++// You should have received a copy of the GNU Lesser General Public ++// License along with this library; if not, write to the Free Software ++// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++// ++// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com ++// ++ +#include "MEDPresentationSlices.hxx" + +void +MEDPresentationSlices::internalGeneratePipeline() +{ + PyGILState_STATE _gil_state = PyGILState_Ensure(); + + std::string cmd = std::string("import pvsimple as pvs;"); + cmd += getRenderViewCommand(_params.viewMode); // define __view1 + + cmd += std::string("__obj1 = pvs.MEDReader(FileName='") + _fileName + std::string("');"); + cmd += std::string("__slice1 = pvs.Slice(Input=__obj1);"); + cmd += std::string("__disp1 = pvs.Show(__slice1, __view1);"); + cmd += std::string("pvs.ColorBy(__disp1, ('") + _fieldType + std::string("', '") + _fieldName + std::string("'));"); + cmd += std::string("__disp1.SetScalarBarVisibility(__view1, True);"); + cmd += std::string("__disp1.RescaleTransferFunctionToDataRangeOverTime();"); + cmd += std::string("pvs.Render();"); + + //std::cerr << "Python command:" << std::endl; + //std::cerr << cmd << std::endl; + PyRun_SimpleString(cmd.c_str()); + // Retrieve Python object for internal storage: + PyObject* obj = getPythonObjectFromMain("__slice1"); + PyObject* disp = getPythonObjectFromMain("__disp1"); + pushInternal(obj, disp); + + PyGILState_Release(_gil_state); +} diff --cc src/MEDCalc/cmp/MEDPresentationSlices.hxx index 42b4dfea8,000000000..a738d7a3f mode 100644,000000..100644 --- a/src/MEDCalc/cmp/MEDPresentationSlices.hxx +++ b/src/MEDCalc/cmp/MEDPresentationSlices.hxx @@@ -1,40 -1,0 +1,41 @@@ +// Copyright (C) 2016 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com ++// + +#ifndef SRC_MEDCALC_CMP_MEDPRESENTATION_SLICES_HXX_ +#define SRC_MEDCALC_CMP_MEDPRESENTATION_SLICES_HXX_ + +#include "MEDCALC.hxx" +#include "MEDPresentation.hxx" + +class MEDCALC_EXPORT MEDPresentationSlices : public MEDPresentation +{ +public: + MEDPresentationSlices(const MEDCALC::SlicesParameters& params) : + MEDPresentation(params.fieldHandlerId, "MEDPresentationSlices"), _params(params) + {} + virtual ~MEDPresentationSlices() {} + +protected: + virtual void internalGeneratePipeline(); + +private: + MEDCALC::SlicesParameters _params; +}; + +#endif diff --cc src/MEDCalc/cmp/MEDPresentationVectorField.cxx index d267fa694,000000000..33290a631 mode 100644,000000..100644 --- a/src/MEDCalc/cmp/MEDPresentationVectorField.cxx +++ b/src/MEDCalc/cmp/MEDPresentationVectorField.cxx @@@ -1,28 -1,0 +1,47 @@@ ++// Copyright (C) 2016 CEA/DEN, EDF R&D ++// ++// This library is free software; you can redistribute it and/or ++// modify it under the terms of the GNU Lesser General Public ++// License as published by the Free Software Foundation; either ++// version 2.1 of the License, or (at your option) any later version. ++// ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++// Lesser General Public License for more details. ++// ++// You should have received a copy of the GNU Lesser General Public ++// License along with this library; if not, write to the Free Software ++// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++// ++// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com ++// ++ +#include "MEDPresentationVectorField.hxx" + +void +MEDPresentationVectorField::internalGeneratePipeline() +{ + PyGILState_STATE _gil_state = PyGILState_Ensure(); + + std::string cmd = std::string("import pvsimple as pvs;"); + cmd += getRenderViewCommand(_params.viewMode); // define __view1 + + cmd += std::string("__obj1 = pvs.MEDReader(FileName='") + _fileName + std::string("');"); + cmd += std::string("__disp1 = pvs.Show(__obj1, __view1);"); + cmd += std::string("pvs.ColorBy(__disp1, ('") + _fieldType + std::string("', '") + _fieldName + std::string("'));"); + cmd += std::string("__disp1.SetScalarBarVisibility(__view1, True);"); + cmd += std::string("__disp1.RescaleTransferFunctionToDataRangeOverTime();"); + cmd += std::string("__disp1.SetRepresentationType('3D Glyphs');"); + cmd += std::string("pvs.Render();"); + + //std::cerr << "Python command:" << std::endl; + //std::cerr << cmd << std::endl; + PyRun_SimpleString(cmd.c_str()); + // Retrieve Python object for internal storage: + PyObject* obj = getPythonObjectFromMain("__obj1"); + PyObject* disp = getPythonObjectFromMain("__disp1"); + pushInternal(obj, disp); + + PyGILState_Release(_gil_state); +} diff --cc src/MEDCalc/cmp/MEDPresentationVectorField.hxx index 838af52fe,000000000..a7fc8d89f mode 100644,000000..100644 --- a/src/MEDCalc/cmp/MEDPresentationVectorField.hxx +++ b/src/MEDCalc/cmp/MEDPresentationVectorField.hxx @@@ -1,40 -1,0 +1,41 @@@ +// Copyright (C) 2016 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com ++// + +#ifndef SRC_MEDCALC_CMP_MEDPRESENTATION_VECTORFIELD_HXX_ +#define SRC_MEDCALC_CMP_MEDPRESENTATION_VECTORFIELD_HXX_ + +#include "MEDCALC.hxx" +#include "MEDPresentation.hxx" + +class MEDCALC_EXPORT MEDPresentationVectorField : public MEDPresentation +{ +public: + MEDPresentationVectorField(const MEDCALC::VectorFieldParameters& params) : + MEDPresentation(params.fieldHandlerId, "MEDPresentationVectorField"), _params(params) + {} + virtual ~MEDPresentationVectorField() {} + +protected: + virtual void internalGeneratePipeline(); + +private: + MEDCALC::VectorFieldParameters _params; +}; + +#endif diff --cc src/MEDCalc/gui/dialogs/WidgetPresentationParameters.cxx index 37e41391a,000000000..dc246e427 mode 100644,000000..100644 --- a/src/MEDCalc/gui/dialogs/WidgetPresentationParameters.cxx +++ b/src/MEDCalc/gui/dialogs/WidgetPresentationParameters.cxx @@@ -1,66 -1,0 +1,85 @@@ ++// Copyright (C) 2016 CEA/DEN, EDF R&D ++// ++// This library is free software; you can redistribute it and/or ++// modify it under the terms of the GNU Lesser General Public ++// License as published by the Free Software Foundation; either ++// version 2.1 of the License, or (at your option) any later version. ++// ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++// Lesser General Public License for more details. ++// ++// You should have received a copy of the GNU Lesser General Public ++// License along with this library; if not, write to the Free Software ++// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++// ++// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com ++// ++ +#include "WidgetPresentationParameters.hxx" + +WidgetPresentationParameters::WidgetPresentationParameters(QWidget* parent) + : QWidget(parent) +{ + ui.setupUi(this); // To be done first +} + +MEDCALC::MEDPresentationViewMode +WidgetPresentationParameters::getViewMode() { + QString viewMode = this->ui.comboBoxViewMode->currentText(); + if (viewMode == tr("LAB_VIEW_MODE_REPLACE")) { + return MEDCALC::VIEW_MODE_REPLACE; + } + else if (viewMode == tr("LAB_VIEW_MODE_OVERLAP")) { + return MEDCALC::VIEW_MODE_OVERLAP; + } + else if (viewMode == tr("LAB_VIEW_MODE_NEW_LAYOUT")) { + return MEDCALC::VIEW_MODE_NEW_LAYOUT; + } + else if (viewMode == tr("LAB_VIEW_MODE_SPLIT_VIEW")) { + return MEDCALC::VIEW_MODE_SPLIT_VIEW; + } +} + +std::string +WidgetPresentationParameters::getField() +{ + return this->ui.comboBoxField->currentText().toStdString(); +} + +std::string +WidgetPresentationParameters::getScalarBarRange() +{ + return this->ui.comboBoxScalarBarRange->currentText().toStdString(); +} + +double +WidgetPresentationParameters::getScalarBarTimestep() +{ + return this->ui.doubleSpinBoxTimeStep->value(); +} + +double +WidgetPresentationParameters::getScalarBarMinVal() +{ + return this->ui.doubleSpinBoxMinVal->value(); +} + +double +WidgetPresentationParameters::getScalarBarMaxVal() +{ + return this->ui.doubleSpinBoxMaxVal->value(); +} + +MEDCALC::MEDPresentationColorMap +WidgetPresentationParameters::getColorMap() +{ + QString colorMap = this->ui.comboBoxColorMap->currentText(); + if (colorMap == tr("LAB_BLUE_TO_RED")) { + return MEDCALC::COLOR_MAP_BLUE_TO_RED_RAINBOW; + } + else if (colorMap == tr("LAB_COOL_TO_WARM")) { + return MEDCALC::COLOR_MAP_COOL_TO_WARM; + } +} diff --cc src/MEDCalc/gui/dialogs/WidgetPresentationParameters.hxx index 04e6dd2a1,000000000..febdd1377 mode 100644,000000..100644 --- a/src/MEDCalc/gui/dialogs/WidgetPresentationParameters.hxx +++ b/src/MEDCalc/gui/dialogs/WidgetPresentationParameters.hxx @@@ -1,29 -1,0 +1,48 @@@ ++// Copyright (C) 2016 CEA/DEN, EDF R&D ++// ++// This library is free software; you can redistribute it and/or ++// modify it under the terms of the GNU Lesser General Public ++// License as published by the Free Software Foundation; either ++// version 2.1 of the License, or (at your option) any later version. ++// ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++// Lesser General Public License for more details. ++// ++// You should have received a copy of the GNU Lesser General Public ++// License along with this library; if not, write to the Free Software ++// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++// ++// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com ++// ++ +#ifndef WIDGET_PRESENTATION_PARAMETERS_HXX +#define WIDGET_PRESENTATION_PARAMETERS_HXX + +#include "MEDCALCGUIdialogs.hxx" + +#include "ui_WidgetPresentationParameters.h" + +#include +#include CORBA_SERVER_HEADER(MEDPresentationManager) + +class WidgetPresentationParameters : public QWidget +{ +public: + WidgetPresentationParameters(QWidget* parent = 0); + + MEDCALC::MEDPresentationViewMode getViewMode(); + std::string getField(); + std::string getScalarBarRange(); + double getScalarBarTimestep(); + double getScalarBarMinVal(); + double getScalarBarMaxVal(); + MEDCALC::MEDPresentationColorMap getColorMap(); + + private: + Ui_WidgetPresentationParameters ui; // instance of the class defined in ui_WidgetPresentationParameters.h +}; + + +#endif