Skip to content
Snippets Groups Projects
Commit d756eb61 authored by Riccardo Maria Bianchi's avatar Riccardo Maria Bianchi :sunny:
Browse files

Add selectable units to Coordinates Axes

parent d1c5cd57
Branches
Tags
No related merge requests found
......@@ -60,6 +60,7 @@ public:
double last_lettersVerticalPos;
bool last_showAxes;
double last_axesLength;
unsigned int last_axesLength_UnitsFactor;
SbVec3f last_axesPosition;
double last_relAxesThickness;
bool last_showCartesianGrid;
......@@ -146,7 +147,9 @@ GuideSysController::GuideSysController(IVP1System * sys)
addUpdateSlot(SLOT(possibleChange_axesLength()));
connectToLastUpdateSlot(m_d->ui_axes.checkBox_axes_shownegativeparts);
connectToLastUpdateSlot(m_d->ui_axes.doubleSpinBox_axes_lengths_m);
connectToLastUpdateSlot(m_d->ui_axes.doubleSpinBox_axes_lengths);
connectToLastUpdateSlot(m_d->ui_axes.comboBox_axes_lengths_units);
m_d->ui_axes.comboBox_axes_lengths_units->setCurrentIndex(2); // we set 'm' (meters) as default units
addUpdateSlot(SLOT(possibleChange_axesPosition()));
connectToLastUpdateSlot(m_d->ui_axes.doubleSpinBox_axes_xpos_m);
......@@ -295,8 +298,22 @@ bool GuideSysController::showAxes() const
//____________________________________________________________________
double GuideSysController::axesLength() const
{
return m_d->ui_axes.doubleSpinBox_axes_lengths_m->value()*SYSTEM_OF_UNITS::m *
(m_d->ui_axes.checkBox_axes_shownegativeparts->isChecked()?-1.0:1.0);
unsigned int unitsFactor;
QString units = m_d->ui_axes.comboBox_axes_lengths_units->currentText();
if (units == "mm") {
unitsFactor = SYSTEM_OF_UNITS::mm;
} else if (units == "cm") {
unitsFactor = SYSTEM_OF_UNITS::cm;
} else if (units == "m") {
unitsFactor = SYSTEM_OF_UNITS::m;
} else if (units == "km") {
unitsFactor = SYSTEM_OF_UNITS::km;
} else {
std::cout << "\nWARNING! So far, only 'mm', 'cm', 'm', and 'km' units are supported. If you need other units, please contact 'geomodel-developers@cern.ch'.\n\n" << std::endl;
}
return m_d->ui_axes.doubleSpinBox_axes_lengths->value()*unitsFactor *
(m_d->ui_axes.checkBox_axes_shownegativeparts->isChecked()?-1.0:1.0);
}
//____________________________________________________________________
......@@ -449,7 +466,7 @@ void GuideSysController::actualSaveSettings(VP1Serialise&s) const
s.save(m_d->ui_floorandletters.checkBox_acdesignations);
//Version 0 output bool here
s.save(m_d->ui_axes.checkBox_axes_shownegativeparts);
s.save(m_d->ui_axes.doubleSpinBox_axes_lengths_m);
s.save(m_d->ui_axes.doubleSpinBox_axes_lengths);
s.save(m_d->ui_axes.doubleSpinBox_axes_relthickness);
s.save(m_d->ui_axes.doubleSpinBox_axes_xpos_m);
s.save(m_d->ui_axes.doubleSpinBox_axes_ypos_m);
......@@ -480,6 +497,9 @@ void GuideSysController::actualSaveSettings(VP1Serialise&s) const
s.save(m_d->ui_lines.doubleSpinBox_phi);
s.save(m_d->ui_lines.doubleSpinBox_eta);
s.save(m_d->ui_lines.doubleSpinBox_length);
// new, length units
s.save(m_d->ui_axes.comboBox_axes_lengths_units);
}
//____________________________________________________________________
......@@ -515,7 +535,7 @@ void GuideSysController::actualRestoreSettings(VP1Deserialise& s)
if (s.version()==0)
s.ignoreBool();
s.restore(m_d->ui_axes.checkBox_axes_shownegativeparts);
s.restore(m_d->ui_axes.doubleSpinBox_axes_lengths_m);
s.restore(m_d->ui_axes.doubleSpinBox_axes_lengths);
s.restore(m_d->ui_axes.doubleSpinBox_axes_relthickness);
s.restore(m_d->ui_axes.doubleSpinBox_axes_xpos_m);
s.restore(m_d->ui_axes.doubleSpinBox_axes_ypos_m);
......@@ -537,6 +557,9 @@ void GuideSysController::actualRestoreSettings(VP1Deserialise& s)
s.restore(m_d->ui_lines.doubleSpinBox_phi);
s.restore(m_d->ui_lines.doubleSpinBox_eta);
s.restore(m_d->ui_lines.doubleSpinBox_length);
// new, length units
s.restore(m_d->ui_axes.comboBox_axes_lengths_units);
}
void GuideSysController::possibleChange_lineDirection() {
......
<ui version="4.0" >
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>VP1GuidesSysSettingsCoordinateAxesForm</class>
<widget class="QWidget" name="VP1GuidesSysSettingsCoordinateAxesForm" >
<property name="geometry" >
<widget class="QWidget" name="VP1GuidesSysSettingsCoordinateAxesForm">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>296</width>
<height>248</height>
<width>464</width>
<height>276</height>
</rect>
</property>
<property name="windowTitle" >
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" >
<layout class="QVBoxLayout">
<item>
<widget class="QGroupBox" name="groupBox_4" >
<property name="title" >
<widget class="QGroupBox" name="groupBox_4">
<property name="title">
<string>Coordinate Axes</string>
</property>
<layout class="QVBoxLayout" >
<layout class="QVBoxLayout">
<item>
<layout class="QHBoxLayout" >
<layout class="QHBoxLayout">
<item>
<widget class="QLabel" name="label_22" >
<property name="text" >
<widget class="QLabel" name="label_22">
<property name="text">
<string>Position (x,y,z):</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0">
<size>
<width>1</width>
<height>5</height>
......@@ -47,91 +48,91 @@
</layout>
</item>
<item>
<layout class="QHBoxLayout" >
<layout class="QHBoxLayout">
<item>
<widget class="QDoubleSpinBox" name="doubleSpinBox_axes_xpos_m" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
<widget class="QDoubleSpinBox" name="doubleSpinBox_axes_xpos_m">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="alignment" >
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="suffix" >
<property name="suffix">
<string> m</string>
</property>
<property name="decimals" >
<property name="decimals">
<number>3</number>
</property>
<property name="minimum" >
<property name="minimum">
<double>-99.989999999999995</double>
</property>
<property name="singleStep" >
<property name="singleStep">
<double>0.010000000000000</double>
</property>
<property name="value" >
<property name="value">
<double>0.000000000000000</double>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="doubleSpinBox_axes_ypos_m" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
<widget class="QDoubleSpinBox" name="doubleSpinBox_axes_ypos_m">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="alignment" >
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="suffix" >
<property name="suffix">
<string> m</string>
</property>
<property name="decimals" >
<property name="decimals">
<number>3</number>
</property>
<property name="minimum" >
<property name="minimum">
<double>-99.989999999999995</double>
</property>
<property name="singleStep" >
<property name="singleStep">
<double>0.010000000000000</double>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="doubleSpinBox_axes_zpos_m" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
<widget class="QDoubleSpinBox" name="doubleSpinBox_axes_zpos_m">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="alignment" >
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="suffix" >
<property name="suffix">
<string> m</string>
</property>
<property name="decimals" >
<property name="decimals">
<number>3</number>
</property>
<property name="minimum" >
<property name="minimum">
<double>-99.989999999999995</double>
</property>
<property name="singleStep" >
<property name="singleStep">
<double>0.010000000000000</double>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0">
<size>
<width>1</width>
<height>5</height>
......@@ -142,54 +143,54 @@
</layout>
</item>
<item>
<layout class="QHBoxLayout" >
<layout class="QHBoxLayout">
<item>
<widget class="QLabel" name="label_24" >
<property name="text" >
<widget class="QLabel" name="label_24">
<property name="text">
<string>Colours (x,y,z):</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" >
<property name="spacing" >
<layout class="QHBoxLayout">
<property name="spacing">
<number>2</number>
</property>
<item>
<widget class="VP1MaterialButton" name="matButton_axes_x" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<widget class="VP1MaterialButton" name="matButton_axes_x">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="VP1MaterialButton" name="matButton_axes_y" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<widget class="VP1MaterialButton" name="matButton_axes_y">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="VP1MaterialButton" name="matButton_axes_z" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<widget class="VP1MaterialButton" name="matButton_axes_z">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<property name="text">
<string/>
</property>
</widget>
......@@ -198,13 +199,13 @@
</item>
<item>
<spacer>
<property name="orientation" >
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0">
<size>
<width>1</width>
<height>5</height>
......@@ -215,61 +216,91 @@
</layout>
</item>
<item>
<layout class="QHBoxLayout" >
<property name="spacing" >
<layout class="QHBoxLayout">
<property name="spacing">
<number>9</number>
</property>
<item>
<widget class="QLabel" name="label_23" >
<property name="text" >
<widget class="QLabel" name="label_23">
<property name="text">
<string>Lengths:</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="doubleSpinBox_axes_lengths_m" >
<property name="alignment" >
<widget class="QDoubleSpinBox" name="doubleSpinBox_axes_lengths">
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="suffix" >
<string> m</string>
<property name="suffix">
<string/>
</property>
<property name="decimals" >
<property name="decimals">
<number>3</number>
</property>
<property name="minimum" >
<property name="minimum">
<double>0.001000000000000</double>
</property>
<property name="singleStep" >
<property name="maximum">
<double>999.999000000000024</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
<property name="value" >
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_25" >
<property name="text" >
<widget class="QComboBox" name="comboBox_axes_lengths_units">
<property name="currentText">
<string>mm</string>
</property>
<item>
<property name="text">
<string>mm</string>
</property>
</item>
<item>
<property name="text">
<string>cm</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">m</string>
</property>
</item>
<item>
<property name="text">
<string>km</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QLabel" name="label_25">
<property name="text">
<string>Rel. thick.:</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="doubleSpinBox_axes_relthickness" >
<property name="decimals" >
<widget class="QDoubleSpinBox" name="doubleSpinBox_axes_relthickness">
<property name="decimals">
<number>3</number>
</property>
<property name="minimum" >
<property name="minimum">
<double>0.001000000000000</double>
</property>
<property name="maximum" >
<property name="maximum">
<double>0.150000000000000</double>
</property>
<property name="singleStep" >
<property name="singleStep">
<double>0.010000000000000</double>
</property>
<property name="value" >
<property name="value">
<double>0.030000000000000</double>
</property>
</widget>
......@@ -277,23 +308,23 @@
</layout>
</item>
<item>
<layout class="QHBoxLayout" >
<layout class="QHBoxLayout">
<item>
<widget class="QCheckBox" name="checkBox_axes_shownegativeparts" >
<property name="text" >
<widget class="QCheckBox" name="checkBox_axes_shownegativeparts">
<property name="text">
<string>Show negative parts</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0">
<size>
<width>1</width>
<height>5</height>
......@@ -307,16 +338,16 @@
</widget>
</item>
<item>
<layout class="QHBoxLayout" >
<property name="spacing" >
<layout class="QHBoxLayout">
<property name="spacing">
<number>0</number>
</property>
<item>
<spacer>
<property name="orientation" >
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0">
<size>
<width>1</width>
<height>5</height>
......@@ -325,8 +356,8 @@
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton_close" >
<property name="text" >
<widget class="QPushButton" name="pushButton_close">
<property name="text">
<string>&amp;Close</string>
</property>
</widget>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment