Commit 8e4b2592 authored by Jan Möbius's avatar Jan Möbius

Added BaseObject::NoObject which can be used, if an object does not exist.

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@17856 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 453d90c4
......@@ -67,7 +67,7 @@ namespace PluginFunctions {
// ===============================================================================
bool getObject( int _identifier , BSplineCurveObject*& _object ) {
if (_identifier == -1)
if (_identifier == BaseObject::NOOBJECT)
{
_object = 0;
return false;
......
......@@ -69,7 +69,7 @@ namespace PluginFunctions {
// ===============================================================================
bool getObject( int _identifier , BSplineSurfaceObject*& _object ) {
if (_identifier == -1)
if (_identifier == BaseObject::NOOBJECT)
{
_object = 0;
return false;
......
......@@ -92,7 +92,7 @@ bool getTargetCameras( std::vector<CameraNode*>& _cameras )
bool getObject( int _identifier , CameraObject*& _object ) {
if ( _identifier == -1 ) {
if ( _identifier == BaseObject::NOOBJECT ) {
_object = 0;
return false;
}
......@@ -107,7 +107,7 @@ bool getObject( int _identifier , CameraObject*& _object ) {
CameraObject* cameraObject( int _objectId ) {
if ( _objectId == -1 ) {
if ( _objectId == BaseObject::NOOBJECT ) {
return 0;
}
......
......@@ -61,7 +61,7 @@ namespace PluginFunctions {
bool getObject( int _identifier , CoordsysObject*& _object ) {
if ( _identifier == -1 ) {
if ( _identifier == BaseObject::NOOBJECT ) {
_object = 0;
return false;
}
......@@ -96,7 +96,7 @@ CoordsysObject* coordsysObject( BaseObjectData* _object ) {
}
CoordsysObject* coordsysObject( int _objectId ) {
if ( _objectId == -1 ) {
if ( _objectId == BaseObject::NOOBJECT ) {
return 0;
}
......
......@@ -93,7 +93,7 @@ bool getTargetMeshes( std::vector<HexahedralMesh*>& _meshes )
bool getObject( int _identifier, HexahedralMeshObject*& _object ) {
if ( _identifier == -1 ) {
if ( _identifier == BaseObject::NOOBJECT ) {
_object = 0;
return false;
}
......
......@@ -63,7 +63,7 @@ namespace PluginFunctions {
bool getObject( int _identifier , LightObject*& _object ) {
if ( _identifier == -1 ) {
if ( _identifier == BaseObject::NOOBJECT ) {
_object = 0;
return false;
}
......
......@@ -61,7 +61,7 @@ namespace PluginFunctions {
bool getObject( int _identifier , PlaneObject*& _object ) {
if ( _identifier == -1 ) {
if ( _identifier == BaseObject::NOOBJECT ) {
_object = 0;
return false;
}
......@@ -104,7 +104,7 @@ PlaneObject* planeObject( BaseObjectData* _object ) {
}
PlaneObject* planeObject( int _objectId ) {
if ( _objectId == -1 ) {
if ( _objectId == BaseObject::NOOBJECT ) {
return 0;
}
......
......@@ -92,7 +92,7 @@ bool getTargetPolylines( std::vector<PolyLine*>& _polylines )
bool getObject( int _identifier , PolyLineObject*& _object ) {
if ( _identifier == -1 ) {
if ( _identifier == BaseObject::NOOBJECT ) {
_object = 0;
return false;
}
......@@ -127,7 +127,7 @@ PolyLineObject* polyLineObject( BaseObjectData* _object ) {
PolyLineObject* polyLineObject( int _objectId ) {
if (_objectId == -1)
if (_objectId == BaseObject::NOOBJECT)
return 0;
// Get object by using the map accelerated plugin function
......
......@@ -86,7 +86,7 @@ bool getTargetMeshes( std::vector<PolyMesh*>& _meshes ) {
bool getObject( int _identifier , PolyMeshObject*& _object ) {
if ( _identifier == -1 ) {
if ( _identifier == BaseObject::NOOBJECT ) {
_object = 0;
return false;
}
......@@ -101,7 +101,7 @@ bool getObject( int _identifier , PolyMeshObject*& _object ) {
bool getMesh( int _identifier , PolyMesh*& _mesh ) {
if ( _identifier == -1 ) {
if ( _identifier == BaseObject::NOOBJECT ) {
_mesh = 0;
return false;
}
......@@ -159,7 +159,7 @@ PolyMeshObject* polyMeshObject( BaseObjectData* _object ) {
PolyMeshObject* polyMeshObject( int _objectId ) {
if (_objectId == -1)
if (_objectId == BaseObject::NOOBJECT)
return 0;
// Get object by using the map accelerated plugin function
......
......@@ -93,7 +93,7 @@ bool getTargetMeshes( std::vector<PolyhedralMesh*>& _meshes )
bool getObject( int _identifier, PolyhedralMeshObject*& _object ) {
if ( _identifier == -1 ) {
if ( _identifier == BaseObject::NOOBJECT ) {
_object = 0;
return false;
}
......
......@@ -64,7 +64,7 @@ namespace PluginFunctions {
bool getObject( int _identifier , QtWidgetObject*& _object ) {
if ( _identifier == -1 ) {
if ( _identifier == BaseObject::NOOBJECT ) {
_object = 0;
return false;
}
......
......@@ -60,7 +60,7 @@ namespace PluginFunctions {
// ===============================================================================
bool getObject( int _identifier , SkeletonObject*& _object ) {
if (_identifier == -1)
if (_identifier == BaseObject::NOOBJECT)
return false;
// Get object by using the map accelerated plugin function
......
......@@ -63,7 +63,7 @@ namespace PluginFunctions {
bool getObject( int _identifier , SphereObject*& _object ) {
if ( _identifier == -1 ) {
if ( _identifier == BaseObject::NOOBJECT ) {
_object = 0;
return false;
}
......@@ -78,7 +78,7 @@ bool getObject( int _identifier , SphereObject*& _object ) {
SphereObject* sphereObject( int _objectId ) {
if ( _objectId == -1 ) {
if ( _objectId == BaseObject::NOOBJECT ) {
return 0;
}
......
......@@ -72,7 +72,7 @@ namespace PluginFunctions {
bool getObject( int _identifier, SplatCloudObject *&_object )
{
if( _identifier == -1 )
if( _identifier == BaseObject::NOOBJECT )
{
_object = 0;
return false;
......@@ -169,7 +169,7 @@ SplatCloudObject* splatCloudObject( BaseObjectData *_object )
SplatCloudObject* splatCloudObject( int _objectId ) {
if (_objectId == -1)
if (_objectId == BaseObject::NOOBJECT)
return 0;
// Get object by using the map accelerated plugin function
......
......@@ -84,7 +84,7 @@ bool getTargetMeshes( std::vector<TriMesh*>& _meshes ) {
bool getObject( int _identifier , TriMeshObject*& _object ) {
if ( _identifier == -1 ) {
if ( _identifier == BaseObject::NOOBJECT ) {
_object = 0;
return false;
}
......@@ -103,7 +103,7 @@ bool getObject( int _identifier , TriMeshObject*& _object ) {
bool getMesh( int _identifier , TriMesh*& _mesh ) {
if ( _identifier == -1 ) {
if ( _identifier == BaseObject::NOOBJECT ) {
_mesh = 0;
return false;
}
......@@ -164,7 +164,7 @@ TriMeshObject* triMeshObject( BaseObjectData* _object ) {
TriMeshObject* triMeshObject( int _objectId ) {
if (_objectId == -1)
if (_objectId == BaseObject::NOOBJECT)
return 0;
// Get object by using the map accelerated plugin function
......
......@@ -55,6 +55,7 @@
//== INCLUDES =================================================================
#include "BaseObjectCore.hh"
#include "BaseObject.hh"
#include "Types.hh"
#include <OpenFlipper/BasePlugin/PluginFunctionsCore.hh>
#include <OpenFlipper/BasePlugin/PluginFunctions.hh>
......@@ -74,6 +75,11 @@ static ObjectManager objectManager_;
*/
static int idGenerator = 1;
/** Static member for no object initialization
*
*/
int BaseObject::NOOBJECT = -1;
BaseObject::BaseObject(const BaseObject& _object) :
QObject(),
id_(idGenerator),
......
......@@ -101,6 +101,10 @@ class DLLEXPORTONLY BaseObject : public QObject {
virtual ~BaseObject();
/** predefined handle which is returned when objects are not found or not initialized.
*/
static int NOOBJECT;
//===========================================================================
/** @name Object Identification
* @{ */
......
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