Types.hh 4.46 KB
Newer Older
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>
53 54 55 56


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

57
/** \brief Predefined datatypes
58
 *
59 60
 * Here are several datatypes which have predefined ids. This might be changed to runtime added
 * datatypes in the futere.
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

/// Triangle Mesh objects
70
#define DATA_TRIANGLE_MESH typeId("TriangleMesh")
71
#define DATA_TRIANGLE_MESH_CONST_ID 2
72 73

/// Poly Mesh Objects
74
#define DATA_POLY_MESH typeId("PolyMesh")
75
#define DATA_POLY_MESH_CONST_ID 4
76

77
/// BSpline objects
78
const unsigned int DATA_BSPLINE_CURVE = 8;
79 80

/// BSpline Surface objects
81
const unsigned int DATA_BSPLINE_SURFACE = 16;
82 83

/// Skeletons
84
const unsigned int DATA_SKELETON       = 32;
85 86

/// Gis Data
87
const unsigned int DATA_GIS            = 64;
88 89 90 91 92

/// 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
93 94

// TODO: Make types runtime addable
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118

//== 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;

119 120 121
//== Functions for adding dataTypes =========================================================

/// Adds a datatype and returns the id for the new type
122
DLLEXPORT
123 124 125
DataType addDataType(QString _name);

/// Given a dataType Identifier string this function will return the id of the datatype
126
DLLEXPORT
127
DataType typeId(QString _name);
128

129
/// Get the name of a type with given id
130
DLLEXPORT
131 132
QString typeName(DataType _id);

133 134 135 136 137 138
//================================================================================================
/** @name Datatype Icons
* @{ */
//================================================================================================

/// Get an icon for a given DataType
139
DLLEXPORT
140
QString typeIcon(QString  _name);
141

142
/// Get an icon for a given DataType
143
DLLEXPORT
144 145 146
QString typeIcon(DataType _id);

/// Set an Icon for a given DataType
147
DLLEXPORT
148
void setTypeIcon( DataType _id   , QString _icon);
149

150
/// Set an Icon for a given DataType
151
DLLEXPORT
152 153 154 155 156
void setTypeIcon( QString  _name , QString _icon );

/** @} */


157 158 159
//=============================================================================
#endif // TYPES_HH defined
//=============================================================================