Changeset 2373 in Sophya for trunk/SophyaPI/PIext/pintuple.cc
- Timestamp:
- Apr 25, 2003, 3:36:47 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PIext/pintuple.cc
r2350 r2373 15 15 // Les objets "PINTuple" peuvent tracer des signes (markers) 16 16 // éventuellement avec des barres d'erreur et une étiquette 17 // pour chaque point. Si un attribut de ligne, autre que18 // "PI_NotDefLineAtt" est spécifié, les points sont connectés19 // par une ligne.17 // pour chaque point. Si un nom de colonne poids est spécifié, 18 // la taille et/ou la couleur des signes (markers) sera fonction 19 // de la valeur de poids. 20 20 //-- 21 21 //++ … … 36 36 // Constructeur. Si "ad == true", l'objet "nt" est détruit par 37 37 // le destructeur de l'objet "PINTuple" 38 // Note : "nt" doit être créé par new 38 // Note : "nt" doit être créé par new dans ce cas. 39 39 //-- 40 40 … … 47 47 SetStats(true); 48 48 ConnectPoints(false); 49 UseSizeScale(true, 5); 50 UseColorScale(true); 49 51 SelectXY(NULL, NULL); 50 SelectWt(NULL , 1);52 SelectWt(NULL); 51 53 SelectErrBar(); 52 54 SelectLabel(NULL); … … 88 90 89 91 /* --Methode-- */ 90 void PINTuple::SelectWt(const char* pw, int nbins) 91 { 92 nWbins = (nbins > 0) ? nbins : 10; 92 void PINTuple::SelectWt(const char* pw) 93 { 93 94 if (pw == NULL) wK = -1; 94 95 else { string name = pw; wK = mNT->ColumnIndex(name); } … … 151 152 // Pour tracer des markers avec taille fonction de Wt (poids) 152 153 double dw = (wMax-wMin)/nWbins; 153 if (dw < 1.e-19) dw = 1.e19; 154 if (dw < 1.e-19) dw = 1.e-19; 155 156 // Pour tracer des markers avec couleur en fonction de Wt (poids) 157 PIColorMap * cmap = NULL; 158 double dwc = 1.; 159 double nwc = 1.; 160 bool revcmap; 161 CMapId mcmapid = GetGraphicAtt().GetColMapId(revcmap); 162 if( colorScale && (wK >= 0) && (mcmapid != CMAP_OTHER) ) { 163 cmap = new PIColorMap(mcmapid); 164 cmap->ReverseColorIndex(revcmap); 165 nwc = cmap->NCol(); 166 dwc = (wMax-wMin)/nwc; 167 } 168 154 169 int msz,sz; 155 170 … … 158 173 if (wK >= 0) mrk = (mmrk != PI_NotDefMarker) ? mmrk : PI_CircleMarker; 159 174 else mrk = (mmrk != PI_NotDefMarker) ? mmrk : PI_DotMarker; 160 175 msz = GetGraphicAtt().GetMarkerSz(); 161 176 if (msz < 1) msz = 1; 162 177 g->SelMarker(msz, mrk); … … 178 193 nok++; 179 194 if ( (xp < xmin) || (xp > xmax) || (yp < ymin) || (yp > ymax) ) continue; 180 if ( (i > 0) && connectPts ) 181 g->DrawLine(xl, yl, xp, yp); // On relie les points ... 182 if ( xebK >= 0 ) { 183 xer = mNT->GetCell(i, xebK); 184 if(xer>0.) g->DrawLine(xp-xer, yp, xp+xer, yp); 185 } 186 if ( yebK >= 0 ) { 187 yer = mNT->GetCell(i, yebK); 188 if(yer>0.) g->DrawLine(xp, yp-yer, xp, yp+yer); 189 } 190 if (wK >= 0) { // Taille de marker en fonction du poids 191 wp = mNT->GetCell(i, wK); 195 196 // Taille - couleur de marker en fonction du poids 197 if (wK >= 0) wp = mNT->GetCell(i, wK); 198 if (mrkSzScale && (wK >= 0)) { // Changement de taille 192 199 sz = (int)((wp-wMin)/dw); 193 200 if (sz < 0) sz = 0; … … 196 203 if (sz < 2) g->SelMarker(sz, PI_DotMarker); 197 204 else g->SelMarker(sz, mrk); 205 } 206 // Couleur du marker en fonction du poids 207 if( colorScale && (wK >= 0) && cmap ) { 208 int cid = (int)((wp-wMin)/dwc); 209 if (cid < 0) cid = 0; 210 if (cid >= nwc) cid = nwc-1; 211 g->SelForeground(*cmap, cid); 212 } 213 214 if ( (i > 0) && connectPts ) 215 g->DrawLine(xl, yl, xp, yp); // On relie les points ... 216 if ( xebK >= 0 ) { 217 xer = mNT->GetCell(i, xebK); 218 if(xer>0.) g->DrawLine(xp-xer, yp, xp+xer, yp); 219 } 220 if ( yebK >= 0 ) { 221 yer = mNT->GetCell(i, yebK); 222 if(yer>0.) g->DrawLine(xp, yp-yer, xp, yp+yer); 198 223 } 199 224 // Trace du marker … … 228 253 } 229 254 255 if (cmap) delete cmap; 230 256 return; 231 257 } … … 289 315 else if (opts == "connectpoints") ConnectPoints(true); 290 316 else if (opts == "noconnectpoints") ConnectPoints(false); 317 else if (opts == "colorscale") UseColorScale(true); 318 else if (opts == "nocolorscale") UseColorScale(false); 319 else if (opts == "sizescale") UseSizeScale(true); 320 else if (opts == "nosizescale") UseSizeScale(false); 321 else if (opts.substr(0,10) == "sizescale=") { 322 int nbn = atoi(opts.substr(10).c_str()); 323 UseSizeScale(true, nbn); 324 } 291 325 else { 292 326 // Si option non decode … … 318 352 info += " connectpoints: The points are connected by a line \n"; 319 353 info += " noconnectpoints (this is the default) \n"; 354 info += " colorscale/nocolorscale (Use color scale for weight) \n"; 355 info += " sizescale/sizescale=nbins/nosizescale (Use marker size for weight) \n"; 320 356 info += " and usual color/line/marker/... attribute decoding \n"; 321 357 return; 322 358 } 359 360 361
Note:
See TracChangeset
for help on using the changeset viewer.