コード例 #1
0
void
avtLabelPlot::CustomizeMapper(avtDataObjectInformation &doi)
{
    //
    // Tell the renderer the variable that we care about.
    //
    renderer->SetVariable(varname);

    //
    // Tell the renderer whether to treat the label data as ASCII.
    //
    if (doi.GetAttributes().ValidVariable(varname))
    {
        renderer->SetTreatAsASCII(doi.GetAttributes().GetTreatAsASCII(varname));
    }
    else 
    {
        // Could not get the information so set the flag to false.
        renderer->SetTreatAsASCII(false);
    }

    // Tell the renderer about the cell and node origin.
    renderer->SetCellOrigin(doi.GetAttributes().GetCellOrigin());
    renderer->SetNodeOrigin(doi.GetAttributes().GetNodeOrigin());

    //
    // Tell the renderer whether the data is 3D or not so it can make
    // some 2D optimizations.
    //
    renderer->Set3D(doi.GetAttributes().GetSpatialDimension() == 3);

    //
    // Set the dataset's extents into the renderer so we can create
    // 2D label bins in world space.
    //
    // These also returned values that might also work.
    // GetCumulativeCurrentSpatialExtents
    // GetSpatialExtents
    // GetAnySpatialExtents
    double e[6] = {0.,1.,0.,1.,0.,1.};
    doi.GetAttributes().GetOriginalSpatialExtents()->CopyTo(e);
    renderer->SetExtents(e);

    bool ugl = atts.GetVarType() == LabelAttributes::LABEL_VT_MATERIAL ||
               atts.GetVarType() == LabelAttributes::LABEL_VT_SUBSET;
    renderer->SetUseGlobalLabel(ugl);

    debug4 << "avtLabelPlot::CustomizeMapper: Labels = " << endl;
    std::vector<std::string> labels;
    doi.GetAttributes().GetLabels(labels);
    for(size_t i = 0; i < labels.size(); ++i)
        debug4 << "\tlabel["<<i<<"] = " << labels[i].c_str() << endl;
    debug4 << endl;
}
コード例 #2
0
void
avtContourPlot::CustomizeMapper(avtDataObjectInformation &info)
{
    std::vector<std::string> isoValues;
    info.GetAttributes().GetLabels(isoValues);

    if (!isoValues.empty())
    {
        levelsLegend->SetLevels(isoValues);
        levelsLegend->SetColorBarVisibility(1);
        levelsLegend->SetMessage(NULL);
    }
    else
    { 
        levelsLegend->SetColorBarVisibility(0);
        levelsLegend->SetMessage("Unable to compute levels");
    }
}