diff --git a/Core/Core.cc b/Core/Core.cc index 431d13b159e3b7147432d9d54e8ca7d3702612ed..5d91b616c29c4273b08f9c56fb5c78752d3196c0 100644 --- a/Core/Core.cc +++ b/Core/Core.cc @@ -100,7 +100,8 @@ #include -#include "OpenFlipper/common/TypesInternal.hh" +#include +#include #define WIDGET_HEIGHT 800 #define WIDGET_WIDTH 800 diff --git a/common/BaseObject.cc b/common/BaseObject.cc index 2a489d84ef6a82ab98c2c4692114572c38ca44ae..d06896b0ee1dd33ce505422a968d9e8a800438aa 100644 --- a/common/BaseObject.cc +++ b/common/BaseObject.cc @@ -54,6 +54,7 @@ //== INCLUDES ================================================================= +#include "BaseObjectCore.hh" #include "Types.hh" #include @@ -67,7 +68,9 @@ */ static int idGenerator = 1; -BaseObject::BaseObject(const BaseObject& _object) { +BaseObject::BaseObject(const BaseObject& _object) : + QObject() +{ id_ = idGenerator; ++idGenerator; persistentId_ = _object.persistentId_; @@ -90,6 +93,7 @@ BaseObject::BaseObject(const BaseObject& _object) { } BaseObject::BaseObject(BaseObject* _parent) : + QObject() , id_(-1), persistentId_(-1), objectType_(DATA_UNKNOWN), diff --git a/common/BaseObject.hh b/common/BaseObject.hh index b0c3e80464761767f7158fe8681173fc357b933b..8ddb8c3398577c4fb367bbcedea628483ee7951d 100644 --- a/common/BaseObject.hh +++ b/common/BaseObject.hh @@ -61,6 +61,8 @@ //== INCLUDES ================================================================= #include +#include +#include #include #include #include @@ -77,7 +79,10 @@ * This is the basic Data class providing the functions common to all objects. * If the Datacontrol Plugin is available, a Tree structure will be generated allowing groups of objects. */ -class DLLEXPORTONLY BaseObject { +class DLLEXPORTONLY BaseObject : public QObject { + + Q_OBJECT + friend class BaseObjectData; public : diff --git a/common/BaseObjectCore.hh b/common/BaseObjectCore.hh new file mode 100644 index 0000000000000000000000000000000000000000..58fb8db7cd9839f6e0462b34774e8c7ae0b0eb7e --- /dev/null +++ b/common/BaseObjectCore.hh @@ -0,0 +1,65 @@ +/*===========================================================================*\ + * * + * OpenFlipper * + * Copyright (C) 2001-2009 by Computer Graphics Group, RWTH Aachen * + * www.openflipper.org * + * * + *---------------------------------------------------------------------------* + * This file is part of OpenFlipper. * + * * + * 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 with the * + * following exceptions: * + * * + * If other files instantiate templates or use macros * + * or inline functions from this file, or you compile this file and * + * link it with other files to produce an executable, this file does * + * not by itself cause the resulting executable to be covered by the * + * GNU Lesser General Public License. This exception does not however * + * invalidate any other reasons why the executable file might be * + * covered by the GNU Lesser General Public License. * + * * + * 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 LesserGeneral Public * + * License along with OpenFlipper. If not, * + * see . * + * * +\*===========================================================================*/ + +/*===========================================================================*\ + * * + * $Revision: 6727 $ * + * $Author: moebius $ * + * $Date: 2009-08-05 08:03:50 +0200 (Mi, 05. Aug 2009) $ * + * * +\*===========================================================================*/ + + + + +//============================================================================= +// +// Types +// +//============================================================================= + +/** + * \file BaseObjectCore.hh + * This File contains the Basic object handling only used by the Core + */ + + +#ifndef BASEOBJECTCORE_HH +#define BASEOBJECTCORE_HH + +#include + +//============================================================================= +#endif // BASEOBJECTCORE_HH defined +//============================================================================= diff --git a/common/BaseObjectData.cc b/common/BaseObjectData.cc index bb65c3577b63dc8b9687ff06a055d58679c2b5e5..36bba4dfcf8e6b12f5ff579306ee9e32cc6fc681 100644 --- a/common/BaseObjectData.cc +++ b/common/BaseObjectData.cc @@ -54,6 +54,7 @@ #include "Types.hh" #include #include +#include //== TYPEDEFS ================================================================= diff --git a/common/BaseObjectData.hh b/common/BaseObjectData.hh index 5d7d2a917f849bce1c5a6f79cfbe31fa48aa31d1..f2542a7a0f7ab8baa228b93582c51ba58098e2fd 100644 --- a/common/BaseObjectData.hh +++ b/common/BaseObjectData.hh @@ -63,7 +63,8 @@ //== INCLUDES ================================================================= #include -#include "BaseObject.hh" +#include +#include #include #include #include @@ -96,6 +97,8 @@ typedef ACG::SceneGraph::StencilRefNode StencilRefNode; */ class DLLEXPORT BaseObjectData : public BaseObject { + Q_OBJECT + public: /** \brief copy constructor diff --git a/common/DataTypes.hh b/common/DataTypes.hh new file mode 100644 index 0000000000000000000000000000000000000000..cd835a7dfdd9bd95b05a3e94d8c5ed7951ae2586 --- /dev/null +++ b/common/DataTypes.hh @@ -0,0 +1,212 @@ +/*===========================================================================*\ + * * + * OpenFlipper * + * Copyright (C) 2001-2009 by Computer Graphics Group, RWTH Aachen * + * www.openflipper.org * + * * + *---------------------------------------------------------------------------* + * This file is part of OpenFlipper. * + * * + * 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 with the * + * following exceptions: * + * * + * If other files instantiate templates or use macros * + * or inline functions from this file, or you compile this file and * + * link it with other files to produce an executable, this file does * + * not by itself cause the resulting executable to be covered by the * + * GNU Lesser General Public License. This exception does not however * + * invalidate any other reasons why the executable file might be * + * covered by the GNU Lesser General Public License. * + * * + * 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 LesserGeneral Public * + * License along with OpenFlipper. If not, * + * see . * + * * +\*===========================================================================*/ + +/*===========================================================================*\ + * * + * $Revision: 7697 $ * + * $Author: moebius $ * + * $Date: 2009-11-30 17:40:00 +0100 (Mo, 30. Nov 2009) $ * + * * +\*===========================================================================*/ + + + + +//============================================================================= +// +// Types +// +//============================================================================= + +/** + * \file DataTypes.hh + * This File contains the basic type informations + */ + + +#ifndef DATATYPES_HH +#define DATATYPES_HH + +//== includes ================================================================= + + +#include + +#include +#include +#include +#include +#include + +//== Global Typedefs ================================================================= + +/** \brief Predefined datatypes +* +* Here are several datatypes which have predefined ids. This might be changed to runtime added +* datatypes in the future. +*/ + +/// None of the other Objects +#define DATA_UNKNOWN 0 + +/// Items used for Grouping +#define DATA_GROUP 1 + +/// Triangle Mesh objects +#define DATA_TRIANGLE_MESH typeId("TriangleMesh") +#define DATA_TRIANGLE_MESH_CONST_ID 2 + +/// Poly Mesh Objects +#define DATA_POLY_MESH typeId("PolyMesh") +#define DATA_POLY_MESH_CONST_ID 4 + +/// Identifier for all available objects +const unsigned int DATA_ALL = UINT_MAX; + +typedef unsigned int DataType; + + +//== 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); + +//================================================================================================ +/** @name Functions for adding dataTypes +* @{ */ +//================================================================================================ + +/** Adds a datatype and returns the id for the new type +* +* @param _name Internal name for the new DataType +* @param _readableName Human readable Name for this type ( Use tr to make it translatable ) +*/ +DLLEXPORT +DataType addDataType(QString _name, QString _readableName); + +/// Given a dataType Identifier string this function will return the id of the datatype +DLLEXPORT +DataType typeId(QString _name); + +/** \brief Get the name of a type with given id +* +* The ids are organized in a bitfield. So use either the macro for getting the type id or +* use the id directly (they have to be power of 2! ... Bitfield) +*/ +DLLEXPORT +QString typeName(DataType _id); + +/** \brief Get the number of registered types +* +* This function will return the number of types registered to the core. You can use it to +* iterate over all types. +* +* \Note Remember that the types are organized in a bitfield! +*/ +DLLEXPORT +uint typeCount(); + +/** @} */ + +//================================================================================================ +/** @name Datatype Name handling +* @{ */ +//================================================================================================ + +/// Get DataType Human readable name ( this name might change. Use the typeName insted! ) +DLLEXPORT +QString dataTypeName( DataType _id ); + +/// Get DataType Human readable name ( this name might change. Use the typeName insted! ) +DLLEXPORT +QString dataTypeName( QString _typeName); + +/// Set DataType Human readable name +DLLEXPORT +void setDataTypeName( DataType _id, QString _name ); + +/// Set DataType Human readable name +DLLEXPORT +void setDataTypeName( QString _typeName, QString _name ); + + +/** @} */ + +//================================================================================================ +/** @name Datatype Icons +* @{ */ +//================================================================================================ + +/// Get a string with the filename of the icon for the DataType name +DLLEXPORT +QString typeIconName(QString _name); + +/// Get a string with the filename of the icon for the DataType +DLLEXPORT +QString typeIconName(DataType _id); + +/** \brief Get an QIcon associated with the given datatype +* +* The icons are loaded once when set and then the reference is returned here. +* This reduces the time when frequently requesting the icons (e.g. DataControl) +*/ +DLLEXPORT +QIcon& typeIcon(DataType _id); + +/// Set an Icon for a given DataType +DLLEXPORT +void setTypeIcon( DataType _id , QString _icon); + +/// Set an Icon for a given DataType +DLLEXPORT +void setTypeIcon( QString _name , QString _icon ); + +/** @} */ + + + + + +//============================================================================= +#endif // DATATYPES_HH defined +//============================================================================= diff --git a/common/GroupObject.hh b/common/GroupObject.hh index 32903ea230c79267a8e050aa26e175bbfdf5cb1d..f7b2544cd88973bcb3c81174f594400c60f071cf 100644 --- a/common/GroupObject.hh +++ b/common/GroupObject.hh @@ -62,6 +62,7 @@ //== INCLUDES ================================================================= #include +#include #include //== TYPEDEFS ================================================================= diff --git a/common/Types.cc b/common/Types.cc index 421b04688cfea10391eb3f229583e2b52c6b3a6e..fac2c488117dadcea80f06794683c6d4ca0aa543 100644 --- a/common/Types.cc +++ b/common/Types.cc @@ -57,8 +57,8 @@ //== INCLUDES ================================================================= -#include "Types.hh" #include "TypesInternal.hh" +#include "DataTypes.hh" #include #include #include diff --git a/common/Types.hh b/common/Types.hh index e65e2bc2b72e98fc83a0b87af206fa362f33bd84..792e05cb1d9720f941ee91954da4707a964f2fb3 100644 --- a/common/Types.hh +++ b/common/Types.hh @@ -58,155 +58,17 @@ #ifndef TYPES_HH #define TYPES_HH -#include -#include -#include -//== Global Typedefs ================================================================= - -/** \brief Predefined datatypes - * - * Here are several datatypes which have predefined ids. This might be changed to runtime added - * datatypes in the future. - */ - -/// None of the other Objects -#define DATA_UNKNOWN 0 - -/// Items used for Grouping -#define DATA_GROUP 1 - -/// Triangle Mesh objects -#define DATA_TRIANGLE_MESH typeId("TriangleMesh") -#define DATA_TRIANGLE_MESH_CONST_ID 2 - -/// Poly Mesh Objects -#define DATA_POLY_MESH typeId("PolyMesh") -#define DATA_POLY_MESH_CONST_ID 4 - -/// Identifier for all available objects -const unsigned int DATA_ALL = UINT_MAX; - -typedef unsigned int DataType; - -// TODO: Make types runtime addable - //== INCLUDES ================================================================= +// This include defines all required datatype handling functions +#include + #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 DataContainer; - -//================================================================================================ -/** @name Functions for adding dataTypes -* @{ */ -//================================================================================================ - -/** Adds a datatype and returns the id for the new type -* -* @param _name Internal name for the new DataType -* @param _readableName Human readable Name for this type ( Use tr to make it translatable ) -*/ -DLLEXPORT -DataType addDataType(QString _name, QString _readableName); - -/// Given a dataType Identifier string this function will return the id of the datatype -DLLEXPORT -DataType typeId(QString _name); - -/** \brief Get the name of a type with given id -* -* The ids are organized in a bitfield. So use either the macro for getting the type id or -* use the id directly (they have to be power of 2! ... Bitfield) -*/ -DLLEXPORT -QString typeName(DataType _id); - -/** \brief Get the number of registered types -* -* This function will return the number of types registered to the core. You can use it to -* iterate over all types. -* -* \Note Remember that the types are organized in a bitfield! -*/ -DLLEXPORT -uint typeCount(); - -/** @} */ - -//================================================================================================ -/** @name Datatype Name handling -* @{ */ -//================================================================================================ - -/// Get DataType Human readable name ( this name might change. Use the typeName insted! ) -DLLEXPORT -QString dataTypeName( DataType _id ); - -/// Get DataType Human readable name ( this name might change. Use the typeName insted! ) -DLLEXPORT -QString dataTypeName( QString _typeName); - -/// Set DataType Human readable name -DLLEXPORT -void setDataTypeName( DataType _id, QString _name ); - -/// Set DataType Human readable name -DLLEXPORT -void setDataTypeName( QString _typeName, QString _name ); - - -/** @} */ - -//================================================================================================ -/** @name Datatype Icons -* @{ */ -//================================================================================================ - -/// Get a string with the filename of the icon for the DataType name -DLLEXPORT -QString typeIconName(QString _name); - -/// Get a string with the filename of the icon for the DataType -DLLEXPORT -QString typeIconName(DataType _id); - -/** \brief Get an QIcon associated with the given datatype -* -* The icons are loaded once when set and then the reference is returned here. -* This reduces the time when frequently requesting the icons (e.g. DataControl) -*/ -DLLEXPORT -QIcon& typeIcon(DataType _id); - -/// Set an Icon for a given DataType -DLLEXPORT -void setTypeIcon( DataType _id , QString _icon); - -/// Set an Icon for a given DataType -DLLEXPORT -void setTypeIcon( QString _name , QString _icon ); - -/** @} */ - //============================================================================= #endif // TYPES_HH defined diff --git a/common/TypesInternal.hh b/common/TypesInternal.hh index 27f9df59ab2abbbd13c2c331bd74ccd4ec5fa39a..270b9b667f55bb02bac3931fb44f18cb90f70f4c 100644 --- a/common/TypesInternal.hh +++ b/common/TypesInternal.hh @@ -1,73 +1,74 @@ -/*===========================================================================*\ - * * - * OpenFlipper * - * Copyright (C) 2001-2009 by Computer Graphics Group, RWTH Aachen * - * www.openflipper.org * - * * - *---------------------------------------------------------------------------* - * This file is part of OpenFlipper. * - * * - * 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 with the * - * following exceptions: * - * * - * If other files instantiate templates or use macros * - * or inline functions from this file, or you compile this file and * - * link it with other files to produce an executable, this file does * - * not by itself cause the resulting executable to be covered by the * - * GNU Lesser General Public License. This exception does not however * - * invalidate any other reasons why the executable file might be * - * covered by the GNU Lesser General Public License. * - * * - * 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 LesserGeneral Public * - * License along with OpenFlipper. If not, * - * see . * - * * -\*===========================================================================*/ - -/*===========================================================================*\ - * * - * $Revision: 7673 $ * - * $Author: moebius $ * - * $Date: 2009-11-30 12:45:38 +0100 (Mo, 30. Nov 2009) $ * - * * -\*===========================================================================*/ - - - - -//============================================================================= -// -// Types -// -//============================================================================= - -/** - * \file TypesInternal.hh - * This File contains the functions for internal communication between types and - * the core. Do not use in Plugins!!! - */ - - -#ifndef TYPESINTERNAL_HH -#define TYPESINTERNAL_HH - - - -//== INCLUDES ================================================================= -#include -#include - -DLLEXPORT -void initializeTypes(); - -//============================================================================= -#endif // TYPESINTERNAL_HH defined -//============================================================================= +/*===========================================================================*\ + * * + * OpenFlipper * + * Copyright (C) 2001-2009 by Computer Graphics Group, RWTH Aachen * + * www.openflipper.org * + * * + *---------------------------------------------------------------------------* + * This file is part of OpenFlipper. * + * * + * 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 with the * + * following exceptions: * + * * + * If other files instantiate templates or use macros * + * or inline functions from this file, or you compile this file and * + * link it with other files to produce an executable, this file does * + * not by itself cause the resulting executable to be covered by the * + * GNU Lesser General Public License. This exception does not however * + * invalidate any other reasons why the executable file might be * + * covered by the GNU Lesser General Public License. * + * * + * 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 LesserGeneral Public * + * License along with OpenFlipper. If not, * + * see . * + * * +\*===========================================================================*/ + +/*===========================================================================*\ + * * + * $Revision: 7673 $ * + * $Author: moebius $ * + * $Date: 2009-11-30 12:45:38 +0100 (Mo, 30. Nov 2009) $ * + * * +\*===========================================================================*/ + + + + +//============================================================================= +// +// Types +// +//============================================================================= + +/** + * \file TypesInternal.hh + * This File contains the functions for internal communication between types and + * the core. Do not use in Plugins!!! + */ + + +#ifndef TYPESINTERNAL_HH +#define TYPESINTERNAL_HH + + +//== INCLUDES ================================================================= + +#include + +/// Vector Type containing the Data Objects +typedef std::vector DataContainer; + +void initializeTypes(); + +//============================================================================= +#endif // TYPESINTERNAL_HH defined +//=============================================================================