2016-01-19 11:17:13 +00:00
|
|
|
#ifndef CSV_RENDER_INSTANCE_SELECTION_MODE_H
|
|
|
|
#define CSV_RENDER_INSTANCE_SELECTION_MODE_H
|
|
|
|
|
2021-01-09 21:35:07 +00:00
|
|
|
#include <QPoint>
|
|
|
|
|
|
|
|
#include <osg/PositionAttitudeTransform>
|
|
|
|
#include <osg/Vec3d>
|
|
|
|
|
2016-05-18 14:46:25 +00:00
|
|
|
#include "selectionmode.hpp"
|
2021-01-09 21:35:07 +00:00
|
|
|
#include "instancedragmodes.hpp"
|
2016-01-19 13:25:20 +00:00
|
|
|
|
2016-01-19 11:17:13 +00:00
|
|
|
namespace CSVRender
|
|
|
|
{
|
2016-05-18 14:46:25 +00:00
|
|
|
class InstanceSelectionMode : public SelectionMode
|
2016-01-19 11:17:13 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
2016-05-18 14:46:25 +00:00
|
|
|
public:
|
|
|
|
|
2021-01-09 21:35:07 +00:00
|
|
|
InstanceSelectionMode(CSVWidget::SceneToolbar* parent, WorldspaceWidget& worldspaceWidget, osg::Group *cellNode);
|
|
|
|
|
|
|
|
~InstanceSelectionMode();
|
|
|
|
|
|
|
|
/// Store the worldspace-coordinate when drag begins
|
|
|
|
void setDragStart(const osg::Vec3d& dragStart);
|
2016-05-18 14:46:25 +00:00
|
|
|
|
2021-01-09 21:35:07 +00:00
|
|
|
/// Store the worldspace-coordinate when drag begins
|
|
|
|
const osg::Vec3d& getDragStart();
|
|
|
|
|
|
|
|
/// Store the screen-coordinate when drag begins
|
|
|
|
void setScreenDragStart(const QPoint& dragStartPoint);
|
|
|
|
|
|
|
|
/// Apply instance selection changes
|
|
|
|
void dragEnded(const osg::Vec3d& dragEndPoint, DragMode dragMode);
|
|
|
|
|
|
|
|
void drawSelectionCubeCentre(const osg::Vec3f& mousePlanePoint );
|
|
|
|
void drawSelectionCubeCorner(const osg::Vec3f& mousePlanePoint );
|
|
|
|
void drawSelectionSphere(const osg::Vec3f& mousePlanePoint );
|
2016-05-18 14:46:25 +00:00
|
|
|
protected:
|
2016-01-19 13:25:20 +00:00
|
|
|
|
|
|
|
/// Add context menu items to \a menu.
|
|
|
|
///
|
|
|
|
/// \attention menu can be a 0-pointer
|
|
|
|
///
|
|
|
|
/// \return Have there been any menu items to be added (if menu is 0 and there
|
|
|
|
/// items to be added, the function must return true anyway.
|
2020-10-16 18:18:54 +00:00
|
|
|
bool createContextMenu(QMenu* menu) override;
|
2016-01-19 13:25:20 +00:00
|
|
|
|
2016-05-18 14:46:25 +00:00
|
|
|
private:
|
2016-01-19 11:17:13 +00:00
|
|
|
|
2021-01-09 21:35:07 +00:00
|
|
|
void drawSelectionBox(const osg::Vec3d& pointA, const osg::Vec3d& pointB);
|
|
|
|
void drawSelectionCube(const osg::Vec3d& point, float radius);
|
|
|
|
void drawSelectionSphere(const osg::Vec3d& point, float radius);
|
|
|
|
|
2016-05-18 14:46:25 +00:00
|
|
|
QAction* mDeleteSelection;
|
|
|
|
QAction* mSelectSame;
|
2021-01-09 21:35:07 +00:00
|
|
|
osg::Vec3d mDragStart;
|
|
|
|
osg::Group* mParentNode;
|
|
|
|
osg::ref_ptr<osg::PositionAttitudeTransform> mBaseNode;
|
2016-01-19 13:25:20 +00:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
|
2016-01-25 13:55:02 +00:00
|
|
|
void deleteSelection();
|
2016-01-26 10:31:37 +00:00
|
|
|
void selectSame();
|
2016-01-19 11:17:13 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|