Handler to create new sketch geometry This class has to be reimplemented to create geometry in the sketcher while its in editing. More...
#include <DrawSketchHandler.h>
Public Member Functions | |
virtual void | activated (ViewProviderSketch *sketchgui) |
void | createAutoConstraints (const std::vector< AutoConstraint > &autoConstrs, int geoId, Sketcher::PointPos pointPos=Sketcher::none) |
DrawSketchHandler () | |
int | getHighestCurveIndex (void) |
int | getHighestVertexIndex (void) |
Sketcher::SketchObject * | getObject (void) |
virtual void | mouseMove (Base::Vector2D onSketchPos)=0 |
virtual bool | pressButton (Base::Vector2D onSketchPos)=0 |
virtual void | quit (void) |
virtual bool | releaseButton (Base::Vector2D onSketchPos)=0 |
void | renderSuggestConstraintsCursor (std::vector< AutoConstraint > &suggestedConstraints) |
void | resetPositionText (void) |
int | seekAutoConstraint (std::vector< AutoConstraint > &suggestedConstraints, const Base::Vector2D &Pos, const Base::Vector2D &Dir, Type selType=VERTEX) |
void | setPositionText (const Base::Vector2D &Pos) |
virtual | ~DrawSketchHandler () |
Protected Member Functions | |
void | applyCursor (QCursor &newCursor) |
void | applyCursor (void) |
void | setCursor (const QPixmap &p, int x, int y) |
void | unsetCursor (void) |
Protected Attributes | |
QCursor | actCursor |
QCursor | oldCursor |
ViewProviderSketch * | sketchgui |
Friends | |
class | ViewProviderSketch |
Handler to create new sketch geometry This class has to be reimplemented to create geometry in the sketcher while its in editing.
Definition at line 63 of file DrawSketchHandler.h.
DrawSketchHandler::DrawSketchHandler | ( | ) |
Definition at line 61 of file DrawSketchHandler.cpp.
DrawSketchHandler::~DrawSketchHandler | ( | ) | [virtual] |
Definition at line 67 of file DrawSketchHandler.cpp.
virtual void SketcherGui::DrawSketchHandler::activated | ( | ViewProviderSketch * | sketchgui | ) | [inline, virtual] |
Reimplemented in DrawSketchHandlerLine, DrawSketchHandlerBox, DrawSketchHandlerLineSet, DrawSketchHandlerArc, DrawSketchHandlerCircle, DrawSketchHandlerFillet, and DrawSketchHandlerTrimming.
Definition at line 69 of file DrawSketchHandler.h.
Referenced by SketcherGui::ViewProviderSketch::activateHandler().
void DrawSketchHandler::applyCursor | ( | QCursor & | newCursor | ) | [protected] |
Definition at line 119 of file DrawSketchHandler.cpp.
References Gui::View3DInventor::getClassTypeId(), Gui::getMainWindow(), and Base::BaseClass::isDerivedFrom().
void DrawSketchHandler::applyCursor | ( | void | ) | [protected] |
Definition at line 114 of file DrawSketchHandler.cpp.
References actCursor.
Referenced by SketcherGui::ViewProviderSketch::detectPreselection(), DrawSketchHandlerCircle::mouseMove(), DrawSketchHandlerArc::mouseMove(), DrawSketchHandlerLineSet::mouseMove(), DrawSketchHandlerBox::mouseMove(), DrawSketchHandlerLine::mouseMove(), DrawSketchHandlerArc::pressButton(), DrawSketchHandlerLineSet::pressButton(), DrawSketchHandlerLineSet::releaseButton(), and renderSuggestConstraintsCursor().
void DrawSketchHandler::createAutoConstraints | ( | const std::vector< AutoConstraint > & | autoConstrs, | |
int | geoId, | |||
Sketcher::PointPos | pointPos = Sketcher::none | |||
) |
Definition at line 274 of file DrawSketchHandler.cpp.
References SketcherGui::ViewProviderSketch::Autoconstraints, Sketcher::Coincident, Gui::Command::commitCommand(), Gui::Command::Doc, Gui::Command::doCommand(), Sketcher::SketchObject::getGeoVertexIndex(), App::DocumentObject::getNameInDocument(), Gui::ViewProviderDocumentObject::getObject(), SketcherGui::ViewProviderSketch::getSketchObject(), App::PropertyBool::getValue(), Sketcher::Horizontal, Sketcher::none, Gui::Command::openCommand(), Sketcher::PointOnObject, sketchgui, Sketcher::Tangent, Gui::Command::updateActive(), and Sketcher::Vertical.
Referenced by DrawSketchHandlerCircle::releaseButton(), DrawSketchHandlerArc::releaseButton(), DrawSketchHandlerLineSet::releaseButton(), DrawSketchHandlerBox::releaseButton(), and DrawSketchHandlerLine::releaseButton().
int DrawSketchHandler::getHighestCurveIndex | ( | void | ) |
Definition at line 95 of file DrawSketchHandler.cpp.
References Sketcher::SketchObject::getHighestCurveIndex(), and getObject().
Referenced by DrawSketchHandlerLineSet::pressButton(), DrawSketchHandlerCircle::releaseButton(), DrawSketchHandlerArc::releaseButton(), DrawSketchHandlerLineSet::releaseButton(), DrawSketchHandlerBox::releaseButton(), and DrawSketchHandlerLine::releaseButton().
int DrawSketchHandler::getHighestVertexIndex | ( | void | ) |
Definition at line 90 of file DrawSketchHandler.cpp.
References Sketcher::SketchObject::getHighestVertexIndex(), and getObject().
Referenced by DrawSketchHandlerLineSet::pressButton().
Sketcher::SketchObject * DrawSketchHandler::getObject | ( | void | ) |
Definition at line 85 of file DrawSketchHandler.cpp.
References Gui::ViewProviderDocumentObject::getObject(), and sketchgui.
Referenced by getHighestCurveIndex(), getHighestVertexIndex(), DrawSketchHandlerLineSet::releaseButton(), and seekAutoConstraint().
virtual void SketcherGui::DrawSketchHandler::mouseMove | ( | Base::Vector2D | onSketchPos | ) | [pure virtual] |
virtual bool SketcherGui::DrawSketchHandler::pressButton | ( | Base::Vector2D | onSketchPos | ) | [pure virtual] |
void DrawSketchHandler::quit | ( | void | ) | [virtual] |
Definition at line 72 of file DrawSketchHandler.cpp.
References SketcherGui::ViewProviderSketch::drawEdit(), SketcherGui::ViewProviderSketch::purgeHandler(), resetPositionText(), sketchgui, and unsetCursor().
Referenced by SketcherGui::ViewProviderSketch::keyPressed(), and SketcherGui::ViewProviderSketch::mouseButtonPressed().
virtual bool SketcherGui::DrawSketchHandler::releaseButton | ( | Base::Vector2D | onSketchPos | ) | [pure virtual] |
void DrawSketchHandler::renderSuggestConstraintsCursor | ( | std::vector< AutoConstraint > & | suggestedConstraints | ) |
Definition at line 341 of file DrawSketchHandler.cpp.
References actCursor, applyCursor(), Gui::BitmapFactory(), Sketcher::Coincident, Sketcher::Horizontal, draftTools::p, Sketcher::PointOnObject, Sketcher::Tangent, and Sketcher::Vertical.
Referenced by DrawSketchHandlerCircle::mouseMove(), DrawSketchHandlerArc::mouseMove(), DrawSketchHandlerLineSet::mouseMove(), DrawSketchHandlerBox::mouseMove(), and DrawSketchHandlerLine::mouseMove().
void DrawSketchHandler::resetPositionText | ( | void | ) |
Definition at line 398 of file DrawSketchHandler.cpp.
References SketcherGui::ViewProviderSketch::resetPositionText(), and sketchgui.
Referenced by DrawSketchHandlerLineSet::pressButton(), quit(), DrawSketchHandlerCircle::releaseButton(), DrawSketchHandlerArc::releaseButton(), DrawSketchHandlerLineSet::releaseButton(), DrawSketchHandlerBox::releaseButton(), and DrawSketchHandlerLine::releaseButton().
int DrawSketchHandler::seekAutoConstraint | ( | std::vector< AutoConstraint > & | suggestedConstraints, | |
const Base::Vector2D & | Pos, | |||
const Base::Vector2D & | Dir, | |||
Type | selType = VERTEX | |||
) |
Definition at line 137 of file DrawSketchHandler.cpp.
References Py::abs(), draftlibs::fcvec::angle(), KDL::atan2(), SketcherGui::ViewProviderSketch::Autoconstraints, Sketcher::Coincident, SketcherGui::CURVE, SketcherExample::f, Base::Vector2D::fX, Base::Vector2D::fY, Sketcher::SketchObject::Geometry, Part::GeomArcOfCircle::getCenter(), Part::GeomCircle::getCenter(), Part::GeomArcOfCircle::getClassTypeId(), Part::GeomCircle::getClassTypeId(), getObject(), SketcherGui::ViewProviderSketch::getPreselectCurve(), SketcherGui::ViewProviderSketch::getPreselectPoint(), Part::GeomArcOfCircle::getRadius(), Part::GeomCircle::getRadius(), Part::GeomArcOfCircle::getRange(), App::PropertyBool::getValue(), Part::PropertyGeometryList::getValues(), Sketcher::Horizontal, SketcherGui::AutoConstraint::Index, Base::Vector3< _Precision >::Length(), Base::Vector2D::Length(), M_PI, M_PI_2, Sketcher::PointOnObject, Base::Vector3< _Precision >::ProjToLine(), sketchgui, Sketcher::Tangent, SketcherGui::AutoConstraint::Type, SketcherGui::VERTEX, Sketcher::Vertical, Base::Vector3< _Precision >::x, and Base::Vector3< _Precision >::y.
Referenced by DrawSketchHandlerCircle::mouseMove(), DrawSketchHandlerArc::mouseMove(), DrawSketchHandlerLineSet::mouseMove(), DrawSketchHandlerBox::mouseMove(), and DrawSketchHandlerLine::mouseMove().
void DrawSketchHandler::setCursor | ( | const QPixmap & | p, | |
int | x, | |||
int | y | |||
) | [protected] |
Definition at line 100 of file DrawSketchHandler.cpp.
References actCursor, Gui::View3DInventor::getClassTypeId(), Gui::getMainWindow(), Base::BaseClass::isDerivedFrom(), and oldCursor.
Referenced by DrawSketchHandlerTrimming::activated(), DrawSketchHandlerFillet::activated(), DrawSketchHandlerCircle::activated(), DrawSketchHandlerArc::activated(), DrawSketchHandlerLineSet::activated(), DrawSketchHandlerBox::activated(), and DrawSketchHandlerLine::activated().
void DrawSketchHandler::setPositionText | ( | const Base::Vector2D & | Pos | ) |
Definition at line 393 of file DrawSketchHandler.cpp.
References SketcherGui::ViewProviderSketch::setPositionText(), and sketchgui.
Referenced by DrawSketchHandlerCircle::mouseMove(), DrawSketchHandlerArc::mouseMove(), DrawSketchHandlerLineSet::mouseMove(), DrawSketchHandlerBox::mouseMove(), and DrawSketchHandlerLine::mouseMove().
void DrawSketchHandler::unsetCursor | ( | void | ) | [protected] |
Definition at line 128 of file DrawSketchHandler.cpp.
References Gui::View3DInventor::getClassTypeId(), Gui::getMainWindow(), Base::BaseClass::isDerivedFrom(), and oldCursor.
Referenced by DrawSketchHandlerLineSet::pressButton(), quit(), DrawSketchHandlerCircle::releaseButton(), DrawSketchHandlerArc::releaseButton(), DrawSketchHandlerLineSet::releaseButton(), DrawSketchHandlerBox::releaseButton(), DrawSketchHandlerLine::releaseButton(), and SketcherGui::ViewProviderSketch::unsetEdit().
friend class ViewProviderSketch [friend] |
Definition at line 76 of file DrawSketchHandler.h.
QCursor SketcherGui::DrawSketchHandler::actCursor [protected] |
Definition at line 102 of file DrawSketchHandler.h.
Referenced by applyCursor(), renderSuggestConstraintsCursor(), and setCursor().
QCursor SketcherGui::DrawSketchHandler::oldCursor [protected] |
Definition at line 101 of file DrawSketchHandler.h.
Referenced by setCursor(), and unsetCursor().
Definition at line 100 of file DrawSketchHandler.h.
Referenced by SketcherGui::ViewProviderSketch::activateHandler(), createAutoConstraints(), getObject(), DrawSketchHandlerCircle::mouseMove(), DrawSketchHandlerArc::mouseMove(), DrawSketchHandlerLineSet::mouseMove(), DrawSketchHandlerBox::mouseMove(), DrawSketchHandlerLine::mouseMove(), DrawSketchHandlerArc::pressButton(), DrawSketchHandlerLineSet::pressButton(), DrawSketchHandlerBox::pressButton(), DrawSketchHandlerLine::pressButton(), quit(), DrawSketchHandlerTrimming::releaseButton(), DrawSketchHandlerFillet::releaseButton(), DrawSketchHandlerCircle::releaseButton(), DrawSketchHandlerArc::releaseButton(), DrawSketchHandlerLineSet::releaseButton(), DrawSketchHandlerBox::releaseButton(), DrawSketchHandlerLine::releaseButton(), resetPositionText(), seekAutoConstraint(), and setPositionText().