Types.hh 4.7 KB
Newer Older
Jan Möbius's avatar
   
Jan Möbius committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//=============================================================================
//
//                               OpenFlipper
//        Copyright (C) 2008 by Computer Graphics Group, RWTH Aachen
//                           www.openflipper.org
//
//-----------------------------------------------------------------------------
//
//                                License
//
//  OpenFlipper is free software: you can redistribute it and/or modify
//  it under the terms of the GNU Lesser General Public License as published by
//  the Free Software Foundation, either version 3 of the License, or
//  (at your option) any later version.
//
//  OpenFlipper is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU Lesser General Public License for more details.
//
//  You should have received a copy of the GNU Lesser General Public License
//  along with OpenFlipper.  If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
//
//   $Revision$
//   $Author$
//   $Date$
//
//=============================================================================




//=============================================================================
//
//  Types
//
//=============================================================================

/**
 * \file Types.hh
 * This File contains the basic available datatypes in the Framework.
 */


#ifndef TYPES_HH
#define TYPES_HH

Jan Möbius's avatar
Jan Möbius committed
50
#include <OpenFlipper/common/GlobalDefines.hh>
51
#include <limits.h>
52
#include <QIcon>
Jan Möbius's avatar
   
Jan Möbius committed
53
54
55
56


//== Global Typedefs  =================================================================

57
/** \brief Predefined datatypes
Jan Möbius's avatar
   
Jan Möbius committed
58
 *
59
60
 * Here are several datatypes which have predefined ids. This might be changed to runtime added
 * datatypes in the futere.
Jan Möbius's avatar
   
Jan Möbius committed
61
 */
62
63

/// None of the other Objects
64
#define DATA_NONE 0
65
66

/// Items used for Grouping
67
#define DATA_GROUP 1
68
69

/// Point based objects
70
#define DATA_POINTS 2
71
72

/// Triangle Mesh objects
73
74
75
#define DATA_TRIANGLE_MESH typeId("TriangleMesh")
//#define DATA_TRIANGLE_MESH 4
#define DATA_TRIANGLE_MESH_CONST_ID 4
76
77

/// Poly Mesh Objects
78
79
80
81
82
83
#define DATA_POLY_MESH typeId("PolyMesh")
//#define DATA_POLY_MESH 8
#define DATA_POLY_MESH_CONST_ID 8

/// PolyLine objects
const unsigned int DATA_POLY_LINE     = 16;
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104

/// BSpline objects
const unsigned int DATA_BSPLINE_CURVE = 32;

/// Volumetric objects
const unsigned int DATA_VOLUME        = 64;

/// BSpline Surface objects
const unsigned int DATA_BSPLINE_SURFACE = 128;

/// Skeletons
const unsigned int DATA_SKELETON       = 256;

/// Gis Data
const unsigned int DATA_GIS            = 512;


/// Identifier for all available objects
const unsigned int DATA_ALL           = UINT_MAX;

typedef unsigned int DataType;
Jan Möbius's avatar
Jan Möbius committed
105
106

// TODO: Make types runtime addable
Jan Möbius's avatar
   
Jan Möbius committed
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130

//== INCLUDES =================================================================

#include "BaseObject.hh"
#include "GroupObject.hh"
#include "BaseObjectData.hh"

//== TYPEDEFS =================================================================

/// Standard Type for 3d Vector used for scripting
typedef ACG::Vec3d Vector;
/// Standard Type for id Lists used for scripting
typedef std::vector< int > idList;
/// Standard Type for a 4x4 Matrix used for scripting
typedef ACG::Matrix4x4d Matrix4x4;

Q_DECLARE_METATYPE(idList);
Q_DECLARE_METATYPE(QVector< int >);
Q_DECLARE_METATYPE(Vector);
Q_DECLARE_METATYPE(Matrix4x4);

/// Vector Type containing the Data Objects
typedef std::vector<BaseObjectData*> DataContainer;

131
132
133
//== Functions for adding dataTypes =========================================================

/// Adds a datatype and returns the id for the new type
134
DLLEXPORT
135
136
137
DataType addDataType(QString _name);

/// Given a dataType Identifier string this function will return the id of the datatype
138
DLLEXPORT
139
DataType typeId(QString _name);
Jan Möbius's avatar
   
Jan Möbius committed
140

141
/// Get the name of a type with given id
142
DLLEXPORT
143
144
QString typeName(DataType _id);

145
146
147
148
149
150
//================================================================================================
/** @name Datatype Icons
* @{ */
//================================================================================================

/// Get an icon for a given DataType
151
DLLEXPORT
152
QString typeIcon(QString  _name);
153

154
/// Get an icon for a given DataType
155
DLLEXPORT
156
157
158
QString typeIcon(DataType _id);

/// Set an Icon for a given DataType
159
DLLEXPORT
160
void setTypeIcon( DataType _id   , QString _icon);
161

162
/// Set an Icon for a given DataType
163
DLLEXPORT
164
165
166
167
168
void setTypeIcon( QString  _name , QString _icon );

/** @} */


Jan Möbius's avatar
   
Jan Möbius committed
169
170
171
//=============================================================================
#endif // TYPES_HH defined
//=============================================================================