itom  3.0.0
plotInfoShapes.h
1 /* ********************************************************************
2  itom software
3  URL: http://www.uni-stuttgart.de/ito
4  Copyright (C) 2013, Institut für Technische Optik (ITO),
5  Universität Stuttgart, Germany
6 
7  This file is part of itom and its software development toolkit (SDK).
8 
9  itom is free software; you can redistribute it and/or modify it
10  under the terms of the GNU Library General Public Licence as published by
11  the Free Software Foundation; either version 2 of the Licence, or (at
12  your option) any later version.
13 
14  In addition, as a special exception, the Institut für Technische
15  Optik (ITO) gives you certain additional rights.
16  These rights are described in the ITO LGPL Exception version 1.0,
17  which can be found in the file LGPL_EXCEPTION.txt in this package.
18 
19  itom is distributed in the hope that it will be useful, but
20  WITHOUT ANY WARRANTY; without even the implied warranty of
21  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
22  General Public Licence for more details.
23 
24  You should have received a copy of the GNU Library General Public License
25  along with itom. If not, see <http://www.gnu.org/licenses/>.
26 *********************************************************************** */
27 
28 #ifndef SHAPELEGENDWIDGET_H
29 #define SHAPELEGENDWIDGET_H
30 
31 #ifdef __APPLE__
32 extern "C++" {
33 #endif
34 
35 #include "../common/commonGlobal.h"
36 #include "../common/typeDefs.h"
37 #include "../common/shape.h"
38 
39 #include "commonWidgets.h"
40 
41 #if QT_VERSION < 0x050000
42 #include <qtreewidget.h>
43 #include <qhash.h>
44 #include <qpainterpath.h>
45 #else
46 #include <QtWidgets/qtreewidget.h>
47 #include <QtGui/qpainterpath.h>
48 //
49 #endif
50 
51 class relation
52 {
53  enum tRelationType
54  {
55  tLength,
56  tRadius,
57  tDiameter,
58  tDistance,
59  tHeightDistance,
60  tInPlaneDistance
61  };
62  int firstIndex;
63  int secondIndex;
64  tRelationType type;
65 };
66 
67 class ITOMWIDGETS_EXPORT PlotInfoShapes : public QTreeWidget
68 {
69  Q_OBJECT
70 
71  public:
72  PlotInfoShapes(QWidget* parent = NULL);
73 
74  private:
75  void setItem2Point(QTreeWidgetItem* curItem, const ito::Shape &element);
76  void setItem2Line(QTreeWidgetItem* curItem, const ito::Shape &element);
77  void setItem2Circle(QTreeWidgetItem* curItem, const ito::Shape &element);
78  void setItem2Ellipse(QTreeWidgetItem* curItem, const ito::Shape &element);
79  void setItem2Square(QTreeWidgetItem* curItem, const ito::Shape &element);
80  void setItem2Rect(QTreeWidgetItem* curItem, const ito::Shape &element);
81  void setItem2Poly(QTreeWidgetItem* curItem, const ito::Shape &element);
82 
83  QHash< int, relation> m_relationHash;
84 
85 
86  bool m_onlyTwoDims;
87 
88  public slots:
89  void updateShape(const ito::Shape element);
90  void updateShapes(const QVector< ito::Shape > elements);
91 
92  void removeShape(int index);
93  void removeShapes();
94 
95  void addRelation(const int index1, const int index2, const int relationType);
96  void removeRelation(const int index1, const int index2);
97  void removeRelations(const int index1, const int index2);
98  void removeRelations(const int index);
99  void removeRelations();
100 
101  QPainterPath renderToPainterPath(const int xsize, const int ysize, const int fontSize);
102 
103  private slots:
104 };
105 
106 #ifdef __APPLE__
107 }
108 #endif
109 
110 #endif // SHAPELEGENDWIDGET_H
Definition: plotInfoShapes.h:51
Definition: plotInfoShapes.h:67
Definition: shape.h:53