// python wrapper for vtkDistanceWidget // #define VTK_WRAPPING_CXX #define VTK_STREAMS_FWD_ONLY #include "vtkPythonArgs.h" #include "vtkPythonOverload.h" #include "vtkConfigure.h" #include #include #include "vtkVariant.h" #include "vtkIndent.h" #include "vtkDistanceWidget.h" extern "C" { VTK_ABI_EXPORT void PyVTKAddFile_vtkDistanceWidget(PyObject *); } extern "C" { VTK_ABI_EXPORT PyObject *PyvtkDistanceWidget_ClassNew(); } #ifndef DECLARED_PyvtkAbstractWidget_ClassNew extern "C" { PyObject *PyvtkAbstractWidget_ClassNew(); } #define DECLARED_PyvtkAbstractWidget_ClassNew #endif static const char *PyvtkDistanceWidget_Doc = "vtkDistanceWidget - measure the distance between two points\n\n" "Superclass: vtkAbstractWidget\n\n" "The vtkDistanceWidget is used to measure the distance between two\n" "points. The two end points can be positioned independently, and when\n" "they are released, a special PlacePointEvent is invoked so that\n" "special operations may be take to reposition the point (snap to grid,\n" "etc.) The widget has two different modes of interaction: when\n" "initially defined (i.e., placing the two points) and then a\n" "manipulate mode (adjusting the position of the two points).\n\n" "To use this widget, specify an instance of vtkDistanceWidget and a\n" "representation (a subclass of vtkDistanceRepresentation). The widget\n" "is implemented using two instances of vtkHandleWidget which are used\n" "to position the end points of the line. The representations for these\n" "two handle widgets are provided by the vtkDistanceRepresentation.\n\n" "@par Event Bindings: By default, the widget responds to the following\n" "VTK events (i.e., it watches the vtkRenderWindowInteractor for these\n" "events):\n\n\n" " LeftButtonPressEvent - add a point or select a handle\n" " MouseMoveEvent - position the second point or move a handle\n" " LeftButtonReleaseEvent - release the handle \n\n" "@par Event Bindings: Note that the event bindings described above can\n" "be changed using this class's vtkWidgetEventTranslator. This class\n" "translates VTK events into the vtkDistanceWidget's widget events:\n\n\n" " vtkWidgetEvent::AddPoint -- add one point; depending on the state\n" " it may the first or second point added.\n" "Or,\n" " if near a handle, select the handle.\n" " vtkWidgetEvent::Move -- move the second point or handle depending\n" "on the state.\n" " vtkWidgetEvent::EndSelect -- the handle manipulation process has\n" "completed. \n\n" "@par Event Bindings: This widget invokes the following VTK events on\n" "itself (which observers can listen for):\n\n\n" " vtkCommand::StartInteractionEvent (beginning to interact)\n" " vtkCommand::EndInteractionEvent (completing interaction)\n" " vtkCommand::InteractionEvent (moving after selecting something)\n" " vtkCommand::PlacePointEvent (after point is positioned;\n" " call data includes handle id (0,1)) \n\n" "@sa\n" "vtkHandleWidget\n\n"; static PyObject * PyvtkDistanceWidget_IsTypeOf(PyObject *, PyObject *args) { vtkPythonArgs ap(args, "IsTypeOf"); char *temp0 = nullptr; PyObject *result = nullptr; if (ap.CheckArgCount(1) && ap.GetValue(temp0)) { int tempr = vtkDistanceWidget::IsTypeOf(temp0); if (!ap.ErrorOccurred()) { result = ap.BuildValue(tempr); } } return result; } static PyObject * PyvtkDistanceWidget_IsA(PyObject *self, PyObject *args) { vtkPythonArgs ap(self, args, "IsA"); vtkObjectBase *vp = ap.GetSelfPointer(self, args); vtkDistanceWidget *op = static_cast(vp); char *temp0 = nullptr; PyObject *result = nullptr; if (op && ap.CheckArgCount(1) && ap.GetValue(temp0)) { int tempr = (ap.IsBound() ? op->IsA(temp0) : op->vtkDistanceWidget::IsA(temp0)); if (!ap.ErrorOccurred()) { result = ap.BuildValue(tempr); } } return result; } static PyObject * PyvtkDistanceWidget_SafeDownCast(PyObject *, PyObject *args) { vtkPythonArgs ap(args, "SafeDownCast"); vtkObjectBase *temp0 = nullptr; PyObject *result = nullptr; if (ap.CheckArgCount(1) && ap.GetVTKObject(temp0, "vtkObjectBase")) { vtkDistanceWidget *tempr = vtkDistanceWidget::SafeDownCast(temp0); if (!ap.ErrorOccurred()) { result = ap.BuildVTKObject(tempr); } } return result; } static PyObject * PyvtkDistanceWidget_NewInstance(PyObject *self, PyObject *args) { vtkPythonArgs ap(self, args, "NewInstance"); vtkObjectBase *vp = ap.GetSelfPointer(self, args); vtkDistanceWidget *op = static_cast(vp); PyObject *result = nullptr; if (op && ap.CheckArgCount(0)) { vtkDistanceWidget *tempr = (ap.IsBound() ? op->NewInstance() : op->vtkDistanceWidget::NewInstance()); if (!ap.ErrorOccurred()) { result = ap.BuildVTKObject(tempr); if (result && PyVTKObject_Check(result)) { PyVTKObject_GetObject(result)->UnRegister(0); PyVTKObject_SetFlag(result, VTK_PYTHON_IGNORE_UNREGISTER, 1); } } } return result; } static PyObject * PyvtkDistanceWidget_SetEnabled(PyObject *self, PyObject *args) { vtkPythonArgs ap(self, args, "SetEnabled"); vtkObjectBase *vp = ap.GetSelfPointer(self, args); vtkDistanceWidget *op = static_cast(vp); int temp0; PyObject *result = nullptr; if (op && ap.CheckArgCount(1) && ap.GetValue(temp0)) { if (ap.IsBound()) { op->SetEnabled(temp0); } else { op->vtkDistanceWidget::SetEnabled(temp0); } if (!ap.ErrorOccurred()) { result = ap.BuildNone(); } } return result; } static PyObject * PyvtkDistanceWidget_SetRepresentation(PyObject *self, PyObject *args) { vtkPythonArgs ap(self, args, "SetRepresentation"); vtkObjectBase *vp = ap.GetSelfPointer(self, args); vtkDistanceWidget *op = static_cast(vp); vtkDistanceRepresentation *temp0 = nullptr; PyObject *result = nullptr; if (op && ap.CheckArgCount(1) && ap.GetVTKObject(temp0, "vtkDistanceRepresentation")) { if (ap.IsBound()) { op->SetRepresentation(temp0); } else { op->vtkDistanceWidget::SetRepresentation(temp0); } if (!ap.ErrorOccurred()) { result = ap.BuildNone(); } } return result; } static PyObject * PyvtkDistanceWidget_GetDistanceRepresentation(PyObject *self, PyObject *args) { vtkPythonArgs ap(self, args, "GetDistanceRepresentation"); vtkObjectBase *vp = ap.GetSelfPointer(self, args); vtkDistanceWidget *op = static_cast(vp); PyObject *result = nullptr; if (op && ap.CheckArgCount(0)) { vtkDistanceRepresentation *tempr = (ap.IsBound() ? op->GetDistanceRepresentation() : op->vtkDistanceWidget::GetDistanceRepresentation()); if (!ap.ErrorOccurred()) { result = ap.BuildVTKObject(tempr); } } return result; } static PyObject * PyvtkDistanceWidget_CreateDefaultRepresentation(PyObject *self, PyObject *args) { vtkPythonArgs ap(self, args, "CreateDefaultRepresentation"); vtkObjectBase *vp = ap.GetSelfPointer(self, args); vtkDistanceWidget *op = static_cast(vp); PyObject *result = nullptr; if (op && ap.CheckArgCount(0)) { if (ap.IsBound()) { op->CreateDefaultRepresentation(); } else { op->vtkDistanceWidget::CreateDefaultRepresentation(); } if (!ap.ErrorOccurred()) { result = ap.BuildNone(); } } return result; } static PyObject * PyvtkDistanceWidget_SetProcessEvents(PyObject *self, PyObject *args) { vtkPythonArgs ap(self, args, "SetProcessEvents"); vtkObjectBase *vp = ap.GetSelfPointer(self, args); vtkDistanceWidget *op = static_cast(vp); int temp0; PyObject *result = nullptr; if (op && ap.CheckArgCount(1) && ap.GetValue(temp0)) { if (ap.IsBound()) { op->SetProcessEvents(temp0); } else { op->vtkDistanceWidget::SetProcessEvents(temp0); } if (!ap.ErrorOccurred()) { result = ap.BuildNone(); } } return result; } static PyObject * PyvtkDistanceWidget_SetWidgetStateToStart(PyObject *self, PyObject *args) { vtkPythonArgs ap(self, args, "SetWidgetStateToStart"); vtkObjectBase *vp = ap.GetSelfPointer(self, args); vtkDistanceWidget *op = static_cast(vp); PyObject *result = nullptr; if (op && ap.CheckArgCount(0)) { if (ap.IsBound()) { op->SetWidgetStateToStart(); } else { op->vtkDistanceWidget::SetWidgetStateToStart(); } if (!ap.ErrorOccurred()) { result = ap.BuildNone(); } } return result; } static PyObject * PyvtkDistanceWidget_SetWidgetStateToManipulate(PyObject *self, PyObject *args) { vtkPythonArgs ap(self, args, "SetWidgetStateToManipulate"); vtkObjectBase *vp = ap.GetSelfPointer(self, args); vtkDistanceWidget *op = static_cast(vp); PyObject *result = nullptr; if (op && ap.CheckArgCount(0)) { if (ap.IsBound()) { op->SetWidgetStateToManipulate(); } else { op->vtkDistanceWidget::SetWidgetStateToManipulate(); } if (!ap.ErrorOccurred()) { result = ap.BuildNone(); } } return result; } static PyObject * PyvtkDistanceWidget_GetWidgetState(PyObject *self, PyObject *args) { vtkPythonArgs ap(self, args, "GetWidgetState"); vtkObjectBase *vp = ap.GetSelfPointer(self, args); vtkDistanceWidget *op = static_cast(vp); PyObject *result = nullptr; if (op && ap.CheckArgCount(0)) { int tempr = (ap.IsBound() ? op->GetWidgetState() : op->vtkDistanceWidget::GetWidgetState()); if (!ap.ErrorOccurred()) { result = ap.BuildValue(tempr); } } return result; } static PyMethodDef PyvtkDistanceWidget_Methods[] = { {"IsTypeOf", PyvtkDistanceWidget_IsTypeOf, METH_VARARGS, "V.IsTypeOf(string) -> int\nC++: static vtkTypeBool IsTypeOf(const char *type)\n\nStandard methods for a VTK class.\n"}, {"IsA", PyvtkDistanceWidget_IsA, METH_VARARGS, "V.IsA(string) -> int\nC++: vtkTypeBool IsA(const char *type) override;\n\nStandard methods for a VTK class.\n"}, {"SafeDownCast", PyvtkDistanceWidget_SafeDownCast, METH_VARARGS, "V.SafeDownCast(vtkObjectBase) -> vtkDistanceWidget\nC++: static vtkDistanceWidget *SafeDownCast(vtkObjectBase *o)\n\nStandard methods for a VTK class.\n"}, {"NewInstance", PyvtkDistanceWidget_NewInstance, METH_VARARGS, "V.NewInstance() -> vtkDistanceWidget\nC++: vtkDistanceWidget *NewInstance()\n\nStandard methods for a VTK class.\n"}, {"SetEnabled", PyvtkDistanceWidget_SetEnabled, METH_VARARGS, "V.SetEnabled(int)\nC++: void SetEnabled(int) override;\n\nThe method for activating and deactivating this widget. This\nmethod must be overridden because it is a composite widget and\ndoes more than its superclasses' vtkAbstractWidget::SetEnabled()\nmethod.\n"}, {"SetRepresentation", PyvtkDistanceWidget_SetRepresentation, METH_VARARGS, "V.SetRepresentation(vtkDistanceRepresentation)\nC++: void SetRepresentation(vtkDistanceRepresentation *r)\n\nSpecify an instance of vtkWidgetRepresentation used to represent\nthis widget in the scene. Note that the representation is a\nsubclass of vtkProp so it can be added to the renderer\nindependent of the widget.\n"}, {"GetDistanceRepresentation", PyvtkDistanceWidget_GetDistanceRepresentation, METH_VARARGS, "V.GetDistanceRepresentation() -> vtkDistanceRepresentation\nC++: vtkDistanceRepresentation *GetDistanceRepresentation()\n\nReturn the representation as a vtkDistanceRepresentation.\n"}, {"CreateDefaultRepresentation", PyvtkDistanceWidget_CreateDefaultRepresentation, METH_VARARGS, "V.CreateDefaultRepresentation()\nC++: void CreateDefaultRepresentation() override;\n\nCreate the default widget representation if one is not set.\n"}, {"SetProcessEvents", PyvtkDistanceWidget_SetProcessEvents, METH_VARARGS, "V.SetProcessEvents(int)\nC++: void SetProcessEvents(int) override;\n\nMethods to change the whether the widget responds to interaction.\nOverridden to pass the state to component widgets.\n"}, {"SetWidgetStateToStart", PyvtkDistanceWidget_SetWidgetStateToStart, METH_VARARGS, "V.SetWidgetStateToStart()\nC++: virtual void SetWidgetStateToStart()\n\nSet the state of the widget. If the state is set to \"Manipulate\"\nthen it is assumed that the widget and its representation will be\ninitialized programmatically and is not interactively placed.\nInitially the widget state is set to \"Start\" which means nothing\nwill appear and the user must interactively place the widget with\nrepeated mouse selections. Set the state to \"Start\" if you want\ninteractive placement. Generally state changes must be followed\nby a Render() for things to visually take effect.\n"}, {"SetWidgetStateToManipulate", PyvtkDistanceWidget_SetWidgetStateToManipulate, METH_VARARGS, "V.SetWidgetStateToManipulate()\nC++: virtual void SetWidgetStateToManipulate()\n\nSet the state of the widget. If the state is set to \"Manipulate\"\nthen it is assumed that the widget and its representation will be\ninitialized programmatically and is not interactively placed.\nInitially the widget state is set to \"Start\" which means nothing\nwill appear and the user must interactively place the widget with\nrepeated mouse selections. Set the state to \"Start\" if you want\ninteractive placement. Generally state changes must be followed\nby a Render() for things to visually take effect.\n"}, {"GetWidgetState", PyvtkDistanceWidget_GetWidgetState, METH_VARARGS, "V.GetWidgetState() -> int\nC++: virtual int GetWidgetState()\n\nReturn the current widget state.\n"}, {nullptr, nullptr, 0, nullptr} }; static PyTypeObject PyvtkDistanceWidget_Type = { PyVarObject_HEAD_INIT(&PyType_Type, 0) "vtkInteractionWidgetsPython.vtkDistanceWidget", // tp_name sizeof(PyVTKObject), // tp_basicsize 0, // tp_itemsize PyVTKObject_Delete, // tp_dealloc 0, // tp_print nullptr, // tp_getattr nullptr, // tp_setattr nullptr, // tp_compare PyVTKObject_Repr, // tp_repr nullptr, // tp_as_number nullptr, // tp_as_sequence nullptr, // tp_as_mapping nullptr, // tp_hash nullptr, // tp_call PyVTKObject_String, // tp_str PyObject_GenericGetAttr, // tp_getattro PyObject_GenericSetAttr, // tp_setattro &PyVTKObject_AsBuffer, // tp_as_buffer Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_BASETYPE, // tp_flags PyvtkDistanceWidget_Doc, // tp_doc PyVTKObject_Traverse, // tp_traverse nullptr, // tp_clear nullptr, // tp_richcompare offsetof(PyVTKObject, vtk_weakreflist), // tp_weaklistoffset nullptr, // tp_iter nullptr, // tp_iternext nullptr, // tp_methods nullptr, // tp_members PyVTKObject_GetSet, // tp_getset nullptr, // tp_base nullptr, // tp_dict nullptr, // tp_descr_get nullptr, // tp_descr_set offsetof(PyVTKObject, vtk_dict), // tp_dictoffset nullptr, // tp_init nullptr, // tp_alloc PyVTKObject_New, // tp_new PyObject_GC_Del, // tp_free nullptr, // tp_is_gc nullptr, // tp_bases nullptr, // tp_mro nullptr, // tp_cache nullptr, // tp_subclasses nullptr, // tp_weaklist VTK_WRAP_PYTHON_SUPPRESS_UNINITIALIZED }; static vtkObjectBase *PyvtkDistanceWidget_StaticNew() { return vtkDistanceWidget::New(); } PyObject *PyvtkDistanceWidget_ClassNew() { PyVTKClass_Add( &PyvtkDistanceWidget_Type, PyvtkDistanceWidget_Methods, "vtkDistanceWidget", &PyvtkDistanceWidget_StaticNew); PyTypeObject *pytype = &PyvtkDistanceWidget_Type; if ((pytype->tp_flags & Py_TPFLAGS_READY) != 0) { return (PyObject *)pytype; } #if !defined(VTK_PY3K) && PY_VERSION_HEX >= 0x02060000 pytype->tp_flags |= Py_TPFLAGS_HAVE_NEWBUFFER; #endif pytype->tp_base = (PyTypeObject *)PyvtkAbstractWidget_ClassNew(); PyObject *d = pytype->tp_dict; PyObject *o; for (int c = 0; c < 3; c++) { static const struct { const char *name; int value; } constants[3] = { { "Start", vtkDistanceWidget::Start }, { "Define", vtkDistanceWidget::Define }, { "Manipulate", vtkDistanceWidget::Manipulate }, }; o = PyInt_FromLong(constants[c].value); if (o) { PyDict_SetItemString(d, constants[c].name, o); Py_DECREF(o); } } PyType_Ready(pytype); return (PyObject *)pytype; } void PyVTKAddFile_vtkDistanceWidget( PyObject *dict) { PyObject *o; o = PyvtkDistanceWidget_ClassNew(); if (o && PyDict_SetItemString(dict, "vtkDistanceWidget", o) != 0) { Py_DECREF(o); } }