1 // Copyright (C) 2016-2021 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 "MEDWidgetHelperVectorField.hxx"
21 #include "MEDPresentationVectorField.hxx" // from component side.
22 #include "PresentationController.hxx"
24 #include <Basics_Utils.hxx>
29 MEDWidgetHelperVectorField::MEDWidgetHelperVectorField(const PresentationController* presController,
30 MEDCALC::MEDPresentationManager_ptr presManager, int presId, const std::string & presName,
31 WidgetPresentationParameters * paramW):
32 MEDWidgetHelper(presController, presManager, presId, presName, paramW)
34 MEDWidgetHelperVectorField::~MEDWidgetHelperVectorField() {}
36 void MEDWidgetHelperVectorField::loadParametersFromEngine()
38 MEDWidgetHelper::loadParametersFromEngine();
39 _scaleFactor = _presManager->getPresentationDoubleProperty(_presId, MEDPresentationVectorField::PROP_SCALE_FACTOR.c_str());
40 _customScaleFactor = _presManager->getPresentationIntProperty(_presId, MEDPresentationVectorField::PROP_CUSTOM_SCALE_FACTOR.c_str());
43 void MEDWidgetHelperVectorField::updateWidget(bool connect)
45 MEDWidgetHelper::updateWidget(connect);
46 _paramWidget->setScaleFactor(_scaleFactor);
47 _paramWidget->setScaleFactorFlag(_customScaleFactor);
49 // Connect spin boxes changes
52 QObject::connect( _paramWidget, SIGNAL(spinboxScaleFactorChaged(double)), this, SLOT(onScaleFactorChanged(double)) );
53 QObject::connect( _paramWidget, SIGNAL(checkboxCustomScaleFactorChanged(int)), this, SLOT(onCustomScaleFactorChanged(int)));
58 void MEDWidgetHelperVectorField::releaseWidget()
60 MEDWidgetHelper::releaseWidget();
62 QObject::disconnect( _paramWidget, SIGNAL(spinboxScaleFactorChaged(double)), this, SLOT(onScaleFactorChanged(double)) );
65 void MEDWidgetHelperVectorField::onScaleFactorChanged(double scale)
67 STDLOG("MEDWidgetHelperVectorField::onScaleFactorChanged");
68 PresentationEvent* event = new PresentationEvent();
69 event->eventtype = PresentationEvent::EVENT_CHANGE_SCALE_FACTOR;
70 event->presentationId = _presId;
71 event->aDouble3 = scale;
73 emit presentationUpdateSignal(event); // --> PresentationController::processPresentationEvent
76 void MEDWidgetHelperVectorField::onCustomScaleFactorChanged(int flag)
78 STDLOG("MEDWidgetHelperVectorField::onScaleFactorChanged");
79 PresentationEvent* event = new PresentationEvent();
80 event->eventtype = PresentationEvent::EVENT_CHANGE_CUSTOM_SCALE_FACTOR;
81 event->presentationId = _presId;
82 event->anInteger = flag;
83 event->aDouble3 = _paramWidget->getScaleFactor();
85 emit presentationUpdateSignal(event); // --> PresentationController::processPresentationEvent