initial redesigning widgets

This commit is contained in:
ozantonkal
2013-07-09 10:21:57 +02:00
parent 061c28cde0
commit d324c03b6a
4 changed files with 272 additions and 166 deletions

View File

@@ -13,5 +13,6 @@ namespace temp_viz
struct CV_EXPORTS WidgetAccessor
{
static vtkSmartPointer<vtkProp> getActor(const Widget &widget);
static void setVtkProp(Widget &widget, vtkSmartPointer<vtkProp> actor);
};
}

View File

@@ -13,32 +13,44 @@ namespace temp_viz
Widget();
Widget(const Widget &other);
Widget& operator =(const Widget &other);
~Widget();
void copyTo(Widget &dst);
void setColor(const Color &color);
private:
class Impl;
Impl *impl_;
friend struct WidgetAccessor;
};
/////////////////////////////////////////////////////////////////////////////
/// The base class for all 3D widgets
class CV_EXPORTS Widget3D : public Widget
{
public:
Widget3D();
void setPose(const Affine3f &pose);
void updatePose(const Affine3f &pose);
Affine3f getPose() const;
protected:
Widget(bool text_widget);
void setColor(const Color &color);
private:
class Impl;
Impl* impl_;
struct MatrixConverter;
void create();
void release();
void create(bool text_widget);
friend struct WidgetAccessor;
};
/////////////////////////////////////////////////////////////////////////////
/// The base class for all 2D widgets
class CV_EXPORTS Widget2D : public Widget
{
public:
Widget2D();
};
class CV_EXPORTS LineWidget : public Widget
class CV_EXPORTS LineWidget : public Widget3D
{
public:
LineWidget(const Point3f &pt1, const Point3f &pt2, const Color &color = Color::white());
@@ -47,58 +59,56 @@ namespace temp_viz
float getLineWidth();
};
class CV_EXPORTS PlaneWidget : public Widget
class CV_EXPORTS PlaneWidget : public Widget3D
{
public:
PlaneWidget(const Vec4f& coefs, double size = 1.0, const Color &color = Color::white());
PlaneWidget(const Vec4f& coefs, const Point3f& pt, double size = 1.0, const Color &color = Color::white());
};
class CV_EXPORTS SphereWidget : public Widget
class CV_EXPORTS SphereWidget : public Widget3D
{
public:
SphereWidget(const cv::Point3f &center, float radius, int sphere_resolution = 10, const Color &color = Color::white());
};
class CV_EXPORTS ArrowWidget : public Widget
class CV_EXPORTS ArrowWidget : public Widget3D
{
public:
ArrowWidget(const Point3f& pt1, const Point3f& pt2, const Color &color = Color::white());
};
class CV_EXPORTS CircleWidget : public Widget
class CV_EXPORTS CircleWidget : public Widget3D
{
public:
CircleWidget(const Point3f& pt, double radius, double thickness = 0.01, const Color &color = Color::white());
};
class CV_EXPORTS CylinderWidget : public Widget
class CV_EXPORTS CylinderWidget : public Widget3D
{
public:
CylinderWidget(const Point3f& pt_on_axis, const Point3f& axis_direction, double radius, int numsides = 30, const Color &color = Color::white());
};
class CV_EXPORTS CubeWidget : public Widget
class CV_EXPORTS CubeWidget : public Widget3D
{
public:
CubeWidget(const Point3f& pt_min, const Point3f& pt_max, bool wire_frame = true, const Color &color = Color::white());
};
class CV_EXPORTS CoordinateSystemWidget : public Widget
class CV_EXPORTS CoordinateSystemWidget : public Widget3D
{
public:
CoordinateSystemWidget(double scale, const Affine3f& affine);
};
class CV_EXPORTS TextWidget : public Widget
class CV_EXPORTS TextWidget : public Widget2D
{
public:
TextWidget(const String &text, const Point2i &pos, int font_size = 10, const Color &color = Color::white());
// TODO Overload setColor method, and hide setPose, updatePose, getPose methods
};
class CV_EXPORTS CloudWidget : public Widget
class CV_EXPORTS CloudWidget : public Widget3D
{
public:
CloudWidget(InputArray _cloud, InputArray _colors);
@@ -107,7 +117,7 @@ namespace temp_viz
struct CreateCloudWidget;
};
class CV_EXPORTS CloudNormalsWidget : public Widget
class CV_EXPORTS CloudNormalsWidget : public Widget3D
{
public:
CloudNormalsWidget(InputArray _cloud, InputArray _normals, int level = 100, float scale = 0.02f, const Color &color = Color::white());