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
avtVectorGlyphMapper::SetLineStyle(_LineStyle ls)
{
    lineStyle = ls;
    if ( actors == NULL )
    {
        // this occurs when this method called before input is set.
        return;
    }

    for (int i = 0 ; i < nMappers ; i++)
    {
        if (actors[i] != NULL)
        {
            actors[i]->GetProperty()->SetLineStipplePattern(LineStyle2StipplePattern(lineStyle));
        }
    }
}
void
avtCurveLegend::SetLineStyle(_LineStyle ls)
{
    lineLegend->GetLineProperty()->SetLineStipplePattern(LineStyle2StipplePattern(ls));
}
void
avtVectorGlyphMapper::CustomizeMappers(void)
{
    if (setMin)
    {
        SetMin(min);
    }
    else
    {
        SetMinOff();
    }

    if (setMax)
    {
        SetMax(max);
    }
    else
    {
        SetMaxOff();
    }

    //
    // It is probable that the mappers defaults did not actually get set, so
    // explicitly do that here.
    //
    SetMappersMinMax();

    if (glyphFilter != NULL)
    {
        for (int i = 0 ; i < nGlyphFilters ; i++)
        {
            if (glyphFilter[i] != NULL)
            {
                glyphFilter[i]->SetSourceConnection(glyph);
                if (scaleByMagnitude)
                    glyphFilter[i]->SetScaleModeToScaleByVector();
                else
                    glyphFilter[i]->SetScaleModeToDataScalingOff();

                if (GetInput()->GetInfo().GetAttributes().GetSpatialDimension() == 2)
                    glyphFilter[i]->SetTreatVectorsAs2D(1);
            }
            if (normalsFilter[i] != NULL)
            {
                normalsFilter[i]->SetNormalTypeToCell();
            }
        }
    }
         
    if (colorByMag)
    {
        ColorByMagOn();
    }
    else if (colorByScalar)
    {
        ColorByScalarOn(scalarName);
    }
    else
    {
        ColorByMagOff(glyphColor);
    }

    for (int i = 0; i < nMappers; i++)
    {
        if (actors[i] != NULL) 
        {
            mappers[i]->SetLookupTable(lut);
            vtkProperty *prop = actors[i]->GetProperty();
            prop->SetLineStipplePattern(LineStyle2StipplePattern(lineStyle));
            prop->SetLineWidth(LineWidth2Int(lineWidth));
        }
    }

    SetScale(scale);
    SetDefaultRange();
}