Further doubel suggestions from Jan

Moved Gui/InputVector,Placement,Transform from float to double
Moved Sketcher from float to double
more suggestions for moving float -> double
This commit is contained in:
jriegel
2013-09-22 22:00:19 +02:00
parent 00ea24e07e
commit ecae7fac7f
16 changed files with 163 additions and 163 deletions

View File

@@ -105,10 +105,10 @@ void LocationWidget::retranslateUi()
dValue->setCurrentIndex(2);
// Vector3f declared to use with QVariant see Gui/propertyeditor/PropertyItem.h
dValue->setItemData(0, QVariant::fromValue<Base::Vector3f>(Base::Vector3f(1,0,0)));
dValue->setItemData(1, QVariant::fromValue<Base::Vector3f>(Base::Vector3f(0,1,0)));
dValue->setItemData(2, QVariant::fromValue<Base::Vector3f>(Base::Vector3f(0,0,1)));
// Vector3d declared to use with QVariant see Gui/propertyeditor/PropertyItem.h
dValue->setItemData(0, QVariant::fromValue<Base::Vector3d>(Base::Vector3d(1,0,0)));
dValue->setItemData(1, QVariant::fromValue<Base::Vector3d>(Base::Vector3d(0,1,0)));
dValue->setItemData(2, QVariant::fromValue<Base::Vector3d>(Base::Vector3d(0,0,1)));
}
else {
dValue->setItemText(0, QApplication::translate("Gui::LocationDialog", "X"));
@@ -119,21 +119,21 @@ void LocationWidget::retranslateUi()
}
}
Base::Vector3f LocationWidget::getPosition() const
Base::Vector3d LocationWidget::getPosition() const
{
return Base::Vector3f((float)this->xValue->value(),
(float)this->yValue->value(),
(float)this->zValue->value());
return Base::Vector3d(this->xValue->value(),
this->yValue->value(),
this->zValue->value());
}
void LocationWidget::setPosition(const Base::Vector3f& v)
void LocationWidget::setPosition(const Base::Vector3d& v)
{
this->xValue->setValue(v.x);
this->yValue->setValue(v.y);
this->zValue->setValue(v.z);
}
void LocationWidget::setDirection(const Base::Vector3f& dir)
void LocationWidget::setDirection(const Base::Vector3d& dir)
{
if (dir.Length() < FLT_EPSILON) {
return;
@@ -142,8 +142,8 @@ void LocationWidget::setDirection(const Base::Vector3f& dir)
// check if the user-defined direction is already there
for (int i=0; i<dValue->count()-1; i++) {
QVariant data = dValue->itemData (i);
if (data.canConvert<Base::Vector3f>()) {
const Base::Vector3f val = data.value<Base::Vector3f>();
if (data.canConvert<Base::Vector3d>()) {
const Base::Vector3d val = data.value<Base::Vector3d>();
if (val == dir) {
dValue->setCurrentIndex(i);
return;
@@ -157,31 +157,31 @@ void LocationWidget::setDirection(const Base::Vector3f& dir)
.arg(dir.y)
.arg(dir.z);
dValue->insertItem(dValue->count()-1, display,
QVariant::fromValue<Base::Vector3f>(dir));
QVariant::fromValue<Base::Vector3d>(dir));
dValue->setCurrentIndex(dValue->count()-2);
}
Base::Vector3f LocationWidget::getDirection() const
Base::Vector3d LocationWidget::getDirection() const
{
QVariant data = dValue->itemData (this->dValue->currentIndex());
if (data.canConvert<Base::Vector3f>()) {
return data.value<Base::Vector3f>();
if (data.canConvert<Base::Vector3d>()) {
return data.value<Base::Vector3d>();
}
else {
return Base::Vector3f(0,0,1);
return Base::Vector3d(0,0,1);
}
}
Base::Vector3f LocationWidget::getUserDirection(bool* ok) const
Base::Vector3d LocationWidget::getUserDirection(bool* ok) const
{
Gui::Dialog::Ui_InputVector iv;
QDialog dlg(const_cast<LocationWidget*>(this));
iv.setupUi(&dlg);
Base::Vector3f dir;
Base::Vector3d dir;
if (dlg.exec()) {
dir.x = (float)iv.vectorX->value();
dir.y = (float)iv.vectorY->value();
dir.z = (float)iv.vectorZ->value();
dir.x = iv.vectorX->value();
dir.y = iv.vectorY->value();
dir.z = iv.vectorZ->value();
if (ok) *ok = true;
}
else {
@@ -196,7 +196,7 @@ void LocationWidget::on_direction_activated(int index)
// last item is selected to define direction by user
if (index+1 == dValue->count()) {
bool ok;
Base::Vector3f dir = this->getUserDirection(&ok);
Base::Vector3d dir = this->getUserDirection(&ok);
if (ok) {
if (dir.Length() < FLT_EPSILON) {
QMessageBox::critical(this, LocationDialog::tr("Wrong direction"),
@@ -220,16 +220,16 @@ LocationDialog::~LocationDialog()
{
}
Base::Vector3f LocationDialog::getUserDirection(bool* ok) const
Base::Vector3d LocationDialog::getUserDirection(bool* ok) const
{
Gui::Dialog::Ui_InputVector iv;
QDialog dlg(const_cast<LocationDialog*>(this));
iv.setupUi(&dlg);
Base::Vector3f dir;
Base::Vector3d dir;
if (dlg.exec()) {
dir.x = (float)iv.vectorX->value();
dir.y = (float)iv.vectorY->value();
dir.z = (float)iv.vectorZ->value();
dir.x = iv.vectorX->value();
dir.y = iv.vectorY->value();
dir.z = iv.vectorZ->value();
if (ok) *ok = true;
}
else {