00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef QGSCOMPOSERSHAPE_H
00019 #define QGSCOMPOSERSHAPE_H
00020
00021 #include "qgscomposeritem.h"
00022
00024 class CORE_EXPORT QgsComposerShape: public QgsComposerItem
00025 {
00026 Q_OBJECT
00027 public:
00028
00029 enum Shape
00030 {
00031 Ellipse,
00032 Rectangle,
00033 Triangle
00034 };
00035
00036 QgsComposerShape( QgsComposition* composition );
00037 QgsComposerShape( qreal x, qreal y, qreal width, qreal height, QgsComposition* composition );
00038 ~QgsComposerShape();
00039
00041 void paint( QPainter* painter, const QStyleOptionGraphicsItem* itemStyle, QWidget* pWidget );
00042
00047 bool writeXML( QDomElement& elem, QDomDocument & doc ) const;
00048
00053 bool readXML( const QDomElement& itemElem, const QDomDocument& doc );
00054
00055
00056 void setLineWidth( double width );
00057 double lineWidth() const;
00058 void setOutlineColor( const QColor& color );
00059 QColor outlineColor() const;
00060 void setFillColor( const QColor& color );
00061 QColor fillColor() const;
00062 QgsComposerShape::Shape shapeType() const {return mShape;}
00063 void setShapeType( QgsComposerShape::Shape s ) {mShape = s;}
00064 bool transparentFill() const;
00065 void setTransparentFill( bool transparent );
00066
00069 void setSceneRect( const QRectF& rectangle );
00070
00071 public slots:
00073 virtual void setRotation( double r );
00074
00075
00076 private:
00078 Shape mShape;
00080 QPen mPen;
00082 QBrush mBrush;
00083 double mShapeWidth;
00084 double mShapeHeight;
00085
00087 void initGraphicsSettings();
00088
00090 QPointF pointOnLineWithDistance( const QPointF& startPoint, const QPointF& directionPoint, double distance ) const;
00091 };
00092
00093 #endif // QGSCOMPOSERSHAPEITEM_H