void
avtHistogramPlot::SetAtts(const AttributeGroup *a)
{
    const HistogramAttributes *newAtts = (const HistogramAttributes *)a;

    needsRecalculation = atts.ChangesRequireRecalculation(*newAtts);

    atts = *newAtts;

    if (HistogramFilter != NULL)
        HistogramFilter->SetAttributes(*newAtts);

    double rgba[4];
    atts.GetColor().GetRgba(rgba);
    property->SetColor((float)rgba[0], (float)rgba[1], (float)rgba[2]);
    if (atts.GetOutputType() == HistogramAttributes::Block)
    {
        property->SetEdgeColor(fgColor[0], fgColor[1], fgColor[2]);
        property->EdgeVisibilityOn();
        renderer->EdgeLinesOn();
    }
    else
    {
        property->SetEdgeColor((float)rgba[0], (float)rgba[1], (float)rgba[2]);
        property->EdgeVisibilityOff();
        renderer->EdgeLinesOff();
    }
    property->SetLineWidth(LineWidth2Int(Int2LineWidth(atts.GetLineWidth())));
    property->SetLineStipplePattern(
                 LineStyle2StipplePattern(Int2LineStyle(atts.GetLineStyle())));

    behavior->GetInfo().GetAttributes().SetWindowMode(WINMODE_CURVE);
}
Exemple #2
0
void
avtOpenGLCurveRenderer::DrawCurveAsLines()
{
    // Set the curve color.
    ColorAttribute curveColor(atts.GetCurveColor());
    curveColor.SetAlpha(255);
    glColor4ubv(curveColor.GetColor());

    // Set up the line properties.
    glLineWidth(LineWidth2Int(Int2LineWidth(atts.GetLineWidth())));

    // Set the LineStipple
    int stipplePattern = LineStyle2StipplePattern(Int2LineStyle(
        atts.GetLineStyle()));
    if (stipplePattern != 0xFFFF)
    {
        glEnable(GL_LINE_STIPPLE);
        glLineStipple(1, stipplePattern);
    }
    else
    {
        // In case it was set elsewhere
        glDisable(GL_LINE_STIPPLE);
    }

    // Draw the curve.
    glBegin(GL_LINE_STRIP);
    bool lastWasGood = false;
    vtkIdType npts = input->GetPoints()->GetNumberOfPoints();
    for(vtkIdType i = 0; i < npts ; i++)
    {
        double pt[3];
        input->GetPoints()->GetPoint(i, pt);

        if (atts.GetDoCropTimeCue() && atts.GetTimeForTimeCue() < pt[0])
        {
            if (lastWasGood)
            {
                double prev[3];
                input->GetPoints()->GetPoint(i-1, prev);

                double p2[3];
                p2[0] = atts.GetTimeForTimeCue();
                p2[1] = (p2[0]-prev[0])/(pt[0]-prev[0])*(pt[1]-prev[1]) + prev[1];
                p2[2] = 0.;
                glVertex3dv(p2);
            }
            input->GetPoints()->GetPoint(i+1, pt);
            lastWasGood = false;
            continue;
        }
        lastWasGood = true;
        glVertex3dv(pt);
    }
    glEnd();

    if (stipplePattern != 0xFFFF)
        glDisable(GL_LINE_STIPPLE);
}
void avtLineoutActor::SetLineStyle(int ls)
{
    //
    //  Need to convert from gui int to LineStyle to gl line stipple pattern.
    //
    lineActor->GetProperty()->SetLineStipplePattern(
        LineStyle2StipplePattern(Int2LineStyle(ls)));
}
void
avtPseudocolorPlot::SetAtts(const AttributeGroup *a)
{
    const PseudocolorAttributes *newAtts = (const PseudocolorAttributes *)a;

    // See if the colors will need to be updated.
    bool updateColors = (!colorsInitialized) ||
      (atts.GetColorTableName() != newAtts->GetColorTableName()) ||
      (atts.GetInvertColorTable() != newAtts->GetInvertColorTable()) ||
      (atts.GetOpacityType() != newAtts->GetOpacityType()) ||
      (atts.GetOpacityType() == PseudocolorAttributes::Ramp &&
       atts.GetOpacity() != newAtts->GetOpacity());

    // See if any attributes that require the plot to be regenerated were
    // changed and copy the state object.
    needsRecalculation = atts.ChangesRequireRecalculation(*newAtts);
    atts = *newAtts;

    // Update the plot's colors if needed.
    if(updateColors || atts.GetColorTableName() == "Default")
    {
        colorsInitialized = true;
        SetColorTable(atts.GetColorTableName().c_str());
    }
    else
      SetOpacityFromAtts();

    SetLighting(atts.GetLightingFlag());
    SetLegend(atts.GetLegendFlag());

    SetScaling(atts.GetScaling(), atts.GetSkewFactor());
    SetLimitsMode(atts.GetLimitsMode());

    glyphMapper->SetLineWidth(Int2LineWidth(atts.GetLineWidth()));
    glyphMapper->SetLineStyle(Int2LineStyle(atts.GetLineStyle()));
    glyphMapper->SetScale(atts.GetPointSize());

    // ARS - FIX ME  - FIX ME  - FIX ME  - FIX ME  - FIX ME 
    if( atts.GetOpacityType() == PseudocolorAttributes::VariableRange &&
        atts.GetOpacityVariable() != "" &&
        atts.GetOpacityVariable() != "\0")
    {   
      // glyphMapper->SetVariableOpacity(atts.GetOpacity());
      // if( atts.GetOpacityVarMinFlag() )
      //     glyphMapper->SetVariableMinOpacity(atts.GetOpacityVarMin());
      // if( atts.GetOpacityVarMaxFlag() )
      //     glyphMapper->SetVariableMaxOpacity(atts.GetOpacityVarMax());
        if (atts.GetOpacityVariable() == "default")
        { 
//            if (varname != NULL)
//                glyphMapper->ScaleOpacityByVar(varname);
        } 
        else
        { 
//            glyphMapper->ScaleOpacityByVar(atts.GetOpacityVariable());
        } 
    }
    else 
    {
//        glyphMapper->OpacityScalingOff();
    }

    // ARS - FIX ME  - FIX ME  - FIX ME  - FIX ME  - FIX ME 
    if( //(topoDim == 1 || (topoDim > 1 && atts.GetRenderWireframe())) &&
        atts.GetLineType() == PseudocolorAttributes::Tube && 
        atts.GetTubeRadiusVarEnabled() == true  &&
        atts.GetTubeRadiusVar() != "" &&
        atts.GetTubeRadiusVar() != "\0" )
    {
        if (atts.GetTubeRadiusVar() == "default")
        { 
//            if (varname != NULL)
//                glyphMapper->ScaleTubesByVar(varname);
        } 
        else
        { 
//            glyphMapper->ScaleTubesByVar(atts.GetTubeRadiusVar());
        } 
    }
    else 
    {
//        glyphMapper->TubeScalingOff();
    }

    if( //(topoDim == 0 || (topoDim > 0 && atts.GetRenderPoints())) &&
        atts.GetPointType() != PseudocolorAttributes::Point &&
        atts.GetPointType() != PseudocolorAttributes::Sphere &&
        atts.GetPointSizeVarEnabled() &&
        atts.GetPointSizeVar() != "" &&
        atts.GetPointSizeVar() != "\0" )
    {
        if (atts.GetPointSizeVar() == "default")
        { 
            if (varname != NULL)
                glyphMapper->ScaleByVar(varname);
        }
        else
        { 
            glyphMapper->ScaleByVar(atts.GetPointSizeVar());
        } 
    }
    else 
    {
        glyphMapper->DataScalingOff();
    }

    if (atts.GetPointType() == PseudocolorAttributes::Box)
        glyphMapper->SetGlyphType(avtPointGlypher::Box);
    else if (atts.GetPointType() == PseudocolorAttributes::Axis)
        glyphMapper->SetGlyphType(avtPointGlypher::Axis);
    else if (atts.GetPointType() == PseudocolorAttributes::Icosahedron)
        glyphMapper->SetGlyphType(avtPointGlypher::Icosahedron);
    else if (atts.GetPointType() == PseudocolorAttributes::Octahedron)
        glyphMapper->SetGlyphType(avtPointGlypher::Octahedron);
    else if (atts.GetPointType() == PseudocolorAttributes::Tetrahedron)
        glyphMapper->SetGlyphType(avtPointGlypher::Tetrahedron);
    else if (atts.GetPointType() == PseudocolorAttributes::SphereGeometry)
        glyphMapper->SetGlyphType(avtPointGlypher::SphereGeometry);
    else if (atts.GetPointType() == PseudocolorAttributes::Point)
        glyphMapper->SetGlyphType(avtPointGlypher::Point);
    else if (atts.GetPointType() == PseudocolorAttributes::Sphere)
        glyphMapper->SetGlyphType(avtPointGlypher::Sphere);

    SetPointGlyphSize();

    if (varname != NULL)
    {
        glyphMapper->ColorByScalarOn(std::string(varname));
    }
}
Exemple #5
0
void
avtWellBorePlot::SetLineStyle(int ls)
{
    levelsMapper->SetLineStyle(Int2LineStyle(ls));
}
void
avtTopologyPlot::SetLineStyle(int ls)
{
    levelsMapper->SetLineStyle(Int2LineStyle(ls));
}
void
avtContourPlot::SetLineStyle(int ls)
{
    levelsMapper->SetLineStyle(Int2LineStyle(ls));
}
void
avtCurvePlot::SetLineStyle(int ls)
{
    curveLegend->SetLineStyle(Int2LineStyle(ls));
}