#include "drawLegendEntity.h"#include "GetProperty.h"#include "Xcall1.h"#include "periScreen.h"#include "MALLOC.h"#include "sciprint.h"#include "PloEch.h"Include dependency graph for drawLegendEntity.c:

Go to the source code of this file.
Functions | |
| void | Legends (integer *style, integer *n1, char *legend) |
| int | drawLegendEntity (sciPointObj *pObj) |
| int drawLegendEntity | ( | sciPointObj * | pObj | ) |
Routine which draw a legend object
| pObj | the pointer on the legend object |
Definition at line 119 of file drawLegendEntity.c.
References C2F, dr(), dr1(), getStrMatElement(), i, L, Legends(), MaybeSetWinhdc(), sciLegend::nblegends, pLEGEND_FEATURE, sciLegend::pptabofpointobj, sciLegend::pstyle, ReleaseWinHdc(), sciGetFontDeciWidth(), sciGetFontStyle(), sciGetForeground(), sciGetIsMark(), sciGetMarkStyle(), sciGetText(), sciGetVisibility(), and v.
Referenced by sciDrawObj().
00120 { 00121 sciLegend * ppLegend = pLEGEND_FEATURE(pObj) ; 00122 00123 int verbose = 0 ; 00124 int foreground = sciGetForeground( pObj ) ; 00125 int fontWidth = sciGetFontDeciWidth( pObj ) / 100 ; 00126 int fontStyle = sciGetFontStyle( pObj ) ; 00127 int oldForeground = 0 ; 00128 int oldDashStyle = 0 ; 00129 int v = 0 ; 00130 double dv = 0.0 ; 00131 int i ; 00132 00133 if ( !sciGetVisibility(pObj) ) { return 0 ; } 00134 00135 C2F(dr1)("xget", "dashes", &verbose, &oldDashStyle, &v, &v, &v,&v, &dv, &dv, &dv, &dv, 5L, 4096); 00136 C2F(dr1)("xget", "foreground", &verbose, &oldForeground, &v, &v, &v, &v, &dv, &dv, &dv, &dv, 5L, 4096); 00137 00138 00139 #ifdef _MSC_VER 00140 flag_DO=MaybeSetWinhdc(); 00141 #endif 00142 C2F (dr1) ("xset", "dashes", &foreground, &foreground, &v, &v, &v, &v, &dv, 00143 &dv, &dv, &dv, 5L, 4096); 00144 C2F (dr1) ("xset", "foreground", &foreground, &foreground, &v, &v, &v, &v, 00145 &dv, &dv, &dv, &dv, 5L, 4096); 00146 00147 C2F(dr)("xset","font",&fontStyle,&fontWidth,&v, &v, &v, &v,&dv, &dv, &dv, &dv, 5L, 4L); 00148 00149 00150 /*permet la mise a jour des legendes correspondantes aux entites associees */ 00151 for ( i = 0; i < ppLegend->nblegends; i++ ) 00152 { 00153 sciPointObj * curObj = ppLegend->pptabofpointobj[i] ; 00154 if ( sciGetIsMark( curObj ) ) 00155 { 00156 ppLegend->pstyle[i] = -sciGetMarkStyle( curObj ); 00157 } 00158 else 00159 { 00160 ppLegend->pstyle[i] = sciGetForeground( curObj ); 00161 } 00162 } 00163 Legends( ppLegend->pstyle, &(ppLegend->nblegends), getStrMatElement(sciGetText(pObj),0,0) ) ; 00164 00165 00166 /* restore the graphic context */ 00167 00168 C2F (dr1) ("xset", "dashes", &oldDashStyle, &v, &v, &v, &v, &v, &dv, &dv, &dv, &dv, 5L, 6L); 00169 C2F (dr1) ("xset", "foreground", &oldForeground, &v, &v, &v, &v, &v, &dv, &dv, &dv, &dv, 5L, 10L); 00170 #ifdef _MSC_VER 00171 if ( flag_DO == 1) ReleaseWinHdc (); 00172 #endif 00173 00174 return 0 ; 00175 00176 }
Here is the call graph for this function:

Here is the caller graph for this function:

legend="leg1@...." legend contain legends separated by '@' if nlegend is the number of legends stored in legend then the function Legends draw Min(*n1,6,nlegends) legends
Definition at line 24 of file drawLegendEntity.c.
References wcscalelist::axis, C2F, Cscale, dr(), FREE, i, inint, L, MALLOC, n, NULL, p, PD0, PI0, sciprint(), wcscalelist::subwin_rect, wcscalelist::wdim, xi, and yi.
Referenced by drawLegendEntity().
00025 { 00026 int rect[4] ; 00027 int xx = 0 ; 00028 int yy = 0 ; 00029 char *leg,*loc; 00030 double xi,xi1,yi,yi1,xoffset,yoffset; 00031 int i; 00032 integer verbose=0,narg,xz[10],fg; 00033 00034 loc = MALLOC( (strlen(legend)+1)*sizeof(char)); 00035 if ( loc == NULL ) 00036 { 00037 sciprint( "Impossible to draw legends, memory full.\n" ) ; 00038 return ; 00039 } 00040 00041 00042 C2F(dr)("xstringl","pl",&xx,&yy,rect,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L); 00043 00044 C2F(dr)("xget","foreground",&verbose,&fg,&narg,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L); 00045 C2F(dr)("xget","line style",&verbose,xz,&narg,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L); 00046 C2F(dr)("xset","line style",(i=1,&i),PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L); 00047 00048 C2F(dr)("xget","color",&verbose,xz+6,&narg,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L); 00049 C2F(dr)("xset","color",&fg,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L); 00050 00051 strcpy(loc,legend); 00052 00053 /* length for the tick zone associated to the legend */ 00054 xoffset= (Cscale.wdim[0]*Cscale.subwin_rect[2]*(1- Cscale.axis[0] - Cscale.axis[1]))/12.0; 00055 /* y offset between legends */ 00056 yoffset= (Cscale.wdim[1]*Cscale.subwin_rect[3]*Cscale.axis[3])/5.0; 00057 00058 /* x position of the legends in pixel if n <= 3 */ 00059 xi = Cscale.wdim[0]*Cscale.subwin_rect[2]*Cscale.axis[0] 00060 + Cscale.subwin_rect[0]*Cscale.wdim[0]; 00061 /* x position of the legends in pixel if n > 3 */ 00062 xi1 = xi + Cscale.wdim[0]*Cscale.subwin_rect[2]*(1.0 - (Cscale.axis[0]+Cscale.axis[1]))/2.0 ; 00063 00064 /* y position of x-axis in pixel */ 00065 yi1 = Cscale.wdim[1]*Cscale.subwin_rect[3]*Cscale.axis[2] 00066 + Cscale.subwin_rect[1]*Cscale.wdim[1] 00067 + Cscale.subwin_rect[3]*Cscale.wdim[1]*(1.0 - (Cscale.axis[2]+Cscale.axis[3])) ; /* ouf !! */ 00068 00069 for ( i = 0 ; i < *n1 && i < 6 ; i++) 00070 { 00071 integer xs,ys,flag=0,polyx[2],polyy[2],lstyle[1]; 00072 double angle=0.0; 00073 00074 if (i >= 3) 00075 { 00076 /* down left point for string display */ 00077 xi= xi1; 00078 yi= yi1 +(i-3)*yoffset+3.0*yoffset;} 00079 else 00080 { 00081 yi= yi1 + (i)*yoffset+3.0*yoffset; 00082 } 00083 xs=inint(xi+1.2*xoffset); 00084 ys=inint(yi); 00085 00086 if ( i==0) leg=strtok(loc,"@"); else leg=strtok((char *)0,"@"); 00087 if (leg != 0) 00088 { 00089 C2F(dr)("xset","color",&fg,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L); 00090 C2F(dr)("xstring",leg,&xs,&ys,PI0,&flag,PI0,PI0,&angle,PD0,PD0,PD0,0L,0L); 00091 C2F(dr)("xset","color",xz+6,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L); 00092 if (style[i] > 0) 00093 { 00094 integer n=1,p=2; 00095 polyx[0]=inint(xi);polyx[1]=inint(xi+xoffset); 00096 polyy[0]=inint(yi - rect[3]/2.0);polyy[1]=polyy[0]; 00097 lstyle[0]=style[i]; 00098 C2F(dr)("xpolys","v",polyx,polyy,lstyle,&n,&p 00099 ,PI0,PD0,PD0,PD0,PD0,0L,0L); 00100 } 00101 else 00102 { 00103 integer n=1,p=1; 00104 polyx[0]=inint(xi+xoffset); 00105 polyy[0]=inint(yi- rect[3]/2.0); 00106 lstyle[0]=style[i]; 00107 C2F(dr)("xpolys","v",polyx,polyy,lstyle,&n,&p 00108 ,PI0,PD0,PD0,PD0,PD0,0L,0L); 00109 } 00110 } 00111 } 00112 FREE(loc); 00113 C2F(dr)("xset","line style",xz,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L); 00114 00115 }
Here is the call graph for this function:

Here is the caller graph for this function:

1.5.1