Changeset 2469 in Sophya for trunk/SophyaPI/PIext
- Timestamp:
- Dec 2, 2003, 8:36:10 PM (22 years ago)
- Location:
- trunk/SophyaPI/PIext
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PIext/pihisto.cc
r2388 r2469 79 79 if( typeid(*mHisto)==typeid(HProf) ) mHisto->UpdateHisto(); 80 80 81 bool drawmarker=false, drawerr=false, oktrace=false; 82 // Tracer les marqueurs si demande ou si HProf 81 bool oktrace=false; 82 // Tracer des marqueurs si demande ou si HProf 83 bool drawmarker=false; 83 84 if( (GetGraphicAtt().GetMarker() != PI_NotDefMarker) || 84 85 (typeid(*mHisto) == typeid(HProf)) ) drawmarker = true; 86 // Tracer des erreurs ? 87 bool drawerr=false; 85 88 if(error==0) { // Gestion automatique des erreurs 86 89 // Tracer les erreurs si HProf … … 88 91 // Trace les erreurs si marqueurs demandes 89 92 if(drawmarker) drawerr=true; 90 } else if(error>0) drawerr=true; 93 } 94 else if(error>0) drawerr=true; 95 else if(error<0) drawerr=false; 91 96 92 97 // Trace des marqeurs … … 101 106 102 107 // Trace des erreurs 103 // Si Marqeurs definis OU HProf => marqueurs+Erreurs si il y en a104 108 if(drawerr) { 105 109 if(GetGraphicAtt().GetLineAtt()==PI_NotDefLineAtt) g->SelLine(PI_ThinLine); … … 122 126 123 127 // Trace de la ligne continue 124 if(GetGraphicAtt().GetLineAtt() != PI_NotDefLineAtt) { 125 double x1,y1, x2, y2; oktrace = true; 126 x1 = mHisto->BinLowEdge(0); 127 y1 = 0; 128 // Si on ne demande pas de ligne (PI_NotDefLineAtt) 129 // et que l'on a rien trace auparavent, on trace un FPolygon 130 if(GetGraphicAtt().GetLineAtt() != PI_NotDefLineAtt || !oktrace) { 131 PIGrCoord* x1 = new PIGrCoord[2*mHisto->NBins()+2]; 132 PIGrCoord* y1 = new PIGrCoord[2*mHisto->NBins()+2]; 133 double dx = mHisto->BinWidth(); 134 int npt=0; 135 x1[npt] = mHisto->BinLowEdge(0); 136 y1[npt] = 0; 137 npt++; 128 138 for(int i=0; i<mHisto->NBins(); i++) { 129 x2 = x1; 130 y2 = (*mHisto)(i); 131 g->DrawLine(x1,y1, x2, y2); 132 y1 = y2; 133 x2 = mHisto->BinHighEdge(i); 134 g->DrawLine(x1,y1, x2, y2); 135 x1 = x2; 136 } 137 y2 = 0; g->DrawLine(x1,y1, x2, y2); 138 } 139 140 // Si rien n'a ete trace 141 if( !oktrace ) { 142 for(int i=0; i<mHisto->NBins(); i++) { 143 double left = mHisto->BinLowEdge(i); 144 double width = mHisto->BinWidth(); 145 double bottom = 0; 146 double height = (*mHisto)(i); 147 g->DrawFBox(left,bottom,width,height); 148 g->DrawLine(left, bottom, left, bottom+height); // Au moins une ligne... 149 } 139 x1[npt] = mHisto->BinLowEdge(i); 140 y1[npt] = (*mHisto)(i); 141 npt++; 142 x1[npt] = (double)x1[npt-1] + dx; 143 y1[npt] = y1[npt-1]; 144 npt++; 145 } 146 x1[npt] = x1[npt-1]; 147 y1[npt] = 0; 148 npt++; 149 if(GetGraphicAtt().GetLineAtt() != PI_NotDefLineAtt) { 150 g->DrawPolygon(x1,y1,npt,false); 151 oktrace = true; 152 } 153 if(!oktrace) g->DrawFPolygon(x1,y1,npt,false); 154 delete[] x1; delete[] y1; 150 155 } 151 156 -
trunk/SophyaPI/PIext/pihisto.h
r2383 r2469 19 19 // fg=-1 pas de barre d'erreur, 1=barres d'erreurs, 20 20 // 0=barres d'erreurs automatiques: trace si HProf ou markeur demande 21 inline void SetError( unsignedshort fg=0) {error=fg;}21 inline void SetError(short fg=0) {error=fg;} 22 22 inline Histo* Histogram() {return(mHisto);} 23 23 … … 30 30 Histo* mHisto; 31 31 bool mAdDO; 32 bool stats,error; 32 bool stats; 33 short error; 33 34 float spoX, spoY; // Stat pos offset par rapport a position defaut 34 35 }; -
trunk/SophyaPI/PIext/pintuple.cc
r2388 r2469 140 140 141 141 /* --Methode-- */ 142 #define NMXMULTP_LOCAL 30 // Pour multipoint sans new 142 143 void PINTuple::Draw(PIGraphicUC* g, double xmin, double ymin, double xmax, double ymax) 143 144 { 144 145 double xp,yp,xer,yer,wp; 145 146 double xl,yl; 146 int nok ;147 int nok,npolyg; 147 148 148 149 if (!mNT) return; … … 158 159 PIColorMap * cmap = NULL; 159 160 double dwc = 1.; 160 double nwc = 1.;161 int nwc = 1; 161 162 bool revcmap; 162 163 CMapId mcmapid = GetGraphicAtt().GetColMapId(revcmap); … … 165 166 cmap->ReverseColorIndex(revcmap); 166 167 nwc = cmap->NCol(); 167 dwc = (wMax-wMin)/ nwc;168 dwc = (wMax-wMin)/(double)nwc; 168 169 } 169 170 … … 187 188 nok = 0; 188 189 xp = yp = xl = yl = 0; 190 PIGrCoord xpolyg[NMXMULTP_LOCAL], ypolyg[NMXMULTP_LOCAL]; 191 npolyg = 0; 189 192 for (long i=0; i<(long)mNT->NbLines(); i++) { 190 xl = xp; yl = yp; 193 xl = xp; yl = yp; 191 194 xp = mNT->GetCell(i, xK); 192 195 yp = mNT->GetCell(i, yK); … … 213 216 } 214 217 215 if ( (i > 0) && connectPts ) 216 g->DrawLine(xl, yl, xp, yp); // On relie les points ... 218 // Trace d'une ligne reliant les points 219 if( connectPts ) { 220 if(npolyg==0) {xpolyg[0]=xl; ypolyg[0]=yl; npolyg=1;} 221 if(npolyg<NMXMULTP_LOCAL) 222 {xpolyg[npolyg]=xp; ypolyg[npolyg]=yp; npolyg++;} 223 if(npolyg==NMXMULTP_LOCAL) 224 {g->DrawPolygon(xpolyg,ypolyg,npolyg,false); npolyg=0;} 225 } 226 227 // Trace des erreurs selon X et Y 217 228 if ( xebK >= 0 ) { 218 229 xer = mNT->GetCell(i, xebK); … … 223 234 if(yer>0.) g->DrawLine(xp, yp-yer, xp, yp+yer); 224 235 } 236 225 237 // Trace du marker 226 238 if ((wK >= 0)||(lK < 0)||(mmrk != PI_NotDefMarker)) g->DrawMarker(xp, yp); 239 227 240 // Trace eventuel du label 228 241 if (lK >= 0) g->DrawString(xp, yp, mNT->GetCelltoString(i, lK).c_str()); 229 242 230 243 } 244 245 // Fin du trace d'une ligne reliant les points si necessaire 246 if( connectPts && npolyg>1 ) 247 {g->DrawPolygon(xpolyg,ypolyg,npolyg,false); npolyg=0;} 231 248 232 249 if (stats) { // Trace de stats … … 262 279 return; 263 280 } 281 #undef NMXMULTP_LOCAL 264 282 265 283 /* --Methode-- */
Note:
See TracChangeset
for help on using the changeset viewer.