BALL  1.4.1
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 namespace BALL
00023 {
00024   class Composite;
00025 
00026   namespace VIEW
00027   {
00036     class BALL_VIEW_EXPORT GeometricObject
00037     {
00038       public:
00039 
00043       BALL_CREATE(GeometricObject)
00044 
00045       //@} /**  @name Constructors and Destructors*/  //@{
00046 
00047       
00056       GeometricObject();
00057         
00061       GeometricObject(const GeometricObject& object);
00062 
00065       virtual ~GeometricObject();
00066 
00074       virtual void clear();
00075 
00079 
00082       void set(const GeometricObject& object);
00083 
00087       GeometricObject& operator = (const GeometricObject& object);
00088 
00092       void swap(GeometricObject& object);
00093               
00095 
00098 
00100       void setComposite(const Composite* composite)
00101         { composite_ = composite;}
00102 
00104       const Composite* getComposite() const
00105         { return composite_;}
00106       
00108 
00110 
00118       virtual bool isValid() const
00119         {return true;}
00120 
00128       virtual void dump(std::ostream& s = std::cout, Size depth = 0) const;
00129 
00132       void setColor(const ColorRGBA& color)
00133         { color_ = color; }
00134 
00137       void setColor(const ColorUnit& red, const ColorUnit& green,
00138                     const ColorUnit& blue, const ColorUnit& alpha = (float)1)
00139         { color_.set(red, green, blue, alpha);}
00140 
00143       const ColorRGBA& getColor() const
00144         { return color_; }
00145 
00147       ColorRGBA& getColor() 
00148         { return color_; }
00149 
00152       void getColor(ColorUnit& red,  ColorUnit& green,
00153                     ColorUnit& blue, ColorUnit& alpha) const
00154         { color_.get(red, green, blue, alpha); }
00155 
00157       void getColors(HashSet<String>& colors);
00158       
00160       bool operator == (const GeometricObject& object) const
00161         { return this == &object;}
00162 
00163     
00165       bool operator < (const GeometricObject& object) const
00166         { return this < &object;}
00167 
00168       // Method to get all vertices from a geometric object
00169       virtual void getVertices(std::vector<Vector3>&) const {};
00170 
00172 
00173       private:
00174 
00175       void clear_();
00176     
00177       ColorRGBA color_;
00178 
00179       // the composite, which is represented by this geometric object
00180       const Composite* composite_;
00181 
00182     };
00183 
00185     typedef std::list<GeometricObject*> GeometricObjectList;
00186 
00187 } } // namespaces
00188 #endif // BALL_VIEW_KERNEL_GEOMETIRCOBJECT_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines