source: flair-src/trunk/lib/FlairCore/src/Vector3DSpinBox.cpp@ 16

Last change on this file since 16 was 15, checked in by Bayard Gildas, 6 years ago

sources reformatted with flair-format-dir script

File size: 2.0 KB
Line 
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
14// station
15//
16//
17/*********************************************************************/
18
19#include "Vector3DSpinBox.h"
20
21using std::string;
22
23namespace flair {
24namespace gui {
25
26Vector3DSpinBox::Vector3DSpinBox(const LayoutPosition *position, string name,
27 double min, double max, double step,
28 int decimals, core::Vector3D default_value)
29 : Box(position, name, "Vector3DSpinBox") {
30 // update value from xml file
31 default_value.Saturate(min, max);
32 box_value = default_value;
33
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);
44
45 SendXml();
46}
47
48Vector3DSpinBox::~Vector3DSpinBox() {}
49/*
50Vector3DSpinBox::operator core::Vector3D() const {
51 return Value();
52}
53*/
54core::Vector3D Vector3DSpinBox::Value(void) const {
55 core::Vector3D tmp;
56
57 GetMutex();
58 tmp = box_value;
59 ReleaseMutex();
60
61 return tmp;
62}
63
64void Vector3DSpinBox::XmlEvent(void) {
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();
76}
77
78} // end namespace gui
79} // end namespace flair
Note: See TracBrowser for help on using the repository browser.