Blue Brain BioExplorer
FieldParameters.cpp
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 #include "FieldParameters.h"
22 
23 namespace
24 {
25 const std::string PARAM_FIELD_DISTANCE = "field-distance";
26 const std::string PARAM_FIELD_CUTOFF = "field-cutoff";
27 const std::string PARAM_FIELD_GRADIENT_SHADING = "field-gradient-shading";
28 const std::string PARAM_FIELD_GRADIENT_OFFSET = "field-gradient-offset";
29 const std::string PARAM_FIELD_SAMPLING_RATE = "field-sampling-rate";
30 const std::string PARAM_FIELD_EPSILON = "field-epsilon";
31 } // namespace
32 
33 namespace core
34 {
36  : AbstractParameters("Field")
37 {
38  _parameters.add_options()
39  //
40  (PARAM_FIELD_GRADIENT_SHADING.c_str(), po::value<bool>(), "Gradient shading [bool]")
41  //
42  (PARAM_FIELD_GRADIENT_OFFSET.c_str(), po::value<float>(), "Gradient shading offset [float]")
43  //
44  (PARAM_FIELD_SAMPLING_RATE.c_str(), po::value<float>(), "Gradient shading sampling rate [float]")
45  //
46  (PARAM_FIELD_DISTANCE.c_str(), po::value<float>(), "Initial distance between leafs in the octree [float]")
47  //
48  (PARAM_FIELD_CUTOFF.c_str(), po::value<float>(), "Cutoff distance between leafs in the octree [float]")
49  //
50  (PARAM_FIELD_EPSILON.c_str(), po::value<float>(), "Epsilon between intersections [float]");
51 }
52 
53 void FieldParameters::parse(const po::variables_map& vm)
54 {
55  if (vm.count(PARAM_FIELD_GRADIENT_SHADING))
56  _gradientShading = vm[PARAM_FIELD_GRADIENT_SHADING].as<bool>();
57  if (vm.count(PARAM_FIELD_GRADIENT_OFFSET))
58  _gradientOffset = vm[PARAM_FIELD_GRADIENT_OFFSET].as<float>();
59  if (vm.count(PARAM_FIELD_SAMPLING_RATE))
60  _samplingRate = vm[PARAM_FIELD_SAMPLING_RATE].as<float>();
61  if (vm.count(PARAM_FIELD_CUTOFF))
62  _cutoff = vm[PARAM_FIELD_CUTOFF].as<float>();
63  if (vm.count(PARAM_FIELD_CUTOFF))
64  _cutoff = vm[PARAM_FIELD_CUTOFF].as<float>();
65  if (vm.count(PARAM_FIELD_EPSILON))
66  _epsilon = vm[PARAM_FIELD_EPSILON].as<float>();
67  markModified();
68 }
69 
71 {
73  CORE_INFO("Gradient shading: " << asString(_gradientShading));
74  CORE_INFO("Gradient offset : " << _gradientOffset);
75  CORE_INFO("Sampling rate : " << _samplingRate);
76  CORE_INFO("Distance : " << _distance);
77  CORE_INFO("Cutoff : " << _cutoff);
78  CORE_INFO("Epsilon : " << _epsilon);
79 }
80 } // namespace core
static std::string asString(const bool flag)
po::options_description _parameters
void markModified(const bool triggerCallback=true)
Definition: BaseObject.h:65
void parse(const po::variables_map &vm) final
#define CORE_INFO(__msg)
Definition: Logs.h:33