libkpl  5.0
A Library for Graphical Presentation of Data Sets and Functions
arcitem.h
1 /***************************************************************************
2  arcitem.h - description
3  -------------------
4  begin : Sam Aug 17 2002
5  copyright : (C) 2017 by Werner Stille
6  email : kpl@werner-stille.de
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef ARCITEM_H
19 #define ARCITEM_H
20 
21 #include <QGraphicsPathItem>
22 #include "decoitem.h"
23 
28 class Q_DECL_EXPORT ArcItem : public DecoItem, public QGraphicsPathItem
29 {
30 public:
32  enum {Type = UserType + Arc
34  };
50  ArcItem(double x0 = 0, double y0 = 0, unsigned color = 0,
51  QGraphicsItem* parent = 0, double width = 3, double height = 3,
52  bool visible = true, double start = 0, double span = 90,
53  Symbol symbol = SolidLine, double relSize = 1, double dir = 0);
58  ArcItem(const ArcItem& a);
65  ArcItem(const KConfigGroup* plo, unsigned color = 0,
66  QGraphicsItem* parent = 0);
68  virtual ~ArcItem();
70  inline double dir() const { return m_dir; };
72  inline double height() const { return m_height; };
74  QPixmap pixmap() const;
76  void setDashOffset();
81  inline void setDir(double dir) { m_dir = dir; };
86  inline void setHeight(double height) { m_height = height; };
91  inline void setSymbol(Symbol symbol) { m_symbol = symbol; };
93  void setPenWidth();
98  void setProperties(const QTransform& m);
103  inline void setSpan(double span) { m_span = span; };
108  inline void setStart(double start) { m_start = start; };
113  inline void setWidth(double width) { m_width = width; };
115  inline double span() const { return m_span; };
117  inline double start() const { return m_start; };
119  inline Symbol symbol() const { return m_symbol; };
121  virtual int type() const { return Type; };
123  void update();
125  inline double width() const { return m_width; };
130  void writePlo(KConfigGroup* plo) const;
131 
132 protected:
134  virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent* event);
136  void setProperties();
137  double m_width, m_height, m_dir, m_start, m_span, myDashOffset;
138  Symbol m_symbol;
139 };
140 
141 #endif
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
void setWidth(double width)
Sets width.
Definition: arcitem.h:113
Symbol
Symbol types.
Definition: kplitem.h:83
virtual int type() const
Returns specific QGraphicsItem type number.
Definition: arcitem.h:121
void setDir(double dir)
Sets rotation angle.
Definition: arcitem.h:81
void writePlo(KConfigGroup *plo, bool visible) const
Writes into plot file.
void setStart(double start)
Sets start angle.
Definition: arcitem.h:108
void setSymbol(Symbol symbol)
Sets line type.
Definition: arcitem.h:91
void update(const QRectF &rect)
double dir() const
Returns rotation angle in deg.
Definition: arcitem.h:70
double span() const
Returns arc length in deg.
Definition: arcitem.h:115
Symbol symbol() const
Returns line type.
Definition: arcitem.h:119
void setHeight(double height)
Sets height.
Definition: arcitem.h:86
double start() const
Returns start angle in deg.
Definition: arcitem.h:117
double width() const
Returns width in cm.
Definition: arcitem.h:125
static QPixmap pixmap(Symbol symbol)
Returns black decoration pixmap of plot symbol for use in dialog GUI.
double height() const
Returns height in cm.
Definition: arcitem.h:72
Decoration item class.
Definition: decoitem.h:35
Arc item class.
Definition: arcitem.h:28
void setSpan(double span)
Sets arc length.
Definition: arcitem.h:103