Blue Brain BioExplorer
OpenDeckParameters.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2024, EPFL/Blue Brain Project
3  * All rights reserved. Do not distribute without permission.
4  *
5  * This file is part of Blue Brain BioExplorer <https://github.com/BlueBrain/BioExplorer>
6  *
7  * This library is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU Lesser General Public License version 3.0 as published
9  * by the Free Software Foundation.
10  *
11  * This library is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
14  * details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this library; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  */
20 
21 #pragma once
22 
25 
26 namespace core
27 {
28 constexpr auto PARAM_RESOLUTION_SCALING = "resolution-scaling";
29 constexpr auto PARAM_CAMERA_SCALING = "camera-scaling";
30 
32 {
33 public:
35 
36  double getResolutionScaling() const { return _props.getProperty<double>(PARAM_RESOLUTION_SCALING); }
37  void setResolutionScaling(const double resScaling) { _updateProperty(PARAM_RESOLUTION_SCALING, resScaling); }
38 
39  double getCameraScaling() const { return _props.getProperty<double>(PARAM_CAMERA_SCALING); }
40  void setCameraScaling(const double cameraScaling) { _updateProperty(PARAM_CAMERA_SCALING, cameraScaling); }
41 
42  const PropertyMap& getPropertyMap() const { return _props; }
43  PropertyMap& getPropertyMap() { return _props; }
44 
45 private:
46  PropertyMap _props;
47 
48  template <typename T>
49  void _updateProperty(const char* property, const T& newValue)
50  {
51  if (!_isEqual(_props.getProperty<T>(property), newValue))
52  {
53  _props.updateProperty(property, newValue);
54  markModified();
55  }
56  }
57 };
58 } // namespace core
void markModified(const bool triggerCallback=true)
Definition: BaseObject.h:65
bool _isEqual(const T &a, const T &b, typename std::enable_if< std::is_floating_point< T >::value >::type *=0)
Definition: BaseObject.h:97
double getResolutionScaling() const
PropertyMap & getPropertyMap()
const PropertyMap & getPropertyMap() const
void setResolutionScaling(const double resScaling)
void setCameraScaling(const double cameraScaling)
void updateProperty(const std::string &name, const T &t)
Definition: PropertyMap.h:296
T getProperty(const std::string &name, T valIfNotFound) const
Definition: PropertyMap.h:323
constexpr auto PARAM_CAMERA_SCALING
constexpr auto PARAM_RESOLUTION_SCALING