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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user