Beispiel #1
0
void PointImp::draw()
{
   LocationType pixelSize(1.0, 1.0);

   PlotViewImp* pPlot = dynamic_cast<PlotViewImp*> (getPlot());
   if (pPlot != NULL)
   {
      pixelSize = pPlot->getPixelSize();
   }

   draw(pixelSize);
}
Beispiel #2
0
void PointSetImp::draw()
{
   if (isVisible() == false)
   {
      return;
   }

   if (mPoints.size() == 0)
   {
      return;
   }

   // Line
   if (mLine == true)
   {
      PlotViewImp* pPlot = getPlot();
      VERIFYNRV(pPlot != NULL);

      if (pPlot->isShadingEnabled() == false)
      {
         glColor3ub(mLineColor.red(), mLineColor.green(), mLineColor.blue());
         glShadeModel(GL_FLAT);
      }
      else
      {
         glShadeModel(GL_SMOOTH);
      }
      glLineWidth(mLineWidth);

      if (mLineStyle != SOLID_LINE)
      {
         glEnable(GL_LINE_STIPPLE);

         if (mLineStyle == DASHED)
         {
            glLineStipple(3, 0x3f3f);
         }
         else if (mLineStyle == DOT)
         {
            glLineStipple(2, 0x1111);
         }
         else if (mLineStyle == DASH_DOT)
         {
            glLineStipple(2, 0x11ff);
         }
         else if (mLineStyle == DASH_DOT_DOT)
         {
            glLineStipple(2, 0x24ff);
         }
      }

      glBegin(GL_LINE_STRIP);

      double dWorldX = 0.0;
      double dWorldY = 0.0;

      vector<Point*>::iterator iter = mPoints.begin();
      while (iter != mPoints.end())
      {
         Point* pPoint = NULL;
         pPoint = *iter;
         if (pPoint != NULL)
         {
            const LocationType& point = pPoint->getLocation();
            pPlot->translateDataToWorld(point.mX, point.mY, dWorldX, dWorldY);
            if (pPlot->isShadingEnabled() == true)
            {
               ColorType color = pPoint->getColor();
               glColor3ub(color.mRed, color.mGreen, color.mBlue);
            }
            glVertex2d(dWorldX, dWorldY);
         }

         ++iter;
      }

      glEnd();

      if (mLineStyle != SOLID_LINE)
      {
         glDisable(GL_LINE_STIPPLE);
      }

      glLineWidth(1);

      // Turn the shade model back to flat to not impact other types of plot objects
      glShadeModel(GL_FLAT);
   }
   
   // Points
   LocationType pixelSize(1.0, 1.0);

   PlotViewImp* pPlot = dynamic_cast<PlotViewImp*> (getPlot());
   if (pPlot != NULL)
   {
      pixelSize = pPlot->getPixelSize();
   }

   vector<Point*>::iterator iter = mPoints.begin();
   while (iter != mPoints.end())
   {
      PointAdapter* pPoint = NULL;
      pPoint = static_cast<PointAdapter*> (*iter);
      if (pPoint != NULL)
      {
         if ((mSymbols == true) || (mLine == false) || (pPoint->isSelected() == true))
         {
            pPoint->draw(pixelSize);
         }
      }

      ++iter;
   }
}