The Sketch ViewProvider This class handles mainly the drawing and editing of the sketch. More...
#include <ViewProviderSketch.h>
Public Member Functions | |
void | draw (bool temp=false) |
draw the sketch in the inventor nodes | |
void | drawConstraintIcons () |
draw constraint icon given the constraint id | |
void | drawEdit (const std::vector< Base::Vector2D > &EditCurve) |
draw the edit curve | |
virtual Base::Type | getTypeId (void) const |
bool | isSelectable (void) const |
Is the view provider selectable. | |
virtual void | onSelectionChanged (const Gui::SelectionChanges &msg) |
Observer message from the Selection. | |
ViewProviderSketch () | |
constructor | |
virtual | ~ViewProviderSketch () |
destructor | |
handler control | |
void | activateHandler (DrawSketchHandler *newHandler) |
sets an DrawSketchHandler in control | |
void | purgeHandler (void) |
removes the active handler | |
base class implementer | |
virtual void | attach (App::DocumentObject *) |
Attaches the document object to this view provider. | |
virtual bool | doubleClicked (void) |
is called by the tree if the user double click on the object | |
virtual bool | keyPressed (bool pressed, int key) |
is called when the Provider is in edit and a key event ocours. Only ESC ends edit. | |
virtual bool | mouseButtonPressed (int Button, bool pressed, const SbVec3f &point, const SbVec3f &normal, const SoPickedPoint *pp) |
is called when the Provider is in edit and the mouse is clicked | |
virtual bool | mouseMove (const SbVec3f &pNear, const SbVec3f &pFar, const SoPickedPoint *pp) |
is called when the Provider is in edit and the mouse is moved | |
virtual bool | onDelete (const std::vector< std::string > &) |
is called when the Provider is in edit and a deletion request occurs | |
virtual void | setupContextMenu (QMenu *menu, QObject *receiver, const char *member) |
set up the context-menu with the supported edit modes | |
virtual void | updateData (const App::Property *) |
Gets called if some of the property hade bin changed. | |
helper functions | |
bool | detectPreselection (const SoPickedPoint *Point, int &PtIndex, int &CurvIndex, int &ConstrIndex, int &CrossIndex) |
void | getCoordsOnSketchPlane (double &u, double &v, const SbVec3f &point, const SbVec3f &normal) |
give the coordinates of a line on the sketch plane in sketcher (2D) coordinates | |
int | getPreselectConstraint (void) const |
int | getPreselectCurve (void) const |
int | getPreselectPoint (void) const |
float | getScaleFactor () |
Sketcher::SketchObject * | getSketchObject (void) const |
get the pointer to the sketch document object | |
bool | isConstraintAtPosition (const Base::Vector3d &constrPos, const SoNode *constraint) |
checks if there is a constraint object at position vector | |
void | moveConstraint (int constNum, const Base::Vector2D &toPos) |
moves a selected constraint | |
Base::Vector3d | seekConstraintPosition (const Base::Vector3d &suggestedPos, const Base::Vector3d &dir, float step, const SoNode *constraint) |
finds a free position for placing a constraint icon | |
void | snapToGrid (double &x, double &y) |
snap points x,y (mouse coordinates) onto grid if enabled | |
void | updateColor (void) |
helper change the color of the sketch according to selection and solver status | |
Static Public Member Functions | |
static void * | create (void) |
static Base::Type | getClassTypeId (void) |
static void | init (void) |
Public Attributes | |
App::PropertyBool | Autoconstraints |
boost::signal< void()> | signalConstraintsChanged |
signals if the constraints list has changed | |
boost::signal< void(int type, int dofs, std::string &msg)> | signalSetUp |
signals if the sketch has been set up | |
boost::signal< void(int type, float time)> | signalSolved |
signals if the sketch has been solved | |
Protected Member Functions | |
void | addSelectPoint (int SelectPoint) |
void | clearSelectPoints (void) |
void | createEditInventorNodes (void) |
set up the edition data structure EditData | |
void | editDoubleClicked (void) |
get called if a subelement is double clicked while editing | |
virtual const App::PropertyData & | getPropertyData (void) const |
bool | isPointOnSketch (const SoPickedPoint *pp) const |
helper to detect whether the picked point lies on the sketch | |
virtual void | onChanged (const App::Property *prop) |
get called by the container whenever a property has been changed | |
void | rebuildConstraintsVisual (void) |
build up the visual of the constraints | |
void | removeSelectPoint (int SelectPoint) |
void | resetPositionText (void) |
void | resetPreselectPoint (void) |
virtual bool | setEdit (int ModNum) |
is called by the document when the provider goes in edit mode | |
virtual void | setEditViewer (Gui::View3DInventorViewer *, int ModNum) |
adjust viewer settings when editing a view provider | |
void | setPositionText (const Base::Vector2D &Pos) |
void | setPreselectPoint (int PreselectPoint) |
virtual void | unsetEdit (int ModNum) |
is called when you loose the edit mode | |
virtual void | unsetEditViewer (Gui::View3DInventorViewer *) |
restores viewer settings when leaving editing mode | |
Static Protected Member Functions | |
static const App::PropertyData * | getPropertyDataPtr (void) |
Protected Attributes | |
EditData * | edit |
pointer to the edit data structure if the ViewProvider is in edit. | |
SketchMode | Mode |
bool | relative |
double | xInit |
double | yInit |
float | zConstr |
float | zCross |
float | zEdit |
float | zHighlight |
float | zLines |
float | zPoints |
float | zText |
Static Protected Attributes | |
static SbColor | ConstrDimColor |
static SbColor | ConstrIcoColor |
static SbColor | CrossColorH |
static SbColor | CrossColorV |
static SbColor | CurveColor |
static SbColor | CurveDraftColor |
static SbColor | FullyConstrainedColor |
static SbColor | PreselectColor |
static SbVec3f | prvClickPoint |
static SbTime | prvClickTime |
static SbColor | SelectColor |
static SbColor | VertexColor |
Friends | |
class | DrawSketchHandler |
modus handling | |
| |
enum | SketchMode { STATUS_NONE, STATUS_SELECT_Point, STATUS_SELECT_Edge, STATUS_SELECT_Constraint, STATUS_SELECT_Cross, STATUS_SKETCH_DragPoint, STATUS_SKETCH_DragCurve, STATUS_SKETCH_DragConstraint, STATUS_SKETCH_UseHandler } |
mode table More... | |
SketchMode | getSketchMode (void) const |
get the sketch mode | |
void | setSketchMode (SketchMode mode) |
is called by GuiCommands to set the drawing mode |
The Sketch ViewProvider This class handles mainly the drawing and editing of the sketch.
It draws the geometry and the constraints applied to the sketch. It uses the class DrawSketchHandler to facilitade the creation of new geometry while editing.
Definition at line 70 of file ViewProviderSketch.h.
mode table
STATUS_NONE |
enum value View provider is in neutral. |
STATUS_SELECT_Point |
enum value a point was selected. |
STATUS_SELECT_Edge |
enum value a edge was selected. |
STATUS_SELECT_Constraint |
enum value a constraint was selected. |
STATUS_SELECT_Cross |
enum value the base coordinate system was selected. |
STATUS_SKETCH_DragPoint |
enum value while dragging a point. |
STATUS_SKETCH_DragCurve |
enum value while dragging a curve. |
STATUS_SKETCH_DragConstraint |
enum value while dragging a compatible constraint. |
STATUS_SKETCH_UseHandler |
enum value a DrawSketchHandler is in control. |
Definition at line 105 of file ViewProviderSketch.h.
ViewProviderSketch::ViewProviderSketch | ( | ) |
constructor
Definition at line 203 of file ViewProviderSketch.cpp.
References ADD_PROPERTY_TYPE, and App::Prop_None.
ViewProviderSketch::~ViewProviderSketch | ( | ) | [virtual] |
destructor
Definition at line 228 of file ViewProviderSketch.cpp.
void ViewProviderSketch::activateHandler | ( | DrawSketchHandler * | newHandler | ) |
sets an DrawSketchHandler in control
Definition at line 233 of file ViewProviderSketch.cpp.
References SketcherGui::DrawSketchHandler::activated(), edit, Mode, SketcherGui::DrawSketchHandler::sketchgui, EditData::sketchHandler, and STATUS_SKETCH_UseHandler.
void ViewProviderSketch::addSelectPoint | ( | int | SelectPoint | ) | [protected] |
Definition at line 2943 of file ViewProviderSketch.cpp.
References edit, EditData::PointsCoordinate, EditData::SelPointSet, MovieTool::x, MovieTool::y, and zHighlight.
Referenced by onSelectionChanged().
void ViewProviderSketch::attach | ( | App::DocumentObject * | pcObject | ) | [virtual] |
Attaches the document object to this view provider.
Reimplemented from PartGui::ViewProvider2DObject.
Definition at line 2584 of file ViewProviderSketch.cpp.
Referenced by SketcherGui::ViewProviderCustom::updateData().
void ViewProviderSketch::clearSelectPoints | ( | void | ) | [protected] |
Definition at line 2969 of file ViewProviderSketch.cpp.
References edit, EditData::PointsCoordinate, EditData::SelPointSet, MovieTool::x, MovieTool::y, and zPoints.
Referenced by onSelectionChanged().
void * SketcherGui::ViewProviderSketch::create | ( | void | ) | [static] |
Reimplemented from PartGui::ViewProvider2DObject.
Reimplemented in SketcherGui::ViewProviderCustom.
Definition at line 200 of file ViewProviderSketch.cpp.
void ViewProviderSketch::createEditInventorNodes | ( | void | ) | [protected] |
set up the edition data structure EditData
Definition at line 2712 of file ViewProviderSketch.cpp.
References EditData::constrGroup, CrossColorH, CrossColorV, EditData::CurvesCoordinate, EditData::CurveSet, EditData::CurvesMaterials, edit, EditData::EditCurvesCoordinate, EditData::EditCurveSet, EditData::EditCurvesMaterials, EditData::EditRoot, draftlibs::dxfImportObjects::LEFT, MeshCore::MeshIO::OFF, MeshCore::MeshIO::OVERALL, Gui::ViewProvider::pcRoot, MeshCore::MeshIO::PER_FACE, MeshCore::MeshIO::PER_VERTEX, EditData::PointsCoordinate, EditData::PointSet, EditData::PointsMaterials, EditData::RootCrossCoordinateH, EditData::RootCrossCoordinateV, EditData::RootCrossMaterialsH, EditData::RootCrossMaterialsV, EditData::RootCrossSetH, EditData::RootCrossSetV, EditData::textPos, and EditData::textX.
Referenced by setEdit().
bool ViewProviderSketch::detectPreselection | ( | const SoPickedPoint * | Point, | |
int & | PtIndex, | |||
int & | CurvIndex, | |||
int & | ConstrIndex, | |||
int & | CrossIndex | |||
) |
helper to detect preselection
Definition at line 1125 of file ViewProviderSketch.cpp.
References SketcherGui::DrawSketchHandler::applyCursor(), EditData::blockedPreselection, EditData::constrGroup, EditData::CurveSet, edit, getClassTypeId(), App::PropertyContainer::getName(), Sketcher::SketchObject::getPoint(), getSketchObject(), EditData::PointSet, EditData::PreselectConstraint, EditData::PreselectCross, EditData::PreselectCurve, EditData::PreselectPoint, resetPreselectPoint(), EditData::RootCrossSetH, EditData::RootCrossSetV, Gui::Selection(), setPreselectPoint(), and EditData::sketchHandler.
Referenced by mouseMove().
bool ViewProviderSketch::doubleClicked | ( | void | ) | [virtual] |
is called by the tree if the user double click on the object
Reimplemented from Gui::ViewProviderGeometryObject.
Definition at line 1397 of file ViewProviderSketch.cpp.
References Gui::Application::Instance.
void ViewProviderSketch::draw | ( | bool | temp = false |
) |
draw the sketch in the inventor nodes
Definition at line 1537 of file ViewProviderSketch.cpp.
References Py::abs(), EditData::ActSketch, Base::Angle, draftlibs::fcvec::angle(), KDL::atan2(), Mod::PartDesign::Scripts::Gear::c1, Sketcher::Coincident, Sketcher::SketchObject::Constraints, EditData::constrGroup, KDL::cos(), EditData::CurvesCoordinate, EditData::CurveSet, EditData::CurvesMaterials, Sketcher::Distance, Sketcher::DistanceX, Sketcher::DistanceY, boost::numeric::bindings::atlas::dot(), drawConstraintIcons(), edit, Sketcher::end, Sketcher::Equal, KDL::exp(), SketcherExample::f, Sketcher::Constraint::First, Sketcher::Constraint::FirstPos, Sketcher::SketchObject::Geometry, Part::GeomArcOfCircle::getCenter(), Part::GeomCircle::getCenter(), Gui::View3DInventor::getClassTypeId(), getClassTypeId(), Part::GeomArcOfCircle::getEndPoint(), Part::GeomLineSegment::getEndPoint(), Sketcher::Sketch::getGeometry(), Sketcher::SketchObject::getPoint(), Sketcher::Sketch::getPoint(), Part::GeomBSplineCurve::getPoles(), Part::GeomArcOfCircle::getRadius(), Part::GeomCircle::getRadius(), Part::GeomArcOfCircle::getRange(), getScaleFactor(), getSketchObject(), Part::GeomArcOfCircle::getStartPoint(), Part::GeomLineSegment::getStartPoint(), Part::Geometry::getTypeId(), Sketcher::PropertyConstraintList::getValues(), Part::PropertyGeometryList::getValues(), Part::GeomBSplineCurve::handle(), Part::GeomArcOfCircle::handle(), Part::GeomCircle::handle(), Sketcher::Horizontal, Gui::Application::Instance, Base::BaseClass::isDerivedFrom(), Sketcher::Constraint::LabelDistance, KDL::log(), M_PI, M_PI_2, KDL::max(), PartGui::ViewProvider2DObject::MaxX, PartGui::ViewProvider2DObject::MaxY, zipios::min(), PartGui::ViewProvider2DObject::MinX, PartGui::ViewProvider2DObject::MinY, Sketcher::None, Sketcher::none, PartGui::ViewProviderPartExt::norm, Sketcher::Parallel, Sketcher::Perpendicular, Sketcher::PointOnObject, EditData::PointsCoordinate, EditData::PointsMaterials, RobotExample::pos, Base::Vector3< _Precision >::ProjToLine(), Sketcher::Radius, rebuildConstraintsVisual(), EditData::RootCrossCoordinateH, EditData::RootCrossCoordinateV, EditData::RootCrossSetH, EditData::RootCrossSetV, scale, Sketcher::Constraint::Second, Sketcher::Constraint::SecondPos, seekConstraintPosition(), KDL::sin(), Sketcher::start, SketcherGui::SoDatumLabel::string, boost::numeric::bindings::atlas::swap(), Sketcher::Symmetric, Sketcher::Tangent, Sketcher::Constraint::Type, updateColor(), draftlibs::fcgeo::v1(), Sketcher::Constraint::Value, EditData::vConstrType, Sketcher::Vertical, MovieTool::x, Base::Vector3< _Precision >::x, MovieTool::y, Base::Vector3< _Precision >::y, zConstr, zCross, zLines, and zPoints.
Referenced by CmdSketcherConstrainAngle::activated(), mouseMove(), moveConstraint(), setEdit(), updateData(), and updateDatumDistance().
void ViewProviderSketch::drawConstraintIcons | ( | ) |
draw constraint icon given the constraint id
Definition at line 1403 of file ViewProviderSketch.cpp.
References Gui::BitmapFactory(), draftlibs::dxfImportObjects::CENTER, Sketcher::SketchObject::Constraints, EditData::constrGroup, ConstrIcoColor, edit, Sketcher::Equal, SketcherExample::f, Sketcher::SketchObject::Geometry, getClassTypeId(), getSketchObject(), Part::Geometry::getTypeId(), Part::PropertyGeometryList::getValues(), Sketcher::PropertyConstraintList::getValues(), HALF, Sketcher::Horizontal, Sketcher::Parallel, Sketcher::Perpendicular, Sketcher::PointOnObject, PreselectColor, EditData::PreselectConstraint, EditData::SelConstraintSet, SelectColor, Sketcher::Symmetric, Sketcher::Tangent, and Sketcher::Vertical.
Referenced by draw(), mouseMove(), onDelete(), and onSelectionChanged().
void ViewProviderSketch::drawEdit | ( | const std::vector< Base::Vector2D > & | EditCurve | ) |
draw the edit curve
Definition at line 2511 of file ViewProviderSketch.cpp.
References edit, EditData::EditCurvesCoordinate, EditData::EditCurveSet, and zEdit.
Referenced by DrawSketchHandlerCircle::mouseMove(), DrawSketchHandlerArc::mouseMove(), DrawSketchHandlerLineSet::mouseMove(), DrawSketchHandlerBox::mouseMove(), DrawSketchHandlerLine::mouseMove(), DrawSketchHandlerArc::pressButton(), DrawSketchHandlerLineSet::pressButton(), DrawSketchHandlerBox::pressButton(), DrawSketchHandlerLine::pressButton(), SketcherGui::DrawSketchHandler::quit(), DrawSketchHandlerCircle::releaseButton(), DrawSketchHandlerArc::releaseButton(), DrawSketchHandlerLineSet::releaseButton(), DrawSketchHandlerBox::releaseButton(), and DrawSketchHandlerLine::releaseButton().
void ViewProviderSketch::editDoubleClicked | ( | void | ) | [protected] |
get called if a subelement is double clicked while editing
Definition at line 692 of file ViewProviderSketch.cpp.
References Sketcher::Angle, Base::Console(), Sketcher::SketchObject::Constraints, Sketcher::Distance, Sketcher::DistanceX, Sketcher::DistanceY, edit, getSketchObject(), Sketcher::PropertyConstraintList::getValues(), EditData::PreselectConstraint, EditData::PreselectCross, EditData::PreselectCurve, EditData::PreselectPoint, Sketcher::Radius, SketcherGui::EditDatumDialog::run(), and Sketcher::Constraint::Type.
Referenced by mouseButtonPressed().
Base::Type SketcherGui::ViewProviderSketch::getClassTypeId | ( | void | ) | [static] |
Reimplemented from PartGui::ViewProvider2DObject.
Reimplemented in SketcherGui::ViewProviderCustom.
Definition at line 200 of file ViewProviderSketch.cpp.
Referenced by CmdSketcherConstrainAngle::activated(), ActivateHandler(), detectPreselection(), draw(), drawConstraintIcons(), getSketchViewprovider(), isAlterGeoActive(), isCreateConstraintActive(), isCreateGeoActive(), mouseButtonPressed(), mouseMove(), moveConstraint(), rebuildConstraintsVisual(), and updateDatumDistance().
void ViewProviderSketch::getCoordsOnSketchPlane | ( | double & | u, | |
double & | v, | |||
const SbVec3f & | point, | |||
const SbVec3f & | normal | |||
) |
give the coordinates of a line on the sketch plane in sketcher (2D) coordinates
Definition at line 301 of file ViewProviderSketch.cpp.
References Base::Placement::getPosition(), Base::Placement::getRotation(), getSketchObject(), App::GeoFeature::Placement, Base::Placement::setRotation(), Base::Vector3< _Precision >::TransformToCoordinateSystem(), Base::Vector3< _Precision >::x, and Base::Vector3< _Precision >::y.
Referenced by mouseButtonPressed(), and mouseMove().
int ViewProviderSketch::getPreselectConstraint | ( | void | ) | const |
Definition at line 2999 of file ViewProviderSketch.cpp.
References edit, and EditData::PreselectConstraint.
int ViewProviderSketch::getPreselectCurve | ( | void | ) | const |
Definition at line 2992 of file ViewProviderSketch.cpp.
References edit, and EditData::PreselectCurve.
Referenced by DrawSketchHandlerTrimming::releaseButton(), DrawSketchHandlerFillet::releaseButton(), and SketcherGui::DrawSketchHandler::seekAutoConstraint().
int ViewProviderSketch::getPreselectPoint | ( | void | ) | const |
Definition at line 2985 of file ViewProviderSketch.cpp.
References edit, and EditData::PreselectPoint.
Referenced by DrawSketchHandlerLineSet::pressButton(), DrawSketchHandlerFillet::releaseButton(), and SketcherGui::DrawSketchHandler::seekAutoConstraint().
const App::PropertyData & SketcherGui::ViewProviderSketch::getPropertyData | ( | void | ) | const [protected, virtual] |
Reimplemented from PartGui::ViewProvider2DObject.
Reimplemented in SketcherGui::ViewProviderCustom.
Definition at line 200 of file ViewProviderSketch.cpp.
const App::PropertyData * SketcherGui::ViewProviderSketch::getPropertyDataPtr | ( | void | ) | [static, protected] |
Reimplemented from PartGui::ViewProvider2DObject.
Reimplemented in SketcherGui::ViewProviderCustom.
Definition at line 200 of file ViewProviderSketch.cpp.
float ViewProviderSketch::getScaleFactor | ( | ) |
Definition at line 1526 of file ViewProviderSketch.cpp.
References SketcherExample::f, Gui::View3DInventor::getClassTypeId(), Gui::Application::Instance, and Base::BaseClass::isDerivedFrom().
Referenced by CmdSketcherConstrainAngle::activated(), draw(), and updateDatumDistance().
SketchMode SketcherGui::ViewProviderSketch::getSketchMode | ( | void | ) | const [inline] |
get the sketch mode
Definition at line 119 of file ViewProviderSketch.h.
Referenced by CmdSketcherViewSketch::isActive(), and CmdSketcherLeaveSketch::isActive().
Sketcher::SketchObject * ViewProviderSketch::getSketchObject | ( | void | ) | const |
get the pointer to the sketch document object
Definition at line 3006 of file ViewProviderSketch.cpp.
References Gui::ViewProviderDocumentObject::pcObject.
Referenced by SketcherGui::DrawSketchHandler::createAutoConstraints(), detectPreselection(), draw(), drawConstraintIcons(), SketcherGui::EditDatumDialog::EditDatumDialog(), editDoubleClicked(), SketcherGui::EditDatumDialog::exec(), getCoordsOnSketchPlane(), mouseButtonPressed(), mouseMove(), moveConstraint(), SketcherGui::TaskSketcherConstrains::on_listWidgetConstraints_itemSelectionChanged(), onSelectionChanged(), SketcherGui::TaskSketcherConstrains::onSelectionChanged(), rebuildConstraintsVisual(), DrawSketchHandlerTrimming::releaseButton(), DrawSketchHandlerFillet::releaseButton(), setEdit(), setEditViewer(), SketcherGui::TaskSketcherConstrains::slotConstraintsChanged(), unsetEdit(), updateColor(), and updateData().
Base::Type SketcherGui::ViewProviderSketch::getTypeId | ( | void | ) | const [virtual] |
Reimplemented from PartGui::ViewProvider2DObject.
Reimplemented in SketcherGui::ViewProviderCustom.
Definition at line 200 of file ViewProviderSketch.cpp.
void SketcherGui::ViewProviderSketch::init | ( | void | ) | [static] |
Reimplemented from PartGui::ViewProvider2DObject.
Reimplemented in SketcherGui::ViewProviderCustom.
Definition at line 200 of file ViewProviderSketch.cpp.
Referenced by initSketcherGui().
bool ViewProviderSketch::isConstraintAtPosition | ( | const Base::Vector3d & | constrPos, | |
const SoNode * | constraint | |||
) |
checks if there is a constraint object at position vector
Definition at line 967 of file ViewProviderSketch.cpp.
References EditData::constrGroup, edit, SketcherExample::f, Gui::Application::Instance, Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.
Referenced by seekConstraintPosition().
bool ViewProviderSketch::isPointOnSketch | ( | const SoPickedPoint * | pp | ) | const [protected] |
helper to detect whether the picked point lies on the sketch
Definition at line 1390 of file ViewProviderSketch.cpp.
References edit, and EditData::EditRoot.
bool ViewProviderSketch::isSelectable | ( | void | ) | const [virtual] |
Is the view provider selectable.
Reimplemented from Gui::ViewProviderGeometryObject.
Definition at line 1015 of file ViewProviderSketch.cpp.
References Gui::ViewProvider::isEditing().
bool ViewProviderSketch::keyPressed | ( | bool | pressed, | |
int | key | |||
) | [virtual] |
is called when the Provider is in edit and a key event ocours. Only ESC ends edit.
Reimplemented from Gui::ViewProvider.
Definition at line 255 of file ViewProviderSketch.cpp.
References edit, SketcherGui::DrawSketchHandler::quit(), and EditData::sketchHandler.
bool ViewProviderSketch::mouseButtonPressed | ( | int | Button, | |
bool | pressed, | |||
const SbVec3f & | point, | |||
const SbVec3f & | normal, | |||
const SoPickedPoint * | pp | |||
) | [virtual] |
is called when the Provider is in edit and the mouse is clicked
Reimplemented from Gui::ViewProvider.
Definition at line 329 of file ViewProviderSketch.cpp.
References Gui::Command::commitCommand(), Gui::Command::Doc, Gui::Command::doCommand(), EditData::DragConstraint, EditData::DragCurve, EditData::DragPoint, edit, editDoubleClicked(), SketcherExample::f, Sketcher::SketchObject::Geometry, getClassTypeId(), getCoordsOnSketchPlane(), Sketcher::SketchObject::getGeoVertexIndex(), Gui::MenuManager::getInstance(), App::PropertyContainer::getName(), Gui::ViewProviderDocumentObject::getObject(), Sketcher::SketchObject::getPoint(), getSketchObject(), Part::Geometry::getTypeId(), Part::PropertyGeometryList::getValues(), Gui::Application::Instance, Mode, moveConstraint(), Sketcher::none, Gui::Command::openCommand(), RobotExample::pos, EditData::PreselectConstraint, EditData::PreselectCross, EditData::PreselectCurve, EditData::PreselectPoint, SketcherGui::DrawSketchHandler::pressButton(), prvClickPoint, prvClickTime, SketcherGui::DrawSketchHandler::quit(), relative, SketcherGui::DrawSketchHandler::releaseButton(), resetPositionText(), Gui::Selection(), Gui::MenuItem::setCommand(), setPreselectPoint(), EditData::sketchHandler, snapToGrid(), STATUS_NONE, STATUS_SELECT_Constraint, STATUS_SELECT_Cross, STATUS_SELECT_Edge, STATUS_SELECT_Point, STATUS_SKETCH_DragConstraint, STATUS_SKETCH_DragCurve, STATUS_SKETCH_DragPoint, STATUS_SKETCH_UseHandler, Gui::Command::updateActive(), MovieTool::x, xInit, MovieTool::y, and yInit.
bool ViewProviderSketch::mouseMove | ( | const SbVec3f & | pNear, | |
const SbVec3f & | pFar, | |||
const SoPickedPoint * | pp | |||
) | [virtual] |
is called when the Provider is in edit and the mouse is moved
Reimplemented from Gui::ViewProvider.
Definition at line 719 of file ViewProviderSketch.cpp.
References EditData::ActSketch, detectPreselection(), EditData::DragConstraint, EditData::DragCurve, EditData::DragPoint, draw(), drawConstraintIcons(), edit, Sketcher::SketchObject::Geometry, getClassTypeId(), getCoordsOnSketchPlane(), Sketcher::SketchObject::getGeoVertexIndex(), getSketchObject(), Part::Geometry::getTypeId(), Part::PropertyGeometryList::getValues(), Sketcher::Sketch::hasConflicts(), Sketcher::Sketch::initMove(), Mode, SketcherGui::DrawSketchHandler::mouseMove(), moveConstraint(), Sketcher::Sketch::movePoint(), Sketcher::none, EditData::PreselectConstraint, EditData::PreselectCross, EditData::PreselectCurve, EditData::PreselectPoint, relative, resetPreselectPoint(), setPositionText(), signalSolved, EditData::sketchHandler, snapToGrid(), Sketcher::Sketch::SolveTime, STATUS_NONE, STATUS_SELECT_Constraint, STATUS_SELECT_Edge, STATUS_SELECT_Point, STATUS_SKETCH_DragConstraint, STATUS_SKETCH_DragCurve, STATUS_SKETCH_DragPoint, STATUS_SKETCH_UseHandler, updateColor(), draftlibs::fcgeo::vec(), MovieTool::x, xInit, MovieTool::y, and yInit.
void ViewProviderSketch::moveConstraint | ( | int | constNum, | |
const Base::Vector2D & | toPos | |||
) |
moves a selected constraint
Definition at line 844 of file ViewProviderSketch.cpp.
References EditData::ActSketch, Base::Angle, draftlibs::fcvec::angle(), Mod::PartDesign::Scripts::Gear::c1, Sketcher::SketchObject::Constraints, KDL::cos(), Sketcher::Distance, Sketcher::DistanceX, Sketcher::DistanceY, draw(), edit, Sketcher::end, Sketcher::Constraint::First, Sketcher::Constraint::FirstPos, Base::Vector2D::fX, Base::Vector2D::fY, Part::GeomCircle::getCenter(), Part::GeomArcOfCircle::getCenter(), getClassTypeId(), Part::GeomLineSegment::getEndPoint(), Sketcher::Sketch::getGeometry(), Sketcher::Sketch::getPoint(), Part::GeomCircle::getRadius(), Part::GeomArcOfCircle::getRadius(), Part::GeomArcOfCircle::getRange(), getSketchObject(), Part::GeomLineSegment::getStartPoint(), Part::Geometry::getTypeId(), Sketcher::PropertyConstraintList::getValues(), Sketcher::Constraint::LabelDistance, Base::Vector3< _Precision >::Length(), M_PI, Sketcher::none, PartGui::ViewProviderPartExt::norm, Base::Vector3< _Precision >::ProjToLine(), Sketcher::Radius, Sketcher::Constraint::Second, Sketcher::Constraint::SecondPos, KDL::sin(), Sketcher::Constraint::Type, draftlibs::fcgeo::vec(), MovieTool::x, Base::Vector3< _Precision >::x, MovieTool::y, and Base::Vector3< _Precision >::y.
Referenced by mouseButtonPressed(), and mouseMove().
void ViewProviderSketch::onChanged | ( | const App::Property * | prop | ) | [protected, virtual] |
get called by the container whenever a property has been changed
Reimplemented from PartGui::ViewProvider2DObject.
Reimplemented in SketcherGui::ViewProviderCustom.
Definition at line 2578 of file ViewProviderSketch.cpp.
bool ViewProviderSketch::onDelete | ( | const std::vector< std::string > & | subList | ) | [virtual] |
is called when the Provider is in edit and a deletion request occurs
Reimplemented from Gui::ViewProvider.
Definition at line 3011 of file ViewProviderSketch.cpp.
References Gui::SelectionObserver::blockConnection(), Base::Console(), Gui::Command::Doc, Gui::Command::doCommand(), drawConstraintIcons(), edit, Gui::ViewProviderDocumentObject::getObject(), EditData::PreselectConstraint, EditData::PreselectCross, EditData::PreselectCurve, resetPreselectPoint(), EditData::SelConstraintSet, EditData::SelCurvSet, Gui::Selection(), EditData::SelPointSet, updateColor(), and Base::Exception::what().
void ViewProviderSketch::onSelectionChanged | ( | const Gui::SelectionChanges & | msg | ) | [virtual] |
Observer message from the Selection.
Implements Gui::SelectionObserver.
Definition at line 1023 of file ViewProviderSketch.cpp.
References Gui::SelectionChanges::AddSelection, addSelectPoint(), clearSelectPoints(), Gui::SelectionChanges::ClrSelection, drawConstraintIcons(), edit, App::PropertyContainer::getName(), getSketchObject(), Gui::SelectionChanges::pDocName, Gui::SelectionChanges::pObjectName, Gui::SelectionChanges::pSubName, removeSelectPoint(), Gui::SelectionChanges::RmvSelection, EditData::SelConstraintSet, EditData::SelCrossSet, EditData::SelCurvSet, EditData::SelPointSet, Gui::SelectionChanges::SetSelection, Gui::SelectionChanges::Type, and updateColor().
void ViewProviderSketch::purgeHandler | ( | void | ) |
removes the active handler
Definition at line 244 of file ViewProviderSketch.cpp.
References edit, Mode, EditData::sketchHandler, and STATUS_NONE.
Referenced by DrawSketchHandlerLineSet::pressButton(), SketcherGui::DrawSketchHandler::quit(), DrawSketchHandlerTrimming::releaseButton(), DrawSketchHandlerFillet::releaseButton(), DrawSketchHandlerCircle::releaseButton(), DrawSketchHandlerArc::releaseButton(), DrawSketchHandlerLineSet::releaseButton(), DrawSketchHandlerBox::releaseButton(), DrawSketchHandlerLine::releaseButton(), and unsetEdit().
void ViewProviderSketch::rebuildConstraintsVisual | ( | void | ) | [protected] |
build up the visual of the constraints
Definition at line 2390 of file ViewProviderSketch.cpp.
References Base::Angle, Sketcher::Coincident, Sketcher::SketchObject::Constraints, ConstrDimColor, EditData::constrGroup, Sketcher::Distance, Sketcher::DistanceX, Sketcher::DistanceY, edit, Sketcher::Equal, Sketcher::SketchObject::Geometry, getClassTypeId(), getSketchObject(), Part::Geometry::getTypeId(), Part::PropertyGeometryList::getValues(), Sketcher::PropertyConstraintList::getValues(), Sketcher::Horizontal, Sketcher::None, MeshCore::MeshIO::OFF, Sketcher::Parallel, Sketcher::Perpendicular, Sketcher::PointOnObject, Sketcher::Radius, SketcherGui::SoDatumLabel::string, Sketcher::Symmetric, Sketcher::Tangent, SketcherGui::SoDatumLabel::textColor, EditData::vConstrType, and Sketcher::Vertical.
Referenced by draw().
void ViewProviderSketch::removeSelectPoint | ( | int | SelectPoint | ) | [protected] |
Definition at line 2956 of file ViewProviderSketch.cpp.
References edit, EditData::PointsCoordinate, EditData::SelPointSet, MovieTool::x, MovieTool::y, and zPoints.
Referenced by onSelectionChanged().
void ViewProviderSketch::resetPositionText | ( | void | ) | [protected] |
Definition at line 2903 of file ViewProviderSketch.cpp.
References edit, and EditData::textX.
Referenced by mouseButtonPressed(), and SketcherGui::DrawSketchHandler::resetPositionText().
void ViewProviderSketch::resetPreselectPoint | ( | void | ) | [protected] |
Definition at line 2927 of file ViewProviderSketch.cpp.
References edit, EditData::PointsCoordinate, EditData::PreselectPoint, EditData::SelPointSet, MovieTool::x, MovieTool::y, and zPoints.
Referenced by detectPreselection(), mouseMove(), and onDelete().
Base::Vector3d ViewProviderSketch::seekConstraintPosition | ( | const Base::Vector3d & | suggestedPos, | |
const Base::Vector3d & | dir, | |||
float | step, | |||
const SoNode * | constraint | |||
) |
finds a free position for placing a constraint icon
Definition at line 1000 of file ViewProviderSketch.cpp.
References isConstraintAtPosition().
Referenced by draw().
bool ViewProviderSketch::setEdit | ( | int | ModNum | ) | [protected, virtual] |
is called by the document when the provider goes in edit mode
Reimplemented from PartGui::ViewProvider2DObject.
Definition at line 2594 of file ViewProviderSketch.cpp.
References EditData::ActSketch, Sketcher::SketchObject::Constraints, Gui::Control(), createEditInventorNodes(), CurveColor, CurveDraftColor, draw(), edit, EditData::FullyConstrained, FullyConstrainedColor, Sketcher::SketchObject::Geometry, App::GetApplication(), Sketcher::Sketch::getConflicting(), App::Application::GetParameterGroupByPath(), Part::PropertyGeometryList::getSize(), getSketchObject(), SketcherGui::TaskDlgEditSketch::getSketchView(), Sketcher::PropertyConstraintList::getValues(), Sketcher::Sketch::hasConflicts(), Gui::ViewProviderDocumentObject::hide(), Py::long, draftTools::msg(), PreselectColor, SelectColor, Gui::Selection(), Sketcher::Sketch::setUpSketch(), App::PropertyBool::setValue(), PartGui::ViewProvider2DObject::ShowGrid, signalSetUp, signalSolved, Sketcher::Sketch::solve(), Sketcher::Sketch::SolveTime, PartGui::ViewProvider2DObject::TightGrid, and VertexColor.
void ViewProviderSketch::setEditViewer | ( | Gui::View3DInventorViewer * | , | |
int | ModNum | |||
) | [protected, virtual] |
adjust viewer settings when editing a view provider
Reimplemented from Gui::ViewProviderGeometryObject.
Definition at line 2875 of file ViewProviderSketch.cpp.
References Base::Placement::getRotation(), getSketchObject(), App::GeoFeature::Placement, Gui::View3DInventorViewer::setCameraOrientation(), and Gui::View3DInventorViewer::setEditing().
void ViewProviderSketch::setPositionText | ( | const Base::Vector2D & | Pos | ) | [protected] |
Definition at line 2895 of file ViewProviderSketch.cpp.
References edit, Base::Vector2D::fX, Base::Vector2D::fY, EditData::textPos, EditData::textX, and zText.
Referenced by mouseMove(), and SketcherGui::DrawSketchHandler::setPositionText().
void ViewProviderSketch::setPreselectPoint | ( | int | PreselectPoint | ) | [protected] |
Definition at line 2908 of file ViewProviderSketch.cpp.
References edit, EditData::PointsCoordinate, EditData::PreselectPoint, EditData::SelPointSet, MovieTool::x, MovieTool::y, zHighlight, and zPoints.
Referenced by detectPreselection(), and mouseButtonPressed().
void SketcherGui::ViewProviderSketch::setSketchMode | ( | SketchMode | mode | ) | [inline] |
is called by GuiCommands to set the drawing mode
Definition at line 117 of file ViewProviderSketch.h.
void ViewProviderSketch::setupContextMenu | ( | QMenu * | , | |
QObject * | , | |||
const char * | ||||
) | [virtual] |
set up the context-menu with the supported edit modes
Reimplemented from PartGui::ViewProviderPartExt.
Definition at line 2589 of file ViewProviderSketch.cpp.
void ViewProviderSketch::snapToGrid | ( | double & | x, | |
double & | y | |||
) |
snap points x,y (mouse coordinates) onto grid if enabled
Definition at line 274 of file ViewProviderSketch.cpp.
References App::PropertyFloat::getValue(), App::PropertyBool::getValue(), PartGui::ViewProvider2DObject::GridSize, and PartGui::ViewProvider2DObject::GridSnap.
Referenced by mouseButtonPressed(), and mouseMove().
void ViewProviderSketch::unsetEdit | ( | int | ModNum | ) | [protected, virtual] |
is called when you loose the edit mode
Reimplemented from PartGui::ViewProvider2DObject.
Definition at line 2845 of file ViewProviderSketch.cpp.
References Gui::Control(), edit, EditData::EditRoot, App::DocumentObject::getDocument(), App::Document::getName(), App::DocumentObject::getNameInDocument(), getSketchObject(), Gui::ViewProvider::pcRoot, purgeHandler(), App::Document::recompute(), Gui::Selection(), App::PropertyBool::setValue(), Gui::ViewProviderDocumentObject::show(), PartGui::ViewProvider2DObject::ShowGrid, EditData::sketchHandler, PartGui::ViewProvider2DObject::TightGrid, and SketcherGui::DrawSketchHandler::unsetCursor().
void ViewProviderSketch::unsetEditViewer | ( | Gui::View3DInventorViewer * | ) | [protected, virtual] |
restores viewer settings when leaving editing mode
Reimplemented from Gui::ViewProviderGeometryObject.
Definition at line 2888 of file ViewProviderSketch.cpp.
References Gui::View3DInventorViewer::setEditing().
void ViewProviderSketch::updateColor | ( | void | ) |
helper change the color of the sketch according to selection and solver status
Definition at line 1296 of file ViewProviderSketch.cpp.
References Sketcher::Angle, Sketcher::SketchObject::Constraints, ConstrDimColor, EditData::constrGroup, CrossColorH, CrossColorV, CurveColor, CurveDraftColor, EditData::CurvesMaterials, Sketcher::Distance, Sketcher::DistanceX, Sketcher::DistanceY, edit, EditData::FullyConstrained, FullyConstrainedColor, Sketcher::SketchObject::Geometry, getSketchObject(), Sketcher::PropertyConstraintList::getValues(), Part::PropertyGeometryList::getValues(), RobotExample::l, FemExample::m, EditData::PointsMaterials, PreselectColor, EditData::PreselectConstraint, EditData::PreselectCross, EditData::PreselectCurve, EditData::PreselectPoint, Sketcher::Radius, EditData::RootCrossMaterialsH, EditData::RootCrossMaterialsV, EditData::SelConstraintSet, EditData::SelCrossSet, EditData::SelCurvSet, SelectColor, EditData::SelPointSet, SketcherGui::SoDatumLabel::textColor, Py::type(), and VertexColor.
Referenced by draw(), mouseMove(), onDelete(), and onSelectionChanged().
void ViewProviderSketch::updateData | ( | const App::Property * | ) | [virtual] |
Gets called if some of the property hade bin changed.
Reimplemented from PartGui::ViewProvider2DObject.
Reimplemented in SketcherGui::ViewProviderCustom.
Definition at line 2529 of file ViewProviderSketch.cpp.
References EditData::ActSketch, Sketcher::SketchObject::Constraints, draw(), edit, EditData::FullyConstrained, Sketcher::SketchObject::Geometry, Sketcher::Sketch::getConflicting(), Part::PropertyGeometryList::getSize(), getSketchObject(), Sketcher::PropertyConstraintList::getValues(), Sketcher::Sketch::hasConflicts(), draftTools::msg(), Sketcher::Sketch::setUpSketch(), signalConstraintsChanged, signalSetUp, signalSolved, Sketcher::Sketch::solve(), and Sketcher::Sketch::SolveTime.
friend class DrawSketchHandler [friend] |
Definition at line 172 of file ViewProviderSketch.h.
Definition at line 80 of file ViewProviderSketch.h.
Referenced by SketcherGui::DrawSketchHandler::createAutoConstraints(), SketcherGui::DrawSketchHandler::seekAutoConstraint(), and SketcherGui::TaskSketcherGeneral::toggleAutoconstraints().
SbColor ViewProviderSketch::ConstrDimColor [static, protected] |
Definition at line 221 of file ViewProviderSketch.h.
Referenced by rebuildConstraintsVisual(), and updateColor().
SbColor ViewProviderSketch::ConstrIcoColor [static, protected] |
Definition at line 222 of file ViewProviderSketch.h.
Referenced by drawConstraintIcons().
SbColor ViewProviderSketch::CrossColorH [static, protected] |
Definition at line 219 of file ViewProviderSketch.h.
Referenced by createEditInventorNodes(), and updateColor().
SbColor ViewProviderSketch::CrossColorV [static, protected] |
Definition at line 218 of file ViewProviderSketch.h.
Referenced by createEditInventorNodes(), and updateColor().
SbColor ViewProviderSketch::CurveColor [static, protected] |
Definition at line 216 of file ViewProviderSketch.h.
Referenced by setEdit(), and updateColor().
SbColor ViewProviderSketch::CurveDraftColor [static, protected] |
Definition at line 217 of file ViewProviderSketch.h.
Referenced by setEdit(), and updateColor().
EditData* SketcherGui::ViewProviderSketch::edit [protected] |
pointer to the edit data structure if the ViewProvider is in edit.
Definition at line 197 of file ViewProviderSketch.h.
Referenced by activateHandler(), addSelectPoint(), clearSelectPoints(), createEditInventorNodes(), detectPreselection(), draw(), drawConstraintIcons(), drawEdit(), editDoubleClicked(), getPreselectConstraint(), getPreselectCurve(), getPreselectPoint(), isConstraintAtPosition(), isPointOnSketch(), keyPressed(), mouseButtonPressed(), mouseMove(), moveConstraint(), onDelete(), onSelectionChanged(), purgeHandler(), rebuildConstraintsVisual(), removeSelectPoint(), resetPositionText(), resetPreselectPoint(), setEdit(), setPositionText(), setPreselectPoint(), unsetEdit(), updateColor(), and updateData().
SbColor ViewProviderSketch::FullyConstrainedColor [static, protected] |
Definition at line 220 of file ViewProviderSketch.h.
Referenced by setEdit(), and updateColor().
SketchMode SketcherGui::ViewProviderSketch::Mode [protected] |
Definition at line 212 of file ViewProviderSketch.h.
Referenced by activateHandler(), mouseButtonPressed(), mouseMove(), and purgeHandler().
SbColor ViewProviderSketch::PreselectColor [static, protected] |
Definition at line 223 of file ViewProviderSketch.h.
Referenced by drawConstraintIcons(), setEdit(), and updateColor().
SbVec3f ViewProviderSketch::prvClickPoint [static, protected] |
Definition at line 227 of file ViewProviderSketch.h.
Referenced by mouseButtonPressed().
SbTime ViewProviderSketch::prvClickTime [static, protected] |
Definition at line 226 of file ViewProviderSketch.h.
Referenced by mouseButtonPressed().
bool SketcherGui::ViewProviderSketch::relative [protected] |
Definition at line 239 of file ViewProviderSketch.h.
Referenced by mouseButtonPressed(), and mouseMove().
SbColor ViewProviderSketch::SelectColor [static, protected] |
Definition at line 224 of file ViewProviderSketch.h.
Referenced by drawConstraintIcons(), setEdit(), and updateColor().
boost::signal<void ()> SketcherGui::ViewProviderSketch::signalConstraintsChanged |
signals if the constraints list has changed
Definition at line 175 of file ViewProviderSketch.h.
Referenced by SketcherGui::TaskSketcherConstrains::TaskSketcherConstrains(), and updateData().
boost::signal<void (int type, int dofs, std::string &msg)> SketcherGui::ViewProviderSketch::signalSetUp |
signals if the sketch has been set up
Definition at line 177 of file ViewProviderSketch.h.
Referenced by setEdit(), SketcherGui::TaskSketcherMessages::TaskSketcherMessages(), and updateData().
boost::signal<void (int type, float time)> SketcherGui::ViewProviderSketch::signalSolved |
signals if the sketch has been solved
Definition at line 179 of file ViewProviderSketch.h.
Referenced by mouseMove(), setEdit(), SketcherGui::TaskSketcherMessages::TaskSketcherMessages(), and updateData().
SbColor ViewProviderSketch::VertexColor [static, protected] |
Definition at line 215 of file ViewProviderSketch.h.
Referenced by setEdit(), and updateColor().
double SketcherGui::ViewProviderSketch::xInit [protected] |
Definition at line 238 of file ViewProviderSketch.h.
Referenced by mouseButtonPressed(), and mouseMove().
double SketcherGui::ViewProviderSketch::yInit [protected] |
Definition at line 238 of file ViewProviderSketch.h.
Referenced by mouseButtonPressed(), and mouseMove().
float SketcherGui::ViewProviderSketch::zConstr [protected] |
Definition at line 232 of file ViewProviderSketch.h.
Referenced by draw().
float SketcherGui::ViewProviderSketch::zCross [protected] |
Definition at line 229 of file ViewProviderSketch.h.
Referenced by draw().
float SketcherGui::ViewProviderSketch::zEdit [protected] |
Definition at line 235 of file ViewProviderSketch.h.
Referenced by drawEdit().
float SketcherGui::ViewProviderSketch::zHighlight [protected] |
Definition at line 233 of file ViewProviderSketch.h.
Referenced by addSelectPoint(), and setPreselectPoint().
float SketcherGui::ViewProviderSketch::zLines [protected] |
Definition at line 230 of file ViewProviderSketch.h.
Referenced by draw().
float SketcherGui::ViewProviderSketch::zPoints [protected] |
Definition at line 231 of file ViewProviderSketch.h.
Referenced by clearSelectPoints(), draw(), removeSelectPoint(), resetPreselectPoint(), and setPreselectPoint().
float SketcherGui::ViewProviderSketch::zText [protected] |
Definition at line 234 of file ViewProviderSketch.h.
Referenced by setPositionText().