itom 2.2.1
K:/git-itom/sources/itom/itomWidgets/plotInfoShapes.h
00001 /* ********************************************************************
00002     itom software
00003     URL: http://www.uni-stuttgart.de/ito
00004     Copyright (C) 2013, Institut für Technische Optik (ITO),
00005     Universität Stuttgart, Germany
00006 
00007     This file is part of itom and its software development toolkit (SDK).
00008 
00009     itom is free software; you can redistribute it and/or modify it
00010     under the terms of the GNU Library General Public Licence as published by
00011     the Free Software Foundation; either version 2 of the Licence, or (at
00012     your option) any later version.
00013    
00014     In addition, as a special exception, the Institut für Technische
00015     Optik (ITO) gives you certain additional rights.
00016     These rights are described in the ITO LGPL Exception version 1.0,
00017     which can be found in the file LGPL_EXCEPTION.txt in this package.
00018 
00019     itom is distributed in the hope that it will be useful, but
00020     WITHOUT ANY WARRANTY; without even the implied warranty of
00021     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library
00022     General Public Licence for more details.
00023 
00024     You should have received a copy of the GNU Library General Public License
00025     along with itom. If not, see <http://www.gnu.org/licenses/>.
00026 *********************************************************************** */
00027 
00028 #ifndef SHAPELEGENDWIDGET_H
00029 #define SHAPELEGENDWIDGET_H
00030 
00031 #ifdef __APPLE__
00032 extern "C++" {
00033 #endif
00034 
00035 #include "../common/commonGlobal.h"
00036 #include "../common/typeDefs.h"
00037 #include "../common/shape.h"
00038 
00039 #include "commonWidgets.h"
00040 
00041 #if QT_VERSION < 0x050000
00042 #include <qtreewidget.h>
00043 #include <qhash.h>
00044 #include <qpainterpath.h>
00045 #else
00046 #include <QtWidgets/qtreewidget.h>
00047 #include <QtGui/qpainterpath.h>
00048 //
00049 #endif
00050 
00051 class relation
00052 {
00053     enum tRelationType
00054     {
00055         tLength,
00056         tRadius,
00057         tDiameter,
00058         tDistance,
00059         tHeightDistance,
00060         tInPlaneDistance
00061     };
00062     int firstIndex;
00063     int secondIndex;
00064     tRelationType type;
00065 };
00066 
00067 class ITOMWIDGETS_EXPORT PlotInfoShapes : public QTreeWidget
00068 {
00069     Q_OBJECT
00070         
00071     public:        
00072                 PlotInfoShapes(QWidget* parent = NULL);
00073 
00074     private:
00075                 void setItem2Point(QTreeWidgetItem* curItem, const ito::Shape &element);
00076                 void setItem2Line(QTreeWidgetItem* curItem, const ito::Shape &element);
00077                 void setItem2Circle(QTreeWidgetItem* curItem, const ito::Shape &element);
00078                 void setItem2Ellipse(QTreeWidgetItem* curItem, const ito::Shape &element);
00079                 void setItem2Square(QTreeWidgetItem* curItem, const ito::Shape &element);
00080                 void setItem2Rect(QTreeWidgetItem* curItem, const ito::Shape &element);
00081                 void setItem2Poly(QTreeWidgetItem* curItem, const ito::Shape &element);
00082 
00083         QHash< int, relation> m_relationHash;
00084 
00085 
00086         bool m_onlyTwoDims;
00087 
00088     public slots:
00089         void updateShape(const ito::Shape element);
00090         void updateShapes(const QVector< ito::Shape > elements);
00091 
00092         void removeShape(int index);
00093         void removeShapes();
00094 
00095                 void addRelation(const int index1, const int index2, const int relationType);
00096                 void removeRelation(const int index1, const int index2);
00097                 void removeRelations(const int index1, const int index2);
00098                 void removeRelations(const int index);
00099                 void removeRelations();
00100 
00101                 QPainterPath renderToPainterPath(const int xsize, const int ysize, const int fontSize);
00102 
00103     private slots:
00104 };
00105 
00106 #ifdef __APPLE__
00107 }
00108 #endif
00109 
00110 #endif // SHAPELEGENDWIDGET_H
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Properties Friends