ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
ccDrawableObject.cpp
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #include <pybind11/pybind11.h>
9 #include <pybind11/stl.h>
10 #include <pybind11/stl_bind.h>
11 
12 #include <ecvDrawableObject.h>
13 #include <ecvGenericDisplayTools.h>
14 
15 namespace py = pybind11;
16 using namespace pybind11::literals;
17 
18 void define_ccDrawableObject(py::module &m)
19 {
20  py::class_<ccDrawableObject>(m, "ccDrawableObject", R"pbdoc(
21  Base class of all objects that ACloudViewer is able to render/draw/display on the screen
22 )pbdoc")
23  .def("draw", &ccDrawableObject::draw, "context"_a)
24  .def("isVisible", &ccDrawableObject::isVisible)
25  .def("setVisible", &ccDrawableObject::setVisible, "state"_a)
26  .def("toggleVisibility", &ccDrawableObject::toggleVisibility)
27  .def("isVisibilityLocked", &ccDrawableObject::isVisibilityLocked)
28  .def("lockVisibility", &ccDrawableObject::lockVisibility)
29  .def("isSelected", &ccDrawableObject::isSelected)
30  .def("setSelected", &ccDrawableObject::setSelected, "state"_a)
31  .def("hasColors", &ccDrawableObject::hasColors)
32  .def("colorsShown", &ccDrawableObject::colorsShown)
33  .def("showColors", &ccDrawableObject::showColors, "state"_a)
34  .def("toggleColors", &ccDrawableObject::toggleColors)
35  .def("hasNormals", &ccDrawableObject::hasNormals)
36  .def("normalsShown", &ccDrawableObject::normalsShown)
37  .def("showNormals", &ccDrawableObject::showNormals, "state"_a)
38  .def("toggleNormals", &ccDrawableObject::toggleNormals)
39  .def("hasDisplayedScalarField", &ccDrawableObject::hasDisplayedScalarField)
40  .def("hasScalarFields", &ccDrawableObject::hasScalarFields)
41  .def("showSF", &ccDrawableObject::showSF, "state"_a)
42  .def("toggleSF", &ccDrawableObject::toggleSF)
43  .def("sfShown", &ccDrawableObject::sfShown)
44  .def("toggleMaterials", &ccDrawableObject::toggleMaterials)
45  .def("showNameIn3D", &ccDrawableObject::showNameIn3D, "state"_a)
46  .def("nameShownIn3D", &ccDrawableObject::nameShownIn3D)
47  .def("toggleShowName", &ccDrawableObject::toggleShowName)
48  // temporary color
49  .def("isColorOverridden", &ccDrawableObject::isColorOverridden)
50  .def("getTempColor", &ccDrawableObject::getTempColor)
51  .def("setTempColor",
52  (void(ccDrawableObject::*)(const ecvColor::Rgba &, bool))(
54  "col"_a,
55  "autoActivate"_a = true)
56 
57  .def("setTempColor",
58  (void(ccDrawableObject::*)(const ecvColor::Rgb &, bool))(
60  "col"_a,
61  "autoActivate"_a = true)
62  // Transformation matrix management
63  .def("setGLTransformation", &ccDrawableObject::setGLTransformation, "trans"_a)
64  .def("enableGLTransformation", &ccDrawableObject::enableGLTransformation, "state"_a)
65  .def("isGLTransEnabled", &ccDrawableObject::isGLTransEnabled)
66  .def("getGLTransformation", &ccDrawableObject::getGLTransformation)
67  .def("resetGLTransformation", &ccDrawableObject::resetGLTransformation)
68  .def("rotateGL", &ccDrawableObject::rotateGL, "rotMat"_a)
69  .def("translateGL", &ccDrawableObject::translateGL, "rotMat"_a)
70  // clipping plane
71  .def("removeAllClipPlanes", &ccDrawableObject::removeAllClipPlanes)
72  .def("addClipPlanes", &ccDrawableObject::addClipPlanes, "plane"_a)
73  .def("toggleClipPlanes", &ccDrawableObject::toggleClipPlanes, "context"_a, "enable"_a);
74 }
void define_ccDrawableObject(py::module &m)
Generic interface for (3D) drawable entities.
virtual void translateGL(const CCVector3 &trans)
Translates current GL transformation by a rotation matrix.
virtual void toggleVisibility()
Toggles visibility.
virtual bool colorsShown() const
Returns whether colors are shown or not.
virtual bool isVisible() const
Returns whether entity is visible or not.
virtual void setTempColor(const ecvColor::Rgb &col, bool autoActivate=true)
Sets current temporary (unique)
virtual bool isVisibilityLocked() const
Returns whether visibility is locked or not.
virtual bool hasDisplayedScalarField() const
Returns whether an active scalar field is available or not.
virtual void toggleNormals()
Toggles normals display state.
virtual bool hasColors() const
Returns whether colors are enabled or not.
virtual void lockVisibility(bool state)
Locks/unlocks visibility.
virtual void enableGLTransformation(bool state)
Enables/disables associated GL transformation.
virtual void setVisible(bool state)
Sets entity visibility.
virtual bool sfShown() const
Returns whether active scalar field is visible.
virtual bool isGLTransEnabled() const
Returns whether a GL transformation is enabled or not.
virtual bool normalsShown() const
Returns whether normals are shown or not.
virtual const ccGLMatrix & getGLTransformation() const
Returns associated GL transformation.
virtual void toggleClipPlanes(CC_DRAW_CONTEXT &context, bool enable)
Enables or disables clipping planes (OpenGL)
virtual bool hasNormals() const
Returns whether normals are enabled or not.
virtual bool isColorOverridden() const
virtual void toggleSF()
Toggles SF display state.
virtual void toggleMaterials()
Toggles material display state.
virtual void toggleColors()
Toggles colors display state.
virtual bool isSelected() const
Returns whether entity is selected or not.
virtual void toggleShowName()
Toggles name in 3D display state.
virtual void showNameIn3D(bool state)
Sets whether name should be displayed in 3D.
virtual bool nameShownIn3D() const
Returns whether name is displayed in 3D or not.
virtual void removeAllClipPlanes()
Removes all clipping planes (if any)
virtual void showNormals(bool state)
Sets normals visibility.
virtual void showColors(bool state)
Sets colors visibility.
virtual void showSF(bool state)
Sets active scalarfield visibility.
virtual const ecvColor::Rgb & getTempColor() const
Returns current temporary (unique) color.
virtual void rotateGL(const ccGLMatrix &rotMat)
Multiplies (left) current GL transformation by a rotation matrix.
virtual bool hasScalarFields() const
Returns whether one or more scalar fields are instantiated.
virtual void draw(CC_DRAW_CONTEXT &context)=0
Draws entity and its children.
virtual bool addClipPlanes(const ccClipPlane &plane)
Registers a new clipping plane.
virtual void resetGLTransformation()
Resets associated GL transformation.
virtual void setGLTransformation(const ccGLMatrix &trans)
Associates entity with a GL transformation (rotation + translation)
virtual void setSelected(bool state)
Selects/Unselects entity.
RGB color structure.
Definition: ecvColorTypes.h:49
RGBA color structure.