**osgUI.Item
**定义了场景图中的一个元素。
osgUI.Item
是 OpenSceneGraph 的一个基本元素,它可以代表任何场景图元素,如模型、文本、图片等。这个类主要用来实现基本的交互功能,如选中、拖拽等。
osg::Referenced
├── osg::Object
├── osg::Drawable
├── osg::Geometry
├── osgText::Text
├── osgUI::Item
osgUI::Item()
osgUI::Item(const osgUI::Item& item, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY)
virtual void setLabel(const std::string& label);
设置 item 的标签
参数:label
- 标签名称
virtual void setSelectable(bool selectable);
设置 item 是否为可选中状态
参数:selectable
- 是否可选中
virtual bool getSelectable() const;
获取 item 的可选中状态
返回值:是否可选中
virtual void setSelected(bool selected);
设置 item 是否被选中
参数:selected
- 是否被选中
virtual bool getSelected() const;
获取 item 的选中状态
返回值:是否被选中
virtual bool handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa);
处理 GUI 事件,并返回处理结果
参数:
ea
- GUI 事件
aa
- GUI 动作
返回值:是否成功处理了事件