proj home

Files   Classes   Functions   Hierarchy  

gobjContainer Class Reference

Composite container of graphics objects. More...

#include <gobjbase.h>

Inheritance diagram for gobjContainer:
Inheritance graph
Collaboration diagram for gobjContainer:
Collaboration graph

List of all members.

Public Member Functions

void set ()
 Make the current container the container where all the global graphics is written to.
void globalpush ()
 Store the previous container and make this container the global graphics stream.
 gobjContainer ()
 Memory management enabled by default.
 gobjContainer (boolc cleanup_)
 Graphics objects optionally deleted.
 ~gobjContainer ()
void nuke ()
 Empties container, deleting if cleanup is true.
boolc kill (uintc k)
 Sets vg[k] to 0.
boolc kill (gobj *const targ)
 Set vg[k] to 0.
void draw ()
 Draws vg[i].
void push (gobj *g)
 Add graphics objects to vg.
template<class T >
void pushcallback (T &data_, void(T::*fn_)())
 Add a callback function.
gobjglCallList< GLuint > * displaylistcreatenew (uint id)
 Compile the list of graphics to a display list.
void displaylist (uintc id)
 Convert this graphics list into a display list.

Static Public Member Functions

static void globalpop ()
 Restore the previous graphics stream.

Public Attributes

vector< gobj * > vg
 Public for the client to access all the graphics.
bool cleanup
 Default true to delete vg[i].

Static Public Attributes

static vector< gobjContainer * > globalvec
 Push and pop the graphic context/stream.

Detailed Description

Composite container of graphics objects.

The client adds the graphics objects to the container through push(gobj*).

Very simple pointer memory management is supported with nuke() and the destructor calling delete() on the pointers. By default it is assumed that objects pushed are contructed from new operator and are memory managed by this class.

If cleanup is set to false (explicityly or at construction time) then this class assumes the graphics pointers are managed outside of this class.

There is a global graphics pointer which is like a universal graphics stream. Clients write to the container by pushing back gobj's. This can be used to pass geometry as well as a storage place for the gobj's to be evaluated at a later date.

Definition at line 171 of file gobjbase.h.

Constructor & Destructor Documentation

gobjContainer::gobjContainer (  ) 
gobjContainer::gobjContainer ( boolc  cleanup_  ) 

Graphics objects optionally deleted.

Definition at line 96 of file gobjbase.cpp.

00097   : cleanup(cleanup_)
00098 {
00099 }

gobjContainer::~gobjContainer (  ) 


Definition at line 117 of file gobjbase.cpp.

References nuke().

00118 {
00119   nuke();
00120 }

Member Function Documentation

void gobjContainer::displaylist ( uintc  id  ) 

Convert this graphics list into a display list.

This destroys and realizes the current geometry and is a non reversible operation. cleanup is set to true. The id is the compiled lists id.

Definition at line 44 of file gobjbase.cpp.

References cleanup, displaylistcreatenew(), nuke(), push(), and vg.

Referenced by gobj::globaldisplaylist(), snakesorttest::test02(), quickhull2Dtest::test02(), and snakesorttest::test03().

00045 {  
00046   if (vg.empty()) 
00047     return; 
00049   gobj * x = displaylistcreatenew(id); 
00050   nuke(); 
00051   cleanup=true; 
00052   push(x); 
00053 }

gobjglCallList<GLuint>* gobjContainer::displaylistcreatenew ( uint  id  ) 

Compile the list of graphics to a display list.

The new operator called so the client owns the object.

Referenced by displaylist(), and test07::keyboard().

void gobjContainer::draw (  )  [virtual]

Draws vg[i].

Implements gobj.

Reimplemented in pathlinesegdraw, tessD2draw02points< TESS, PT >, gobjContainerPrePost, tessD1draw01points< TESS, PT >, tessD1draw01lines< TESS, PT >, tessD1draw01linesmulticolor< TESS, PT >, and tessD1draw01simplexindexes< TESS, PT >.

Definition at line 55 of file gobjbase.cpp.

References GOBJDEBUGCODE, and vg.

Referenced by visenv::display(), simplexD1tessapp01::display(), menusystemtest04::display(), menusystemtest03::display(), menusystemtest02::display(), menusystemtest01::display(), d2simplextest::display(), test07::display(), test06::display(), test05::display(), test01obj< P, PD >::display(), bsptree001::display(), display(), helixtestscope::helixtest::display01(), spiralindextest::display01(), snakesorttest::display01(), simplexD2tessapp01::display01(), quickhull3Dtest::display01(), quickhull2Dtest::display01(), triangletest::display01(), tetrahedrontest::display01(), plotpolartest::display01(), maze005::display01(), maze004::display01(), maze003::display01(), maze002::display01(), maze001::display01(), buttonpanel01test::display01(), diskinttest::display01(), circleD2test::display01(), boxOBBhalfspaceD2test::display01(), triangles3Tdisplaytest::display01(), menusystemtest::display01(), graphicsImmediateDeferredTest::display01(), gobjtest::display01(), delaunaysimpleD2test::display01(), cubegui::display01(), regionD2linkedtest::display01(), polytopesD2linkedtest::display01(), pathlinesegtest::display01(), display01(), partitionstest::display02(), menusystemtest::display02(), display02(), pointsgraph_axes_circle::draw(), menusystem::draw(), graphicsImmediateDeferred::draw(), gobjContainerSwitch::draw(), gobjContainerPrePost::draw(), menu01< T >::draw(), d3tessdraw::draw(), arcdraw::draw(), meshpatchtestdisplay01(), planeinttestdisplay01(), pointsurfacetestdisplay01(), gobjdebug01test::test01(), gobjdebug01test::test02(), gobjdebug01test::test03(), and graphicsImmediateDeferred::update().

00056 {
00059   if (vg.empty())
00060     return;
00062   for (uint i=0; i<vg.size(); ++i)
00063     vg[i]->draw();
00064 }

void gobjContainer::globalpop (  )  [static]

Restore the previous graphics stream.

Definition at line 8 of file gobjbase.cpp.

References globalvec.

Referenced by graphicsImmediateDeferredTestTri::graphicscreate03(), and gobjGlobal::~gobjGlobal().

00009 { 
00010   assert(globalvec.empty()==false); 
00011   gobj::global =
00012     globalvec[globalvec.size()-1]; 
00013   globalvec.pop_back();
00014 }

void gobjContainer::globalpush (  )  [inline]

Store the previous container and make this container the global graphics stream.

Definition at line 185 of file gobjbase.h.

References gobj::global, and globalvec.

Referenced by gobjGlobal::gobjGlobal(), and graphicsImmediateDeferredTestTri::graphicscreate03().

00186     { globalvec.push_back( gobj::global); set(); }

boolc gobjContainer::kill ( gobj *const   targ  ) 

Set vg[k] to 0.

O(N) complexity.

Definition at line 76 of file gobjbase.cpp.

References vg.

00077 { 
00078   uint imax=vg.size();
00079   for (uint i=0; i<imax; ++i)
00080   {
00081     if (vg[i]==targ)
00082     {
00083       vg[i]=0;
00084       return true;
00085     }
00086   }
00088   return false; 
00089 } 

boolc gobjContainer::kill ( uintc  k  ) 

Sets vg[k] to 0.

Useful for mixed memory situations.

Definition at line 66 of file gobjbase.cpp.

References vg.

Referenced by diskinttest::update03().

00067 { 
00068   assert(k<vg.size());
00069   if (k>=vg.size()) 
00070     return false; 
00071   vg[k]=0; 
00073   return true; 
00074 } 

void gobjContainer::nuke (  ) 
void gobjContainer::push ( gobj g  )  [inline]

Add graphics objects to vg.

Definition at line 216 of file gobjbase.h.

References vg.

Referenced by ruler::addAngleRuler(), protractor::addAxes(), protractor::addCircles(), protractor::addCirclesText(), plotpolar::addcrosses(), menusystem::addfont10(), menusystem::addfont10start(), menusystem::addfont12(), menusystem::addfont12start(), primitiveWindow::addline(), addpointinsidemesh(), plotpolar::addpoints(), addrandompointtomesh(), graphicsImmediateDeferredTestTri::addshape01(), graphicsImmediateDeferredTestTri::addshape02(), ruler::addStraightRuler(), pointsurface< T, G >::addsurface2D(), pointsurface< T, G >::addsurface3D(), simplexD1tessapp01::createdisplay(), d2simplextest::d2simplextest(), tetrahedrondraw< T, D >::displaybase(), tessD2disp02< TESS, PT, INDX >::displaycircles(), tetrahedrondraw< T, D >::displayedges(), displaylist(), tessD2disp02< TESS, PT, INDX >::displaymesh(), tessD2disp02< TESS, PT, INDX >::displaymulticolor(), tessD2disp02< TESS, PT, INDX >::displaypoints(), tessD2disp02< TESS, PT, INDX >::displaysimplexindex(), tetrahedrondraw< T, D >::displaywinding(), tessD1draw01simplexindexes< TESS, PT >::draw(), tessD1draw01lines< TESS, PT >::draw(), tessD1draw01linesmulticolor< TESS, PT >::draw(), tessD1draw01points< TESS, PT >::draw(), triangledisplaygergonnepoint< TR >::draw(), triangledisplayincenter< TR >::draw(), triangledisplaycircumcenter< TR >::draw(), triangledisplayorthocenter< TR >::draw(), triangledisplaycentroid< TR >::draw(), triangledisplaybisectpoints< TR >::draw(), triangledisplaymidpoints< TR >::draw(), triangledisplaymesh< TR >::draw(), triangledisplayfermatpoint< TR >::draw(), triangledisplaynapoleanpoint< TR >::draw(), tetrahedrondisplaycentroid< TET >::draw(), tetrahedrondisplaymesh< TET >::draw(), tetrahedrondisplaytest< TET >::draw(), tessD2draw02simplexindex< TESS, PT, INDX >::draw(), tessD2draw02points< TESS, PT >::draw(), tessD2draw02multicolor< TESS, PT, INDX >::draw(), tessD2draw02circles< TESS, PT, INDX >::draw(), regionD2tessdisplaymesh< TS, Indx >::draw(), regionD2tessdisplaypoints< TS, Indx >::draw(), writemulticolorobj::draw(), writevoronoidiagramobj::draw(), writesimplicesobj::draw(), writepointsobj::draw(), tessD2disp01< PT >::eval(), polytopeD2tessdisp01< VPTS, VPOLY >::eval(), graphicsImmediateDeferredTestTri::graphicscreate02(), test07::keyboard(), pointsdisplay2D< T >::pointsdisplay2D(), pointsdisplay3D< T >::pointsdisplay3D(), pointsurface< T, G >::pointsurface(), pointsgraph_axes_circle::push(), pushcallback(), graphicsImmediateDeferredSwitch::pushimmediate(), plotpolartest::test01(), planeinttest::test01(), diskinttest::test01(), pointsurfacetest::test01(), gobjdebug01test::test01(), simplexD2tessapp01::test02(), pointsurfacetest::test02(), gobjdebug01test::test02(), delaunaysimpleD2test::test02(), test02(), pointsurfacetest::test03(), gobjdebug01test::test03(), test03(), treeindexedD2test::test05(), test05(), partitionstest::test06(), cpsphere::update(), bsptreeD2dispregions01< PT, PD, INDX >::update(), bsptreeD2disp03< PT, PD, INDX >::update(), bsptreeD2disp02< PT, PD, INDX >::update(), bsptreeD2disp01< PT, PD, INDX >::update(), pointgrid3Ddraw::update(), pointgrid3Dbilineardraw::update(), pathlinesegdraw::update(), arcdraw::update(), diskinttest::update01(), circleD2test::update01(), boxOBBhalfspaceD2test::update01(), diskinttest::update02(), diskinttest::update03(), diskinttest::update03lineline(), and writearcgeometry().

00217     { assert(g!=0); vg.push_back(g); }

template<class T >
void gobjContainer::pushcallback ( T data_,
void(T::*)()  fn_ 
) [inline]

Add a callback function.

Definition at line 220 of file gobjbase.h.

References push().

Referenced by graphicsImmediateDeferredTestTri::graphicscreate07().

00221    { push(new gobjcallback<T>(data_,fn_)); }

void gobjContainer::set (  )  [inline]

Make the current container the container where all the global graphics is written to.

Definition at line 177 of file gobjbase.h.

References gobj::global.

Referenced by bsptree001::bsptree001(), buttonpanel01test::buttonpanel01test(), d2simplextest::d2simplextest(), visenv::defaultgraphics(), tessD2draw02multicolor< TESS, PT, INDX >::draw(), test07::eval(), test06::eval(), test05::eval(), test01obj< P, PD >::eval(), main(), maze001::maze001(), maze002::maze002(), maze003::maze003(), maze004::maze004(), maze005::maze005(), menusystemtest01::menusystemtest01(), menusystemtest02::menusystemtest02(), menusystemtest03::menusystemtest03(), menusystemtest04::menusystemtest04(), d3tessdraw::meshupdate(), openwindowresource::openwindowresource(), pathlinesegtest::pathlinesegtest(), cubegui::prog01(), simplexD1tessapp01::simplexD1tessapp01(), gobjtest::test001(), windowscaleD2test::test002(), graphmisctest::test002(), gobjtest::test002(), gobjtest::test003(), helixtestscope::helixtest::test01(), quickhull3Dtest::test01(), triangletest::test01(), tetrahedrontest::test01(), plotpolartest::test01(), planeinttest::test01(), diskinttest::test01(), circleD2test::test01(), boxOBBhalfspaceD2test::test01(), triangles3Tdisplaytest::test01(), pointsurfacetest::test01(), menusystemtest::test01(), graphicsImmediateDeferredTest::test01(), delaunaysimpleD2test::test01(), test01obj< P, PD >::test01obj(), helixtestscope::helixtest::test02(), spiralindextest::test02(), snakesorttest::test02(), simplexD2tessapp01::test02(), quickhull2Dtest::test02(), triangletest::test02(), tetrahedrontest::test02(), diskinttest::test02(), triangles3Tdisplaytest::test02(), pointsurfacetest::test02(), menusystemtest::test02(), graphicsImmediateDeferredTest::test02(), delaunaysimpleD2test::test02(), regionD2linkedtest::test02(), polytopesD2linkedtest::test02(), meshpatchtest::test02(), test02(), helixtestscope::helixtest::test03(), snakesorttest::test03(), triangletest::test03(), diskinttest::test03(), triangles3Tdisplaytest::test03(), pointsurfacetest::test03(), graphicsImmediateDeferredTest::test03(), regionD2linkedtest::test03(), polytopesD2linkedtest::test03(), treeindexedD2test::test03(), meshpatchtest::test03(), test03(), spiralindextest::test04(), triangles3Tdisplaytest::test04(), graphicsImmediateDeferredTest::test04(), polytopesD2linkedtest::test04(), meshpatchtest::test04(), triangles3Tdisplaytest::test05(), graphicsImmediateDeferredTest::test05(), treeindexedD2test::test05(), partitionstest::test06(), quickhull2Dtest::test06(), graphicsImmediateDeferredTest::test06(), graphicsImmediateDeferredTest::test07(), and graphicsImmediateDeferred::update().

00178     { gobj::global = this; }

Member Data Documentation

Default true to delete vg[i].

Definition at line 195 of file gobjbase.h.

Referenced by displaylist(), nuke(), and gobjContainerSwitch::push().

Push and pop the graphic context/stream.

Definition at line 181 of file gobjbase.h.

Referenced by globalpop(), and globalpush().

The documentation for this class was generated from the following files:

Generated on 27 Nov 2012 for Chelton Evans Source by  doxygen 1.6.1