[TechDraw] Use templates instead of duplicate code: formatVector
This commit is contained in:
@@ -485,7 +485,8 @@ Base::Vector3d DrawUtil::vertex2Vector(const TopoDS_Vertex& v)
|
||||
return Base::Vector3d(gp.X(), gp.Y(), gp.Z());
|
||||
}
|
||||
|
||||
//TODO: make formatVector using toVector3d
|
||||
// template specialization
|
||||
//template <> // GCC BUG 85282, wanting this to be outside class body
|
||||
std::string DrawUtil::formatVector(const Base::Vector3d& v)
|
||||
{
|
||||
std::stringstream builder;
|
||||
@@ -493,51 +494,7 @@ std::string DrawUtil::formatVector(const Base::Vector3d& v)
|
||||
builder << " (" << v.x << ", " << v.y << ", " << v.z << ") ";
|
||||
return builder.str();
|
||||
}
|
||||
|
||||
template <> // GCC BUG 85282, wanting this to be outside class body
|
||||
Base::Vector3d DrawUtil::toVector3d<QPointF>(const QPointF& v)
|
||||
{
|
||||
return Base::Vector3d(v.x(), v.y(), 0);
|
||||
}
|
||||
|
||||
std::string DrawUtil::formatVector(const gp_Dir2d& v)
|
||||
{
|
||||
std::stringstream builder;
|
||||
builder << std::fixed << std::setprecision(Base::UnitsApi::getDecimals());
|
||||
builder << " (" << v.X() << ", " << v.Y() << ") ";
|
||||
return builder.str();
|
||||
}
|
||||
std::string DrawUtil::formatVector(const gp_Vec& v)
|
||||
{
|
||||
std::stringstream builder;
|
||||
builder << std::fixed << std::setprecision(Base::UnitsApi::getDecimals());
|
||||
builder << " (" << v.X() << ", " << v.Y() << ", " << v.Z() << ") ";
|
||||
return builder.str();
|
||||
}
|
||||
|
||||
std::string DrawUtil::formatVector(const gp_Pnt& v)
|
||||
{
|
||||
std::stringstream builder;
|
||||
builder << std::fixed << std::setprecision(Base::UnitsApi::getDecimals());
|
||||
builder << " (" << v.X() << ", " << v.Y() << ", " << v.Z() << ") ";
|
||||
return builder.str();
|
||||
}
|
||||
|
||||
std::string DrawUtil::formatVector(const gp_Pnt2d& v)
|
||||
{
|
||||
std::stringstream builder;
|
||||
builder << std::fixed << std::setprecision(Base::UnitsApi::getDecimals());
|
||||
builder << " (" << v.X() << ", " << v.Y() << ") ";
|
||||
return builder.str();
|
||||
}
|
||||
|
||||
std::string DrawUtil::formatVector(const QPointF& v)
|
||||
{
|
||||
std::stringstream builder;
|
||||
builder << std::fixed << std::setprecision(Base::UnitsApi::getDecimals());
|
||||
builder << " (" << v.x() << ", " << v.y() << ") ";
|
||||
return builder.str();
|
||||
}
|
||||
//template std::string DrawUtil::formatVector<Base::Vector3d>(const Base::Vector3d &v);
|
||||
|
||||
//! compare 2 vectors for sorting - true if v1 < v2
|
||||
//! precision::Confusion() is too strict for vertex - vertex comparisons
|
||||
|
||||
Reference in New Issue
Block a user