Skip to content

Commit

Permalink
+ fixes #844: Cannot use edge hidden by sketch axis as external geometry
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Mar 15, 2014
1 parent e6bd7e8 commit 3ea41ff
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/Mod/Sketcher/Gui/CommandCreateGeo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#include "PreCompiled.h"
#ifndef _PreComp_
# include <Inventor/nodes/SoPickStyle.h>
#endif

#include <boost/math/special_functions/fpclassify.hpp>
Expand Down Expand Up @@ -2335,6 +2336,7 @@ class DrawSketchHandlerExternal: public DrawSketchHandler

virtual void activated(ViewProviderSketch *sketchgui)
{
sketchgui->setAxisPickStyle(false);
Gui::MDIView *mdi = Gui::Application::Instance->activeDocument()->getActiveView();
Gui::View3DInventorViewer *viewer;
viewer = static_cast<Gui::View3DInventor *>(mdi)->getViewer();
Expand All @@ -2348,6 +2350,11 @@ class DrawSketchHandlerExternal: public DrawSketchHandler
setCursor(QPixmap(cursor_external),7,7);
}

virtual void deactivated(ViewProviderSketch *sketchgui)
{
sketchgui->setAxisPickStyle(true);
}

virtual void mouseMove(Base::Vector2D onSketchPos)
{
if (Gui::Selection().getPreselection().pObjectName)
Expand Down
1 change: 1 addition & 0 deletions src/Mod/Sketcher/Gui/DrawSketchHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class SketcherGuiExport DrawSketchHandler
virtual ~DrawSketchHandler();

virtual void activated(ViewProviderSketch *sketchgui){};
virtual void deactivated(ViewProviderSketch *sketchgui){};
virtual void mouseMove(Base::Vector2D onSketchPos)=0;
virtual bool pressButton(Base::Vector2D onSketchPos)=0;
virtual bool releaseButton(Base::Vector2D onSketchPos)=0;
Expand Down
17 changes: 16 additions & 1 deletion src/Mod/Sketcher/Gui/ViewProviderSketch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
# include <Inventor/nodes/SoTranslation.h>
# include <Inventor/nodes/SoText2.h>
# include <Inventor/nodes/SoFont.h>
# include <Inventor/nodes/SoPickStyle.h>
# include <Inventor/sensors/SoIdleSensor.h>
# include <Inventor/nodes/SoCamera.h>

Expand Down Expand Up @@ -147,7 +148,7 @@ struct EditData {
PointsCoordinate(0),
CurvesCoordinate(0),
CurveSet(0), EditCurveSet(0), RootCrossSet(0),
PointSet(0)
PointSet(0), pickStyleAxes(0)
{}

// pointer to the active handler for new sketch objects
Expand Down Expand Up @@ -200,6 +201,7 @@ struct EditData {
SoTranslation *textPos;

SoGroup *constrGroup;
SoPickStyle *pickStyleAxes;
};


Expand Down Expand Up @@ -281,6 +283,7 @@ void ViewProviderSketch::deactivateHandler()
{
assert(edit);
assert(edit->sketchHandler != 0);
edit->sketchHandler->deactivated(this);
edit->sketchHandler->unsetCursor();
delete(edit->sketchHandler);
edit->sketchHandler = 0;
Expand All @@ -301,6 +304,15 @@ void ViewProviderSketch::purgeHandler(void)
static_cast<Gui::SoFCUnifiedSelection*>(root)->selectionRole.setValue(FALSE);
}

void ViewProviderSketch::setAxisPickStyle(bool on)
{
assert(edit);
if (on)
edit->pickStyleAxes->style = SoPickStyle::SHAPE;
else
edit->pickStyleAxes->style = SoPickStyle::UNPICKABLE;
}

// **********************************************************************************

bool ViewProviderSketch::keyPressed(bool pressed, int key)
Expand Down Expand Up @@ -3173,6 +3185,9 @@ void ViewProviderSketch::createEditInventorNodes(void)

// stuff for the RootCross lines +++++++++++++++++++++++++++++++++++++++
SoGroup* crossRoot = new Gui::SoSkipBoundingGroup;
edit->pickStyleAxes = new SoPickStyle();
edit->pickStyleAxes->style = SoPickStyle::SHAPE;
crossRoot->addChild(edit->pickStyleAxes);
edit->EditRoot->addChild(crossRoot);
MtlBind = new SoMaterialBinding;
MtlBind->setName("RootCrossMaterialBinding");
Expand Down
2 changes: 2 additions & 0 deletions src/Mod/Sketcher/Gui/ViewProviderSketch.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ class SketcherGuiExport ViewProviderSketch : public PartGui::ViewProvider2DObjec
void activateHandler(DrawSketchHandler *newHandler);
/// removes the active handler
void purgeHandler(void);
/// set the pick style of the sketch coordinate axes
void setAxisPickStyle(bool on);
//@}

/** @name modus handling */
Expand Down

0 comments on commit 3ea41ff

Please sign in to comment.