Sketcher: improve position hints on arc and circle creation
This commit is contained in:
parent
ebf0723b84
commit
c5b2f377a4
|
@ -731,9 +731,8 @@ public:
|
|||
|
||||
virtual void mouseMove(Base::Vector2D onSketchPos)
|
||||
{
|
||||
setPositionText(onSketchPos);
|
||||
|
||||
if (Mode==STATUS_SEEK_First) {
|
||||
setPositionText(onSketchPos);
|
||||
if (seekAutoConstraint(sugConstr1, onSketchPos, Base::Vector2D(0.f,0.f))) {
|
||||
renderSuggestConstraintsCursor(sugConstr1);
|
||||
return;
|
||||
|
@ -750,6 +749,16 @@ public:
|
|||
EditCurve[17+i] = Base::Vector2D(EditCurve[0].fX - dx, EditCurve[0].fY - dy);
|
||||
}
|
||||
EditCurve[33] = EditCurve[1];
|
||||
|
||||
// Display radius and start angle
|
||||
float radius = (onSketchPos - EditCurve[0]).Length();
|
||||
float angle = atan2f(dy_ , dx_) * 180 / M_PI;
|
||||
|
||||
char buf[40];
|
||||
sprintf( buf, " (R%.1f,%.1f)", radius, angle);
|
||||
std::string text = buf;
|
||||
setPositionText(onSketchPos, text);
|
||||
|
||||
sketchgui->drawEdit(EditCurve);
|
||||
if (seekAutoConstraint(sugConstr2, onSketchPos, Base::Vector2D(0.f,0.f))) {
|
||||
renderSuggestConstraintsCursor(sugConstr2);
|
||||
|
@ -767,6 +776,15 @@ public:
|
|||
float dy = rx * sin(angle) + ry * cos(angle);
|
||||
EditCurve[i] = Base::Vector2D(CenterPoint.fX + dx, CenterPoint.fY + dy);
|
||||
}
|
||||
|
||||
// Display radius and end angle
|
||||
float radius = (onSketchPos - EditCurve[0]).Length();
|
||||
|
||||
char buf[40];
|
||||
sprintf( buf, " (R%.1f,%.1f)", radius, arcAngle * 180 / M_PI);
|
||||
std::string text = buf;
|
||||
setPositionText(onSketchPos, text);
|
||||
|
||||
sketchgui->drawEdit(EditCurve);
|
||||
if (seekAutoConstraint(sugConstr3, onSketchPos, Base::Vector2D(0.f,0.f))) {
|
||||
renderSuggestConstraintsCursor(sugConstr3);
|
||||
|
@ -950,8 +968,8 @@ public:
|
|||
|
||||
virtual void mouseMove(Base::Vector2D onSketchPos)
|
||||
{
|
||||
setPositionText(onSketchPos);
|
||||
if (Mode==STATUS_SEEK_First) {
|
||||
setPositionText(onSketchPos);
|
||||
if (seekAutoConstraint(sugConstr1, onSketchPos, Base::Vector2D(0.f,0.f))) {
|
||||
renderSuggestConstraintsCursor(sugConstr1);
|
||||
return;
|
||||
|
@ -968,6 +986,15 @@ public:
|
|||
EditCurve[17+i] = Base::Vector2D(EditCurve[0].fX - rx, EditCurve[0].fY - ry);
|
||||
}
|
||||
EditCurve[33] = EditCurve[1];
|
||||
|
||||
// Display radius for user
|
||||
float radius = (onSketchPos - EditCurve[0]).Length();
|
||||
|
||||
char buf[40];
|
||||
sprintf( buf, "R%.1f", radius);
|
||||
std::string text = buf;
|
||||
setPositionText(onSketchPos, text);
|
||||
|
||||
sketchgui->drawEdit(EditCurve);
|
||||
if (seekAutoConstraint(sugConstr2, onSketchPos, Base::Vector2D(0.f,0.f), CURVE)) {
|
||||
renderSuggestConstraintsCursor(sugConstr2);
|
||||
|
|
|
@ -385,6 +385,12 @@ void DrawSketchHandler::renderSuggestConstraintsCursor(std::vector<AutoConstrain
|
|||
applyCursor(newCursor);
|
||||
}
|
||||
|
||||
void DrawSketchHandler::setPositionText(const Base::Vector2D &Pos, const std::string &text)
|
||||
{
|
||||
sketchgui->setPositionText(Pos, text);
|
||||
}
|
||||
|
||||
|
||||
void DrawSketchHandler::setPositionText(const Base::Vector2D &Pos)
|
||||
{
|
||||
sketchgui->setPositionText(Pos);
|
||||
|
|
|
@ -87,6 +87,7 @@ public:
|
|||
void createAutoConstraints(const std::vector<AutoConstraint> &autoConstrs,
|
||||
int geoId, Sketcher::PointPos pointPos=Sketcher::none);
|
||||
|
||||
void setPositionText(const Base::Vector2D &Pos, const std::string &text);
|
||||
void setPositionText(const Base::Vector2D &Pos);
|
||||
void resetPositionText(void);
|
||||
void renderSuggestConstraintsCursor(std::vector<AutoConstraint> &suggestedConstraints);
|
||||
|
|
|
@ -3026,6 +3026,12 @@ void ViewProviderSketch::unsetEditViewer(Gui::View3DInventorViewer* viewer)
|
|||
static_cast<Gui::SoFCUnifiedSelection*>(root)->selectionRole.setValue(TRUE);
|
||||
}
|
||||
|
||||
void ViewProviderSketch::setPositionText(const Base::Vector2D &Pos, const std::string &text)
|
||||
{
|
||||
edit->textX->string = text.c_str();
|
||||
edit->textPos->translation = SbVec3f(Pos.fX,Pos.fY,zText);
|
||||
}
|
||||
|
||||
void ViewProviderSketch::setPositionText(const Base::Vector2D &Pos)
|
||||
{
|
||||
char buf[40];
|
||||
|
|
|
@ -200,6 +200,7 @@ protected:
|
|||
/// build up the visual of the constraints
|
||||
void rebuildConstraintsVisual(void);
|
||||
|
||||
void setPositionText(const Base::Vector2D &Pos, const std::string &txt);
|
||||
void setPositionText(const Base::Vector2D &Pos);
|
||||
void resetPositionText(void);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user