Beispiel #1
0
int main(int argc,char *argv[]) {

  struct Rplot *rplot=NULL;

  float wdt=400,hgt=400;

  unsigned int bgcol=0xffffffff;
  unsigned int fgcol=0xff000000;

  rplot=RplotMake();
  RplotSetText(rplot,stream,stdout);   
  RplotMakePlot(rplot,"Rplot",wdt,hgt,24);

  RplotRectangle(rplot,NULL,0,0,wdt,hgt,
                  1,bgcol,0x0f,0,NULL);


  RplotBezier(rplot,20,20,0,hgt/2,wdt,hgt/2,wdt-20,hgt-20,
              fgcol,0x0f,1.0,NULL);



  RplotEndPlot(rplot);
  return 0;
}
Beispiel #2
0
int main(int argc,char *argv[]) {

  struct Rplot *rplot=NULL;

  float wdt=400,hgt=400;

  unsigned int bgcol=0xffffffff;
  unsigned int fgcol;

  rplot=RplotMake();
  RplotSetText(rplot,stream,stdout);   
  RplotMakePlot(rplot,"Rplot",wdt,hgt,24);

  fgcol=RplotColorStringRGB("128 128 128");

  RplotRectangle(rplot,NULL,0,0,wdt,hgt,
                  1,bgcol,0x0f,0,NULL);


  RplotRectangle(rplot,NULL,10,10,wdt-20,hgt-20,
                  1,fgcol,0x0f,0,NULL);




  RplotEndPlot(rplot);
  return 0;
}
Beispiel #3
0
int main(int argc,char *argv[]) {

  struct Rplot *rplot=NULL;

  float wdt=400,hgt=400;

  unsigned int bgcol=0xffffffff;
  unsigned int fgcol=0xff000000;
  int x;

  rplot=RplotMake();
  RplotSetText(rplot,stream,stdout);   
  RplotMakePlot(rplot,"Rplot",wdt,hgt,24);

  RplotRectangle(rplot,NULL,0,0,wdt,hgt,
                  1,bgcol,0x0f,0,NULL);


  for (x=0;x<200;x+=10) {
    fgcol=RplotColor(255-x,255-x,255-x,255);
    RplotRectangle(rplot,NULL,x,x,wdt-2*x,hgt-2*x,
                  1,fgcol,0x0f,0,NULL);
  }



  RplotEndPlot(rplot);
  return 0;
}
Beispiel #4
0
int main(int argc,char *argv[]) {

  struct Rplot *rplot=NULL;

  float wdt=400,hgt=400;

  unsigned int bgcol=0xaffffff;
  unsigned int lndcol=0xa0ffa0;
  unsigned int seacol=0xa0a0ff;
 
  MapTransform  tfunc;
  float marg[3];
  
  char *envstr;
  FILE *mapfp;

  envstr=getenv("MAPDATA");

  mapfp=fopen(envstr,"r");
  map=MapFread(mapfp);
  fclose(mapfp);   

  marg[0]=90.0;
  marg[1]=0.0;
  marg[2]=1.0;

  tfunc=MapStereographic;

  clip=MapCircleClip(10); 

  nmap=PolygonTransform(map,2*sizeof(float),PolygonXYbbox,
                        tfunc,marg);

  pmap=PolygonClip(clip,nmap); 
 
  rplot=RplotMake();
  RplotSetText(rplot,stream,stdout);   
  RplotMakePlot(rplot,"MapCircleClip",wdt,hgt,24);

  RplotRectangle(rplot,NULL,0,0,wdt,hgt,
                  1,bgcol,0x0f,0,NULL);
  RplotEllipse(rplot,NULL,wdt/2,hgt/2,wdt/2,hgt/2,
                  1,seacol,0x0f,0,NULL);

  MapPlotPolygon(rplot,NULL,0,0,wdt,hgt,1,lndcol,0x0f,0,NULL,
                   pmap,1);

  MapPlotPolygon(rplot,NULL,0,0,wdt,hgt,1,lndcol,0x0f,0,NULL,
                   pmap,3);
  
  MapPlotPolygon(rplot,NULL,0,0,wdt,hgt,1,seacol,0x0f,0,NULL,
                   pmap,0);



  RplotEndPlot(rplot);
  return 0;
}
Beispiel #5
0
int main(int argc,char *argv[]) {

  struct Rplot *rplot=NULL;

  float wdt=400,hgt=400;

  unsigned int bgcol=0xffffffff;
  unsigned int fgcol=0xff000000;

  int i,j,k;
  int type;
 
  float pnt[2]; 
  float *ptr;

  poly=PolygonMake(sizeof(float)*2,PolygonXYbbox);
 
  PolygonAddPolygon(poly,1);

  pnt[0]=0.1;
  pnt[1]=0.1;
  PolygonAdd(poly,pnt,0);

  pnt[0]=0.9;
  pnt[1]=0.1;
  PolygonAdd(poly,pnt,0);

  pnt[0]=0.9;
  pnt[1]=0.9;
  PolygonAdd(poly,pnt,0);

  pnt[0]=0.1;
  pnt[1]=0.9;
  PolygonAdd(poly,pnt,0);

  PolygonAddPolygon(poly,2);

  pnt[0]=0.2;
  pnt[1]=0.2;
  PolygonAdd(poly,pnt,0);

  pnt[0]=0.8;
  pnt[1]=0.2;
  PolygonAdd(poly,pnt,0);

  pnt[0]=0.5;
  pnt[1]=0.4;
  PolygonAdd(poly,pnt,0);

  pnt[0]=0.5;
  pnt[1]=0.6;
  PolygonAdd(poly,pnt,1);


  pnt[0]=0.8;
  pnt[1]=0.8;
  PolygonAdd(poly,pnt,0);

  pnt[0]=0.2;
  pnt[1]=0.8;
  PolygonAdd(poly,pnt,0);

 
  rplot=RplotMake();
  RplotSetText(rplot,stream,stdout);   
  RplotMakePlot(rplot,"MapPlotPolygon",wdt,hgt,24);

  RplotRectangle(rplot,NULL,0,0,wdt,hgt,
                  1,bgcol,0x0f,0,NULL);

  for (i=0;i<poly->polnum;i++) {
    type=PolygonReadType(poly,i);
    if (type==1) fgcol=RplotColor(255,0,0,255);
    if (type==2) fgcol=RplotColor(0,255,0,255);
    k=0;
    for (j=0;j<poly->num[i];j++) {
      if (PolygonReadOp(poly,i,j) !=0) {
        if (k !=0) RplotPolygon(rplot,NULL,0,0,k,fx,fy,t,
                  0,fgcol,0x0f,2,NULL);

	k=0;
      }
      ptr=(float *) PolygonRead(poly,i,j);
      fx[k]=ptr[0]*wdt;
      fy[k]=ptr[1]*hgt;
      t[k]=0;
      k++;
    }
    if (k !=0) RplotPolygon(rplot,NULL,0,0,k,fx,fy,t,
                  0,fgcol,0x0f,2,NULL);
  }

  RplotEndPlot(rplot);
  return 0;
}
Beispiel #6
0
int main(int argc,char *argv[]) {

  struct Rplot *rplot=NULL;

  float wdt=400,hgt=400;

  unsigned int bgcol=0xffffffff;
  unsigned int fgcol=0xff000000;

  int i,j;
  float x;
 
  float pnt[2]; 
  float *ptr;

  poly=PolygonMake(sizeof(float)*2,PolygonXYbbox);
 
  for (x=0.4;x>0.1;x-=0.1) {

    PolygonAddPolygon(poly,1);

    pnt[0]=0.5-x;
    pnt[1]=0.5-x;
    PolygonAdd(poly,pnt,0);

    pnt[0]=0.5-x;
    pnt[1]=0.5+x;
    PolygonAdd(poly,pnt,0);

    pnt[0]=0.5+x;
    pnt[1]=0.5+x;
    PolygonAdd(poly,pnt,0);

    pnt[0]=0.5+x;
    pnt[1]=0.5-x;
    PolygonAdd(poly,pnt,0);
  }

  copy=PolygonCopy(poly);
  PolygonFree(poly);


  rplot=RplotMake();
  RplotSetText(rplot,stream,stdout);  
  RplotMakeDocument(rplot,"PolygonCopy","1",wdt,hgt,24);
 
  RplotMakePlot(rplot,"PolygonCopy",wdt,hgt,24);

  RplotRectangle(rplot,NULL,0,0,wdt,hgt,
                  1,bgcol,0x0f,0,NULL);

  for (i=0;i<copy->polnum;i++) {
  
    fgcol=RplotColor(239-i*16,239-i*16,239-i*16,255);
    for (j=0;j<copy->num[i];j++) {
      ptr=(float *) PolygonRead(copy,i,j);
      fx[j]=ptr[0]*wdt;
      fy[j]=ptr[1]*hgt;
      t[j]=0;
    }
    RplotPolygon(rplot,NULL,0,0,copy->num[i],fx,fy,t,
                  1,fgcol,0x0f,0,NULL);


  }

  RplotEndPlot(rplot);
  RplotEndDocument(rplot);
  return 0;
}
Beispiel #7
0
int main(int argc,char *argv[]) {

  int yr,mo,dy,hr,mt,sc;

  struct Rplot *rplot=NULL;

  float wdt=400,hgt=400;

  unsigned int bgcol=0xffffffff;
  unsigned int lndcol=0xffa0ffa0;
  unsigned int seacol=0xffa0a0ff;
  unsigned int grdcol=0xffa0a0a0;
 
  MapTransform  tfunc;
  float marg[3];
  char *envstr;
  FILE *mapfp;

  yr=2002;
  mo=31;
  dy=26;
  hr=22;
  mt=0;
  sc=0;

  envstr=getenv("MAPDATA");

  mapfp=fopen(envstr,"r");
  map=MapFread(mapfp);
  fclose(mapfp);   

  trm=SZATerminator(yr,mo,dy,hr,mt,sc,1,0,1.0,105.0);


  marg[0]=90.0;
  marg[1]=0.0;
  marg[2]=1.0;

  tfunc=MapStereographic;

  clip=MapCircleClip(10); 

  nmap=PolygonTransform(map,2*sizeof(float),PolygonXYbbox,
                        tfunc,marg);

  pmap=PolygonClip(clip,nmap); 

  ntrm=PolygonTransform(trm,2*sizeof(float),PolygonXYbbox,
                        tfunc,marg);

  ptrm=PolygonClip(clip,ntrm); 



  rplot=RplotMake();
  RplotSetText(rplot,stream,stdout);   
  RplotMakeDocument(rplot,"SZATerminator","1",wdt,hgt,24);

  RplotMakePlot(rplot,"SZATerminator",wdt,hgt,24);

  RplotRectangle(rplot,NULL,0,0,wdt,hgt,
                  1,bgcol,0x0f,0,NULL);
  RplotEllipse(rplot,NULL,wdt/2,hgt/2,wdt/2,hgt/2,
                  1,seacol,0x0f,0,NULL);

  MapPlotPolygon(rplot,NULL,0,0,wdt,hgt,1,lndcol,0x0f,0,NULL,
                   pmap,1);

  MapPlotPolygon(rplot,NULL,0,0,wdt,hgt,1,lndcol,0x0f,0,NULL,
                   pmap,3);
  
  MapPlotPolygon(rplot,NULL,0,0,wdt,hgt,1,seacol,0x0f,0,NULL,
                   pmap,0);

  MapPlotPolygon(rplot,NULL,0,0,wdt,hgt,1,grdcol,0x0f,0,NULL,
                 ptrm,1);

 


  RplotEndPlot(rplot);
  RplotEndDocument(rplot);
  return 0;
}
Beispiel #8
0
int main(int argc,char *argv[]) {

    struct Rplot *rplot=NULL;

    float wdt=400,hgt=200;

    float src[2],dst[2];

    unsigned int lndcol=0xffa0ffa0;
    unsigned int seacol=0xffa0a0ff;
    unsigned int grdcol=0xffa00000;

    MapTransform  tfunc;
    float marg[3];
    int s;
    char *envstr;
    FILE *mapfp;

    envstr=getenv("MAPDATA");

    mapfp=fopen(envstr,"r");
    map=MapFread(mapfp);
    fclose(mapfp);

    marg[0]=0.0;
    marg[1]=0.0;
    marg[2]=1.0;

    tfunc=MapCylindrical;

    clip=MapSquareClip(10);

    nmap=PolygonTransform(map,2*sizeof(float),PolygonXYbbox,
                          tfunc,marg);
    wmap=MapWraparound(nmap);
    pmap=PolygonClip(clip,wmap);

    rplot=RplotMake();
    RplotSetText(rplot,stream,stdout);
    RplotMakeDocument(rplot,"MapCylindrical","1",wdt,hgt,24);

    RplotMakePlot(rplot,"MapCylindrical",wdt,hgt,24);

    RplotRectangle(rplot,NULL,0,0,wdt,hgt,
                   1,seacol,0x0f,0,NULL);

    MapPlotPolygon(rplot,NULL,0,0,wdt,hgt,1,lndcol,0x0f,0,NULL,
                   pmap,1);

    MapPlotPolygon(rplot,NULL,0,0,wdt,hgt,1,lndcol,0x0f,0,NULL,
                   pmap,3);

    MapPlotPolygon(rplot,NULL,0,0,wdt,hgt,1,seacol,0x0f,0,NULL,
                   pmap,0);

    src[0]=53.2;
    src[1]=160.0;

    s=MapCylindrical(2*sizeof(float),src,2*sizeof(float),dst,marg);

    if (s==0)
        RplotEllipse(rplot,NULL,wdt*dst[0],hgt*dst[1],8,8,
                     1,grdcol,0x0f,0,NULL);


    RplotEndPlot(rplot);
    RplotEndDocument(rplot);
    return 0;
}
int main(int argc,char *argv[]) {

  struct Rplot *rplot=NULL;

  float wdt=400,hgt=400;

  unsigned int bgcol=0xffffffff;
  unsigned int fgcol=0xff000000;

  int i,j;
  int type;
 
  float pnt[2]; 
  float *ptr;

  float arg[1];

  poly=PolygonMake(sizeof(float)*2,PolygonXYbbox);
 
  PolygonAddPolygon(poly,1);

  pnt[0]=0.1;
  pnt[1]=0.1;
  PolygonAdd(poly,pnt,0);

  pnt[0]=0.9;
  pnt[1]=0.1;
  PolygonAdd(poly,pnt,0);

  pnt[0]=0.9;
  pnt[1]=0.9;
  PolygonAdd(poly,pnt,0);

  pnt[0]=0.1;
  pnt[1]=0.9;
  PolygonAdd(poly,pnt,0);

  PolygonAddPolygon(poly,2);

  pnt[0]=0.2;
  pnt[1]=0.5;
  PolygonAdd(poly,pnt,0);

  pnt[0]=0.5;
  pnt[1]=0.2;
  PolygonAdd(poly,pnt,0);

  pnt[0]=0.8;
  pnt[1]=0.5;
  PolygonAdd(poly,pnt,0);

  pnt[0]=0.5;
  pnt[1]=0.8;
  PolygonAdd(poly,pnt,0);

  arg[0]=30.0;

  npoly=PolygonTransform(poly,sizeof(float)*2,PolygonXYbbox,rotate,arg);

 
  rplot=RplotMake();
  RplotSetText(rplot,stream,stdout);
  RplotMakeDocument(rplot,"PolygonTransform","1",wdt,hgt,24);
  RplotMakePlot(rplot,"PolygonTransform",wdt,hgt,24);

  RplotRectangle(rplot,NULL,0,0,wdt,hgt,
                  1,bgcol,0x0f,0,NULL);

  for (i=0;i<npoly->polnum;i++) {
    type=PolygonReadType(npoly,i);
    if (type==1) fgcol=RplotColor(255,0,0,255);
    if (type==2) fgcol=RplotColor(0,255,0,255);

    for (j=0;j<npoly->num[i];j++) {
      ptr=(float *) PolygonRead(npoly,i,j);
      fx[j]=ptr[0]*wdt;
      fy[j]=ptr[1]*hgt;
      t[j]=0;
    }
    RplotPolygon(rplot,NULL,0,0,npoly->num[i],fx,fy,t,
                  1,fgcol,0x0f,0,NULL);
  }

  RplotEndPlot(rplot);
  RplotEndDocument(rplot);
  return 0;
}