itom  4.1.0
plotInfoShapes.h
1 /* ********************************************************************
2  itom software
3  URL: http://www.uni-stuttgart.de/ito
4  Copyright (C) 2020, Institut fuer Technische Optik (ITO),
5  University of 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 fuer 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 PLOTINFOSHAPES_H
29 #define PLOTINFOSHAPES_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 #include <QtWidgets/qtreewidget.h>
42 #include <QtGui/qpainterpath.h>
43 
44 class relation
45 {
46  enum tRelationType
47  {
48  tLength,
49  tRadius,
50  tDiameter,
51  tDistance,
52  tHeightDistance,
53  tInPlaneDistance
54  };
55  int firstIndex;
56  int secondIndex;
57  tRelationType type;
58 };
59 
60 class ITOMWIDGETS_EXPORT PlotInfoShapes : public QTreeWidget
61 {
62  Q_OBJECT
63 
64  public:
65  PlotInfoShapes(QWidget* parent = NULL);
66 
67  private:
68  void setItem2Point(QTreeWidgetItem* curItem, const ito::Shape &element);
69  void setItem2Line(QTreeWidgetItem* curItem, const ito::Shape &element);
70  void setItem2Circle(QTreeWidgetItem* curItem, const ito::Shape &element);
71  void setItem2Ellipse(QTreeWidgetItem* curItem, const ito::Shape &element);
72  void setItem2Square(QTreeWidgetItem* curItem, const ito::Shape &element);
73  void setItem2Rect(QTreeWidgetItem* curItem, const ito::Shape &element);
74  void setItem2Poly(QTreeWidgetItem* curItem, const ito::Shape &element);
75 
76  void adjustNumberOfChildItems(QTreeWidgetItem* curItem, int count);
77 
78  QHash< int, relation> m_relationHash;
79 
80 
81  bool m_onlyTwoDims;
82 
83  public slots:
84  void updateShape(const ito::Shape element);
85  void updateShapes(const QVector< ito::Shape > elements);
86 
87  void removeShape(int index);
88  void removeShapes();
89 
90  void addRelation(const int index1, const int index2, const int relationType);
91  void removeRelation(const int index1, const int index2);
92  void removeRelations(const int index1, const int index2);
93  void removeRelations(const int index);
94  void removeRelations();
95 
96  QPainterPath renderToPainterPath(const int xsize, const int ysize, const int fontSize);
97 
98  private slots:
99 };
100 
101 #ifdef __APPLE__
102 }
103 #endif
104 
105 #endif // SHAPELEGENDWIDGET_H
Definition: plotInfoShapes.h:44
Definition: plotInfoShapes.h:60
Definition: shape.h:52