1 | // %flair:license{
|
---|
2 | // This file is part of the Flair framework distributed under the
|
---|
3 | // CECILL-C License, Version 1.0.
|
---|
4 | // %flair:license}
|
---|
5 | // created: 2016/02/22
|
---|
6 | // filename: Vector3DSpinBox.cpp
|
---|
7 | //
|
---|
8 | // author: Guillaume Sanahuja
|
---|
9 | // Copyright Heudiasyc UMR UTC/CNRS 7253
|
---|
10 | //
|
---|
11 | // version: $Id: $
|
---|
12 | //
|
---|
13 | // purpose: Class displaying 3 QDoubleSpinBox for x,y,z on the ground station
|
---|
14 | //
|
---|
15 | //
|
---|
16 | /*********************************************************************/
|
---|
17 |
|
---|
18 | #include "Vector3DSpinBox.h"
|
---|
19 |
|
---|
20 | using std::string;
|
---|
21 |
|
---|
22 | namespace flair { namespace gui {
|
---|
23 |
|
---|
24 | Vector3DSpinBox::Vector3DSpinBox(const LayoutPosition* position,string name,double min,double max,double step,int decimals,core::Vector3D default_value):Box(position,name,"Vector3DSpinBox") {
|
---|
25 | //update value from xml file
|
---|
26 | default_value.Saturate(min,max);
|
---|
27 | box_value=default_value;
|
---|
28 |
|
---|
29 | SetVolatileXmlProp("min",min);
|
---|
30 | SetVolatileXmlProp("max",max);
|
---|
31 | SetVolatileXmlProp("step",step);
|
---|
32 | SetVolatileXmlProp("decimals",decimals);
|
---|
33 | GetPersistentXmlProp("value_x",box_value.x);
|
---|
34 | SetPersistentXmlProp("value_x",box_value.x);
|
---|
35 | GetPersistentXmlProp("value_y",box_value.y);
|
---|
36 | SetPersistentXmlProp("value_y",box_value.y);
|
---|
37 | GetPersistentXmlProp("value_z",box_value.z);
|
---|
38 | SetPersistentXmlProp("value_z",box_value.z);
|
---|
39 |
|
---|
40 | SendXml();
|
---|
41 | }
|
---|
42 |
|
---|
43 | Vector3DSpinBox::~Vector3DSpinBox() {
|
---|
44 |
|
---|
45 | }
|
---|
46 | /*
|
---|
47 | Vector3DSpinBox::operator core::Vector3D() const {
|
---|
48 | return Value();
|
---|
49 | }
|
---|
50 | */
|
---|
51 | core::Vector3D Vector3DSpinBox::Value(void) const {
|
---|
52 | core::Vector3D tmp;
|
---|
53 |
|
---|
54 | GetMutex();
|
---|
55 | tmp=box_value;
|
---|
56 | ReleaseMutex();
|
---|
57 |
|
---|
58 | return tmp;
|
---|
59 | }
|
---|
60 |
|
---|
61 | void Vector3DSpinBox::XmlEvent(void) {
|
---|
62 | bool changed=false;
|
---|
63 | GetMutex();
|
---|
64 | if(GetPersistentXmlProp("value_x",box_value.x)) changed=true;
|
---|
65 | if(GetPersistentXmlProp("value_y",box_value.y)) changed=true;
|
---|
66 | if(GetPersistentXmlProp("value_z",box_value.z)) changed=true;
|
---|
67 | if(changed) SetValueChanged();
|
---|
68 | ReleaseMutex();
|
---|
69 | }
|
---|
70 |
|
---|
71 | } // end namespace gui
|
---|
72 | } // end namespace flair
|
---|