SketcherGui::DrawSketchHandler Class Referenceabstract

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

void activate (ViewProviderSketch *)
 
void createAutoConstraints (const std::vector< AutoConstraint > &autoConstrs, int geoId, Sketcher::PointPos pointPos=Sketcher::PointPos::none, bool createowncommand=true)
 
void deactivate ()
 
 DrawSketchHandler ()
 
int getHighestCurveIndex (void)
 
int getHighestVertexIndex (void)
 
virtual void mouseMove (Base::Vector2d onSketchPos)=0
 
virtual bool onSelectionChanged (const Gui::SelectionChanges &)
 
virtual bool pressButton (Base::Vector2d onSketchPos)=0
 
virtual void quit (void)
 
virtual void registerPressedKey (bool, int)
 
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, AutoConstraint::TargetType type=AutoConstraint::VERTEX)
 
void setPositionText (const Base::Vector2d &Pos)
 
void setPositionText (const Base::Vector2d &Pos, const SbString &text)
 
virtual ~DrawSketchHandler ()
 

Protected Member Functions

virtual QString getCrosshairCursorSVGName () const
 

Friends

class ViewProviderSketch
 

Icon helpers

Sets a cursor for 3D inventor view.

pixmap as a cursor image in device independent pixels.

Parameters
autoScale- set this to false if pixmap already scaled for HiDPI
ViewProviderSketchsketchgui
 
QCursor oldCursor
 
QCursor actCursor
 
QPixmap actCursorPixmap
 
void setCursor (const QPixmap &pixmap, int x, int y, bool autoScale=true)
 
void updateCursor ()
 updates the actCursor with the icon by calling getCrosshairCursorSVGName(), enabling to set data member dependent icons (i.e. More...
 
void unsetCursor (void)
 restitutes the cursor that was in use at the moment of starting the DrawSketchHandler (i.e. oldCursor) More...
 
void applyCursor (void)
 restitutes the DSH cached cursor (e.g. without any tail due to autoconstraints, ...) More...
 
unsigned long getCrosshairColor ()
 returns the color to be used for the crosshair (configurable as a parameter) More...
 
qreal devicePixelRatio ()
 functions to set the cursor to a given svgName (to be migrated to NVI style) More...
 
void drawEdit (const std::vector< Base::Vector2d > &EditCurve)
 
void drawEdit (const std::list< std::vector< Base::Vector2d > > &list)
 
void drawEdit (const std::vector< Part::Geometry * > &geometries)
 
void drawEditMarkers (const std::vector< Base::Vector2d > &EditMarkers, unsigned int augmentationlevel=0)
 
void setAxisPickStyle (bool on)
 
void moveCursorToSketchPoint (Base::Vector2d point)
 
void preselectAtPoint (Base::Vector2d point)
 
void drawPositionAtCursor (const Base::Vector2d &position)
 
void drawDirectionAtCursor (const Base::Vector2d &position, const Base::Vector2d &origin)
 
int getPreselectPoint (void) const
 
int getPreselectCurve (void) const
 
int getPreselectCross (void) const
 
Sketcher::SketchObjectgetSketchObject ()
 
std::vector< QPixmap > suggestedConstraintsPixmaps (std::vector< AutoConstraint > &suggestedConstraints)
 Returns constraints icons scaled to width. More...
 

Detailed Description

Handler to create new sketch geometry This class has to be reimplemented to create geometry in the sketcher while its in editing.

DrawSketchHandler takes over the responsibility of drawing edit temporal curves and markers necessary to enable visual feedback to the user, as well as the UI interaction during such edits. This is its exclusive responsibility under the Single Responsibility Principle.

A plethora of speciliased handlers derive from DrawSketchHandler for each specialised editing (see for example all the handlers for creation of new geometry). These derived classes do * not * have direct access to the ViewProviderSketchDrawSketchHandlerAttorney. This is intended to keep coupling under control. However, generic functionality requiring access to the Attorney can be implemented in DrawSketchHandler and used from its derived classes by virtue of the inheritance. This promotes a concentrating the coupling in a single point (and code reuse).

Constructor & Destructor Documentation

◆ DrawSketchHandler()

DrawSketchHandler::DrawSketchHandler ( )

◆ ~DrawSketchHandler()

DrawSketchHandler::~DrawSketchHandler ( )
virtual

Member Function Documentation

◆ activate()

◆ applyCursor()

void DrawSketchHandler::applyCursor ( void  )
protected

restitutes the DSH cached cursor (e.g. without any tail due to autoconstraints, ...)

References actCursor, and applyCursor().

Referenced by applyCursor(), SketcherGui::DrawSketchHandlerBSpline::DrawSketchHandlerBSpline(), DrawSketchHandlerBSplineInsertKnot::mouseMove(), DrawSketchHandlerCopy::mouseMove(), DrawSketchHandlerRectangularArray::mouseMove(), SketcherGui::DrawSketchHandlerArc::mouseMove(), SketcherGui::DrawSketchHandler3PointArc::mouseMove(), SketcherGui::DrawSketchHandlerArcOfEllipse::mouseMove(), SketcherGui::DrawSketchHandlerArcOfHyperbola::mouseMove(), SketcherGui::DrawSketchHandlerArcOfParabola::mouseMove(), SketcherGui::DrawSketchHandlerCarbonCopy::mouseMove(), SketcherGui::DrawSketchHandlerCircle::mouseMove(), SketcherGui::DrawSketchHandler3PointCircle::mouseMove(), SketcherGui::DrawSketchHandlerEllipse::mouseMove(), SketcherGui::DrawSketchHandlerExternal::mouseMove(), SketcherGui::DrawSketchHandlerLine::mouseMove(), SketcherGui::DrawSketchHandlerLineSet::mouseMove(), SketcherGui::DrawSketchHandlerPoint::mouseMove(), SketcherGui::DrawSketchHandlerRegularPolygon::mouseMove(), SketcherGui::DrawSketchHandlerBox::mouseMove(), SketcherGui::DrawSketchHandlerOblong::mouseMove(), SketcherGui::DrawSketchHandlerSlot::mouseMove(), SketcherGui::DrawSketchHandlerArc::pressButton(), SketcherGui::DrawSketchHandler3PointArc::pressButton(), SketcherGui::DrawSketchHandler3PointCircle::pressButton(), SketcherGui::DrawSketchHandlerLineSet::pressButton(), SketcherGui::DrawSketchHandlerLineSet::quit(), DrawSketchHandlerBSplineInsertKnot::releaseButton(), SketcherGui::DrawSketchHandlerArc::releaseButton(), SketcherGui::DrawSketchHandler3PointArc::releaseButton(), SketcherGui::DrawSketchHandlerArcOfEllipse::releaseButton(), SketcherGui::DrawSketchHandlerCircle::releaseButton(), SketcherGui::DrawSketchHandler3PointCircle::releaseButton(), SketcherGui::DrawSketchHandlerExtend::releaseButton(), SketcherGui::DrawSketchHandlerLine::releaseButton(), SketcherGui::DrawSketchHandlerLineSet::releaseButton(), SketcherGui::DrawSketchHandlerPoint::releaseButton(), SketcherGui::DrawSketchHandlerRegularPolygon::releaseButton(), SketcherGui::DrawSketchHandlerBox::releaseButton(), SketcherGui::DrawSketchHandlerOblong::releaseButton(), SketcherGui::DrawSketchHandlerSlot::releaseButton(), SketcherGui::DrawSketchHandlerArcOfHyperbola::releaseButton(), and SketcherGui::DrawSketchHandlerArcOfParabola::releaseButton().

◆ createAutoConstraints()

void DrawSketchHandler::createAutoConstraints ( const std::vector< AutoConstraint > &  autoConstrs,
int  geoId,
Sketcher::PointPos  pointPos = Sketcher::PointPos::none,
bool  createowncommand = true 
)

References SketcherGui::ViewProviderSketch::Autoconstraints, Gui::cmdAppObjectArgs(), Sketcher::Coincident, Gui::Command::commitCommand(), Base::Persistence::getClassTypeId(), Sketcher::SketchObject::getGeometry(), Gui::ViewProviderDocumentObject::getObject(), Base::Persistence::getTypeId(), App::PropertyBool::getValue(), Sketcher::Horizontal, SketcherGui::makeTangentToArcOfEllipseviaNewPoint(), SketcherGui::makeTangentToEllipseviaNewPoint(), Sketcher::none, Gui::Command::openCommand(), Sketcher::PointOnObject, draftutils.translate::QT_TRANSLATE_NOOP, sketchgui, Sketcher::Tangent, and Sketcher::Vertical.

Referenced by SketcherGui::DrawSketchHandlerBSpline::pressButton(), DrawSketchHandlerCopy::releaseButton(), DrawSketchHandlerRectangularArray::releaseButton(), SketcherGui::DrawSketchHandlerArc::releaseButton(), SketcherGui::DrawSketchHandler3PointArc::releaseButton(), SketcherGui::DrawSketchHandlerArcOfEllipse::releaseButton(), SketcherGui::DrawSketchHandlerCircle::releaseButton(), SketcherGui::DrawSketchHandler3PointCircle::releaseButton(), SketcherGui::DrawSketchHandlerExtend::releaseButton(), SketcherGui::DrawSketchHandlerLine::releaseButton(), SketcherGui::DrawSketchHandlerLineSet::releaseButton(), SketcherGui::DrawSketchHandlerPoint::releaseButton(), SketcherGui::DrawSketchHandlerRegularPolygon::releaseButton(), SketcherGui::DrawSketchHandlerBox::releaseButton(), SketcherGui::DrawSketchHandlerOblong::releaseButton(), SketcherGui::DrawSketchHandlerSlot::releaseButton(), SketcherGui::DrawSketchHandlerArcOfHyperbola::releaseButton(), and SketcherGui::DrawSketchHandlerArcOfParabola::releaseButton().

◆ deactivate()

void DrawSketchHandler::deactivate ( )

◆ devicePixelRatio()

qreal DrawSketchHandler::devicePixelRatio ( )
protected

functions to set the cursor to a given svgName (to be migrated to NVI style)

References Gui::MainWindow::activeWindow(), Base::BaseClass::getClassTypeId(), Gui::getMainWindow(), and OfflineRenderingUtils::viewer().

◆ drawDirectionAtCursor()

void DrawSketchHandler::drawDirectionAtCursor ( const Base::Vector2d position,
const Base::Vector2d origin 
)
protected

References setPositionText().

◆ drawEdit() [1/3]

void DrawSketchHandler::drawEdit ( const std::list< std::vector< Base::Vector2d > > &  list)
protected

References sketchgui.

◆ drawEdit() [2/3]

void DrawSketchHandler::drawEdit ( const std::vector< Base::Vector2d > &  EditCurve)
protected

References sketchgui.

Referenced by deactivate(), drawEdit(), DrawSketchHandlerCopy::mouseMove(), DrawSketchHandlerRectangularArray::mouseMove(), SketcherGui::DrawSketchHandlerArc::mouseMove(), SketcherGui::DrawSketchHandler3PointArc::mouseMove(), SketcherGui::DrawSketchHandlerArcOfEllipse::mouseMove(), SketcherGui::DrawSketchHandlerArcOfHyperbola::mouseMove(), SketcherGui::DrawSketchHandlerArcOfParabola::mouseMove(), SketcherGui::DrawSketchHandlerCircle::mouseMove(), SketcherGui::DrawSketchHandler3PointCircle::mouseMove(), SketcherGui::DrawSketchHandlerEllipse::mouseMove(), SketcherGui::DrawSketchHandlerExtend::mouseMove(), SketcherGui::DrawSketchHandlerLine::mouseMove(), SketcherGui::DrawSketchHandlerLineSet::mouseMove(), SketcherGui::DrawSketchHandlerRegularPolygon::mouseMove(), SketcherGui::DrawSketchHandlerBox::mouseMove(), SketcherGui::DrawSketchHandlerOblong::mouseMove(), SketcherGui::DrawSketchHandlerSlot::mouseMove(), SketcherGui::DrawSketchHandlerArc::pressButton(), SketcherGui::DrawSketchHandler3PointArc::pressButton(), SketcherGui::DrawSketchHandler3PointCircle::pressButton(), SketcherGui::DrawSketchHandlerLine::pressButton(), SketcherGui::DrawSketchHandlerLineSet::pressButton(), SketcherGui::DrawSketchHandlerBox::pressButton(), DrawSketchHandlerCopy::pressButton(), DrawSketchHandlerRectangularArray::pressButton(), SketcherGui::DrawSketchHandlerLineSet::quit(), DrawSketchHandlerCopy::releaseButton(), DrawSketchHandlerRectangularArray::releaseButton(), SketcherGui::DrawSketchHandlerArc::releaseButton(), SketcherGui::DrawSketchHandler3PointArc::releaseButton(), SketcherGui::DrawSketchHandlerArcOfEllipse::releaseButton(), SketcherGui::DrawSketchHandlerCircle::releaseButton(), SketcherGui::DrawSketchHandler3PointCircle::releaseButton(), SketcherGui::DrawSketchHandlerExtend::releaseButton(), SketcherGui::DrawSketchHandlerLine::releaseButton(), SketcherGui::DrawSketchHandlerLineSet::releaseButton(), SketcherGui::DrawSketchHandlerRegularPolygon::releaseButton(), SketcherGui::DrawSketchHandlerBox::releaseButton(), SketcherGui::DrawSketchHandlerOblong::releaseButton(), SketcherGui::DrawSketchHandlerSlot::releaseButton(), SketcherGui::DrawSketchHandlerArcOfHyperbola::releaseButton(), and SketcherGui::DrawSketchHandlerArcOfParabola::releaseButton().

◆ drawEdit() [3/3]

void DrawSketchHandler::drawEdit ( const std::vector< Part::Geometry * > &  geometries)
protected

References drawEdit().

◆ drawEditMarkers()

void DrawSketchHandler::drawEditMarkers ( const std::vector< Base::Vector2d > &  EditMarkers,
unsigned int  augmentationlevel = 0 
)
protected

◆ drawPositionAtCursor()

void DrawSketchHandler::drawPositionAtCursor ( const Base::Vector2d position)
protected

References setPositionText().

◆ getCrosshairColor()

unsigned long DrawSketchHandler::getCrosshairColor ( )
protected

returns the color to be used for the crosshair (configurable as a parameter)

References App::GetApplication(), App::Application::GetParameterGroupByPath(), and ParameterGrp::GetUnsigned().

◆ getCrosshairCursorSVGName()

QString DrawSketchHandler::getCrosshairCursorSVGName ( ) const
protectedvirtual

Referenced by updateCursor().

◆ getHighestCurveIndex()

◆ getHighestVertexIndex()

int DrawSketchHandler::getHighestVertexIndex ( void  )

◆ getPreselectCross()

◆ getPreselectCurve()

◆ getPreselectPoint()

◆ getSketchObject()

Sketcher::SketchObject * DrawSketchHandler::getSketchObject ( )
protected

◆ mouseMove()

◆ moveCursorToSketchPoint()

void DrawSketchHandler::moveCursorToSketchPoint ( Base::Vector2d  point)
protected

References sketchgui.

◆ onSelectionChanged()

virtual bool SketcherGui::DrawSketchHandler::onSelectionChanged ( const Gui::SelectionChanges )
virtual

◆ preselectAtPoint()

void DrawSketchHandler::preselectAtPoint ( Base::Vector2d  point)
protected

References sketchgui.

◆ pressButton()

◆ quit()

◆ registerPressedKey()

virtual void SketcherGui::DrawSketchHandler::registerPressedKey ( bool  ,
int   
)
virtual

◆ releaseButton()

◆ renderSuggestConstraintsCursor()

◆ resetPositionText()

◆ seekAutoConstraint()

int DrawSketchHandler::seekAutoConstraint ( std::vector< AutoConstraint > &  suggestedConstraints,
const Base::Vector2d Pos,
const Base::Vector2d Dir,
AutoConstraint::TargetType  type = AutoConstraint::VERTEX 
)

References SketcherGui::ViewProviderSketch::Autoconstraints, Sketcher::Coincident, SketcherGui::AutoConstraint::CURVE, Base::fmod(), SketcherGui::AutoConstraint::GeoId, Part::GeomArcOfConic::getCenter(), Base::Persistence::getClassTypeId(), Sketcher::SketchObject::getCompleteGeometry(), Part::GeomLineSegment::getEndPoint(), Sketcher::SketchObject::getGeometry(), Sketcher::SketchObject::getGeoVertexIndex(), getHighestCurveIndex(), Part::GeomArcOfEllipse::getMajorAxisDir(), Part::GeomArcOfEllipse::getMajorRadius(), Part::GeomArcOfEllipse::getMinorRadius(), getPreselectCross(), getPreselectCurve(), getPreselectPoint(), Part::GeomArcOfEllipse::getRange(), SketcherGui::ViewProviderSketch::getScaleFactor(), SketcherGui::ViewProviderSketch::getSketchObject(), Part::GeomLineSegment::getStartPoint(), Base::Persistence::getTypeId(), App::PropertyBool::getValue(), Sketcher::Horizontal, Base::Vector2d::Length(), Base::Vector3< _Precision >::Length(), Sketcher::none, Base::Vector3< _Precision >::Normalize(), Sketcher::PointOnObject, SketcherGui::AutoConstraint::PosId, Base::Vector3< _Precision >::ProjectToLine(), sketchgui, Sketcher::start, Sketcher::Tangent, SketcherGui::AutoConstraint::Type, SketcherGui::AutoConstraint::VERTEX, SketcherGui::AutoConstraint::VERTEX_NO_TANGENCY, Sketcher::Vertical, Base::Vector2d::x, Base::Vector3< _Precision >::x, Base::Vector2d::y, and Base::Vector3< _Precision >::y.

Referenced by DrawSketchHandlerCopy::mouseMove(), DrawSketchHandlerRectangularArray::mouseMove(), SketcherGui::DrawSketchHandlerArc::mouseMove(), SketcherGui::DrawSketchHandler3PointArc::mouseMove(), SketcherGui::DrawSketchHandlerArcOfEllipse::mouseMove(), SketcherGui::DrawSketchHandlerArcOfHyperbola::mouseMove(), SketcherGui::DrawSketchHandlerArcOfParabola::mouseMove(), SketcherGui::DrawSketchHandlerBSpline::mouseMove(), SketcherGui::DrawSketchHandlerCircle::mouseMove(), SketcherGui::DrawSketchHandler3PointCircle::mouseMove(), SketcherGui::DrawSketchHandlerEllipse::mouseMove(), SketcherGui::DrawSketchHandlerExtend::mouseMove(), SketcherGui::DrawSketchHandlerLine::mouseMove(), SketcherGui::DrawSketchHandlerLineSet::mouseMove(), SketcherGui::DrawSketchHandlerPoint::mouseMove(), SketcherGui::DrawSketchHandlerRegularPolygon::mouseMove(), SketcherGui::DrawSketchHandlerBox::mouseMove(), SketcherGui::DrawSketchHandlerOblong::mouseMove(), and SketcherGui::DrawSketchHandlerSlot::mouseMove().

◆ setAxisPickStyle()

void DrawSketchHandler::setAxisPickStyle ( bool  on)
protected

References sketchgui.

◆ setCursor()

◆ setPositionText() [1/2]

void DrawSketchHandler::setPositionText ( const Base::Vector2d Pos)

References sketchgui.

◆ setPositionText() [2/2]

◆ suggestedConstraintsPixmaps()

std::vector< QPixmap > DrawSketchHandler::suggestedConstraintsPixmaps ( std::vector< AutoConstraint > &  suggestedConstraints)
protected

◆ unsetCursor()

◆ updateCursor()

void DrawSketchHandler::updateCursor ( )
protected

updates the actCursor with the icon by calling getCrosshairCursorSVGName(), enabling to set data member dependent icons (i.e.

for different construction methods)

References getCrosshairCursorSVGName().

Referenced by activate().

Friends And Related Function Documentation

◆ ViewProviderSketch

friend class ViewProviderSketch
friend

Member Data Documentation

◆ actCursor

QCursor SketcherGui::DrawSketchHandler::actCursor
protected

Referenced by applyCursor(), and setCursor().

◆ actCursorPixmap

QPixmap SketcherGui::DrawSketchHandler::actCursorPixmap
protected

Referenced by setCursor().

◆ oldCursor

QCursor SketcherGui::DrawSketchHandler::oldCursor
protected

Referenced by activate(), and unsetCursor().

◆ sketchgui

ViewProviderSketch* SketcherGui::DrawSketchHandler::sketchgui
protected

Referenced by activate(), createAutoConstraints(), deactivate(), drawEdit(), drawEditMarkers(), getHighestCurveIndex(), getHighestVertexIndex(), getPreselectCross(), getPreselectCurve(), getPreselectPoint(), getSketchObject(), SketcherGui::DrawSketchHandlerExtend::mouseMove(), SketcherGui::DrawSketchHandlerTrimming::mouseMove(), moveCursorToSketchPoint(), SketcherGui::DrawSketchHandlerCarbonCopy::onSelectionChanged(), SketcherGui::DrawSketchHandlerExternal::onSelectionChanged(), preselectAtPoint(), SketcherGui::DrawSketchHandlerBSpline::pressButton(), SketcherGui::DrawSketchHandlerLineSet::pressButton(), quit(), SketcherGui::DrawSketchHandlerBSpline::quit(), SketcherGui::DrawSketchHandlerBSpline::registerPressedKey(), SketcherGui::DrawSketchHandlerLineSet::registerPressedKey(), DrawSketchHandlerGenConstraint::releaseButton(), DrawSketchHandlerCoincident::releaseButton(), DrawSketchHandlerBSplineInsertKnot::releaseButton(), DrawSketchHandlerCopy::releaseButton(), DrawSketchHandlerRectangularArray::releaseButton(), SketcherGui::DrawSketchHandlerArc::releaseButton(), SketcherGui::DrawSketchHandler3PointArc::releaseButton(), SketcherGui::DrawSketchHandlerArcOfEllipse::releaseButton(), SketcherGui::DrawSketchHandlerCircle::releaseButton(), SketcherGui::DrawSketchHandler3PointCircle::releaseButton(), SketcherGui::DrawSketchHandlerExtend::releaseButton(), SketcherGui::DrawSketchHandlerFillet::releaseButton(), SketcherGui::DrawSketchHandlerLine::releaseButton(), SketcherGui::DrawSketchHandlerLineSet::releaseButton(), SketcherGui::DrawSketchHandlerPoint::releaseButton(), SketcherGui::DrawSketchHandlerRegularPolygon::releaseButton(), SketcherGui::DrawSketchHandlerBox::releaseButton(), SketcherGui::DrawSketchHandlerOblong::releaseButton(), SketcherGui::DrawSketchHandlerSlot::releaseButton(), SketcherGui::DrawSketchHandlerSplitting::releaseButton(), SketcherGui::DrawSketchHandlerTrimming::releaseButton(), SketcherGui::DrawSketchHandlerArcOfHyperbola::releaseButton(), SketcherGui::DrawSketchHandlerArcOfParabola::releaseButton(), resetPositionText(), seekAutoConstraint(), setAxisPickStyle(), setPositionText(), and SketcherGui::DrawSketchHandlerLineSet::updateTransitionData().


The documentation for this class was generated from the following files: