- rSGP.setWindow (xl_min, yl_min, xl_max, yl_max);
- rSGP.setViewport (xl_min, yl_min, xl_max, yl_max);
- rSGP.setColor (clr_legend);
- rSGP.drawRect (xl_min, yl_min, xl_max, yl_max);
-
- n = 0; /* current legend position */
- for (EZPlotCurveIterator iterCurve = m_vecCurves.begin(); iterCurve != m_vecCurves.end(); iterCurve++) {
- const EZPlotCurve& curve = **iterCurve;
-
- if (curve.m_sLegend.length() == 0)
- continue;
-
- double xmin = xl_min + 1.0 * charwidth;
- double xmax = xl_max - 1.0 * charwidth;
- double y = yl_max - (2.0 + n * 3) * charheight;
-
- rSGP.moveAbs (xmin, y + 0.5 * charheight);
- rSGP.drawText (curve.m_sLegend);
- rSGP.setColor (curve.m_iColor);
- if (curve.m_iLineStyle != SGP::LS_NOLINE) {
- rSGP.setLineStyle (curve.m_iLineStyle);
- rSGP.moveAbs (xmin, y);
- rSGP.lineAbs (xmax, y);
- }
- if (curve.m_iSymbol > 0) {
- double xinc = (xmax - xmin) / (5 - 1);
- rSGP.setLineStyle (SGP::LS_SOLID);
- for (j = 0; j < 5; j++) {
- rSGP.moveAbs (xmin + j * xinc, y);
- symbol(curve.m_iSymbol, 0.5 * charwidth, 0.5 * charheight);
- }
+ m_pSGP->setColor (clr_legend);
+ m_pSGP->drawRect (xl_min, yl_min, xl_max, yl_max);
+
+ int iLegend = 0; // current legend position
+
+ for (unsigned int iCurve = 0; iCurve < m_vecCurves.size(); iCurve++) {
+ const std::string* pstrLegend = getLegend (iCurve);
+ if (! pstrLegend || pstrLegend->length() == 0)
+ continue;
+
+ double xmin = xl_min + 1.0 * charwidth;
+ double xmax = xl_max - 1.0 * charwidth;
+ double y = yl_max - (2.0 + iLegend * 3) * charheight;
+
+ m_pSGP->moveAbs (xmin, y + 0.5 * charheight);
+
+ m_pSGP->drawText (pstrLegend->c_str());
+ m_pSGP->setColor (getColor (iCurve));
+
+ int iLS = getLinestyle (iCurve);
+ if (iLS != SGP::LS_NOLINE) {
+ m_pSGP->setLineStyle (iLS);
+ m_pSGP->moveAbs (xmin, y);
+ m_pSGP->lineAbs (xmax, y);
+ }
+
+ int iSymbol = getSymbol (iCurve);
+ if (iSymbol > 0) {
+ double xinc = (xmax - xmin) / (5 - 1);
+ m_pSGP->setLineStyle (SGP::LS_SOLID);
+ for (int j = 0; j < 5; j++) {
+ m_pSGP->moveAbs (xmin + j * xinc, y);
+ symbol (iSymbol, symwidth, symheight);
+ }