Plugins/PointSprite/ParaViewPlugin/Qvis/ColorTableAttributes.cpp
void
ColorTableAttributes::RemoveColorTable(int index)
{
    if(index >= 0 && index < static_cast<int>(names.size()))
    {
        // Determine if the color table is active.
        bool isActiveContinuous, isActiveDiscrete;
        isActiveContinuous = (names[index] == activeContinuous);
        isActiveDiscrete = (names[index] == activeDiscrete);

        // Iterate through the vector "index" times. 
        stringVector::iterator pos = names.begin();
        for(int i = 0; i < index; ++i)
            ++pos;

        // If pos is still a valid iterator, remove that element.
        if(pos != names.end())
        {
            names.erase(pos);
        }

        // Indicate that things have changed by selecting the list.
        Select(0, (void *)&names);

        // erase the color table from the vector.
        RemoveColorTables(index);

        // If it is the active color table that was removed, reset the
        // active color table to the first element.
        if(isActiveContinuous)
        {
            if(names.size() > 0)
                SetActiveContinuous(names[0]);
            else
                SetActiveContinuous(vtkstd::string(""));
        }
        if(isActiveDiscrete)
        {
            if(names.size() > 0)
                SetActiveDiscrete(names[0]);
            else
                SetActiveDiscrete(vtkstd::string(""));
        }
    }
}
// ****************************************************************************
// Method: ColorTableAttributes::RemoveColorTable
//
// Purpose: 
//   Removes the color table at the specified list index.
//
// Arguments:
//   index : The index of the color table we want to remove.
//
// Programmer: Brad Whitlock
// Creation:   Sat Jun 16 20:37:03 PST 2001
//
// Modifications:
//   Brad Whitlock, Wed Nov 20 12:08:18 PDT 2002
//   Made it work with the new discrete color tables.
//
// ****************************************************************************
:RemoveColorTable
Purpose:
Removes the color table at the specified list index.

index : The index of the color table we want to remove.

Brad Whitlock
Creation:   Sat Jun 16 20:37:03 PST 2001

Brad Whitlock, Wed Nov 20 12:08:18 PDT 2002
Made it work with the new discrete color tables.
: RemoveColorTable Purpose : Removes the color table at the specified list index . index : The index of the color table we want to remove . Brad Whitlock Creation : Sat Jun 16 20 : 37 : 03 PST 2001 Brad Whitlock Wed Nov 20 12 : 08 : 18 PDT 2002 Made it work with the new discrete color tables .
void
ColorTableAttributes::RemoveColorTable(int index)
{
    if(index >= 0 && index < static_cast<int>(names.size()))
    {
        bool isActiveContinuous, isActiveDiscrete;
        isActiveContinuous = (names[index] == activeContinuous);
        isActiveDiscrete = (names[index] == activeDiscrete);
        stringVector::iterator pos = names.begin();
        for(int i = 0; i < index; ++i)
            ++pos;
        if(pos != names.end())
        {
            names.erase(pos);
        }
        Select(0, (void *)&names);
        RemoveColorTables(index);
        if(isActiveContinuous)
        {
            if(names.size() > 0)
                SetActiveContinuous(names[0]);
            else
                SetActiveContinuous(vtkstd::string(""));
        }
        if(isActiveDiscrete)
        {
            if(names.size() > 0)
                SetActiveDiscrete(names[0]);
            else
                SetActiveDiscrete(vtkstd::string(""));
        }
    }
}
void ColorTableAttributes :: RemoveColorTable ( int index ) { if ( index >= 0 && index < static_cast < int > ( names . size ( ) ) ) { bool isActiveContinuous , isActiveDiscrete ; isActiveContinuous = ( names [ index ] == activeContinuous ) ; isActiveDiscrete = ( names [ index ] == activeDiscrete ) ; stringVector :: iterator pos = names . begin ( ) ; for ( int i = 0 ; i < index ; ++ i ) ++ pos ; if ( pos != names . end ( ) ) { names . erase ( pos ) ; } Select ( 0 , ( void * ) & names ) ; RemoveColorTables ( index ) ; if ( isActiveContinuous ) { if ( names . size ( ) > 0 ) SetActiveContinuous ( names [ 0 ] ) ; else SetActiveContinuous ( vtkstd :: string ( " " ) ) ; } if ( isActiveDiscrete ) { if ( names . size ( ) > 0 ) SetActiveDiscrete ( names [ 0 ] ) ; else SetActiveDiscrete ( vtkstd :: string ( " " ) ) ; } } }
Method: ColorTableAttributes::RemoveColorTable
Purpose:
Removes the color table at the specified list index.
Method : ColorTableAttributes :: RemoveColorTable Purpose : Removes the color table at the specified list index .
// Determine if the color table is active. // Iterate through the vector "index" times.  // If pos is still a valid iterator, remove that element. // Indicate that things have changed by selecting the list. // erase the color table from the vector. // If it is the active color table that was removed, reset the // active color table to the first element.