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

Last change on this file since 2 was 2, checked in by Sanahuja Guillaume, 5 years ago

flaircore

File size: 1.9 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 station
14//
15//
16/*********************************************************************/
17
18#include "Vector3DSpinBox.h"
19
20using std::string;
21
22namespace flair { namespace gui {
23
24Vector3DSpinBox::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
43Vector3DSpinBox::~Vector3DSpinBox() {
44
45}
46/*
47Vector3DSpinBox::operator core::Vector3D() const {
48    return Value();
49}
50*/
51core::Vector3D Vector3DSpinBox::Value(void) const {
52    core::Vector3D tmp;
53
54    GetMutex();
55    tmp=box_value;
56    ReleaseMutex();
57
58    return tmp;
59}
60
61void 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
Note: See TracBrowser for help on using the repository browser.