+ expose zoomIn/zoomOut to Python

This commit is contained in:
wmayer 2014-02-09 15:28:43 +01:00
parent fa33bcae4a
commit 4fb000f0c8
2 changed files with 46 additions and 0 deletions

View File

@ -83,6 +83,8 @@ void View3DInventorPy::init_type()
add_varargs_method("viewAxometric",&View3DInventorPy::viewAxometric,"viewAxometric()");
add_varargs_method("viewRotateLeft",&View3DInventorPy::viewRotateLeft,"viewRotateLeft()");
add_varargs_method("viewRotateRight",&View3DInventorPy::viewRotateRight,"viewRotateRight()");
add_varargs_method("zoomIn",&View3DInventorPy::zoomIn,"zoomIn()");
add_varargs_method("zoomOut",&View3DInventorPy::zoomOut,"zoomOut()");
add_varargs_method("viewPosition",&View3DInventorPy::viewPosition,"viewPosition()");
add_varargs_method("startAnimating",&View3DInventorPy::startAnimating,"startAnimating()");
add_varargs_method("stopAnimating",&View3DInventorPy::stopAnimating,"stopAnimating()");
@ -473,6 +475,48 @@ Py::Object View3DInventorPy::viewRotateRight(const Py::Tuple& args)
return Py::None();
}
Py::Object View3DInventorPy::zoomIn(const Py::Tuple& args)
{
if (!PyArg_ParseTuple(args.ptr(), ""))
throw Py::Exception();
try {
_view->getViewer()->navigationStyle()->zoomIn();
}
catch (const Base::Exception& e) {
throw Py::Exception(e.what());
}
catch (const std::exception& e) {
throw Py::Exception(e.what());
}
catch(...) {
throw Py::Exception("Unknown C++ exception");
}
return Py::None();
}
Py::Object View3DInventorPy::zoomOut(const Py::Tuple& args)
{
if (!PyArg_ParseTuple(args.ptr(), ""))
throw Py::Exception();
try {
_view->getViewer()->navigationStyle()->zoomOut();
}
catch (const Base::Exception& e) {
throw Py::Exception(e.what());
}
catch (const std::exception& e) {
throw Py::Exception(e.what());
}
catch(...) {
throw Py::Exception("Unknown C++ exception");
}
return Py::None();
}
Py::Object View3DInventorPy::setCameraOrientation(const Py::Tuple& args)
{
PyObject* o;

View File

@ -58,6 +58,8 @@ public:
Py::Object viewPosition(const Py::Tuple&);
Py::Object viewRotateLeft(const Py::Tuple&);
Py::Object viewRotateRight(const Py::Tuple&);
Py::Object zoomIn(const Py::Tuple&);
Py::Object zoomOut(const Py::Tuple&);
Py::Object startAnimating(const Py::Tuple&);
Py::Object stopAnimating(const Py::Tuple&);
Py::Object setAnimationEnabled(const Py::Tuple&);