00001 #ifndef ARROWRENDERER_H_ 00002 #define ARROWRENDERER_H_ 00003 00004 #include <QColor> 00005 #include <QBrush> 00006 #include <QPainter> 00007 #include "ARender.h" 00008 00013 class ArrowRenderer : public ARender { 00014 public: 00015 ArrowRenderer(const Data& aData) : ARender(aData), 00016 mArrowDistance(0.4), 00017 mArrowSize(0.4), 00018 mScaleMax(0), 00019 mScaleMin(0), 00020 mScaleArrowIndex(0), 00021 mScaleArrows(false), 00022 mArrowBrush(Qt::black) {} 00023 00024 virtual void render(QPixmap* pixmap); 00025 00031 void setArrowDistance(float dist) { mArrowDistance = dist; } 00036 void setArrowSize(float size) { mArrowSize = size; } 00037 00042 void setScaleArrowIndex(int newIndex){ 00043 mScaleArrowIndex = newIndex; 00044 std::pair<float, float> range = mData.getDataRange(newIndex); 00045 mScaleMin = range.first; 00046 mScaleMax = range.second; 00047 } 00048 00049 void setScaleArrows(bool scaleArrows){mScaleArrows = scaleArrows;} 00050 00057 void setScaleMax(float max){mScaleMax = max;} 00064 void setScaleMin(float min){mScaleMin = min;} 00065 00070 void setArrowBrush(QBrush brush) { mArrowBrush = brush; } 00071 00075 static void drawArrow(QPainter& painter, const QBrush& brush, float arrowSize); 00076 private: 00077 void drawArrow(QPainter& painter, float x, float y) const; 00078 00079 float mArrowDistance; 00080 float mArrowSize; 00081 00082 float mScaleMax; 00083 float mScaleMin; 00084 00085 int mScaleArrowIndex; 00086 bool mScaleArrows; 00087 00088 QBrush mArrowBrush; 00089 }; 00090 00091 #endif