Open3D (C++ API)  0.18.0+afb23f8
Data Structures | Public Types | Public Member Functions
open3d::visualization::gui::SceneWidget Class Reference

#include <SceneWidget.h>

Inheritance diagram for open3d::visualization::gui::SceneWidget:
open3d::visualization::gui::Widget

Data Structures

struct  Impl
 
class  MouseInteractor
 
struct  PickableGeometry
 

Public Types

enum  Controls {
  ROTATE_CAMERA , ROTATE_CAMERA_SPHERE , FLY , ROTATE_SUN ,
  ROTATE_IBL , ROTATE_MODEL , PICK_POINTS
}
 
enum class  Quality { FAST , BEST }
 
enum class  CameraPreset { PLUS_X , PLUS_Y , PLUS_Z }
 
enum class  PolygonPickAction { CANCEL = 0 , SELECT }
 
- Public Types inherited from open3d::visualization::gui::Widget
enum class  DrawResult { NONE , REDRAW , RELAYOUT }
 
enum class  EventResult { IGNORED , CONSUMED , DISCARD }
 

Public Member Functions

 SceneWidget ()
 
 ~SceneWidget () override
 
void SetFrame (const Rect &f) override
 
void SetViewControls (Controls mode)
 
void SetupCamera (float verticalFoV, const geometry::AxisAlignedBoundingBox &scene_bounds, const Eigen::Vector3f &center_of_rotation)
 
void SetupCamera (const camera::PinholeCameraIntrinsic &intrinsic, const Eigen::Matrix4d &extrinsic, const geometry::AxisAlignedBoundingBox &scene_bounds)
 
void SetupCamera (const Eigen::Matrix3d &intrinsic, const Eigen::Matrix4d &extrinsic, int intrinsic_width_px, int intrinsic_height_px, const geometry::AxisAlignedBoundingBox &scene_bounds)
 
void LookAt (const Eigen::Vector3f &center, const Eigen::Vector3f &eye, const Eigen::Vector3f &up)
 
void SetOnCameraChanged (std::function< void(visualization::rendering::Camera *)> on_cam_changed)
 
Eigen::Vector3f GetCenterOfRotation () const
 
void SetCenterOfRotation (const Eigen::Vector3f &center)
 
void SetOnSunDirectionChanged (std::function< void(const Eigen::Vector3f &)> on_dir_changed)
 
void SetScene (std::shared_ptr< rendering::Open3DScene > scene)
 
std::shared_ptr< rendering::Open3DSceneGetScene () const
 
rendering::ViewGetRenderView () const
 
void EnableSceneCaching (bool enable)
 
void ForceRedraw ()
 
void SetRenderQuality (Quality level)
 
Quality GetRenderQuality () const
 
void GoToCameraPreset (CameraPreset preset)
 
void SetSunInteractorEnabled (bool enable)
 
void SetPickableGeometry (const std::vector< PickableGeometry > &geometry)
 
void SetPickablePointSize (int px)
 
void SetOnPointsPicked (std::function< void(const std::map< std::string, std::vector< std::pair< size_t, Eigen::Vector3d >>> &, int)> on_picked)
 
void SetOnStartedPolygonPicking (std::function< void()> on_poly_pick)
 
void DoPolygonPick (PolygonPickAction action)
 
std::shared_ptr< Label3DAddLabel (const Eigen::Vector3f &pos, const char *text)
 
void RemoveLabel (std::shared_ptr< Label3D > label)
 
void ClearLabels ()
 
Widget::DrawResult Draw (const DrawContext &context) override
 
Widget::EventResult Mouse (const MouseEvent &e) override
 
Widget::EventResult Key (const KeyEvent &e) override
 
Widget::DrawResult Tick (const TickEvent &e) override
 
- Public Member Functions inherited from open3d::visualization::gui::Widget
 Widget ()
 
 Widget (const std::vector< std::shared_ptr< Widget >> &children)
 
virtual ~Widget ()
 
virtual void AddChild (std::shared_ptr< Widget > child)
 
virtual const std::vector< std::shared_ptr< Widget > > GetChildren () const
 
virtual const RectGetFrame () const
 Returns the frame size in pixels. More...
 
virtual const ColorGetBackgroundColor () const
 
virtual bool IsDefaultBackgroundColor () const
 
virtual void SetBackgroundColor (const Color &color)
 
virtual bool IsVisible () const
 
virtual void SetVisible (bool vis)
 
virtual bool IsEnabled () const
 
virtual void SetEnabled (bool enabled)
 
virtual void SetTooltip (const char *text)
 
virtual const char * GetTooltip () const
 
virtual Size CalcPreferredSize (const LayoutContext &context, const Constraints &constraints) const
 
virtual Size CalcMinimumSize (const LayoutContext &context) const
 
virtual void Layout (const LayoutContext &context)
 

Additional Inherited Members

- Static Public Attributes inherited from open3d::visualization::gui::Widget
static constexpr int DIM_GROW = 10000
 
- Protected Member Functions inherited from open3d::visualization::gui::Widget
void DrawImGuiPushEnabledState ()
 
void DrawImGuiPopEnabledState ()
 
void DrawImGuiTooltip ()
 

Member Enumeration Documentation

◆ CameraPreset

Enumerator
PLUS_X 
PLUS_Y 
PLUS_Z 

◆ Controls

Enumerator
ROTATE_CAMERA 
ROTATE_CAMERA_SPHERE 
FLY 
ROTATE_SUN 
ROTATE_IBL 
ROTATE_MODEL 
PICK_POINTS 

◆ PolygonPickAction

Enumerator
CANCEL 
SELECT 

◆ Quality

Enumerator
FAST 
BEST 

Constructor & Destructor Documentation

◆ SceneWidget()

open3d::visualization::gui::SceneWidget::SceneWidget ( )
explicit

◆ ~SceneWidget()

open3d::visualization::gui::SceneWidget::~SceneWidget ( )
override

Member Function Documentation

◆ AddLabel()

std::shared_ptr< Label3D > open3d::visualization::gui::SceneWidget::AddLabel ( const Eigen::Vector3f &  pos,
const char *  text 
)

◆ ClearLabels()

void open3d::visualization::gui::SceneWidget::ClearLabels ( )

◆ DoPolygonPick()

void open3d::visualization::gui::SceneWidget::DoPolygonPick ( PolygonPickAction  action)

◆ Draw()

Widget::DrawResult open3d::visualization::gui::SceneWidget::Draw ( const DrawContext context)
overridevirtual

Draws the widget. If this is a Dear ImGUI widget, this is where the actual event processing happens. Return NONE if no action needs to be taken, REDRAW if the widget needs to be redrawn (e.g. its value changed), and RELAYOUT if the widget wishes to change size.

Reimplemented from open3d::visualization::gui::Widget.

◆ EnableSceneCaching()

void open3d::visualization::gui::SceneWidget::EnableSceneCaching ( bool  enable)

Enable (or disable) caching of scene to improve UI responsiveness when dealing with large scenes (especially point clouds)

◆ ForceRedraw()

void open3d::visualization::gui::SceneWidget::ForceRedraw ( )

Forces the scene to redraw regardless of Renderer caching settings.

◆ GetCenterOfRotation()

Eigen::Vector3f open3d::visualization::gui::SceneWidget::GetCenterOfRotation ( ) const

◆ GetRenderQuality()

SceneWidget::Quality open3d::visualization::gui::SceneWidget::GetRenderQuality ( ) const

◆ GetRenderView()

rendering::View * open3d::visualization::gui::SceneWidget::GetRenderView ( ) const

◆ GetScene()

std::shared_ptr< rendering::Open3DScene > open3d::visualization::gui::SceneWidget::GetScene ( ) const

◆ GoToCameraPreset()

void open3d::visualization::gui::SceneWidget::GoToCameraPreset ( CameraPreset  preset)

◆ Key()

Widget::EventResult open3d::visualization::gui::SceneWidget::Key ( const KeyEvent e)
overridevirtual

Widgets that use Dear ImGUI should not need to override this, as Dear ImGUI will take care of all the key handling during the Draw().

Reimplemented from open3d::visualization::gui::Widget.

◆ LookAt()

void open3d::visualization::gui::SceneWidget::LookAt ( const Eigen::Vector3f &  center,
const Eigen::Vector3f &  eye,
const Eigen::Vector3f &  up 
)

◆ Mouse()

Widget::EventResult open3d::visualization::gui::SceneWidget::Mouse ( const MouseEvent e)
overridevirtual

Widgets that use Dear ImGUI should not need to override this, as Dear ImGUI will take care of all the mouse handling during the Draw().

Reimplemented from open3d::visualization::gui::Widget.

◆ RemoveLabel()

void open3d::visualization::gui::SceneWidget::RemoveLabel ( std::shared_ptr< Label3D label)

◆ SetCenterOfRotation()

void open3d::visualization::gui::SceneWidget::SetCenterOfRotation ( const Eigen::Vector3f &  center)

◆ SetFrame()

void open3d::visualization::gui::SceneWidget::SetFrame ( const Rect f)
overridevirtual

The frame is in pixels. The size of a pixel varies on different and operating systems now frequently scale text sizes on high DPI monitors. Prefer using a Layout to using this function, but if you must use it, it is best to use a multiple of Window::GetTheme().fontSize, which represents 1em and is scaled according to the scaling factor of the window.

Reimplemented from open3d::visualization::gui::Widget.

◆ SetOnCameraChanged()

void open3d::visualization::gui::SceneWidget::SetOnCameraChanged ( std::function< void(visualization::rendering::Camera *)>  on_cam_changed)

◆ SetOnPointsPicked()

void open3d::visualization::gui::SceneWidget::SetOnPointsPicked ( std::function< void(const std::map< std::string, std::vector< std::pair< size_t, Eigen::Vector3d >>> &, int)>  on_picked)

◆ SetOnStartedPolygonPicking()

void open3d::visualization::gui::SceneWidget::SetOnStartedPolygonPicking ( std::function< void()>  on_poly_pick)

◆ SetOnSunDirectionChanged()

void open3d::visualization::gui::SceneWidget::SetOnSunDirectionChanged ( std::function< void(const Eigen::Vector3f &)>  on_dir_changed)

Enables changing the directional light with the mouse. SceneWidget will update the light's direction, so onDirChanged is only needed if other things need to be updated (like a UI).

◆ SetPickableGeometry()

void open3d::visualization::gui::SceneWidget::SetPickableGeometry ( const std::vector< PickableGeometry > &  geometry)

◆ SetPickablePointSize()

void open3d::visualization::gui::SceneWidget::SetPickablePointSize ( int  px)

◆ SetRenderQuality()

void open3d::visualization::gui::SceneWidget::SetRenderQuality ( Quality  level)

◆ SetScene()

void open3d::visualization::gui::SceneWidget::SetScene ( std::shared_ptr< rendering::Open3DScene scene)

◆ SetSunInteractorEnabled()

void open3d::visualization::gui::SceneWidget::SetSunInteractorEnabled ( bool  enable)

◆ SetupCamera() [1/3]

void open3d::visualization::gui::SceneWidget::SetupCamera ( const camera::PinholeCameraIntrinsic intrinsic,
const Eigen::Matrix4d &  extrinsic,
const geometry::AxisAlignedBoundingBox scene_bounds 
)

◆ SetupCamera() [2/3]

void open3d::visualization::gui::SceneWidget::SetupCamera ( const Eigen::Matrix3d &  intrinsic,
const Eigen::Matrix4d &  extrinsic,
int  intrinsic_width_px,
int  intrinsic_height_px,
const geometry::AxisAlignedBoundingBox scene_bounds 
)

◆ SetupCamera() [3/3]

void open3d::visualization::gui::SceneWidget::SetupCamera ( float  verticalFoV,
const geometry::AxisAlignedBoundingBox scene_bounds,
const Eigen::Vector3f &  center_of_rotation 
)

◆ SetViewControls()

void open3d::visualization::gui::SceneWidget::SetViewControls ( Controls  mode)

◆ Tick()

Widget::DrawResult open3d::visualization::gui::SceneWidget::Tick ( const TickEvent e)
overridevirtual

Tick events are sent regularly and allow for things like smoothly moving the camera based on keys that are pressed, or animations. Return DrawResult::REDRAW if you want to be redrawn.

Reimplemented from open3d::visualization::gui::Widget.


The documentation for this class was generated from the following files: