geometricObject.h

Go to the documentation of this file.
00001 // -*- Mode: C++; tab-width: 2; -*-
00002 // vi: set ts=2:
00003 //
00004 // $Id: geometricObject.h,v 1.39.16.2 2007-03-28 13:51:45 amoll Exp $
00005 //
00006 
00007 #ifndef BALL_VIEW_KERNEL_GEOMETRICOBJECT_H
00008 #define BALL_VIEW_KERNEL_GEOMETRICOBJECT_H
00009 
00010 #ifndef BALL_VIEW_DATATYPE_COLORRGBA_H
00011 # include <BALL/VIEW/DATATYPE/colorRGBA.h>
00012 #endif
00013 
00014 #ifndef BALL_MATHS_VECTOR3_H
00015 # include <BALL/MATHS/vector3.h>
00016 #endif
00017 
00018 #ifdef BALL_DATATYPE_HASHSET_H
00019 # include <BALL/DATATYPE/hashSet.h>
00020 #endif
00021 
00022 #ifndef BALL_DATATYPE_LIST_H
00023 # include <BALL/DATATYPE/list.h>
00024 #endif
00025 
00026 namespace BALL
00027 {
00028   class Composite;
00029 
00030   namespace VIEW
00031   {
00040     class BALL_VIEW_EXPORT GeometricObject
00041     {
00042       public:
00043 
00047       BALL_CREATE(GeometricObject)
00048 
00049       //@} /**  @name Constructors and Destructors*/  //@{
00050 
00051       
00060       GeometricObject();
00061         
00065       GeometricObject(const GeometricObject& object);
00066 
00069       virtual ~GeometricObject();
00070 
00078       virtual void clear();
00079 
00083 
00086       void set(const GeometricObject& object);
00087 
00091       GeometricObject& operator = (const GeometricObject& object);
00092 
00096       void swap(GeometricObject& object);
00097               
00099 
00102 
00104       void setComposite(const Composite* composite)
00105         { composite_ = composite;}
00106 
00108       const Composite* getComposite() const
00109         { return composite_;}
00110       
00112 
00114 
00122       virtual bool isValid() const
00123         {return true;}
00124 
00132       virtual void dump(std::ostream& s = std::cout, Size depth = 0) const;
00133 
00136       void setColor(const ColorRGBA& color)
00137         { color_ = color; }
00138 
00141       void setColor(const ColorUnit& red, const ColorUnit& green,
00142                     const ColorUnit& blue, const ColorUnit& alpha = (float)1)
00143         { color_.set(red, green, blue, alpha);}
00144 
00147       const ColorRGBA& getColor() const
00148         { return color_; }
00149 
00151       ColorRGBA& getColor() 
00152         { return color_; }
00153 
00156       void getColor(ColorUnit& red,  ColorUnit& green,
00157                     ColorUnit& blue, ColorUnit& alpha) const
00158         { color_.get(red, green, blue, alpha); }
00159 
00161       void getColors(HashSet<String>& colors);
00162       
00164       bool operator == (const GeometricObject& object) const
00165         { return this == &object;}
00166 
00167     
00169       bool operator < (const GeometricObject& object) const
00170         { return this < &object;}
00171 
00172       // Method to get all vertices from a geometric object
00173       virtual void getVertices(std::vector<Vector3>&) const {};
00174 
00176 
00177       private:
00178 
00179       void clear_();
00180     
00181       ColorRGBA color_;
00182 
00183       // the composite, which is represented by this geometric object
00184       const Composite* composite_;
00185 
00186     };
00187 
00189     typedef List<GeometricObject*> GeometricObjectList;
00190 
00191 } } // namespaces
00192 #endif // BALL_VIEW_KERNEL_GEOMETIRCOBJECT_H