/* * © Copyright 2014 – Urheberrechtshinweis * Alle Rechte vorbehalten / All Rights Reserved * * Programmcode ist urheberrechtlich geschuetzt. * Das Urheberrecht liegt, soweit nicht ausdruecklich anders gekennzeichnet, bei Frank Ebner. * Keine Verwendung ohne explizite Genehmigung. * (vgl. § 106 ff UrhG / § 97 UrhG) */ #ifndef PAINTER_H #define PAINTER_H #include #include #include //#include "Scaler.h" class Scaler; class QPainter; class QPixmap; class QImage; class QPen; class QColor; class QBrush; #include 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& points); void drawPolygon(const std::vector& 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 void setPenBrush(const Pen& pen, const Brush& brush) { setPen(pen); setBrush(brush); } const Scaler& getScaler(); private: }; #endif // PAINTER_H