2019-04-18 07:59:17 +00:00
|
|
|
#ifndef slic3r_GLSelectionRectangle_hpp_
|
|
|
|
#define slic3r_GLSelectionRectangle_hpp_
|
|
|
|
|
|
|
|
#include "libslic3r/Point.hpp"
|
|
|
|
|
|
|
|
namespace Slic3r {
|
|
|
|
namespace GUI {
|
|
|
|
|
2019-04-24 11:43:39 +00:00
|
|
|
struct Camera;
|
2019-04-24 14:01:27 +00:00
|
|
|
class GLCanvas3D;
|
2019-04-18 07:59:17 +00:00
|
|
|
|
|
|
|
class GLSelectionRectangle {
|
|
|
|
public:
|
|
|
|
enum EState {
|
|
|
|
Off,
|
2019-04-24 14:01:27 +00:00
|
|
|
Select,
|
|
|
|
Deselect
|
|
|
|
};
|
2019-04-18 07:59:17 +00:00
|
|
|
|
2019-04-24 14:01:27 +00:00
|
|
|
// Initiates the rectangle.
|
|
|
|
void start_dragging(const Vec2d& mouse_position, EState state);
|
2019-04-18 07:59:17 +00:00
|
|
|
|
|
|
|
// To be called on mouse move.
|
|
|
|
void dragging(const Vec2d& mouse_position);
|
|
|
|
|
|
|
|
// Given a vector of points in world coordinates, the function returns indices of those
|
|
|
|
// that are in the rectangle. It then disables the rectangle.
|
2019-04-24 14:01:27 +00:00
|
|
|
std::vector<unsigned int> stop_dragging(const GLCanvas3D& canvas, const std::vector<Vec3d>& points);
|
2019-04-18 07:59:17 +00:00
|
|
|
|
2019-04-24 14:01:27 +00:00
|
|
|
// Disables the rectangle.
|
|
|
|
void stop_dragging();
|
2019-04-24 13:43:52 +00:00
|
|
|
|
2019-04-24 14:01:27 +00:00
|
|
|
void render(const GLCanvas3D& canvas) const;
|
2019-04-18 07:59:17 +00:00
|
|
|
|
2019-04-24 14:01:27 +00:00
|
|
|
bool is_dragging() const { return m_state != Off; }
|
|
|
|
EState get_state() const { return m_state; }
|
|
|
|
|
2019-04-18 07:59:17 +00:00
|
|
|
private:
|
2019-04-24 14:01:27 +00:00
|
|
|
EState m_state = Off;
|
2019-04-18 07:59:17 +00:00
|
|
|
Vec2d m_start_corner;
|
|
|
|
Vec2d m_end_corner;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace GUI
|
|
|
|
} // namespace Slic3r
|
|
|
|
|
|
|
|
|
|
|
|
#endif // slic3r_GLGizmoSlaSupports_hpp_
|