예제 #1
0
int GrPlotZeroEnd(char *name,char *buf,int sze,void *data) {

  struct GrPlotBlock *blk;
  struct GrPlotZero *ptr;
  struct GrPlotData *plt;

  blk=(struct GrPlotBlock *) data;
  if (blk==NULL) return -1;
  ptr=(struct GrPlotZero *) blk->data;
  if (ptr==NULL) return -1;
  plt=ptr->plt;

  if (strcmp(name,blk->name)==0) {
    struct PlotData *plot;
    plot=plt->plot;
    if (plot==NULL) return -1;
    if (ptr->state !=1) return -1;

    if (strcmp(name,"xzero")==0) 
    PlotXzero(plot,plt->num,ptr->min,ptr->max,
              ptr->color,ptr->mask,ptr->width,ptr->dash);

    if (strcmp(name,"yzero")==0) 
    PlotYzero(plot,plt->num,ptr->min,ptr->max,
              ptr->color,ptr->mask,ptr->width,ptr->dash);

    if (ptr->dash !=NULL) RplotFreeDash(ptr->dash);
    free(ptr);
    GrPlotRestore(blk);
    return 0;
  }
  return 0;
}
예제 #2
0
int GrPlotBarPlotEnd(char *name,char *buf,int sze,void *data) {
  void *fp;
  double xval,yval;
  struct GrPlotBlock *blk;
  struct GrPlotBarPlot *ptr;
  struct GrPlotData *plt;

  blk=(struct GrPlotBlock *) data;
  if (blk==NULL) return -1;
  ptr=(struct GrPlotBarPlot *) blk->data;
  if (ptr==NULL) return -1;
  plt=ptr->plt;

  if (strcmp(name,blk->name)==0) {
    struct PlotData *plot;
    plot=plt->plot;
    if (plot==NULL) return -1;
   
    if ((ptr->state & 0x05) !=0x05) return -1;
    if (ptr->name==NULL) return -1;
    if (ptr->x==NULL) return -1;
    if (ptr->y==NULL) return -1;
  
    /* do the plot here */

    if ((plt->file.open !=NULL) &&
        (plt->file.close!=NULL) &&
        (plt->file.read !=NULL)) {
      fp=(plt->file.open)(ptr->name,ptr->encode,ptr->x,ptr->y,
                          plt->file.data);
      if (fp !=NULL) {
        while ( (plt->file.read)(fp,ptr->encode,ptr->x,ptr->y,
                                &xval,&yval,plt->file.data) !=-1) {

          if (xval<ptr->xdmin) continue;
          if (xval>ptr->xdmax) continue;
	  if (yval<ptr->ydmin) continue;
          if (yval>ptr->ydmax) continue;

     
          PlotBar(plot,plt->num,xval,yval,ptr->w,ptr->o,
                  ptr->xmin,ptr->xmax,ptr->ymin,ptr->ymax,
                  ptr->or,ptr->fill,ptr->color,ptr->mask,ptr->width,ptr->dash);

        }
        (plt->file.close)(fp,plt->file.data);
      } 
    }
    free(ptr->name);
    if (ptr->encode !=NULL) free(ptr->encode);
    free(ptr->x);
    free(ptr->y);    
    if (ptr->dash !=NULL) RplotFreeDash(ptr->dash);
    free(ptr);
    GrPlotRestore(blk);
    return 0;
  }
  return 0;
}
예제 #3
0
int GrPlotShapeEnd(char *name,char *buf,int sze,void *data) {

  struct GrPlotBlock *blk;
  struct GrPlotShape *ptr;
  struct GrPlotData *plt;

  blk=(struct GrPlotBlock *) data;
  if (blk==NULL) return -1;
  ptr=(struct GrPlotShape *) blk->data;
  if (ptr==NULL) return -1;
  plt=ptr->plt;

  if (strcmp(name,blk->name)==0) {
    struct PlotData *plot;
    plot=plt->plot;
    if (plot==NULL) return -1;
   
    if (ptr->state !=0x03) return -1;

    if (ptr->off !=NULL) {
      ptr->x=(ptr->off)->x+ptr->x*(ptr->off)->w;
      ptr->y=(ptr->off)->y+ptr->y*(ptr->off)->h;
      ptr->w=ptr->w*(ptr->off)->w;
      ptr->h=ptr->h*(ptr->off)->h;
      
    }
 
    if (strcmp(name,"rectangle")==0)    
       PlotRectangle(plot,plt->num,ptr->matrix,ptr->x,ptr->y,ptr->w,ptr->h,
             ptr->xmin,ptr->xmax,ptr->ymin,ptr->ymax,
             ptr->fill,ptr->color,ptr->mask,ptr->width,ptr->dash);
    
    if (strcmp(name,"ellipse")==0)    
       PlotEllipse(plot,plt->num,ptr->matrix,ptr->x,ptr->y,ptr->w,ptr->h,
             ptr->xmin,ptr->xmax,ptr->ymin,ptr->ymax,
             ptr->fill,ptr->color,ptr->mask,ptr->width,ptr->dash);
   


    if (ptr->matrix !=NULL) free(ptr->matrix);
    if (ptr->dash !=NULL) RplotFreeDash(ptr->dash);
    free(ptr);
    GrPlotRestore(blk);
    return 0;
  }
  return 0;
}