Sketcher: DSH - new cursor drawing functions
This commit is contained in:
committed by
abdullahtahiriyo
parent
4c888b6afe
commit
e73d8e2e96
@@ -1144,16 +1144,45 @@ void DrawSketchHandler::drawPositionAtCursor(const Base::Vector2d& position)
|
||||
void DrawSketchHandler::drawDirectionAtCursor(const Base::Vector2d& position,
|
||||
const Base::Vector2d& origin)
|
||||
{
|
||||
if (!showCursorCoords()) {
|
||||
return;
|
||||
}
|
||||
|
||||
float length = (position - origin).Length();
|
||||
float angle = (position - origin).GetAngle(Base::Vector2d(1.f, 0.f));
|
||||
|
||||
if (showCursorCoords()) {
|
||||
SbString text;
|
||||
std::string lengthString = lengthToDisplayFormat(length, 1);
|
||||
std::string angleString = angleToDisplayFormat(angle * 180.0 / M_PI, 1);
|
||||
text.sprintf(" (%s, %s)", lengthString.c_str(), angleString.c_str());
|
||||
setPositionText(position, text);
|
||||
SbString text;
|
||||
std::string lengthString = lengthToDisplayFormat(length, 1);
|
||||
std::string angleString = angleToDisplayFormat(angle * 180.0 / M_PI, 1);
|
||||
text.sprintf(" (%s, %s)", lengthString.c_str(), angleString.c_str());
|
||||
setPositionText(position, text);
|
||||
}
|
||||
|
||||
void DrawSketchHandler::drawWidthHeightAtCursor(const Base::Vector2d& position,
|
||||
const double val1,
|
||||
const double val2)
|
||||
{
|
||||
if (!showCursorCoords()) {
|
||||
return;
|
||||
}
|
||||
|
||||
SbString text;
|
||||
std::string val1String = lengthToDisplayFormat(val1, 1);
|
||||
std::string val2String = lengthToDisplayFormat(val2, 1);
|
||||
text.sprintf(" (%s x %s)", val1String.c_str(), val2String.c_str());
|
||||
setPositionText(position, text);
|
||||
}
|
||||
|
||||
void DrawSketchHandler::drawDoubleAtCursor(const Base::Vector2d& position, const double val)
|
||||
{
|
||||
if (!showCursorCoords()) {
|
||||
return;
|
||||
}
|
||||
|
||||
SbString text;
|
||||
std::string doubleString = lengthToDisplayFormat(val, 1);
|
||||
text.sprintf(" (%s)", doubleString.c_str());
|
||||
setPositionText(position, text);
|
||||
}
|
||||
|
||||
std::unique_ptr<QWidget> DrawSketchHandler::createToolWidget() const
|
||||
|
||||
@@ -282,6 +282,9 @@ protected:
|
||||
|
||||
void drawPositionAtCursor(const Base::Vector2d& position);
|
||||
void drawDirectionAtCursor(const Base::Vector2d& position, const Base::Vector2d& origin);
|
||||
void
|
||||
drawWidthHeightAtCursor(const Base::Vector2d& position, const double val1, const double val2);
|
||||
void drawDoubleAtCursor(const Base::Vector2d& position, const double radius);
|
||||
|
||||
int getPreselectPoint() const;
|
||||
int getPreselectCurve() const;
|
||||
|
||||
Reference in New Issue
Block a user