100 lines
2.2 KiB
C++
100 lines
2.2 KiB
C++
#ifndef PAINTER_H
|
|
#define PAINTER_H
|
|
|
|
#include <Indoor/geo/Point2.h>
|
|
#include <Indoor/geo/Point3.h>
|
|
#include <Indoor/geo/BBox2.h>
|
|
|
|
//#include "Scaler.h"
|
|
|
|
class Scaler;
|
|
class QPainter;
|
|
class QPixmap;
|
|
class QImage;
|
|
class QPen;
|
|
class QColor;
|
|
class QBrush;
|
|
|
|
#include <qnamespace.h>
|
|
|
|
class Painter {
|
|
|
|
public:
|
|
|
|
Scaler& s;
|
|
QPainter* p;
|
|
int w;
|
|
int h;
|
|
|
|
public:
|
|
|
|
/** ctor */
|
|
Painter(Scaler& s, QPainter* p, int w, int h);
|
|
|
|
int width();
|
|
|
|
int height();
|
|
|
|
/** is the given point visible on screen? */
|
|
bool isVisible(const Point2 p);
|
|
|
|
/** is the given volume visible on screen? */
|
|
bool isVisible(const BBox2 bb);
|
|
|
|
void drawLine(const Point2 p1, const Point2 p2);
|
|
void drawLine(const Point3 p1, const Point3 p2);
|
|
void drawLine(const float x1, const float y1, const float x2, const float y2);
|
|
|
|
float radToDeg(const float rad) const;
|
|
|
|
void drawArc(const Point2 center, const float radius, const float startAngleRad, const float spanAngleRad);
|
|
|
|
/** draw a dot at the given map coordinates */
|
|
void drawDot(const Point2 center);
|
|
|
|
void drawCircle(const Point3 center);
|
|
void drawCircle(const Point2 center);
|
|
void drawCircle(const Point2 center, const float size_m);
|
|
void drawCircle_px(const Point2 center, const float size_px);
|
|
|
|
void drawRect(const Point2 p1, const Point2 p2);
|
|
void drawRect(const float x1, const float y1, const float x2, const float y2);
|
|
void drawRect(const Point2 center);
|
|
|
|
void drawNode(Point2 pt, bool focused, bool selected);
|
|
|
|
void drawText(const Point2 pos, const std::string& text);
|
|
|
|
void drawPolygon(const std::vector<Point2>& points);
|
|
void drawPolygon(const std::vector<Point3>& points);
|
|
|
|
void drawPixmap(const Point2 pt, const QPixmap& img);
|
|
|
|
void drawImage(const Point2 pt, const QImage& img);
|
|
|
|
void drawLength(Point2 p1, Point2 p2, const float len, const float offset = 0);
|
|
|
|
void setBrush(const QBrush& brush);
|
|
void setBrush(const Qt::BrushStyle& brush);
|
|
|
|
void setPen(const QPen& pen);
|
|
void setPen(const QColor& pen);
|
|
void setPen(const Qt::PenStyle& pen);
|
|
|
|
const QPen& getPen();
|
|
|
|
template <typename Pen, typename Brush> void setPenBrush(const Pen& pen, const Brush& brush) {
|
|
setPen(pen);
|
|
setBrush(brush);
|
|
}
|
|
|
|
const Scaler& getScaler();
|
|
|
|
private:
|
|
|
|
|
|
|
|
};
|
|
|
|
#endif // PAINTER_H
|