Gui: Selection: pick radius support
This commit is contained in:
parent
27d3c6beb5
commit
93d5cf3f98
|
@ -309,7 +309,7 @@ SbBool NavigationStyle::lookAtPoint(const SbVec2s screenpos)
|
|||
|
||||
SoRayPickAction rpaction(viewer->getSoRenderManager()->getViewportRegion());
|
||||
rpaction.setPoint(screenpos);
|
||||
rpaction.setRadius(2);
|
||||
rpaction.setRadius(viewer->getPickRadius());
|
||||
rpaction.apply(viewer->getSoRenderManager()->getSceneGraph());
|
||||
|
||||
SoPickedPoint * picked = rpaction.getPickedPoint();
|
||||
|
@ -994,7 +994,7 @@ void NavigationStyle::saveCursorPosition(const SoEvent * const ev)
|
|||
if (PRIVATE(this)->dragAtCursor) {
|
||||
SoRayPickAction rpaction(viewer->getSoRenderManager()->getViewportRegion());
|
||||
rpaction.setPoint(this->localPos);
|
||||
rpaction.setRadius(2);
|
||||
rpaction.setRadius(viewer->getPickRadius());
|
||||
rpaction.apply(viewer->getSoRenderManager()->getSceneGraph());
|
||||
|
||||
SoPickedPoint * picked = rpaction.getPickedPoint();
|
||||
|
@ -1058,6 +1058,7 @@ SbBool NavigationStyle::handleEventInForeground(const SoEvent* const e)
|
|||
{
|
||||
SoHandleEventAction action(viewer->getSoRenderManager()->getViewportRegion());
|
||||
action.setEvent(e);
|
||||
action.setPickRadius(viewer->getPickRadius());
|
||||
action.apply(viewer->foregroundroot);
|
||||
return action.isHandled();
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <Inventor/actions/SoSearchAction.h>
|
||||
#include <Inventor/actions/SoRayPickAction.h>
|
||||
#include <Inventor/actions/SoGetBoundingBoxAction.h>
|
||||
#include <Inventor/actions/SoHandleEventAction.h>
|
||||
#include <Inventor/SoPickedPoint.h>
|
||||
#include <Inventor/SbLine.h>
|
||||
#include <Inventor/SbPlane.h>
|
||||
|
@ -163,6 +164,7 @@ void SIM::Coin3D::Quarter::SoQTQuarterAdaptor::init()
|
|||
m_inseekmode = false;
|
||||
m_storedcamera = 0;
|
||||
m_viewingflag = false;
|
||||
pickRadius = 5.0;
|
||||
|
||||
m_seeksensor = new SoTimerSensor(SoQTQuarterAdaptor::seeksensorCB, (void*)this);
|
||||
getSoEventManager()->setNavigationState(SoEventManager::NO_NAVIGATION);
|
||||
|
@ -378,12 +380,24 @@ SbBool SIM::Coin3D::Quarter::SoQTQuarterAdaptor::isSeekValuePercentage(void) con
|
|||
return m_seekdistanceabs ? false : true;
|
||||
}
|
||||
|
||||
void SIM::Coin3D::Quarter::SoQTQuarterAdaptor::setPickRadius(float pickRadius)
|
||||
{
|
||||
this->pickRadius = pickRadius;
|
||||
SoEventManager* evm = this->getSoEventManager();
|
||||
if (evm){
|
||||
SoHandleEventAction* a = evm->getHandleEventAction();
|
||||
if (a){
|
||||
a->setPickRadius(pickRadius);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SbBool SIM::Coin3D::Quarter::SoQTQuarterAdaptor::seekToPoint(const SbVec2s screenpos)
|
||||
{
|
||||
|
||||
SoRayPickAction rpaction(getSoRenderManager()->getViewportRegion());
|
||||
rpaction.setPoint(screenpos);
|
||||
rpaction.setRadius(2);
|
||||
rpaction.setRadius(pickRadius);
|
||||
rpaction.apply(getSoRenderManager()->getSceneGraph());
|
||||
|
||||
SoPickedPoint* picked = rpaction.getPickedPoint();
|
||||
|
|
|
@ -85,6 +85,9 @@ public:
|
|||
void setSeekValueAsPercentage(const SbBool on);
|
||||
SbBool isSeekValuePercentage(void) const;
|
||||
|
||||
virtual float getPickRadius(void) const {return this->pickRadius;};
|
||||
virtual void setPickRadius(float pickRadius);
|
||||
|
||||
virtual void saveHomePosition(void);
|
||||
virtual void resetToHomePosition(void);
|
||||
|
||||
|
@ -120,6 +123,7 @@ private:
|
|||
SbBool m_seekdistanceabs;
|
||||
SoSearchAction searchaction;
|
||||
SoGetMatrixAction matrixaction;
|
||||
float pickRadius;
|
||||
// Home position storage.
|
||||
SoNode * m_storedcamera;
|
||||
|
||||
|
|
|
@ -192,6 +192,7 @@ View3DInventor::View3DInventor(Gui::Document* pcDocument, QWidget* parent,
|
|||
OnChange(*hGrp,"DimensionsVisible");
|
||||
OnChange(*hGrp,"Dimensions3dVisible");
|
||||
OnChange(*hGrp,"DimensionsDeltaVisible");
|
||||
OnChange(*hGrp,"PickRadius");
|
||||
|
||||
stopSpinTimer = new QTimer(this);
|
||||
connect(stopSpinTimer, SIGNAL(timeout()), this, SLOT(stopAnimating()));
|
||||
|
@ -395,6 +396,10 @@ void View3DInventor::OnChange(ParameterGrp::SubjectType &rCaller,ParameterGrp::M
|
|||
else
|
||||
_viewer->turnDeltaDimensionsOff();
|
||||
}
|
||||
else if (strcmp(Reason, "PickRadius") == 0)
|
||||
{
|
||||
_viewer->setPickRadius(rGrp.GetFloat("PickRadius", 5.0f));
|
||||
}
|
||||
else{
|
||||
unsigned long col1 = rGrp.GetUnsigned("BackgroundColor",3940932863UL);
|
||||
unsigned long col2 = rGrp.GetUnsigned("BackgroundColor2",859006463UL); // default color (dark blue)
|
||||
|
|
|
@ -416,6 +416,7 @@ SoPickedPoint* ViewProvider::getPointOnRay(const SbVec2s& pos, const View3DInven
|
|||
//get the picked point
|
||||
SoRayPickAction rp(viewer->getSoRenderManager()->getViewportRegion());
|
||||
rp.setPoint(pos);
|
||||
rp.setRadius(viewer->getPickRadius());
|
||||
rp.apply(root);
|
||||
root->unref();
|
||||
trans->unref();
|
||||
|
@ -452,6 +453,7 @@ SoPickedPoint* ViewProvider::getPointOnRay(const SbVec3f& pos,const SbVec3f& dir
|
|||
//get the picked point
|
||||
SoRayPickAction rp(viewer->getSoRenderManager()->getViewportRegion());
|
||||
rp.setRay(pos,dir);
|
||||
rp.setRadius(viewer->getPickRadius());
|
||||
rp.apply(root);
|
||||
root->unref();
|
||||
trans->unref();
|
||||
|
|
|
@ -371,6 +371,7 @@ SoPickedPointList ViewProviderGeometryObject::getPickedPoints(const SbVec2s& pos
|
|||
|
||||
SoRayPickAction rp(viewer.getSoRenderManager()->getViewportRegion());
|
||||
rp.setPickAll(pickAll);
|
||||
rp.setRadius(viewer.getPickRadius());
|
||||
rp.setPoint(pos);
|
||||
rp.apply(root);
|
||||
root->unref();
|
||||
|
@ -389,6 +390,7 @@ SoPickedPoint* ViewProviderGeometryObject::getPickedPoint(const SbVec2s& pos, co
|
|||
|
||||
SoRayPickAction rp(viewer.getSoRenderManager()->getViewportRegion());
|
||||
rp.setPoint(pos);
|
||||
rp.setRadius(viewer.getPickRadius());
|
||||
rp.apply(root);
|
||||
root->unref();
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user