Beispiel #1
0
// del a new geometry object from the list with the given index. Return success.
// if n < 0, delete all markers
int GeometryList::del_geometry(int glindex, int n) {

  // make sure the given GeometryMol object is OK
  if(glindex >= 0 && glindex < num_lists()) {

    // get the list of geometry objects for the given index
    GeomListPtr glist = geom_list(glindex);

    // make sure the geometry index is ok
    if(n >= 0 && n < glist->num())  {
      // delete and remove the geometry object
      delete (*glist)[n];
      glist->remove(n);
      
      // indicate we were successful
      return TRUE;
    } else if(n < 0) {
      // delete and remove all geometry objects
      for(int j=(glist->num() - 1); j >= 0; j--) {
        delete (*glist)[j];
        glist->remove(j);
      }
      
      // indicate we were successful
      return TRUE;
    }
  }
  
  // if here, something did not work
  return FALSE;
}