Exemplo n.º 1
0
void  PFO_ColorCubeIsovolumeGL::DrawPlotObject()
{
    if (!InitDrawObject())
        return;

#ifdef _GLPRHARDCOPY_
    if (DoingHardCopy())
    {
        int glpNum = vertexCount;
        glpBegin(GLP_3D_COLOR, glpNum);
        objectBase->SetHardCopyParameters();
    }
#endif

    vertexCount = 0;
    SetColors();
    for (int i = 0; i < triToPlot.Size(); i++)
    {
        DoPoly(i);
        vertexCount += isoCalc.polyCoords.Size();
    }
    GL_Base::HardCopyBlockEnd();

    CloseDrawObject();
}
Exemplo n.º 2
0
void OGL2DBase::SetLineAntiAlias()
{
    if (PS_OGLBase::Get2DAntiAliasLines() && (!DoingHardCopy()))
    {
        glEnable(GL_LINE_SMOOTH);

        glEnable(GL_BLEND);
        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

        glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
    }

}
Exemplo n.º 3
0
void  PFO_CubeColorBlockGL :: DrawPlotObject()
{
    if (!InitDrawObject())
        return;

#ifdef _GLPRHARDCOPY_
    if (DoingHardCopy())
    {
        int glpNum = vertexCount;
        if (edgeSpec.plotEdges)
        {
            glpNum += polygonCount * 2;
            GL_Line::SetLine(edgeSpec.edgeThk);
        }
        glpBegin(GLP_3D_COLOR, glpNum);
        objectBase->SetHardCopyParameters();
    }
    bool doGprGroup = DoingHardCopy() && edgeSpec.plotEdges;
#endif


    polygonObj.SetPolygonFilled(polyOffset);
    SC_CoordArray topCoords, bottomCoords, sides;
    sides.AllocAndSetSize(4);

    vertexCount = 0;
    polygonCount = 0;

    SC_IntArray& currIndx = GetIndexes();

    double polyReduction = reductionFactor;
    if (DoingVRMLOutput())
        polyReduction *= objectBase->GetVRMLEdgeFactor();

    for (int i = 0; i < colorMap->ncolorMap; i++)
    {
        SC_ColorSpec polyColor = colorMap->GetColor(i);

        for (int j = 0; j < currIndx.Size(); j++ )
        {
            if (cubeColors[j] != i)
                continue;

            GetCoords(currIndx[j], topCoords, bottomCoords, polyReduction);

            vertexCount += topCoords.Size() * 6;
            polygonCount += topCoords.Size() + 2;

            // all polys
            polygonObj.SetPolygonFilled(polyOffset);


            // use best approach if not hard copy
            if (!DoingHardCopy())
            {
                polygonObj.SetColor(polyColor);
                polygonObj.DrawPolygon(topCoords, bottomCoords);

                if (edgeSpec.plotEdges)
                {
                    if (DoingVRMLOutput())
                        GetCoords(currIndx[j], topCoords, bottomCoords, reductionFactor);

                    polygonObj.SetColor(edgeSpec.edgePen);
                    polygonObj.SetPolygonLine(edgeSpec.edgeThk, edgeSpec.edgePolyOffset);
                    polygonObj.DrawPolygon(topCoords, bottomCoords);
                }
                continue;
            }


            //  hard copy case only

#ifdef _GLPRHARDCOPY_
            // draw top poly
            if (doGprGroup)
            {
                GL_Polygon::SetColor(edgeSpec.edgePen);
                glpBeginGroup(GLP_OVERLAY_GROUP);
            }

            GL_Polygon::SetColor(polyColor);
            polygonObj.DrawPolygon(topCoords);

            if (doGprGroup)
                glpEndGroup();

            if (doGprGroup)
            {
                GL_Polygon::SetColor(edgeSpec.edgePen);
                glpBeginGroup(GLP_OVERLAY_GROUP);
            }

            GL_Polygon::SetColor(polyColor);
            polygonObj.DrawPolygon(bottomCoords);

            if (doGprGroup)
                glpEndGroup();

            // all sides
            for (int k = 0; k <  topCoords.Size(); k++)
            {
                sides[0] = topCoords[k];
                if (k == 0)
                {
                    sides[1] = topCoords.LastIndex();
                    sides[2] = bottomCoords.LastIndex();
                }
                else
                {
                    sides[1] = topCoords[k - 1];
                    sides[2] = bottomCoords[k - 1];
                }
                sides[3] = bottomCoords[k];

                if (doGprGroup)
                {
                    GL_Polygon::SetColor(edgeSpec.edgePen);
                    glpBeginGroup(GLP_OVERLAY_GROUP);
                }

                GL_Polygon::SetColor(polyColor);
                polygonObj.DrawPolygon(sides);

                if (doGprGroup)
                    glpEndGroup();

            }

#endif
        }
    }

    GL_Base::HardCopyBlockEnd();

    CloseDrawObject();
}
Exemplo n.º 4
0
void PFO_CovarLimitsGL::Draw2D()
{
    GL_Line::SetColor(covarPen);
    GL_Line::SetLine(covarLineThk);
    if (covarPlotType == cptSingle)
    {
        SC_PointArray st, end;
        GL_Line currLine;
        for (int i = 0; i < covarArrayDC->Size(); i++)
            if (Get2DSingle(i, st, end))
            {
                currLine.DrawLines(st, end);
            }
    }
    else
    {
        SC_PointArray ell, polyPoints;
        if (covarPlotFormat  == cpfFill)
        {
            GL_Polygon::SetColor(covarPen);
            covarPoly.SetPolygonFilled(polyOffset);
            polyPoints.Alloc(4);
        }

        for (int i = 0; i < covarArrayDC->Size(); i++)
            if (Get2DDual(i, ell))
            {
                if (covarPlotFormat  == cpfFill)
                {
                    GL_Polygon covarPoly;
                    int maxpt = ell.UpperBound();
                    int nhalf = ell.Size() / 2;
                    int npoly = nhalf - 1;

#ifdef _GLPRHARDCOPY_
                    if (DoingHardCopy())
                    {
                        int glpNum = 4 * npoly;  //4 points in each polygon
                        glpBegin(GLP_3D_COLOR, glpNum);
                        objectBase->SetHardCopyParameters();
                    }
#endif

                    for (int j = 0; j < npoly; j++)
                    {
                        polyPoints.SetSize(3);
                        polyPoints[0] = ell[j];
                        polyPoints[1] = ell[j + 1];
                        if (j == 0)
                        {
                            polyPoints[2] = ell[maxpt - 1];
                        }
                        else if (j == (npoly - 1))
                        {
                            polyPoints[2] = ell[maxpt - j];
                        }
                        else
                        {
                            polyPoints.SetSize(4);
                            polyPoints[2] = ell[maxpt - j - 1];
                            polyPoints[3] = ell[maxpt - j];
                        }
                        covarPoly.DrawPolygon(polyPoints);
                    }
                    GL_Base::HardCopyBlockEnd();
                }
                else
                {
                    GL_Line covarLine;
                    covarLine.DrawLines(ell);
                }
            }
    }
}
Exemplo n.º 5
0
void PFO_CovarLimitsGL::Draw3DEllipse(const SC_CoordArray& ell)
{
    switch (covarPlotFormat)
    {
        case cpfLine : {
            GL_Line covarLine;
            covarLine.DrawLines(ell);
            break;
        }
        case cpfFill : {
            GL_Polygon::SetColor(covarPen);
            covarPoly.SetPolygonFilled(polyOffset);

            SC_CoordArray polyCoords(4);

            int maxpt = ell.UpperBound();
            int nhalf = ell.Size() / 2;
            int npoly = nhalf - 1;

#ifdef _GLPRHARDCOPY_
            if (DoingHardCopy())
            {
                int glpNum = 4 * npoly;  //4 points in each polygon
                glpBegin(GLP_3D_COLOR, glpNum);
                objectBase->SetHardCopyParameters();
            }
#endif
            for (int j = 0; j < npoly; j++)
            {
                polyCoords.SetSize(3);
                polyCoords[0] = ell[j];
                polyCoords[1] = ell[j + 1];
                if (j == 0)
                {
                    polyCoords[2] = ell[maxpt - 1];
                }
                else if (j == (npoly - 1))
                {
                    polyCoords[2] = ell[maxpt - j];
                }
                else
                {
                    polyCoords.SetSize(4);
                    polyCoords[2] = ell[maxpt - j - 1];
                    polyCoords[3] = ell[maxpt - j];
                }
                covarPoly.DrawPolygon(polyCoords);
            }
            GL_Base::HardCopyBlockEnd();

            break;
        }
        case cpfTube : {
            PSC_EdgeSpec noEdges;
            noEdges.plotEdges = false;
            GL_Extrusion tubeExt(polyOffset, assocPlot->defaultPenSet->GetColor(covarPen), noEdges);
            tubeExt.DrawExtrusion(ell, tubeData);
            break;
        }

    }
}