Changeset 2373 in Sophya for trunk/SophyaPI/PIext
- Timestamp:
- Apr 25, 2003, 3:36:47 PM (22 years ago)
- Location:
- trunk/SophyaPI/PIext
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PIext/piaversion.h
r2350 r2373 2 2 #define PIAPPVERSION_H_SEEN 3 3 4 #define PIAPP_VERSIONNUMBER 3.9 34 #define PIAPP_VERSIONNUMBER 3.95 5 5 6 6 #endif -
trunk/SophyaPI/PIext/pintup3d.cc
r2350 r2373 48 48 mNT = nt; 49 49 mAdDO = ad; 50 UseSizeScale(true, 5); 51 UseColorScale(true); 50 52 SelectXYZ(NULL, NULL, NULL); 51 SelectWt(NULL , 1);53 SelectWt(NULL); 52 54 SelectErrBar(); 53 55 SelectLabel(NULL); … … 91 93 92 94 /* --Methode-- */ 93 void PINTuple3D::SelectWt(const char* pw, int nbins) 94 { 95 nWbins = (nbins > 0) ? nbins : 10; 95 void PINTuple3D::SelectWt(const char* pw) 96 { 96 97 if (pw == NULL) wK = -1; 97 98 else { string name = pw; wK = mNT->ColumnIndex(name); } … … 189 190 // Pour tracer des markers avec taille fonction de Wt (poids) 190 191 double dw = (wMax-wMin)/nWbins; 191 if (dw < 1.e-19) dw = 1.e19; 192 if (dw < 1.e-19) dw = 1.e-19; 193 // Pour tracer des markers avec couleur en fonction de Wt (poids) 194 PIColorMap * cmap = NULL; 195 double dwc = 1.; 196 double nwc = 1.; 197 bool revcmap; 198 CMapId mcmapid = GetGraphicAtt().GetColMapId(revcmap); 199 if( colorScale && (wK >= 0) && (mcmapid != CMAP_OTHER) ) { 200 cmap = new PIColorMap(mcmapid); 201 cmap->ReverseColorIndex(revcmap); 202 nwc = cmap->NCol(); 203 dwc = (wMax-wMin)/nwc; 204 } 205 192 206 int msz,sz; 193 207 … … 207 221 yp = mNT->GetCell(i, yK); 208 222 zp = mNT->GetCell(i, zK); 223 224 // Taille - couleur de marker en fonction du poids 225 if (wK >= 0) wp = mNT->GetCell(i, wK); 226 if (mrkSzScale && (wK >= 0)) { // Changement de taille 227 sz = (int)((wp-wMin)/dw); 228 if (sz < 0) sz = 0; 229 if (sz > nWbins) sz = nWbins; 230 sz += msz; 231 if (sz < 2) g->SelMarker(sz, PI_DotMarker); 232 else g->SelMarker(sz, mrk); 233 } 234 // Couleur du marker en fonction du poids 235 if( colorScale && (wK >= 0) && cmap ) { 236 int cid = (int)((wp-wMin)/dwc); 237 if (cid < 0) cid = 0; 238 if (cid >= nwc) cid = nwc-1; 239 g->SelForeground(*cmap, cid); 240 } 241 209 242 if ( (i > 0) && connectPts ) // On relie les points ... 210 243 g3->DrawLine3D(xl, yl, zl, xp, yp, zp); … … 221 254 zer = mNT->GetCell(i, zebK); 222 255 g3->DrawLine3D(xp, yp, zp-zer, xp, yp, zp+zer); 223 }224 if (wK >= 0) { // Taille de marker en fonction du poids225 wp = mNT->GetCell(i, wK);226 sz = (int)((wp-wMin)/dw);227 if (sz < 0) sz = 0;228 if (sz > nWbins) sz = nWbins;229 sz += msz;230 if (sz < 2) g->SelMarker(sz, PI_DotMarker);231 else g->SelMarker(sz, mrk);232 256 } 233 257 // Trace du marker … … 271 295 if (opts == "connectpoints") ConnectPoints(true); 272 296 else if (opts == "noconnectpoints") ConnectPoints(false); 297 else if (opts == "colorscale") UseColorScale(true); 298 else if (opts == "nocolorscale") UseColorScale(false); 299 else if (opts == "sizescale") UseSizeScale(true); 300 else if (opts == "nosizescale") UseSizeScale(false); 301 else if (opts.substr(0,10) == "sizescale=") { 302 int nbn = atoi(opts.substr(10).c_str()); 303 UseSizeScale(true, nbn); 304 } 273 305 else { 274 306 // Si option non decode … … 298 330 info += " connectpoints: The points are connected by a line \n"; 299 331 info += " noconnectpoints (this is the default) \n"; 332 info += " colorscale/nocolorscale (Use color scale for weight) \n"; 333 info += " sizescale/sizescale=nbins/nosizescale (Use marker size for weight) \n"; 300 334 info += " and usual color/line/marker/... attribute decoding \n"; 301 335 return; -
trunk/SophyaPI/PIext/pintup3d.h
r2350 r2373 14 14 15 15 virtual void SelectXYZ(const char* px, const char* py, const char* pz); 16 virtual void SelectWt(const char* pw=NULL , int nbins=10);16 virtual void SelectWt(const char* pw=NULL); 17 17 virtual void SelectErrBar(const char* erbx=NULL, const char* erby=NULL, const char* erbz=NULL); 18 18 virtual void SelectLabel(const char* plabel); 19 19 20 20 inline void ConnectPoints(bool fg=false) { connectPts = fg; } 21 22 // Gestion de la representation de poids 23 inline void UseSizeScale(bool fg=true, int nbins=5) 24 { mrkSzScale = fg; if (nbins>0) nWbins = nbins; } 25 inline void UseColorScale(bool fg=true) { colorScale = fg; } 26 27 inline bool GetSizeScale(int& nbins) 28 { nbins = nWbins; return mrkSzScale; } 29 inline bool GetColScale() { return colorScale; } 21 30 22 31 // Methode de decodage des options … … 33 42 int lK; // Index du nom de variable label (affiche en texte) 34 43 double wMin, wMax; // Valeurs de poids min/max 35 int nWbins; // Nombre de bins pour le poids (Wt) 44 bool mrkSzScale; // true -> Taille de markers variable suivant poids 45 int nWbins; // Nombre de bins taille de marker variable 46 bool colorScale; // true -> Couleur de marker variable suivant poids 36 47 37 48 bool connectPts; // true -> les points sont relies par une ligne -
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 -
trunk/SophyaPI/PIext/pintuple.h
r2350 r2373 19 19 20 20 virtual void SelectXY(const char* px, const char* py); 21 virtual void SelectWt(const char* pw=NULL , int nbins=10);21 virtual void SelectWt(const char* pw=NULL); 22 22 virtual void SelectErrBar(const char* erbx=NULL, const char* erby=NULL); 23 23 virtual void SelectLabel(const char* plabel=NULL); 24 24 25 inline void ConnectPoints(bool fg=false) { connectPts = fg; } 26 27 // Gestion de la representation de poids 28 inline void UseSizeScale(bool fg=true, int nbins=5) 29 { mrkSzScale = fg; if (nbins>0) nWbins = nbins; } 30 inline void UseColorScale(bool fg=true) { colorScale = fg; } 31 32 inline bool GetSizeScale(int& nbins) 33 { nbins = nWbins; return mrkSzScale; } 34 inline bool GetColScale() { return colorScale; } 35 25 36 inline void SetStats(bool fg=true) { stats = fg; } 26 inline void ConnectPoints(bool fg=false) { connectPts = fg; }27 37 28 38 virtual void AppendTextInfo(string& info, double xmin, double ymin, double xmax, double ymax); … … 40 50 int wK; // Index du nom de variable poids 41 51 int lK; // Index du nom de variable label (affiche en texte) 42 double wMin, wMax; // Valeurs de poids min/max 43 int nWbins; // Nombre de bins pour le poids (Wt) 52 double wMin, wMax; // Valeurs de poids min/max 53 bool mrkSzScale; // true -> Taille de markers variable suivant poids 54 int nWbins; // Nombre de bins taille de marker variable 55 bool colorScale; // true -> Couleur de marker variable suivant poids 44 56 bool stats; // true -> indication du nb de points 45 57 bool connectPts; // true -> les points sont relies par une ligne
Note:
See TracChangeset
for help on using the changeset viewer.