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:
parent
664c1d4862
commit
66ee73f54b
|
@ -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 {
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
#include <cfloat>
|
||||
#include <QDialog>
|
||||
#include <QMessageBox>
|
||||
#include <QMessageBox>
|
||||
#include <QApplication>
|
||||
|
||||
#include <Gui/propertyeditor/PropertyItem.h>
|
||||
|
@ -46,11 +46,11 @@ public:
|
|||
virtual ~LocationWidget();
|
||||
QSize sizeHint() const;
|
||||
|
||||
Base::Vector3f getPosition() const;
|
||||
void setPosition(const Base::Vector3f&);
|
||||
void setDirection(const Base::Vector3f& dir);
|
||||
Base::Vector3f getDirection() const;
|
||||
Base::Vector3f getUserDirection(bool* ok=0) const;
|
||||
Base::Vector3d getPosition() const;
|
||||
void setPosition(const Base::Vector3d&);
|
||||
void setDirection(const Base::Vector3d& dir);
|
||||
Base::Vector3d getDirection() const;
|
||||
Base::Vector3d getUserDirection(bool* ok=0) const;
|
||||
|
||||
private Q_SLOTS:
|
||||
void on_direction_activated(int);
|
||||
|
@ -90,8 +90,8 @@ private Q_SLOTS:
|
|||
void on_direction_activated(int);
|
||||
|
||||
public:
|
||||
virtual Base::Vector3f getDirection() const = 0;
|
||||
Base::Vector3f getUserDirection(bool* ok=0) const;
|
||||
virtual Base::Vector3d getDirection() const = 0;
|
||||
Base::Vector3d getUserDirection(bool* ok=0) const;
|
||||
|
||||
private:
|
||||
virtual void directionActivated(int) = 0;
|
||||
|
@ -135,10 +135,10 @@ public:
|
|||
|
||||
this->direction->setCurrentIndex(2);
|
||||
|
||||
// Vector3f declared to use with QVariant see Gui/propertyeditor/PropertyItem.h
|
||||
this->direction->setItemData(0, QVariant::fromValue<Base::Vector3f>(Base::Vector3f(1,0,0)));
|
||||
this->direction->setItemData(1, QVariant::fromValue<Base::Vector3f>(Base::Vector3f(0,1,0)));
|
||||
this->direction->setItemData(2, QVariant::fromValue<Base::Vector3f>(Base::Vector3f(0,0,1)));
|
||||
// Vector3d declared to use with QVariant see Gui/propertyeditor/PropertyItem.h
|
||||
this->direction->setItemData(0, QVariant::fromValue<Base::Vector3d>(Base::Vector3d(1,0,0)));
|
||||
this->direction->setItemData(1, QVariant::fromValue<Base::Vector3d>(Base::Vector3d(0,1,0)));
|
||||
this->direction->setItemData(2, QVariant::fromValue<Base::Vector3d>(Base::Vector3d(0,0,1)));
|
||||
}
|
||||
else {
|
||||
this->direction->setItemText(0, QApplication::translate("Gui::LocationDialog", "X", 0,
|
||||
|
@ -153,21 +153,21 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
Base::Vector3f getPosition() const
|
||||
Base::Vector3d getPosition() const
|
||||
{
|
||||
return Base::Vector3f((float)this->xPos->value(),
|
||||
(float)this->yPos->value(),
|
||||
(float)this->zPos->value());
|
||||
return Base::Vector3d(this->xPos->value(),
|
||||
this->yPos->value(),
|
||||
this->zPos->value());
|
||||
}
|
||||
|
||||
Base::Vector3f getDirection() const
|
||||
Base::Vector3d getDirection() const
|
||||
{
|
||||
QVariant data = this->direction->itemData (this->direction->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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -188,7 +188,7 @@ private:
|
|||
// last item is selected to define direction by user
|
||||
if (index+1 == this->direction->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"),
|
||||
|
@ -199,8 +199,8 @@ private:
|
|||
// check if the user-defined direction is already there
|
||||
for (int i=0; i<this->direction->count()-1; i++) {
|
||||
QVariant data = this->direction->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) {
|
||||
this->direction->setCurrentIndex(i);
|
||||
return;
|
||||
|
@ -214,7 +214,7 @@ private:
|
|||
.arg(dir.y)
|
||||
.arg(dir.z);
|
||||
this->direction->insertItem(this->direction->count()-1, display,
|
||||
QVariant::fromValue<Base::Vector3f>(dir));
|
||||
QVariant::fromValue<Base::Vector3d>(dir));
|
||||
this->direction->setCurrentIndex(this->direction->count()-2);
|
||||
}
|
||||
}
|
||||
|
@ -257,10 +257,10 @@ public:
|
|||
|
||||
this->direction->setCurrentIndex(2);
|
||||
|
||||
// Vector3f declared to use with QVariant see Gui/propertyeditor/PropertyItem.h
|
||||
this->direction->setItemData(0, QVariant::fromValue<Base::Vector3f>(Base::Vector3f(1,0,0)));
|
||||
this->direction->setItemData(1, QVariant::fromValue<Base::Vector3f>(Base::Vector3f(0,1,0)));
|
||||
this->direction->setItemData(2, QVariant::fromValue<Base::Vector3f>(Base::Vector3f(0,0,1)));
|
||||
// Vector3d declared to use with QVariant see Gui/propertyeditor/PropertyItem.h
|
||||
this->direction->setItemData(0, QVariant::fromValue<Base::Vector3d>(Base::Vector3d(1,0,0)));
|
||||
this->direction->setItemData(1, QVariant::fromValue<Base::Vector3d>(Base::Vector3d(0,1,0)));
|
||||
this->direction->setItemData(2, QVariant::fromValue<Base::Vector3d>(Base::Vector3d(0,0,1)));
|
||||
}
|
||||
else {
|
||||
this->direction->setItemText(0, QApplication::translate("Gui::LocationDialog", "X", 0,
|
||||
|
@ -275,33 +275,33 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void setPosition(const Base::Vector3f& v)
|
||||
void setPosition(const Base::Vector3d& v)
|
||||
{
|
||||
this->xPos->setValue(v.x);
|
||||
this->yPos->setValue(v.y);
|
||||
this->zPos->setValue(v.z);
|
||||
}
|
||||
|
||||
Base::Vector3f getPosition() const
|
||||
Base::Vector3d getPosition() const
|
||||
{
|
||||
return Base::Vector3f((float)this->xPos->value(),
|
||||
(float)this->yPos->value(),
|
||||
(float)this->zPos->value());
|
||||
return Base::Vector3d(this->xPos->value(),
|
||||
this->yPos->value(),
|
||||
this->zPos->value());
|
||||
}
|
||||
|
||||
Base::Vector3f getDirection() const
|
||||
Base::Vector3d getDirection() const
|
||||
{
|
||||
QVariant data = this->direction->itemData (this->direction->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);
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
void setDirection(const Base::Vector3f& dir)
|
||||
void setDirection(const Base::Vector3d& dir)
|
||||
{
|
||||
if (dir.Length() < FLT_EPSILON) {
|
||||
return;
|
||||
|
@ -310,8 +310,8 @@ public:
|
|||
// check if the user-defined direction is already there
|
||||
for (int i=0; i<this->direction->count()-1; i++) {
|
||||
QVariant data = this->direction->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) {
|
||||
this->direction->setCurrentIndex(i);
|
||||
return;
|
||||
|
@ -325,7 +325,7 @@ public:
|
|||
.arg(dir.y)
|
||||
.arg(dir.z);
|
||||
this->direction->insertItem(this->direction->count()-1, display,
|
||||
QVariant::fromValue<Base::Vector3f>(dir));
|
||||
QVariant::fromValue<Base::Vector3d>(dir));
|
||||
this->direction->setCurrentIndex(this->direction->count()-2);
|
||||
}
|
||||
bool directionActivated(LocationDialog* dlg, int index)
|
||||
|
@ -333,7 +333,7 @@ public:
|
|||
// last item is selected to define direction by user
|
||||
if (index+1 == this->direction->count()) {
|
||||
bool ok;
|
||||
Base::Vector3f dir = dlg->getUserDirection(&ok);
|
||||
Base::Vector3d dir = dlg->getUserDirection(&ok);
|
||||
if (ok) {
|
||||
if (dir.Length() < FLT_EPSILON) {
|
||||
QMessageBox::critical(dlg, LocationDialog::tr("Wrong direction"),
|
||||
|
@ -368,7 +368,7 @@ public:
|
|||
// no need to delete child widgets, Qt does it all for us
|
||||
}
|
||||
|
||||
Base::Vector3f getDirection() const
|
||||
Base::Vector3d getDirection() const
|
||||
{
|
||||
return ui.getDirection();
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#include <QSignalMapper>
|
||||
#include <QSignalMapper>
|
||||
#include <QDockWidget>
|
||||
|
||||
#include "Placement.h"
|
||||
|
@ -314,7 +314,7 @@ void Placement::directionActivated(int index)
|
|||
}
|
||||
}
|
||||
|
||||
Base::Vector3f Placement::getDirection() const
|
||||
Base::Vector3d Placement::getDirection() const
|
||||
{
|
||||
return ui->getDirection();
|
||||
}
|
||||
|
@ -343,11 +343,11 @@ void Placement::setPlacementData(const Base::Placement& p)
|
|||
Base::Vector3d axis;
|
||||
p.getRotation().getValue(axis, angle);
|
||||
ui->angle->setValue(angle*180.0/D_PI);
|
||||
Base::Vector3f dir((float)axis.x,(float)axis.y,(float)axis.z);
|
||||
Base::Vector3d dir(axis.x,axis.y,axis.z);
|
||||
for (int i=0; i<ui->direction->count()-1; i++) {
|
||||
QVariant data = ui->direction->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) {
|
||||
ui->direction->setCurrentIndex(i);
|
||||
newitem = false;
|
||||
|
@ -363,7 +363,7 @@ void Placement::setPlacementData(const Base::Placement& p)
|
|||
.arg(dir.y)
|
||||
.arg(dir.z);
|
||||
ui->direction->insertItem(ui->direction->count()-1, display,
|
||||
QVariant::fromValue<Base::Vector3f>(dir));
|
||||
QVariant::fromValue<Base::Vector3d>(dir));
|
||||
ui->direction->setCurrentIndex(ui->direction->count()-2);
|
||||
}
|
||||
signalMapper->blockSignals(false);
|
||||
|
@ -386,7 +386,7 @@ Base::Placement Placement::getPlacementData() const
|
|||
cnt = Base::Vector3d(ui->xCnt->value(),ui->yCnt->value(),ui->zCnt->value());
|
||||
|
||||
if (index == 0) {
|
||||
Base::Vector3f dir = getDirection();
|
||||
Base::Vector3d dir = getDirection();
|
||||
rot.setValue(Base::Vector3d(dir.x,dir.y,dir.z),ui->angle->value()*D_PI/180.0);
|
||||
}
|
||||
else if (index == 1) {
|
||||
|
@ -416,11 +416,11 @@ void Placement::changeEvent(QEvent *e)
|
|||
|
||||
DockablePlacement::DockablePlacement(QWidget* parent, Qt::WFlags fl) : Placement(parent, fl)
|
||||
{
|
||||
Gui::DockWindowManager* pDockMgr = Gui::DockWindowManager::instance();
|
||||
Gui::DockWindowManager* pDockMgr = Gui::DockWindowManager::instance();
|
||||
QDockWidget* dw = pDockMgr->addDockWindow(QT_TR_NOOP("Placement"),
|
||||
this, Qt::BottomDockWidgetArea);
|
||||
dw->setFeatures(QDockWidget::DockWidgetMovable|QDockWidget::DockWidgetFloatable);
|
||||
dw->show();
|
||||
dw->setFeatures(QDockWidget::DockWidgetMovable|QDockWidget::DockWidgetFloatable);
|
||||
dw->show();
|
||||
}
|
||||
|
||||
DockablePlacement::~DockablePlacement()
|
||||
|
@ -429,17 +429,17 @@ DockablePlacement::~DockablePlacement()
|
|||
|
||||
void DockablePlacement::accept()
|
||||
{
|
||||
// closes the dock window
|
||||
Gui::DockWindowManager* pDockMgr = Gui::DockWindowManager::instance();
|
||||
pDockMgr->removeDockWindow(this);
|
||||
// closes the dock window
|
||||
Gui::DockWindowManager* pDockMgr = Gui::DockWindowManager::instance();
|
||||
pDockMgr->removeDockWindow(this);
|
||||
Placement::accept();
|
||||
}
|
||||
|
||||
void DockablePlacement::reject()
|
||||
{
|
||||
// closes the dock window
|
||||
Gui::DockWindowManager* pDockMgr = Gui::DockWindowManager::instance();
|
||||
pDockMgr->removeDockWindow(this);
|
||||
// closes the dock window
|
||||
Gui::DockWindowManager* pDockMgr = Gui::DockWindowManager::instance();
|
||||
pDockMgr->removeDockWindow(this);
|
||||
Placement::reject();
|
||||
}
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ public:
|
|||
void accept();
|
||||
void reject();
|
||||
|
||||
Base::Vector3f getDirection() const;
|
||||
Base::Vector3d getDirection() const;
|
||||
void setPlacement(const Base::Placement&);
|
||||
Base::Placement getPlacement() const;
|
||||
void showDefaultButtons(bool);
|
||||
|
|
|
@ -278,7 +278,7 @@ void DefaultTransformStrategy::onSelectionChanged(const Gui::SelectionChanges& m
|
|||
}
|
||||
|
||||
if (!filter.empty()) {
|
||||
std::set<App::DocumentObject*> diff;
|
||||
std::set<App::DocumentObject*> diff;
|
||||
std::insert_iterator< std::set<App::DocumentObject*> > biit(diff, diff.begin());
|
||||
std::set_difference(update_selection.begin(), update_selection.end(),
|
||||
filter.begin(), filter.end(), biit);
|
||||
|
@ -286,7 +286,7 @@ void DefaultTransformStrategy::onSelectionChanged(const Gui::SelectionChanges& m
|
|||
}
|
||||
|
||||
// reset transform for all deselected objects
|
||||
std::vector<App::DocumentObject*> diff;
|
||||
std::vector<App::DocumentObject*> diff;
|
||||
std::back_insert_iterator< std::vector<App::DocumentObject*> > biit(diff);
|
||||
std::set_difference(selection.begin(), selection.end(),
|
||||
update_selection.begin(), update_selection.end(), biit);
|
||||
|
@ -408,7 +408,7 @@ void Transform::directionActivated(int index)
|
|||
}
|
||||
}
|
||||
|
||||
Base::Vector3f Transform::getDirection() const
|
||||
Base::Vector3d Transform::getDirection() const
|
||||
{
|
||||
return ui->getDirection();
|
||||
}
|
||||
|
@ -424,7 +424,7 @@ Base::Placement Transform::getPlacementData() const
|
|||
cnt = Base::Vector3d(ui->xCnt->value(),ui->yCnt->value(),ui->zCnt->value());
|
||||
|
||||
if (index == 0) {
|
||||
Base::Vector3f dir = getDirection();
|
||||
Base::Vector3d dir = getDirection();
|
||||
rot.setValue(Base::Vector3d(dir.x,dir.y,dir.z),ui->angle->value()*D_PI/180.0);
|
||||
}
|
||||
else if (index == 1) {
|
||||
|
|
|
@ -79,7 +79,7 @@ public:
|
|||
void setTransformStrategy(TransformStrategy* ts);
|
||||
|
||||
protected:
|
||||
Base::Vector3f getDirection() const;
|
||||
Base::Vector3d getDirection() const;
|
||||
void changeEvent(QEvent *e);
|
||||
|
||||
public Q_SLOTS:
|
||||
|
|
|
@ -40,8 +40,8 @@
|
|||
#include <Base/FutureWatcherProgress.h>
|
||||
#include <Base/Parameter.h>
|
||||
#include <Base/Sequencer.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <App/Application.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <App/Application.h>
|
||||
#include <Mod/Mesh/App/Mesh.h>
|
||||
#include <Mod/Mesh/App/MeshFeature.h>
|
||||
#include <Mod/Mesh/App/Core/Algorithm.h>
|
||||
|
@ -479,11 +479,11 @@ PROPERTY_SOURCE(Inspection::Feature, App::DocumentObject)
|
|||
|
||||
Feature::Feature()
|
||||
{
|
||||
ADD_PROPERTY(SearchRadius,(0.05f));
|
||||
ADD_PROPERTY(Thickness,(0.0f));
|
||||
ADD_PROPERTY(SearchRadius,(0.05));
|
||||
ADD_PROPERTY(Thickness,(0.0));
|
||||
ADD_PROPERTY(Actual,(0));
|
||||
ADD_PROPERTY(Nominals,(0));
|
||||
ADD_PROPERTY(Distances,(0.0f));
|
||||
ADD_PROPERTY(Distances,(0.0));
|
||||
}
|
||||
|
||||
Feature::~Feature()
|
||||
|
|
|
@ -35,8 +35,8 @@
|
|||
#include <Inventor/events/SoMouseButtonEvent.h>
|
||||
#include <Inventor/nodes/SoCoordinate3.h>
|
||||
#include <Inventor/nodes/SoDrawStyle.h>
|
||||
#include <Inventor/nodes/SoIndexedFaceSet.h>
|
||||
#include <Inventor/nodes/SoPointSet.h>
|
||||
#include <Inventor/nodes/SoIndexedFaceSet.h>
|
||||
#include <Inventor/nodes/SoPointSet.h>
|
||||
#include <Inventor/nodes/SoMaterial.h>
|
||||
#include <Inventor/nodes/SoShapeHints.h>
|
||||
#include <Inventor/nodes/SoOrthographicCamera.h>
|
||||
|
@ -64,14 +64,14 @@ using namespace InspectionGui;
|
|||
|
||||
|
||||
bool ViewProviderInspection::addflag = false;
|
||||
App::PropertyFloatConstraint::Constraints ViewProviderInspection::floatRange = {1.0f,64.0f,1.0f};
|
||||
App::PropertyFloatConstraint::Constraints ViewProviderInspection::floatRange = {1.0,64.0,1.0};
|
||||
|
||||
PROPERTY_SOURCE(InspectionGui::ViewProviderInspection, Gui::ViewProviderDocumentObject)
|
||||
|
||||
ViewProviderInspection::ViewProviderInspection() : search_radius(FLT_MAX)
|
||||
{
|
||||
ADD_PROPERTY_TYPE(OutsideGrayed,(false),"",(App::PropertyType) (App::Prop_Output|App::Prop_Hidden),"");
|
||||
ADD_PROPERTY_TYPE(PointSize,(1.0f),"Display",(App::PropertyType) (App::Prop_None/*App::Prop_Hidden*/),"");
|
||||
ADD_PROPERTY_TYPE(PointSize,(1.0),"Display",(App::PropertyType) (App::Prop_None/*App::Prop_Hidden*/),"");
|
||||
PointSize.setConstraints(&floatRange);
|
||||
|
||||
pcColorRoot = new SoSeparator();
|
||||
|
|
|
@ -25,8 +25,8 @@
|
|||
#ifndef _PreComp_
|
||||
# include <QDir>
|
||||
# include <QFileInfo>
|
||||
# include <QLineEdit>
|
||||
# include <QInputDialog>
|
||||
# include <QLineEdit>
|
||||
# include <QInputDialog>
|
||||
# include <Standard_math.hxx>
|
||||
#endif
|
||||
|
||||
|
@ -66,7 +66,7 @@ void CmdPartSimpleCylinder::activated(int iMsg)
|
|||
{
|
||||
PartGui::DlgPartCylinderImp dlg(Gui::getMainWindow());
|
||||
if (dlg.exec()== QDialog::Accepted) {
|
||||
Base::Vector3f dir = dlg.getDirection();
|
||||
Base::Vector3d dir = dlg.getDirection();
|
||||
openCommand("Create Part Cylinder");
|
||||
doCommand(Doc,"from FreeCAD import Base");
|
||||
doCommand(Doc,"import Part");
|
||||
|
|
|
@ -655,8 +655,8 @@ void Location::pickCallback(void * ud, SoEventCallback * n)
|
|||
SbVec3f pnt = point->getPoint();
|
||||
SbVec3f nor = point->getNormal();
|
||||
Location* dlg = reinterpret_cast<Location*>(ud);
|
||||
dlg->ui.loc->setPosition(Base::Vector3f(pnt[0],pnt[1],pnt[2]));
|
||||
dlg->ui.loc->setDirection(Base::Vector3f(nor[0],nor[1],nor[2]));
|
||||
dlg->ui.loc->setPosition(Base::Vector3d(pnt[0],pnt[1],pnt[2]));
|
||||
dlg->ui.loc->setDirection(Base::Vector3d(nor[0],nor[1],nor[2]));
|
||||
n->setHandled();
|
||||
}
|
||||
}
|
||||
|
@ -678,7 +678,7 @@ void Location::pickCallback(void * ud, SoEventCallback * n)
|
|||
|
||||
QString Location::toPlacement() const
|
||||
{
|
||||
Base::Vector3f d = ui.loc->getDirection();
|
||||
Base::Vector3d d = ui.loc->getDirection();
|
||||
gp_Dir dir = gp_Dir(d.x,d.y,d.z);
|
||||
gp_Pnt pnt = gp_Pnt(0.0,0.0,0.0);
|
||||
gp_Ax3 ax3;
|
||||
|
@ -721,7 +721,7 @@ QString Location::toPlacement() const
|
|||
Trf.GetRotation(theAxis,theAngle);
|
||||
|
||||
Base::Rotation rot(Base::convertTo<Base::Vector3d>(theAxis), theAngle);
|
||||
Base::Vector3f loc = ui.loc->getPosition();
|
||||
Base::Vector3d loc = ui.loc->getPosition();
|
||||
|
||||
return QString::fromAscii("Base.Placement(Base.Vector(%1,%2,%3),Base.Rotation(%4,%5,%6,%7))")
|
||||
.arg(loc.x,0,'f',2)
|
||||
|
|
|
@ -121,7 +121,7 @@ void DlgRevolution::directionActivated(int index)
|
|||
ui->directionActivated(this, index);
|
||||
}
|
||||
|
||||
Base::Vector3f DlgRevolution::getDirection() const
|
||||
Base::Vector3d DlgRevolution::getDirection() const
|
||||
{
|
||||
return ui->getDirection();
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ void DlgRevolution::accept()
|
|||
shape = (*it)->data(0, Qt::UserRole).toString();
|
||||
type = QString::fromAscii("Part::Revolution");
|
||||
name = QString::fromAscii(activeDoc->getUniqueObjectName("Revolve").c_str());
|
||||
Base::Vector3f axis = this->getDirection();
|
||||
Base::Vector3d axis = this->getDirection();
|
||||
|
||||
QString code = QString::fromAscii(
|
||||
"FreeCAD.ActiveDocument.addObject(\"%1\",\"%2\")\n"
|
||||
|
@ -222,8 +222,8 @@ void DlgRevolution::onSelectionChanged(const Gui::SelectionChanges& msg)
|
|||
{
|
||||
if (msg.Type == Gui::SelectionChanges::AddSelection) {
|
||||
if (filter && filter->canSelect) {
|
||||
ui->setPosition (Base::convertTo<Base::Vector3f>(filter->loc));
|
||||
ui->setDirection(Base::convertTo<Base::Vector3f>(filter->dir));
|
||||
ui->setPosition (Base::convertTo<Base::Vector3d>(filter->loc));
|
||||
ui->setDirection(Base::convertTo<Base::Vector3d>(filter->dir));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ public:
|
|||
~DlgRevolution();
|
||||
void accept();
|
||||
|
||||
Base::Vector3f getDirection() const;
|
||||
Base::Vector3d getDirection() const;
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent *e);
|
||||
|
|
|
@ -53,17 +53,17 @@ void PropertyGreyValueList::removeIndices( const std::vector<unsigned long>& uIn
|
|||
std::vector<unsigned long> uSortedInds = uIndices;
|
||||
std::sort(uSortedInds.begin(), uSortedInds.end());
|
||||
|
||||
const std::vector<float>& rValueList = getValues();
|
||||
const std::vector<double>& rValueList = getValues();
|
||||
|
||||
assert( uSortedInds.size() <= rValueList.size() );
|
||||
if ( uSortedInds.size() > rValueList.size() )
|
||||
return;
|
||||
|
||||
std::vector<float> remainValue;
|
||||
std::vector<double> remainValue;
|
||||
remainValue.reserve(rValueList.size() - uSortedInds.size());
|
||||
|
||||
std::vector<unsigned long>::iterator pos = uSortedInds.begin();
|
||||
for ( std::vector<float>::const_iterator it = rValueList.begin(); it != rValueList.end(); ++it ) {
|
||||
for ( std::vector<double>::const_iterator it = rValueList.begin(); it != rValueList.end(); ++it ) {
|
||||
unsigned long index = it - rValueList.begin();
|
||||
if (pos == uSortedInds.end())
|
||||
remainValue.push_back( *it );
|
||||
|
|
|
@ -65,7 +65,7 @@ using namespace Points;
|
|||
PROPERTY_SOURCE(PointsGui::ViewProviderPoints, Gui::ViewProviderGeometryObject)
|
||||
|
||||
|
||||
App::PropertyFloatConstraint::Constraints ViewProviderPoints::floatRange = {1.0f,64.0f,1.0f};
|
||||
App::PropertyFloatConstraint::Constraints ViewProviderPoints::floatRange = {1.0,64.0,1.0};
|
||||
|
||||
ViewProviderPoints::ViewProviderPoints()
|
||||
{
|
||||
|
|
|
@ -326,7 +326,7 @@ public:
|
|||
EditCurve[1] = Base::Vector2D(onSketchPos.fX ,EditCurve[0].fY);
|
||||
EditCurve[3] = Base::Vector2D(EditCurve[0].fX,onSketchPos.fY);
|
||||
sketchgui->drawEdit(EditCurve);
|
||||
if (seekAutoConstraint(sugConstr2, onSketchPos, Base::Vector2D(0.f,0.f))) {
|
||||
if (seekAutoConstraint(sugConstr2, onSketchPos, Base::Vector2D(0.0,0.0))) {
|
||||
renderSuggestConstraintsCursor(sugConstr2);
|
||||
return;
|
||||
}
|
||||
|
@ -663,17 +663,17 @@ public:
|
|||
else if (TransitionMode == TRANSITION_MODE_Perpendicular_R)
|
||||
Tangent = Base::Vector2D(dirVec.y,-dirVec.x);
|
||||
|
||||
float theta = Tangent.GetAngle(onSketchPos - EditCurve[0]);
|
||||
double theta = Tangent.GetAngle(onSketchPos - EditCurve[0]);
|
||||
arcRadius = (onSketchPos - EditCurve[0]).Length()/(2.0*sin(theta));
|
||||
// At this point we need a unit normal vector pointing torwards
|
||||
// the center of the arc we are drawing. Derivation of the formula
|
||||
// used here can be found at http://people.richland.edu/james/lecture/m116/matrices/area.html
|
||||
float x1 = EditCurve[0].fX;
|
||||
float y1 = EditCurve[0].fY;
|
||||
float x2 = x1 + Tangent.fX;
|
||||
float y2 = y1 + Tangent.fY;
|
||||
float x3 = onSketchPos.fX;
|
||||
float y3 = onSketchPos.fY;
|
||||
double x1 = EditCurve[0].fX;
|
||||
double y1 = EditCurve[0].fY;
|
||||
double x2 = x1 + Tangent.fX;
|
||||
double y2 = y1 + Tangent.fY;
|
||||
double x3 = onSketchPos.fX;
|
||||
double y3 = onSketchPos.fY;
|
||||
if ((x2*y3-x3*y2)-(x1*y3-x3*y1)+(x1*y2-x2*y1) > 0)
|
||||
arcRadius *= -1;
|
||||
if (boost::math::isnan(arcRadius) || boost::math::isinf(arcRadius))
|
||||
|
@ -681,26 +681,26 @@ public:
|
|||
|
||||
CenterPoint = EditCurve[0] + Base::Vector2D(arcRadius * Tangent.fY, -arcRadius * Tangent.fX);
|
||||
|
||||
float rx = EditCurve[0].fX - CenterPoint.fX;
|
||||
float ry = EditCurve[0].fY - CenterPoint.fY;
|
||||
double rx = EditCurve[0].fX - CenterPoint.fX;
|
||||
double ry = EditCurve[0].fY - CenterPoint.fY;
|
||||
|
||||
startAngle = atan2(ry,rx);
|
||||
|
||||
float rxe = onSketchPos.fX - CenterPoint.fX;
|
||||
float rye = onSketchPos.fY - CenterPoint.fY;
|
||||
float arcAngle = atan2(-rxe*ry + rye*rx, rxe*rx + rye*ry);
|
||||
double rxe = onSketchPos.fX - CenterPoint.fX;
|
||||
double rye = onSketchPos.fY - CenterPoint.fY;
|
||||
double arcAngle = atan2(-rxe*ry + rye*rx, rxe*rx + rye*ry);
|
||||
if (boost::math::isnan(arcAngle) || boost::math::isinf(arcAngle))
|
||||
arcAngle = 0.f;
|
||||
if (arcRadius >= 0 && arcAngle > 0)
|
||||
arcAngle -= (float) 2*M_PI;
|
||||
arcAngle -= 2*M_PI;
|
||||
if (arcRadius < 0 && arcAngle < 0)
|
||||
arcAngle += (float) 2*M_PI;
|
||||
arcAngle += 2*M_PI;
|
||||
endAngle = startAngle + arcAngle;
|
||||
|
||||
for (int i=1; i <= 29; i++) {
|
||||
float angle = i*arcAngle/29.0;
|
||||
float dx = rx * cos(angle) - ry * sin(angle);
|
||||
float dy = rx * sin(angle) + ry * cos(angle);
|
||||
double angle = i*arcAngle/29.0;
|
||||
double dx = rx * cos(angle) - ry * sin(angle);
|
||||
double dy = rx * sin(angle) + ry * cos(angle);
|
||||
EditCurve[i] = Base::Vector2D(CenterPoint.fX + dx, CenterPoint.fY + dy);
|
||||
}
|
||||
|
||||
|
@ -915,7 +915,7 @@ protected:
|
|||
|
||||
Base::Vector2D CenterPoint;
|
||||
Base::Vector3d dirVec;
|
||||
float startAngle, endAngle, arcRadius;
|
||||
double startAngle, endAngle, arcRadius;
|
||||
|
||||
void updateTransitionData(int GeoId, Sketcher::PointPos PosId) {
|
||||
|
||||
|
@ -1044,12 +1044,12 @@ public:
|
|||
}
|
||||
}
|
||||
else if (Mode==STATUS_SEEK_Second) {
|
||||
float dx_ = onSketchPos.fX - EditCurve[0].fX;
|
||||
float dy_ = onSketchPos.fY - EditCurve[0].fY;
|
||||
double dx_ = onSketchPos.fX - EditCurve[0].fX;
|
||||
double dy_ = onSketchPos.fY - EditCurve[0].fY;
|
||||
for (int i=0; i < 16; i++) {
|
||||
float angle = i*M_PI/16.0;
|
||||
float dx = dx_ * cos(angle) + dy_ * sin(angle);
|
||||
float dy = -dx_ * sin(angle) + dy_ * cos(angle);
|
||||
double angle = i*M_PI/16.0;
|
||||
double dx = dx_ * cos(angle) + dy_ * sin(angle);
|
||||
double dy = -dx_ * sin(angle) + dy_ * cos(angle);
|
||||
EditCurve[1+i] = Base::Vector2D(EditCurve[0].fX + dx, EditCurve[0].fY + dy);
|
||||
EditCurve[17+i] = Base::Vector2D(EditCurve[0].fX - dx, EditCurve[0].fY - dy);
|
||||
}
|
||||
|
@ -1070,14 +1070,14 @@ public:
|
|||
}
|
||||
}
|
||||
else if (Mode==STATUS_SEEK_Third) {
|
||||
float angle1 = atan2(onSketchPos.fY - CenterPoint.fY,
|
||||
double angle1 = atan2(onSketchPos.fY - CenterPoint.fY,
|
||||
onSketchPos.fX - CenterPoint.fX) - startAngle;
|
||||
float angle2 = angle1 + (angle1 < 0. ? 2 : -2) * M_PI ;
|
||||
double angle2 = angle1 + (angle1 < 0. ? 2 : -2) * M_PI ;
|
||||
arcAngle = abs(angle1-arcAngle) < abs(angle2-arcAngle) ? angle1 : angle2;
|
||||
for (int i=1; i <= 29; i++) {
|
||||
float angle = i*arcAngle/29.0;
|
||||
float dx = rx * cos(angle) - ry * sin(angle);
|
||||
float dy = rx * sin(angle) + ry * cos(angle);
|
||||
double angle = i*arcAngle/29.0;
|
||||
double dx = rx * cos(angle) - ry * sin(angle);
|
||||
double dy = rx * sin(angle) + ry * cos(angle);
|
||||
EditCurve[i] = Base::Vector2D(CenterPoint.fX + dx, CenterPoint.fY + dy);
|
||||
}
|
||||
|
||||
|
@ -1089,7 +1089,7 @@ public:
|
|||
setPositionText(onSketchPos, text);
|
||||
|
||||
sketchgui->drawEdit(EditCurve);
|
||||
if (seekAutoConstraint(sugConstr3, onSketchPos, Base::Vector2D(0.f,0.f))) {
|
||||
if (seekAutoConstraint(sugConstr3, onSketchPos, Base::Vector2D(0.0,0.0))) {
|
||||
renderSuggestConstraintsCursor(sugConstr3);
|
||||
return;
|
||||
}
|
||||
|
@ -1118,9 +1118,9 @@ public:
|
|||
}
|
||||
else {
|
||||
EditCurve.resize(30);
|
||||
float angle1 = atan2(onSketchPos.fY - CenterPoint.fY,
|
||||
double angle1 = atan2(onSketchPos.fY - CenterPoint.fY,
|
||||
onSketchPos.fX - CenterPoint.fX) - startAngle;
|
||||
float angle2 = angle1 + (angle1 < 0. ? 2 : -2) * M_PI ;
|
||||
double angle2 = angle1 + (angle1 < 0. ? 2 : -2) * M_PI ;
|
||||
arcAngle = abs(angle1-arcAngle) < abs(angle2-arcAngle) ? angle1 : angle2;
|
||||
if (arcAngle > 0)
|
||||
endAngle = startAngle + arcAngle;
|
||||
|
@ -1182,7 +1182,7 @@ protected:
|
|||
SelectMode Mode;
|
||||
std::vector<Base::Vector2D> EditCurve;
|
||||
Base::Vector2D CenterPoint;
|
||||
float rx, ry, startAngle, endAngle, arcAngle;
|
||||
double rx, ry, startAngle, endAngle, arcAngle;
|
||||
std::vector<AutoConstraint> sugConstr1, sugConstr2, sugConstr3;
|
||||
};
|
||||
|
||||
|
@ -1279,12 +1279,12 @@ public:
|
|||
}
|
||||
}
|
||||
else if (Mode==STATUS_SEEK_Second) {
|
||||
float rx0 = onSketchPos.fX - EditCurve[0].fX;
|
||||
float ry0 = onSketchPos.fY - EditCurve[0].fY;
|
||||
double rx0 = onSketchPos.fX - EditCurve[0].fX;
|
||||
double ry0 = onSketchPos.fY - EditCurve[0].fY;
|
||||
for (int i=0; i < 16; i++) {
|
||||
float angle = i*M_PI/16.0;
|
||||
float rx = rx0 * cos(angle) + ry0 * sin(angle);
|
||||
float ry = -rx0 * sin(angle) + ry0 * cos(angle);
|
||||
double angle = i*M_PI/16.0;
|
||||
double rx = rx0 * cos(angle) + ry0 * sin(angle);
|
||||
double ry = -rx0 * sin(angle) + ry0 * cos(angle);
|
||||
EditCurve[1+i] = Base::Vector2D(EditCurve[0].fX + rx, EditCurve[0].fY + ry);
|
||||
EditCurve[17+i] = Base::Vector2D(EditCurve[0].fX - rx, EditCurve[0].fY - ry);
|
||||
}
|
||||
|
@ -1322,8 +1322,8 @@ public:
|
|||
virtual bool releaseButton(Base::Vector2D onSketchPos)
|
||||
{
|
||||
if (Mode==STATUS_Close) {
|
||||
float rx = EditCurve[1].fX - EditCurve[0].fX;
|
||||
float ry = EditCurve[1].fY - EditCurve[0].fY;
|
||||
double rx = EditCurve[1].fX - EditCurve[0].fX;
|
||||
double ry = EditCurve[1].fY - EditCurve[0].fY;
|
||||
unsetCursor();
|
||||
resetPositionText();
|
||||
Gui::Command::openCommand("Add sketch circle");
|
||||
|
|
|
@ -203,10 +203,10 @@ int DrawSketchHandler::seekAutoConstraint(std::vector<AutoConstraint> &suggested
|
|||
|
||||
// Find if there are tangent constraints (currently arcs and circles)
|
||||
// FIXME needs to consider when zooming out?
|
||||
const float tangDeviation = 2.;
|
||||
const double tangDeviation = 2.;
|
||||
|
||||
int tangId = Constraint::GeoUndef;
|
||||
float smlTangDist = 1e15f;
|
||||
double smlTangDist = 1e15f;
|
||||
|
||||
// Get geometry list
|
||||
const std::vector<Part::Geometry *> geomlist = sketchgui->getSketchObject()->getCompleteGeometry();
|
||||
|
@ -221,11 +221,11 @@ int DrawSketchHandler::seekAutoConstraint(std::vector<AutoConstraint> &suggested
|
|||
Base::Vector3d center = circle->getCenter();
|
||||
Base::Vector3d tmpPos(Pos.fX, Pos.fY, 0.f);
|
||||
|
||||
float radius = (float) circle->getRadius();
|
||||
double radius = circle->getRadius();
|
||||
|
||||
Base::Vector3d projPnt(0.f, 0.f, 0.f);
|
||||
projPnt = projPnt.ProjToLine(center - tmpPos, Base::Vector3d(Dir.fX, Dir.fY));
|
||||
float projDist = projPnt.Length();
|
||||
double projDist = projPnt.Length();
|
||||
|
||||
if ( (projDist < radius + tangDeviation ) && (projDist > radius - tangDeviation)) {
|
||||
// Find if nearest
|
||||
|
@ -245,7 +245,7 @@ int DrawSketchHandler::seekAutoConstraint(std::vector<AutoConstraint> &suggested
|
|||
Base::Vector3d tmpPos(Pos.fX, Pos.fY, 0.f);
|
||||
|
||||
projPnt = projPnt.ProjToLine(center - tmpPos, Base::Vector3d(Dir.fX, Dir.fY));
|
||||
float projDist = projPnt.Length();
|
||||
double projDist = projPnt.Length();
|
||||
|
||||
if ( projDist < radius + tangDeviation && projDist > radius - tangDeviation) {
|
||||
double startAngle, endAngle;
|
||||
|
|
Loading…
Reference in New Issue
Block a user