CurveAxisScaleConfig.cpp
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright (C) 2015 by Ralf Kaestner *
3  * ralf.kaestner@gmail.com *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the Lesser GNU General Public License as published by*
7  * the Free Software Foundation; either version 3 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * Lesser GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the Lesser GNU General Public License *
16  * along with this program. If not, see <http://www.gnu.org/licenses/>. *
17  ******************************************************************************/
18 
20 
21 namespace rqt_multiplot {
22 
23 /*****************************************************************************/
24 /* Constructors and Destructor */
25 /*****************************************************************************/
26 
28  double absoluteMinimum, double absoluteMaximum, double relativeMinimum,
29  double relativeMaximum) :
30  Config(parent),
31  type_(type),
32  absoluteMinimum_(absoluteMinimum),
33  absoluteMaximum_(absoluteMaximum),
34  relativeMinimum_(relativeMinimum),
35  relativeMaximum_(relativeMaximum) {
36 }
37 
39 }
40 
41 /*****************************************************************************/
42 /* Accessors */
43 /*****************************************************************************/
44 
46  if (type != type_) {
47  type_ = type;
48 
49  emit typeChanged(type);
50  emit changed();
51  }
52 }
53 
55  return type_;
56 }
57 
59  if (minimum != absoluteMinimum_) {
60  absoluteMinimum_ = minimum;
61 
62  emit absoluteMinimumChanged(minimum);
63  emit changed();
64  }
65 }
66 
68  return absoluteMinimum_;
69 }
70 
72  if (maximum != absoluteMaximum_) {
73  absoluteMaximum_ = maximum;
74 
75  emit absoluteMaximumChanged(maximum);
76  emit changed();
77  }
78 }
79 
81  return absoluteMaximum_;
82 }
83 
85  if (minimum != relativeMinimum_) {
86  relativeMinimum_ = minimum;
87 
88  emit relativeMinimumChanged(minimum);
89  emit changed();
90  }
91 }
92 
94  return relativeMinimum_;
95 }
96 
98  if (maximum != relativeMaximum_) {
99  relativeMaximum_ = maximum;
100 
101  emit relativeMaximumChanged(maximum);
102  emit changed();
103  }
104 }
105 
107  return relativeMaximum_;
108 }
109 
111  if (type_ == Absolute)
113  if (type_ == Relative)
115  else
116  return true;
117 }
118 
119 /*****************************************************************************/
120 /* Methods */
121 /*****************************************************************************/
122 
123 void CurveAxisScaleConfig::save(QSettings& settings) const {
124  settings.setValue("type", type_);
125 
126  settings.setValue("absolute_minimum", absoluteMinimum_);
127  settings.setValue("absolute_maximum", absoluteMaximum_);
128 
129  settings.setValue("relative_minimum", relativeMinimum_);
130  settings.setValue("relative_maximum", relativeMaximum_);
131 }
132 
133 void CurveAxisScaleConfig::load(QSettings& settings) {
134  setType(static_cast<Type>(settings.value("type", Auto).toInt()));
135 
136  setAbsoluteMinimum(settings.value("absolute_minimum", 0.0).toDouble());
137  setAbsoluteMaximum(settings.value("absolute_maximum", 1000.0).toDouble());
138 
139  setRelativeMinimum(settings.value("relative_minimum", -1000.0).toDouble());
140  setRelativeMaximum(settings.value("relative_maximum", 0.0).toDouble());
141 }
142 
144  setType(Auto);
145 
146  setAbsoluteMinimum(0.0);
147  setAbsoluteMaximum(1000.0);
148 
149  setRelativeMinimum(-1000.0);
150  setRelativeMaximum(0.0);
151 }
152 
153 void CurveAxisScaleConfig::write(QDataStream& stream) const {
154  stream << (int)type_;
155 
156  stream << absoluteMinimum_;
157  stream << absoluteMaximum_;
158 
159  stream << relativeMinimum_;
160  stream << relativeMaximum_;
161 }
162 
163 void CurveAxisScaleConfig::read(QDataStream& stream) {
164  int type;
165  double absoluteMinimum, absoluteMaximum, relativeMinimum, relativeMaximum;
166 
167  stream >> type;
168  setType(static_cast<Type>(type));
169 
170  stream >> absoluteMinimum;
171  setAbsoluteMinimum(absoluteMinimum);
172  stream >> absoluteMaximum;
173  setAbsoluteMaximum(absoluteMaximum);
174 
175  stream >> relativeMinimum;
176  setRelativeMinimum(relativeMinimum);
177  stream >> relativeMaximum;
178  setRelativeMaximum(relativeMaximum);
179 }
180 
181 /*****************************************************************************/
182 /* Operators */
183 /*****************************************************************************/
184 
186  CurveAxisScaleConfig& src) {
187  setType(src.type_);
188 
191 
194 
195  return *this;
196 }
197 
198 }
void write(QDataStream &stream) const
void relativeMaximumChanged(double maxnimum)
void relativeMinimumChanged(double minimum)
void absoluteMinimumChanged(double minimum)
void save(QSettings &settings) const
void absoluteMaximumChanged(double maxnimum)
CurveAxisScaleConfig & operator=(const CurveAxisScaleConfig &src)
CurveAxisScaleConfig(QObject *parent=0, Type type=Auto, double absoluteMinimum=0.0, double absoluteMaximum=1000.0, double relativeMinimum=-1000.0, double relativeMaximum=0.0)


rqt_multiplot
Author(s): Ralf Kaestner
autogenerated on Wed Jul 10 2019 03:49:44