PlotAxesConfig.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  Config(parent) {
29  axisConfig_[X] = new PlotAxisConfig(this);
30  axisConfig_[Y] = new PlotAxisConfig(this);
31 
32  connect(axisConfig_[X], SIGNAL(changed()), this, SLOT(axisConfigChanged()));
33  connect(axisConfig_[Y], SIGNAL(changed()), this, SLOT(axisConfigChanged()));
34 }
35 
37 }
38 
39 /*****************************************************************************/
40 /* Accessors */
41 /*****************************************************************************/
42 
44  QMap<Axis, PlotAxisConfig*>::const_iterator it = axisConfig_.find(axis);
45 
46  if (it != axisConfig_.end())
47  return it.value();
48  else
49  return 0;
50 }
51 
52 /*****************************************************************************/
53 /* Methods */
54 /*****************************************************************************/
55 
56 void PlotAxesConfig::save(QSettings& settings) const {
57  settings.beginGroup("axes");
58  settings.beginGroup("x_axis");
59  axisConfig_[X]->save(settings);
60  settings.endGroup();
61  settings.beginGroup("y_axis");
62  axisConfig_[Y]->save(settings);
63  settings.endGroup();
64  settings.endGroup();
65 }
66 
67 void PlotAxesConfig::load(QSettings& settings) {
68  settings.beginGroup("axes");
69  settings.beginGroup("x_axis");
70  axisConfig_[X]->load(settings);
71  settings.endGroup();
72  settings.beginGroup("y_axis");
73  axisConfig_[Y]->load(settings);
74  settings.endGroup();
75  settings.endGroup();
76 }
77 
79  axisConfig_[X]->reset();
80  axisConfig_[Y]->reset();
81 }
82 
83 void PlotAxesConfig::write(QDataStream& stream) const {
84  axisConfig_[X]->write(stream);
85  axisConfig_[Y]->write(stream);
86 }
87 
88 void PlotAxesConfig::read(QDataStream& stream) {
89  axisConfig_[X]->read(stream);
90  axisConfig_[Y]->read(stream);
91 }
92 
93 /*****************************************************************************/
94 /* Operators */
95 /*****************************************************************************/
96 
98  *axisConfig_[X] = *src.axisConfig_[X];
99  *axisConfig_[Y] = *src.axisConfig_[Y];
100 
101  return *this;
102 }
103 
104 /*****************************************************************************/
105 /* Slots */
106 /*****************************************************************************/
107 
109  emit changed();
110 }
111 
112 }
PlotAxesConfig(QObject *parent=0)
QMap< Axis, PlotAxisConfig * > axisConfig_
void write(QDataStream &stream) const
PlotAxisConfig * getAxisConfig(Axis axis) const
void read(QDataStream &stream)
PlotAxesConfig & operator=(const PlotAxesConfig &src)
void load(QSettings &settings)
void save(QSettings &settings) const


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