Gui: get rid of some const_cast
This commit is contained in:
@@ -1082,14 +1082,15 @@ void View3DInventorViewer::resetEditingRoot(bool updateLinks)
|
||||
}
|
||||
}
|
||||
|
||||
SoPickedPoint* View3DInventorViewer::getPointOnRay(const SbVec2s& pos, ViewProvider* vp) const
|
||||
SoPickedPoint* View3DInventorViewer::getPointOnRay(const SbVec2s& pos, const ViewProvider* vp) const
|
||||
{
|
||||
SoPath *path;
|
||||
if(vp == editViewProvider && pcEditingRoot->getNumChildren()>1) {
|
||||
if (vp == editViewProvider && pcEditingRoot->getNumChildren() > 1) {
|
||||
path = new SoPath(1);
|
||||
path->ref();
|
||||
path->append(pcEditingRoot);
|
||||
}else{
|
||||
}
|
||||
else {
|
||||
//first get the path to this node and calculate the current transformation
|
||||
SoSearchAction sa;
|
||||
sa.setNode(vp->getRoot());
|
||||
@@ -1128,17 +1129,18 @@ SoPickedPoint* View3DInventorViewer::getPointOnRay(const SbVec2s& pos, ViewProvi
|
||||
return (pick ? new SoPickedPoint(*pick) : nullptr);
|
||||
}
|
||||
|
||||
SoPickedPoint* View3DInventorViewer::getPointOnRay(const SbVec3f& pos,const SbVec3f& dir, ViewProvider* vp) const
|
||||
SoPickedPoint* View3DInventorViewer::getPointOnRay(const SbVec3f& pos, const SbVec3f& dir, const ViewProvider* vp) const
|
||||
{
|
||||
// Note: There seems to be a bug with setRay() which causes SoRayPickAction
|
||||
// to fail to get intersections between the ray and a line
|
||||
|
||||
SoPath *path;
|
||||
if(vp == editViewProvider && pcEditingRoot->getNumChildren()>1) {
|
||||
if (vp == editViewProvider && pcEditingRoot->getNumChildren() > 1) {
|
||||
path = new SoPath(1);
|
||||
path->ref();
|
||||
path->append(pcEditingRoot);
|
||||
}else{
|
||||
}
|
||||
else {
|
||||
//first get the path to this node and calculate the current setTransformation
|
||||
SoSearchAction sa;
|
||||
sa.setNode(vp->getRoot());
|
||||
|
||||
@@ -210,11 +210,11 @@ public:
|
||||
/** Helper method to get picked entities while editing.
|
||||
* It's in the responsibility of the caller to delete the returned instance.
|
||||
*/
|
||||
SoPickedPoint* getPointOnRay(const SbVec2s& pos, ViewProvider* vp) const;
|
||||
SoPickedPoint* getPointOnRay(const SbVec2s& pos, const ViewProvider* vp) const;
|
||||
/** Helper method to get picked entities while editing.
|
||||
* It's in the responsibility of the caller to delete the returned instance.
|
||||
*/
|
||||
SoPickedPoint* getPointOnRay(const SbVec3f& pos, const SbVec3f& dir, ViewProvider* vp) const;
|
||||
SoPickedPoint* getPointOnRay(const SbVec3f& pos, const SbVec3f& dir, const ViewProvider* vp) const;
|
||||
/// display override mode
|
||||
void setOverrideMode(const std::string &mode);
|
||||
void updateOverrideMode(const std::string &mode);
|
||||
|
||||
@@ -633,15 +633,14 @@ bool ViewProvider::checkRecursion(SoNode* node)
|
||||
|
||||
SoPickedPoint* ViewProvider::getPointOnRay(const SbVec2s& pos, const View3DInventorViewer* viewer) const
|
||||
{
|
||||
return viewer->getPointOnRay(pos,const_cast<ViewProvider*>(this));
|
||||
return viewer->getPointOnRay(pos, this);
|
||||
}
|
||||
|
||||
SoPickedPoint* ViewProvider::getPointOnRay(const SbVec3f& pos,const SbVec3f& dir, const View3DInventorViewer* viewer) const
|
||||
{
|
||||
return viewer->getPointOnRay(pos,dir,const_cast<ViewProvider*>(this));
|
||||
return viewer->getPointOnRay(pos, dir, this);
|
||||
}
|
||||
|
||||
|
||||
std::vector<Base::Vector3d> ViewProvider::getModelPoints(const SoPickedPoint* pp) const
|
||||
{
|
||||
// the default implementation just returns the picked point from the visual representation
|
||||
|
||||
@@ -193,7 +193,7 @@ SoPickedPointList ViewProviderGeometryObject::getPickedPoints(const SbVec2s& pos
|
||||
root->ref();
|
||||
root->addChild(viewer.getHeadlight());
|
||||
root->addChild(viewer.getSoRenderManager()->getCamera());
|
||||
root->addChild(const_cast<ViewProviderGeometryObject*>(this)->getRoot());
|
||||
root->addChild(getRoot());
|
||||
|
||||
SoRayPickAction rp(viewer.getSoRenderManager()->getViewportRegion());
|
||||
rp.setPickAll(pickAll);
|
||||
@@ -212,7 +212,7 @@ SoPickedPoint* ViewProviderGeometryObject::getPickedPoint(const SbVec2s& pos, co
|
||||
root->ref();
|
||||
root->addChild(viewer.getHeadlight());
|
||||
root->addChild(viewer.getSoRenderManager()->getCamera());
|
||||
root->addChild(const_cast<ViewProviderGeometryObject*>(this)->getRoot());
|
||||
root->addChild(getRoot());
|
||||
|
||||
SoRayPickAction rp(viewer.getSoRenderManager()->getViewportRegion());
|
||||
rp.setPoint(pos);
|
||||
|
||||
Reference in New Issue
Block a user