[2] | 1 | // %flair:license{
|
---|
[15] | 2 | // This file is part of the Flair framework distributed under the
|
---|
| 3 | // CECILL-C License, Version 1.0.
|
---|
[2] | 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 | //
|
---|
[15] | 13 | // purpose: Class displaying 3 QDoubleSpinBox for x,y,z on the ground
|
---|
| 14 | // station
|
---|
[2] | 15 | //
|
---|
| 16 | //
|
---|
| 17 | /*********************************************************************/
|
---|
| 18 |
|
---|
| 19 | #include "Vector3DSpinBox.h"
|
---|
| 20 |
|
---|
| 21 | using std::string;
|
---|
| 22 |
|
---|
[15] | 23 | namespace flair {
|
---|
| 24 | namespace gui {
|
---|
[2] | 25 |
|
---|
[15] | 26 | Vector3DSpinBox::Vector3DSpinBox(const LayoutPosition *position, string name,
|
---|
| 27 | double min, double max, double step,
|
---|
[167] | 28 | int decimals, core::Vector3Df default_value)
|
---|
[15] | 29 | : Box(position, name, "Vector3DSpinBox") {
|
---|
| 30 | // update value from xml file
|
---|
| 31 | default_value.Saturate(min, max);
|
---|
| 32 | box_value = default_value;
|
---|
[2] | 33 |
|
---|
[15] | 34 | SetVolatileXmlProp("min", min);
|
---|
| 35 | SetVolatileXmlProp("max", max);
|
---|
| 36 | SetVolatileXmlProp("step", step);
|
---|
| 37 | SetVolatileXmlProp("decimals", decimals);
|
---|
| 38 | GetPersistentXmlProp("value_x", box_value.x);
|
---|
| 39 | SetPersistentXmlProp("value_x", box_value.x);
|
---|
| 40 | GetPersistentXmlProp("value_y", box_value.y);
|
---|
| 41 | SetPersistentXmlProp("value_y", box_value.y);
|
---|
| 42 | GetPersistentXmlProp("value_z", box_value.z);
|
---|
| 43 | SetPersistentXmlProp("value_z", box_value.z);
|
---|
[2] | 44 |
|
---|
[15] | 45 | SendXml();
|
---|
[2] | 46 | }
|
---|
| 47 |
|
---|
[15] | 48 | Vector3DSpinBox::~Vector3DSpinBox() {}
|
---|
[2] | 49 | /*
|
---|
| 50 | Vector3DSpinBox::operator core::Vector3D() const {
|
---|
| 51 | return Value();
|
---|
| 52 | }
|
---|
| 53 | */
|
---|
[167] | 54 | core::Vector3Df Vector3DSpinBox::Value(void) const {
|
---|
| 55 | core::Vector3Df tmp;
|
---|
[2] | 56 |
|
---|
[15] | 57 | GetMutex();
|
---|
| 58 | tmp = box_value;
|
---|
| 59 | ReleaseMutex();
|
---|
[2] | 60 |
|
---|
[15] | 61 | return tmp;
|
---|
[2] | 62 | }
|
---|
| 63 |
|
---|
| 64 | void Vector3DSpinBox::XmlEvent(void) {
|
---|
[15] | 65 | bool changed = false;
|
---|
| 66 | GetMutex();
|
---|
| 67 | if (GetPersistentXmlProp("value_x", box_value.x))
|
---|
| 68 | changed = true;
|
---|
| 69 | if (GetPersistentXmlProp("value_y", box_value.y))
|
---|
| 70 | changed = true;
|
---|
| 71 | if (GetPersistentXmlProp("value_z", box_value.z))
|
---|
| 72 | changed = true;
|
---|
| 73 | if (changed)
|
---|
| 74 | SetValueChanged();
|
---|
| 75 | ReleaseMutex();
|
---|
[2] | 76 | }
|
---|
| 77 |
|
---|
| 78 | } // end namespace gui
|
---|
| 79 | } // end namespace flair
|
---|