Example #1
0
void
ColorTableObserver::Update(Subject *)
{
    ColorTableAttributes *colorAtts = (ColorTableAttributes *)subject;

    // For when we have pixmaps later, here are the rules...
    // 1. if just #0 is ever selected, we're adding/deleting colortables.
    // 2. If just #1 is selected , we're modifying a color table.
    // 3. If just #2 is selected, we're changing the default colormap. This is
    //    only of concern if I decide to show what the default is in a widget.

    // If the names or the color table attributes are changing, then we
    // have to update the widget.
    if(colorAtts->IsSelected(ColorTableAttributes::ID_names) ||
       colorAtts->IsSelected(ColorTableAttributes::ID_colorTables))
    {
        // Clear all of the color tables.
        QvisColorTableButton::setColorTableAttributes(colorAtts);
        QvisColorTableButton::clearAllColorTables();

        int nNames = colorAtts->GetNames().size();
        const stringVector &names = colorAtts->GetNames();
        for(int i = 0; i < nNames; ++i)
        {
            QvisColorTableButton::addColorTable(names[i].c_str());
        }

        // Update all of the QvisColorTableButton widgets.
        QvisColorTableButton::updateColorTableButtons();
    }
}
void
ContourViewerPluginInfo::InitializeDefaultPalette(ContourAttributes *contour)
{
    // Copy over the contour's defaultPalette with the default discrete
    // color table from avtColorTable.
    if(contour->GetColorType() != ContourAttributes::ColorByMultipleColors ||
       contour->GetDefaultPalette().GetNumControlPoints() < 1)
    {
        avtColorTables *ct = avtColorTables::Instance();
        ColorTableAttributes *ctAtts = ct->GetColorTables();
        int i = ctAtts->GetColorTableIndex(ct->GetDefaultDiscreteColorTable());
        if(i != -1)
        {
            contour->SetDefaultPalette(ctAtts->operator[](i));
        }
    }
}
void
WellBoreViewerEnginePluginInfo::InitializeDefaultPalette(
    WellBoreAttributes *wellBore)
{
    // Copy over the wellBore's defaultPalette with the default discrete
    // color table from avtColorTable.
    if(wellBore->GetColorType() != WellBoreAttributes::ColorByMultipleColors ||
       wellBore->GetDefaultPalette().GetNumControlPoints() < 1)
    {
        avtColorTables *ct = avtColorTables::Instance();
        ColorTableAttributes *ctAtts = ct->GetColorTables();
        int i = ctAtts->GetColorTableIndex(ct->GetDefaultDiscreteColorTable());
        if(i != -1)
        {
            wellBore->SetDefaultPalette(ctAtts->operator[](i));
        }
    }
}