Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

drawable.H

Go to the documentation of this file.
00001 /**********************************************************************
00002  * drawable.H
00003  **********************************************************************/
00004 #ifndef BMESH_DRAWABLE_IS_INCLUDED
00005 #define BMESH_DRAWABLE_IS_INCLUDED
00006 
00007 #include "disp/ref_img_client.H"
00008 
00009 class VIEWptr;
00010 #define CVIEWptr  const VIEWptr
00011 
00012 /*****************************************************************
00013  * BMESHdrawable
00014  *
00015  *      Provides an interface for a generic thing that can draw
00016  *      reference images and can also draw to the screen. Base
00017  *      class for Patch (a region of a BMESH that can be drawn in
00018  *      a separate style), GTexture (a procedural "texture" that
00019  *      can be assigned to a Patch), and other classes that want
00020  *      to get in on the drawing action of a BMESH.
00021  *
00022  *  XXX - Q: can we add RefImageClient::draw(CVIEWptr&)
00023  *           and get rid of this class?
00024  *****************************************************************/
00025 class BMESHdrawable : public RefImageClient {
00026  public:
00027    //******** MANAGERS ********
00028    BMESHdrawable() {}
00029 
00030    //******** DRAWING ********
00031    virtual int draw(CVIEWptr&)          = 0;
00032 };
00033 
00034 /*****************************************************************
00035  * BMESHdrawable_array:
00036  *
00037  *   An ARRAY of BMESHdrawables with convenience methods for
00038  *   passing calls to all the items in the ARRAY.
00039  *
00040  *   The templated BMD_array class is so you can do this with
00041  *   types derived from BMESHdrawable, and not be forced to work
00042  *   with generic pointers to the base type.
00043  *
00044  *   See disp/ref_img_client.H for a more complete explanation.
00045  *****************************************************************/
00046 template <class T>
00047 class BMD_array : public RIC_array<T> {
00048  public:
00049    //******** MANAGERS ********
00050    BMD_array(int n=0)                  : RIC_array<T>(n)    {}
00051    BMD_array(const RIC_array<T>& list) : RIC_array<T>(list) {}
00052 
00053    //******** CONVENIENCE ********
00054    int draw(CVIEWptr& v) const {
00055       int ret = 0;
00056       for (int i=0; i<num(); i++)
00057          ret += (*this)[i]->draw(v);
00058       return ret;
00059    }
00060 
00061    using RIC_array<T>::num;
00062 };
00063 
00064 typedef BMD_array<BMESHdrawable> BMESHdrawable_array;
00065 
00066 #endif // BMESH_DRAWABLE_IS_INCLUDED
00067 
00068 /* end of file drawable.H */
00069 

Generated on Mon Sep 18 11:39:29 2006 for jot by  doxygen 1.4.4