Changeset 2469 in Sophya for trunk/SophyaPI/PIext/pihisto.cc
- Timestamp:
- Dec 2, 2003, 8:36:10 PM (22 years ago)
- File:
-
- 1 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
Note:
See TracChangeset
for help on using the changeset viewer.