Gui: rename getPointOnScreen() to getPointOnViewport()

This commit is contained in:
wmayer
2023-04-08 12:46:10 +02:00
committed by wwmayer
parent 7bf0e2e703
commit 6237a0e67b
5 changed files with 12 additions and 10 deletions

View File

@@ -2408,7 +2408,7 @@ SbVec3f View3DInventorViewer::getPointOnFocalPlane(const SbVec2s& pnt) const
return pt;
}
SbVec2s View3DInventorViewer::getPointOnScreen(const SbVec3f& pnt) const
SbVec2s View3DInventorViewer::getPointOnViewport(const SbVec3f& pnt) const
{
const SbViewportRegion& vp = this->getSoRenderManager()->getViewportRegion();
float fRatio = vp.getViewportAspectRatio();

View File

@@ -312,8 +312,8 @@ public:
/** Returns the 3d point on the focal plane to the given 2d point. */
SbVec3f getPointOnFocalPlane(const SbVec2s&) const;
/** Returns the 2d coordinates on the screen to the given 3d point. */
SbVec2s getPointOnScreen(const SbVec3f&) const;
/** Returns the 2d coordinates on the viewport to the given 3d point. */
SbVec2s getPointOnViewport(const SbVec3f&) const;
/** Converts Inventor coordinates into Qt coordinates.
* The conversion takes the device pixel ratio into account.

View File

@@ -161,8 +161,10 @@ void View3DInventorPy::init_type()
"\n"
"Return the according 3D point on the focal plane to the given 2D point (in\n"
"pixel coordinates).\n");
add_varargs_method("getPointOnScreen",&View3DInventorPy::getPointOnScreen,
"getPointOnScreen(3D vector) -> pixel coords (as integer)\n"
add_varargs_method("getPointOnScreen",&View3DInventorPy::getPointOnViewport,
"Same as getPointOnViewport");
add_varargs_method("getPointOnViewport",&View3DInventorPy::getPointOnViewport,
"getPointOnViewport(3D vector) -> pixel coords (as integer)\n"
"\n"
"Return the projected 3D point (in pixel coordinates).\n");
add_varargs_method("projectPointToLine",&View3DInventorPy::projectPointToLine,
@@ -1579,7 +1581,7 @@ Py::Object View3DInventorPy::getPointOnFocalPlane(const Py::Tuple& args)
}
}
Py::Object View3DInventorPy::getPointOnScreen(const Py::Tuple& args)
Py::Object View3DInventorPy::getPointOnViewport(const Py::Tuple& args)
{
PyObject* v;
double vx,vy,vz;
@@ -1597,7 +1599,7 @@ Py::Object View3DInventorPy::getPointOnScreen(const Py::Tuple& args)
}
try {
SbVec2s pt = getView3DIventorPtr()->getViewer()->getPointOnScreen(SbVec3f(vx,vy,vz));
SbVec2s pt = getView3DIventorPtr()->getViewer()->getPointOnViewport(SbVec3f(vx,vy,vz));
Py::Tuple tuple(2);
tuple.setItem(0, Py::Int(pt[0]));
tuple.setItem(1, Py::Int(pt[1]));

View File

@@ -96,7 +96,7 @@ public:
Py::Object getSize(const Py::Tuple&);
Py::Object getPointOnFocalPlane(const Py::Tuple&);
Py::Object projectPointToLine(const Py::Tuple&);
Py::Object getPointOnScreen(const Py::Tuple&);
Py::Object getPointOnViewport(const Py::Tuple&);
Py::Object addEventCallback(const Py::Tuple&);
Py::Object removeEventCallback(const Py::Tuple&);
Py::Object setAnnotation(const Py::Tuple&);

View File

@@ -439,7 +439,7 @@ void ViewProviderSketch::moveCursorToSketchPoint(Base::Vector2d point) {
Gui::View3DInventorViewer* viewer = view->getViewer();
SbVec2s screencoords = viewer->getPointOnScreen(sbpoint);
SbVec2s screencoords = viewer->getPointOnViewport(sbpoint);
short x,y; screencoords.getValue(x,y);
@@ -475,7 +475,7 @@ void ViewProviderSketch::preselectAtPoint(Base::Vector2d point)
Gui::View3DInventorViewer* viewer = view->getViewer();
SbVec2s screencoords = viewer->getPointOnScreen(sbpoint);
SbVec2s screencoords = viewer->getPointOnViewport(sbpoint);
std::unique_ptr<SoPickedPoint> Point(this->getPointOnRay(screencoords, viewer));