Commit d0edd9ee authored by Jan Möbius's avatar Jan Möbius

Switch to dynamic object type ids for poly and trimesh

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@6280 383ad7c9-94d9-4d36-a494-682f7c89f535
parent f5399d51
......@@ -99,29 +99,35 @@ void initialize() {
stringToTypeInfo["Unknown"] = types.size();
typeToTypeInfo[DATA_NONE] = types.size();
types.push_back( TypeInfo(DATA_NONE ,"Unknown" ,"Unknown.png") );
stringToTypeInfo["Group"] = types.size();
typeToTypeInfo[DATA_GROUP] = types.size();
types.push_back( TypeInfo(DATA_GROUP ,"Group" ,"Unknown.png") );
stringToTypeInfo["Points"] = types.size();
typeToTypeInfo[DATA_POINTS] = types.size();
types.push_back( TypeInfo(DATA_POINTS ,"Points" ,"Unknown.png") );
stringToTypeInfo["TriangleMesh"] = types.size();
typeToTypeInfo[DATA_TRIANGLE_MESH_CONST_ID] = types.size();
types.push_back( TypeInfo(DATA_TRIANGLE_MESH_CONST_ID ,"TriangleMesh" ,"TriangleType.png") );
stringToTypeInfo["PolyMesh"] = types.size();
typeToTypeInfo[DATA_POLY_MESH_CONST_ID] = types.size();
types.push_back( TypeInfo(DATA_POLY_MESH_CONST_ID ,"PolyMesh" ,"PolyType.png") );
stringToTypeInfo["PolyLine"] = types.size();
typeToTypeInfo[DATA_POLY_LINE] = types.size();
types.push_back( TypeInfo(DATA_POLY_LINE ,"PolyLine" ,"PolyLineType.png") );
stringToTypeInfo["TriangleMesh"] = types.size();
typeToTypeInfo[DATA_TRIANGLE_MESH] = types.size();
types.push_back( TypeInfo(DATA_TRIANGLE_MESH ,"TriangleMesh" ,"TriangleType.png") );
stringToTypeInfo["PolyMesh"] = types.size();
typeToTypeInfo[DATA_POLY_MESH] = types.size();
types.push_back( TypeInfo(DATA_POLY_MESH ,"PolyMesh" ,"PolyType.png") );
stringToTypeInfo["BSplineCurve"] = types.size();
typeToTypeInfo[DATA_BSPLINE_CURVE] = types.size();
types.push_back( TypeInfo(DATA_BSPLINE_CURVE ,"BSplineCurve" ,"BSplineCurveType.png") );
stringToTypeInfo["Volume"] = types.size();
typeToTypeInfo[DATA_VOLUME] = types.size();
types.push_back( TypeInfo(DATA_VOLUME ,"Volume" ,"Unknown.png") );
stringToTypeInfo["BSplineSurface"] = types.size();
typeToTypeInfo[DATA_BSPLINE_SURFACE] = types.size();
types.push_back( TypeInfo(DATA_BSPLINE_SURFACE ,"BSplineSurface" ,"Unknown.png") );
......@@ -129,9 +135,11 @@ void initialize() {
stringToTypeInfo["Skeleton"] = types.size();
typeToTypeInfo[DATA_SKELETON] = types.size();
types.push_back( TypeInfo(DATA_SKELETON ,"Skeleton" ,"Unknown.png") );
stringToTypeInfo["GIS"] = types.size();
typeToTypeInfo[DATA_GIS] = types.size();
types.push_back( TypeInfo(DATA_GIS ,"GIS" ,"Unknown.png") );
stringToTypeInfo["All"] = types.size();
typeToTypeInfo[DATA_ALL] = types.size();
types.push_back( TypeInfo(DATA_ALL ,"All" ,"Unknown.png") );
......@@ -139,9 +147,9 @@ void initialize() {
typeToString[DATA_NONE] = "Unknown";
typeToString[DATA_GROUP] = "Group";
typeToString[DATA_POINTS] = "Points";
typeToString[DATA_TRIANGLE_MESH_CONST_ID] = "TriangleMesh";
typeToString[DATA_POLY_MESH_CONST_ID] = "PolyMesh";
typeToString[DATA_POLY_LINE] = "PolyLine";
typeToString[DATA_TRIANGLE_MESH] = "TriangleMesh";
typeToString[DATA_POLY_MESH] = "PolyMesh";
typeToString[DATA_BSPLINE_CURVE] = "BSplineCurve";
typeToString[DATA_VOLUME] = "Volume";
typeToString[DATA_BSPLINE_SURFACE] = "BSplineSurface";
......@@ -177,8 +185,10 @@ DataType typeId(QString _name) {
if ( index != stringToTypeInfo.end() )
return types[ index->second ].type;
else
else {
std::cerr << "Unknown Data type with name " << _name.toStdString() << std::endl;
return -1;
}
}
/// Get the name of a type with given id
......@@ -189,8 +199,10 @@ QString typeName(DataType _id) {
if ( name != typeToString.end() )
return name->second;
else
else {
std::cerr << "Unable to retrieve typeName for id " << _id << std::endl;
return "Unknown";
}
}
/// Get the icon of a given dataType
......
......@@ -61,22 +61,26 @@
*/
/// None of the other Objects
const unsigned int DATA_NONE = 0;
#define DATA_NONE 0
/// Items used for Grouping
const unsigned int DATA_GROUP = 1;
#define DATA_GROUP 1
/// Point based objects
const unsigned int DATA_POINTS = 2;
/// PolyLine objects
const unsigned int DATA_POLY_LINE = 4;
#define DATA_POINTS 2
/// Triangle Mesh objects
const unsigned int DATA_TRIANGLE_MESH = 8;
#define DATA_TRIANGLE_MESH typeId("TriangleMesh")
//#define DATA_TRIANGLE_MESH 4
#define DATA_TRIANGLE_MESH_CONST_ID 4
/// Poly Mesh Objects
const unsigned int DATA_POLY_MESH = 16;
#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;
/// BSpline objects
const unsigned int DATA_BSPLINE_CURVE = 32;
......
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