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

lvert_strip.C

Go to the documentation of this file.
00001 /**********************************************************************
00002  * lvert_strip.C:
00003  **********************************************************************/
00004 
00005 
00006 #include "lvert_strip.H"
00007 #include "lmesh.H"
00008 
00009 int
00010 LvertStrip::cur_level() const
00011 {
00012   if ( _verts.empty() )
00013     return 0;
00014 
00015    return  lv(0)->lmesh()->rel_cur_level();
00016 }
00017 
00018 void
00019 LvertStrip::draw(int level, StripCB* cb)
00020 {
00021    if (level < 1)
00022       VertStrip::draw(cb);      // draw this one
00023    else {
00024       generate_substrip();      // draw the substrip (or lower)
00025       _substrip->draw(level-1, cb);
00026    }
00027 }
00028 
00029 void
00030 LvertStrip::generate_substrip()
00031 {
00032    // the convention is: if the substrip is allocated,
00033    // it's also filled in w/ data
00034    if (_substrip)
00035       return;   // all set
00036 
00037    // allocate it ...
00038    _substrip  = new LvertStrip;
00039 
00040    // ... and fill it in
00041    for (int i=0; i<_verts.num(); i++) {
00042      if (((Lvert*)_verts[i])->subdiv_vertex()) {
00043       _substrip->add(((Lvert*)_verts[i])->subdiv_vertex());
00044      }
00045    }
00046 }
00047 
00048 void 
00049 LvertStrip::clear_subdivision(int level) 
00050 {
00051    // Subdivision elements at the given level have been deleted.
00052    // The strip one level above should delete its substrip.
00053    // If level == 0 the strip is invalidated.
00054 
00055    if (level <= 0) {
00056       delete_substrip();
00057       reset();
00058    } else if (level == 1) {
00059       delete_substrip();
00060    } else if (_substrip) {
00061       _substrip->clear_subdivision(level - 1);
00062    }
00063 }
00064 
00065 /* end of file lvert_strip.C */

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