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