Example showing drawing using GINOGRAF

/*     Program GRAFEX5 */
/* ********************************************** */
/* Copyright Bradly Associates Limited */
/*        GINOGRAF  Version 6.0 */
/* ********************************************** */

#include <gino-c.h>
#include <graf-c.h>
#include <math.h>

#define MIN(x,y)	((x) < (y) ? (x) : (y))

#define NUMX 30
#define NUMY 20

GVECTOR vectors[NUMX][NUMY];
GDIM paper;
GLIMIT pframe = {50.0,950.0,50.0,710.0},
       vframe = {1.0,30.0,1.0,20.0},
       frame1 = {10.0,990.0,50.0,740.0},
       frame2 = {15.0,985.0,55.0,735.0};

#if defined(MWIN) || defined(WOGL)
int PASCAL WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
			 LPSTR lpszCmdParam, int nCmdShow)
#else
int main ()
#endif
{
/*  Declare local variables */

      int i,j,ip,fill[8],line[8];
      float factor,cw,ch;
      float vals1[NUMX],vals2[NUMX],vals3[NUMX];

/*  Enter GINO-C & initialise device */

      gOpenGino();
/* Nominate the device */
#if defined(MWIN)
  gMwin(hInstance, hPrevInstance);
#elif defined(WOGL)
  gWogl(hInstance, hPrevInstance);
#elif defined(XWIN)
  gXwinw(1,0,0,0,0,0);
#elif defined(GLX)
  gGlxw(1,0,0,0,0,0);
#elif defined(VGA)
  gVga();
#else
  xxxxx();
#endif

      gEnqDrawingLimits(&paper,&ip);
      factor=MIN(paper.xpap/1000.0,paper.ypap/750.0);
      gDefinePictureUnits(factor);
      gNewDrawing();
      ggRestoreAxesSettings();
      cw = 7.5;
      ch = 7.5;
      gSetCharSize(cw,ch);
      ggSetPlotFrame(&pframe);

      ggSetAxesPos(GAXISSTART,250.0,100.0,500.0,GXAXIS);
      ggSetAxesPos(GAXISSTART,250.0,100.0,550.0,GYAXIS);
      ggSetAxesScaling(GLINEARTYPE3,31,0.0,31.0,GXAXIS);
      ggSetAxesScaling(GLINEARTYPE3,21,0.0,21.0,GYAXIS);
      ggSetAxesAttribs(GONAXIS,0.0,0,3,0.0,0.0,GDEFAULTPOSITION,GDEFAULTPOSITION,GNOREDUCE,GXAXIS);
      ggSetAxesAttribs(GONAXIS,0.0,0,1,0.0,0.0,GDEFAULTPOSITION,GDEFAULTPOSITION,GNOREDUCE,GYAXIS);
      ggDrawAxes(GCARDINAL,GCLOCKWISE,GCLOCKWISE,GXAXIS);
      ggDrawAxes(GCARDINAL,GANTICLOCKWISE,GANTICLOCKWISE,GYAXIS);
      ggAddGrid(GNONE,GNONE,GNOGRID,GNOGRID);

/*  Load in vector fields values */

      for (j=0; j<NUMY; j++) {
        for (i=0; i<NUMX; i++) {

          vectors[i][j].direc=360.0*sin(((float) (i+1))/10.0)*cos(((float) (j+1))/10.0);
          vectors[i][j].stren=fabs(vectors[i][j].direc)/50.0;
          vectors[i][j].col=(int) vectors[i][j].stren+2.5;

         }
       }

      for (i=0; i<NUMX; i++ ) {
        vals1[i]=vectors[i][9].direc;
        vals2[i]=vectors[i][9].stren;
        vals3[i]=(float) vectors[i][9].col;
        if(i < 8){
          fill[i]=0;
          line[i]=i+2;
        }
      }

      ggSetVectorChartFrame(&vframe);
      ggSetVectorLimits(0.0,10.5);
      ggSetVectorAttribs(GMIDDLE,-3.0,7.5,1.0);
      ggAddVectors(NUMX,NUMY,(GVECTOR*)vectors,GSOLID);

      ggSetTextChartAttribs(40.0,550.0,0,0,0);
      ggDisplayFillColumn(60.0,650.0,8,fill,line,"*.");
      ggSetAxesAnnotation(-1,0,0,GYAXIS);
      ggDisplayGeneratedColumn(100.0,650.0,8,9.0,2.0,"*.");
      ggDisplayGeneratedColumn(140.0,650.0,8,10.0,3.0,"*.");

      ggSetAxesAnnotation(-2,0,0,GYAXIS);
      ggSetTextChartAttribs(60.0,550.0,0,0,0);
      ggDisplayValueColumn(800.0,650.0,NUMX,vals1,"*.");
      ggSetTextChartAttribs(50.0,550.0,0,0,0);
      ggDisplayValueColumn(860.0,650.0,NUMX,vals2,"*.");
      ggSetTextChartAttribs(30.0,550.0,0,0,0);
      ggSetAxesAnnotation(0,0,0,GYAXIS);
      ggDisplayValueColumn(910.0,650.0,NUMX,vals3,"*.");

      gSetCharSize(4.0*cw,4.0*ch);
      gSetLineColour(GRED);
      ggDrawGraphTitle("*f015Fluid Flow Assessment",GCENTRE,GTOP);

/*  Draw frame */

      gSetLineColour(GCYAN);
      gFillRect(GHOLLOW,GCURRENT,&frame1);
      gFillRect(GHOLLOW,GCURRENT,&frame2);
      gMoveTo2D(305.0,20.0);
      gSetCharSize(2.0*cw,2.0*ch);
      gDisplayStr("GINOGRAF Example Program 5");

/*  Close down device & leave GINO-C */

      gSuspendDevice();
      gCloseGino();

/*  Close Program */
      return 0;
}