BaseObject.hh

Go to the documentation of this file.
00001 /*===========================================================================*\
00002  *                                                                           *
00003  *                              OpenFlipper                                  *
00004  *      Copyright (C) 2001-2009 by Computer Graphics Group, RWTH Aachen      *
00005  *                           www.openflipper.org                             *
00006  *                                                                           *
00007  *---------------------------------------------------------------------------*
00008  *  This file is part of OpenFlipper.                                        *
00009  *                                                                           *
00010  *  OpenFlipper is free software: you can redistribute it and/or modify      *
00011  *  it under the terms of the GNU Lesser General Public License as           *
00012  *  published by the Free Software Foundation, either version 3 of           *
00013  *  the License, or (at your option) any later version with the              *
00014  *  following exceptions:                                                    *
00015  *                                                                           *
00016  *  If other files instantiate templates or use macros                       *
00017  *  or inline functions from this file, or you compile this file and         *
00018  *  link it with other files to produce an executable, this file does        *
00019  *  not by itself cause the resulting executable to be covered by the        *
00020  *  GNU Lesser General Public License. This exception does not however       *
00021  *  invalidate any other reasons why the executable file might be            *
00022  *  covered by the GNU Lesser General Public License.                        *
00023  *                                                                           *
00024  *  OpenFlipper is distributed in the hope that it will be useful,           *
00025  *  but WITHOUT ANY WARRANTY; without even the implied warranty of           *
00026  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            *
00027  *  GNU Lesser General Public License for more details.                      *
00028  *                                                                           *
00029  *  You should have received a copy of the GNU LesserGeneral Public          *
00030  *  License along with OpenFlipper. If not,                                  *
00031  *  see <http://www.gnu.org/licenses/>.                                      *
00032  *                                                                           *
00033 \*===========================================================================*/
00034 
00035 /*===========================================================================*\
00036  *                                                                           *
00037  *   $Revision: 8694 $                                                         *
00038  *   $Author: wilden $                                                      *
00039  *   $Date: 2010-03-09 18:49:22 +0100 (Di, 09. Mär 2010) $                   *
00040  *                                                                           *
00041 \*===========================================================================*/
00042 
00043 
00044 
00045 
00046 //=============================================================================
00047 //
00048 //  Types
00049 //
00050 //=============================================================================
00051 
00058 #ifndef BASEOBJECT_HH
00059 #define BASEOBJECT_HH
00060 
00061 //== INCLUDES =================================================================
00062 
00063 #include <OpenFlipper/common/GlobalDefines.hh>
00064 #include <OpenFlipper/common/DataTypes.hh>
00065 #include <OpenFlipper/common/UpdateType.hh>
00066 #include <QObject>
00067 #include <QString>
00068 #include <QList>
00069 #include <QStringList>
00070 #include <vector>
00071 #include <QMap>
00072 #include "perObjectData.hh"
00073 
00074 //== TYPEDEFS =================================================================
00075 
00076 
00077 //== CLASS DEFINITION =========================================================
00078 
00083 class DLLEXPORTONLY BaseObject : public QObject {
00084   
00085   Q_OBJECT 
00086   
00087   friend class BaseObjectData;
00088 
00089   public :
00090 
00094     BaseObject(const BaseObject& _object);
00095 
00100     BaseObject( BaseObject *_parent = 0);
00101 
00102     virtual ~BaseObject();
00103 
00104   //===========================================================================
00107   //===========================================================================
00108   public:
00112     int id();
00113 
00118     int persistentId();
00119 
00122     void persistentId( int _id );
00123 
00124   private:
00130     int id_;
00131 
00137     int persistentId_;
00138 
00139   //===========================================================================
00142   //===========================================================================
00143 
00144   public:
00148     bool dataType(DataType _type);
00149 
00152     DataType dataType();
00153 
00157     void setDataType(DataType _type);
00158 
00159   private:
00163     DataType objectType_;
00164 
00167   //===========================================================================
00170   //===========================================================================
00171 
00172   public:
00176     virtual void cleanup();
00177 
00180   //===========================================================================
00183   //===========================================================================
00184   public:
00186     virtual QString getObjectinfo();
00187 
00189     virtual void printObjectInfo();
00190 
00193   //===========================================================================
00196   //===========================================================================
00197 
00198   signals:
00199     void objectSelectionChanged(int _objectId);
00200     
00201   public:
00207     bool target();
00208 
00211     void target(bool _target);
00212 
00216     bool source();
00217 
00220     void source(bool _source);
00221 
00224     bool flag(QString _flag);
00225 
00228     void setFlag(QString _flag, bool _set);
00229 
00232     QStringList flags();
00233 
00234   private:
00235 
00239     QStringList flags_;
00240 
00241 
00244   //===========================================================================
00247   //===========================================================================
00248   
00249   signals:
00255     void visibilityChanged(int _objectId);
00256 
00257 
00258   public :
00260     virtual bool visible();
00261 
00263     virtual void visible(bool _visible);
00264 
00265   private :
00270     bool visible_;
00271 
00274   //===========================================================================
00277   //===========================================================================
00278 
00279   public:
00286     virtual void update(UpdateType _type = UPDATE_ALL);
00287 
00289     void dumpTree();
00290 
00292     virtual BaseObject* copy();
00293 
00297   //===========================================================================
00300   //===========================================================================
00301 
00302   public:
00303 
00306     BaseObject* last();
00307 
00310     BaseObject* next();
00311 
00314     int level();
00315 
00316   private:
00318     BaseObject *parentItem_;
00319 
00321     QList<BaseObject*> childItems_;
00322 
00323   public:
00324     //===========================================================================
00327     //===========================================================================
00328 
00329   public:
00330     
00332     int row() const;
00333 
00335     BaseObject *parent();
00336 
00338     void setParent(BaseObject* _parent);
00339 
00342     //===========================================================================
00345     //===========================================================================
00346     
00347   public:
00348     
00350     BaseObject* childExists(int _objectId);
00351 
00353     BaseObject* childExists(QString _name);
00354 
00356     void appendChild(BaseObject *child);
00357 
00359     BaseObject *child(int row);
00360 
00362     int childCount() const;
00363 
00365     void removeChild( BaseObject* _item );
00366 
00368     QList< BaseObject* > getLeafs();
00369 
00371     void deleteSubtree();
00372 
00375     //===========================================================================
00378     //===========================================================================
00379 
00380   public:
00381     
00387     int group();
00388 
00390     bool isGroup();
00391 
00396     bool isInGroup( int _id );
00397 
00402     bool isInGroup( QString _name );
00403 
00406     std::vector< int > getGroupIds();
00407 
00410     QStringList getGroupNames();
00411 
00412 
00415     //===========================================================================
00418     //===========================================================================
00419 
00420   signals:
00424     void objectPropertiesChanged(int _objectId);
00425 
00426   public:
00428     QString name( );
00429 
00431     virtual void setName( QString _name );
00432 
00433 
00434   private:
00435 
00437     QString name_;
00438 
00439 
00442   //===========================================================================
00445   //===========================================================================
00446 
00447   public:
00448 
00456     void setObjectData( QString _dataName , PerObjectData* _data );
00457 
00459     void clearObjectData( QString _dataName );
00460 
00462     bool hasObjectData( QString _dataName );
00463 
00465     PerObjectData* objectData( QString _dataName );
00466 
00468     void deleteData();
00469 
00470   private:
00471 
00472     QMap<QString, PerObjectData* > dataMap_;
00473 
00476 };
00477 
00478 
00479 //=============================================================================
00480 #endif // BASEOBJECT_HH defined
00481 //=============================================================================

acg pic Project OpenFlipper, ©  Computer Graphics Group, RWTH Aachen. Documentation generated using doxygen .