DrawObjects.h File Reference

#include "ObjectStructure.h"
#include "HandleManagement.h"
#include "../../sparse/includes/spConfig.h"
#include "bcg.h"
#include "PloEch.h"
#include "Vect2Matrix.h"
#include "StringMatrix.h"

Include dependency graph for DrawObjects.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define spINSIDE_SPARSE

Functions

void wininfo __PARAMS ((char *fmt,...))
int get_cf_type (void)
void GPopupResize (struct BCG *ScilabXgc, int *width, int *height)
void set_cf_type (int val)
char ** FreeUserLabels (char **u_xlabels, int *u_nxgrads)
double * AllocUserGrads (double *u_xgrads, int nb)
int CopyUserGrads (double *u_xgrad_SRC, double *u_xgrad_DEST, int dim)
char ** AllocAndSetUserLabelsFromMdl (char **u_xlabels, char **u_xlabels_MDL, int u_nxgrads)
void sciRedrawFigure (void)
void sciRedrawF (int *num)
void sciXbasc (void)
void sciXclear (void)
void SetEch3d1 (double *xbox, double *ybox, double *zbox, double *bbox, double *teta, double *alpha, integer flag)
void Convex_Box (double *xbox, double *ybox, integer *InsideU, integer *InsideD, char *legend, integer *flag, double *bbox)
void Nextind (integer ind1, integer *ind2, integer *ind3)
int GradLog (double _min, double _max, double *_grads, int *n_grads, int compNgrads)
BOOL Ishidden (sciPointObj *pobj)
BOOL IsDownAxes (sciPointObj *pobj)
void sciGetDisplayedBounds (sciPointObj *pSubWin, double *xmin, double *xmax, double *ymin, double *ymax, double *zmin, double *zmax)
void updateScale3d (sciPointObj *pobj, double dbox[6], double xbox[8], double ybox[8], double zbox[8])
BOOL sci_update_frame_bounds_3d (sciPointObj *pobj)
BOOL sci_update_frame_bounds_2d (sciPointObj *pobj)
int ComputeNbSubTics (sciPointObj *pobj, int nbtics, char logflag, double *grads, int nbsubtics_input)
int ComputeNbSubTicsFor3dUse (sciPointObj *pobj, int nbtics, char logflag, double *grads, int nbsubtics_input)
int ComputeCorrectXindAndInsideUD (double Teta, double Alpha, double *dbox, integer *xind, integer *InsideU, integer *InsideD)
int Axes3dStrings2 (integer *ixbox, integer *iybox, integer *xind)
int AdaptGraduationsOnZ (int x, int y, int size, integer *Ticsdir, int *fontid, sciPointObj *psubwin, double zminval, double zmaxval, double fx, double fy, double fz)
int AdaptGraduationsOnXBottomRight (int iof, int x, int y, int size, integer *Ticsdir, int *fontid, sciPointObj *psubwin, double xminval, double xmaxval, double fx, double fy, double fz)
int AdaptGraduationsOnYBottomRight (int iof, int x, int y, int size, integer *Ticsdir, int *fontid, sciPointObj *psubwin, double yminval, double ymaxval, double fx, double fy, double fz)
int AdaptGraduationsOnXBottomLeft (int iof, int x, int y, int size, integer *Ticsdir, int *fontid, sciPointObj *psubwin, double xminval, double xmaxval, double fx, double fy, double fz)
int AdaptGraduationsOnYBottomLeft (int iof, int x, int y, int size, integer *Ticsdir, int *fontid, sciPointObj *psubwin, double yminval, double ymaxval, double fx, double fy, double fz)
int CheckDisplay (double fact_h, double fact_w, char logflag, char *foo, int *posi, int *fontid, int *old_rect)
int IsInsideRectangle (int *rect, int *point)
int ComputeGoodTrans3d (sciPointObj *psubwin, int n, int *xm, int *ym, double *fx, double *fy, double *fz)
void DrawAxesIfRequired (sciPointObj *)
void DrawAxes (sciPointObj *)
void UpdateSubwinScale (sciPointObj *pobj)
int sciDrawObj (sciPointObj *pobj)
int sciDrawObjIfRequired (sciPointObj *pobj)
int sciRefreshObj (sciPointObj *pobj)
int ComputeXIntervals (sciPointObj *pobj, char xy_type, double **vector, int *N, int checkdim)
int Gen3DPoints (integer type, integer *polyx, integer *polyy, integer *fill, integer whiteid, double zmin, double zmax, double *, double *, double *, integer i, integer j, integer jj1, integer *p, integer dc, integer fg, sciPointObj *psurface)
void Merge3d (sciPointObj *psubwin)
void Merge3dBuildTable (sciPointObj *pparent, int *index_in_entity, long *from_entity, int *pos)
int Merge3dDimension (sciPointObj *pparent)
int CheckPixelStatus (void)
int GetDPIFromDriver (int *DPI)
int ChooseFormatForOneGrad (char *c_format, double *grad)
int ChildrenCounter (sciPointObj *pparent)
int GetBarNumber (sciPointObj *pobj)
double FindWidth (sciPointObj *pobj, int n1, int bar_number, double *x)
void sciGetAxisBox (double limits[6], double xbox[8], double ybox[8], double zbox[8])
void sciUpdateScaleAngles (double theta, double alpha)
void sciAxesVerticesIndices (integer insideU[4], integer insideD[4], double xbox[8], double ybox[8], integer xind[8])
void matrixLine2String (char **matrix, int matrixSize[2], int numLine, char *dest)
void computeLabelAutoPos (sciPointObj *pLabel, int axisStart[2], int axisEnd[2], int offsets[2])
void sciDrawFigure (int numFigure)
int computeRealArrowSize (sciPointObj *pSegs, int nbSegs, int xCoord[], int yCoord[])

Variables

int cf_type


Define Documentation

#define spINSIDE_SPARSE

Definition at line 20 of file DrawObjects.h.


Function Documentation

void wininfo __PARAMS ( (char *fmt,...)   ) 

int AdaptGraduationsOnXBottomLeft ( int  iof,
int  x,
int  y,
int  size,
integer Ticsdir,
int fontid,
sciPointObj psubwin,
double  xminval,
double  xmaxval,
double  fx,
double  fy,
double  fz 
)

Definition at line 1790 of file DrawObjects.c.

References sciSubWindow::axes, C2F, CheckDisplay(), ChoixFormatE(), ChooseFormatForOneGrad(), ComputeGoodTrans3d(), dr(), foo(), sciSubWindow::FRect, i, inint, int, InvAxis(), IsDownAxes(), sciSubWindow::logflags, AXES::nbsubtics, AXES::nxgrads, pas, pSUBWIN_FEATURE, AXES::reverse, TRUE, and AXES::xgrads.

01791 {
01792   int i;
01793   int nbtics, nbsubtics;
01794   int lastxindex;
01795   int old_rect[4];
01796   int nb_grads_max = 0;
01797   int vx[2], vy[2];
01798   int xm, ym;
01799   double grads_tmp[20];
01800   char c_format[5];
01801   integer barlengthx = 0,barlengthy = 0;
01802   integer rect[4],posi[2]; 
01803   integer textcolor = -1;
01804   int logrect[4],XX,YY;
01805   int pas;
01806   double fact_h = 1.5, fact_w = 1.5;
01807   int compteur = 0;
01808 
01809   int possible_pas, possible_compteur;
01810   
01811   sciSubWindow * ppsubwin = pSUBWIN_FEATURE(psubwin);
01812   
01813   for(i=0;i<4;i++) old_rect[i] = 0; /* Init. old_rect to force first grad. to be displayed */
01814   
01815   lastxindex = ppsubwin->axes.nxgrads - 1;
01816   
01817   if(lastxindex == 0)
01818     ChooseFormatForOneGrad(c_format,&(ppsubwin->axes.xgrads[0]));
01819   else
01820     ChoixFormatE(c_format,
01821                  ppsubwin->axes.xgrads[0],
01822                  ppsubwin->axes.xgrads[lastxindex],
01823                  ((ppsubwin->axes.xgrads[lastxindex])-(ppsubwin->axes.xgrads[0]))/(lastxindex));
01824   
01825   nbtics = ppsubwin->axes.nxgrads;
01826   nbsubtics = ppsubwin->axes.nbsubtics[0];
01827   
01828   
01829   for(i=0;i<nbtics;i++) grads_tmp[i] = ppsubwin->axes.xgrads[i];
01830 
01831   for(i=0;i<nbtics;i++)
01832     {
01833       char foo[256]; 
01834       double xtmp = ppsubwin->axes.xgrads[i];
01835                   
01836       sprintf(foo,c_format,xtmp);
01837 
01838       /***************************************************************/
01839       /************************* COMMON PART *************************/
01840       /***************************************************************/
01841       if(ppsubwin->axes.reverse[0] == TRUE)
01842         xtmp = InvAxis(ppsubwin->FRect[0],ppsubwin->FRect[2],xtmp);
01843                   
01844       ComputeGoodTrans3d(psubwin,1,&xm,&ym,&xtmp,&fy,&fz);
01845                   
01846       vx[0]=xm;vy[0]=ym; 
01847                   
01848       barlengthx= (integer) (( Ticsdir[0])/sqrt((double) Ticsdir[0]*Ticsdir[0]+Ticsdir[1]*Ticsdir[1])*size);
01849       barlengthy= (integer) (( Ticsdir[1])/sqrt((double) Ticsdir[0]*Ticsdir[0]+Ticsdir[1]*Ticsdir[1])*size);
01850 
01851       C2F(dr)("xset","font",fontid,fontid+1,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L); /* fix bug noticed by R.N. */
01852       C2F(dr)("xstringl",foo,&x,&y,rect,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
01853       
01854 
01855       if (IsDownAxes(psubwin)){
01856         vx[1]=vx[0];
01857         vy[1]=vy[0]+iof/2;
01858         posi[0] = inint(xm-rect[2]/2); 
01859         posi[1]=inint( vy[0] + iof + rect[3]);}
01860       else{
01861         vx[1]=vx[0]+barlengthx;
01862         vy[1]=vy[0]+barlengthy;
01863         posi[0] = inint( xm+2*barlengthx-rect[2]); 
01864         posi[1]=inint( ym + 2*barlengthy + rect[3]);}
01865       
01866       /* compute bounding of "10"  string used for log scale ON and auto_ticks ON */
01867       C2F(dr)("xstringl","10",&XX,&YY,logrect,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);       
01868       
01869       
01870       if(CheckDisplay(fact_h, fact_w, ppsubwin->logflags[0],foo,posi,fontid,old_rect) == 0)
01871         continue; /*  graduation too close, DO NOT display the graduation ! */
01872       
01873       
01874       C2F(dr)("xset","pattern",&textcolor,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
01875       C2F(dr)("xset","font",fontid,fontid+1,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
01876       if ( ppsubwin->logflags[0] == 'l' )
01877         {
01878           int smallersize = fontid[1]-2;
01879           int old_rect10[4];
01880           int posi10[2];
01881 
01882           posi10[0] = posi[0] - logrect[2];
01883           posi10[1] = posi[1] + logrect[3];
01884           
01885           C2F(dr)("xset","font",fontid,fontid+1,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
01886           
01887           C2F(dr)("xstringl","10",(&posi10[0]),(&posi10[1]),old_rect10,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
01888           
01889           posi[0] = old_rect10[0] + old_rect10[2];
01890           posi[1] = (int) (old_rect10[1] - old_rect10[3]*.1);
01891           
01892           C2F(dr)("xset","font",fontid,&smallersize,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
01893           C2F(dr)("xstringl",foo,(&posi[0]),(&posi[1]),old_rect,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
01894           
01895           /* update old_rect */
01896           old_rect[2] = (int)(fact_w*(old_rect[2] + old_rect10[2]));
01897           old_rect[3] = (int)(fact_h*(old_rect[3] + old_rect10[3] + (int) (old_rect10[3]*.1)));
01898           old_rect[0] = old_rect10[0];
01899           old_rect[1] = old_rect[1];
01900           
01901           nb_grads_max++;
01902           
01903           /* put back the current fontid */
01904           C2F(dr)("xset","font",fontid,fontid+1,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
01905         }
01906       else{
01907         /* update old_rect */
01908         C2F(dr)("xstringl",foo,(&posi[0]),(&posi[1]),old_rect,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
01909         old_rect[3] = (int)(fact_h* old_rect[3]);
01910         old_rect[2] = (int)(fact_w* old_rect[2]);
01911         nb_grads_max++;
01912       }
01913     }
01914   
01915   if(ppsubwin->logflags[0] != 'l')
01916     if(nb_grads_max == 1) /* only one grad. can be displayed : we choose to display the average value (max+min)/2 */
01917       {
01918         ppsubwin->axes.xgrads[0] = (grads_tmp[0]+grads_tmp[lastxindex])/2.;
01919         ppsubwin->axes.nxgrads = 1;
01920         if ( !ppsubwin->flagNax )
01921         {
01922           ppsubwin->axes.nbsubtics[0] = 1;
01923         }
01924         return 0;
01925       }
01926   
01927   
01928   pas = nbtics - 2; /* pas == grads number - 2 */
01929   
01930   possible_pas = -99;
01931   possible_compteur = -99;
01932   
01933   while(pas > 0)
01934     {
01935       int tmp = 0;
01936       compteur = 0;
01937       for(;;)
01938         {
01939           tmp = tmp + pas;
01940           compteur++;
01941           
01942           if((tmp == (nbtics - 1)) && (compteur < nb_grads_max)){
01943             possible_pas = pas;
01944             possible_compteur = ++compteur;
01945             break;
01946           }
01947           
01948           if(tmp > (nbtics - 1))
01949             break;
01950         }
01951       
01952       pas--;
01953     }
01954   
01955   
01956   if(possible_compteur != -99){
01957     compteur = possible_compteur;
01958     pas = possible_pas;
01959     
01960     for(i=0;i<compteur;i++)
01961       ppsubwin->axes.xgrads[i] = grads_tmp[i*pas];
01962     
01963     ppsubwin->axes.nxgrads = compteur;
01964     
01965     /* Nb of subtics computation and storage */
01966     /* jb Silvy 01/2006 : default value was Max((int) abs((13-compteur)/2),2) */
01967     ppsubwin->axes.nbsubtics[0] = ComputeNbSubTicsFor3dUse(psubwin,
01968                                                            ppsubwin->axes.nxgrads,
01969                                                            ppsubwin->logflags[0],
01970                                                            ppsubwin->axes.xgrads,
01971                                                            ppsubwin->axes.nbsubtics[0]); 
01972   }
01973   else{
01974     ppsubwin->axes.xgrads[0] = grads_tmp[0];
01975     ppsubwin->axes.xgrads[1] = grads_tmp[lastxindex];
01976     ppsubwin->axes.nxgrads = 2;
01977     /* Nb of subtics computation and storage */
01978     /* jb Silvy 01/2006 : default value was Max((int) abs((13-compteur)/2),2) */
01979     ppsubwin->axes.nbsubtics[0] = ComputeNbSubTicsFor3dUse(psubwin,
01980                                                            ppsubwin->axes.nxgrads,
01981                                                            ppsubwin->logflags[0],
01982                                                            ppsubwin->axes.xgrads,
01983                                                            ppsubwin->axes.nbsubtics[0]); 
01984     
01985     if(ppsubwin->logflags[0] == 'n'){
01986       if(nb_grads_max > 4) {
01987         /* we could display at least 4 graduations but we did not find a proper interval... */
01988         /* To avoid to display only the min and max (see above), we add 2 newly created grads by interpolating between min and max */
01989         double pas_ = (grads_tmp[lastxindex]-grads_tmp[0])/3;
01990         for(i=0;i<3;i++){
01991           ppsubwin->axes.xgrads[i] = grads_tmp[0] + i*pas_;
01992         }
01993         
01994         ppsubwin->axes.xgrads[3] = grads_tmp[lastxindex]; /* exact max */
01995         ppsubwin->axes.nxgrads = 4;
01996         
01997         /* Nb of subtics computation and storage */
01998         /* jb Silvy 01/2006 : default value was Max((int) abs((13-compteur)/2),2) */
01999         ppsubwin->axes.nbsubtics[0] = ComputeNbSubTicsFor3dUse(psubwin,
02000                                                                ppsubwin->axes.nxgrads,
02001                                                                'n',
02002                                                                ppsubwin->axes.xgrads,
02003                                                                ppsubwin->axes.nbsubtics[0]); 
02004       }
02005     }
02006   }
02007   
02008   return 0;
02009 }

Here is the call graph for this function:

int AdaptGraduationsOnXBottomRight ( int  iof,
int  x,
int  y,
int  size,
integer Ticsdir,
int fontid,
sciPointObj psubwin,
double  xminval,
double  xmaxval,
double  fx,
double  fy,
double  fz 
)

Definition at line 2238 of file DrawObjects.c.

References sciSubWindow::axes, C2F, CheckDisplay(), ChoixFormatE(), ChooseFormatForOneGrad(), ComputeGoodTrans3d(), dr(), foo(), sciSubWindow::FRect, i, inint, int, InvAxis(), IsDownAxes(), sciSubWindow::logflags, AXES::nbsubtics, AXES::nxgrads, pas, pSUBWIN_FEATURE, AXES::reverse, TRUE, and AXES::xgrads.

02239 {
02240   int i;
02241   int nbtics, nbsubtics;
02242   int lastxindex;
02243   int old_rect[4];
02244   int nb_grads_max = 0;
02245   int vx[2], vy[2];
02246   int xm, ym;
02247   double grads_tmp[20];
02248   char c_format[5];
02249   integer barlengthx = 0,barlengthy = 0;
02250   integer rect[4],posi[2]; 
02251   integer textcolor = -1;
02252   int logrect[4] ;
02253   int XX = 0;
02254   int YY = 0 ;
02255   int pas;
02256   double fact_h = 1.5, fact_w = 1.5;
02257   int compteur = 0;
02258 
02259   int possible_pas, possible_compteur;
02260   
02261   sciSubWindow * ppsubwin = pSUBWIN_FEATURE(psubwin);
02262   
02263   for(i=0;i<4;i++) old_rect[i] = 0; /* Init. old_rect to force first grad. to be displayed */
02264   
02265   lastxindex = ppsubwin->axes.nxgrads - 1;
02266   
02267   if(lastxindex == 0)
02268     ChooseFormatForOneGrad(c_format,&(ppsubwin->axes.xgrads[0]));
02269   else
02270     ChoixFormatE(c_format,
02271                  ppsubwin->axes.xgrads[0],
02272                  ppsubwin->axes.xgrads[lastxindex],
02273                  ((ppsubwin->axes.xgrads[lastxindex])-(ppsubwin->axes.xgrads[0]))/(lastxindex));
02274   
02275   nbtics = ppsubwin->axes.nxgrads;
02276   nbsubtics = ppsubwin->axes.nbsubtics[0];
02277   
02278   
02279   for(i=0;i<nbtics;i++) grads_tmp[i] = ppsubwin->axes.xgrads[i];
02280 
02281   for(i=0;i<nbtics;i++)
02282     {
02283       char foo[256]; 
02284       double xtmp = ppsubwin->axes.xgrads[i];
02285                   
02286       sprintf(foo,c_format,xtmp);
02287 
02288       /***************************************************************/
02289       /************************* COMMON PART *************************/
02290       /***************************************************************/
02291       if(ppsubwin->axes.reverse[0] == TRUE)
02292         xtmp = InvAxis(ppsubwin->FRect[0],ppsubwin->FRect[2],xtmp);
02293                   
02294       ComputeGoodTrans3d(psubwin,1,&xm,&ym,&xtmp,&fy,&fz);
02295                   
02296       vx[0]=xm;vy[0]=ym; 
02297                   
02298       barlengthx= (integer) (( Ticsdir[0])/sqrt((double) Ticsdir[0]*Ticsdir[0]+Ticsdir[1]*Ticsdir[1])*size);
02299       barlengthy= (integer) (( Ticsdir[1])/sqrt((double) Ticsdir[0]*Ticsdir[0]+Ticsdir[1]*Ticsdir[1])*size);
02300 
02301       C2F(dr)("xset","font",fontid,fontid+1,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L); /* fix bug noticed by R.N. */
02302       C2F(dr)("xstringl",foo,&x,&y,rect,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
02303       
02304 
02305       if (IsDownAxes(psubwin)){
02306         vx[1]=vx[0];
02307         vy[1]=vy[0]+iof/2;
02308         posi[0] = inint(xm-rect[2]/2); 
02309         posi[1]=inint( vy[0] + iof + rect[3]);}
02310       else{
02311         vx[1]=vx[0]+barlengthx;
02312         vy[1]=vy[0]+barlengthy;
02313         posi[0] = inint( xm+2*barlengthx);
02314         posi[1]=inint( ym + 2*barlengthy + rect[3]);}
02315                       
02316       
02317       /* compute bounding of "10"  string used for log scale ON and auto_ticks ON */
02318       C2F(dr)("xstringl","10",&XX,&YY,logrect,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);       
02319       
02320       
02321       if(CheckDisplay(fact_h, fact_w, ppsubwin->logflags[0],foo,posi,fontid,old_rect) == 0)
02322         continue; /*  graduation too close, DO NOT display the graduation ! */
02323       
02324       
02325       C2F(dr)("xset","pattern",&textcolor,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
02326       C2F(dr)("xset","font",fontid,fontid+1,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
02327       if ( ppsubwin->logflags[0] == 'l' )
02328         {
02329           int smallersize = fontid[1]-2;
02330           int old_rect10[4];
02331           int posi10[2];
02332 
02333           posi10[0] = posi[0] - logrect[2];
02334           posi10[1] = posi[1] + logrect[3];
02335           
02336           C2F(dr)("xset","font",fontid,fontid+1,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
02337           
02338           C2F(dr)("xstringl","10",(&posi10[0]),(&posi10[1]),old_rect10,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
02339           
02340           posi[0] = old_rect10[0] + old_rect10[2];
02341           posi[1] = (int) (old_rect10[1] - old_rect10[3]*.1);
02342           
02343           C2F(dr)("xset","font",fontid,&smallersize,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
02344           C2F(dr)("xstringl",foo,(&posi[0]),(&posi[1]),old_rect,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
02345           
02346           /* update old_rect */
02347           old_rect[2] = (int)(fact_w*(old_rect[2] + old_rect10[2]));
02348           old_rect[3] = (int)(fact_h*(old_rect[3] + old_rect10[3] + (int) (old_rect10[3]*.1)));
02349           old_rect[0] = old_rect10[0];
02350           old_rect[1] = old_rect[1];
02351           
02352           nb_grads_max++;
02353           
02354           /* put back the current fontid */
02355           C2F(dr)("xset","font",fontid,fontid+1,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
02356         }
02357       else{
02358         /* update old_rect */
02359         C2F(dr)("xstringl",foo,(&posi[0]),(&posi[1]),old_rect,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
02360         old_rect[3] = (int)(fact_h* old_rect[3]);
02361         old_rect[2] = (int)(fact_w* old_rect[2]);
02362         nb_grads_max++;
02363       }
02364     }
02365   
02366   if(ppsubwin->logflags[0] != 'l')
02367     if(nb_grads_max == 1) /* only one grad. can be displayed : we choose to display the average value (max+min)/2 */
02368       {
02369         ppsubwin->axes.xgrads[0] = (grads_tmp[0]+grads_tmp[lastxindex])/2.;
02370         ppsubwin->axes.nxgrads = 1;
02371         if ( !ppsubwin->flagNax )
02372         {
02373           ppsubwin->axes.nbsubtics[0] = 1;
02374         }
02375         return 0;
02376       }
02377   
02378   
02379   pas = nbtics - 2; /* pas == grads number - 2 */
02380   
02381   possible_pas = -99;
02382   possible_compteur = -99;
02383   
02384   while(pas > 0)
02385     {
02386       int tmp = 0;
02387       compteur = 0;
02388       for(;;)
02389         {
02390           tmp = tmp + pas;
02391           compteur++;
02392           
02393           if((tmp == (nbtics - 1)) && (compteur < nb_grads_max)){
02394             possible_pas = pas;
02395             possible_compteur = ++compteur;
02396             break;
02397           }
02398           
02399           if(tmp > (nbtics - 1))
02400             break;
02401         }
02402       
02403       pas--;
02404     }
02405   
02406   
02407   if(possible_compteur != -99){
02408     compteur = possible_compteur;
02409     pas = possible_pas;
02410     
02411     for(i=0;i<compteur;i++)
02412       ppsubwin->axes.xgrads[i] = grads_tmp[i*pas];
02413     
02414     ppsubwin->axes.nxgrads = compteur;
02415     
02416     ppsubwin->axes.nbsubtics[0] = ComputeNbSubTicsFor3dUse(psubwin,
02417                                                            ppsubwin->axes.nxgrads,
02418                                                            ppsubwin->logflags[0],
02419                                                            ppsubwin->axes.xgrads,
02420                                                            ppsubwin->axes.nbsubtics[0]);
02421   }
02422   else{
02423     ppsubwin->axes.xgrads[0] = grads_tmp[0];
02424     ppsubwin->axes.xgrads[1] = grads_tmp[lastxindex];
02425     ppsubwin->axes.nxgrads = 2;
02426     ppsubwin->axes.nbsubtics[0] = ComputeNbSubTicsFor3dUse(psubwin,
02427                                                            ppsubwin->axes.nxgrads,
02428                                                            ppsubwin->logflags[0],
02429                                                            ppsubwin->axes.xgrads,
02430                                                            ppsubwin->axes.nbsubtics[0]);
02431     if(ppsubwin->logflags[0] == 'n'){
02432       if(nb_grads_max > 4) {
02433         /* we could display at least 4 graduations but we did not find a proper interval... */
02434         /* To avoid to display only the min and max (see above), we add 2 newly created grads by interpolating between min and max */
02435         double pas_ = (grads_tmp[lastxindex]-grads_tmp[0])/3;
02436         for(i=0;i<3;i++){
02437           ppsubwin->axes.xgrads[i] = grads_tmp[0] + i*pas_;
02438         }
02439         
02440         ppsubwin->axes.xgrads[3] = grads_tmp[lastxindex]; /* exact max */
02441         ppsubwin->axes.nxgrads = 4;
02442         ppsubwin->axes.nbsubtics[0] = ComputeNbSubTicsFor3dUse(psubwin,
02443                                                                ppsubwin->axes.nxgrads,
02444                                                                'n',
02445                                                                ppsubwin->axes.xgrads,
02446                                                                ppsubwin->axes.nbsubtics[0] );
02447       }
02448     }
02449   }
02450   
02451   return 0;
02452 }

Here is the call graph for this function:

int AdaptGraduationsOnYBottomLeft ( int  iof,
int  x,
int  y,
int  size,
integer Ticsdir,
int fontid,
sciPointObj psubwin,
double  yminval,
double  ymaxval,
double  fx,
double  fy,
double  fz 
)

Definition at line 1565 of file DrawObjects.c.

References sciSubWindow::axes, C2F, CheckDisplay(), ChoixFormatE(), ChooseFormatForOneGrad(), ComputeGoodTrans3d(), dr(), foo(), sciSubWindow::FRect, i, inint, int, InvAxis(), IsDownAxes(), sciSubWindow::logflags, AXES::nbsubtics, AXES::nygrads, pas, pSUBWIN_FEATURE, AXES::reverse, TRUE, and AXES::ygrads.

01566 {
01567   int i;
01568   int nbtics, nbsubtics;
01569   int lastyindex;
01570   int old_rect[4];
01571   int nb_grads_max = 0;
01572   int vx[2], vy[2];
01573   int xm, ym;
01574   double grads_tmp[20];
01575   char c_format[5];
01576   integer barlengthx = 0,barlengthy = 0;
01577   integer rect[4],posi[2];
01578   integer textcolor = -1;
01579   int logrect[4] ;
01580   int XX = 0 ;
01581   int YY = 0 ;
01582   int pas;
01583   double fact_h = 1.5, fact_w = 1.5;
01584   int compteur = 0;
01585 
01586   int possible_pas, possible_compteur;
01587   
01588   sciSubWindow * ppsubwin = pSUBWIN_FEATURE(psubwin);
01589   
01590   for(i=0;i<4;i++) { old_rect[i] = 0 ; } /* Init. old_rect to force first grad. to be displayed */
01591   
01592   lastyindex = ppsubwin->axes.nygrads - 1;
01593   
01594   if(lastyindex == 0)
01595     ChooseFormatForOneGrad(c_format,&(ppsubwin->axes.ygrads[0]));
01596   else
01597     ChoixFormatE(c_format,
01598                  ppsubwin->axes.ygrads[0],
01599                  ppsubwin->axes.ygrads[lastyindex],
01600                  ((ppsubwin->axes.ygrads[lastyindex])-(ppsubwin->axes.ygrads[0]))/(lastyindex));
01601   
01602   nbtics = ppsubwin->axes.nygrads;
01603   nbsubtics = ppsubwin->axes.nbsubtics[1];
01604   
01605   
01606   for(i=0;i<nbtics;i++) grads_tmp[i] = ppsubwin->axes.ygrads[i];
01607 
01608   for(i=0;i<nbtics;i++)
01609     {
01610       char foo[256];
01611       double ytmp = ppsubwin->axes.ygrads[i];
01612                   
01613                   
01614       sprintf(foo,c_format,ytmp);
01615 
01616       /***************************************************************/
01617       /************************* COMMON PART *************************/
01618       /***************************************************************/
01619       if(ppsubwin->axes.reverse[1] == TRUE)
01620         ytmp = InvAxis(ppsubwin->FRect[1],ppsubwin->FRect[3],ytmp);
01621                   
01622       ComputeGoodTrans3d(psubwin,1,&xm,&ym,&fx,&ytmp,&fz);
01623                   
01624       vx[0]=xm;vy[0]=ym;
01625                   
01626       barlengthx= (integer) (( Ticsdir[0])/sqrt((double) Ticsdir[0]*Ticsdir[0]+Ticsdir[1]*Ticsdir[1])*size);
01627       barlengthy= (integer) (( Ticsdir[1])/sqrt((double) Ticsdir[0]*Ticsdir[0]+Ticsdir[1]*Ticsdir[1])*size);
01628 
01629       C2F(dr)("xset","font",fontid,fontid+1,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L); /* fix bug noticed by R.N. */
01630       C2F(dr)("xstringl",foo,&x,&y,rect,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
01631                       
01632       
01633       if (IsDownAxes(psubwin)){
01634         vx[1]=vx[0];
01635         vy[1]=vy[0]+iof/2;
01636         posi[0] = inint(xm-rect[2]/2);
01637         posi[1]=inint( vy[0] + iof + rect[3]);}
01638       else{
01639         vx[1]=vx[0]+barlengthx;
01640         vy[1]=vy[0]+barlengthy;
01641         posi[0] = inint( xm+2*barlengthx-rect[2]);
01642         posi[1]=inint( ym + 2*barlengthy + rect[3]);}
01643       
01644       /* compute bounding of "10"  string used for log scale ON and auto_ticks ON */
01645       C2F(dr)("xstringl","10",&XX,&YY,logrect,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
01646       
01647       
01648       if(CheckDisplay(fact_h, fact_w, ppsubwin->logflags[1],foo,posi,fontid,old_rect) == 0)
01649         continue; /*  graduation too close, DO NOT display the graduation ! */
01650       
01651       
01652       C2F(dr)("xset","pattern",&textcolor,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
01653       C2F(dr)("xset","font",fontid,fontid+1,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
01654       if ( ppsubwin->logflags[1] == 'l' )
01655         {
01656           int smallersize = fontid[1]-2;
01657           int old_rect10[4];
01658           int posi10[2];
01659 
01660           posi10[0] = posi[0] - logrect[2];
01661           posi10[1] = posi[1] + logrect[3];
01662           
01663           C2F(dr)("xset","font",fontid,fontid+1,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
01664           
01665           C2F(dr)("xstringl","10",(&posi10[0]),(&posi10[1]),old_rect10,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
01666           
01667           posi[0] = old_rect10[0] + old_rect10[2];
01668           posi[1] = (int) (old_rect10[1] - old_rect10[3]*.1);
01669           
01670           C2F(dr)("xset","font",fontid,&smallersize,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
01671           C2F(dr)("xstringl",foo,(&posi[0]),(&posi[1]),old_rect,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
01672           
01673           /* update old_rect */
01674           old_rect[2] = (int)(fact_w*(old_rect[2] + (double)old_rect10[2]));
01675           old_rect[3] = (int)(fact_h*(old_rect[3] + old_rect10[3] + (int) (old_rect10[3]*.1)));
01676           old_rect[0] = old_rect10[0];
01677           old_rect[1] = old_rect[1];
01678           
01679           nb_grads_max++;
01680           
01681           /* put back the current fontid */
01682           C2F(dr)("xset","font",fontid,fontid+1,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
01683         }
01684       else{
01685         /* update old_rect */
01686         C2F(dr)("xstringl",foo,(&posi[0]),(&posi[1]),old_rect,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
01687         old_rect[3] = (int)(fact_h* old_rect[3]);
01688         old_rect[2] = (int)(fact_w* old_rect[2]);
01689         nb_grads_max++;
01690       }
01691     }
01692   
01693   if(ppsubwin->logflags[1] != 'l')
01694     if(nb_grads_max == 1) /* only one grad. can be displayed : we choose to display the average value (max+min)/2 */
01695       {
01696         ppsubwin->axes.ygrads[0] = (grads_tmp[0]+grads_tmp[lastyindex])/2.;
01697         ppsubwin->axes.nygrads = 1;
01698         
01699         if ( !ppsubwin->flagNax )
01700         {
01701           /* don't change the number if it aldready has been specified */
01702           ppsubwin->axes.nbsubtics[1] = 1 ;
01703         }
01704         return 0;
01705       }
01706   
01707   
01708   pas = nbtics - 2; /* pas == grads number - 2 */
01709   
01710   possible_pas = -99;
01711   possible_compteur = -99;
01712   
01713   while(pas > 0)
01714     {
01715       int tmp = 0;
01716       compteur = 0;
01717       for(;;)
01718         {
01719           tmp = tmp + pas;
01720           compteur++;
01721           
01722           if((tmp == (nbtics - 1)) && (compteur < nb_grads_max)){
01723             possible_pas = pas;
01724             possible_compteur = ++compteur;
01725             break;
01726           }
01727           
01728           if(tmp > (nbtics - 1))
01729             break;
01730         }
01731       
01732       pas--;
01733     }
01734   
01735   
01736   if(possible_compteur != -99){
01737     compteur = possible_compteur;
01738     pas = possible_pas;
01739     
01740     for(i=0;i<compteur;i++)
01741       ppsubwin->axes.ygrads[i] = grads_tmp[i*pas];
01742     
01743     ppsubwin->axes.nygrads = compteur;
01744     
01745     /* Nb of subtics computation and storage */
01746     /* jb Silvy 01/2006 : default value was Max((int) abs((13-compteur)/2),2) */
01747     ppsubwin->axes.nbsubtics[1] = ComputeNbSubTicsFor3dUse(psubwin,
01748                                                            ppsubwin->axes.nygrads,
01749                                                            ppsubwin->logflags[1],
01750                                                            ppsubwin->axes.ygrads,
01751                                                            ppsubwin->axes.nbsubtics[1]);
01752   }
01753   else{
01754     ppsubwin->axes.ygrads[0] = grads_tmp[0];
01755     ppsubwin->axes.ygrads[1] = grads_tmp[lastyindex];
01756     ppsubwin->axes.nygrads = 2;
01757     /* Nb of subtics computation and storage */
01758     /* jb Silvy 01/2006 : default value was Max((int) abs((13-compteur)/2),2) */
01759     ppsubwin->axes.nbsubtics[1] = ComputeNbSubTicsFor3dUse(psubwin,
01760                                                            ppsubwin->axes.nygrads,
01761                                                            ppsubwin->logflags[1],
01762                                                            ppsubwin->axes.ygrads,
01763                                                            ppsubwin->axes.nbsubtics[1]);
01764     
01765     if(ppsubwin->logflags[1] == 'n'){
01766       if(nb_grads_max > 4) {
01767         /* we could display at least 4 graduations but we did not find a proper interval... */
01768         /* To avoid to display only the min and max (see above), we add 2 newly created grads by interpolating between min and max */
01769         double pas_ = (grads_tmp[lastyindex]-grads_tmp[0])/3;
01770         for(i=0;i<3;i++){
01771           ppsubwin->axes.ygrads[i] = grads_tmp[0] + i*pas_;
01772         }
01773         
01774         ppsubwin->axes.ygrads[3] = grads_tmp[lastyindex]; /* exact max */
01775         ppsubwin->axes.nygrads = 4;
01776         /* Nb of subtics computation and storage */
01777         ppsubwin->axes.nbsubtics[1] = ComputeNbSubTicsFor3dUse(psubwin,
01778                                                                ppsubwin->axes.nygrads,
01779                                                                'n',
01780                                                                ppsubwin->axes.ygrads,
01781                                                                ppsubwin->axes.nbsubtics[1]);
01782       }
01783     }
01784   }
01785   
01786   return 0;
01787 }

Here is the call graph for this function:

int AdaptGraduationsOnYBottomRight ( int  iof,
int  x,
int  y,
int  size,
integer Ticsdir,
int fontid,
sciPointObj psubwin,
double  yminval,
double  ymaxval,
double  fx,
double  fy,
double  fz 
)

Definition at line 2013 of file DrawObjects.c.

References sciSubWindow::axes, C2F, CheckDisplay(), ChoixFormatE(), ChooseFormatForOneGrad(), ComputeGoodTrans3d(), dr(), foo(), sciSubWindow::FRect, i, inint, int, InvAxis(), IsDownAxes(), sciSubWindow::logflags, AXES::nbsubtics, AXES::nygrads, pas, pSUBWIN_FEATURE, AXES::reverse, TRUE, and AXES::ygrads.

02014 {
02015   int i;
02016   int nbtics, nbsubtics;
02017   int lastyindex;
02018   int old_rect[4];
02019   int nb_grads_max = 0;
02020   int vx[2], vy[2];
02021   int xm, ym;
02022   double grads_tmp[20];
02023   char c_format[5];
02024   integer barlengthx = 0,barlengthy = 0;
02025   integer rect[4],posi[2]; 
02026   integer textcolor = -1;
02027   int logrect[4] ;
02028   int XX = 0 ;
02029   int YY = 0 ;
02030   int pas;
02031   double fact_h = 1.5, fact_w = 1.5;
02032   int compteur = 0;
02033 
02034   int possible_pas, possible_compteur;
02035   
02036   sciSubWindow * ppsubwin = pSUBWIN_FEATURE(psubwin);
02037   
02038   for(i=0;i<4;i++) old_rect[i] = 0; /* Init. old_rect to force first grad. to be displayed */
02039   
02040   lastyindex = ppsubwin->axes.nygrads - 1;
02041   
02042   if(lastyindex == 0)
02043     ChooseFormatForOneGrad(c_format,&(ppsubwin->axes.ygrads[0]));
02044   else
02045     ChoixFormatE(c_format,
02046                  ppsubwin->axes.ygrads[0],
02047                  ppsubwin->axes.ygrads[lastyindex],
02048                  ((ppsubwin->axes.ygrads[lastyindex])-(ppsubwin->axes.ygrads[0]))/(lastyindex));
02049   
02050   nbtics = ppsubwin->axes.nygrads;
02051   nbsubtics = ppsubwin->axes.nbsubtics[1];
02052   
02053   
02054   for(i=0;i<nbtics;i++) grads_tmp[i] = ppsubwin->axes.ygrads[i];
02055 
02056   for(i=0;i<nbtics;i++)
02057     {
02058       char foo[256]; 
02059       double ytmp = ppsubwin->axes.ygrads[i];
02060                   
02061       sprintf(foo,c_format,ytmp);
02062 
02063       /***************************************************************/
02064       /************************* COMMON PART *************************/
02065       /***************************************************************/
02066       if(ppsubwin->axes.reverse[1] == TRUE)
02067         ytmp = InvAxis(ppsubwin->FRect[1],ppsubwin->FRect[3],ytmp);
02068                   
02069       ComputeGoodTrans3d(psubwin,1,&xm,&ym,&fx,&ytmp,&fz);
02070                   
02071       vx[0]=xm;vy[0]=ym; 
02072                   
02073       barlengthx= (integer) (( Ticsdir[0])/sqrt((double) Ticsdir[0]*Ticsdir[0]+Ticsdir[1]*Ticsdir[1])*size);
02074       barlengthy= (integer) (( Ticsdir[1])/sqrt((double) Ticsdir[0]*Ticsdir[0]+Ticsdir[1]*Ticsdir[1])*size);
02075 
02076       C2F(dr)("xset","font",fontid,fontid+1,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L); /* fix bug noticed by R.N. */
02077       C2F(dr)("xstringl",foo,&x,&y,rect,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
02078       
02079 
02080       if (IsDownAxes(psubwin)){
02081         vx[1]=vx[0];
02082         vy[1]=vy[0]+iof/2;
02083         posi[0] = inint(xm-rect[2]/2); 
02084         posi[1]=inint( vy[0] + iof + rect[3]);}
02085       else{
02086         vx[1]=vx[0]+barlengthx;
02087         vy[1]=vy[0]+barlengthy;
02088         posi[0] = inint( xm+2*barlengthx);
02089         posi[1]=inint( ym + 2*barlengthy + rect[3]);}
02090                       
02091       
02092       /* compute bounding of "10"  string used for log scale ON and auto_ticks ON */
02093       C2F(dr)("xstringl","10",&XX,&YY,logrect,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);       
02094       
02095       
02096       if(CheckDisplay(fact_h, fact_w, ppsubwin->logflags[1],foo,posi,fontid,old_rect) == 0)
02097         continue; /*  graduation too close, DO NOT display the graduation ! */
02098       
02099       
02100       C2F(dr)("xset","pattern",&textcolor,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
02101       C2F(dr)("xset","font",fontid,fontid+1,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
02102       if ( ppsubwin->logflags[1] == 'l' )
02103         {
02104           int smallersize = fontid[1]-2;
02105           int old_rect10[4];
02106           int posi10[2];
02107 
02108           posi10[0] = posi[0] - logrect[2];
02109           posi10[1] = posi[1] + logrect[3];
02110           
02111           C2F(dr)("xset","font",fontid,fontid+1,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
02112           
02113           C2F(dr)("xstringl","10",(&posi10[0]),(&posi10[1]),old_rect10,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
02114           
02115           posi[0] = old_rect10[0] + old_rect10[2];
02116           posi[1] = (int) (old_rect10[1] - old_rect10[3]*.1);
02117           
02118           C2F(dr)("xset","font",fontid,&smallersize,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
02119           C2F(dr)("xstringl",foo,(&posi[0]),(&posi[1]),old_rect,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
02120           
02121           /* update old_rect */
02122           old_rect[2] = (int)(fact_w*(old_rect[2] + old_rect10[2]));
02123           old_rect[3] = (int)(fact_h*(old_rect[3] + old_rect10[3] + (int) (old_rect10[3]*.1)));
02124           old_rect[0] = old_rect10[0];
02125           old_rect[1] = old_rect[1];
02126           
02127           nb_grads_max++;
02128           
02129           /* put back the current fontid */
02130           C2F(dr)("xset","font",fontid,fontid+1,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
02131         }
02132       else{
02133         /* update old_rect */
02134         C2F(dr)("xstringl",foo,(&posi[0]),(&posi[1]),old_rect,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
02135         old_rect[3] = (int)(fact_h* old_rect[3]);
02136         old_rect[2] = (int)(fact_w* old_rect[2]);
02137         nb_grads_max++;
02138       }
02139     }
02140   
02141   if(ppsubwin->logflags[1] != 'l')
02142     if(nb_grads_max == 1) /* only one grad. can be displayed : we choose to display the average value (max+min)/2 */
02143       {
02144         ppsubwin->axes.ygrads[0] = (grads_tmp[0]+grads_tmp[lastyindex])/2.;
02145         ppsubwin->axes.nygrads = 1;
02146         if ( !ppsubwin->flagNax )
02147         {
02148           ppsubwin->axes.nbsubtics[1] = 1;
02149         }
02150         return 0;
02151       }
02152   
02153   
02154   pas = nbtics - 2; /* pas == grads number - 2 */
02155   
02156   possible_pas = -99;
02157   possible_compteur = -99;
02158   
02159   while(pas > 0)
02160     {
02161       int tmp = 0;
02162       compteur = 0;
02163       for(;;)
02164         {
02165           tmp = tmp + pas;
02166           compteur++;
02167           
02168           if((tmp == (nbtics - 1)) && (compteur < nb_grads_max)){
02169             possible_pas = pas;
02170             possible_compteur = ++compteur;
02171             break;
02172           }
02173           
02174           if(tmp > (nbtics - 1))
02175             break;
02176         }
02177       
02178       pas--;
02179     }
02180   
02181   
02182   if(possible_compteur != -99){
02183     compteur = possible_compteur;
02184     pas = possible_pas;
02185     
02186     for(i=0;i<compteur;i++)
02187       ppsubwin->axes.ygrads[i] = grads_tmp[i*pas];
02188     
02189     ppsubwin->axes.nygrads = compteur;
02190     
02191     /* Nb of subtics computation and storage */
02192     /* jb Silvy 01/2006 : default value was Max((int) abs((13-compteur)/2),2) */
02193     ppsubwin->axes.nbsubtics[1] = ComputeNbSubTicsFor3dUse(psubwin,
02194                                                            ppsubwin->axes.nygrads,
02195                                                            ppsubwin->logflags[1],
02196                                                            ppsubwin->axes.ygrads,
02197                                                            ppsubwin->axes.nbsubtics[1]);
02198   }
02199   else{
02200     ppsubwin->axes.ygrads[0] = grads_tmp[0];
02201     ppsubwin->axes.ygrads[1] = grads_tmp[lastyindex];
02202     ppsubwin->axes.nygrads = 2;
02203 
02204     /* Nb of subtics computation and storage */
02205     /* jb Silvy 01/2006 : default value was Max((int) abs((13-compteur)/2),2) */
02206     ppsubwin->axes.nbsubtics[1] = ComputeNbSubTicsFor3dUse(psubwin,
02207                                                            ppsubwin->axes.nygrads,
02208                                                            ppsubwin->logflags[1],
02209                                                            ppsubwin->axes.ygrads,
02210                                                            ppsubwin->axes.nbsubtics[1]);
02211     
02212     if(ppsubwin->logflags[1] == 'n'){
02213       if(nb_grads_max > 4) {
02214         /* we could display at least 4 graduations but we did not find a proper interval... */
02215         /* To avoid to display only the min and max (see above), we add 2 newly created grads by interpolating between min and max */
02216         double pas_ = (grads_tmp[lastyindex]-grads_tmp[0])/3;
02217         for(i=0;i<3;i++){
02218           ppsubwin->axes.ygrads[i] = grads_tmp[0] + i*pas_;
02219         }
02220         
02221         ppsubwin->axes.ygrads[3] = grads_tmp[lastyindex]; /* exact max */
02222         ppsubwin->axes.nygrads = 4;
02223         /* Nb of subtics computation and storage */
02224         /* jb Silvy 01/2006 : default value was Max((int) abs((13-compteur)/2),2) */
02225         ppsubwin->axes.nbsubtics[1] = ComputeNbSubTicsFor3dUse(psubwin,
02226                                                                ppsubwin->axes.nygrads,
02227                                                                'n',
02228                                                                ppsubwin->axes.ygrads,
02229                                                                ppsubwin->axes.nbsubtics[1]);
02230       }
02231     }
02232   }
02233   
02234   return 0;
02235 }

Here is the call graph for this function:

int AdaptGraduationsOnZ ( int  x,
int  y,
int  size,
integer Ticsdir,
int fontid,
sciPointObj psubwin,
double  zminval,
double  zmaxval,
double  fx,
double  fy,
double  fz 
)

Definition at line 2454 of file DrawObjects.c.

References sciSubWindow::axes, C2F, CheckDisplay(), ChoixFormatE(), ChooseFormatForOneGrad(), ComputeGoodTrans3d(), dr(), foo(), sciSubWindow::FRect, i, inint, int, InvAxis(), sciSubWindow::logflags, AXES::nbsubtics, AXES::nzgrads, pas, pSUBWIN_FEATURE, AXES::reverse, TRUE, and AXES::zgrads.

02455 {
02456   int i;
02457   int nbtics, nbsubtics;
02458   int lastzindex;
02459   int old_rect[4];
02460   int nb_grads_max = 0;
02461   int vx[2], vy[2];
02462   int xm, ym;
02463   double grads_tmp[20];
02464   char c_format[5];
02465   integer barlengthx = 0,barlengthy = 0;
02466   integer rect[4],posi[2]; 
02467   integer textcolor = -1;
02468   int logrect[4] ;
02469   int XX = 0 ;
02470   int YY = 0 ;
02471   int pas;
02472   double fact_h = 1.5, fact_w = 1.;
02473   int compteur;
02474 
02475   int possible_pas, possible_compteur;
02476   
02477   sciSubWindow * ppsubwin = pSUBWIN_FEATURE(psubwin);
02478   
02479   for(i=0;i<4;i++) old_rect[i] = 0; /* Init. old_rect to force first grad. to be displayed */
02480   
02481 
02482 
02483   lastzindex = ppsubwin->axes.nzgrads - 1;
02484   
02485   if(lastzindex == 0)
02486     ChooseFormatForOneGrad(c_format,&(ppsubwin->axes.zgrads[0]));
02487   else
02488     ChoixFormatE(c_format,
02489                  ppsubwin->axes.zgrads[0],
02490                  ppsubwin->axes.zgrads[lastzindex],
02491                  ((ppsubwin->axes.zgrads[lastzindex])-(ppsubwin->axes.zgrads[0]))/(lastzindex));
02492   
02493   nbtics = ppsubwin->axes.nzgrads;
02494   nbsubtics = ppsubwin->axes.nbsubtics[2];
02495 
02496 
02497   for(i=0;i<nbtics;i++) grads_tmp[i] = ppsubwin->axes.zgrads[i];
02498   
02499   for(i=0;i<nbtics;i++)
02500     {
02501       char foo[256];
02502       double ztmp = ppsubwin->axes.zgrads[i];
02503 
02504       sprintf(foo,c_format,ztmp);
02505       
02506       /***************************************************************/
02507       /************************* COMMON PART *************************/
02508       /***************************************************************/
02509       if(ppsubwin->axes.reverse[2] == TRUE)
02510         ztmp = InvAxis(ppsubwin->FRect[4],ppsubwin->FRect[5],ztmp);
02511       
02512       ComputeGoodTrans3d(psubwin,1,&xm,&ym,&fx,&fy,&ztmp);
02513             
02514       
02515       vx[0]=xm;vy[0]=ym;
02516       
02517       barlengthx= (integer) (( Ticsdir[0])/sqrt((double) Ticsdir[0]*Ticsdir[0]+Ticsdir[1]*Ticsdir[1])*size);
02518       barlengthy= (integer) (( Ticsdir[1])/sqrt((double) Ticsdir[0]*Ticsdir[0]+Ticsdir[1]*Ticsdir[1])*size);
02519       vx[1]=vx[0]+barlengthx;
02520       vy[1]=vy[0]+barlengthy;
02521       
02522       /* foo is set above with sprintf(foo,c_format,xtmp); */
02523               
02524       C2F(dr)("xset","font",fontid,fontid+1,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L); /* fix bug noticed by R.N. */
02525       C2F(dr)("xstringl",foo,&x,&y,rect,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
02526       posi[0] = inint( xm+2*barlengthx - rect[2]); 
02527       posi[1]=inint( ym + 2*barlengthy + rect[3]/2);
02528 
02529 
02530       /* compute bounding of "10"  string used for log scale ON and auto_ticks ON */
02531       C2F(dr)("xstringl","10",&XX,&YY,logrect,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);       
02532       
02533       
02534       if(CheckDisplay(fact_h, fact_w, ppsubwin->logflags[2],foo,posi,fontid,old_rect) == 0)
02535         continue; /*  graduation too close, DO NOT display the graduation ! */
02536               
02537       C2F(dr)("xset","pattern",&textcolor,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
02538       C2F(dr)("xset","font",fontid,fontid+1,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
02539       if ( ppsubwin->logflags[2] == 'l' )
02540         {
02541           int smallersize = fontid[1]-2;
02542           int old_rect10[4];
02543           int posi10[2];
02544           
02545           posi10[0] = posi[0] - logrect[2];
02546           posi10[1] = posi[1] + logrect[3];
02547           
02548           C2F(dr)("xset","font",fontid,fontid+1,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
02549           
02550           C2F(dr)("xstringl","10",(&posi10[0]),(&posi10[1]),old_rect10,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
02551           
02552           posi[0] = old_rect10[0] + old_rect10[2];
02553           posi[1] = (int) (old_rect10[1] - old_rect10[3]*.1);
02554           
02555           C2F(dr)("xset","font",fontid,&smallersize,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
02556           C2F(dr)("xstringl",foo,(&posi[0]),(&posi[1]),old_rect,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
02557           
02558           /* update old_rect */
02559           old_rect[2] = (int)(fact_w*(old_rect[2] + old_rect10[2]));
02560           old_rect[3] = (int)(fact_h*(old_rect[3] + old_rect10[3] + (int) (old_rect10[3]*.1)));
02561           old_rect[0] = old_rect10[0];
02562           old_rect[1] = old_rect[1];
02563           
02564           nb_grads_max++;
02565           
02566           
02567           /* put back the current fontid */
02568           C2F(dr)("xset","font",fontid,fontid+1,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
02569         }
02570       else{
02571         /* update old_rect */
02572         C2F(dr)("xstringl",foo,(&posi[0]),(&posi[1]),old_rect,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
02573         old_rect[3] = (int)(fact_h* old_rect[3]);
02574         old_rect[2] = (int)(fact_w* old_rect[2]);
02575         nb_grads_max++;
02576       }
02577     }
02578   
02579   
02580   if(ppsubwin->logflags[2] != 'l')
02581     if(nb_grads_max == 1) /* only one grad. can be displayed : we choose to display the average value (max+min)/2 */
02582       {
02583         ppsubwin->axes.zgrads[0] = (grads_tmp[0]+grads_tmp[lastzindex])/2.;
02584         ppsubwin->axes.nzgrads = 1;
02585         if ( !ppsubwin->flagNax )
02586         {
02587           ppsubwin->axes.nbsubtics[2] = 1;
02588         }
02589         return 0;
02590       }
02591   
02592   pas = nbtics - 2; /* pas == grads number - 2 */
02593 
02594   possible_pas = -99;
02595   possible_compteur = -99;
02596 
02597   while(pas > 0)
02598     {
02599       int tmp = 0;
02600       compteur = 0;
02601       for(;;)
02602         {
02603           tmp = tmp + pas;
02604           compteur++;
02605           
02606           if((tmp == (nbtics - 1)) && (compteur < nb_grads_max)){
02607             possible_pas = pas;
02608             possible_compteur = ++compteur;
02609             break;
02610           }
02611           
02612           if(tmp > (nbtics - 1))
02613             break;
02614         }
02615       
02616       pas--;
02617     }
02618   
02619   if(possible_compteur != -99){
02620     compteur = possible_compteur;
02621     pas = possible_pas;
02622     
02623     for(i=0;i<compteur;i++)
02624       ppsubwin->axes.zgrads[i] = grads_tmp[i*pas];
02625     
02626     ppsubwin->axes.nzgrads = compteur;
02627     
02628     /* Nb of subtics computation and storage */
02629     /* jb Silvy 01/2006 : default value was Max((int) abs((13-compteur)/2),2) */
02630     ppsubwin->axes.nbsubtics[2] = ComputeNbSubTicsFor3dUse(psubwin,
02631                                                            ppsubwin->axes.nzgrads,
02632                                                            ppsubwin->logflags[2],
02633                                                            ppsubwin->axes.zgrads,
02634                                                            ppsubwin->axes.nbsubtics[2]); 
02635   }
02636   else{
02637     ppsubwin->axes.zgrads[0] = grads_tmp[0];
02638     ppsubwin->axes.zgrads[1] = grads_tmp[lastzindex];
02639     ppsubwin->axes.nzgrads = 2;
02640     /* Nb of subtics computation and storage */
02641     /* jb Silvy 01/2006 : default value was Max((int) abs((13-compteur)/2),2) */
02642     ppsubwin->axes.nbsubtics[2] = ComputeNbSubTicsFor3dUse(psubwin,
02643                                                            ppsubwin->axes.nzgrads,
02644                                                            ppsubwin->logflags[2],
02645                                                            ppsubwin->axes.zgrads,
02646                                                            ppsubwin->axes.nbsubtics[2]); 
02647   }
02648   
02649   return 0;
02650 }

Here is the call graph for this function:

char ** AllocAndSetUserLabelsFromMdl ( char **  u_xlabels,
char **  u_xlabels_MDL,
int  u_nxgrads 
)

Definition at line 774 of file Plo2dn.c.

References i, MALLOC, NULL, and sciprint().

Referenced by ConstructSubWin().

00775 {
00776   int i;
00777   int nbtics = u_nxgrads;
00778 
00779   if(u_nxgrads == 0)
00780     return (char **) NULL;
00781   
00782   if(u_xlabels != NULL)
00783     {
00784       sciprint("Impossible: u_xlabels must be freed before re-allocating");
00785       return (char **) NULL;
00786     }
00787   
00788   if((u_xlabels=(char **)MALLOC(u_nxgrads*sizeof(char *)))==NULL){
00789     sciprint("No more place for allocating user labels using Nax");
00790     return (char **) NULL;
00791   }
00792 
00793   
00794   for(i=0;i<nbtics;i++)
00795     {  
00796       if((u_xlabels[i]=(char *)MALLOC((strlen(u_xlabels_MDL[i])+1)*sizeof(char )))==NULL){
00797         sciprint("No more place for allocating u_xlabels");
00798         return (char **) NULL;
00799       }
00800       
00801       strcpy(u_xlabels[i],u_xlabels_MDL[i]);
00802     }
00803   
00804   return u_xlabels;
00805 }

Here is the call graph for this function:

Here is the caller graph for this function:

double * AllocUserGrads ( double *  u_xgrads,
int  nb 
)

Definition at line 696 of file Plo2dn.c.

References MALLOC, NULL, and sciprint().

Referenced by ConstructSubWin(), and CreatePrettyGradsFromNax().

00697 {
00698   
00699   if(nb == 0)
00700     return (double *) NULL;
00701   
00702   if(u_xgrads != NULL)
00703     {
00704       sciprint("Impossible: u_xgrads must be freed before re-allocating");
00705       return (double *) NULL;
00706     }
00707   
00708   if((u_xgrads=(double *)MALLOC(nb*sizeof(double)))==NULL){
00709     sciprint("No more place for allocating user grads using Nax");
00710     return (double *) NULL;
00711   }
00712     
00713   return u_xgrads;
00714 
00715 }

Here is the call graph for this function:

Here is the caller graph for this function:

int Axes3dStrings2 ( integer ixbox,
integer iybox,
integer xind 
)

Author:
F.Leray 18.10.04

le cot\'e gauche ( c'est tjrs un axe des Z

bottom right side

bottom left side

Definition at line 3202 of file Axes.c.

References C2F, Cscale, dr(), i, iflag, j, L, sciSubWindow::mon_title, NULL, PD0, PI0, pLABEL_FEATURE, pSUBWIN_FEATURE, SCI_SUBWIN, sciGetCurrentSubWin(), sciGetEntityType(), sciGetFontDeciWidth(), sciGetFontForeground(), sciGetFontStyle(), sciGetForeground(), sciGetVisibility(), sciprint(), sciSetFontOrientation(), size, wcscalelist::WIRect1, x, and y.

03203 {
03204   integer verbose=0,narg,xz[2],fontid[2],fontsize_kp,color_kp,size;
03205   integer iof,barlengthx = 0,barlengthy = 0, posi[2]; 
03206   integer rect[4],flag=0,x=0,y=0;
03207   double ang=0.0, bbox[6];
03208   int fontsize=-1,textcolor=-1,ticscolor=-1;
03209   int fontstyle=0; /* F.Leray 08.04.04 */
03210   sciPointObj *psubwin = NULL;
03211   sciSubWindow * ppsubwin = NULL;
03212   int ns=2,iflag=0,gstyle,gridStyle=2,dash[6];
03213   double xx[4],yy[4],zz[4],vxx1,vyy1,vzz1;
03214   integer i,xm,ym,vx[2],vy[2],xg[2],yg[2],j;
03215   integer fontid_old[2], textcolor_old;
03216 
03217   int lastzindex = 0, lastxindex = 0, lastyindex = 0;
03218   double xminval, yminval, zminval, xmaxval, ymaxval, zmaxval;
03219   int nbtics = 0;
03220   int nbsubtics = 0;
03221 
03222   int logrect[4], XX = 0, YY = 0; /* see below */ /* ah ouais ou ca ? */
03223   double angle=0.0;
03224 
03225   int constOffset[2] ; /* displacment of labels from the axes segments. */
03226   int maxTicksLabelSize[2] ; /* for each axis the maximum size of ticks label */
03227 
03228 
03229   psubwin= sciGetCurrentSubWin();
03230   ppsubwin = pSUBWIN_FEATURE (psubwin);
03231 
03233   xz[0] = Cscale.WIRect1[2] ;
03234   xz[1] = Cscale.WIRect1[2] ;
03235   iof = (xz[0]+xz[1])/50;
03236 
03237   ticscolor = sciGetForeground(psubwin);
03238   textcolor=sciGetFontForeground(psubwin);
03239 
03240   fontsize=sciGetFontDeciWidth(psubwin)/100;
03241   fontstyle=sciGetFontStyle(psubwin);
03242 
03243   if(sciGetEntityType (psubwin) != SCI_SUBWIN) { 
03244     sciprint("Impossible case\n");
03245     return 0;
03246   }
03247 
03248 
03249   bbox[0] =  xminval = pSUBWIN_FEATURE (psubwin)->FRect[0]; /*xmin*/
03250   bbox[1] =  xmaxval = pSUBWIN_FEATURE (psubwin)->FRect[2]; /*xmax*/
03251   bbox[2] =  yminval = pSUBWIN_FEATURE (psubwin)->FRect[1]; /*ymin*/
03252   bbox[3] =  ymaxval = pSUBWIN_FEATURE (psubwin)->FRect[3]; /*ymax*/ 
03253   bbox[4] =  zminval = pSUBWIN_FEATURE (psubwin)->FRect[4]; /*zmin*/
03254   bbox[5] =  zmaxval = pSUBWIN_FEATURE (psubwin)->FRect[5]; /*zmax*/
03255 
03256   C2F(dr)("xget","font",&verbose,fontid,&narg,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
03257 
03258   fontid[0]= fontstyle;
03259   fontsize_kp = fontid[1] ;
03260   if( fontsize == -1 ){ 
03261     fontid[1]= 1;
03262     C2F(dr)("xset","font",fontid,fontid+1,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
03263   }
03264   else {
03265     fontid[1] = fontsize ;
03266     C2F(dr)("xset","font",fontid,fontid+1,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
03267   }
03268   if ( textcolor != -1 || ticscolor != -1 ) 
03269     C2F(dr)("xget","pattern",&verbose,&color_kp,&narg,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);    
03270 
03271   for (i=0; i<3 ; i++) {
03272     xx[i]=pSUBWIN_FEATURE (psubwin)->axes.xlim[i];
03273     yy[i]=pSUBWIN_FEATURE (psubwin)->axes.ylim[i];
03274     zz[i]=pSUBWIN_FEATURE (psubwin)->axes.zlim[i];
03275   } 
03276 
03277   /* main title */ /* We fix the title always at the top */
03278   rect[0]= Cscale.WIRect1[0] ;
03279   rect[1]= Cscale.WIRect1[1] ;
03280   rect[2]= Cscale.WIRect1[2] ;
03281   rect[3]= Cscale.WIRect1[3]/6 ;
03282   textcolor_old = textcolor;
03283   fontid_old[0] = fontid[0];
03284   fontid_old[1] = fontid[1];
03285 
03286   constOffset[0] = Cscale.WIRect1[2] / 50 + 1 ;
03287   constOffset[1] = Cscale.WIRect1[3] / 25 + 1 ;
03288 
03289   if( sciGetVisibility(ppsubwin->mon_title) )
03290   {
03291     /* get the pointer on the title */
03292     sciLabel * ppLabel = pLABEL_FEATURE( ppsubwin->mon_title ) ;
03293 
03294     /* get position and orientation of the title */
03295     if ( ppLabel->auto_rotation )
03296     {
03297       sciSetFontOrientation( ppsubwin->mon_title, 0 ) ;
03298     }
03299 
03300     if ( ppLabel->auto_position )
03301     {
03302       /* same as in 2d */
03303       int segmentStart[2] = { rect[0] + rect[2], rect[1] } ;
03304       int segmentEnd[2]   = { rect[0]          , rect[1] } ;
03305       computeLabelAutoPos( ppsubwin->mon_title, segmentStart, segmentEnd, constOffset ) ;
03306     }
03307     /* draw the label */
03308     drawTextEntity( ppLabel->text ) ;
03309   }
03310 
03311   textcolor = textcolor_old;
03312   fontid[0] = fontid_old[0];
03313   fontid[1] = fontid_old[1];
03314 
03315   size = xz[0]>=xz[1] ? (integer) (xz[1]/50.0) : (integer) (xz[0]/50.0); 
03316 
03317   /* compute bounding of "10"  string used for log scale ON and auto_ticks ON */
03318   C2F(dr)("xstringl","10",&XX,&YY,logrect,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);   
03319 
03320   /********************************************/
03321   /* draw the axis line if axes_visible is on */
03322   /********************************************/
03323   {
03324     int x2[5] ;
03325     int two = 2 ;
03326     int one = 1 ;
03327     int verbose2 = 0 ;
03328     int dash2[6] ;
03329     int pat ;
03330     int narg2 ;
03331     x2[0] = sciGetForeground (psubwin);
03332     x2[2] = sciGetLineWidth (psubwin) ;
03333     x2[3] = sciGetLineStyle (psubwin);
03334     x2[4] = 0;
03335     C2F(dr)("xget","line style",&verbose2,dash2,&narg2,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L); 
03336     C2F(dr)("xget","pattern",&verbose2,&pat,&narg2,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
03337     C2F (dr) ("xset", "dashes", x2, x2, x2+4, x2+4, x2+4,PI0,PD0,PD0,PD0,PD0, 5L, 6L);
03338     C2F (dr) ("xset","foreground",x2,x2,x2+4,x2+4,x2+4,PI0,PD0,PD0,PD0,PD0,5L,4096); /* F.Leray 05.03.04 Useless too*/
03339     C2F (dr) ("xset","thickness",x2+2,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
03340     C2F (dr) ("xset", "line style", x2+3,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
03341     if ( ppsubwin->axes.axes_visible[2] )
03342     {
03343       /* draw the line of the axis like in 2d */
03344       /* the two bounds are (ixbox[2],iybox[2]) and (ixbox[2],iybox[2]) */
03345       C2F(dr)("xpolys","v",&(ixbox[2]),&(iybox[2]),x2,&one,&two, PI0,PD0,PD0,PD0,PD0,0L,0L);
03346     }
03347     if ( ( xind[4]+xind[5] == 3) || ( xind[4]+xind[5] == 11 ) )
03348     {
03349       /* i copy this test but I don't know what it mean... jb Silvy 03/2006 */
03350       if ( ppsubwin->axes.axes_visible[1] )
03351       {
03352         /* draw the line of the axis like in 2d */
03353         /* the two bounds are (ixbox[3],iybox[3]) and (ixbox[3],iybox[3]) */
03354         C2F(dr)("xpolys","v",&(ixbox[3]),&(iybox[3]),x2,&one,&two, PI0,PD0,PD0,PD0,PD0,0L,0L);
03355       }
03356       if ( ppsubwin->axes.axes_visible[0] )
03357       {
03358         /* draw the line of the axis like in 2d */
03359         /* the two bounds are (ixbox[4],iybox[4]) and (ixbox[4],iybox[4]) */
03360         C2F(dr)("xpolys","v",&(ixbox[4]),&(iybox[4]),x2,&one,&two, PI0,PD0,PD0,PD0,PD0,0L,0L);
03361       }
03362     }
03363     else
03364     {
03365       if ( ppsubwin->axes.axes_visible[1] )
03366       {
03367         /* draw the line of the axis like in 2d */
03368         /* the two bounds are (ixbox[3],iybox[3]) and (ixbox[3],iybox[3]) */
03369         C2F(dr)("xpolys","v",&(ixbox[4]),&(iybox[4]),x2,&one,&two, PI0,PD0,PD0,PD0,PD0,0L,0L);
03370       }
03371       if ( ppsubwin->axes.axes_visible[0] )
03372       {
03373         /* draw the line of the axis like in 2d */
03374         /* the two bounds are (ixbox[4],iybox[4]) and (ixbox[4],iybox[4]) */
03375         C2F(dr)("xpolys","v",&(ixbox[3]),&(iybox[3]),x2,&one,&two, PI0,PD0,PD0,PD0,PD0,0L,0L);
03376       }
03377     }
03378     C2F(dr)("xset","pattern",&pat,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
03379     C2F(dr)("xset","line style",dash2,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
03380   }  
03381 
03382   /********************/
03383   /*** le z scaling ***/ /* DISPLAY Z graduations */
03384   /********************/
03385 
03386 
03387   if (pSUBWIN_FEATURE (psubwin)->project[2]==1)
03388   {
03389     double fx,fy,fz; 
03390     char c_format[5] ;
03391 
03392     integer Ticsdir[2];
03393     Ticsdir[0]=ixbox[3]-ixbox[4]; /* <=> en pixel direction/vecteur non norme(e)s des tics en x */
03394     Ticsdir[1]=iybox[3]-iybox[4]; /* <=> idem pour y */
03395     /* NB: for a default plot3d (simply calling plot3d in siclab console) */
03396     /* Ticsdir[0] & Ticsdir[1] are negative : we do min - max here... */
03397 
03398     BBoxToval(&fx,&fy,&fz,xind[3],bbox); /* xind[3] <=> en bas a gauche <=> zmin */
03399     x=ixbox[2]-(xz[0]+xz[1])/20;
03400     y=(iybox[3]+iybox[2])/2;
03401 
03402     /*       NumberFormat(str,((integer) zz[0]),((integer) zz[2])); */
03403 
03404 
03405     if( !ppsubwin->axes.auto_ticks[2] )
03406     {
03407       /* we display the z tics specified by the user*/
03408       nbtics = ppsubwin->axes.u_nzgrads;
03409       nbsubtics = ppsubwin->axes.nbsubtics[2];
03410 
03411       maxTicksLabelSize[0] = 0 ;
03412       maxTicksLabelSize[1] = 0 ;
03413 
03414       for(i=0;i<nbtics;i++)
03415       {
03416         char *foo = ppsubwin->axes.u_zlabels[i]; 
03417         double ztmp = ppsubwin->axes.u_zgrads[i];
03418 
03419         if(ztmp<zminval || ztmp>zmaxval) 
03420         {
03421           /*   sciprint("je rejete la valeur: %lf\n\n",xtmp); */
03422           continue; /* cas ou TL est ON et on a des graduations qui ne seront pas affichees de tte facon */
03423           /* donc autant ne pas aller plus loin dans l'algo... */
03424         }
03425 
03426 
03427         /***************************************************************/
03428         /************************* COMMON PART *************************/
03429         /***************************************************************/
03430 
03431         if( ppsubwin->axes.reverse[2] )
03432         {
03433           ztmp = InvAxis(ppsubwin->FRect[4],ppsubwin->FRect[5],ztmp);
03434         }
03435 
03436         ComputeGoodTrans3d(psubwin,1,&xm,&ym,&fx,&fy,&ztmp);
03437 
03438 
03439         vx[0]=xm;vy[0]=ym;
03440 
03441         barlengthx= (integer) (( Ticsdir[0])/sqrt((double) Ticsdir[0]*Ticsdir[0]+Ticsdir[1]*Ticsdir[1])*size);
03442         barlengthy= (integer) (( Ticsdir[1])/sqrt((double) Ticsdir[0]*Ticsdir[0]+Ticsdir[1]*Ticsdir[1])*size);
03443         vx[1]=vx[0]+barlengthx;
03444         vy[1]=vy[0]+barlengthy;
03445 
03446         /* foo is set above with sprintf(foo,c_format,xtmp); */
03447 
03448         C2F(dr)("xset","font",fontid,fontid+1,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L); /* fix bug noticed by R.N. */
03449 
03450         /* get the size of ticks label */
03451         C2F(dr)("xstringl",foo,&x,&y,rect,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
03452         maxTicksLabelSize[0] = Max( maxTicksLabelSize[0], rect[2] ) ;
03453         maxTicksLabelSize[1] = Max( maxTicksLabelSize[1], rect[3] ) ;
03454 
03455 
03456         posi[0] = inint( xm+2*barlengthx - rect[2]); 
03457         posi[1]=inint( ym + 2*barlengthy + rect[3]/2);
03458 
03459 
03460         if(ppsubwin->axes.axes_visible[2] == TRUE){
03461           C2F(dr)("xset","pattern",&textcolor,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
03462           C2F(dr)("xset","font",fontid,fontid+1,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
03463           C2F(dr)("xstring",foo,&(posi[0]),&(posi[1]),PI0,&flag,PI0,PI0,&ang, PD0,PD0,PD0,0L,0L);
03464           C2F(dr)("xset","pattern",&ticscolor,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
03465           C2F(dr)("xsegs","v", vx, vy, &ns,&ticscolor,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
03466         }
03467         /* grid to put here */
03468         if ( ppsubwin->grid[2] > -1 && ppsubwin->axes.axes_visible[2] )
03469         {
03470           gstyle = pSUBWIN_FEATURE (psubwin)->grid[2];
03471 
03472           if((ppsubwin->logflags[2] =='l') && (i != nbtics-1))
03473           {
03474             double tmp[2];
03475             double pas=0;
03476             double * tmp_log_grads = (double *) NULL;
03477 
03478 
03479             double * grads = ppsubwin->axes.u_zgrads;
03480 
03481             tmp[0] = exp10(grads[i]);
03482             tmp[1] = exp10(grads[i+1]);
03483             pas = (exp10(grads[i+1]) - exp10(grads[i])) / (nbsubtics );
03484 
03485             if((tmp_log_grads = (double *)MALLOC(nbsubtics*sizeof(double)))==NULL){
03486               sciprint("Error allocating tmp_log_grads\n");
03487               return -1;
03488             }
03489 
03490             for(j=0;j<nbsubtics;j++) tmp_log_grads[j] = log10(tmp[0]+(j)*pas);
03491 
03492             for(j=0;j<nbsubtics;j++)
03493             {
03494               vzz1 = tmp_log_grads[j];
03495 
03496               if(vzz1<=zminval || vzz1>=zmaxval) continue;       
03497 
03498               if(ppsubwin->axes.reverse[2] == TRUE)
03499                 vzz1 = InvAxis(ppsubwin->FRect[4],ppsubwin->FRect[5],vzz1);
03500 
03501               ComputeGoodTrans3d(psubwin,1,&xm,&ym,&fx,&fy,&vzz1);
03502 
03503               /*  if ((ym != iybox[3]) && (ym != iybox[2])) */
03504               /*                            { */
03505               C2F(dr)("xget","line style",&verbose,dash,&narg,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
03506               C2F (dr) ("xset", "line style",&gridStyle,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
03507               xg[0]= ixbox[3];yg[0]= ym;
03508               if (Ishidden(psubwin))
03509               {  xg[1]=ixbox[4];  yg[1]= iybox[4]- iybox[3]+ym;}
03510               else
03511               {xg[1]=ixbox[1];  yg[1]= iybox[1]- iybox[2]+ym;}
03512               C2F(dr)("xsegs","v", xg, yg, &ns,&gstyle,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
03513               xg[0]=xg[1];  ; xg[1] =ixbox[0];
03514               yg[0]=yg[1]; yg[1]= ym- iybox[3]+ iybox[5];
03515               C2F(dr)("xsegs","v", xg, yg, &ns,&gstyle,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
03516               C2F(dr)("xset","line style",dash,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
03517               /*   } */
03518             }
03519             FREE(tmp_log_grads); tmp_log_grads = (double *) NULL;
03520           }
03521           else
03522           { 
03523             if(ztmp>zminval && ztmp<zmaxval) 
03524             {
03525               C2F(dr)("xget","line style",&verbose,dash,&narg,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
03526               C2F (dr) ("xset", "line style",&gridStyle,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
03527               xg[0]= ixbox[3];yg[0]= ym;
03528               if (Ishidden(psubwin))
03529               {  xg[1]=ixbox[4];  yg[1]= iybox[4]- iybox[3]+ym;}
03530               else
03531               {xg[1]=ixbox[1];  yg[1]= iybox[1]- iybox[2]+ym;}
03532               C2F(dr)("xsegs","v", xg, yg, &ns,&gstyle,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
03533               xg[0]=xg[1];  ; xg[1] =ixbox[0];
03534               yg[0]=yg[1]; yg[1]= ym- iybox[3]+ iybox[5];
03535               C2F(dr)("xsegs","v", xg, yg, &ns,&gstyle,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
03536               C2F(dr)("xset","line style",dash,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
03537             }
03538           }
03539         }
03540 
03541         /* and subtics */
03542         if(i != nbtics-1)
03543         {
03544           if(ppsubwin->logflags[2] =='l')
03545           {
03546             double tmp[2];
03547             double pas=0;
03548             double * tmp_log_grads = (double *) NULL;
03549 
03550 
03551             double * grads = ppsubwin->axes.u_zgrads;
03552 
03553             tmp[0] = exp10(grads[i]);
03554             tmp[1] = exp10(grads[i+1]);
03555             pas = (exp10(grads[i+1]) - exp10(grads[i])) / (nbsubtics );
03556 
03557             if((tmp_log_grads = (double *)MALLOC(nbsubtics*sizeof(double)))==NULL){
03558               sciprint("Error allocating tmp_log_grads\n");
03559               return -1;
03560             }
03561 
03562             for(j=0;j<nbsubtics;j++) tmp_log_grads[j] = log10(tmp[0]+(j)*pas);
03563 
03564             for(j=0;j<nbsubtics;j++)
03565             {
03566               vzz1 = tmp_log_grads[j];
03567 
03568               if(vzz1<zminval || vzz1>zmaxval) continue;
03569 
03570               if(ppsubwin->axes.reverse[2] == TRUE)
03571                 vzz1 = InvAxis(ppsubwin->FRect[4],ppsubwin->FRect[5],vzz1);
03572 
03573               ComputeGoodTrans3d(psubwin,1,&xm,&ym,&fx,&fy,&vzz1);
03574 
03575               vx[0]=xm;vy[0]=ym;
03576               vx[1]= (integer) (vx[0]+barlengthx/2.0);
03577               vy[1]= (integer) (vy[0]+barlengthy/2.0);
03578 
03579               if(ppsubwin->axes.axes_visible[2] == TRUE)
03580                 C2F(dr)("xsegs","v", vx, vy, &ns,&ticscolor,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
03581             }
03582             FREE(tmp_log_grads); tmp_log_grads = (double *) NULL;
03583           } /* end NEW */
03584           else
03585           {
03586             double xtmp = ppsubwin->axes.u_zgrads[i];
03587             double dx = (ppsubwin->axes.u_zgrads[i+1] - ppsubwin->axes.u_zgrads[i]) / nbsubtics;
03588             for(j=0;j<nbsubtics;j++)
03589             {
03590               vzz1=xtmp+dx*j;
03591 
03592               if(vzz1<zminval || vzz1>zmaxval) continue;         
03593 
03594               if(ppsubwin->axes.reverse[2] == TRUE)
03595                 vzz1 = InvAxis(ppsubwin->FRect[4],ppsubwin->FRect[5],vzz1);
03596 
03597               ComputeGoodTrans3d(psubwin,1,&xm,&ym,&fx,&fy,&vzz1);
03598               /*                      trans3d(psubwin,1,&xm,&ym,&fx,&fy,&vzz1); */
03599 
03600 
03601               vx[0]=xm;vy[0]=ym;
03602               vx[1]= (integer) (vx[0]+barlengthx/2.0);
03603               vy[1]= (integer) (vy[0]+barlengthy/2.0);
03604 
03605               if(ppsubwin->axes.axes_visible[2] == TRUE)
03606                 C2F(dr)("xsegs","v", vx, vy, &ns,&ticscolor,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
03607             }
03608           } 
03609         }
03610 
03611         /***************************************************************/
03612         /************************* END OF COMMON PART ******************/
03613         /***************************************************************/
03614       }
03615     }
03616     else /* we display the computed tics */
03617     {
03618       AdaptGraduationsOnZ(x,y,size,Ticsdir,fontid,psubwin,zminval,zmaxval,fx,fy,0.);
03619 
03620       lastzindex = ppsubwin->axes.nzgrads - 1;
03621 
03622       if(lastzindex == 0)
03623         ChooseFormatForOneGrad(c_format,&(ppsubwin->axes.zgrads[0]));
03624       else
03625         ChoixFormatE(c_format,
03626         ppsubwin->axes.zgrads[0],
03627         ppsubwin->axes.zgrads[lastzindex],
03628         ((ppsubwin->axes.zgrads[lastzindex])-(ppsubwin->axes.zgrads[0]))/(lastzindex));
03629 
03630       nbtics = ppsubwin->axes.nzgrads;
03631       nbsubtics = ppsubwin->axes.nbsubtics[2];
03632 
03633       maxTicksLabelSize[0] = 0 ;
03634       maxTicksLabelSize[1] = 0 ;
03635 
03636       for(i=0;i<nbtics;i++)
03637       {
03638         char foo[256]; 
03639         double ztmp = ppsubwin->axes.zgrads[i];
03640 
03641         if(ztmp<zminval || ztmp>zmaxval) 
03642         {
03643           /*   sciprint("je rejete la valeur: %lf\n\n",xtmp); */
03644           continue; /* cas ou TL est ON et on a des graduations qui ne seront pas affichees de tte facon */
03645           /* donc autant ne pas aller plus loin dans l'algo... */
03646         }
03647 
03648         sprintf(foo,c_format,ztmp);
03649 
03650         /***************************************************************/
03651         /************************* COMMON PART *************************/
03652         /***************************************************************/
03653         if(ppsubwin->axes.reverse[2] == TRUE)
03654           ztmp = InvAxis(ppsubwin->FRect[4],ppsubwin->FRect[5],ztmp);
03655 
03656         ComputeGoodTrans3d(psubwin,1,&xm,&ym,&fx,&fy,&ztmp);
03657 
03658         /*            trans3d(psubwin,1,&xm,&ym,&fx,&fy,&ztmp); */
03659 
03660 
03661         vx[0]=xm;vy[0]=ym;
03662 
03663         barlengthx= (integer) (( Ticsdir[0])/sqrt((double) Ticsdir[0]*Ticsdir[0]+Ticsdir[1]*Ticsdir[1])*size);
03664         barlengthy= (integer) (( Ticsdir[1])/sqrt((double) Ticsdir[0]*Ticsdir[0]+Ticsdir[1]*Ticsdir[1])*size);
03665         vx[1]=vx[0]+barlengthx;
03666         vy[1]=vy[0]+barlengthy;
03667 
03668         /* foo is set above with sprintf(foo,c_format,xtmp); */
03669 
03670         C2F(dr)("xset","font",fontid,fontid+1,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L); /* fix bug noticed by R.N. */
03671 
03672         /* get the size of ticks label */
03673         C2F(dr)("xstringl",foo,&x,&y,rect,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
03674         maxTicksLabelSize[0] = Max( maxTicksLabelSize[0], rect[2] ) ;
03675         maxTicksLabelSize[1] = Max( maxTicksLabelSize[1], rect[3] ) ;
03676 
03677         posi[0] = inint( xm+2*barlengthx - rect[2]); 
03678         posi[1]=inint( ym + 2*barlengthy + rect[3]/2);
03679 
03680         if(ppsubwin->axes.axes_visible[2] == TRUE){
03681           C2F(dr)("xset","pattern",&textcolor,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
03682           C2F(dr)("xset","font",fontid,fontid+1,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
03683           if ( ppsubwin->logflags[2] == 'l' )
03684           {
03685             int smallersize = fontid[1]-2;
03686             int old_rect10[4];
03687             /*              char str[2] = "xv"; */
03688             int posi10[2];
03689 
03690             posi10[0] = posi[0] - logrect[2];
03691             posi10[1] = posi[1] + logrect[3];
03692 
03693             C2F(dr)("xset","font",fontid,fontid+1,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
03694             C2F(dr)("xstring","10",(&posi10[0]),(&posi10[1]),PI0,&flag,PI0,PI0,&angle,PD0,PD0,PD0,0L,0L);
03695 
03696             C2F(dr)("xstringl","10",(&posi10[0]),(&posi10[1]),old_rect10,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
03697 
03698             posi[0] = old_rect10[0] + old_rect10[2];
03699             posi[1] = (int) (old_rect10[1] - old_rect10[3]*.1);
03700 
03701             C2F(dr)("xset","font",fontid,&smallersize,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
03702             C2F(dr)("xstring",foo,&(posi[0]),&(posi[1]),PI0,&flag,PI0,PI0,&ang, PD0,PD0,PD0,0L,0L);
03703 
03704             /* put back the current fontid */
03705             C2F(dr)("xset","font",fontid,fontid+1,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
03706           }
03707           else{
03708             C2F(dr)("xstring",foo,&(posi[0]),&(posi[1]),PI0,&flag,PI0,PI0,&ang, PD0,PD0,PD0,0L,0L);
03709           }
03710 
03711           C2F(dr)("xset","pattern",&ticscolor,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);   
03712           C2F(dr)("xsegs","v", vx, vy, &ns,&ticscolor,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
03713         }
03714         /* grid to put here */
03715         if ( ppsubwin->grid[2] > -1 && ppsubwin->axes.axes_visible[2] )
03716         {
03717           gstyle = pSUBWIN_FEATURE (psubwin)->grid[2];
03718 
03719           if((ppsubwin->logflags[2] =='l') && (i != nbtics-1))
03720           {
03721             double tmp[2];
03722             double pas=0;
03723             double * tmp_log_grads = (double *) NULL;
03724 
03725 
03726             double * grads = ppsubwin->axes.zgrads;
03727 
03728             tmp[0] = exp10(grads[i]);
03729             tmp[1] = exp10(grads[i+1]);
03730             pas = (exp10(grads[i+1]) - exp10(grads[i])) / (nbsubtics );
03731 
03732             if((tmp_log_grads = (double *)MALLOC(nbsubtics*sizeof(double)))==NULL){
03733               sciprint("Error allocating tmp_log_grads\n");
03734               return -1;
03735             }
03736 
03737             for(j=0;j<nbsubtics;j++) tmp_log_grads[j] = log10(tmp[0]+(j)*pas);
03738 
03739             for(j=0;j<nbsubtics;j++)
03740             {
03741               vzz1 = tmp_log_grads[j];
03742 
03743               if(vzz1<=zminval || vzz1>=zmaxval) continue;       
03744 
03745               if(ppsubwin->axes.reverse[2] == TRUE)
03746                 vzz1 = InvAxis(ppsubwin->FRect[4],ppsubwin->FRect[5],vzz1);
03747 
03748               ComputeGoodTrans3d(psubwin,1,&xm,&ym,&fx,&fy,&vzz1);
03749 
03750               /*  if ((ym != iybox[3]) && (ym != iybox[2])) */
03751               /*                            { */
03752               C2F(dr)("xget","line style",&verbose,dash,&narg,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
03753               C2F (dr) ("xset", "line style",&gridStyle,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
03754               xg[0]= ixbox[3];yg[0]= ym;
03755               if (Ishidden(psubwin))
03756               {  xg[1]=ixbox[4];  yg[1]= iybox[4]- iybox[3]+ym;}
03757               else
03758               {xg[1]=ixbox[1];  yg[1]= iybox[1]- iybox[2]+ym;}
03759               C2F(dr)("xsegs","v", xg, yg, &ns,&gstyle,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
03760               xg[0]=xg[1];  ; xg[1] =ixbox[0];
03761               yg[0]=yg[1]; yg[1]= ym- iybox[3]+ iybox[5];
03762               C2F(dr)("xsegs","v", xg, yg, &ns,&gstyle,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
03763               C2F(dr)("xset","line style",dash,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
03764               /*   } */
03765             }
03766             FREE(tmp_log_grads); tmp_log_grads = (double *) NULL;
03767           }
03768           else
03769           {
03770             if(ztmp>zminval && ztmp<zmaxval) 
03771             {
03772               C2F(dr)("xget","line style",&verbose,dash,&narg,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
03773               C2F (dr) ("xset", "line style",&gridStyle,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
03774               xg[0]= ixbox[3];yg[0]= ym;
03775               if (Ishidden(psubwin))
03776               {  xg[1]=ixbox[4];  yg[1]= iybox[4]- iybox[3]+ym;}
03777               else
03778               {xg[1]=ixbox[1];  yg[1]= iybox[1]- iybox[2]+ym;}
03779               C2F(dr)("xsegs","v", xg, yg, &ns,&gstyle,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
03780               xg[0]=xg[1];  ; xg[1] =ixbox[0];
03781               yg[0]=yg[1]; yg[1]= ym- iybox[3]+ iybox[5];
03782               C2F(dr)("xsegs","v", xg, yg, &ns,&gstyle,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
03783               C2F(dr)("xset","line style",dash,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
03784             }
03785           }
03786         }
03787 
03788         /* and subtics */
03789         if(i != nbtics-1)
03790         {
03791           if(ppsubwin->logflags[2] =='l')
03792           {
03793             double tmp[2];
03794             double pas=0;
03795             double * tmp_log_grads = (double *) NULL;
03796 
03797 
03798             double * grads = ppsubwin->axes.zgrads;
03799 
03800             tmp[0] = exp10(grads[i]);
03801             tmp[1] = exp10(grads[i+1]);
03802             pas = (exp10(grads[i+1]) - exp10(grads[i])) / (nbsubtics );
03803 
03804             if((tmp_log_grads = (double *)MALLOC(nbsubtics*sizeof(double)))==NULL){
03805               sciprint("Error allocating tmp_log_grads\n");
03806               return -1;
03807             }
03808 
03809             for(j=0;j<nbsubtics;j++) tmp_log_grads[j] = log10(tmp[0]+(j)*pas);
03810 
03811             for(j=0;j<nbsubtics;j++)
03812             {
03813               vzz1 = tmp_log_grads[j];
03814 
03815               if(vzz1<zminval || vzz1>zmaxval) continue;
03816 
03817               if(ppsubwin->axes.reverse[2] == TRUE)
03818                 vzz1 = InvAxis(ppsubwin->FRect[4],ppsubwin->FRect[5],vzz1);
03819 
03820               ComputeGoodTrans3d(psubwin,1,&xm,&ym,&fx,&fy,&vzz1);
03821 
03822               vx[0]=xm;vy[0]=ym;
03823               vx[1]= (integer) (vx[0]+barlengthx/2.0);
03824               vy[1]= (integer) (vy[0]+barlengthy/2.0);
03825 
03826               if(ppsubwin->axes.axes_visible[2] == TRUE)
03827                 C2F(dr)("xsegs","v", vx, vy, &ns,&ticscolor,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
03828             }
03829             FREE(tmp_log_grads); tmp_log_grads = (double *) NULL;
03830           } /* end NEW */
03831           else
03832           {
03833             double ztmp2 = ppsubwin->axes.zgrads[i];
03834             double dz = (ppsubwin->axes.zgrads[i+1] - ppsubwin->axes.zgrads[i]) / nbsubtics;
03835             for(j=0;j<nbsubtics;j++)
03836             {
03837               vzz1=ztmp2+dz*j;
03838 
03839               if(vzz1<zminval || vzz1>zmaxval) continue;
03840 
03841               if(ppsubwin->axes.reverse[2] == TRUE)
03842                 vzz1 = InvAxis(ppsubwin->FRect[4],ppsubwin->FRect[5],vzz1);
03843 
03844               ComputeGoodTrans3d(psubwin,1,&xm,&ym,&fx,&fy,&vzz1);
03845               /*                      trans3d(psubwin,1,&xm,&ym,&fx,&fy,&vzz1); */
03846 
03847 
03848               vx[0]=xm;vy[0]=ym;
03849               vx[1]= (integer) (vx[0]+barlengthx/2.0);
03850               vy[1]= (integer) (vy[0]+barlengthy/2.0);
03851 
03852               if(ppsubwin->axes.axes_visible[2] == TRUE)
03853                 C2F(dr)("xsegs","v", vx, vy, &ns,&ticscolor,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
03854             }
03855           }
03856         }
03857         /***************************************************************/
03858         /************************* END OF COMMON PART ******************/
03859         /***************************************************************/
03860 
03861       }
03862     }
03863   }
03864 
03865   if ( sciGetVisibility(ppsubwin->mon_z_label) )
03866   {
03867     /* draw z label */
03868     sciLabel * ppLabel = pLABEL_FEATURE(ppsubwin->mon_z_label) ;
03869 
03870     if ( ppLabel->auto_rotation )
03871     {
03872       /* mult by 10 because */
03873       sciSetFontOrientation(ppsubwin->mon_z_label, 270 * 10 ) ;
03874     }
03875 
03876     if( ppLabel->auto_position )
03877     {
03878 
03879       int segmentStart[2] = { ixbox[2], iybox[2] } ;
03880       int segmentEnd[2]   = { ixbox[3], iybox[3] } ;
03881 
03882       /* add the bar size and ticks label size to the offset */
03883       int offset[2] = { constOffset[0] + maxTicksLabelSize[0] + abs( barlengthx ), 
03884         constOffset[1] + maxTicksLabelSize[1] + abs( barlengthy )  } ;
03885       computeLabelAutoPos( ppsubwin->mon_z_label, segmentStart, segmentEnd, offset ) ;
03886     }
03887     /* a trick to force the display with 2d scale */
03888     drawTextEntity( ppLabel->text ) ;
03889 
03890   }
03891 
03892 
03893   /***********************/ 
03894   /*** le  x-y scaling ***/ /* DISPLAY x or y graduations */
03895   /***********************/
03896 
03897 
03898   if (( xind[4]+xind[5] == 3) || ( xind[4]+xind[5] == 11))
03899   {
03900     if (pSUBWIN_FEATURE (psubwin)->project[0]==1) /* x HERE */
03901     {
03902       double fx,fy,fz;
03903       char c_format[5];
03904 
03905       integer Ticsdir[2]; 
03906       Ticsdir[0]=ixbox[4]-ixbox[3];
03907       Ticsdir[1]=iybox[4]-iybox[3];
03908       BBoxToval(&fx,&fy,&fz,xind[4],bbox);
03909       x=inint((ixbox[4]+ixbox[5])/2+1.5*rect[2] +iof);
03910       y=inint(((2/3.0)*iybox[4]+(1/3.0)*iybox[5])+1.5*rect[3]+iof);
03911 
03912       if( !ppsubwin->axes.auto_ticks[0] )
03913       {
03914         /* we display the x tics specified by the user*/
03915         nbtics = ppsubwin->axes.u_nxgrads;
03916         nbsubtics = ppsubwin->axes.nbsubtics[0];
03917 
03918         maxTicksLabelSize[0] = 0 ;
03919         maxTicksLabelSize[1] = 0 ;
03920 
03921         for(i=0;i<nbtics;i++)
03922         {
03923           char *foo = ppsubwin->axes.u_xlabels[i]; 
03924           double xtmp = ppsubwin->axes.u_xgrads[i];
03925 
03926           if(xtmp<xminval || xtmp>xmaxval) 
03927           {
03928             /*   sciprint("je rejete la valeur: %lf\n\n",xtmp); */
03929             continue; /* cas ou TL est ON et on a des graduations qui ne seront pas affichees de tte facon */
03930             /* donc autant ne pas aller plus loin dans l'algo... */
03931           }
03932 
03933           /***************************************************************/
03934           /************************* COMMON PART *************************/
03935           /***************************************************************/
03936 
03937           if(ppsubwin->axes.reverse[0] == TRUE)
03938             xtmp = InvAxis(ppsubwin->FRect[0],ppsubwin->FRect[2],xtmp);
03939 
03940           ComputeGoodTrans3d(psubwin,1,&xm,&ym,&xtmp,&fy,&fz);
03941           /*   trans3d(psubwin,1,&xm,&ym,&xtmp,&fy,&fz); */
03942 
03943 
03944           vx[0]=xm;vy[0]=ym;
03945 
03946           barlengthx= (integer) (( Ticsdir[0])/sqrt((double) Ticsdir[0]*Ticsdir[0]+Ticsdir[1]*Ticsdir[1])*size);
03947           barlengthy= (integer) (( Ticsdir[1])/sqrt((double) Ticsdir[0]*Ticsdir[0]+Ticsdir[1]*Ticsdir[1])*size);
03948 
03949           C2F(dr)("xset","font",fontid,fontid+1,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L); /* fix bug noticed by R.N. */
03950 
03951           /* get the size of the icks label */
03952           C2F(dr)("xstringl",foo,&x,&y,rect,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
03953           maxTicksLabelSize[0] = Max( maxTicksLabelSize[0], rect[2] ) ;
03954           maxTicksLabelSize[1] = Max( maxTicksLabelSize[1], rect[3] ) ;
03955 
03956 
03957           if (IsDownAxes(psubwin)){
03958             vx[1]=vx[0];
03959             vy[1]=vy[0]+iof/2;
03960             posi[0] = inint(xm-rect[2]/2); 
03961             posi[1]=inint( vy[0] + iof + rect[3]);}
03962           else{
03963             vx[1]=vx[0]+barlengthx;
03964             vy[1]=vy[0]+barlengthy;
03965             posi[0] = inint( xm+2*barlengthx);
03966             posi[1]=inint( ym + 2*barlengthy + rect[3]);}
03967 
03968           if( ppsubwin->axes.axes_visible[0] )
03969           {    
03970             C2F(dr)("xset","pattern",&textcolor,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
03971             C2F(dr)("xset","font",fontid,fontid+1,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
03972             C2F(dr)("xstring",foo,&(posi[0]),&(posi[1]),PI0,&flag,PI0,PI0,&ang, PD0,PD0,PD0,0L,0L);
03973             C2F(dr)("xset","pattern",&ticscolor,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);   
03974             C2F(dr)("xsegs","v", vx, vy, &ns,&ticscolor,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
03975           }
03976           /* grid to put here */
03977           if ( ppsubwin->grid[0] > -1 && ppsubwin->axes.axes_visible[0] )
03978           {
03979             gstyle = pSUBWIN_FEATURE (psubwin)->grid[0];
03980 
03981             if((ppsubwin->logflags[0] =='l') && (i != nbtics-1))
03982             {
03983               double tmp[2];
03984               double pas=0;
03985               double * tmp_log_grads = (double *) NULL;
03986 
03987 
03988               double * grads = ppsubwin->axes.u_xgrads;
03989 
03990               tmp[0] = exp10(grads[i]);
03991               tmp[1] = exp10(grads[i+1]);
03992               pas = (exp10(grads[i+1]) - exp10(grads[i])) / (nbsubtics );
03993 
03994               if((tmp_log_grads = (double *)MALLOC(nbsubtics*sizeof(double)))==NULL){
03995                 sciprint("Error allocating tmp_log_grads\n");
03996                 return -1;
03997               }
03998 
03999               for(j=0;j<nbsubtics;j++) tmp_log_grads[j] = log10(tmp[0]+(j)*pas);
04000 
04001               for(j=0;j<nbsubtics;j++)
04002               {
04003                 vxx1 = tmp_log_grads[j];
04004 
04005                 if(vxx1<=xminval || vxx1>=xmaxval) continue;
04006 
04007                 if(ppsubwin->axes.reverse[0] == TRUE)
04008                   vxx1 = InvAxis(ppsubwin->FRect[0],ppsubwin->FRect[2],vxx1);
04009 
04010                 ComputeGoodTrans3d(psubwin,1,&xm,&ym,&vxx1,&fy,&fz);
04011 
04012                 /*  if ((xm != ixbox[5]) && (xm != ixbox[4])) */
04013                 /*                              {  */
04014                 xg[0]= xm;  yg[0]= ym;  
04015                 if (Ishidden(psubwin)) 
04016                 { xg[1]= xm; yg[1]= iybox[2] -iybox[3]+ym; }
04017                 else
04018                 {xg[1]= ixbox[3] - ixbox[4] +xm; yg[1]= iybox[3] - iybox[4] +ym; } 
04019 
04020                 C2F(dr)("xget","line style",&verbose,dash,&narg,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
04021                 C2F (dr) ("xset", "line style",&gridStyle,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
04022                 C2F(dr)("xsegs","v", xg, yg, &ns,&gstyle,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
04023                 xg[0]= xg[1]; yg[0]= yg[1];
04024                 xg[1] = ixbox[3] - ixbox[4] +xm; 
04025                 yg[1]=  iybox[2] - iybox[4] +ym;
04026                 C2F(dr)("xsegs","v", xg, yg, &ns,&gstyle,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
04027                 C2F(dr)("xset","line style",dash,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);  
04028                 /*      } */
04029               }
04030               FREE(tmp_log_grads); tmp_log_grads = (double *) NULL;
04031             }
04032             else
04033             {
04034               if(xtmp>xminval && xtmp<xmaxval) 
04035               {
04036                 xg[0]= xm;  yg[0]= ym;  
04037                 if (Ishidden(psubwin)) 
04038                 { xg[1]= xm; yg[1]= iybox[2] -iybox[3]+ym; }
04039                 else
04040                 {xg[1]= ixbox[3] - ixbox[4] +xm; yg[1]= iybox[3] - iybox[4] +ym; } 
04041                 C2F(dr)("xget","line style",&verbose,dash,&narg,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
04042                 C2F (dr) ("xset", "line style",&gridStyle,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
04043                 C2F(dr)("xsegs","v", xg, yg, &ns,&gstyle,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
04044                 xg[0]= xg[1]; yg[0]= yg[1];
04045                 xg[1] = ixbox[3] - ixbox[4] +xm; 
04046                 yg[1]=  iybox[2] - iybox[4] +ym;
04047                 C2F(dr)("xsegs","v", xg, yg, &ns,&gstyle,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
04048                 C2F(dr)("xset","line style",dash,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);  
04049               }
04050             }
04051           }
04052 
04053           /* and subtics */
04054           if(i != nbtics-1)
04055           {
04056             if(ppsubwin->logflags[0] =='l')
04057             {
04058               double tmp[2];
04059               double pas=0;
04060               double * tmp_log_grads = (double *) NULL;
04061 
04062 
04063               double * grads = ppsubwin->axes.u_xgrads;
04064 
04065               tmp[0] = exp10(grads[i]);
04066               tmp[1] = exp10(grads[i+1]);
04067               pas = (exp10(grads[i+1]) - exp10(grads[i])) / (nbsubtics );
04068 
04069               if((tmp_log_grads = (double *)MALLOC(nbsubtics*sizeof(double)))==NULL){
04070                 sciprint("Error allocating tmp_log_grads\n");
04071                 return -1;
04072               }
04073 
04074               for(j=0;j<nbsubtics;j++) tmp_log_grads[j] = log10(tmp[0]+(j)*pas);
04075 
04076               for(j=0;j<nbsubtics;j++)
04077               {
04078                 vxx1 = tmp_log_grads[j];
04079 
04080                 if(vxx1<xminval || vxx1>xmaxval) continue;
04081 
04082                 if(ppsubwin->axes.reverse[0] == TRUE)
04083                   vxx1 = InvAxis(ppsubwin->FRect[0],ppsubwin->FRect[2],vxx1);
04084 
04085                 ComputeGoodTrans3d(psubwin,1,&xm,&ym,&vxx1,&fy,&fz);
04086 
04087                 if (IsDownAxes(psubwin))
04088                 {
04089                   vx[1]=vx[0]=xm;
04090                   vy[0]=ym;
04091                   vy[1]=vy[0]+iof/4;
04092                 }
04093                 else
04094                 {
04095                   vx[0]=xm;vy[0]=ym;
04096                   vx[1]= (integer) (vx[0]+barlengthx/2.0);
04097                   vy[1]= (integer) (vy[0]+barlengthy/2.0);
04098                 }
04099 
04100                 if(ppsubwin->axes.axes_visible[0] == TRUE)
04101                   C2F(dr)("xsegs","v", vx, vy, &ns,&ticscolor,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
04102               }
04103 
04104               FREE(tmp_log_grads); tmp_log_grads = (double *) NULL;
04105             } /* end NEW */
04106             else
04107             {
04108               double xtmp2 = ppsubwin->axes.u_xgrads[i];
04109               double dx = (ppsubwin->axes.u_xgrads[i+1] - ppsubwin->axes.u_xgrads[i]) / nbsubtics;
04110 
04111               for (j=1;j<nbsubtics;j++)
04112               {  
04113                 vxx1=xtmp2+dx*j;
04114 
04115                 if(vxx1<xminval || vxx1>xmaxval) continue;
04116 
04117                 if(ppsubwin->axes.reverse[0] == TRUE)
04118                   vxx1 = InvAxis(ppsubwin->FRect[0],ppsubwin->FRect[2],vxx1);
04119 
04120                 ComputeGoodTrans3d(psubwin,1,&xm,&ym,&vxx1,&fy,&fz);
04121                 /*                        trans3d(psubwin,1,&xm,&ym,&vxx1,&fy,&fz); */
04122 
04123 
04124                 if (IsDownAxes(psubwin))
04125                 {
04126                   vx[1]=vx[0]=xm;
04127                   vy[0]=ym;
04128                   vy[1]=vy[0]+iof/4;
04129                 }
04130                 else
04131                 {
04132                   vx[0]=xm;vy[0]=ym;
04133                   vx[1]= (integer) (vx[0]+barlengthx/2.0);
04134                   vy[1]= (integer) (vy[0]+barlengthy/2.0);
04135                 }
04136 
04137                 if(ppsubwin->axes.axes_visible[0] == TRUE)   
04138                   C2F(dr)("xsegs","v", vx, vy, &ns,&ticscolor,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
04139               }
04140             }
04141           }
04142           /***************************************************************/
04143           /************************* END OF COMMON PART ******************/
04144           /***************************************************************/
04145 
04146         }
04147       }
04148       else /* we display the computed tics */
04149       {
04150         AdaptGraduationsOnXBottomRight(iof,x,y,size,Ticsdir,fontid,psubwin,xminval,xmaxval,0.,fy,fz);
04151 
04152         lastxindex = ppsubwin->axes.nxgrads - 1;
04153 
04154         if(lastxindex == 0)
04155         {
04156           ChooseFormatForOneGrad(c_format,&(ppsubwin->axes.xgrads[0]));
04157         }
04158         else
04159         {
04160           ChoixFormatE(c_format,
04161             ppsubwin->axes.xgrads[0],
04162             ppsubwin->axes.xgrads[lastxindex],
04163             ((ppsubwin->axes.xgrads[lastxindex])-(ppsubwin->axes.xgrads[0]))/(lastxindex));
04164         }
04165 
04166         nbtics = ppsubwin->axes.nxgrads;
04167         nbsubtics = ppsubwin->axes.nbsubtics[0];
04168 
04169         maxTicksLabelSize[0] = 0 ;
04170         maxTicksLabelSize[1] = 0 ;
04171 
04172         for(i=0;i<nbtics;i++)
04173         {
04174           char foo[256]; 
04175           double xtmp = ppsubwin->axes.xgrads[i];
04176 
04177           if(xtmp<xminval || xtmp>xmaxval) 
04178           {
04179             /*   sciprint("je rejete la valeur: %lf\n\n",xtmp); */
04180             continue; /* cas ou TL est ON et on a des graduations qui ne seront pas affichees de tte facon */
04181             /* donc autant ne pas aller plus loin dans l'algo... */
04182           }
04183 
04184           sprintf(foo,c_format,xtmp);
04185 
04186           /***************************************************************/
04187           /************************* COMMON PART *************************/
04188           /***************************************************************/
04189 
04190 
04191           /* F.Leray 03.11.04 Test if log scale to perform a : exp10(x) because trans3d will */
04192           /* re-do a log10() (that is needed for data computations) */
04193 
04194           if( ppsubwin->axes.reverse[0] )
04195           {
04196             xtmp = InvAxis(ppsubwin->FRect[0],ppsubwin->FRect[2],xtmp);
04197           }
04198 
04199           ComputeGoodTrans3d(psubwin,1,&xm,&ym,&xtmp,&fy,&fz);
04200 
04201           vx[0]=xm;vy[0]=ym; 
04202 
04203           barlengthx= (integer) (( Ticsdir[0])/sqrt((double) Ticsdir[0]*Ticsdir[0]+Ticsdir[1]*Ticsdir[1])*size);
04204           barlengthy= (integer) (( Ticsdir[1])/sqrt((double) Ticsdir[0]*Ticsdir[0]+Ticsdir[1]*Ticsdir[1])*size);
04205 
04206           C2F(dr)("xset","font",fontid,fontid+1,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L); /* fix bug noticed by R.N. */
04207 
04208           /* get the size of ticks label */
04209           C2F(dr)("xstringl",foo,&x,&y,rect,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
04210           maxTicksLabelSize[0] = Max( maxTicksLabelSize[0], rect[2] ) ;
04211           maxTicksLabelSize[1] = Max( maxTicksLabelSize[1], rect[3] ) ;
04212 
04213           if (IsDownAxes(psubwin)){
04214             vx[1]=vx[0];
04215             vy[1]=vy[0]+iof/2;
04216             posi[0] = inint(xm-rect[2]/2); 
04217             posi[1]=inint( vy[0] + iof + rect[3]);}
04218           else{
04219             vx[1]=vx[0]+barlengthx;
04220             vy[1]=vy[0]+barlengthy;
04221             posi[0] = inint( xm+2*barlengthx);
04222             posi[1]=inint( ym + 2*barlengthy + rect[3]);}
04223 
04224           if( ppsubwin->axes.axes_visible[0] )
04225           {
04226             C2F(dr)("xset","pattern",&textcolor,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
04227             C2F(dr)("xset","font",fontid,fontid+1,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
04228             if ( ppsubwin->logflags[0] == 'l' )
04229             {
04230               int smallersize = fontid[1]-2;
04231               int old_rect10[4];
04232               int posi10[2];
04233 
04234               posi10[0] = posi[0] - logrect[2];
04235               posi10[1] = posi[1] + logrect[3];
04236 
04237               C2F(dr)("xset","font",fontid,fontid+1,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
04238               C2F(dr)("xstring","10",(&posi10[0]),(&posi10[1]),PI0,&flag,PI0,PI0,&angle,PD0,PD0,PD0,0L,0L);
04239 
04240               C2F(dr)("xstringl","10",(&posi10[0]),(&posi10[1]),old_rect10,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
04241 
04242               posi[0] = old_rect10[0] + old_rect10[2];
04243               posi[1] = (int) (old_rect10[1] - old_rect10[3]*.1);
04244 
04245               C2F(dr)("xset","font",fontid,&smallersize,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
04246               C2F(dr)("xstring",foo,&(posi[0]),&(posi[1]),PI0,&flag,PI0,PI0,&ang, PD0,PD0,PD0,0L,0L);
04247 
04248               /* put back the current fontid */
04249               C2F(dr)("xset","font",fontid,fontid+1,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
04250             }
04251             else
04252             {
04253               C2F(dr)("xstring",foo,&(posi[0]),&(posi[1]),PI0,&flag,PI0,PI0,&ang, PD0,PD0,PD0,0L,0L);
04254             }       
04255             C2F(dr)("xset","pattern",&ticscolor,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);   
04256             C2F(dr)("xsegs","v", vx, vy, &ns,&ticscolor,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
04257           }
04258           /* grid to put here */
04259           if ( ppsubwin->grid[0] > -1 && ppsubwin->axes.axes_visible[0]  )
04260           {
04261             gstyle = pSUBWIN_FEATURE (psubwin)->grid[0];
04262 
04263             if((ppsubwin->logflags[0] =='l') && (i != nbtics-1))
04264             {
04265               double tmp[2];
04266               double pas=0;
04267               double * tmp_log_grads = (double *) NULL;
04268 
04269 
04270               double * grads = ppsubwin->axes.xgrads;
04271 
04272               tmp[0] = exp10(grads[i]);
04273               tmp[1] = exp10(grads[i+1]);
04274               pas = (exp10(grads[i+1]) - exp10(grads[i])) / (nbsubtics );
04275 
04276               if((tmp_log_grads = (double *)MALLOC(nbsubtics*sizeof(double)))==NULL){
04277                 sciprint("Error allocating tmp_log_grads\n");
04278                 return -1;
04279               }
04280 
04281               for(j=0;j<nbsubtics;j++)
04282               {
04283                 tmp_log_grads[j] = log10( tmp[0] + (j) * pas ) ;
04284               }
04285 
04286               for(j=0;j<nbsubtics;j++)
04287               {
04288                 vxx1 = tmp_log_grads[j];
04289 
04290                 if(vxx1<=xminval || vxx1>=xmaxval) continue;
04291 
04292                 if(ppsubwin->axes.reverse[0] == TRUE)
04293                   vxx1 = InvAxis(ppsubwin->FRect[0],ppsubwin->FRect[2],vxx1);
04294 
04295                 ComputeGoodTrans3d(psubwin,1,&xm,&ym,&vxx1,&fy,&fz);
04296 
04297                 /*  if ((xm != ixbox[5]) && (xm != ixbox[4])) */
04298                 /*                              {  */
04299                 xg[0]= xm;  yg[0]= ym;  
04300                 if (Ishidden(psubwin)) 
04301                 { xg[1]= xm; yg[1]= iybox[2] -iybox[3]+ym; }
04302                 else
04303                 {xg[1]= ixbox[3] - ixbox[4] +xm; yg[1]= iybox[3] - iybox[4] +ym; } 
04304 
04305                 C2F(dr)("xget","line style",&verbose,dash,&narg,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
04306                 C2F (dr) ("xset", "line style",&gridStyle,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
04307                 C2F(dr)("xsegs","v", xg, yg, &ns,&gstyle,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
04308                 xg[0]= xg[1]; yg[0]= yg[1];
04309                 xg[1] = ixbox[3] - ixbox[4] +xm; 
04310                 yg[1]=  iybox[2] - iybox[4] +ym;
04311                 C2F(dr)("xsegs","v", xg, yg, &ns,&gstyle,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
04312                 C2F(dr)("xset","line style",dash,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);  
04313                 /*      } */
04314               }
04315               FREE(tmp_log_grads); tmp_log_grads = (double *) NULL;
04316             }
04317             else
04318             {
04319               if(xtmp>xminval && xtmp<xmaxval) 
04320               {
04321                 xg[0]= xm;  yg[0]= ym;  
04322                 if (Ishidden(psubwin)) 
04323                 { xg[1]= xm; yg[1]= iybox[2] -iybox[3]+ym; }
04324                 else
04325                 {xg[1]= ixbox[3] - ixbox[4] +xm; yg[1]= iybox[3] - iybox[4] +ym; } 
04326                 C2F(dr)("xget","line style",&verbose,dash,&narg,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
04327                 C2F (dr) ("xset", "line style",&gridStyle,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
04328                 C2F(dr)("xsegs","v", xg, yg, &ns,&gstyle,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
04329                 xg[0]= xg[1]; yg[0]= yg[1];
04330                 xg[1] = ixbox[3] - ixbox[4] +xm; 
04331                 yg[1]=  iybox[2] - iybox[4] +ym;
04332                 C2F(dr)("xsegs","v", xg, yg, &ns,&gstyle,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
04333                 C2F(dr)("xset","line style",dash,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);  
04334               }
04335             }   
04336           }
04337 
04338           /* and subtics */
04339           if(i != nbtics-1) /* F.Leray NEW 03.11.04 */
04340           {
04341 
04342             if(ppsubwin->logflags[0] =='l')
04343             {
04344               double tmp[2];
04345               double pas=0;
04346               double * tmp_log_grads = (double *) NULL;
04347 
04348 
04349               double * grads = ppsubwin->axes.xgrads;
04350 
04351               tmp[0] = exp10(grads[i]);
04352               tmp[1] = exp10(grads[i+1]);
04353               pas = (exp10(grads[i+1]) - exp10(grads[i])) / (nbsubtics );
04354 
04355               if((tmp_log_grads = (double *)MALLOC(nbsubtics*sizeof(double)))==NULL){
04356                 sciprint("Error allocating tmp_log_grads\n");
04357                 return -1;
04358               }
04359 
04360               for(j=0;j<nbsubtics;j++) tmp_log_grads[j] = log10(tmp[0]+(j)*pas);
04361 
04362               for(j=0;j<nbsubtics;j++)
04363               {
04364                 vxx1 = tmp_log_grads[j];
04365 
04366                 if(vxx1<xminval || vxx1>xmaxval) continue;
04367 
04368                 if(ppsubwin->axes.reverse[0] == TRUE)
04369                   vxx1 = InvAxis(ppsubwin->FRect[0],ppsubwin->FRect[2],vxx1);
04370 
04371                 ComputeGoodTrans3d(psubwin,1,&xm,&ym,&vxx1,&fy,&fz);
04372 
04373                 if (IsDownAxes(psubwin))
04374                 {
04375                   vx[1]=vx[0]=xm;
04376                   vy[0]=ym;
04377                   vy[1]=vy[0]+iof/4;
04378                 }
04379                 else
04380                 {
04381                   vx[0]=xm;vy[0]=ym;
04382                   vx[1]= (integer) (vx[0]+barlengthx/2.0);
04383                   vy[1]= (integer) (vy[0]+barlengthy/2.0);
04384                 }
04385 
04386                 if( ppsubwin->axes.axes_visible[0] )
04387                   C2F(dr)("xsegs","v", vx, vy, &ns,&ticscolor,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
04388               }
04389 
04390               FREE(tmp_log_grads); tmp_log_grads = (double *) NULL;
04391             } /* end NEW */
04392             else
04393             {
04394               double xtmp2 = ppsubwin->axes.xgrads[i];
04395               double dx = (ppsubwin->axes.xgrads[i+1] - ppsubwin->axes.xgrads[i]) / nbsubtics;
04396 
04397               for (j=1;j<nbsubtics;j++)
04398               {  
04399                 vxx1=xtmp2+dx*j;
04400 
04401                 if(vxx1<xminval || vxx1>xmaxval) continue;
04402 
04403                 if(ppsubwin->axes.reverse[0] == TRUE)
04404                   vxx1 = InvAxis(ppsubwin->FRect[0],ppsubwin->FRect[2],vxx1);
04405 
04406                 ComputeGoodTrans3d(psubwin,1,&xm,&ym,&vxx1,&fy,&fz);
04407 
04408                 if (IsDownAxes(psubwin))
04409                 {
04410                   vx[1]=vx[0]=xm;
04411                   vy[0]=ym;
04412                   vy[1]=vy[0]+iof/4;
04413                 }
04414                 else
04415                 {
04416                   vx[0]=xm;vy[0]=ym;
04417                   vx[1]= (integer) (vx[0]+barlengthx/2.0);
04418                   vy[1]= (integer) (vy[0]+barlengthy/2.0);
04419                 }
04420 
04421                 if(ppsubwin->axes.axes_visible[0] == TRUE)
04422                   C2F(dr)("xsegs","v", vx, vy, &ns,&ticscolor,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
04423               }
04424             }
04425           }
04426 
04427           /***************************************************************/
04428           /************************* END OF COMMON PART ******************/
04429           /***************************************************************/
04430 
04431         }
04432       }
04433     }
04434     if ( sciGetVisibility(ppsubwin->mon_x_label) )
04435     {
04436       sciLabel * ppLabel = pLABEL_FEATURE( ppsubwin->mon_x_label ) ;
04437       if( ppLabel->auto_rotation )
04438       {
04439         sciSetFontOrientation(ppsubwin->mon_x_label, 0) ;
04440       }
04441 
04442 
04443       if( ppLabel->auto_position )
04444       {
04445 
04446         int segmentStart[2] = { ixbox[4], iybox[4] } ;
04447         int segmentEnd[2]   = { ixbox[5], iybox[5] } ;
04448 
04449         /* add the bar size and ticks label size to the offset */
04450         int offset[2] = { constOffset[0] + maxTicksLabelSize[0] + abs( barlengthx ), 
04451           constOffset[1] + maxTicksLabelSize[1] + abs( barlengthy )  } ;
04452         computeLabelAutoPos( ppsubwin->mon_x_label, segmentStart, segmentEnd, offset ) ;
04453       }
04454       /* a trick to force the display with 2d scale */
04455       drawTextEntity( ppLabel->text ) ;
04456 
04457     }
04458   }
04459   else
04460   {
04461 
04462     if ( pSUBWIN_FEATURE (psubwin)->project[1]==1) /* y is HERE */
04463     {
04464       double fx,fy,fz; 
04465       char c_format[5];
04466 
04467       integer Ticsdir[2];
04468       Ticsdir[0]=ixbox[4]-ixbox[3];
04469       Ticsdir[1]=iybox[4]-iybox[3];
04470       BBoxToval(&fx,&fy,&fz,xind[4],bbox);
04471 
04472       x=inint((ixbox[4]+ixbox[5])/2+1.5*rect[2] +iof);
04473       y=inint(((2/3.0)*iybox[4]+(1/3.0)*iybox[5])+1.5*rect[3]+iof);
04474 
04475       if(ppsubwin->axes.auto_ticks[1] == FALSE)
04476       {
04477         /* we display the y tics specified by the user*/
04478         nbtics = ppsubwin->axes.u_nygrads;
04479         nbsubtics = ppsubwin->axes.nbsubtics[1];
04480 
04481         maxTicksLabelSize[0] = 0 ;
04482         maxTicksLabelSize[1] = 0 ;
04483 
04484         for(i=0;i<nbtics;i++)
04485         {
04486           char *foo = ppsubwin->axes.u_ylabels[i]; 
04487           double ytmp = ppsubwin->axes.u_ygrads[i];
04488 
04489           if(ytmp<yminval || ytmp>ymaxval) 
04490           {
04491             /*   sciprint("je rejete la valeur: %lf\n\n",xtmp); */
04492             continue; /* cas ou TL est ON et on a des graduations qui ne seront pas affichees de tte facon */
04493             /* donc autant ne pas aller plus loin dans l'algo... */
04494           }
04495 
04496 
04497           /***************************************************************/
04498           /************************* COMMON PART *************************/
04499           /***************************************************************/
04500 
04501           if(ppsubwin->axes.reverse[1] == TRUE)
04502             ytmp = InvAxis(ppsubwin->FRect[1],ppsubwin->FRect[3],ytmp);
04503 
04504           ComputeGoodTrans3d(psubwin,1,&xm,&ym,&fx,&ytmp,&fz);
04505           /*              trans3d(psubwin,1,&xm,&ym,&fx,&ytmp,&fz); */
04506 
04507 
04508 
04509           vx[0]=xm;vy[0]=ym;
04510 
04511           barlengthx= (integer) (( Ticsdir[0])/sqrt((double) Ticsdir[0]*Ticsdir[0]+Ticsdir[1]*Ticsdir[1])*size);
04512           barlengthy= (integer) (( Ticsdir[1])/sqrt((double) Ticsdir[0]*Ticsdir[0]+Ticsdir[1]*Ticsdir[1])*size);
04513           /*    NumberFormat(foo,((integer) (yy[0] + i*ceil((yy[1]-yy[0])/yy[3]))), */
04514           /*                         ((integer) yy[2])); */
04515           C2F(dr)("xset","font",fontid,fontid+1,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L); /* fix bug noticed by R.N. */
04516 
04517           /* get the size of the ticks */
04518           C2F(dr)("xstringl",foo,&x,&y,rect,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
04519           maxTicksLabelSize[0] = Max( maxTicksLabelSize[0], rect[2] ) ;
04520           maxTicksLabelSize[1] = Max( maxTicksLabelSize[1], rect[3] ) ;
04521 
04522 
04523           if (IsDownAxes(psubwin)){
04524             vx[1]=vx[0];
04525             vy[1]=vy[0]+iof/2;
04526             posi[0] = inint(xm-rect[2]/2); 
04527             posi[1]=inint( vy[0] + iof + rect[3]);}
04528           else{ 
04529             vx[1]=vx[0]+barlengthx;
04530             vy[1]=vy[0]+barlengthy;
04531             /*              posi[0] = inint( xm+2*barlengthx - rect[2]/2); */
04532             /*              posi[0] = inint( xm+2*barlengthx - rect[2]); */
04533             posi[0] = inint( xm+2*barlengthx);
04534             posi[1]=inint( ym + 2*barlengthy + rect[3]);}
04535 
04536           if(ppsubwin->axes.axes_visible[1] == TRUE){
04537             C2F(dr)("xset","pattern",&textcolor,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
04538             C2F(dr)("xset","font",fontid,fontid+1,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
04539             C2F(dr)("xstring",foo,&(posi[0]),&(posi[1]),PI0,&flag,PI0,PI0,&ang, PD0,PD0,PD0,0L,0L);
04540             C2F(dr)("xset","pattern",&ticscolor,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);  
04541             C2F(dr)("xsegs","v", vx, vy, &ns,&ticscolor,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
04542           }
04543           /* grid to put here */
04544           if ( ppsubwin->grid[1] > -1 && ppsubwin->axes.axes_visible[1] )
04545           {
04546             gstyle = pSUBWIN_FEATURE (psubwin)->grid[1];
04547 
04548             if((ppsubwin->logflags[1] =='l') && (i != nbtics-1))
04549             {
04550               double tmp[2];
04551               double pas=0;
04552               double * tmp_log_grads = (double *) NULL;
04553 
04554 
04555               double * grads = ppsubwin->axes.u_ygrads;
04556 
04557               tmp[0] = exp10(grads[i]);
04558               tmp[1] = exp10(grads[i+1]);
04559               pas = (exp10(grads[i+1]) - exp10(grads[i])) / (nbsubtics );
04560 
04561               if((tmp_log_grads = (double *)MALLOC(nbsubtics*sizeof(double)))==NULL){
04562                 sciprint("Error allocating tmp_log_grads\n");
04563                 return -1;
04564               }
04565 
04566               for(j=0;j<nbsubtics;j++) tmp_log_grads[j] = log10(tmp[0]+(j)*pas);
04567 
04568               for(j=0;j<nbsubtics;j++)
04569               {
04570                 vyy1 = tmp_log_grads[j];
04571 
04572                 if(vyy1<=yminval || vyy1>=ymaxval) continue;
04573 
04574                 if(ppsubwin->axes.reverse[1] == TRUE)
04575                   vyy1 = InvAxis(ppsubwin->FRect[1],ppsubwin->FRect[3],vyy1);
04576 
04577                 ComputeGoodTrans3d(psubwin,1,&xm,&ym,&fx,&vyy1,&fz);
04578 
04579                 /*  if ((xm != ixbox[5]) && (xm != ixbox[4])) */
04580                 /*                              {  */
04581                 xg[0]= xm;  yg[0]= ym;  
04582                 if (Ishidden(psubwin))
04583                 { xg[1]= xm; yg[1]= iybox[2] -iybox[3]+ym; }
04584                 else
04585                 {xg[1]= ixbox[3] - ixbox[4] +xm; yg[1]= iybox[3] - iybox[4] +ym; } 
04586                 C2F(dr)("xget","line style",&verbose,dash,&narg,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
04587                 C2F (dr) ("xset", "line style",&gridStyle,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
04588                 C2F(dr)("xsegs","v", xg, yg, &ns,&gstyle,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
04589                 xg[0]= xg[1]; yg[0]= yg[1];
04590                 xg[1] = ixbox[3] - ixbox[4] +xm; 
04591                 yg[1]=  iybox[2] - iybox[4] +ym;
04592                 C2F(dr)("xsegs","v", xg, yg, &ns,&gstyle,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
04593                 C2F(dr)("xset","line style",dash,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);  
04594                 /*      } */
04595               }
04596               FREE(tmp_log_grads); tmp_log_grads = (double *) NULL;
04597             }
04598             else
04599             {
04600               if(ytmp>yminval && ytmp<ymaxval) 
04601               {
04602                 xg[0]= xm;  yg[0]= ym;  
04603                 if (Ishidden(psubwin))
04604                 { xg[1]= xm; yg[1]= iybox[2] -iybox[3]+ym; }
04605                 else
04606                 {xg[1]= ixbox[3] - ixbox[4] +xm; yg[1]= iybox[3] - iybox[4] +ym; } 
04607                 C2F(dr)("xget","line style",&verbose,dash,&narg,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
04608                 C2F (dr) ("xset", "line style",&gridStyle,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
04609                 C2F(dr)("xsegs","v", xg, yg, &ns,&gstyle,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
04610                 xg[0]= xg[1]; yg[0]= yg[1];
04611                 xg[1] = ixbox[3] - ixbox[4] +xm; 
04612                 yg[1]=  iybox[2] - iybox[4] +ym;
04613                 C2F(dr)("xsegs","v", xg, yg, &ns,&gstyle,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
04614                 C2F(dr)("xset","line style",dash,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);  
04615               }
04616             }
04617           }
04618 
04619           /* and subtics */
04620           if(i != nbtics-1)
04621           {
04622             if(ppsubwin->logflags[1] =='l')
04623             {
04624               double tmp[2];
04625               double pas=0;
04626               double * tmp_log_grads = (double *) NULL;
04627 
04628 
04629               double * grads = ppsubwin->axes.u_ygrads;
04630 
04631               tmp[0] = exp10(grads[i]);
04632               tmp[1] = exp10(grads[i+1]);
04633               pas = (exp10(grads[i+1]) - exp10(grads[i])) / (nbsubtics );
04634 
04635               if((tmp_log_grads = (double *)MALLOC(nbsubtics*sizeof(double)))==NULL){
04636                 sciprint("Error allocating tmp_log_grads\n");
04637                 return -1;
04638               }
04639 
04640               for(j=0;j<nbsubtics;j++) tmp_log_grads[j] = log10(tmp[0]+(j)*pas);
04641 
04642               for(j=0;j<nbsubtics;j++)
04643               {
04644                 vyy1 = tmp_log_grads[j];
04645 
04646                 if(vyy1<yminval || vyy1>ymaxval) continue;
04647 
04648                 if(ppsubwin->axes.reverse[1] == TRUE)
04649                   vyy1 = InvAxis(ppsubwin->FRect[1],ppsubwin->FRect[3],vyy1);
04650 
04651                 ComputeGoodTrans3d(psubwin,1,&xm,&ym,&fx,&vyy1,&fz);
04652 
04653                 if (IsDownAxes(psubwin))
04654                 {
04655                   vx[1]=vx[0]=xm;
04656                   vy[0]=ym;
04657                   vy[1]=vy[0]+iof/4;
04658                 }
04659                 else
04660                 {
04661                   vx[0]=xm;vy[0]=ym;
04662                   vx[1]= (integer) (vx[0]+barlengthx/2.0);
04663                   vy[1]= (integer) (vy[0]+barlengthy/2.0);
04664                 }
04665 
04666                 if(ppsubwin->axes.axes_visible[1] == TRUE)
04667                   C2F(dr)("xsegs","v", vx, vy, &ns,&ticscolor,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
04668               }
04669               FREE(tmp_log_grads); tmp_log_grads = (double *) NULL;
04670 
04671             } /* end NEW */
04672             else
04673             {
04674               double ytmp2 = ppsubwin->axes.u_ygrads[i];
04675               double dy = (ppsubwin->axes.u_ygrads[i+1] - ppsubwin->axes.u_ygrads[i]) / nbsubtics;
04676               for(j=0;j<nbsubtics;j++)
04677               {
04678                 vyy1=ytmp2+dy*j;
04679 
04680                 if(vyy1<yminval || vyy1>ymaxval) continue;
04681 
04682                 if(ppsubwin->axes.reverse[1] == TRUE)
04683                   vyy1 = InvAxis(ppsubwin->FRect[1],ppsubwin->FRect[3],vyy1);
04684 
04685                 ComputeGoodTrans3d(psubwin,1,&xm,&ym,&fx,&vyy1,&fz);
04686 
04687                 if (IsDownAxes(psubwin))
04688                 {
04689                   vx[1]=vx[0]=xm;
04690                   vy[0]=ym;
04691                   vy[1]=vy[0]+iof/4;
04692                 }
04693                 else
04694                 {
04695                   vx[0]=xm;vy[0]=ym;
04696                   vx[1]= (integer) (vx[0]+barlengthx/2.0);
04697                   vy[1]= (integer) (vy[0]+barlengthy/2.0);
04698                 }
04699 
04700                 if(ppsubwin->axes.axes_visible[1] == TRUE)
04701                   C2F(dr)("xsegs","v", vx, vy, &ns,&ticscolor,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
04702               }
04703             }
04704           }
04705 
04706           /***************************************************************/
04707           /************************* END OF COMMON PART ******************/
04708           /***************************************************************/
04709         }
04710       }
04711       else /* we display the computed tics */
04712       {
04713         AdaptGraduationsOnYBottomRight(iof,x,y,size,Ticsdir,fontid,psubwin,yminval,ymaxval,fx,0.,fz);
04714 
04715         lastyindex = ppsubwin->axes.nygrads - 1;
04716 
04717         if(lastyindex == 0)
04718           ChooseFormatForOneGrad(c_format,&(ppsubwin->axes.ygrads[0]));
04719         else
04720           ChoixFormatE(c_format,
04721           ppsubwin->axes.ygrads[0],
04722           ppsubwin->axes.ygrads[lastyindex],
04723           ((ppsubwin->axes.ygrads[lastyindex])-(ppsubwin->axes.ygrads[0]))/(lastyindex));
04724 
04725         nbtics = ppsubwin->axes.nygrads;
04726         nbsubtics = ppsubwin->axes.nbsubtics[1];
04727 
04728         maxTicksLabelSize[0] = 0 ;
04729         maxTicksLabelSize[1] = 0 ;
04730 
04731         for(i=0;i<nbtics;i++)
04732         {
04733           char foo[256]; 
04734           double ytmp2 = ppsubwin->axes.ygrads[i];
04735 
04736           if(ytmp2<yminval || ytmp2>ymaxval) 
04737           {
04738             /*   sciprint("je rejete la valeur: %lf\n\n",xtmp); */
04739             continue; /* cas ou TL est ON et on a des graduations qui ne seront pas affichees de tte facon */
04740             /* donc autant ne pas aller plus loin dans l'algo... */
04741           }
04742 
04743           sprintf(foo,c_format,ytmp2);
04744 
04745           /***************************************************************/
04746           /************************* COMMON PART *************************/
04747           /***************************************************************/
04748 
04749           /* F.Leray 03.11.04 Test if log scale to perform a : exp10(x) because trans3d will */
04750           /* re-do a log10() (that is needed for data computations) */
04751 
04752 
04753           if(ppsubwin->axes.reverse[1] == TRUE)
04754             ytmp2 = InvAxis(ppsubwin->FRect[1],ppsubwin->FRect[3],ytmp2);
04755 
04756           ComputeGoodTrans3d(psubwin,1,&xm,&ym,&fx,&ytmp2,&fz);
04757 
04758 
04759           vx[0]=xm;vy[0]=ym;
04760 
04761           barlengthx= (integer) (( Ticsdir[0])/sqrt((double) Ticsdir[0]*Ticsdir[0]+Ticsdir[1]*Ticsdir[1])*size);
04762           barlengthy= (integer) (( Ticsdir[1])/sqrt((double) Ticsdir[0]*Ticsdir[0]+Ticsdir[1]*Ticsdir[1])*size);
04763 
04764           C2F(dr)("xset","font",fontid,fontid+1,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L); /* fix bug noticed by R.N. */
04765 
04766 
04767           C2F(dr)("xstringl",foo,&x,&y,rect,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
04768           maxTicksLabelSize[0] = Max( maxTicksLabelSize[0], rect[2] ) ;
04769           maxTicksLabelSize[1] = Max( maxTicksLabelSize[1], rect[3] ) ;
04770 
04771           if (IsDownAxes(psubwin)){
04772             vx[1]=vx[0];
04773             vy[1]=vy[0]+iof/2;
04774             posi[0] = inint(xm-rect[2]/2); 
04775             posi[1]=inint( vy[0] + iof + rect[3]);}
04776           else{ 
04777             vx[1]=vx[0]+barlengthx;
04778             vy[1]=vy[0]+barlengthy;
04779             /*              posi[0] = inint( xm+2*barlengthx - rect[2]/2); */
04780             /*              posi[0] = inint( xm+2*barlengthx - rect[2]); */
04781             posi[0] = inint( xm+2*barlengthx);
04782             posi[1]=inint( ym + 2*barlengthy + rect[3]);}
04783 
04784           if(ppsubwin->axes.axes_visible[1] == TRUE){
04785             C2F(dr)("xset","pattern",&textcolor,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
04786             C2F(dr)("xset","font",fontid,fontid+1,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
04787             if ( ppsubwin->logflags[1] == 'l' )
04788             {
04789               int smallersize = fontid[1]-2;
04790               int old_rect10[4];
04791               /*                    char str[2] = "xv"; */
04792               int posi10[2];
04793 
04794               posi10[0] = posi[0] - logrect[2];
04795               posi10[1] = posi[1] + logrect[3];
04796 
04797               C2F(dr)("xset","font",fontid,fontid+1,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
04798               C2F(dr)("xstring","10",(&posi10[0]),(&posi10[1]),PI0,&flag,PI0,PI0,&angle,PD0,PD0,PD0,0L,0L);
04799 
04800               C2F(dr)("xstringl","10",(&posi10[0]),(&posi10[1]),old_rect10,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
04801 
04802               posi[0] = old_rect10[0] + old_rect10[2];
04803               posi[1] = (int) (old_rect10[1] - old_rect10[3]*.1);
04804 
04805               C2F(dr)("xset","font",fontid,&smallersize,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
04806               C2F(dr)("xstring",foo,&(posi[0]),&(posi[1]),PI0,&flag,PI0,PI0,&ang, PD0,PD0,PD0,0L,0L);
04807 
04808               /* put back the current fontid */
04809               C2F(dr)("xset","font",fontid,fontid+1,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
04810             }
04811             else
04812               C2F(dr)("xstring",foo,&(posi[0]),&(posi[1]),PI0,&flag,PI0,PI0,&ang, PD0,PD0,PD0,0L,0L);
04813 
04814             C2F(dr)("xset","pattern",&ticscolor,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);  
04815             C2F(dr)("xsegs","v", vx, vy, &ns,&ticscolor,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
04816           }
04817 
04818           /* grid to put here */
04819 
04820           if ( ppsubwin->grid[1] > -1 && ppsubwin->axes.axes_visible[1] )
04821           {
04822             gstyle = pSUBWIN_FEATURE (psubwin)->grid[1];
04823 
04824             if((ppsubwin->logflags[1] =='l') && (i != nbtics-1))
04825             {
04826               double tmp[2];
04827               double pas=0;
04828               double * tmp_log_grads = (double *) NULL;
04829 
04830 
04831               double * grads = ppsubwin->axes.ygrads;
04832 
04833               tmp[0] = exp10(grads[i]);
04834               tmp[1] = exp10(grads[i+1]);
04835               pas = (exp10(grads[i+1]) - exp10(grads[i])) / (nbsubtics );
04836 
04837               if((tmp_log_grads = (double *)MALLOC(nbsubtics*sizeof(double)))==NULL){
04838                 sciprint("Error allocating tmp_log_grads\n");
04839                 return -1;
04840               }
04841 
04842               for(j=0;j<nbsubtics;j++) tmp_log_grads[j] = log10(tmp[0]+(j)*pas);
04843 
04844               for(j=0;j<nbsubtics;j++)
04845               {
04846                 vyy1 = tmp_log_grads[j];
04847 
04848                 if(vyy1<=yminval || vyy1>=ymaxval) continue;
04849 
04850                 if(ppsubwin->axes.reverse[1] == TRUE)
04851                   vyy1 = InvAxis(ppsubwin->FRect[1],ppsubwin->FRect[3],vyy1);
04852 
04853                 ComputeGoodTrans3d(psubwin,1,&xm,&ym,&fx,&vyy1,&fz);
04854 
04855                 /*  if ((xm != ixbox[5]) && (xm != ixbox[4])) */
04856                 /*                              {  */
04857                 xg[0]= xm;  yg[0]= ym;  
04858                 if (Ishidden(psubwin))
04859                 { xg[1]= xm; yg[1]= iybox[2] -iybox[3]+ym; }
04860                 else
04861                 {xg[1]= ixbox[3] - ixbox[4] +xm; yg[1]= iybox[3] - iybox[4] +ym; } 
04862                 C2F(dr)("xget","line style",&verbose,dash,&narg,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
04863                 C2F (dr) ("xset", "line style",&gridStyle,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
04864                 C2F(dr)("xsegs","v", xg, yg, &ns,&gstyle,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
04865                 xg[0]= xg[1]; yg[0]= yg[1];
04866                 xg[1] = ixbox[3] - ixbox[4] +xm; 
04867                 yg[1]=  iybox[2] - iybox[4] +ym;
04868                 C2F(dr)("xsegs","v", xg, yg, &ns,&gstyle,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
04869                 C2F(dr)("xset","line style",dash,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);  
04870                 /*      } */
04871               }
04872               FREE(tmp_log_grads); tmp_log_grads = (double *) NULL;
04873             }
04874             else
04875             {
04876               if(ytmp2>yminval && ytmp2<ymaxval) 
04877               {
04878                 xg[0]= xm;  yg[0]= ym;  
04879                 if (Ishidden(psubwin))
04880                 { xg[1]= xm; yg[1]= iybox[2] -iybox[3]+ym; }
04881                 else
04882                 {xg[1]= ixbox[3] - ixbox[4] +xm; yg[1]= iybox[3] - iybox[4] +ym; } 
04883                 C2F(dr)("xget","line style",&verbose,dash,&narg,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
04884                 C2F (dr) ("xset", "line style",&gridStyle,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
04885                 C2F(dr)("xsegs","v", xg, yg, &ns,&gstyle,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
04886                 xg[0]= xg[1]; yg[0]= yg[1];
04887                 xg[1] = ixbox[3] - ixbox[4] +xm; 
04888                 yg[1]=  iybox[2] - iybox[4] +ym;
04889                 C2F(dr)("xsegs","v", xg, yg, &ns,&gstyle,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
04890                 C2F(dr)("xset","line style",dash,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);  
04891               }
04892             }
04893           }
04894 
04895           /* and subtics */
04896           if(i != nbtics-1)
04897           {
04898             if(ppsubwin->logflags[1] =='l')
04899             {
04900               double tmp[2];
04901               double pas=0;
04902               double * tmp_log_grads = (double *) NULL;
04903 
04904 
04905               double * grads = ppsubwin->axes.ygrads;
04906 
04907               tmp[0] = exp10(grads[i]);
04908               tmp[1] = exp10(grads[i+1]);
04909               pas = (exp10(grads[i+1]) - exp10(grads[i])) / (nbsubtics );
04910 
04911               if((tmp_log_grads = (double *)MALLOC(nbsubtics*sizeof(double)))==NULL){
04912                 sciprint("Error allocating tmp_log_grads\n");
04913                 return -1;
04914               }
04915 
04916               for(j=0;j<nbsubtics;j++) tmp_log_grads[j] = log10(tmp[0]+(j)*pas);
04917 
04918               for(j=0;j<nbsubtics;j++)
04919               {
04920                 vyy1 = tmp_log_grads[j];
04921 
04922                 if(vyy1<yminval || vyy1>ymaxval) continue;
04923 
04924                 if(ppsubwin->axes.reverse[1] == TRUE)
04925                   vyy1 = InvAxis(ppsubwin->FRect[1],ppsubwin->FRect[3],vyy1);
04926 
04927                 ComputeGoodTrans3d(psubwin,1,&xm,&ym,&fx,&vyy1,&fz);
04928 
04929                 if (IsDownAxes(psubwin))
04930                 {
04931                   vx[1]=vx[0]=xm;
04932                   vy[0]=ym;
04933                   vy[1]=vy[0]+iof/4;
04934                 }
04935                 else
04936                 {
04937                   vx[0]=xm;vy[0]=ym;
04938                   vx[1]= (integer) (vx[0]+barlengthx/2.0);
04939                   vy[1]= (integer) (vy[0]+barlengthy/2.0);
04940                 }
04941 
04942                 if(ppsubwin->axes.axes_visible[1] == TRUE)
04943                   C2F(dr)("xsegs","v", vx, vy, &ns,&ticscolor,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
04944               }
04945               FREE(tmp_log_grads); tmp_log_grads = (double *) NULL;
04946 
04947             } /* end NEW */
04948             else
04949             {
04950               double ytmp3 = ppsubwin->axes.ygrads[i];
04951               double dy = (ppsubwin->axes.ygrads[i+1] - ppsubwin->axes.ygrads[i]) / nbsubtics;
04952               for(j=0;j<nbsubtics;j++)
04953               {
04954                 vyy1=ytmp3+dy*j;
04955 
04956                 if(vyy1<yminval || vyy1>ymaxval) continue;
04957 
04958                 if(ppsubwin->axes.reverse[1] == TRUE)
04959                   vyy1 = InvAxis(ppsubwin->FRect[1],ppsubwin->FRect[3],vyy1);
04960 
04961                 ComputeGoodTrans3d(psubwin,1,&xm,&ym,&fx,&vyy1,&fz);
04962                 /*   trans3d(psubwin,1,&xm,&ym,&fx,&vyy1,&fz); */
04963 
04964                 if (IsDownAxes(psubwin))
04965                 {
04966                   vx[1]=vx[0]=xm;
04967                   vy[0]=ym;
04968                   vy[1]=vy[0]+iof/4;
04969                 }
04970                 else
04971                 {
04972                   vx[0]=xm;vy[0]=ym;
04973                   vx[1]= (integer) (vx[0]+barlengthx/2.0);
04974                   vy[1]= (integer) (vy[0]+barlengthy/2.0);
04975                 }
04976 
04977                 if(ppsubwin->axes.axes_visible[1] == TRUE)
04978                   C2F(dr)("xsegs","v", vx, vy, &ns,&ticscolor,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
04979               }
04980             }
04981           }
04982           /***************************************************************/
04983           /************************* END OF COMMON PART ******************/
04984           /***************************************************************/
04985 
04986         }
04987       }
04988     }
04989     if ( sciGetVisibility(ppsubwin->mon_y_label) )
04990     {
04991       sciLabel * ppLabel = pLABEL_FEATURE( ppsubwin->mon_y_label ) ;
04992       if( ppLabel->auto_rotation )
04993       {
04994         sciSetFontOrientation( ppsubwin->mon_y_label, 0 ) ;
04995       }
04996 
04997       if( ppLabel->auto_position )
04998       {
04999 
05000         int segmentStart[2] = { ixbox[4], iybox[4] } ;
05001         int segmentEnd[2]   = { ixbox[5], iybox[5] } ;
05002 
05003         /* add the bar size and ticks label size to the offset */
05004         int offset[2] = { constOffset[0] + maxTicksLabelSize[0] + abs( barlengthx ), 
05005           constOffset[1] + maxTicksLabelSize[1] + abs( barlengthy )  } ;
05006         computeLabelAutoPos( ppsubwin->mon_y_label, segmentStart, segmentEnd, offset ) ;
05007       }
05008       /* a trick to force the display with 2d scale */
05009       drawTextEntity( ppLabel->text ) ;
05010 
05011     }
05012   }
05013 
05014 
05015 
05016   /***********************/ 
05017   /*** le  x-y scaling ***/ /* DISPLAY x or y graduations */
05018   /***********************/
05019 
05020   if (( xind[3]+xind[4] == 3) || ( xind[3]+xind[4] == 11))
05021   {
05022     if (pSUBWIN_FEATURE (psubwin)->project[0]==1) /* x HERE */
05023     {
05024       double fx,fy,fz;
05025       char c_format[5];
05026 
05027 
05028       integer Ticsdir[2];
05029       Ticsdir[0]=ixbox[4]-ixbox[5];
05030       Ticsdir[1]=iybox[4]-iybox[5];
05031       BBoxToval(&fx,&fy,&fz,xind[3],bbox);
05032 
05033       x=inint((ixbox[3]+ixbox[4])/2.0 -rect[2] -iof);
05034       y=inint((1/3.0)*iybox[3]+(2/3.0)*iybox[4]+ iof+ 1.5*rect[3]); 
05035 
05036       if(ppsubwin->axes.auto_ticks[0] == FALSE)
05037       {
05038         /* we display the x tics specified by the user*/
05039         nbtics = ppsubwin->axes.u_nxgrads;
05040         nbsubtics = ppsubwin->axes.nbsubtics[0];
05041 
05042         maxTicksLabelSize[0] = 0 ;
05043         maxTicksLabelSize[1] = 0 ;
05044 
05045         for(i=0;i<nbtics;i++)
05046         {
05047           char *foo = ppsubwin->axes.u_xlabels[i]; 
05048           double xtmp = ppsubwin->axes.u_xgrads[i];
05049 
05050           if(xtmp<xminval || xtmp>xmaxval) 
05051           {
05052             /*   sciprint("je rejete la valeur: %lf\n\n",xtmp); */
05053             continue; /* cas ou TL est ON et on a des graduations qui ne seront pas affichees de tte facon */
05054             /* donc autant ne pas aller plus loin dans l'algo... */
05055           }
05056 
05057           /***************************************************************/
05058           /************************* COMMON PART *************************/
05059           /***************************************************************/
05060 
05061           if(ppsubwin->axes.reverse[0] == TRUE)
05062             xtmp = InvAxis(ppsubwin->FRect[0],ppsubwin->FRect[2],xtmp);
05063 
05064           ComputeGoodTrans3d(psubwin,1,&xm,&ym,&xtmp,&fy,&fz);
05065           /*              trans3d(psubwin,1,&xm,&ym,&xtmp,&fy,&fz); */
05066 
05067 
05068           vx[0]=xm;vy[0]=ym;
05069 
05070           barlengthx= (integer) (( Ticsdir[0])/sqrt((double) Ticsdir[0]*Ticsdir[0]+Ticsdir[1]*Ticsdir[1])*size);
05071           barlengthy= (integer) (( Ticsdir[1])/sqrt((double) Ticsdir[0]*Ticsdir[0]+Ticsdir[1]*Ticsdir[1])*size);
05072 
05073           C2F(dr)("xset","font",fontid,fontid+1,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L); /* fix bug noticed by R.N. */
05074 
05075           C2F(dr)("xstringl",foo,&x,&y,rect,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
05076           maxTicksLabelSize[0] = Max( maxTicksLabelSize[0], rect[2] ) ;
05077           maxTicksLabelSize[1] = Max( maxTicksLabelSize[1], rect[3] ) ;
05078 
05079 
05080           if (IsDownAxes(psubwin)){
05081             vx[1]=vx[0];
05082             vy[1]=vy[0]+iof/2;
05083             posi[0] = inint(xm-rect[2]/2); 
05084             posi[1]=inint( vy[0] + iof + rect[3]);}
05085           else{
05086             vx[1]=vx[0]+barlengthx;
05087             vy[1]=vy[0]+barlengthy;
05088             posi[0] = inint( xm+2*barlengthx-rect[2]); 
05089             posi[1]=inint( ym + 2*barlengthy + rect[3]);}
05090 
05091           if(ppsubwin->axes.axes_visible[0] == TRUE){
05092             C2F(dr)("xset","pattern",&textcolor,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
05093             C2F(dr)("xset","font",fontid,fontid+1,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
05094             C2F(dr)("xstring",foo,&(posi[0]),&(posi[1]),PI0,&flag,PI0,PI0,&ang, PD0,PD0,PD0,0L,0L);
05095             C2F(dr)("xset","pattern",&ticscolor,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);   
05096             C2F(dr)("xsegs","v", vx, vy, &ns,&ticscolor,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
05097           }
05098           /* grid to put here */
05099           if ( ppsubwin->grid[0] > -1 && ppsubwin->axes.axes_visible[0]  )
05100           {
05101             gstyle = pSUBWIN_FEATURE (psubwin)->grid[0];
05102 
05103             if((ppsubwin->logflags[0] =='l') && (i != nbtics-1))
05104             {
05105               double tmp[2];
05106               double pas=0;
05107               double * tmp_log_grads = (double *) NULL;
05108 
05109 
05110               double * grads = ppsubwin->axes.u_xgrads;
05111 
05112               tmp[0] = exp10(grads[i]);
05113               tmp[1] = exp10(grads[i+1]);
05114               pas = (exp10(grads[i+1]) - exp10(grads[i])) / (nbsubtics );
05115 
05116               if((tmp_log_grads = (double *)MALLOC(nbsubtics*sizeof(double)))==NULL){
05117                 sciprint("Error allocating tmp_log_grads\n");
05118                 return -1;
05119               }
05120 
05121               for(j=0;j<nbsubtics;j++) tmp_log_grads[j] = log10(tmp[0]+(j)*pas);
05122 
05123               for(j=0;j<nbsubtics;j++)
05124               {
05125                 vxx1 = tmp_log_grads[j];
05126 
05127                 if(vxx1<=xminval || vxx1>=xmaxval) continue;
05128 
05129                 if(ppsubwin->axes.reverse[0] == TRUE)
05130                   vxx1 = InvAxis(ppsubwin->FRect[0],ppsubwin->FRect[2],vxx1);
05131 
05132                 ComputeGoodTrans3d(psubwin,1,&xm,&ym,&vxx1,&fy,&fz);
05133 
05134                 /*   if ((xm != ixbox[3]) && (xm != ixbox[4])) */
05135                 /*                              {  */
05136                 xg[0]= xm;  yg[0]= ym;  
05137                 if (Ishidden(psubwin))
05138                 { xg[1]= xm; yg[1]= iybox[0] -iybox[5]+ym; }
05139                 else
05140                 {xg[1]= ixbox[1] - ixbox[3] +xm; yg[1]= iybox[5] - iybox[4] +ym; } 
05141                 C2F(dr)("xget","line style",&verbose,dash,&narg,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
05142                 C2F (dr) ("xset", "line style",&gridStyle,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
05143                 C2F(dr)("xsegs","v", xg, yg, &ns,&gstyle,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
05144                 xg[0]= xg[1]; yg[0]= yg[1];
05145                 xg[1] = ixbox[1] - ixbox[3] +xm; yg[1]=  iybox[0] - iybox[4] +ym;
05146                 C2F(dr)("xsegs","v", xg, yg, &ns,&gstyle,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
05147                 C2F(dr)("xset","line style",dash,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);  
05148                 /*      } */
05149               }
05150               FREE(tmp_log_grads); tmp_log_grads = (double *) NULL;
05151             }
05152             else
05153             {
05154               if(xtmp>xminval && xtmp<xmaxval) 
05155               {
05156                 xg[0]= xm;  yg[0]= ym;  
05157                 if (Ishidden(psubwin))
05158                 { xg[1]= xm; yg[1]= iybox[0] -iybox[5]+ym; }
05159                 else
05160                 {xg[1]= ixbox[1] - ixbox[3] +xm; yg[1]= iybox[5] - iybox[4] +ym; } 
05161                 C2F(dr)("xget","line style",&verbose,dash,&narg,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
05162                 C2F (dr) ("xset", "line style",&gridStyle,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
05163                 C2F(dr)("xsegs","v", xg, yg, &ns,&gstyle,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
05164                 xg[0]= xg[1]; yg[0]= yg[1];
05165                 xg[1] = ixbox[1] - ixbox[3] +xm; yg[1]=  iybox[0] - iybox[4] +ym;
05166                 C2F(dr)("xsegs","v", xg, yg, &ns,&gstyle,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
05167                 C2F(dr)("xset","line style",dash,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);  
05168               }
05169             }
05170           }
05171 
05172           /* and subtics */
05173           if(i != nbtics-1)
05174           {
05175             if(ppsubwin->logflags[0] =='l')
05176             {
05177               double tmp[2];
05178               double pas=0;
05179               double * tmp_log_grads = (double *) NULL;
05180 
05181 
05182               double * grads = ppsubwin->axes.u_xgrads;
05183 
05184               tmp[0] = exp10(grads[i]);
05185               tmp[1] = exp10(grads[i+1]);
05186               pas = (exp10(grads[i+1]) - exp10(grads[i])) / (nbsubtics );
05187 
05188               if((tmp_log_grads = (double *)MALLOC(nbsubtics*sizeof(double)))==NULL){
05189                 sciprint("Error allocating tmp_log_grads\n");
05190                 return -1;
05191               }
05192 
05193               for(j=0;j<nbsubtics;j++) tmp_log_grads[j] = log10(tmp[0]+(j)*pas);
05194 
05195               for(j=0;j<nbsubtics;j++)
05196               {
05197                 vxx1 = tmp_log_grads[j];
05198 
05199                 if(vxx1<xminval || vxx1>xmaxval) continue;
05200 
05201                 if(ppsubwin->axes.reverse[0] == TRUE)
05202                   vxx1 = InvAxis(ppsubwin->FRect[0],ppsubwin->FRect[2],vxx1);
05203 
05204                 ComputeGoodTrans3d(psubwin,1,&xm,&ym,&vxx1,&fy,&fz);
05205 
05206                 if (IsDownAxes(psubwin))
05207                 {
05208                   vx[1]=vx[0]=xm;
05209                   vy[0]=ym;
05210                   vy[1]=vy[0]+iof/4;
05211                 }
05212                 else
05213                 {
05214                   vx[0]=xm;vy[0]=ym;
05215                   vx[1]= (integer) (vx[0]+barlengthx/2.0);
05216                   vy[1]= (integer) (vy[0]+barlengthy/2.0);
05217                 }
05218 
05219                 if(ppsubwin->axes.axes_visible[0] == TRUE)
05220                   C2F(dr)("xsegs","v", vx, vy, &ns,&ticscolor,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
05221               }
05222 
05223               FREE(tmp_log_grads); tmp_log_grads = (double *) NULL;
05224             } /* end NEW */
05225             else
05226             {
05227               double xtmp2 = ppsubwin->axes.u_xgrads[i];
05228               double dx = (ppsubwin->axes.u_xgrads[i+1] - ppsubwin->axes.u_xgrads[i]) / nbsubtics;
05229 
05230               for (j=1;j<nbsubtics;j++)
05231               {  
05232                 vxx1=xtmp2+dx*j;
05233 
05234                 if(vxx1<xminval || vxx1>xmaxval) continue;
05235 
05236                 if(ppsubwin->axes.reverse[0] == TRUE)
05237                   vxx1 = InvAxis(ppsubwin->FRect[0],ppsubwin->FRect[2],vxx1);
05238 
05239                 ComputeGoodTrans3d(psubwin,1,&xm,&ym,&vxx1,&fy,&fz);
05240                 /*                trans3d(psubwin,1,&xm,&ym,&vxx1,&fy,&fz); */
05241 
05242 
05243                 if (IsDownAxes(psubwin))
05244                 {
05245                   vx[1]=vx[0]=xm;
05246                   vy[0]=ym;
05247                   vy[1]=vy[0]+iof/4;
05248                 }
05249                 else
05250                 {
05251                   vx[0]=xm;vy[0]=ym;
05252                   vx[1]= (integer) (vx[0]+barlengthx/2.0);
05253                   vy[1]= (integer) (vy[0]+barlengthy/2.0);
05254                 }
05255 
05256                 if(ppsubwin->axes.axes_visible[0] == TRUE)
05257                   C2F(dr)("xsegs","v", vx, vy, &ns,&ticscolor,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
05258               }
05259             }
05260           }
05261           /***************************************************************/
05262           /************************* COMMON PART *************************/
05263           /***************************************************************/
05264 
05265 
05266         }
05267 
05268       }
05269       else /* we display the computed tics */
05270       {
05271         AdaptGraduationsOnXBottomLeft(iof,x,y,size,Ticsdir,fontid,psubwin,xminval,xmaxval,0.,fy,fz);
05272 
05273         lastxindex = ppsubwin->axes.nxgrads - 1;
05274 
05275         if(lastxindex == 0)
05276           ChooseFormatForOneGrad(c_format,&(ppsubwin->axes.xgrads[0]));
05277         else
05278           ChoixFormatE(c_format,
05279           ppsubwin->axes.xgrads[0],
05280           ppsubwin->axes.xgrads[lastxindex],
05281           ((ppsubwin->axes.xgrads[lastxindex])-(ppsubwin->axes.xgrads[0]))/(lastxindex));
05282 
05283         nbtics = ppsubwin->axes.nxgrads;
05284         nbsubtics = ppsubwin->axes.nbsubtics[0];
05285 
05286         maxTicksLabelSize[0] = 0 ;
05287         maxTicksLabelSize[1] = 0 ;
05288 
05289         for(i=0;i<nbtics;i++)
05290         {
05291           char foo[256]; 
05292           double xtmp = ppsubwin->axes.xgrads[i];
05293 
05294           if(xtmp<xminval || xtmp>xmaxval) 
05295           {
05296             /*   sciprint("je rejete la valeur: %lf\n\n",xtmp); */
05297             continue; /* cas ou TL est ON et on a des graduations qui ne seront pas affichees de tte facon */
05298             /* donc autant ne pas aller plus loin dans l'algo... */
05299           }
05300 
05301           sprintf(foo,c_format,xtmp);
05302 
05303           /***************************************************************/
05304           /************************* COMMON PART *************************/
05305           /***************************************************************/
05306 
05307           if(ppsubwin->axes.reverse[0] == TRUE)
05308             xtmp = InvAxis(ppsubwin->FRect[0],ppsubwin->FRect[2],xtmp);
05309 
05310           ComputeGoodTrans3d(psubwin,1,&xm,&ym,&xtmp,&fy,&fz);
05311 
05312           vx[0]=xm;vy[0]=ym;
05313 
05314           barlengthx= (integer) (( Ticsdir[0])/sqrt((double) Ticsdir[0]*Ticsdir[0]+Ticsdir[1]*Ticsdir[1])*size);
05315           barlengthy= (integer) (( Ticsdir[1])/sqrt((double) Ticsdir[0]*Ticsdir[0]+Ticsdir[1]*Ticsdir[1])*size);
05316 
05317           C2F(dr)("xset","font",fontid,fontid+1,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L); /* fix bug noticed by R.N. */
05318 
05319           C2F(dr)("xstringl",foo,&x,&y,rect,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
05320           maxTicksLabelSize[0] = Max( maxTicksLabelSize[0], rect[2] ) ;
05321           maxTicksLabelSize[1] = Max( maxTicksLabelSize[1], rect[3] ) ;
05322 
05323           if (IsDownAxes(psubwin)){
05324             vx[1]=vx[0];
05325             vy[1]=vy[0]+iof/2;
05326             posi[0] = inint(xm-rect[2]/2); 
05327             posi[1]=inint( vy[0] + iof + rect[3]);}
05328           else{
05329             vx[1]=vx[0]+barlengthx;
05330             vy[1]=vy[0]+barlengthy;
05331             posi[0] = inint( xm+2*barlengthx-rect[2]); 
05332             posi[1]=inint( ym + 2*barlengthy + rect[3]);}
05333 
05334           if(ppsubwin->axes.axes_visible[0] == TRUE){
05335             C2F(dr)("xset","pattern",&textcolor,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
05336             C2F(dr)("xset","font",fontid,fontid+1,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
05337             if ( ppsubwin->logflags[0] == 'l' )
05338             {
05339               int smallersize = fontid[1]-2;
05340               int old_rect10[4];
05341               int posi10[2];
05342 
05343               posi10[0] = posi[0] - logrect[2];
05344               posi10[1] = posi[1] + logrect[3];
05345 
05346               C2F(dr)("xset","font",fontid,fontid+1,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
05347               C2F(dr)("xstring","10",(&posi10[0]),(&posi10[1]),PI0,&flag,PI0,PI0,&angle,PD0,PD0,PD0,0L,0L);
05348 
05349               C2F(dr)("xstringl","10",(&posi10[0]),(&posi10[1]),old_rect10,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
05350 
05351               posi[0] = old_rect10[0] + old_rect10[2];
05352               posi[1] = (int) (old_rect10[1] - old_rect10[3]*.1);
05353 
05354               C2F(dr)("xset","font",fontid,&smallersize,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
05355               C2F(dr)("xstring",foo,&(posi[0]),&(posi[1]),PI0,&flag,PI0,PI0,&ang, PD0,PD0,PD0,0L,0L);
05356 
05357               /* put back the current fontid */
05358               C2F(dr)("xset","font",fontid,fontid+1,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
05359             }
05360             else
05361               C2F(dr)("xstring",foo,&(posi[0]),&(posi[1]),PI0,&flag,PI0,PI0,&ang, PD0,PD0,PD0,0L,0L);
05362 
05363             C2F(dr)("xset","pattern",&ticscolor,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);   
05364             C2F(dr)("xsegs","v", vx, vy, &ns,&ticscolor,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
05365           }
05366           /* grid to put here */
05367           if ( ppsubwin->grid[0] > -1 && ppsubwin->axes.axes_visible[0] )
05368           {
05369             gstyle = pSUBWIN_FEATURE (psubwin)->grid[0];
05370 
05371             if((ppsubwin->logflags[0] =='l') && (i != nbtics-1))
05372             {
05373               double tmp[2];
05374               double pas=0;
05375               double * tmp_log_grads = (double *) NULL;
05376 
05377 
05378               double * grads = ppsubwin->axes.xgrads;
05379 
05380               tmp[0] = exp10(grads[i]);
05381               tmp[1] = exp10(grads[i+1]);
05382               pas = (exp10(grads[i+1]) - exp10(grads[i])) / (nbsubtics );
05383 
05384               if((tmp_log_grads = (double *)MALLOC(nbsubtics*sizeof(double)))==NULL){
05385                 sciprint("Error allocating tmp_log_grads\n");
05386                 return -1;
05387               }
05388 
05389               for(j=0;j<nbsubtics;j++) tmp_log_grads[j] = log10(tmp[0]+(j)*pas);
05390 
05391               for(j=0;j<nbsubtics;j++)
05392               {
05393                 vxx1 = tmp_log_grads[j];
05394 
05395                 if(vxx1<=xminval || vxx1>=xmaxval) continue;
05396 
05397                 if(ppsubwin->axes.reverse[0] == TRUE)
05398                   vxx1 = InvAxis(ppsubwin->FRect[0],ppsubwin->FRect[2],vxx1);
05399 
05400                 ComputeGoodTrans3d(psubwin,1,&xm,&ym,&vxx1,&fy,&fz);
05401 
05402 
05403                 xg[0]= xm;  yg[0]= ym;  
05404                 if (Ishidden(psubwin))
05405                 { xg[1]= xm; yg[1]= iybox[0] -iybox[5]+ym; }
05406                 else
05407                 {xg[1]= ixbox[1] - ixbox[3] +xm; yg[1]= iybox[5] - iybox[4] +ym; } 
05408                 C2F(dr)("xget","line style",&verbose,dash,&narg,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
05409                 C2F (dr) ("xset", "line style",&gridStyle,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
05410                 C2F(dr)("xsegs","v", xg, yg, &ns,&gstyle,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
05411                 xg[0]= xg[1]; yg[0]= yg[1];
05412                 xg[1] = ixbox[1] - ixbox[3] +xm; yg[1]=  iybox[0] - iybox[4] +ym;
05413                 C2F(dr)("xsegs","v", xg, yg, &ns,&gstyle,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
05414                 C2F(dr)("xset","line style",dash,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);  
05415 
05416               }
05417               FREE(tmp_log_grads); tmp_log_grads = (double *) NULL;
05418             }
05419             else
05420             {
05421               if(xtmp>xminval && xtmp<xmaxval) 
05422               {
05423                 xg[0]= xm;  yg[0]= ym;  
05424                 if (Ishidden(psubwin))
05425                 { xg[1]= xm; yg[1]= iybox[0] -iybox[5]+ym; }
05426                 else
05427                 {xg[1]= ixbox[1] - ixbox[3] +xm; yg[1]= iybox[5] - iybox[4] +ym; } 
05428                 C2F(dr)("xget","line style",&verbose,dash,&narg,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
05429                 C2F (dr) ("xset", "line style",&gridStyle,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
05430                 C2F(dr)("xsegs","v", xg, yg, &ns,&gstyle,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
05431                 xg[0]= xg[1]; yg[0]= yg[1];
05432                 xg[1] = ixbox[1] - ixbox[3] +xm; yg[1]=  iybox[0] - iybox[4] +ym;
05433                 C2F(dr)("xsegs","v", xg, yg, &ns,&gstyle,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
05434                 C2F(dr)("xset","line style",dash,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);  
05435               }
05436             }
05437           }
05438 
05439           /* and subtics */
05440           if(i != nbtics-1)
05441           {
05442             if(ppsubwin->logflags[0] =='l')
05443             {
05444               double tmp[2];
05445               double pas=0;
05446               double * tmp_log_grads = (double *) NULL;
05447 
05448 
05449               double * grads = ppsubwin->axes.xgrads;
05450 
05451               tmp[0] = exp10(grads[i]);
05452               tmp[1] = exp10(grads[i+1]);
05453               pas = (exp10(grads[i+1]) - exp10(grads[i])) / (nbsubtics );
05454 
05455               if((tmp_log_grads = (double *)MALLOC(nbsubtics*sizeof(double)))==NULL){
05456                 sciprint("Error allocating tmp_log_grads\n");
05457                 return -1;
05458               }
05459 
05460               for(j=0;j<nbsubtics;j++) tmp_log_grads[j] = log10(tmp[0]+(j)*pas);
05461 
05462               for(j=0;j<nbsubtics;j++)
05463               {
05464                 vxx1 = tmp_log_grads[j];
05465 
05466                 if(vxx1<xminval || vxx1>xmaxval) continue;
05467 
05468                 if(ppsubwin->axes.reverse[0] == TRUE)
05469                   vxx1 = InvAxis(ppsubwin->FRect[0],ppsubwin->FRect[2],vxx1);
05470 
05471                 ComputeGoodTrans3d(psubwin,1,&xm,&ym,&vxx1,&fy,&fz);
05472 
05473                 if (IsDownAxes(psubwin))
05474                 {
05475                   vx[1]=vx[0]=xm;
05476                   vy[0]=ym;
05477                   vy[1]=vy[0]+iof/4;
05478                 }
05479                 else
05480                 {
05481                   vx[0]=xm;vy[0]=ym;
05482                   vx[1]= (integer) (vx[0]+barlengthx/2.0);
05483                   vy[1]= (integer) (vy[0]+barlengthy/2.0);
05484                 }
05485 
05486                 if(ppsubwin->axes.axes_visible[0] == TRUE)
05487                   C2F(dr)("xsegs","v", vx, vy, &ns,&ticscolor,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
05488               }
05489               FREE(tmp_log_grads); tmp_log_grads = (double *) NULL;
05490             } /* end NEW */
05491             else
05492             {
05493               double xtmp2 = ppsubwin->axes.xgrads[i];
05494               double dx = (ppsubwin->axes.xgrads[i+1] - ppsubwin->axes.xgrads[i]) / nbsubtics;
05495 
05496               for (j=1;j<nbsubtics;j++)
05497               {  
05498                 vxx1=xtmp2+dx*j;
05499 
05500                 if(vxx1<xminval || vxx1>xmaxval) continue;
05501 
05502                 if(ppsubwin->axes.reverse[0] == TRUE)
05503                   vxx1 = InvAxis(ppsubwin->FRect[0],ppsubwin->FRect[2],vxx1);
05504 
05505                 ComputeGoodTrans3d(psubwin,1,&xm,&ym,&vxx1,&fy,&fz);
05506                 /*                trans3d(psubwin,1,&xm,&ym,&vxx1,&fy,&fz); */
05507 
05508 
05509                 if (IsDownAxes(psubwin))
05510                 {
05511                   vx[1]=vx[0]=xm;
05512                   vy[0]=ym;
05513                   vy[1]=vy[0]+iof/4;
05514                 }
05515                 else
05516                 {
05517                   vx[0]=xm;vy[0]=ym;
05518                   vx[1]= (integer) (vx[0]+barlengthx/2.0);
05519                   vy[1]= (integer) (vy[0]+barlengthy/2.0);
05520                 }
05521 
05522                 if(ppsubwin->axes.axes_visible[0] == TRUE)
05523                   C2F(dr)("xsegs","v", vx, vy, &ns,&ticscolor,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
05524               }
05525             }
05526           }
05527           /***************************************************************/
05528           /************************* COMMON PART *************************/
05529           /***************************************************************/
05530 
05531         }
05532       }
05533     }
05534 
05535     if ( sciGetVisibility(ppsubwin->mon_x_label) )
05536     { 
05537 
05538       sciLabel * ppLabel = pLABEL_FEATURE(ppsubwin->mon_x_label) ;
05539       if( ppLabel->auto_rotation )
05540       {
05541         sciSetFontOrientation(ppsubwin->mon_x_label, 0 ) ;
05542       }
05543 
05544 
05545       if( ppLabel->auto_position )
05546       {
05547 
05548         int segmentStart[2] = { ixbox[3], iybox[3] } ;
05549         int segmentEnd[2]   = { ixbox[4], iybox[4] } ;
05550 
05551         /* add the bar size and ticks label size to the offset */
05552         int offset[2] = { constOffset[0] + maxTicksLabelSize[0] + abs( barlengthx ), 
05553           constOffset[1] + maxTicksLabelSize[1] + abs( barlengthy )  } ;
05554         computeLabelAutoPos( ppsubwin->mon_x_label, segmentStart, segmentEnd, offset ) ;
05555       }
05556       /* a trick to force the display with 2d scale */
05557       drawTextEntity( ppLabel->text ) ;
05558 
05559     }
05560   }
05561   else 
05562   {
05563     if  (pSUBWIN_FEATURE (psubwin)->project[1]==1) /* y is HERE */
05564     {
05565       double fx,fy,fz;
05566       char c_format[5];
05567 
05568       integer Ticsdir[2];
05569       Ticsdir[0]=ixbox[4]-ixbox[5];
05570       Ticsdir[1]=iybox[4]-iybox[5];
05571       BBoxToval(&fx,&fy,&fz,xind[3],bbox);
05572 
05573       x=inint((ixbox[3]+ixbox[4])/2.0 -rect[2] -iof);
05574       y=inint((1/3.0)*iybox[3]+(2/3.0)*iybox[4]+ iof + 1.5*rect[3]);  
05575 
05576       if(ppsubwin->axes.auto_ticks[1] == FALSE)
05577       {
05578         /* we display the y tics specified by the user*/
05579         nbtics = ppsubwin->axes.u_nygrads;
05580         nbsubtics = ppsubwin->axes.nbsubtics[1];
05581 
05582         maxTicksLabelSize[0] = 0 ;
05583         maxTicksLabelSize[1] = 0 ;
05584 
05585         for(i=0;i<nbtics;i++)
05586         {
05587           char *foo = ppsubwin->axes.u_ylabels[i]; 
05588           double ytmp = ppsubwin->axes.u_ygrads[i];
05589 
05590           if(ytmp<yminval || ytmp>ymaxval) 
05591           {
05592             /*   sciprint("je rejete la valeur: %lf\n\n",xtmp); */
05593             continue; /* cas ou TL est ON et on a des graduations qui ne seront pas affichees de tte facon */
05594             /* donc autant ne pas aller plus loin dans l'algo... */
05595           }
05596 
05597           /***************************************************************/
05598           /************************* COMMON PART *************************/
05599           /***************************************************************/
05600 
05601           if(ppsubwin->axes.reverse[1] == TRUE)
05602             ytmp = InvAxis(ppsubwin->FRect[1],ppsubwin->FRect[3],ytmp);
05603 
05604           ComputeGoodTrans3d(psubwin,1,&xm,&ym,&fx,&ytmp,&fz);
05605           /*              trans3d(psubwin,1,&xm,&ym,&fx,&ytmp,&fz); */
05606 
05607 
05608           vx[0]=xm;vy[0]=ym; 
05609 
05610           barlengthx= (integer) (( Ticsdir[0])/sqrt((double) Ticsdir[0]*Ticsdir[0]+Ticsdir[1]*Ticsdir[1])*size);
05611           barlengthy= (integer) (( Ticsdir[1])/sqrt((double) Ticsdir[0]*Ticsdir[0]+Ticsdir[1]*Ticsdir[1])*size);
05612 
05613           C2F(dr)("xset","font",fontid,fontid+1,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L); /* fix bug noticed by R.N. */
05614 
05615           C2F(dr)("xstringl",foo,&x,&y,rect,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
05616           maxTicksLabelSize[0] = Max( maxTicksLabelSize[0], rect[2] ) ;
05617           maxTicksLabelSize[1] = Max( maxTicksLabelSize[1], rect[3] ) ;
05618 
05619           if (IsDownAxes(psubwin)){
05620             vx[1]=vx[0];
05621             vy[1]=vy[0]+iof/2;
05622             posi[0] = inint(xm-rect[2]/2); 
05623             posi[1]=inint( vy[0] + iof + rect[3]);}
05624           else{
05625             vx[1]=vx[0]+barlengthx;
05626             vy[1]=vy[0]+barlengthy;
05627             /*              posi[0] = inint( xm+2*barlengthx-rect[2]/2);  */
05628             posi[0] = inint( xm+2*barlengthx-rect[2]); 
05629             posi[1]=inint( ym + 2*barlengthy + rect[3]);}
05630 
05631 
05632           if(ppsubwin->axes.axes_visible[1] == TRUE){
05633             C2F(dr)("xset","pattern",&textcolor,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
05634             C2F(dr)("xset","font",fontid,fontid+1,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
05635             C2F(dr)("xstring",foo,&(posi[0]),&(posi[1]),PI0,&flag,PI0,PI0,&ang, PD0,PD0,PD0,0L,0L);
05636             C2F(dr)("xset","pattern",&ticscolor,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);   
05637             C2F(dr)("xsegs","v", vx, vy, &ns,&ticscolor,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
05638           }
05639           /* grid to put here */
05640           if ( ppsubwin->grid[1] > -1 && ppsubwin->axes.axes_visible[1] )
05641           {
05642             gstyle = pSUBWIN_FEATURE (psubwin)->grid[1];
05643 
05644             if((ppsubwin->logflags[1] =='l') && (i != nbtics-1))
05645             {
05646               double tmp[2];
05647               double pas=0;
05648               double * tmp_log_grads = (double *) NULL;
05649 
05650 
05651               double * grads = ppsubwin->axes.u_ygrads;
05652 
05653               tmp[0] = exp10(grads[i]);
05654               tmp[1] = exp10(grads[i+1]);
05655               pas = (exp10(grads[i+1]) - exp10(grads[i])) / (nbsubtics );
05656 
05657               if((tmp_log_grads = (double *)MALLOC(nbsubtics*sizeof(double)))==NULL){
05658                 sciprint("Error allocating tmp_log_grads\n");
05659                 return -1;
05660               }
05661 
05662               for(j=0;j<nbsubtics;j++) tmp_log_grads[j] = log10(tmp[0]+(j)*pas);
05663 
05664               for(j=0;j<nbsubtics;j++)
05665               {
05666                 vyy1 = tmp_log_grads[j];
05667 
05668                 if(vyy1<=yminval || vyy1>=ymaxval) continue;
05669 
05670                 if(ppsubwin->axes.reverse[1] == TRUE)
05671                   vyy1 = InvAxis(ppsubwin->FRect[1],ppsubwin->FRect[3],vyy1);
05672 
05673                 ComputeGoodTrans3d(psubwin,1,&xm,&ym,&fx,&vyy1,&fz);
05674 
05675                 /*   if ((xm != ixbox[3]) && (xm != ixbox[4])) */
05676                 /*                              { */ 
05677                 xg[0]= xm;  yg[0]= ym;  
05678                 if (Ishidden(psubwin))
05679                 { xg[1]= xm; yg[1]= iybox[0] -iybox[5]+ym; }
05680                 else
05681                 {xg[1]= ixbox[1] - ixbox[3] +xm; yg[1]= iybox[5] - iybox[4] +ym; } 
05682                 C2F(dr)("xget","line style",&verbose,dash,&narg,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
05683                 C2F (dr) ("xset", "line style",&gridStyle,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
05684                 C2F(dr)("xsegs","v", xg, yg, &ns,&gstyle,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
05685                 xg[0]= xg[1]; yg[0]= yg[1];
05686                 xg[1] = ixbox[1] - ixbox[3] +xm; yg[1]=  iybox[0] - iybox[4] +ym;
05687                 C2F(dr)("xsegs","v", xg, yg, &ns,&gstyle,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
05688                 C2F(dr)("xset","line style",dash,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);  
05689                 /*      } */
05690               }
05691               FREE(tmp_log_grads); tmp_log_grads = (double *) NULL;
05692             }
05693             else
05694             {
05695               if(ytmp>yminval && ytmp<ymaxval) 
05696               {
05697                 xg[0]= xm;  yg[0]= ym;  
05698                 if (Ishidden(psubwin))
05699                 { xg[1]= xm; yg[1]= iybox[0] -iybox[5]+ym; }
05700                 else
05701                 {xg[1]= ixbox[1] - ixbox[3] +xm; yg[1]= iybox[5] - iybox[4] +ym; } 
05702                 C2F(dr)("xget","line style",&verbose,dash,&narg,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
05703                 C2F (dr) ("xset", "line style",&gridStyle,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
05704                 C2F(dr)("xsegs","v", xg, yg, &ns,&gstyle,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
05705                 xg[0]= xg[1]; yg[0]= yg[1];
05706                 xg[1] = ixbox[1] - ixbox[3] +xm; yg[1]=  iybox[0] - iybox[4] +ym;
05707                 C2F(dr)("xsegs","v", xg, yg, &ns,&gstyle,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
05708                 C2F(dr)("xset","line style",dash,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);  
05709               }
05710             }
05711           }
05712 
05713           /* and subtics */
05714           if(i != nbtics-1)
05715           {
05716             if(ppsubwin->logflags[1] =='l')
05717             {
05718               double tmp[2];
05719               double pas=0;
05720               double * tmp_log_grads = (double *) NULL;
05721 
05722 
05723               double * grads = ppsubwin->axes.u_ygrads;
05724 
05725               tmp[0] = exp10(grads[i]);
05726               tmp[1] = exp10(grads[i+1]);
05727               pas = (exp10(grads[i+1]) - exp10(grads[i])) / (nbsubtics );
05728 
05729               if((tmp_log_grads = (double *)MALLOC(nbsubtics*sizeof(double)))==NULL){
05730                 sciprint("Error allocating tmp_log_grads\n");
05731                 return -1;
05732               }
05733 
05734               for(j=0;j<nbsubtics;j++) tmp_log_grads[j] = log10(tmp[0]+(j)*pas);
05735 
05736               for(j=0;j<nbsubtics;j++)
05737               {
05738                 vyy1 = tmp_log_grads[j];
05739 
05740                 if(vyy1<yminval || vyy1>ymaxval) continue;
05741 
05742                 if(ppsubwin->axes.reverse[1] == TRUE)
05743                   vyy1 = InvAxis(ppsubwin->FRect[1],ppsubwin->FRect[3],vyy1);
05744 
05745                 ComputeGoodTrans3d(psubwin,1,&xm,&ym,&fx,&vyy1,&fz);
05746 
05747                 if (IsDownAxes(psubwin))
05748                 {
05749                   vx[1]=vx[0]=xm;
05750                   vy[0]=ym;
05751                   vy[1]=vy[0]+iof/4;
05752                 }
05753                 else
05754                 {
05755                   vx[0]=xm;vy[0]=ym;
05756                   vx[1]= (integer) (vx[0]+barlengthx/2.0);
05757                   vy[1]= (integer) (vy[0]+barlengthy/2.0);
05758                 }
05759 
05760                 if(ppsubwin->axes.axes_visible[1] == TRUE)
05761                   C2F(dr)("xsegs","v", vx, vy, &ns,&ticscolor,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
05762               }
05763               FREE(tmp_log_grads); tmp_log_grads = (double *) NULL;
05764 
05765             } /* end NEW */
05766             else
05767             {
05768 
05769               double ytmp2 = ppsubwin->axes.u_ygrads[i];
05770               double dy = (ppsubwin->axes.u_ygrads[i+1] - ppsubwin->axes.u_ygrads[i]) / nbsubtics;
05771               for(j=0;j<nbsubtics;j++)
05772               {
05773                 vyy1=ytmp2+dy*j;
05774 
05775                 if(vyy1<yminval || vyy1>ymaxval) continue;
05776 
05777                 if(ppsubwin->axes.reverse[1] == TRUE)
05778                   vyy1 = InvAxis(ppsubwin->FRect[1],ppsubwin->FRect[3],vyy1);
05779 
05780                 ComputeGoodTrans3d(psubwin,1,&xm,&ym,&fx,&vyy1,&fz);
05781                 /*                trans3d(psubwin,1,&xm,&ym,&fx,&vyy1,&fz); */
05782 
05783 
05784                 if (IsDownAxes(psubwin))
05785                 {
05786                   vx[1]=vx[0]=xm;
05787                   vy[0]=ym;
05788                   vy[1]=vy[0]+iof/4;
05789                 }
05790                 else
05791                 {
05792                   vx[0]=xm;vy[0]=ym;
05793                   vx[1]= (integer) (vx[0]+barlengthx/2.0);
05794                   vy[1]= (integer) (vy[0]+barlengthy/2.0);
05795                 }
05796 
05797                 if(ppsubwin->axes.axes_visible[1] == TRUE)
05798                   C2F(dr)("xsegs","v", vx, vy, &ns,&ticscolor,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
05799               }
05800             }
05801           }
05802           /***************************************************************/
05803           /************************* COMMON PART *************************/
05804           /***************************************************************/
05805 
05806         }
05807       }
05808       else /* we display the computed tics */
05809       {
05810         AdaptGraduationsOnYBottomLeft(iof,x,y,size,Ticsdir,fontid,psubwin,yminval,ymaxval,fx,0.,fz);
05811 
05812         lastyindex = ppsubwin->axes.nygrads - 1;
05813 
05814         if(lastyindex == 0)
05815           ChooseFormatForOneGrad(c_format,&(ppsubwin->axes.ygrads[0]));
05816         else
05817           ChoixFormatE(c_format,
05818           ppsubwin->axes.ygrads[0],
05819           ppsubwin->axes.ygrads[lastyindex],
05820           ((ppsubwin->axes.ygrads[lastyindex])-(ppsubwin->axes.ygrads[0]))/(lastyindex));
05821 
05822         nbtics = ppsubwin->axes.nygrads;
05823         nbsubtics = ppsubwin->axes.nbsubtics[1];
05824 
05825         maxTicksLabelSize[0] = 0 ;
05826         maxTicksLabelSize[1] = 0 ;
05827 
05828         for(i=0;i<nbtics;i++)
05829         {
05830           char foo[256]; 
05831           double ytmp = ppsubwin->axes.ygrads[i];
05832 
05833           if(ytmp<yminval || ytmp>ymaxval) 
05834           {
05835             /*   sciprint("je rejete la valeur: %lf\n\n",xtmp); */
05836             continue; /* cas ou TL est ON et on a des graduations qui ne seront pas affichees de tte facon */
05837             /* donc autant ne pas aller plus loin dans l'algo... */
05838           }
05839 
05840           sprintf(foo,c_format,ytmp);
05841 
05842           /***************************************************************/
05843           /************************* COMMON PART *************************/
05844           /***************************************************************/
05845 
05846           if(ppsubwin->axes.reverse[1] == TRUE)
05847             ytmp = InvAxis(ppsubwin->FRect[1],ppsubwin->FRect[3],ytmp);
05848 
05849           ComputeGoodTrans3d(psubwin,1,&xm,&ym,&fx,&ytmp,&fz);
05850           /*              trans3d(psubwin,1,&xm,&ym,&fx,&ytmp,&fz); */
05851 
05852 
05853           vx[0]=xm;vy[0]=ym; 
05854 
05855           barlengthx= (integer) (( Ticsdir[0])/sqrt((double) Ticsdir[0]*Ticsdir[0]+Ticsdir[1]*Ticsdir[1])*size);
05856           barlengthy= (integer) (( Ticsdir[1])/sqrt((double) Ticsdir[0]*Ticsdir[0]+Ticsdir[1]*Ticsdir[1])*size);
05857 
05858           C2F(dr)("xset","font",fontid,fontid+1,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L); /* fix bug noticed by R.N. */
05859 
05860           C2F(dr)("xstringl",foo,&x,&y,rect,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
05861           maxTicksLabelSize[0] = Max( maxTicksLabelSize[0], rect[2] ) ;
05862           maxTicksLabelSize[1] = Max( maxTicksLabelSize[1], rect[3] ) ;
05863 
05864           if (IsDownAxes(psubwin)){
05865             vx[1]=vx[0];
05866             vy[1]=vy[0]+iof/2;
05867             posi[0] = inint(xm-rect[2]/2); 
05868             posi[1]=inint( vy[0] + iof + rect[3]);}
05869           else{
05870             vx[1]=vx[0]+barlengthx;
05871             vy[1]=vy[0]+barlengthy;
05872             /*              posi[0] = inint( xm+2*barlengthx-rect[2]/2);  */
05873             posi[0] = inint( xm+2*barlengthx-rect[2]); 
05874             posi[1]=inint( ym + 2*barlengthy + rect[3]);}
05875 
05876           if(ppsubwin->axes.axes_visible[1] == TRUE){
05877             C2F(dr)("xset","pattern",&textcolor,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
05878             C2F(dr)("xset","font",fontid,fontid+1,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
05879             if ( ppsubwin->logflags[1] == 'l' )
05880             {
05881               int smallersize = fontid[1]-2;
05882               int old_rect10[4];
05883               /*                    char str[2] = "xv"; */
05884               int posi10[2];
05885 
05886               posi10[0] = posi[0] - logrect[2];
05887               posi10[1] = posi[1] + logrect[3];
05888 
05889               C2F(dr)("xset","font",fontid,fontid+1,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
05890               C2F(dr)("xstring","10",(&posi10[0]),(&posi10[1]),PI0,&flag,PI0,PI0,&angle,PD0,PD0,PD0,0L,0L);
05891 
05892               C2F(dr)("xstringl","10",(&posi10[0]),(&posi10[1]),old_rect10,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
05893 
05894               posi[0] = old_rect10[0] + old_rect10[2];
05895               posi[1] = (int) (old_rect10[1] - old_rect10[3]*.1);
05896 
05897               C2F(dr)("xset","font",fontid,&smallersize,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
05898               C2F(dr)("xstring",foo,&(posi[0]),&(posi[1]),PI0,&flag,PI0,PI0,&ang, PD0,PD0,PD0,0L,0L);
05899 
05900               /* put back the current fontid */
05901               C2F(dr)("xset","font",fontid,fontid+1,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
05902             }
05903             else
05904               C2F(dr)("xstring",foo,&(posi[0]),&(posi[1]),PI0,&flag,PI0,PI0,&ang, PD0,PD0,PD0,0L,0L);
05905 
05906             C2F(dr)("xset","pattern",&ticscolor,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);   
05907             C2F(dr)("xsegs","v", vx, vy, &ns,&ticscolor,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
05908           }
05909           /* grid to put here */
05910           if ( ppsubwin->grid[1] > -1 && ppsubwin->axes.axes_visible[1] )
05911           {
05912             gstyle = pSUBWIN_FEATURE (psubwin)->grid[1];
05913 
05914             if((ppsubwin->logflags[1] =='l') && (i != nbtics-1))
05915             {
05916               double tmp[2];
05917               double pas=0;
05918               double * tmp_log_grads = (double *) NULL;
05919 
05920 
05921               double * grads = ppsubwin->axes.ygrads;
05922 
05923               tmp[0] = exp10(grads[i]);
05924               tmp[1] = exp10(grads[i+1]);
05925               pas = (exp10(grads[i+1]) - exp10(grads[i])) / (nbsubtics );
05926 
05927               if((tmp_log_grads = (double *)MALLOC(nbsubtics*sizeof(double)))==NULL){
05928                 sciprint("Error allocating tmp_log_grads\n");
05929                 return -1;
05930               }
05931 
05932               for(j=0;j<nbsubtics;j++) tmp_log_grads[j] = log10(tmp[0]+(j)*pas);
05933 
05934               for(j=0;j<nbsubtics;j++)
05935               {
05936                 vyy1 = tmp_log_grads[j];
05937 
05938                 if(vyy1<=yminval || vyy1>=ymaxval) continue;
05939 
05940                 if(ppsubwin->axes.reverse[1] == TRUE)
05941                   vyy1 = InvAxis(ppsubwin->FRect[1],ppsubwin->FRect[3],vyy1);
05942 
05943                 ComputeGoodTrans3d(psubwin,1,&xm,&ym,&fx,&vyy1,&fz);
05944 
05945                 /*    if ((xm != ixbox[3]) && (xm != ixbox[4])) */
05946                 /*                              {  */
05947                 xg[0]= xm;  yg[0]= ym;  
05948                 if (Ishidden(psubwin))
05949                 { xg[1]= xm; yg[1]= iybox[0] -iybox[5]+ym; }
05950                 else
05951                 {xg[1]= ixbox[1] - ixbox[3] +xm; yg[1]= iybox[5] - iybox[4] +ym; } 
05952                 C2F(dr)("xget","line style",&verbose,dash,&narg,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
05953                 C2F (dr) ("xset", "line style",&gridStyle,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
05954                 C2F(dr)("xsegs","v", xg, yg, &ns,&gstyle,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
05955                 xg[0]= xg[1]; yg[0]= yg[1];
05956                 xg[1] = ixbox[1] - ixbox[3] +xm; yg[1]=  iybox[0] - iybox[4] +ym;
05957                 C2F(dr)("xsegs","v", xg, yg, &ns,&gstyle,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
05958                 C2F(dr)("xset","line style",dash,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);  
05959                 /*      } */
05960               }
05961               FREE(tmp_log_grads); tmp_log_grads = (double *) NULL;
05962             }
05963             else
05964             {
05965               if(ytmp>yminval && ytmp<ymaxval) 
05966               {
05967                 xg[0]= xm;  yg[0]= ym;  
05968                 if (Ishidden(psubwin))
05969                 { xg[1]= xm; yg[1]= iybox[0] -iybox[5]+ym; }
05970                 else
05971                 {xg[1]= ixbox[1] - ixbox[3] +xm; yg[1]= iybox[5] - iybox[4] +ym; } 
05972                 C2F(dr)("xget","line style",&verbose,dash,&narg,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
05973                 C2F (dr) ("xset", "line style",&gridStyle,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
05974                 C2F(dr)("xsegs","v", xg, yg, &ns,&gstyle,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
05975                 xg[0]= xg[1]; yg[0]= yg[1];
05976                 xg[1] = ixbox[1] - ixbox[3] +xm; yg[1]=  iybox[0] - iybox[4] +ym;
05977                 C2F(dr)("xsegs","v", xg, yg, &ns,&gstyle,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
05978                 C2F(dr)("xset","line style",dash,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);  
05979               }
05980             }
05981           }
05982 
05983           /* and subtics */
05984           if(i != nbtics-1)
05985           {
05986             if(ppsubwin->logflags[1] =='l')
05987             {
05988               double tmp[2];
05989               double pas=0;
05990               double * tmp_log_grads = (double *) NULL;
05991 
05992 
05993               double * grads = ppsubwin->axes.ygrads;
05994 
05995               tmp[0] = exp10(grads[i]);
05996               tmp[1] = exp10(grads[i+1]);
05997               pas = (exp10(grads[i+1]) - exp10(grads[i])) / (nbsubtics );
05998 
05999               if((tmp_log_grads = (double *)MALLOC(nbsubtics*sizeof(double)))==NULL){
06000                 sciprint("Error allocating tmp_log_grads\n");
06001                 return -1;
06002               }
06003 
06004               for(j=0;j<nbsubtics;j++) tmp_log_grads[j] = log10(tmp[0]+(j)*pas);
06005 
06006               for(j=0;j<nbsubtics;j++)
06007               {
06008                 vyy1 = tmp_log_grads[j];
06009 
06010                 if(vyy1<yminval || vyy1>ymaxval) continue;
06011 
06012                 if(ppsubwin->axes.reverse[1] == TRUE)
06013                   vyy1 = InvAxis(ppsubwin->FRect[1],ppsubwin->FRect[3],vyy1);
06014 
06015                 ComputeGoodTrans3d(psubwin,1,&xm,&ym,&fx,&vyy1,&fz);
06016 
06017                 if (IsDownAxes(psubwin))
06018                 {
06019                   vx[1]=vx[0]=xm;
06020                   vy[0]=ym;
06021                   vy[1]=vy[0]+iof/4;
06022                 }
06023                 else
06024                 {
06025                   vx[0]=xm;vy[0]=ym;
06026                   vx[1]= (integer) (vx[0]+barlengthx/2.0);
06027                   vy[1]= (integer) (vy[0]+barlengthy/2.0);
06028                 }
06029 
06030                 if(ppsubwin->axes.axes_visible[1] == TRUE)
06031                   C2F(dr)("xsegs","v", vx, vy, &ns,&ticscolor,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
06032               }
06033               FREE(tmp_log_grads); tmp_log_grads = (double *) NULL;
06034 
06035             } /* end NEW */
06036             else
06037             {
06038 
06039               double ytmp2 = ppsubwin->axes.ygrads[i];
06040               double dy = (ppsubwin->axes.ygrads[i+1] - ppsubwin->axes.ygrads[i]) / nbsubtics;
06041               for(j=0;j<nbsubtics;j++)
06042               {
06043                 vyy1=ytmp2+dy*j;
06044 
06045                 if(vyy1<yminval || vyy1>ymaxval) continue;
06046 
06047                 if(ppsubwin->axes.reverse[1] == TRUE)
06048                   vyy1 = InvAxis(ppsubwin->FRect[1],ppsubwin->FRect[3],vyy1);
06049 
06050                 ComputeGoodTrans3d(psubwin,1,&xm,&ym,&fx,&vyy1,&fz);
06051 
06052                 if (IsDownAxes(psubwin))
06053                 {
06054                   vx[1]=vx[0]=xm;
06055                   vy[0]=ym;
06056                   vy[1]=vy[0]+iof/4;
06057                 }
06058                 else
06059                 {
06060                   vx[0]=xm;vy[0]=ym;
06061                   vx[1]= (integer) (vx[0]+barlengthx/2.0);
06062                   vy[1]= (integer) (vy[0]+barlengthy/2.0);
06063                 }
06064 
06065                 if(ppsubwin->axes.axes_visible[1] == TRUE)
06066                   C2F(dr)("xsegs","v", vx, vy, &ns,&ticscolor,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L);
06067               }
06068             }
06069           }
06070 
06071           /***************************************************************/
06072           /************************* COMMON PART *************************/
06073           /***************************************************************/
06074         }
06075       }
06076     }
06077 
06078     if ( sciGetVisibility(ppsubwin->mon_y_label) )
06079     {  
06080       sciLabel * ppLabel =  pLABEL_FEATURE(ppsubwin->mon_y_label) ;
06081       if( ppLabel->auto_rotation )
06082       {
06083         sciSetFontOrientation(ppsubwin->mon_y_label, 0 ) ;
06084       }
06085 
06086       if( ppLabel->auto_position )
06087       {
06088 
06089         int segmentStart[2] = { ixbox[3], iybox[3] } ;
06090         int segmentEnd[2]   = { ixbox[4], iybox[4] } ;
06091 
06092         /* add the bar size and ticks label size to the offset */
06093         int offset[2] = { constOffset[0] + maxTicksLabelSize[0] + abs( barlengthx ), 
06094           constOffset[1] + maxTicksLabelSize[1] + abs( barlengthy )  } ;
06095         computeLabelAutoPos( ppsubwin->mon_y_label, segmentStart, segmentEnd, offset ) ;
06096       }
06097       /* a trick to force the display with 2d scale */
06098       drawTextEntity( ppLabel->text ) ;
06099 
06100     }
06101   }
06102   /* reset font to its current size & to current color*/ 
06103   if ( fontsize != -1 ){
06104     fontid[1] = fontsize_kp;
06105     C2F(dr)("xset","font",fontid,fontid+1,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
06106   }
06107   if ( textcolor != -1 || ticscolor != -1 ) 
06108     C2F(dr)("xset","pattern",&color_kp,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
06109   /***/
06110   /* FREE(loc); */
06111 
06112 
06113   return 0;
06114 }

Here is the call graph for this function:

int CheckDisplay ( double  fact_h,
double  fact_w,
char  logflag,
char *  foo,
int posi,
int fontid,
int old_rect 
)

Definition at line 2266 of file Axes.c.

References C2F, dr(), FALSE, getTicksLabelBox(), i, IsInsideRectangle(), L, PD0, PI0, and TRUE.

02267 {
02268   int rect[4],i;
02269   int point[4][2];
02270   int logrect[4] ;
02271   int XX = 0 ;
02272   int YY = 0 ;
02273   
02274   if(old_rect[0] == 0 && old_rect[1] == 0 && old_rect[2] == 0 && old_rect[3] == 0)
02275   {
02276     return TRUE ;
02277   }
02278   
02279   C2F(dr)("xset","font",fontid,fontid+1,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L); /* fix bug noticed by R.N. */
02280   
02281   /* compute bounding of "10"  string used for log scale ON and auto_ticks ON */
02282   C2F(dr)("xstringl","10",&XX,&YY,logrect,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);   
02283  
02284   getTicksLabelBox( 1.0, 1.0, foo, posi, fontid, logflag, rect, TRUE ) ;
02285  
02286   point[0][0] = rect[0]; /* upper left point */
02287   point[0][1] = rect[1];
02288   
02289   point[1][0] = rect[0]; /* lower left point */
02290   point[1][1] = rect[1]+rect[3];
02291   
02292   point[2][0] = rect[0]+rect[2]; /* lower right point */
02293   point[2][1] = rect[1]+rect[3];
02294   
02295   point[3][0] = rect[0]+rect[2]; /* upper right point */
02296   point[3][1] = rect[1];
02297   
02298   for(i=0;i<4;i++)
02299   {
02300     if( !IsInsideRectangle(old_rect,point[i]) )
02301     {
02302       return FALSE; /* If one inside the old_rect, DO NOT display the graduation ! */
02303     }
02304   }
02305 
02306   return TRUE;
02307 }

Here is the call graph for this function:

int CheckPixelStatus ( void   ) 

Definition at line 713 of file drawMarks.c.

Referenced by DrawNewMarks().

00714 {
00715   if( GetDriverId() == 0 ) /* X11 or Win32 driver */
00716   { 
00717     return 1 ;
00718   }
00719   else
00720   {
00721     return 0 ;
00722   }
00723 }

Here is the caller graph for this function:

int ChildrenCounter ( sciPointObj pparent  ) 

Definition at line 1246 of file DrawObjects.c.

References ChildrenCounter(), N, NULL, tagSons::pnext, tagSons::pointobj, SCI_AGREG, SCI_POLYLINE, SCI_RECTANGLE, SCI_SEGS, SCI_SURFACE, sciGetEntityType(), and sciGetSons().

Referenced by ChildrenCounter(), and Objplot3d().

01247 {
01248   int N,q=0;
01249   sciSons * psonstmp = sciGetSons (pparent);
01250   
01251   while (psonstmp != (sciSons *) NULL) {   
01252     switch (sciGetEntityType (psonstmp->pointobj)) {  
01253     case SCI_SURFACE:
01254       N=1;
01255       break;
01256     case  SCI_POLYLINE:
01257       N = 1; 
01258       break;
01259     case  SCI_SEGS: 
01260       N=1;
01261       break;
01262     case  SCI_RECTANGLE: 
01263       N = 1;
01264       break;
01265     case SCI_AGREG:
01266       N = ChildrenCounter(psonstmp->pointobj);
01267       break;
01268     default:
01269       N=0;
01270     }
01271     q+=N;
01272     psonstmp = psonstmp->pnext;
01273   }
01274 
01275   return q;
01276 }

Here is the call graph for this function:

Here is the caller graph for this function:

int ChooseFormatForOneGrad ( char *  c_format,
double *  grad 
)

Definition at line 2694 of file DrawObjects.c.

References abs.

Referenced by AdaptGraduationsOnXBottomLeft(), AdaptGraduationsOnXBottomRight(), AdaptGraduationsOnYBottomLeft(), AdaptGraduationsOnYBottomRight(), and AdaptGraduationsOnZ().

02695 {
02696   int compteur = 0;
02697   double epsilon = 1e-16;
02698   
02699   if((double)(abs((int)*grad)) < epsilon){ /* case where grad is strictly equal to 0. */
02700     *grad = 0.;
02701     strcpy(c_format,"%d");
02702     return 0;
02703   }
02704   
02705   while((int) (*grad) == 0){
02706     compteur++;
02707     *grad = 10*(*grad);
02708     
02709     if(compteur > 100){
02710       Scierror(999,"Error in function ChooseFormatForOneGrad\n");
02711       return -1;
02712     }
02713   }
02714   
02715   sprintf(c_format,"%%.%df",compteur);
02716   
02717   return 0;
02718 }

Here is the caller graph for this function:

int ComputeCorrectXindAndInsideUD ( double  Teta,
double  Alpha,
double *  dbox,
integer xind,
integer InsideU,
integer InsideD 
)

Definition at line 938 of file DrawObjects.c.

References sciAxesVerticesIndices(), sciGetAxisBox(), and sciUpdateScaleAngles().

Referenced by axis_3ddraw().

00939 {
00940   double xbox[8], ybox[8], zbox[8];
00941 
00942   Teta = 0.1; /* Little offset to compute correct values for xind,  InsideU and InsideD */
00943 
00944   /* update Cscale.m from the new viewing angles */
00945   sciUpdateScaleAngles( Teta, Alpha ) ;
00946  
00947   sciGetAxisBox( dbox, xbox, ybox, zbox ) ;
00948  
00949   sciAxesVerticesIndices( InsideU, InsideD, xbox, ybox, xind ) ;
00950 
00951   return 0;
00952 }

Here is the call graph for this function:

Here is the caller graph for this function:

int ComputeGoodTrans3d ( sciPointObj psubwin,
int  n,
int xm,
int ym,
double *  fx,
double *  fy,
double *  fz 
)

Definition at line 956 of file DrawObjects.c.

References sciSubWindow::logflags, pSUBWIN_FEATURE, and trans3d().

Referenced by AdaptGraduationsOnXBottomLeft(), AdaptGraduationsOnXBottomRight(), AdaptGraduationsOnYBottomLeft(), AdaptGraduationsOnYBottomRight(), and AdaptGraduationsOnZ().

00957 {
00958   sciSubWindow * ppsubwin = pSUBWIN_FEATURE(psubwin);
00959 
00960   
00961   double tmp_fx = *fx;
00962   double tmp_fy = *fy;
00963   double tmp_fz = *fz;
00964   
00965   if(ppsubwin->logflags[0] == 'l')
00966     tmp_fx = exp10(tmp_fx);
00967   
00968   if(ppsubwin->logflags[1] == 'l')
00969     tmp_fy = exp10(tmp_fy);
00970   
00971   if(ppsubwin->logflags[2] == 'l')
00972     tmp_fz = exp10(tmp_fz);
00973   
00974   trans3d(psubwin, n, xm, ym, &tmp_fx, &tmp_fy, &tmp_fz);
00975   
00976   return 0;
00977 }

Here is the call graph for this function:

Here is the caller graph for this function:

void computeLabelAutoPos ( sciPointObj pLabel,
int  axisStart[2],
int  axisEnd[2],
int  offsets[2] 
)

Update the coordinates of a label to put it in the middle of a segment (normally an axis) but with a little orthogonal offset. Let Ri i=0:3 be the four corners of the label boudinbg box. The algorithm will put the center of the bounding box C on the middle of the segment I. Then we compute for each corner the needed translation to put them at a distance given by offset. The translation is done along an axis orthogonal to the segment. Finally we transalte the box from I with the longest translation, so each corner is at least at the wanted distance.

Parameters:
pLabel pointer to the label to place.
axisStart Starting point of the segment.
axisEnd The other end of the segment. The order of the two points determine the side in which the label will be placed.
offsets The label is not put exactly on the middle of the segment. It is moved from a little offset orthogonally from the segment.

Definition at line 2900 of file DrawObjects.c.

References Abs, DOT_PROD_2D, getTextBoundingBox(), Max, normalize2d(), NULL, pLABEL_FEATURE, round, sciSetPosition(), XPixel2Double, and YPixel2Double.

Referenced by labels2D_draw().

02901 {
02902   /* computation are done in double to avoid loss of data */
02903   double centerDir[2]  ; /* give the direction of the line on which is the center. */
02904                          /* it is orthogonal with the axis direction */
02905   double axisMiddle[2] ; /* middle of the axis = ( axisStart + axisEnd ) / 2 */
02906   int    bbox[4][2]    ; /* real bounding box of the label */
02907   double corners[4][2] ; /* the four corners of the boundign box */
02908   double centerDist    ; /* final distance between the center and the axis */
02909   int wantedBlPoint[2] ; /* the position we want for the bottom left point of the axis */
02910   double distance      ;
02911   double rectCenter[2] ;
02912 
02913   if ( axisStart[0] == axisEnd[0] && axisStart[1] == axisEnd[1] )
02914   {
02915     /* the axis is invisible. Its label is not displayed also. */
02916     return ;
02917   }
02918 
02919   /* normalized vector orthogonal to the axe */
02920   /* its direction (+ or -) determines on which side will be displayed the axis */
02921   centerDir[0] = axisStart[1] - axisEnd[1]   ;
02922   centerDir[1] = axisEnd[0]   - axisStart[0] ;
02923   normalize2d( centerDir ) ;
02924 
02925   /* the distance between the aabb and the axis is offsets[0] if the axis is vertical, */
02926   /* offest[1] if horizontal and something in between otherwise */
02927   distance = Abs( (double)offsets[0] * centerDir[0] ) + Abs( (double)offsets[1] * centerDir[1] ) ;
02928 
02929   axisMiddle[0] = ( axisStart[0] + axisEnd[0] ) / 2.0 ;
02930   axisMiddle[1] = ( axisStart[1] + axisEnd[1] ) / 2.0 ;
02931   
02932   /* get the size of the label axis aligned bouding box. */
02933   getTextBoundingBox( pLABEL_FEATURE(pLabel)->text, bbox, NULL ) ;
02934 
02935   /* get the center of the rectangle */
02936   rectCenter[0] = ( bbox[0][0] + bbox[1][0] + bbox[2][0] + bbox[3][0] ) / 4.0 ;
02937   rectCenter[1] = ( bbox[0][1] + bbox[1][1] + bbox[2][1] + bbox[3][1] ) / 4.0 ;
02938 
02939   /* We suppose the box is centered on I and we compute IRi, i=0:3 */
02940   corners[0][0] = bbox[0][0] - rectCenter[0] ;
02941   corners[0][1] = bbox[0][1] - rectCenter[1] ;
02942   corners[1][0] = bbox[1][0] - rectCenter[0] ;
02943   corners[1][1] = bbox[1][1] - rectCenter[1] ;
02944   corners[2][0] = bbox[2][0] - rectCenter[0] ;
02945   corners[2][1] = bbox[2][1] - rectCenter[1] ;
02946   corners[3][0] = bbox[3][0] - rectCenter[0] ;
02947   corners[3][1] = bbox[3][1] - rectCenter[1] ;
02948 
02949   /* compute IRi.v, i=0:3 to get the current distance between Ri and the axis. */
02950   /* Then for each Ri we can compute the need displacment along the centerDir to push it */
02951   /* at distance dist of the axis. Finally, the needed displacement is the maximum of the 4. */
02952   centerDist = distance - DOT_PROD_2D( corners[0], centerDir ) ;
02953   centerDist = Max( centerDist, distance - DOT_PROD_2D( corners[1], centerDir ) ) ;
02954   centerDist = Max( centerDist, distance - DOT_PROD_2D( corners[2], centerDir ) ) ;
02955   centerDist = Max( centerDist, distance - DOT_PROD_2D( corners[3], centerDir ) ) ;
02956 
02957   /* the wanted center is C = I + a.v */
02958   wantedBlPoint[0] = round( axisMiddle[0] + centerDist * centerDir[0] + corners[0][0] ) ;
02959   wantedBlPoint[1] = round( axisMiddle[1] + centerDist * centerDir[1] + corners[0][1] ) ;
02960 
02961   sciSetPosition( pLabel,
02962                   XPixel2Double( wantedBlPoint[0] ),
02963                   YPixel2Double( wantedBlPoint[1] ) ) ;
02964 
02965 }

Here is the call graph for this function:

Here is the caller graph for this function:

int ComputeNbSubTics ( sciPointObj pobj,
int  nbtics,
char  logflag,
double *  grads,
int  nbsubtics_input 
)

Definition at line 890 of file DrawObjects.c.

References FALSE, sciSubWindow::flagNax, i, and pSUBWIN_FEATURE.

Referenced by sci_update_frame_bounds_2d(), sci_update_frame_bounds_3d(), set_x_ticks_property(), set_y_ticks_property(), and set_z_ticks_property().

00891 {
00892   int ticsval[] =    {2 ,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20};
00893   int subticsval[] = {10,7,5,5,4,4,3,2,2 ,2 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 };
00894   int i;
00895   sciSubWindow * ppsubwin = pSUBWIN_FEATURE (pobj);
00896 
00897 
00898   if(logflag =='l'){
00899     if((grads[1]-grads[0])==1) /* intervalle de type ...10^n 10^(n+1)...*/
00900       {
00901         return 9; /* 9 subtics to have a pretty tics/grid in log.*/
00902       }
00903     else
00904       {
00905         return 1; /* no subtics at all (1 but draw on a tics place) */
00906       }
00907   }
00908   else{
00909     if(ppsubwin->flagNax == FALSE) /* if auto subtics mode == ON */
00910       { 
00911         for(i=0;i<19;i++)
00912           if(nbtics == ticsval[i])
00913             {
00914               return subticsval[i];
00915             }
00916       }
00917     else /* if auto subtics mode == OFF already computed in Plo2dn.c, Champ.c routines... */
00918       {  /* or given via a.subtics=[nbsubtics_on_x, nbsubtics_on_y, nbsubtics_on_z] command */
00919         return nbsubtics_input;
00920       }
00921   }
00922   
00923   return -1;
00924 }

Here is the caller graph for this function:

int ComputeNbSubTicsFor3dUse ( sciPointObj pobj,
int  nbtics,
char  logflag,
double *  grads,
int  nbsubtics_input 
)

Definition at line 2654 of file DrawObjects.c.

References FALSE, sciSubWindow::flagNax, i, and pSUBWIN_FEATURE.

02655 {
02656   int ticsval[] =    {2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20};
02657   int subticsval[] = {6,4,4,3,3,3,2,2,2 ,2 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1};
02658   int i;
02659   sciSubWindow * ppsubwin = pSUBWIN_FEATURE (pobj);
02660 
02661 
02662   if(logflag =='l'){
02663     if( (grads[1]-grads[0]) == 1 ) /* intervalle de type ...10^n 10^(n+1)...*/
02664       {
02665         return 9; /* 9 subtics to have a pretty tics/grid in log.*/
02666       }
02667     else
02668       {
02669         return 1; /* no subtics at all (1 but draw on a tics place) */
02670       }
02671   }
02672   else
02673   {
02674     if(ppsubwin->flagNax == FALSE) /* if auto subtics mode == ON */
02675     { 
02676       for(i=0;i<19;i++)
02677       {
02678         if(nbtics == ticsval[i])
02679         {
02680           return subticsval[i];
02681         }
02682       }
02683     }
02684     else /* if auto subtics mode == OFF already computed in Plo2dn.c, Champ.c routines... */
02685     {  /* or given via a.subtics=[nbsubtics_on_x, nbsubtics_on_y, nbsubtics_on_z] command */
02686       return nbsubtics_input;
02687     }
02688   }
02689   
02690   return -1;
02691 }

int computeRealArrowSize ( sciPointObj pSegs,
int  nbSegs,
int  xCoord[],
int  yCoord[] 
)

Compute the arrow size which must be used in (dr)(xarrows).

Parameters:
[in] pSegs object of which we are displaying arrows.
[in] X coordinates in pixels of the segments
[in] Y coordinates in pixels of the segments
Returns:
Size to use in xarrows.

Definition at line 381 of file drawSegsEntity.c.

Referenced by DrawMerge3d(), and drawSegsEntity().

00382 {
00383   sciSegs * ppSegs = pSEGS_FEATURE( pSegs ) ;
00384   double arrowSize = ppSegs->arrowsize ;
00385   int one = 1 ;
00386 
00387   if ( ppSegs->ptype == 0 )
00388   {
00389     if ( arrowSize > 0 )
00390     {
00391       int iAs2 = 0 ;
00392       int iAs  = 0 ;
00393       C2F(echelle2dl)( &arrowSize, &arrowSize, &iAs, &iAs2, &one, &one, "f2i" ) ;
00394       return iAs / 2 ;
00395     }
00396     else
00397     {
00398       /* taken from Xcall1.c */
00399       int i ;
00400       double length = 0.0 ;
00401       for ( i = 0 ; i < nbSegs / 2 ; i++ )
00402       {
00403         double dx ;
00404         double dy ;
00405         dx=( xCoord[2*i+1] - xCoord[2*i] ) ;
00406         dy=( yCoord[2*i+1] - yCoord[2*i] ) ;
00407         length += sqrt( dx * dx + dy * dy ) ;
00408       }
00409       if ( nbSegs != 0 )
00410       {
00411         length /= nbSegs / 2 ;
00412       }
00413       return round( -arrowSize * length ) ;
00414     }
00415   }
00416   else
00417   {
00418     if ( ppSegs->arrowsize >= 0 )
00419     {
00420       double arsize1 = ((double) Cscale.WIRect1[2])/(5*( ppSegs->Nbr1));
00421       double arsize2 = ((double) Cscale.WIRect1[3])/(5*( ppSegs->Nbr2));
00422       double arsize  =  (arsize1 < arsize2) ? inint(arsize1*10.0) : inint(arsize2*10.0) ;
00423       return (int)((arsize)*(ppSegs->arrowsize));
00424     }
00425   }
00426 
00427   return 0 ;
00428 
00429 }

Here is the caller graph for this function:

int ComputeXIntervals ( sciPointObj pobj,
char  xy_type,
double **  vector,
int N,
int  checkdim 
)

Definition at line 1036 of file Format.c.

Referenced by computeDefaultTicsLabels(), set_tics_style_property(), set_xtics_coord_property(), and set_ytics_coord_property().

01037 {
01038   int i;
01039   sciAxes * ppaxes = pAXES_FEATURE (pobj);
01040   double * val = NULL; /* reprensents ppaxes->x or ppaxes->y */
01041   int nval;
01042 
01043   int n;
01044 
01045   /* draw an horizontal axis : YES (horizontal axis) or NO (vertical axis) */
01046   BOOL ishoriz = (ppaxes->nx > ppaxes->ny)? TRUE : FALSE; 
01047 
01048   if(ishoriz == TRUE){
01049     val  = ppaxes->vx;
01050     nval = ppaxes->nx; 
01051   }
01052   else{
01053     val  = ppaxes->vy;
01054     nval = ppaxes->ny;
01055   }
01056 
01057   if(xy_type == 'v')
01058   {
01059     *N = n = nval;
01060 
01061     if((*vector = (double *) MALLOC(n*sizeof(double ))) == NULL){
01062       sciprint("No memory left for allocating temporary tics_labels\n");
01063       return -1;
01064     }
01065 
01066     for(i=0;i<n;i++)
01067       (*vector)[i] = val[i];
01068   }
01069   else if(xy_type == 'r')
01070   {
01071     double step = 0;
01072 
01073     *N = n = (int)val[2]+1; /* intervals number is given by  ppaxes->x or ppaxes->y */
01074 
01075     if(checkdim){
01076       if(nval != 3)
01077         sciprint("Warning: tics_coord must be changed, xy_type is 'r' and tics_coord dimension is not 3\n");
01078 
01079       if(nval < 3){
01080         sciprint("Error: tics_coord must be changed FIRST, xy_type is 'r' and tics_coord dimension < 3\n");
01081         *vector = (double *) NULL;
01082         return -1;
01083       }
01084     }
01085 
01086     if((*vector = (double *) MALLOC(n*sizeof(double ))) == NULL){
01087       sciprint("No memory left for allocating temporary tics_labels");
01088       return -1;
01089     }
01090 
01091     step = (val[1] - val[0])/(n-1);
01092 
01093     for(i=0;i<n-1;i++)
01094       (*vector)[i] = val[0] + i*step;
01095 
01096     (*vector)[n-1] = val[1]; /* xmax */
01097 
01098   }
01099   else if(xy_type == 'i')
01100   {
01101     double step = 0;
01102 
01103     *N = n = (int)val[3]+1;
01104 
01105     if(checkdim){
01106       if(nval != 4)
01107         sciprint("Warning: tics_coord must be changed, xy_type is 'i' and tics_coord dimension is not 4\n");
01108 
01109       if(nval < 4){
01110         sciprint("Error: tics_coord must be changed FIRST, xy_type is 'i' and tics_coord dimension < 4\n");
01111         *vector = (double *) NULL;
01112         return -1;
01113       }
01114     }
01115 
01116     if((*vector =(double *)  MALLOC(n*sizeof(double ))) == NULL){
01117       sciprint("No memory left for allocating temporary tics_labels");
01118       return -1;
01119     }
01120 
01121     step = (val[1]*exp10(val[2]) - val[0]*exp10(val[2]))/val[3];
01122 
01123 
01124     for(i=0;i<n-1;i++)
01125       (*vector)[i] = val[0]*exp10(val[2]) + i*step;
01126 
01127     (*vector)[n-1] = val[1]*exp10(val[2]); /* xmax */
01128 
01129   }
01130 
01131   return 0;
01132 }

Here is the caller graph for this function:

void Convex_Box ( double *  xbox,
double *  ybox,
integer InsideU,
integer InsideD,
char *  legend,
integer flag,
double *  bbox 
)

Definition at line 275 of file Plo3d.c.

Referenced by box3d().

00276 {
00277   double xmaxi;
00278   integer ixbox[8],iybox[8];
00279   integer xind[8];
00280   integer ind2,ind3,ind;
00281   integer p,n,dvect[1],dash[6];
00282   integer verbose=0,narg_,pat;
00283   integer i,j;
00290   /*      4 ----- 5        */
00291   /*       /    /|         */
00292   /*     7----6  |         */
00293   /*      | 0 | / 1        */
00294   /*     3----- 2          */
00298   xmaxi=((double) Maxi(xbox,8L));
00299   ind= -1;
00300   for (i =0 ; i < 8 ; i++)
00301     {
00302       MaxiInd(xbox,8L,&ind,xmaxi);
00303       if ( ind > 3)
00304         {
00305           xind[0]=ind;
00306           break;
00307         }
00308     }
00309   if (ind < 0 || ind > 8) 
00310     {
00311       sciprint("xind out of bounds");
00312       xind[0]=0;
00313     }
00314   UpNext(xind[0],&ind2,&ind3);
00315   if (ybox[ind2] > ybox[ind3]) 
00316     {
00317       xind[1]=ind2;InsideU[0]=ind3;
00318     }
00319   else 
00320     {
00321       xind[1]=ind3;InsideU[0]=ind2;
00322     }
00323   UpNext(ind2,&ind2,&ind3); InsideU[1]=xind[0];
00324   InsideU[2]=ind2; InsideU[3]=InsideU[0]-4;
00325   xind[2]=ind2;
00326   /* le pointeger en bas qui correspond */
00327   xind[3]=ind2-4;
00328   DownNext(xind[3],&ind2,&ind3);
00329   if (ybox[ind2] < ybox[ind3]) 
00330     {
00331       xind[4]=ind2;InsideD[0]=ind3;
00332     }
00333   else  
00334     {
00335       xind[4]=ind3;InsideD[0]=ind2;
00336     }
00337   DownNext(ind2,&ind2,&ind3);
00338   InsideD[1]=xind[3];
00339   InsideD[2]=ind2;
00340   InsideD[3]=InsideD[0]+4;
00341   xind[5]=ind2;
00342   for (i=0; i < 6 ; i++)
00343     {
00344       ixbox[i]=XScale(xbox[xind[i]]);
00345       iybox[i]=YScale(ybox[xind[i]]);
00346     }
00347   ixbox[6]=ixbox[0];iybox[6]=iybox[0];
00348   p=7,n=1;
00351   dvect[0]=2;       
00353   C2F(dr)("xget","line style",&verbose,dash,&narg_,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
00354   C2F(dr)("xset","line style",(j=1,&j),PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
00355   C2F (dr) ("xset","thickness",(j=1,&j),PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);     
00356   if (flag[2]>=3){
00357     C2F(dr)("xpolys","v",ixbox,iybox,dvect,&n,&p
00358             ,PI0,PD0,PD0,PD0,PD0,0L,0L);
00359   }
00360   C2F(dr)("xget","pattern",&verbose,&pat,&narg_,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
00361   C2F(dr)("xset","pattern",dvect,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L); 
00362   if (flag[2]>=3)
00363     AxesStrings(flag[2],ixbox,iybox,xind,legend,bbox);
00364   C2F(dr)("xset","pattern",&pat,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
00365   C2F(dr)("xset","line style",dash,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
00366 
00367 }

Here is the caller graph for this function:

int CopyUserGrads ( double *  u_xgrad_SRC,
double *  u_xgrad_DEST,
int  dim 
)

Definition at line 717 of file Plo2dn.c.

References i, and NULL.

Referenced by ConstructSubWin().

00718 {
00719   int i;
00720 
00721   if(u_xgrad_SRC == NULL)
00722     return 0;
00723 
00724   for(i=0;i<dim;i++)
00725     u_xgrad_DEST[i] = u_xgrad_SRC[i];
00726   
00727   return 0;
00728 }

Here is the caller graph for this function:

void DrawAxes ( sciPointObj  ) 

Definition at line 1000 of file DrawObjects.c.

References axis_draw2(), C2F, dr(), NULL, pSUBWIN_FEATURE, rebuild_strflag(), sciGetForeground(), sciGetLineStyle(), sciGetLineWidth(), sciGetMarkStyle(), sciGetParentSubwin(), sciGetVisibility(), sciSetSelectedSubWin(), set_scale(), v, and x.

Referenced by DrawAxesIfRequired().

01001 {
01002   sciPointObj * psubwin = sciGetParentSubwin(pobj);
01003   /*   sciPointObj * pfigure = sciGetParentFigure(pobj); */
01004   char STRFLAG[4];
01005   integer x[6], v, markidsizenew[2];
01006   double dv;
01007 
01008   if (!sciGetVisibility(pobj)) return;
01009   
01010   x[0] = sciGetForeground (psubwin);
01011   x[2] = sciGetLineWidth (psubwin);
01012   x[3] = sciGetLineStyle (psubwin);
01013   markidsizenew[0] = sciGetMarkStyle(psubwin);
01014   markidsizenew[1] = sciGetLineWidth (psubwin);
01015   x[4] = 0;
01016   v = 0;
01017   dv = 0;
01018 
01019   
01020   sciSetSelectedSubWin(psubwin); 
01021   
01022   set_scale ("tttftt", pSUBWIN_FEATURE (psubwin)->WRect, pSUBWIN_FEATURE (psubwin)->FRect,
01023              NULL, pSUBWIN_FEATURE (psubwin)->logflags, 
01024              pSUBWIN_FEATURE (psubwin)->ARect); 
01025      
01026   if (!pSUBWIN_FEATURE (psubwin)->is3d)   /* we are in 2D mode...*/
01027     {
01028       /* F.Leray 07.12.04 */
01029       /* TO CORRECT the bug 1115 : Big object (grayplots) could cover axes*/
01030       C2F (dr) ("xset","dashes",x,x,x+4,x+4,x+4,&v,&dv,&dv,&dv,&dv,5L,4096);
01031       C2F (dr) ("xset","foreground",x,x,x+4,x+4,x+4,&v,&dv,&dv,&dv,&dv,5L,4096);
01032       C2F (dr) ("xset","thickness",x+2,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
01033       C2F (dr) ("xset","mark",&markidsizenew[0],&markidsizenew[1],PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
01034 
01035       rebuild_strflag(psubwin,STRFLAG);
01036       axis_draw2 (STRFLAG); /* Axes is rebuilt here to avoid being covered by the new created object */
01037     }
01038 }

Here is the call graph for this function:

Here is the caller graph for this function:

void DrawAxesIfRequired ( sciPointObj pobj  ) 

DrawAxesIfRequired Draws Axes (only the basic graphicobject under subwindows) in its SubWindow or figure if and only if pFIGURE_FEATURE(pobj)->auto_redraw == TRUE !! Only used inside High Level functions calls (sucha as plot2d, plot3d...)

Parameters:
sciPointObj * pobj: the pointer to the entity
Returns:
int 0 if OK, -1 if not

Definition at line 987 of file DrawObjects.c.

References DrawAxes(), pFIGURE_FEATURE, and sciGetParentFigure().

Referenced by champg(), fec(), plot2dn(), xgray(), xgray1(), and xgray2().

00988 {
00989   sciPointObj * pfigure = sciGetParentFigure(pobj);
00990   
00991   if( pFIGURE_FEATURE(pfigure)->auto_redraw && pFIGURE_FEATURE(pfigure)->visible )
00992   {
00993     DrawAxes(pobj);
00994   }
00995   
00996 }

Here is the call graph for this function:

Here is the caller graph for this function:

double FindWidth ( sciPointObj pobj,
int  n1,
int  bar_number,
double *  x 
)

char ** FreeUserLabels ( char **  u_xlabels,
int u_nxgrads 
)

Definition at line 673 of file Plo2dn.c.

References FREE, i, and NULL.

Referenced by CreatePrettyGradsFromNax(), and DestroySubWin().

00674 {
00675   int i;
00676   
00677   if(u_xlabels != NULL){
00678     for(i=0;i<(*u_nxgrads);i++)
00679       {FREE(u_xlabels[i]); u_xlabels[i] = (char *) NULL;}
00680   }
00681   
00682   u_xlabels = (char **) NULL;
00683     
00684   *u_nxgrads = 0;
00685   
00686   return u_xlabels;
00687 }

Here is the caller graph for this function:

int Gen3DPoints ( integer  type,
integer polyx,
integer polyy,
integer fill,
integer  whiteid,
double  zmin,
double  zmax,
double *  ,
double *  ,
double *  ,
integer  i,
integer  j,
integer  jj1,
integer p,
integer  dc,
integer  fg,
sciPointObj psurface 
)

DJ.Abdemouche 2003

Definition at line 1106 of file DrawObjects.c.

References sciSubWindow::axes, sciSurface::flag_x, sciSurface::flag_y, inint, pSUBWIN_FEATURE, pSURFACE_FEATURE, AXES::reverse, sciGetCurrentSubWin(), trans3d(), and TRUE.

Referenced by plot3dn().

01107 {
01108   sciPointObj *pobj;
01109   int facteur = 1;
01110 
01111   sciPointObj *psubwin = sciGetCurrentSubWin();
01112   sciSubWindow * ppsubwin = pSUBWIN_FEATURE(psubwin);
01113   sciSurface * ppsurface = pSURFACE_FEATURE (psurface);
01114   
01115   pobj = sciGetCurrentSubWin(); 
01116   if (trans3d(pobj ,1, &(polyx[  5*jj1]),&(polyy[  5*jj1]),&(x[i]),&(y[j]),&(z[i+(*p)*j]))==0) return 0; 
01117   if (trans3d(pobj ,1, &(polyx[1+  5*jj1]),&(polyy[1+  5*jj1]),&(x[i]),&(y[j+1]),&(z[i+(*p)*(j+1)]))==0) return 0; 
01118   if (trans3d(pobj ,1, &(polyx[2+  5*jj1]),&(polyy[2+  5*jj1]),&(x[i+1]),&(y[j+1]),&(z[(i+1)+(*p)*(j+1)]))==0) return 0; 
01119   if (trans3d(pobj ,1, &(polyx[3+  5*jj1]),&(polyy[3+  5*jj1]),&(x[i+1]),&(y[j]),&(z[(i+1)+(*p)*j]))==0) return 0;   
01120   if (trans3d(pobj ,1, &(polyx[4+  5*jj1]),&(polyy[4+  5*jj1]),&(x[i]),&(y[j]),&(z[i+(*p)*j]))==0) return 0; 
01121   
01122   
01123   if(ppsubwin->axes.reverse[0] == TRUE) facteur = -facteur;
01124   if(ppsubwin->axes.reverse[1] == TRUE) facteur = -facteur;
01125   if(ppsubwin->axes.reverse[2] == TRUE) facteur = -facteur;
01126   
01127   /* try */
01128   facteur = ppsurface->flag_x * ppsurface->flag_y * facteur;
01129   
01130   /* type == flagcolor and dc == color_mode */
01131   /* fg = hidden color */
01132   
01133   if ((((polyx[1+5*jj1]-polyx[0+5*jj1])*(polyy[2+5*jj1]-polyy[0+5*jj1])-
01134         (polyy[1+5*jj1]-polyy[0+5*jj1])*(polyx[2+5*jj1]-polyx[0+5*jj1]))*facteur <  0) && (fg >=0 )) 
01135     {
01136       
01137       /* ------------------- */
01138       /* Beneath the surface */
01139       /* ------------------- */
01140 
01141       if (type != 0) /* flagcolor = 1 case : special treatment compared to flagcolor = 0 */
01142                      /* don't know why... F.Leray */
01143         fill[jj1]= (dc < 0 ) ? -fg : fg ;
01144       else           /* flagcolor = 0 :  No shading at all, fixed facecolor. */
01145         fill[jj1]=  (dc != 0 ) ? fg : dc ;
01146     }
01147   else
01148     {
01149 
01150       /* ------------------- */
01151       /* Above the surface */
01152       /* ------------------- */
01153 
01154      if (type != 0)
01155         {  /* flagcolor = 1 :  Z-level flat shading. */
01156           fill[jj1]=inint((whiteid-1)*((1/4.0*( z[i+(*p)*j]+ z[i+1+(*p)*j]+
01157                                                 z[i+(*p)*(j+1)]+ z[i+1+(*p)*(j+1)])-zmin)
01158                                        /(zmax-zmin)))+1;
01159           if ( dc < 0 ) fill[jj1]= -fill[jj1];  
01160         }
01161       else
01162         fill[jj1]= dc;     
01163     }
01164   
01165   return(1);
01166   
01167 }

Here is the call graph for this function:

Here is the caller graph for this function:

int get_cf_type ( void   ) 

To know if the current figure is a graphic one.

Definition at line 23 of file CurrentObjectsManagement.c.

References cf_type.

00024 {
00025   return cf_type ;
00026 }

int GetBarNumber ( sciPointObj pobj  ) 

int GetDPIFromDriver ( int DPI  ) 

Referenced by drawMergeEntity(), drawPolylineEntity(), drawRectangleEntity(), drawSegsEntity(), and drawSurfaceEntity().

Here is the caller graph for this function:

void GPopupResize ( struct BCG ScilabXgc,
int width,
int height 
)

used when we resize the popup at scilab level

Definition at line 154 of file wgraph.c.

Referenced by setpopupdim(), and xset_popupdim().

00155 {
00156   RECT rect, rect1;
00157   int xof, yof;
00158   SCROLLINFO vertsi;
00159   SCROLLINFO horzsi;
00160   int *x = width; /* F.Leray 01.07.04 copy the setwindowdim function philosohpy (see periwin.c)*/
00161   int *y = height;
00162 
00163  if ( (ScilabXgc->CWindow != NULL) && (ScilabXgc->hWndParent != NULL) )
00164   {
00165     /* initialisation des variables SCROLLINFO*/
00166     sciGetScrollInfo(ScilabXgc, SB_VERT, &vertsi);
00167     sciGetScrollInfo(ScilabXgc, SB_HORZ, &horzsi);
00168     
00169     ScilabXgc->CWindowWidth = Max((int) *x,50);
00170     ScilabXgc->CWindowHeight =Max((int) *y,50);
00171     if ( sciGetwresize() == 1 ) {
00172       ScilabXgc->CWindowWidthView  = ScilabXgc->CWindowWidth;
00173       ScilabXgc->CWindowHeightView = ScilabXgc->CWindowHeight;
00174       vertsi.nPos   = 0;
00175       horzsi.nPos   = 0;
00176     }
00177 
00178     if ( ScilabXgc->CWindowWidthView > ScilabXgc->CWindowWidth)
00179       ScilabXgc->CWindowWidthView = ScilabXgc->CWindowWidth;
00180 
00181     if (ScilabXgc->CWindowHeightView > ScilabXgc->CWindowHeight)
00182       ScilabXgc->CWindowHeightView = ScilabXgc->CWindowHeight;
00183     CPixmapResize1();
00184 
00185     GetWindowRect (ScilabXgc->hWndParent, &rect) ;
00186     GetWindowRect (ScilabXgc->CWindow, &rect1) ;
00187     xof = (rect.right-rect.left)- (rect1.right - rect1.left);
00188     yof = (rect.bottom-rect.top)- (rect1.bottom -rect1.top );
00189     if (sciGetwresize () == 0)
00190       {
00191         SetWindowPos (ScilabXgc->hWndParent, HWND_TOP, 0, 0,
00192                       ScilabXgc->CWindowWidthView + xof +
00193                       GetSystemMetrics (SM_CXVSCROLL),
00194                       ScilabXgc->CWindowHeightView + yof +
00195                       GetSystemMetrics (SM_CYHSCROLL),
00196                       SWP_NOMOVE | SWP_NOZORDER);
00197       }
00198     else
00199       {
00200         SetWindowPos(ScilabXgc->hWndParent,HWND_TOP,0,0,
00201                      ScilabXgc->CWindowWidthView  + xof,
00202                      ScilabXgc->CWindowHeightView + yof,
00203                      SWP_NOMOVE | SWP_NOZORDER );
00204       }
00205     vertsi.nMax   = ScilabXgc->CWindowHeight;
00206     vertsi.nPage  = ScilabXgc->CWindowHeightView;
00207     horzsi.nMax   = ScilabXgc->CWindowWidth;
00208     horzsi.nPage  = ScilabXgc->CWindowWidthView;  
00209     sciSetScrollInfo(ScilabXgc,SB_VERT, &(vertsi), TRUE);
00210     sciSetScrollInfo(ScilabXgc,SB_HORZ, &(horzsi), TRUE);
00211     if ( sciGetwresize() == 0 ) 
00212       {
00213         /* need to force a rdraw in that case */
00214         if ( ScilabXgc->horzsi.nPos + ScilabXgc->CWindowWidthView < 
00215              ScilabXgc->CWindowWidth 
00216              &&  ScilabXgc->vertsi.nPos + ScilabXgc->CWindowHeightView < 
00217              ScilabXgc->CWindowHeight) 
00218           InvalidateRect(ScilabXgc->CWindow,NULL,FALSE);
00219           }
00220   }
00221  
00222 }

Here is the caller graph for this function:

int GradLog ( double  _min,
double  _max,
double *  _grads,
int n_grads,
int  compNgrads 
)

Definition at line 437 of file DrawObjects.c.

References GradFixedlog(), i, int, j, pas, size, and val.

Referenced by GradFixedlog(), updateXaxesTics(), and updateYaxesTics().

00442 {
00443   int i;
00444   int log_min, log_max;
00445   int size;
00446   
00447   if ( compNgrads )
00448   {
00449     GradFixedlog( _min, _max, _grads, *n_grads ) ;
00450     return 0 ;
00451   }
00452 
00453   log_max =  (int) ceil(_max);
00454   log_min =  (int) floor(_min);
00455   
00456 
00457   size = log_max - log_min +1;
00458   /*  tab=(int *)MALLOC(size*sizeof(int)); */
00459   
00460   /*   for(i=0;i<size;i++) tab[i]=log_min+i; */
00461 
00462   *n_grads = 0 ;
00463 
00464   if(size<=7)    {
00465       for(i=0;i<size;i++)
00466         {
00467           /*    _grads[i] = exp10(tab[i]); */
00468           _grads[i] = log_min+i;
00469           *n_grads = (*n_grads) + 1;
00470           /*      sciprint("Juste en sortie, _grads[%d] = %lf\n",i, _grads[i]); */
00471         }
00472     }
00473   else
00474     {
00475       int pas = 0, old_pas= 0,j;
00476       int val = size, passed = 0;
00477       
00478       for(j=val-1;j>1;j--)
00479         if(val%j == 0){
00480           old_pas = pas;
00481           pas=j; 
00482           passed = 1;
00483 
00484           if((7*pas)<=val){ 
00485             if(old_pas != 0) {pas = old_pas; }
00486             break;
00487           }
00488         }
00489       
00490       if(passed != 1 || (size/pas)>15 ) pas = size;
00491             
00492       if(pas==size)
00493         {
00494           _grads[0] = log_min;
00495           _grads[1] = log_max;
00496           *n_grads =2;
00497         }
00498       else
00499       {
00500         for(i=0;i<=(int )(size/pas);i++)
00501           {
00502             _grads[i] = log_min+(i*pas);
00503             
00504             *n_grads = (*n_grads) + 1;
00505             /*      sciprint("Juste en sortie, _grads[%d] = %lf\n",i, _grads[i]); */
00506           }
00507       }
00508     }
00509   
00510   return 0;
00511 }

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL IsDownAxes ( sciPointObj pobj  ) 

Definition at line 369 of file DrawObjects.c.

References alpha, FALSE, pSUBWIN_FEATURE, SCI_SUBWIN, sciGetEntityType(), and TRUE.

Referenced by AdaptGraduationsOnXBottomLeft(), AdaptGraduationsOnXBottomRight(), AdaptGraduationsOnYBottomLeft(), and AdaptGraduationsOnYBottomRight().

00370 {
00371   double alpha,cof;
00372   
00373   if (sciGetEntityType(pobj) == SCI_SUBWIN){
00374     alpha = pSUBWIN_FEATURE (pobj)->alpha;   
00375     if (!(pSUBWIN_FEATURE (pobj)->isoview))
00376       cof=10.0;
00377     else
00378       cof = 5.0; /* F.Leray : hard fixed here */
00379     if (cof == 0 ) cof =5;
00380     if ((alpha <=(-90.0+cof) ) && (alpha >= (-90.0-cof))) 
00381       return TRUE;
00382     if ((alpha <=(-270.0+cof) ) && (alpha >= (-270.0-cof)))
00383       return TRUE;
00384     if ((alpha <=(90.0+cof) ) && (alpha >= (90.0-cof)))
00385       return TRUE;
00386     if ((alpha <=(270.0+cof) ) && (alpha >= (270.0-cof)))
00387       return TRUE;
00388   }
00389   return FALSE;
00390 }

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL Ishidden ( sciPointObj pobj  ) 

Definition at line 350 of file DrawObjects.c.

References alpha, FALSE, pSUBWIN_FEATURE, SCI_SUBWIN, sciGetEntityType(), and TRUE.

Referenced by axis_3ddraw().

00351 {
00352   double alpha;
00353   if (sciGetEntityType(pobj) == SCI_SUBWIN){
00354     alpha = pSUBWIN_FEATURE (pobj)->alpha;
00355     if ((alpha <0.0 ) && (alpha > -90.0))
00356       return TRUE;
00357     if ((alpha <360.0 ) && (alpha > 270.0)) /* missing case added to fix bug 839 F.Leray */
00358       return TRUE;
00359     if ((alpha <-180.0 ) && (alpha > -270.0))
00360       return TRUE;
00361     if ((alpha <180.0 ) && (alpha > 90.0))
00362       return TRUE;
00363   }
00364   return FALSE;
00365 }

Here is the call graph for this function:

Here is the caller graph for this function:

int IsInsideRectangle ( int rect,
int point 
)

Definition at line 2318 of file Axes.c.

References FALSE, and TRUE.

02319 {
02320 
02321   if((point[0] >= rect[0] && point[0] <= rect[0]+rect[2]) &&
02322      (point[1] >= rect[1] && point[1] <= rect[1]+rect[3]))
02323     return FALSE;
02324   
02325   return TRUE;
02326 }

void matrixLine2String ( char **  matrix,
int  matrixSize[2],
int  numLine,
char *  dest 
)

void Merge3d ( sciPointObj psubwin  ) 

Definition at line 1346 of file DrawObjects.c.

References ConstructMerge(), DestroyMerge(), FREE, MALLOC, Merge3dBuildTable(), Merge3dDimension(), NULL, pSUBWIN_FEATURE, SCI_SUBWIN, sciGetEntityType(), sciGetMerge(), sciprint(), and TRUE.

Referenced by Objplot3d(), plot2dn(), sci_set(), sci_xfpoly(), sci_xfpolys(), sci_xpoly(), sci_xpolys(), sci_xrect(), sci_xrects(), sci_xsegs(), and updateMerge().

01347 {
01348   integer q,k; 
01349   sciPointObj *pmerge; 
01350   int *index_in_entity;
01351   long *from_entity;
01352   
01353   if(sciGetEntityType (psubwin) != SCI_SUBWIN) return; 
01354   if ((pmerge= sciGetMerge(psubwin)) != (sciPointObj *) NULL)
01355     DestroyMerge(pmerge); 
01356   
01357   /* ========================================================================
01358    * Compute the number of facets, segments,... included in all the subwin 
01359    * children
01360    * ========================================================================*/
01361   
01362   
01363   q =  Merge3dDimension(psubwin);
01364   
01365   
01366   /* ========================================================================
01367    * allocate tables for index and handles
01368    * ========================================================================*/
01369   
01370   /* q now contains the total number of elements */
01371   if ((index_in_entity = (int *) MALLOC (q * sizeof (int))) == (int *)NULL) {
01372     sciprint("Merge3d : not enough memory to allocate \n");
01373     return;
01374   }
01375   if ((from_entity   = (long *) MALLOC (q * sizeof (long))) == (long *) NULL) {
01376     sciprint("Merge3d : not enough memory to allocate \n");
01377     FREE(index_in_entity);
01378   }
01379   
01380   /* ========================================================================
01381    * fill the index and handles tables
01382    * ========================================================================*/
01383   k=0;
01384   Merge3dBuildTable(psubwin, index_in_entity, from_entity, &k);
01385   
01386   /* ========================================================================
01387    * create the Merge data structure
01388    * ========================================================================*/
01389   
01390   if ((pmerge=ConstructMerge ((sciPointObj *) psubwin,q,index_in_entity,from_entity)) == (sciPointObj *) NULL) {
01391     FREE(index_in_entity);
01392     FREE(from_entity);
01393     sciprint ("\r\n No merge supported");}
01394   else /* inform the subwindow to display Merge instead of individual children */
01395     pSUBWIN_FEATURE (psubwin)->facetmerge = TRUE;
01396   
01397 }

Here is the call graph for this function:

Here is the caller graph for this function:

void Merge3dBuildTable ( sciPointObj pparent,
int index_in_entity,
long from_entity,
int pos 
)

Definition at line 1279 of file DrawObjects.c.

References i, long, Merge3dBuildTable(), N, sciSegs::Nbr1, sciSegs::Nbr2, NULL, tagSons::pnext, tagSons::pointobj, pPOLYLINE_FEATURE, pSEGS_FEATURE, pSURFACE_FEATURE, sciSegs::ptype, SCI_AGREG, SCI_PLOT3D, SCI_POLYLINE, SCI_RECTANGLE, SCI_SEGS, SCI_SURFACE, sciGetEntityType(), sciGetHandle(), sciGetIsMark(), and sciGetSons().

Referenced by Merge3d(), and Merge3dBuildTable().

01280 {
01281   sciSons *psonstmp;
01282   int i,N;
01283 
01284   psonstmp = sciGetSons (pparent);
01285 
01286   while (psonstmp != (sciSons *) NULL) {   
01287     switch (sciGetEntityType (psonstmp->pointobj)) {  
01288     case SCI_SURFACE:
01289       if (pSURFACE_FEATURE (psonstmp->pointobj)->typeof3d == SCI_PLOT3D) 
01290         N=(pSURFACE_FEATURE (psonstmp->pointobj)->dimzx-1)*(pSURFACE_FEATURE (psonstmp->pointobj)->dimzy-1);
01291       else
01292         N = pSURFACE_FEATURE (psonstmp->pointobj)->dimzy;
01293       break;
01294     case  SCI_POLYLINE:
01295       if ( pPOLYLINE_FEATURE(psonstmp->pointobj)->n1 == 0 )
01296       {
01297         N = 0 ;
01298       }
01299       else if (pPOLYLINE_FEATURE (psonstmp->pointobj)->plot != 5)
01300       {/*polyline*/
01301         N = pPOLYLINE_FEATURE (psonstmp->pointobj)->n1-1;
01302         if ((pPOLYLINE_FEATURE (psonstmp->pointobj)->plot != 2) && 
01303             (sciGetIsMark((sciPointObj *)psonstmp->pointobj) == 1))
01304         {
01305           N = N + 1 ;
01306         }
01307       }
01308       else /* patch */
01309       {
01310         N = 1 ;
01311       }
01312       break;
01313     case  SCI_SEGS: 
01314       {
01315         sciSegs * ppSegs = pSEGS_FEATURE(psonstmp->pointobj) ;
01316         if ( ppSegs->ptype == 0 )
01317         { 
01318           N = ppSegs->Nbr1 / 2 ;
01319         }
01320         else
01321         {
01322           N = ppSegs->Nbr1 * ppSegs->Nbr2 ;
01323         }
01324       }
01325       break;
01326     case  SCI_RECTANGLE: 
01327       N = 4;
01328       break;
01329     case SCI_AGREG:
01330       Merge3dBuildTable(psonstmp->pointobj, index_in_entity, from_entity, pos);
01331       break;
01332     default:
01333       N = 0;
01334     }
01335     if (sciGetEntityType (psonstmp->pointobj) != SCI_AGREG)
01336       for (i=0 ; i<N; i++) {
01337         index_in_entity[*pos]=i;
01338         from_entity[*pos]=(long) sciGetHandle (psonstmp->pointobj);
01339         *pos=*pos+1;
01340       }
01341     psonstmp = psonstmp->pnext;
01342   }
01343 }

Here is the call graph for this function:

Here is the caller graph for this function:

int Merge3dDimension ( sciPointObj pparent  ) 

Definition at line 1171 of file DrawObjects.c.

References Merge3dDimension(), N, sciSegs::Nbr1, sciSegs::Nbr2, NULL, tagSons::pnext, tagSons::pointobj, pPOLYLINE_FEATURE, pSEGS_FEATURE, pSURFACE_FEATURE, sciSegs::ptype, SCI_AGREG, SCI_PLOT3D, SCI_POLYLINE, SCI_RECTANGLE, SCI_SEGS, SCI_SURFACE, sciGetEntityType(), sciGetIsMark(), and sciGetSons().

Referenced by Merge3d(), and Merge3dDimension().

01172 {
01173   integer N,q; 
01174   sciSons *psonstmp;
01175 
01176   /* ========================================================================
01177    * Compute the number of facets, segments,... included in all the subwin 
01178    * children
01179    * Each entities to merge; is decomposed in a set of basic elements 
01180    *  (facet, segment, point,...)
01181    * Each basic element is represented in the Merge structure by the handle of its entity and an 
01182    *   index within this entity
01183    * ========================================================================*/
01184 
01185   q=0;
01186   psonstmp = sciGetSons (pparent);
01187   while (psonstmp != (sciSons *) NULL) {   
01188     switch (sciGetEntityType (psonstmp->pointobj)) {  
01189     case SCI_SURFACE:
01190       if (pSURFACE_FEATURE (psonstmp->pointobj)->typeof3d == SCI_PLOT3D) 
01191         N=(pSURFACE_FEATURE (psonstmp->pointobj)->dimzx-1)*(pSURFACE_FEATURE (psonstmp->pointobj)->dimzy-1);
01192       else
01193         N = pSURFACE_FEATURE (psonstmp->pointobj)->dimzy;
01194       break;
01195 
01196     case  SCI_POLYLINE:
01197       {
01198         if ( pPOLYLINE_FEATURE(psonstmp->pointobj)->n1 == 0 )
01199         {
01200           N = 0 ;
01201         }
01202         else if (pPOLYLINE_FEATURE (psonstmp->pointobj)->plot != 5)
01203         {/*polyline*/
01204           N = pPOLYLINE_FEATURE (psonstmp->pointobj)->n1-1;
01205           if ((pPOLYLINE_FEATURE (psonstmp->pointobj)->plot != 2) && 
01206             (sciGetIsMark((sciPointObj *)psonstmp->pointobj) == 1))
01207           {
01208             N = N + 1 ;
01209           }
01210         }
01211         else /* patch */
01212         {
01213           N = 1 ;
01214         }
01215       }
01216       break;
01217     case  SCI_SEGS:
01218       {
01219         sciSegs * ppSegs = pSEGS_FEATURE(psonstmp->pointobj) ;
01220         if ( ppSegs->ptype == 0 )
01221         { 
01222           N = ppSegs->Nbr1 / 2 ;
01223         }
01224         else
01225         {
01226           N = ppSegs->Nbr1 * ppSegs->Nbr2 ;
01227         }
01228       }
01229       break;
01230     case  SCI_RECTANGLE: 
01231       N = 4;
01232       break;
01233     case SCI_AGREG:
01234       N =  Merge3dDimension(psonstmp->pointobj);
01235       break;
01236     default:
01237       N=0;
01238     }
01239     q+=N;
01240     psonstmp = psonstmp->pnext;
01241   }
01242 
01243   return q;
01244 }

Here is the call graph for this function:

Here is the caller graph for this function:

void Nextind ( integer  ind1,
integer ind2,
integer ind3 
)

Nextind

Author:
Djalel Abdemouche 10/2003 Should be in Action.c file

Definition at line 331 of file DrawObjects.c.

Referenced by sciAxesVerticesIndices().

00332 {
00333   *ind2 = ind1+1;
00334   *ind3 = ind1-1;
00335   if (ind1 > 3)
00336     {
00337       if (*ind2 == 8) *ind2 = 4;
00338       if (*ind3 == 3) *ind3 = 7;
00339     }
00340   else
00341     {
00342       if (*ind2 == 4) *ind2 = 0;
00343       if (*ind3 == -1) *ind3 = 3;
00344     }
00345 }

Here is the caller graph for this function:

BOOL sci_update_frame_bounds_2d ( sciPointObj pobj  ) 

Definition at line 603 of file DrawObjects.c.

References sciSubWindow::axes, ComputeNbSubTics(), FALSE, sciSubWindow::FRect, i, sciSubWindow::logflags, AXES::nbsubtics, NULL, AXES::nxgrads, AXES::nygrads, pSUBWIN_FEATURE, sciGetDisplayedBounds(), TheTicks(), AXES::xgrads, and AXES::ygrads.

Referenced by drawSubWinEntity(), update_specification_bounds(), UpdateSubwinScale(), and updateSubWinScale().

00604 {
00605   double xmax, xmin, ymin, ymax, zmin, zmax ;
00606   double hx,hy,hx1,hy1;
00607   int i;
00608   
00609   sciSubWindow * ppsubwin =  pSUBWIN_FEATURE (pobj);
00610   double FRect[4],WRect[4],ARect[4]; 
00611   char logscale[2];
00612   
00613   /* Temp variables only used when called from update_specification_bounds */
00614   /* to know if we have to redraw all the figure */
00615   double ExistingFRect[4]; /* the Existing FRect at start to be compared at the end of this routine */
00616   /* in order to determine wheter or not the bounds have changed... */
00617   int nbsubtics[2];
00618   int nbgrads[2];
00619   /* End of Temp variables */
00620   
00621   for(i=0;i<4;i++) ExistingFRect[i] =  ppsubwin->FRect[i]; /* store old initial bounds*/
00622 
00623   for(i=0;i<2;i++) nbsubtics[i] = ppsubwin->axes.nbsubtics[i];
00624   nbgrads[0] = ppsubwin->axes.nxgrads;
00625   nbgrads[1] = ppsubwin->axes.nygrads;
00626   
00627   /* nbtics on z put to 0 */
00628   /*   ppsubwin->axes.nzgrads = 0; */
00629   
00630 
00631   sciGetDisplayedBounds( pobj, &xmin, &xmax, &ymin, &ymax, &zmin, &zmax ) ;
00632 
00633 
00634   /* _grad Init. to 0. */
00635   for(i=0;i<20;i++) 
00636     {
00637       ppsubwin->axes.xgrads[i] = 0.;
00638       ppsubwin->axes.ygrads[i] = 0.;
00639     }
00640    
00641  
00642   if ( ppsubwin->logflags[0]=='n') { /* x-axis */
00643     TheTicks(&xmin, &xmax, &(ppsubwin->axes.xgrads[0]), &ppsubwin->axes.nxgrads, FALSE); 
00644     ppsubwin->axes.nbsubtics[0] = ComputeNbSubTics(pobj,ppsubwin->axes.nxgrads,'n',NULL,ppsubwin->axes.nbsubtics[0]); /* Nb of subtics computation and storage */ /* F.Leray 07.10.04 */
00645   }
00646   else{ /* log. case */
00647     GradLog(xmin,xmax,ppsubwin->axes.xgrads,&ppsubwin->axes.nxgrads, FALSE );
00648     ppsubwin->axes.nbsubtics[0] = ComputeNbSubTics(pobj,ppsubwin->axes.nxgrads,'l',ppsubwin->axes.xgrads,0);
00649   }
00650    
00651   if ( ppsubwin->logflags[1]=='n') { /* y-axis */
00652     TheTicks(&ymin, &ymax, &(ppsubwin->axes.ygrads[0]), &ppsubwin->axes.nygrads, FALSE);
00653     ppsubwin->axes.nbsubtics[1] = ComputeNbSubTics(pobj,ppsubwin->axes.nygrads,'n',NULL, ppsubwin->axes.nbsubtics[1]); /* Nb of subtics computation and storage */ /* F.Leray 07.10.04 */
00654   }
00655   else{ /* log. case */
00656     GradLog(ymin,ymax,ppsubwin->axes.ygrads,&ppsubwin->axes.nygrads, FALSE );
00657     ppsubwin->axes.nbsubtics[1] = ComputeNbSubTics(pobj,ppsubwin->axes.nygrads,'l',ppsubwin->axes.ygrads,0);
00658   }
00659    
00660   if(ppsubwin->tight_limits == FALSE )
00661     {
00662       xmin = ppsubwin->axes.xgrads[0];
00663       xmax = ppsubwin->axes.xgrads[ ppsubwin->axes.nxgrads - 1];
00664       ymin = ppsubwin->axes.ygrads[0];
00665       ymax = ppsubwin->axes.ygrads[ ppsubwin->axes.nygrads - 1];
00666     }
00667 
00668   /*****************************************************************
00669    * modify  bounds if  isoview requested 
00670    *****************************************************************/
00671   if ( ppsubwin->isoview == TRUE) {      
00672     int verbose=0,wdim[2],narg; 
00673         
00674     C2F(dr)("xget","wdim",&verbose,wdim,&narg, PI0, PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
00675     hx=xmax-xmin;
00676     hy=ymax-ymin;
00677     getscale2d(WRect,FRect,logscale,ARect);
00678     
00679     wdim[0]=linint((double)wdim[0] *WRect[2]);
00680     wdim[1]=linint((double)wdim[1] *WRect[3]);
00681     
00682     if ( hx/(double)wdim[0]  <hy/(double) wdim[1] ) {
00683       hx1=wdim[0]*hy/wdim[1];
00684       xmin=xmin-(hx1-hx)/2.0;
00685       xmax=xmax+(hx1-hx)/2.0;
00686     }
00687     else {
00688       hy1=wdim[1]*hx/wdim[0];
00689       ymin=ymin-(hy1-hy)/2.0;
00690       ymax=ymax+(hy1-hy)/2.0;
00691     }
00692     
00693     /* F.Leray 28.09.04 */
00694     /* I need to recompute the correct xgrads and ygrads vector to have a good display */
00695      
00696     if ( ppsubwin->logflags[0]=='n') { /* x-axis */
00697       TheTicks(&xmin, &xmax, &(ppsubwin->axes.xgrads[0]), &ppsubwin->axes.nxgrads, FALSE);
00698       ppsubwin->axes.nbsubtics[0] = ComputeNbSubTics(pobj,ppsubwin->axes.nxgrads,'n',NULL, ppsubwin->axes.nbsubtics[0]); /* Nb of subtics computation and storage */ /* F.Leray 07.10.04 */
00699     }
00700     else{ /* log. case */
00701       GradLog(xmin,xmax,ppsubwin->axes.xgrads,&ppsubwin->axes.nxgrads, FALSE);
00702       ppsubwin->axes.nbsubtics[0] = ComputeNbSubTics(pobj,ppsubwin->axes.nxgrads,'l',ppsubwin->axes.xgrads,0);
00703     }
00704 
00705  
00706 
00707     if ( ppsubwin->logflags[1]=='n') { /* y-axis */
00708       TheTicks(&ymin, &ymax, &(ppsubwin->axes.ygrads[0]), &ppsubwin->axes.nygrads, FALSE);
00709       ppsubwin->axes.nbsubtics[1] = ComputeNbSubTics(pobj,ppsubwin->axes.nygrads,'n',NULL, ppsubwin->axes.nbsubtics[1]); /* Nb of subtics computation and storage */ /* F.Leray 07.10.04 */
00710     }
00711     else{ /* log. case */
00712       GradLog(ymin,ymax,ppsubwin->axes.ygrads,&ppsubwin->axes.nygrads, FALSE );
00713       ppsubwin->axes.nbsubtics[1] = ComputeNbSubTics(pobj,ppsubwin->axes.nygrads,'l',ppsubwin->axes.ygrads,0);
00714     }
00715    
00716    
00717     /* END ISO if */
00718   }
00719   
00720   /* Changement ci-dessous F.Leray 21.09.04 */
00721   ppsubwin->axes.xlim[0]=xmin;
00722   ppsubwin->axes.xlim[1]=xmax;
00723   ppsubwin->axes.xlim[2]=0;
00724   ppsubwin->axes.ylim[0]=ymin;
00725   ppsubwin->axes.ylim[1]=ymax;
00726   ppsubwin->axes.ylim[2]=0;
00727    
00728    
00729    
00730   /*****************************************************************
00731    * set the actual bounds in subwindow data structure
00732    *****************************************************************/
00733    
00734    
00735   ppsubwin->FRect[0]=xmin;
00736   ppsubwin->FRect[2]=xmax;
00737   ppsubwin->FRect[1]=ymin;
00738   ppsubwin->FRect[3]=ymax;
00739    
00740   ppsubwin->axes.xlim[3] = ppsubwin->axes.nxgrads;
00741   ppsubwin->axes.ylim[3] = ppsubwin->axes.nygrads;
00742    
00743   /*   ppsubwin->axes.reverse[0] = FALSE; /\*TRUE;*\/  /\* TEST en DUR F.Leray ICIIIIIIIIIIIII 12.10.04 *\/ */
00744   /*    ppsubwin->axes.reverse[1] = FALSE; /\*TRUE;*\/  */
00745    
00746    
00747   set_scale("tftftf",NULL,ppsubwin->FRect,NULL,ppsubwin->logflags,NULL); 
00748    
00749    
00750   for(i=0;i<4;i++)
00751     if(ppsubwin->FRect[i] != ExistingFRect[i]){
00752       return TRUE;
00753       break;
00754     } 
00755    
00756   for(i=0;i<2;i++) 
00757     if(nbsubtics[i] != ppsubwin->axes.nbsubtics[i]){
00758       return TRUE;
00759       break;
00760     }
00761    
00762   if(nbgrads[0] != ppsubwin->axes.nxgrads) return TRUE;
00763   if(nbgrads[1] != ppsubwin->axes.nygrads) return TRUE;
00764    
00765   return FALSE;
00766 }

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL sci_update_frame_bounds_3d ( sciPointObj pobj  ) 

update_3dbounds -> renammed sci_update_frame_bounds_3d

Author:
Djalel Abdemouche 10/2003 Should be in Plo2dEch.c file

Definition at line 772 of file DrawObjects.c.

References sciSubWindow::axes, ComputeNbSubTics(), FALSE, sciSubWindow::FRect, i, sciSubWindow::logflags, AXES::nbsubtics, NULL, AXES::nxgrads, AXES::nygrads, AXES::nzgrads, pSUBWIN_FEATURE, sciGetDisplayedBounds(), TheTicks(), AXES::xgrads, AXES::ygrads, and AXES::zgrads.

Referenced by update_specification_bounds(), and updateScale3d().

00773 {
00774   double xmin,xmax,ymin,ymax,zmin,zmax; 
00775   int i;
00776   sciSubWindow * ppsubwin = pSUBWIN_FEATURE (pobj); 
00777 
00778   /* Temp variables only used when called from update_specification_bounds */
00779   /* to know if we have to redraw all the figure */
00780   double ExistingFRect[6]; /* the Existing FRect at start to be compared at the end of this routine */
00781   /* in order to determine wheter or not the bounds have changed... */
00782   int nbsubtics[3];
00783   int nbgrads[3];
00784   /* End of Temp variables */
00785 
00786   for(i=0;i<6;i++) ExistingFRect[i] =  ppsubwin->FRect[i]; /* store old initial bounds*/
00787   
00788   for(i=0;i<3;i++) nbsubtics[i] = ppsubwin->axes.nbsubtics[i];
00789   nbgrads[0] = ppsubwin->axes.nxgrads;
00790   nbgrads[1] = ppsubwin->axes.nygrads;
00791   nbgrads[2] = ppsubwin->axes.nzgrads;
00792 
00793   sciGetDisplayedBounds( pobj, &xmin, &xmax, &ymin, &ymax, &zmin, &zmax ) ;
00794   
00795 
00796   /* _grad Init. to 0. */
00797   for(i=0;i<20;i++) 
00798     {
00799       ppsubwin->axes.xgrads[i] = 0.;
00800       ppsubwin->axes.ygrads[i] = 0.;
00801       ppsubwin->axes.zgrads[i] = 0.;
00802     }
00803    
00804   
00805   if ( ppsubwin->logflags[0]=='n') { /* x-axis */
00806     TheTicks(&xmin, &xmax, &(ppsubwin->axes.xgrads[0]), &ppsubwin->axes.nxgrads, FALSE);
00807     ppsubwin->axes.nbsubtics[0] = ComputeNbSubTics(pobj,ppsubwin->axes.nxgrads,'n',NULL,ppsubwin->axes.nbsubtics[0]); /* Nb of subtics computation and storage */
00808   }
00809   else{ /* log. case */
00810     GradLog(xmin,xmax,ppsubwin->axes.xgrads,&ppsubwin->axes.nxgrads, FALSE );
00811     ppsubwin->axes.nbsubtics[0] = ComputeNbSubTics(pobj,ppsubwin->axes.nxgrads,'l',ppsubwin->axes.xgrads,0);
00812   }
00813   
00814   if ( ppsubwin->logflags[1]=='n') { /* y-axis */
00815     TheTicks(&ymin, &ymax, &(ppsubwin->axes.ygrads[0]), &ppsubwin->axes.nygrads, FALSE);
00816     ppsubwin->axes.nbsubtics[1] = ComputeNbSubTics(pobj,ppsubwin->axes.nygrads,'n',NULL, ppsubwin->axes.nbsubtics[1]); /* Nb of subtics computation and storage */
00817   }
00818   else{ /* log. case */
00819     GradLog(ymin,ymax,ppsubwin->axes.ygrads,&ppsubwin->axes.nygrads, FALSE );
00820     ppsubwin->axes.nbsubtics[1] = ComputeNbSubTics(pobj,ppsubwin->axes.nygrads,'l',ppsubwin->axes.ygrads,0);
00821   }
00822   
00823   if ( ppsubwin->logflags[2]=='n') { /* z-axis */
00824     TheTicks(&zmin, &zmax, &(ppsubwin->axes.zgrads[0]), &ppsubwin->axes.nzgrads, FALSE);
00825     ppsubwin->axes.nbsubtics[2] = ComputeNbSubTics(pobj,ppsubwin->axes.nzgrads,'n',NULL, ppsubwin->axes.nbsubtics[2]); /* Nb of subtics computation and storage */
00826   }
00827   else{ /* log. case */
00828     GradLog(zmin,zmax,ppsubwin->axes.zgrads,&ppsubwin->axes.nzgrads, FALSE );
00829     ppsubwin->axes.nbsubtics[2] = ComputeNbSubTics(pobj,ppsubwin->axes.nzgrads,'l',ppsubwin->axes.zgrads,0);
00830   }
00831   
00832   if(ppsubwin->tight_limits == FALSE )
00833     {
00834       xmin = ppsubwin->axes.xgrads[0];
00835       xmax = ppsubwin->axes.xgrads[ ppsubwin->axes.nxgrads - 1];
00836       ymin = ppsubwin->axes.ygrads[0];
00837       ymax = ppsubwin->axes.ygrads[ ppsubwin->axes.nygrads - 1];
00838       zmin = ppsubwin->axes.zgrads[0];
00839       zmax = ppsubwin->axes.zgrads[ ppsubwin->axes.nzgrads - 1];
00840     }
00841 
00842   ppsubwin->axes.xlim[0]=xmin;
00843   ppsubwin->axes.xlim[1]=xmax;
00844   ppsubwin->axes.xlim[2]=0;
00845   ppsubwin->axes.ylim[0]=ymin;
00846   ppsubwin->axes.ylim[1]=ymax;
00847   ppsubwin->axes.ylim[2]=0;
00848   ppsubwin->axes.zlim[0]=zmin; /* rajout pour z */
00849   ppsubwin->axes.zlim[1]=zmax;
00850   ppsubwin->axes.zlim[2]=0;
00851      
00852   ppsubwin->FRect[0]=xmin;
00853   ppsubwin->FRect[2]=xmax;
00854   ppsubwin->FRect[1]=ymin;
00855   ppsubwin->FRect[3]=ymax;
00856   ppsubwin->FRect[4]=zmin;
00857   ppsubwin->FRect[5]=zmax;
00858     
00859   ppsubwin->axes.xlim[3] = ppsubwin->axes.nxgrads;
00860   ppsubwin->axes.ylim[3] = ppsubwin->axes.nygrads;
00861   ppsubwin->axes.zlim[3] = ppsubwin->axes.nzgrads;
00862    
00863   set_scale("tftftf",NULL,ppsubwin->FRect,NULL,ppsubwin->logflags,NULL); 
00864     
00865   for(i=0;i<6;i++)
00866     if(ppsubwin->FRect[i] != ExistingFRect[i]){
00867       return TRUE;
00868       break;
00869     } 
00870     
00871   for(i=0;i<3;i++) 
00872     if(nbsubtics[i] != ppsubwin->axes.nbsubtics[i]){
00873       return TRUE;
00874       break;
00875     }
00876   
00877   if(nbgrads[0] != ppsubwin->axes.nxgrads) return TRUE;
00878   if(nbgrads[1] != ppsubwin->axes.nygrads) return TRUE;
00879   if(nbgrads[2] != ppsubwin->axes.nzgrads) return TRUE;
00880   
00881   return FALSE;  
00882 }

Here is the call graph for this function:

Here is the caller graph for this function:

void sciAxesVerticesIndices ( integer  insideU[4],
integer  insideD[4],
double  xbox[8],
double  ybox[8],
integer  xind[8] 
)

Definition at line 2787 of file DrawObjects.c.

References i, ind, Maxi(), MaxiInd(), Nextind(), and sciprint().

Referenced by axis_3ddraw(), and ComputeCorrectXindAndInsideUD().

02792 {
02793   int    i      ;
02794   int    ind    ;
02795   int    ind2   ;
02796   int    ind3   ;
02797   double xmaxi  ;
02798   int    tmpind ;
02799 
02800   /* F.Leray 23.02.04 Mise a 0 du tableau xind pour corriger bug*/
02801   /* dans le cas ind < 3 ET ybox[tmpind] < ybox[tmpind]*/
02802   for( i = 0 ; i < 8 ; i++ )
02803   { 
02804     xind[i] = 0 ;
02805   }
02806 
02807   /* indices */
02808   /* determine the indices for the 3d represention */
02809   xmaxi = ( (double) Maxi(xbox,8L) ) ;
02810   ind = -1 ;
02811   MaxiInd( xbox, 8L, &ind, xmaxi ) ;
02812   if ( ind > 3 )
02813   {
02814     xind[0]=ind;
02815   }
02816   tmpind = ind ;  
02817   MaxiInd(xbox,8L,&ind,xmaxi);
02818   if ( ind > 3 )
02819   {
02820     xind[0] = ind ;
02821   }
02822   if (ybox[tmpind] > ybox[ind] )
02823   {
02824     xind[0] = tmpind ;
02825   }
02826   
02827   if (ind < 0 || ind > 8) 
02828   {
02829     sciprint("xind out of bounds");
02830     xind[0]=0;
02831   }
02832   Nextind(xind[0],&ind2,&ind3);
02833   if (ybox[ind2] > ybox[ind3]) 
02834   {
02835     xind[1]=ind2;insideU[0]=ind3;
02836   }
02837   else 
02838   {
02839     xind[1]=ind3;insideU[0]=ind2;
02840   }
02841   Nextind(ind2,&ind2,&ind3); insideU[1]=xind[0];
02842   insideU[2]=ind2; 
02843   if ( insideU[0] > 3 )
02844   {
02845     insideU[3] = insideU[0] - 4 ;
02846   }
02847   else
02848   {
02849     insideU[3] = insideU[0] + 4 ;
02850   }
02851   xind[2]=ind2;
02852   /* le pointeger en bas qui correspond */        
02853   if ( ind2 > 3 )
02854   {
02855     xind[3] = ind2 - 4 ;
02856   }
02857   else
02858   {
02859     xind[3] = ind2 + 4 ;
02860   }
02861   Nextind(xind[3],&ind2,&ind3);
02862   if (ybox[ind2] < ybox[ind3]) 
02863   {
02864     xind[4]=ind2;insideD[0]=ind3;
02865   }
02866   else  
02867   {
02868     xind[4]=ind3;insideD[0]=ind2;
02869   }
02870   Nextind(ind2,&ind2,&ind3);
02871   insideD[1]=xind[3];
02872   insideD[2]=ind2;
02873   if ( insideD[0] > 3 )
02874   {
02875     insideD[3]=insideD[0] - 4 ;
02876   }
02877   else
02878   {
02879     insideD[3]=insideD[0] + 4 ;
02880   }
02881   xind[5]=ind2;
02882          
02883 }

Here is the call graph for this function:

Here is the caller graph for this function:

void sciDrawFigure ( int  numFigure  ) 

draw the figure number numFigure.

Definition at line 1403 of file DrawObjects.c.

References sciDrawObj(), sciGetCurrentFigure(), sciGetNumFigure(), and sciSetUsedWindow().

01404 {
01405   int curFigure = sciGetNumFigure( sciGetCurrentFigure() ) ;
01406   sciSetUsedWindow( numFigure ) ;
01407   sciDrawObj( sciGetCurrentFigure() ) ;
01408   sciSetUsedWindow( curFigure ) ;
01409 }

Here is the call graph for this function:

int sciDrawObj ( sciPointObj pobj  ) 

sciDrawObj Draws Object (only the basic graphicobject under subwindows) in its SubWindow or figure

Parameters:
sciPointObj * pobj: the pointer to the entity
Returns:
int 0 if OK, -1 if not

Definition at line 1475 of file DrawObjects.c.

References drawArcEntity(), drawAxesEntity(), drawCompoundEntity(), drawFecEntity(), drawFigureEntity(), drawGrayplotEntity(), drawLegendEntity(), drawMergeEntity(), drawPolylineEntity(), drawRectangleEntity(), drawSegsEntity(), drawSubWinEntity(), drawSurfaceEntity(), drawTextEntity(), GetDriverId(), isGraphicSessionOpened(), SCI_AGREG, SCI_ARC, SCI_AXES, SCI_FEC, SCI_FIGURE, SCI_GRAYPLOT, SCI_LEGEND, SCI_LIGHT, SCI_MENU, SCI_MENUCONTEXT, SCI_MERGE, SCI_PANNER, SCI_POLYLINE, SCI_RECTANGLE, SCI_SBH, SCI_SBV, SCI_SEGS, SCI_STATUSB, SCI_SUBWIN, SCI_SURFACE, SCI_TEXT, and sciGetEntityType().

Referenced by champg(), drawCompoundEntity(), drawFigureEntity(), drawSubWinEntity(), fec(), Objplot3d(), plot2dn(), sci_copy(), sci_delete(), sci_draw(), sci_drawnow(), sci_set(), sci_xend(), sci_xfpoly(), sci_xfpolys(), sci_xgrid(), sci_xpoly(), sci_xpolys(), sci_xrect(), sci_xrects(), sci_xsegs(), sciDrawFigure(), sciDrawObjIfRequired(), scig_toPs(), sciInitdrawmode(), sciRedrawF(), sciRedrawFigure(), sciRelocateHandles(), sciXbasc(), sciXclear(), swapHandles(), unzoom(), unzoom_one_axes(), xgray(), xgray1(), xgray2(), and zoom_box().

01476 {
01477  
01478   
01479   /* driver test */  
01480   if((GetDriverId() != 0) && ( isGraphicSessionOpened() )){
01481     return -1;
01482   }
01483 
01484   switch (sciGetEntityType (pobj))
01485     {
01486     case SCI_FIGURE:
01487       return drawFigureEntity( pobj ) ;
01488       break;
01489     case SCI_SUBWIN:
01490       return drawSubWinEntity( pobj ) ;
01491       break ;
01492     case SCI_AGREG:
01493       return drawCompoundEntity( pobj ) ;
01494       break;
01495     case SCI_LEGEND:
01496       return drawLegendEntity( pobj ) ;
01497       break;   
01498     case SCI_FEC:
01499       return drawFecEntity( pobj ) ;
01500       break;      
01501     case SCI_SEGS:
01502       return drawSegsEntity( pobj ) ;
01503       break;
01504     case SCI_GRAYPLOT:
01505       return drawGrayplotEntity( pobj ) ;
01506       break;
01507     case SCI_POLYLINE:   
01508       return drawPolylineEntity( pobj ) ;
01509       break;
01510     case SCI_ARC:
01511       return drawArcEntity( pobj ) ;
01512       break;
01513     case SCI_RECTANGLE:
01514       return drawRectangleEntity( pobj ) ;
01515       break;
01516     case SCI_TEXT:
01517       return drawTextEntity( pobj ) ;
01518       break;
01519     case SCI_AXES:
01520       return drawAxesEntity(pobj) ;
01521       break;
01522     case SCI_MERGE:
01523       return drawMergeEntity(pobj) ;
01524       break ;
01525     case SCI_SURFACE:
01526       return drawSurfaceEntity(pobj) ;
01527       break;
01528     case SCI_LIGHT:
01529     case SCI_PANNER:
01530     case SCI_SBH:
01531     case SCI_SBV:
01532     case SCI_MENU:
01533     case SCI_MENUCONTEXT:
01534     case SCI_STATUSB:
01535     default:
01536       return -1;
01537       break;
01538     }
01539   /*sciSetSelectedSubWin (curSubWin);*/
01540   return -1;
01541 }

Here is the call graph for this function:

Here is the caller graph for this function:

int sciDrawObjIfRequired ( sciPointObj pobj  ) 

sciDrawObjIfRequired Draws Object (only the basic graphicobject under subwindows) in its SubWindow or figure if and only if pFIGURE_FEATURE(pobj)->auto_redraw == TRUE !! Only used inside High Level functions calls (sucha as plot2d, plot3d...)

Parameters:
sciPointObj * pobj: the pointer to the entity
Returns:
int 0 if OK, -1 if not

Definition at line 1457 of file DrawObjects.c.

References pFIGURE_FEATURE, sciDrawObj(), and sciGetParentFigure().

Referenced by champg(), fec(), Objarc(), Objdrawaxis(), Objfpoly(), Objpoly(), Objrect(), Objsegs(), Objstring(), Objtitle(), plot2dn(), sci_xfpoly(), sci_xfpolys(), sci_xpoly(), sci_xpolys(), sci_xrect(), sci_xrects(), sci_xsegs(), sciRefreshObj(), xgray(), xgray1(), and xgray2().

01458 {
01459   sciPointObj * pfigure = sciGetParentFigure(pobj);
01460 
01461   if( pFIGURE_FEATURE(pfigure)->auto_redraw && pFIGURE_FEATURE(pfigure)->visible )
01462   {
01463     sciDrawObj(pobj);
01464   }
01465 
01466   return 0;
01467 }

Here is the call graph for this function:

Here is the caller graph for this function:

void sciGetAxisBox ( double  limits[6],
double  xbox[8],
double  ybox[8],
double  zbox[8] 
)

Definition at line 2725 of file DrawObjects.c.

References TRX, TRY, and TRZ.

Referenced by ComputeCorrectXindAndInsideUD(), and updateScale3d().

02726 {
02727   xbox[0]=TRX(limits[0],limits[2],limits[4]); /* transfo. 3D of [xmin,ymin,zmin] */
02728   ybox[0]=TRY(limits[0],limits[2],limits[4]); /* into [xbox[0],ybox[0],zbox[0] ] */
02729   zbox[0]=TRZ(limits[0],limits[2],limits[4]); /*                                 */ 
02730   
02731   xbox[1]=TRX(limits[0],limits[3],limits[4]); /* transfo. 3D of [xmin,ymax,zmin] */
02732   ybox[1]=TRY(limits[0],limits[3],limits[4]); /* into [xbox[1],ybox[1],zbox[1] ] */
02733   zbox[1]=TRZ(limits[0],limits[3],limits[4]); /*                                 */
02734   
02735   xbox[2]=TRX(limits[1],limits[3],limits[4]); /* transfo. 3D of [xmax,ymax,zmin] */
02736   ybox[2]=TRY(limits[1],limits[3],limits[4]); /* into [xbox[2],ybox[2],zbox[2] ] */
02737   zbox[2]=TRZ(limits[1],limits[3],limits[4]); /*                                 */
02738   
02739   xbox[3]=TRX(limits[1],limits[2],limits[4]); /* transfo. 3D of [xmax,ymin,zmin] */
02740   ybox[3]=TRY(limits[1],limits[2],limits[4]); /* into [xbox[3],ybox[3],zbox[3] ] */
02741   zbox[3]=TRZ(limits[1],limits[2],limits[4]); /*                                 */
02742   
02743   xbox[4]=TRX(limits[0],limits[2],limits[5]); /* transfo. 3D of [xmin,ymin,zmax] */
02744   ybox[4]=TRY(limits[0],limits[2],limits[5]); /* into [xbox[4],ybox[4],zbox[4] ] */
02745   zbox[4]=TRZ(limits[0],limits[2],limits[5]); /*                                 */
02746   
02747   xbox[5]=TRX(limits[0],limits[3],limits[5]); /* transfo. 3D of [xmin,ymax,zmax] */
02748   ybox[5]=TRY(limits[0],limits[3],limits[5]); /* into [xbox[5],ybox[5],zbox[5] ] */
02749   zbox[5]=TRZ(limits[0],limits[3],limits[5]); /*                                 */
02750   
02751   xbox[6]=TRX(limits[1],limits[3],limits[5]); /* transfo. 3D of [xmax,ymax,zmax] */
02752   ybox[6]=TRY(limits[1],limits[3],limits[5]); /* into [xbox[6],ybox[6],zbox[6] ] */
02753   zbox[6]=TRZ(limits[1],limits[3],limits[5]); /*                                 */
02754   
02755   xbox[7]=TRX(limits[1],limits[2],limits[5]); /* transfo. 3D of [xmax,ymin,zmax] */
02756   ybox[7]=TRY(limits[1],limits[2],limits[5]); /* into [xbox[7],ybox[7],zbox[7] ] */
02757   zbox[7]=TRZ(limits[1],limits[2],limits[5]); /*                                 */
02758 }

Here is the caller graph for this function:

void sciGetDisplayedBounds ( sciPointObj pSubWin,
double *  xmin,
double *  xmax,
double *  ymin,
double *  ymax,
double *  zmin,
double *  zmax 
)

Definition at line 531 of file DrawObjects.c.

References sciSubWindow::logflags, pSUBWIN_FEATURE, sciGetLogExponent(), sciGetZooming(), sciprint(), sciSubWindow::SRect, and sciSubWindow::ZRect.

Referenced by sci_update_frame_bounds_2d(), sci_update_frame_bounds_3d(), updateXaxesTics(), and updateYaxesTics().

00538 {
00539   sciSubWindow * ppsubwin =  pSUBWIN_FEATURE ( pSubWin ) ;
00540     /*****************************************************************
00541      * get initial bounds
00542    *****************************************************************/
00543   if( sciGetZooming( pSubWin ) )
00544   {
00545     *xmin = ppsubwin->ZRect[0] ; 
00546     *ymin = ppsubwin->ZRect[1] ; 
00547     *xmax = ppsubwin->ZRect[2] ;
00548     *ymax = ppsubwin->ZRect[3] ;
00549     *zmin = ppsubwin->ZRect[4] ;
00550     *zmax = ppsubwin->ZRect[5] ;
00551   }
00552   else
00553   {
00554     *xmin = ppsubwin->SRect[0] ;
00555     *ymin = ppsubwin->SRect[2] ;
00556     *xmax = ppsubwin->SRect[1] ;
00557     *ymax = ppsubwin->SRect[3] ;
00558     *zmin = ppsubwin->SRect[4] ;
00559     *zmax = ppsubwin->SRect[5] ;
00560   }
00561   
00562   
00563    
00564   /*****************************************************************
00565    * modify  bounds and aaint  if using log scaling X axis
00566    *****************************************************************/
00567   if ( ppsubwin->logflags[0] == 'l' )
00568   {
00569     if ( sciGetLogExponent( *xmin, *xmax, xmin, xmax ) != 0 )
00570     {
00571       sciprint("Warning: Can't use Log on X-axis xmin is negative. \n");
00572     }
00573   }
00574 
00575   /*****************************************************************
00576    * modify  bounds and aaint  if using log scaling Y axis
00577    *****************************************************************/
00578   if ( ppsubwin->logflags[1] == 'l' )
00579   {
00580     if ( sciGetLogExponent( *ymin, *ymax, ymin, ymax ) != 0 )
00581     {
00582       sciprint("Warning: Can't use Log on Y-axis ymin is negative. \n");
00583     }
00584   }
00585 
00586   /*****************************************************************
00587    * modify  bounds and aaint  if using log scaling Z axis
00588    *****************************************************************/
00589   if ( ppsubwin->logflags[2] == 'l' )
00590   {
00591     if ( sciGetLogExponent( *zmin, *zmax, zmin, zmax ) != 0 )
00592     {
00593       sciprint("Warning: Can't use Log on Z-axis zmin is negative. \n");
00594     }
00595   }
00596 
00597 }

Here is the call graph for this function:

Here is the caller graph for this function:

void sciRedrawF ( int num  ) 

Definition at line 120 of file DrawObjects.c.

References C2F, cur, dr(), L, na, NULL, PD0, PI0, sciDrawObj(), and sciIsExistingFigure().

Referenced by scig_replay_hdc().

00122 { 
00123   sciPointObj *figure; 
00124   integer cur,na,verb=0;
00125   figure= (sciPointObj *) sciIsExistingFigure(value); 
00126   /* F.Leray 13.04.04 : Test if returned sciPointObj* is NULL (means Figure has been destroyed) */
00127 
00128   if(figure == (sciPointObj *)  NULL)
00129     {
00130       /* Do nothing */
00131     }
00132   else
00133     {
00134       C2F (dr) ("xget", "window",&verb,&cur,&na,PI0,PI0,PI0,PD0,PD0,PD0,PD0,4L,6L);
00135       C2F (dr) ("xset", "window",value,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,4L,6L);
00136       sciDrawObj (figure);
00137       C2F (dr) ("xset", "window",&cur,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,4L,6L);
00138     }
00139 }

Here is the call graph for this function:

Here is the caller graph for this function:

void sciRedrawFigure ( void   ) 

Definition at line 115 of file DrawObjects.c.

References sciDrawObj(), and sciGetCurrentFigure().

Referenced by I3dRotation(), sci_xset(), sci_xtitle(), scig_expose(), scig_replay(), and scig_resize().

00116 {
00117   sciDrawObj (sciGetCurrentFigure ());
00118 }

Here is the call graph for this function:

Here is the caller graph for this function:

int sciRefreshObj ( sciPointObj pobj  ) 

Definition at line 1416 of file DrawObjects.c.

References C2F, dr(), sciDrawObjIfRequired(), sciGetNum(), and sciGetParentFigure().

Referenced by Objmove().

01417 {
01418   
01419   int parentId = sciGetNum( sciGetParentFigure( pobj ) ) ;
01420   int currentId             ;
01421   int status                ;
01422   int verboseGet        = 0 ;
01423   int iDontKnowWhatItIs     ;
01424   /* get current Id in ScilabXgc */
01425   C2F (dr) ("xget", "window",&verboseGet,&currentId,&iDontKnowWhatItIs,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
01426 
01427   /* set the parent figure of the object as the current figure */
01428   if ( parentId != currentId )
01429   {
01430     C2F (dr) ("xset", "window",&parentId,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
01431   }
01432   
01433   /* draw the object */
01434   status = sciDrawObjIfRequired( pobj ) ;
01435 
01436   /* set back the values */
01437   if ( parentId != currentId )
01438   {
01439     C2F (dr) ("xset", "window",&currentId,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
01440   }
01441 
01442   return status ;
01443   
01444   
01445 }

Here is the call graph for this function:

Here is the caller graph for this function:

void sciUpdateScaleAngles ( double  theta,
double  alpha 
)

Definition at line 2761 of file DrawObjects.c.

References cost, Cscale, DEG2RAD, wcscalelist::m, and sint.

Referenced by ComputeCorrectXindAndInsideUD(), drawSubWinEntity(), and updateScale3d().

02762 {
02763   double cost = 0.5 ;
02764   double sint = 0.5 ;
02765   double cosa = 0.5 ;
02766   double sina = 0.5 ;
02767 
02768   cost = cos( DEG2RAD(theta) ) ;
02769   cosa = cos( DEG2RAD(alpha) ) ;
02770   sint = sin( DEG2RAD(theta) ) ;
02771   sina = sin( DEG2RAD(alpha) ) ;
02772   
02773   Cscale.m[0][0]= -sint        ;
02774   Cscale.m[0][1]=  cost        ;
02775   Cscale.m[0][2]=  0           ;
02776   Cscale.m[1][0]= -cost * cosa ;
02777   Cscale.m[1][1]= -sint * cosa ;
02778   Cscale.m[1][2]=  sina        ;
02779   Cscale.m[2][0]=  cost * sina ;
02780   Cscale.m[2][1]=  sint * sina ;
02781   Cscale.m[2][2]=  cosa        ;
02782 
02783 }

Here is the caller graph for this function:

void sciXbasc ( void   ) 

Definition at line 141 of file DrawObjects.c.

References ConstructSubWin(), DestroyAllGraphicsSons(), BCG::mafigure, NULL, sciDrawObj(), sciGetCurrentFigure(), sciSetCurrentObj(), and sciSetOriginalSubWin().

Referenced by sci_delete(), sci_xset(), sciDelGraphicObj(), and scig_erase().

00142 {  
00143   static sciPointObj *mafigure;
00144   static sciPointObj *masousfen;  
00145  
00146   mafigure= (sciPointObj *) sciGetCurrentFigure(); 
00147   DestroyAllGraphicsSons((sciPointObj *)mafigure);
00148   
00149    
00150   if ((masousfen = ConstructSubWin (mafigure, 'o')) != NULL){
00151     sciSetCurrentObj(masousfen);
00152     sciSetOriginalSubWin (mafigure, masousfen);}
00153   sciDrawObj(sciGetCurrentFigure ());      
00154 }       

Here is the call graph for this function:

Here is the caller graph for this function:

void sciXclear ( void   ) 

Definition at line 156 of file DrawObjects.c.

References FALSE, NULL, tagSons::pnext, tagSons::pointobj, SCI_SUBWIN, sciDrawObj(), sciGetCurrentFigure(), sciGetCurrentSubWin(), sciGetEntityType(), sciGetSons(), sciSetdrawmode(), and sciSetSelectedSubWin().

Referenced by sci_xclear().

00157 {
00158   static sciPointObj *masousfen, *tmpsousfen;
00159   sciSons *psonstmp; 
00160      
00161   tmpsousfen= sciGetCurrentSubWin();
00162   psonstmp = sciGetSons (sciGetCurrentFigure());
00163   
00164   while (psonstmp != (sciSons *) NULL)  
00165     {  
00166       if(sciGetEntityType (psonstmp->pointobj) == SCI_SUBWIN)
00167         {
00168           masousfen= (sciPointObj *)psonstmp->pointobj;
00169           sciSetSelectedSubWin (masousfen);
00170           sciSetdrawmode (FALSE); 
00171         }
00172       psonstmp = psonstmp->pnext;
00173     }
00174   sciSetSelectedSubWin (tmpsousfen);
00175   sciDrawObj(sciGetCurrentFigure ());      
00176 }

Here is the call graph for this function:

Here is the caller graph for this function:

void set_cf_type ( int  val  ) 

Definition at line 28 of file CurrentObjectsManagement.c.

00029 {
00030   cf_type = val ;
00031 }

void SetEch3d1 ( double *  xbox,
double *  ybox,
double *  zbox,
double *  bbox,
double *  teta,
double *  alpha,
integer  flag 
)

Definition at line 128 of file Plo3d.c.

References Alpha, wcscalelist::alpha, wcscalelist::bbox1, C2F, cost, Cscale, dr(), dx, dy, getscale2d(), hmax, ib, L, linint, wcscalelist::m, M_PI, Maxi(), wcscalelist::metric3d, Mini(), NULL, PD0, PI0, R, set_scale(), sint, wcscalelist::theta, TRX, TRY, and TRZ.

00129 {
00130   double xmmin,ymmax,xmmax,ymmin,FRect[4],WRect[4],ARect[4];
00131   integer ib;
00132   static integer aaint[]={2,10,2,10};
00133   int verbose=0,wdim[2],narg_;
00134   char logf_[2];
00135   double R,xo,yo,zo,dx,dy,dz,hx,hy,hx1,hy1,Teta,Alpha;
00136   integer wmax,hmax;
00137   static double cost=0.5,sint=0.5,cosa=0.5,sina=0.5;
00138   Teta=*teta;
00139   Alpha=*alpha;
00140   /*  if (flag==0) {
00141       Alpha=Cscale.alpha;
00142       Teta=Cscale.theta;
00143       }
00144       else {
00145       Cscale.alpha = Alpha;
00146       Cscale.theta = Teta;
00147       }*/
00148   Cscale.alpha = Alpha;
00149   Cscale.theta = Teta;
00150   cost=cos((Teta)*M_PI/180.0);
00151   sint=sin((Teta)*M_PI/180.0);
00152   cosa=cos((Alpha)*M_PI/180.0);
00153   sina=sin((Alpha)*M_PI/180.0);
00154   Cscale.m[0][0]= -sint    ;    Cscale.m[0][1]= cost      ;    Cscale.m[0][2]= 0;
00155   Cscale.m[1][0]= -cost*cosa;   Cscale.m[1][1]= -sint*cosa;    Cscale.m[1][2]= sina;
00156   Cscale.m[2][0]=  cost*sina;   Cscale.m[2][1]= sint*sina;     Cscale.m[2][2]= cosa;
00157   /* Coordonn\'ees apr\`es transformation g\'eometrique de la
00158    * boite qui entoure le plot3d                            
00159    * le plan de projection est defini par x et y            
00160    */
00161   for (ib=0;ib<6 ;ib++) 
00162     { 
00163       if (flag==0) 
00164         bbox[ib]=Cscale.bbox1[ib];
00165       else 
00166         Cscale.bbox1[ib]=bbox[ib];
00167     }
00168   xbox[0]=TRX(bbox[0],bbox[2],bbox[4]);
00169   ybox[0]=TRY(bbox[0],bbox[2],bbox[4]);
00170   zbox[0]=TRZ(bbox[0],bbox[2],bbox[4]);
00171   xbox[1]=TRX(bbox[0],bbox[3],bbox[4]);
00172   ybox[1]=TRY(bbox[0],bbox[3],bbox[4]);
00173   zbox[1]=TRZ(bbox[0],bbox[3],bbox[4]);
00174   xbox[2]=TRX(bbox[1],bbox[3],bbox[4]);
00175   ybox[2]=TRY(bbox[1],bbox[3],bbox[4]);
00176   zbox[2]=TRZ(bbox[1],bbox[3],bbox[4]);
00177   xbox[3]=TRX(bbox[1],bbox[2],bbox[4]);
00178   ybox[3]=TRY(bbox[1],bbox[2],bbox[4]);
00179   zbox[3]=TRZ(bbox[1],bbox[2],bbox[4]);
00180   xbox[4]=TRX(bbox[0],bbox[2],bbox[5]);
00181   ybox[4]=TRY(bbox[0],bbox[2],bbox[5]);
00182   zbox[4]=TRZ(bbox[0],bbox[2],bbox[5]);
00183   xbox[5]=TRX(bbox[0],bbox[3],bbox[5]);
00184   ybox[5]=TRY(bbox[0],bbox[3],bbox[5]);
00185   zbox[5]=TRZ(bbox[0],bbox[3],bbox[5]);
00186   xbox[6]=TRX(bbox[1],bbox[3],bbox[5]);
00187   ybox[6]=TRY(bbox[1],bbox[3],bbox[5]);
00188   zbox[6]=TRZ(bbox[1],bbox[3],bbox[5]);
00189   xbox[7]=TRX(bbox[1],bbox[2],bbox[5]);
00190   ybox[7]=TRY(bbox[1],bbox[2],bbox[5]);
00191   zbox[7]=TRZ(bbox[1],bbox[2],bbox[5]);
00193   if ( flag == 1 || flag == 3 )
00194     {
00195       xmmin=  (double) Mini(xbox,8L);xmmax= (double) Maxi(xbox,8L);
00196       ymmax=  (double) - Mini(ybox,8L);
00197       ymmin=  (double) - Maxi(ybox,8L);
00198     }
00199   /* code added by es: isoview scaling */
00200   if ( flag == 2 || flag == 3 )
00201     {
00202       /* get current window size */
00203       C2F(dr)("xget","wdim",&verbose,wdim,&narg_, PI0,PI0,PI0,
00204               PD0,PD0,PD0,PD0,0L,0L);
00205       getscale2d(WRect,FRect,logf_,ARect);
00206       wmax=linint((double)wdim[0] * WRect[2]);
00207       hmax=linint((double)wdim[1] * WRect[3]); 
00208     }
00209   if ( flag == 2 )
00210     {
00211       /* radius and center of the sphere circumscribing the box */
00212       dx=bbox[1]-bbox[0]; dy=bbox[3]-bbox[2]; dz=bbox[5]-bbox[4];
00213       R= (double) sqrt(dx*dx + dy*dy + dz*dz)/2;
00214       xo= (double) (xbox[0]+xbox[6])/2 ;
00215       yo= (double) (ybox[0]+ybox[6])/2 ;
00216       zo= (double) (zbox[0]+zbox[6])/2 ;
00217       xmmin=  (double) xo - R ;
00218       xmmax=  (double) xo + R ;
00219       ymmax=  (double) -yo + R ;
00220       ymmin=  (double) -yo - R ;
00221     }
00222   if (flag==2 || flag==3)
00223     {
00224       /* adjust limits (code adapted from Plo2d.c & Stephane's patch) */
00225       hx=xmmax-xmmin;
00226       hy=ymmax-ymmin;
00227       if ( hx/(double)wmax  < hy/(double)hmax ) 
00228         {
00229           hx1=wmax*hy/hmax;
00230           xmmin=xmmin-(hx1-hx)/2.0;
00231           xmmax=xmmax+(hx1-hx)/2.0;
00232         }
00233       else 
00234         {
00235           hy1=hmax*hx/wmax;
00236           ymmin=ymmin-(hy1-hy)/2.0;
00237           ymmax=ymmax+(hy1-hy)/2.0;
00238         }
00239     }
00240   if (flag !=0 )
00241     {
00242       FRect[0]=xmmin;FRect[1]= -ymmax;FRect[2]=xmmax;FRect[3]= -ymmin;
00243       set_scale("tftttf",NULL,FRect,aaint,"nn",NULL);
00244       Cscale.metric3d=flag; /* the metric mode is stored into the
00245                              * List of Scales */
00246     }
00247   /* end of code added by es */
00248 }

Here is the call graph for this function:

void updateScale3d ( sciPointObj pobj,
double  dbox[6],
double  xbox[8],
double  ybox[8],
double  zbox[8] 
)

Definition at line 179 of file DrawObjects.c.

References wcscalelist::alpha, sciSubWindow::alpha, sciSubWindow::axes, wcscalelist::bbox1, C2F, Cscale, sciSubWindow::cube_scaling, dr(), dx, dy, AXES::flag, sciSubWindow::FRect, getscale2d(), hmax, i, L, linint, Maxi(), wcscalelist::metric3d, Mini(), NULL, PD0, PI0, pSUBWIN_FEATURE, R, sci_update_frame_bounds_3d(), sciGetAxisBox(), sciUpdateScaleAngles(), set_scale(), wcscalelist::theta, and sciSubWindow::theta.

Referenced by axis_3ddraw(), and updateSubWinScale().

00184 {
00185   int    flag     ;
00186   int    i        ;
00187   double xmmin    ;
00188   double xmmax    ;
00189   double ymmin    ;
00190   double ymmax    ;
00191   double wmax     ;
00192   double hmax     ;
00193   integer aaint[] = {2,10,2,10} ;
00194   sciSubWindow * ppsubwin =  pSUBWIN_FEATURE (pobj);
00195 
00196   sci_update_frame_bounds_3d( pobj ) ;
00197        
00198   dbox[0] =  ppsubwin->FRect[0] ; /*xmin*/
00199   dbox[1] =  ppsubwin->FRect[2] ; /*xmax*/
00200   dbox[2] =  ppsubwin->FRect[1] ; /*ymin*/
00201   dbox[3] =  ppsubwin->FRect[3] ; /*ymax*/
00202   dbox[4] =  ppsubwin->FRect[4] ; /*zmin*/
00203   dbox[5] =  ppsubwin->FRect[5] ; /*zmax*/
00204 
00205   if( ppsubwin->cube_scaling )
00206   {
00207     dbox[0] =  0.; 
00208     dbox[1] =  1.;
00209     dbox[2] =  0.;
00210     dbox[3] =  1.;
00211     dbox[4] =  0.;
00212     dbox[5] =  1.;
00213   }
00214 
00215 
00217   flag = ( ppsubwin->axes.flag[1] + 1 ) / 2 ; /* F.Leray Adding HERE 19.04.04 */
00218 
00219   Cscale.alpha = ppsubwin->alpha ;
00220   Cscale.theta = ppsubwin->theta ;
00221       
00222   /* update Cscale.m from the new viewing angles */
00223   sciUpdateScaleAngles( ppsubwin->theta, ppsubwin->alpha ) ;
00224       
00225   for ( i = 0 ; i < 6 ; i++ ) 
00226   { 
00227     if ( flag == 0 )
00228     { 
00229       dbox[i] = Cscale.bbox1[i];
00230     }
00231     else
00232     { 
00233       Cscale.bbox1[i] = dbox[i];
00234     }
00235   }
00236 
00237   /* get the vertices of the axes box */
00238   sciGetAxisBox( dbox, xbox, ybox, zbox ) ;
00239       
00241   if ( flag == 1 || flag == 3 ) /* ALL the expanded cases : flag[1] = 1 or 2 or 5 or 6 */
00242   {
00243     xmmin =  Mini(xbox,8L) ;
00244     xmmax =  Maxi(xbox,8L) ; /* search for x Min/Max on all the edges (there are 8 edges that compose the box) F.Leray 13.10.04 */
00245     ymmax = -Mini(ybox,8L) ; /* same thing on ybox vector ( 1) why - (minus) ? see 2) )*/
00246     ymmin = -Maxi(ybox,8L);
00247   }
00248   
00249   if ( flag == 2 || flag == 3 ) /* ALL the isometric cases : flag[1] = 3 or 4 or 5 or 6 */
00250   {
00251     int verbose = 0 ;
00252     int narg        ;
00253     int wdim[2]     ;
00254     double FRect[4] ;
00255     double WRect[4] ;
00256     double ARect[4] ;
00257     char   logf_[2]  ;
00258     /* get current window size */
00259     C2F(dr)("xget","wdim",&verbose,wdim,&narg, PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
00260     getscale2d(WRect,FRect,logf_,ARect);
00261     wmax=linint((double)wdim[0] * WRect[2]);
00262     hmax=linint((double)wdim[1] * WRect[3]); 
00263   }
00264   
00265   if ( flag == 2 ) /* the "NON expanded isometric" cases : flag[1] = 3 or 4 */
00266   {
00267     double R  ;
00268     double xo ;
00269     double yo ;
00270     double zo ;
00271     double dx ;
00272     double dy ;
00273     double dz ;
00274     
00275     /* radius and center of the sphere circumscribing the box */
00276     dx = dbox[1] - dbox[0] ;
00277     dy = dbox[3] - dbox[2] ;
00278     dz = dbox[5] - dbox[4] ;
00279     
00280     R  = sqrt( dx*dx + dy*dy + dz*dz)/2;
00281     xo = ( xbox[0] + xbox[6] ) / 2.0 ;
00282     yo = ( ybox[0] + ybox[6] ) / 2.0 ;
00283     zo = ( zbox[0] + zbox[6] ) / 2.0 ;
00284     
00285     xmmin=   xo - R ;
00286     xmmax=   xo + R ;
00287     ymmax=  -yo + R ;
00288     ymmin=  -yo - R ;
00289   }
00290 
00291   if (flag==2 || flag==3)
00292   {
00293     double hx ;
00294     double hy  ;
00295     hx=xmmax-xmmin;
00296     hy=ymmax-ymmin;
00297     if ( hx/(double)wmax  < hy/(double)hmax ) 
00298     {
00299       double hx1 ;
00300       hx1   = wmax * hy / hmax ;
00301       xmmin = xmmin - ( hx1 - hx ) / 2.0 ;
00302       xmmax = xmmax + ( hx1 - hx ) / 2.0 ;
00303     }
00304     else 
00305     {
00306       double hy1 ;
00307       hy1 = hmax * hx / wmax ;
00308       ymmin = ymmin - ( hy1 - hy ) / 2.0 ;
00309       ymmax = ymmax + ( hy1 - hy ) / 2.0 ;
00310     }
00311   }
00312 
00313   if (flag != 0 ) /* != using current 3D scale */
00314   {
00315     double FRect[4] ;
00316     /* FRect = [Xmin,Ymin,Xmax,Ymax] */
00317     FRect[0] =  xmmin ;
00318     FRect[1] = -ymmax ;
00319     FRect[2] =  xmmax ;
00320     FRect[3] = -ymmin ; /* 2) ... (why - (minus) ? )*/
00321     set_scale("tftttf",NULL,FRect,aaint,"nn",NULL);
00322     Cscale.metric3d = flag; 
00323   }
00324 }

Here is the call graph for this function:

Here is the caller graph for this function:

void UpdateSubwinScale ( sciPointObj pobj  ) 

Definition at line 1046 of file DrawObjects.c.

References sciSubWindow::axes, axis_3ddraw(), FALSE, AXES::flag, sciSubWindow::is3d, sciSubWindow::isoview, long, NULL, pSUBWIN_FEATURE, sci_update_frame_bounds_2d(), sciGetCurrentSubWin(), sciGetVisibility(), sciSetSelectedSubWin(), sciSetVisibility(), and TRUE.

Referenced by plot2dn(), and sciInitIs3d().

01047 {
01048   sciSubWindow * ppsubwin = pSUBWIN_FEATURE (pobj);
01049   sciPointObj * currentsubwin = NULL;
01050   BOOL vis_save = FALSE;
01051   double xbox[8],ybox[8],zbox[8];
01052   static integer InsideU[4],InsideD[4];
01053         
01054   currentsubwin = sciGetCurrentSubWin();
01055 
01056   sciSetSelectedSubWin(pobj); 
01057   
01058   /*   set_scale ("tttftt", pSUBWIN_FEATURE (pobj)->WRect, pSUBWIN_FEATURE (pobj)->FRect, */
01059   /*         NULL, pSUBWIN_FEATURE (pobj)->logflags,  */
01060   /*         pSUBWIN_FEATURE (pobj)->ARect);  */
01061   
01062   if (ppsubwin->is3d) 
01063     {  /* 3D Coordinates */ /* verifier si c'est encore utile SS */
01064       /*To have directly all the possible ISOVIEW Modes*/
01065       long isoflag = (long)(ppsubwin->axes.flag[1]+1)/2; 
01066       
01067       if(ppsubwin->isoview == TRUE) {
01068         if(isoflag ==2 || isoflag == 3){                }
01069         else {
01070           if((ppsubwin->axes.flag[1] == 0)
01071              || (ppsubwin->axes.flag[1] == 2))
01072             /* The default isoview mode is type=4 3d isometric bounds 
01073                derived from the data, to similarily type=2  */
01074             ppsubwin->axes.flag[1] = 4; 
01075           else if(ppsubwin->axes.flag[1] == 1)
01076             ppsubwin->axes.flag[1] = 3;
01077         }
01078       }
01079       else {
01080         if((ppsubwin->axes.flag[1] == 3) 
01081            || (ppsubwin->axes.flag[1] == 5))
01082           ppsubwin->axes.flag[1] = 1; /* computed from ebox*/
01083         else if((ppsubwin->axes.flag[1] == 4) 
01084                 || (ppsubwin->axes.flag[1] == 6))
01085           /* The default NON-isoview mode is 2 computed from data*/
01086           ppsubwin->axes.flag[1] = 2; 
01087       }
01088       
01089 
01090       vis_save = sciGetVisibility(pobj);
01091 
01092       sciSetVisibility(pobj,FALSE);
01093       axis_3ddraw(pobj,xbox,ybox,zbox,InsideU,InsideD); /* TEST on sciGetVisibility inside */
01094       /* because axis_3ddraw displays 3d axes BUT ALSO compute + reset the 3d scale BEFORE !! */
01095       sciSetVisibility(pobj,vis_save);
01096     }
01097   else /* we are in 2D mode...*/
01098     {
01099       sci_update_frame_bounds_2d(pobj);
01100     }
01101 
01102   sciSetSelectedSubWin(currentsubwin); 
01103   
01104 }

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

int cf_type

Referenced by get_cf_type(), and set_cf_type().


Generated on Sun Mar 4 15:22:37 2007 for Scilab [trunk] by  doxygen 1.5.1