itom 1.4.0
|
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 SHAREDSTRUCTURESPRIMITIVES_H 00029 #define SHAREDSTRUCTURESPRIMITIVES_H 00030 00031 #include "typeDefs.h" 00032 #include "../DataObject/dataobj.h" 00033 00034 #if !defined(Q_MOC_RUN) || defined(ITOMCOMMONQT_MOC) //only moc this file in itomCommonQtLib but not in other libraries or executables linking against this itomCommonQtLib 00035 00036 #define PRIM_ELEMENTLENGTH 11 00060 struct ITOMCOMMONQT_EXPORT geometricPrimitives 00061 { 00062 00063 /* 00064 struct point 00065 { 00066 ito::float32 idx; 00067 ito::float32 flags; 00068 ito::float32 x0; 00069 ito::float32 y0; 00070 ito::float32 z0; 00071 }; 00072 00073 struct line 00074 { 00075 ito::float32 idx; 00076 ito::float32 flags; 00077 ito::float32 x0; 00078 ito::float32 y0; 00079 ito::float32 z0; 00080 ito::float32 x1; 00081 ito::float32 y1; 00082 ito::float32 z1; 00083 }; 00084 00085 struct elipse 00086 { 00087 ito::float32 idx; 00088 ito::float32 flags; 00089 ito::float32 centerX; 00090 ito::float32 centerY; 00091 ito::float32 centerZ; 00092 ito::float32 r1; 00093 ito::float32 r2; 00094 ito::float32 alpha; 00095 }; 00096 00097 struct circle 00098 { 00099 ito::float32 idx; 00100 ito::float32 flags; 00101 ito::float32 centerX; 00102 ito::float32 centerY; 00103 ito::float32 centerZ; 00104 ito::float32 r1; 00105 }; 00106 00107 struct retangle 00108 { 00109 ito::float32 idx; 00110 ito::float32 flags; 00111 ito::float32 x0; 00112 ito::float32 y0; 00113 ito::float32 z0; 00114 ito::float32 x1; 00115 ito::float32 y1; 00116 ito::float32 z1; 00117 ito::float32 alpha; 00118 }; 00119 00120 struct square 00121 { 00122 ito::float32 idx; 00123 ito::float32 flags; 00124 ito::float32 centerX; 00125 ito::float32 centerY; 00126 ito::float32 centerZ; 00127 ito::float32 a; 00128 ito::float32 alpha; 00129 }; 00130 00131 struct polygoneElement 00132 { 00133 ito::float32 idx; 00134 ito::float32 flags; 00135 ito::float32 x0; 00136 ito::float32 y0; 00137 ito::float32 z0; 00138 ito::float32 directionX; 00139 ito::float32 directionY; 00140 ito::float32 directionZ; 00141 ito::float32 pointIdx; 00142 ito::float32 pointNumber; 00143 }; 00144 */ 00145 ito::float32 cells[PRIM_ELEMENTLENGTH]; 00146 }; 00147 00148 00149 00150 namespace ito 00151 { 00152 00159 class ITOMCOMMONQT_EXPORT PrimitiveContainer 00160 { 00161 public: 00162 00167 enum tPrimitive 00168 { 00169 tNoType = 0, 00170 tMultiPointPick = 6, 00171 tPoint = 101, 00172 tLine = 102, 00173 tRectangle = 103, 00174 tSquare = 104, 00175 tEllipse = 105, 00176 tCircle = 106, 00177 tPolygon = 110, 00178 tMoveLock = 0x00010000, 00179 tRotateLock = 0x00020000, 00180 tResizeLock = 0x00040000, 00181 tTypeMask = 0x0000FFFF, 00182 tFlagMask = 0xFFFF0000 00183 }; 00184 00186 PrimitiveContainer(DataObject primitives = DataObject()); 00187 ~PrimitiveContainer(); 00188 00189 00190 00191 inline int getNumberOfRows() const {return m_primitives.getSize(0);}; 00192 inline int getNumberOfElements(const int type) const; 00193 inline int getFirstElementRow(const int type) const; 00194 inline ito::float32* getElementPtr(const int row); 00195 inline const ito::float32* getElementPtr(const int row) const; 00196 inline int getIndexFromRow(const int row) const; 00197 inline int getRowFromIndex(const int idx) const; 00198 00199 inline bool isElement(const int row) const; 00200 void clear(void); 00201 00202 ito::RetVal addElement(const int type, ito::float32 * cells); 00203 ito::RetVal changeElement(const int type, ito::float32 * cells); 00204 ito::RetVal removeElement(const int row); 00205 00206 ito::RetVal copyGeometricElements(const ito::DataObject &rhs); 00207 00208 private: 00209 00210 ito::DataObject m_primitives; 00211 cv::Mat * m_internalMat; 00214 }; 00215 00216 00217 } 00218 00219 #endif //#if !defined(Q_MOC_RUN) || defined(ITOMCOMMONQT_MOC) 00220 00221 #endif //SHAREDSTRUCTURESPRIMITIVES_H