Jafar
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Shape.hpp
00001 /* $Id:$ */
00002 #ifndef _QDISPLAY_SHAPE_HPP_
00003 #define _QDISPLAY_SHAPE_HPP_
00004 
00005 #include <QGraphicsItem>
00006 
00007 namespace jafar {
00008 namespace qdisplay {
00009 class Viewer;
00015 class Shape : public QGraphicsItemGroup {
00016   public:
00017     enum ShapeType {
00018       ShapeRectangle,
00019       ShapeCross,
00020       ShapeCrossX,
00021       ShapeEllipse,
00022       ShapeRectangleFilled,
00023       ShapeEllipseFilled,
00024       ShapeLine
00025     };
00035     Shape(ShapeType shapeType, double x, double y, double w, double h, double angle = 0);
00036     virtual ~Shape() { delete m_label; }
00037     virtual QRectF boundingRect () const { return m_boundingRect; } 
00038     virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *);
00045     inline void setColor(int r, int g, int b) { m_color.setRgb(r,g,b); }
00051     inline void setPos(double x, double y) { QGraphicsItem::setPos(x,y); }
00056     inline void setRotation(double a) { QGraphicsItem::setRotation(a); }
00061     inline void setScale(double s) { QGraphicsItem::setScale(s); }
00062     void setLabel(const char * text, double relX = 0, double relY = 0);
00063     void setFontSize(int s) { m_fontSize = s; }
00064     void setFontColor( int r, int g, int b) { m_fontColor.setRgb(r,g,b); if (m_label) m_label->setDefaultTextColor( m_fontColor ); }
00065     void setBoundingBox( double x, double y, double w, double h);
00066     bool hasItem(QGraphicsItem *item) const;
00067   private:
00068     ShapeType m_shapeType;
00069     QRectF m_boundingRect;
00070     QColor m_color;
00071     QColor m_fontColor;
00072     QGraphicsTextItem* m_label;
00073     int m_fontSize;
00074 };
00075 
00076 }
00077 
00078 }
00079 
00080 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on Wed Oct 15 2014 00:37:25 for Jafar by doxygen 1.7.6.1
LAAS-CNRS