+ fixes #0000844: Cannot use edge hidden by sketch axis as external geometry

This commit is contained in:
wmayer 2014-03-15 19:53:14 +01:00
parent e6bd7e8de3
commit 3ea41ff0c9
4 changed files with 26 additions and 1 deletions

View File

@ -23,6 +23,7 @@
#include "PreCompiled.h"
#ifndef _PreComp_
# include <Inventor/nodes/SoPickStyle.h>
#endif
#include <boost/math/special_functions/fpclassify.hpp>
@ -2335,6 +2336,7 @@ public:
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();
@ -2348,6 +2350,11 @@ public:
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)

View File

@ -68,6 +68,7 @@ public:
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;

View File

@ -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>
@ -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
@ -200,6 +201,7 @@ struct EditData {
SoTranslation *textPos;
SoGroup *constrGroup;
SoPickStyle *pickStyleAxes;
};
@ -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;
@ -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)
@ -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");

View File

@ -106,6 +106,8 @@ public:
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 */