Program Listing for File figure.hpp
↰ Return to documentation for file (include/tuw_geometry/figure.hpp
)
#ifndef TUW_GEOMETRY__FIGURE_HPP
#define TUW_GEOMETRY__FIGURE_HPP
#include <opencv2/core/core_c.h>
#include <opencv2/core/core.hpp>
#include <tuw_geometry/pose2d.hpp>
#include <tuw_geometry/world_scoped_maps.hpp>
namespace tuw
{
class Figure;
using FigurePtr = std::shared_ptr<Figure>;
using FigureConstPtr = std::shared_ptr<Figure const>;
class Figure : public WorldScopedMaps
{
std::string title_;
std::string label_format_x_;
std::string label_format_y_;
cv::Mat view_;
cv::Mat background_;
cv::Mat background_image_;
std::string background_filename_;
double grid_scale_x_, grid_scale_y_;
public:
//special class member functions
Figure(const std::string & title);
virtual ~Figure() = default;
Figure(const Figure &) = default;
Figure & operator=(const Figure &) = default;
Figure(Figure &&) = default;
Figure & operator=(Figure &&) = default;
virtual void init(
int width_pixel, int height_pixel, double min_y, double max_y, double min_x, double max_x,
double rotation = 0, double grid_scale_x = -1, double grid_scale_y = -1,
const std::string & background_image = std::string());
virtual void init(
int width_pixel, int height_pixel, cv::Matx33d Mw2m, double grid_scale_y, double grid_scale_x,
const std::string & background_image);
const std::string title() const;
void setLabel(
const std::string & label_x = std::string("x=%f"),
const std::string & label_y = std::string("y=%f"));
const std::string & backgroundFileName() const;
const cv::Mat & view() const;
cv::Mat & view();
const cv::Mat & background() const;
cv::Mat & background();
const cv::Mat & background_image() const;
cv::Mat & background_image();
void setView(const cv::Mat & view);
void line(
const Point2D & p0, const Point2D & p1, const cv::Scalar & color, int thickness = 1,
int lineType = cv::LINE_AA);
using WorldScopedMaps::line;
void circle(
const Point2D & p, int radius, const cv::Scalar & color, int thickness = 1,
int lineType = cv::LINE_AA);
using WorldScopedMaps::circle;
void symbol(cv::Mat & view, const Point2D & p, const cv::Scalar & color);
void symbol(const Point2D & p, const cv::Scalar & color);
void symbol(
cv::Mat & view, const Pose2D & p, double radius, const cv::Scalar & color, int thickness = 1,
int lineType = cv::LINE_AA);
void symbol(
const Pose2D & p, double radius, const cv::Scalar & color, int thickness = 1,
int lineType = cv::LINE_AA);
void putText(
cv::Mat & view, const std::string & text, const Point2D & p,
int fontFace = cv::FONT_HERSHEY_PLAIN, double fontScale = 0.6,
cv::Scalar color = cv::Scalar(128, 0, 0), int thickness = 1, int lineType = cv::LINE_AA,
bool bottomLeftOrigin = false);
void putText(
const std::string & text, const Point2D & p, int fontFace = cv::FONT_HERSHEY_PLAIN,
double fontScale = 0.6, cv::Scalar color = cv::Scalar(128, 0, 0), int thickness = 1,
int lineType = cv::LINE_AA, bool bottomLeftOrigin = false);
void drawBackground();
void clear();
void appendToView(
const cv::Mat & _mat, const cv::Scalar & _colMin, const cv::Scalar & _colMax,
u_int8_t _truncateLayerVal = 0);
static const cv::Scalar green;
static const cv::Scalar green_bright;
static const cv::Scalar green_dark;
static const cv::Scalar red;
static const cv::Scalar blue;
static const cv::Scalar blue_bright;
static const cv::Scalar blue_dark;
static const cv::Scalar orange;
static const cv::Scalar yellow;
static const cv::Scalar cyan;
static const cv::Scalar magenta;
static const cv::Scalar gray_bright;
static const cv::Scalar gray;
static const cv::Scalar black;
static const cv::Scalar white;
static const cv::Scalar niceBlue;
static const cv::Scalar niceMustard;
static const cv::Scalar niceMagenta;
static const cv::Scalar niceGreenBlue;
static const cv::Scalar niceRed;
static const cv::Scalar niceRedDark;
static const cv::Scalar niceGreen;
static const cv::Scalar niceGrey;
static const cv::Scalar niceGreyLight;
static const cv::Scalar niceGreyPurple;
static const cv::Scalar niceGreenWashed;
static const cv::Scalar niceGreyDark;
static const cv::Scalar niceLime;
static const cv::Scalar niceDirtyPink;
};
} // namespace tuw
#endif // TUW_GEOMETRY__FIGRUE_HPP