Commit 7951a55a authored by Jan Möbius's avatar Jan Möbius
Browse files

Preliminary work to make custom types runtime addable

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@3975 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 69a4a614
...@@ -127,7 +127,11 @@ void BaseObject::cleanup() { ...@@ -127,7 +127,11 @@ void BaseObject::cleanup() {
// =============================================================================== // ===============================================================================
bool BaseObject::dataType(DataType _type) { bool BaseObject::dataType(DataType _type) {
return (objectType_ & _type); if ( _type == DATA_ALL ) {
return true;
}
return ( objectType_ & _type);
} }
DataType BaseObject::dataType() { DataType BaseObject::dataType() {
......
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
#define TYPES_HH #define TYPES_HH
#include "GlobalDefines.hh" #include "GlobalDefines.hh"
#include <limits.h>
//== Global Typedefs ================================================================= //== Global Typedefs =================================================================
...@@ -57,33 +58,45 @@ ...@@ -57,33 +58,45 @@
* This is an enumerator defining the supported data types. To decide which object * This is an enumerator defining the supported data types. To decide which object
* type an object has, get the dataType from it. * type an object has, get the dataType from it.
*/ */
enum DataType {
/// None of the other Objects /// None of the other Objects
DATA_NONE = 0 , const unsigned int DATA_NONE = 0;
/// Items used for Grouping
DATA_GROUP = 1 , /// Items used for Grouping
/// Point based objects const unsigned int DATA_GROUP = 1;
DATA_POINTS = 1 << 1,
/// PolyLine objects /// Point based objects
DATA_POLY_LINE = 1 << 2, const unsigned int DATA_POINTS = 2;
/// Triangle Mesh objects
DATA_TRIANGLE_MESH = 1 << 3, /// PolyLine objects
/// Poly Mesh Objects const unsigned int DATA_POLY_LINE = 4;
DATA_POLY_MESH = 1 << 4,
/// Volumetric objects /// Triangle Mesh objects
DATA_VOLUME = 1 << 5, const unsigned int DATA_TRIANGLE_MESH = 8;
/// BSpline objects
DATA_BSPLINE_CURVE = 1 << 6, /// Poly Mesh Objects
/// BSpline Surface objects const unsigned int DATA_POLY_MESH = 16;
DATA_BSPLINE_SURFACE = 1 << 7,
/// Skeletons /// BSpline objects
DATA_SKELETON = 1 << 8, const unsigned int DATA_BSPLINE_CURVE = 32;
/// Gis Data
DATA_GIS = 1 << 9 /// Volumetric objects
}; const unsigned int DATA_VOLUME = 64;
/// Datatype matching all available types /// BSpline Surface objects
const DataType DATA_ALL = DataType( DATA_POINTS | DATA_TRIANGLE_MESH | DATA_POLY_MESH | DATA_VOLUME | DATA_POLY_LINE | DATA_BSPLINE_CURVE | DATA_BSPLINE_SURFACE | DATA_SKELETON | DATA_GIS ); 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;
// TODO: Make types runtime addable // TODO: Make types runtime addable
...@@ -121,7 +134,13 @@ typedef MeshObject< TriMesh , DATA_TRIANGLE_MESH > TriMeshObject; ...@@ -121,7 +134,13 @@ typedef MeshObject< TriMesh , DATA_TRIANGLE_MESH > TriMeshObject;
/// Typedef for a Meshobject containing a poly mesh /// Typedef for a Meshobject containing a poly mesh
typedef MeshObject< PolyMesh , DATA_POLY_MESH > PolyMeshObject; typedef MeshObject< PolyMesh , DATA_POLY_MESH > PolyMeshObject;
//== CLASS DEFINITION ========================================================= //== Functions for adding dataTypes =========================================================
/// Adds a datatype and returns the id for the new type
DataType addDataType(QString _name);
/// Given a dataType Identifier string this function will return the id of the datatype
DataType typeId(QString _name);
//============================================================================= //=============================================================================
#endif // TYPES_HH defined #endif // TYPES_HH defined
......
...@@ -107,7 +107,8 @@ void CoreWidget::updatePopupMenu(const QPoint& _point) { ...@@ -107,7 +107,8 @@ void CoreWidget::updatePopupMenu(const QPoint& _point) {
typeEntry->setText("BSpline Curve"); typeEntry->setText("BSpline Curve");
icon.addFile(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"BSplineCurveType.png"); icon.addFile(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"BSplineCurveType.png");
typeEntry->setIcon(icon); typeEntry->setIcon(icon);
} } else
std::cerr << "Datatype unknown... returned type was : " << object->dataType() << std::endl;
// Add real context Menus first // Add real context Menus first
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment