Changeset 2373 in Sophya for trunk/SophyaPI/PIext/pintup3d.cc


Ignore:
Timestamp:
Apr 25, 2003, 3:36:47 PM (22 years ago)
Author:
ansari
Message:

Ajout possibilite de trace de marker suivant table de couleur/poids ds PINTuple/PINTuple3D - Reza 25/04/03

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaPI/PIext/pintup3d.cc

    r2350 r2373  
    4848  mNT = nt;
    4949  mAdDO = ad;
     50  UseSizeScale(true, 5);
     51  UseColorScale(true);
    5052  SelectXYZ(NULL, NULL, NULL);
    51   SelectWt(NULL, 1);
     53  SelectWt(NULL);
    5254  SelectErrBar();
    5355  SelectLabel(NULL);
     
    9193
    9294/* --Methode-- */
    93 void  PINTuple3D::SelectWt(const char* pw, int nbins)
    94 {
    95 nWbins = (nbins > 0) ? nbins : 10;
     95void  PINTuple3D::SelectWt(const char* pw)
     96{
    9697if (pw == NULL) wK = -1; 
    9798else { string name = pw;   wK = mNT->ColumnIndex(name);  }
     
    189190//  Pour tracer des markers avec taille fonction de Wt (poids)
    190191double dw = (wMax-wMin)/nWbins;
    191 if (dw < 1.e-19) dw = 1.e19;
     192if (dw < 1.e-19) dw = 1.e-19;
     193//  Pour tracer des markers avec couleur en fonction de Wt (poids)
     194PIColorMap * cmap = NULL;
     195double dwc = 1.;
     196double nwc = 1.;
     197bool revcmap;
     198CMapId mcmapid = GetGraphicAtt().GetColMapId(revcmap);
     199if( 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
    192206int msz,sz;
    193207
     
    207221  yp = mNT->GetCell(i, yK);
    208222  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
    209242  if ( (i > 0) && connectPts ) // On relie les points ...
    210243    g3->DrawLine3D(xl, yl, zl, xp, yp, zp);
     
    221254    zer = mNT->GetCell(i, zebK);
    222255    g3->DrawLine3D(xp, yp, zp-zer, xp, yp, zp+zer);
    223   }
    224   if (wK >= 0) { // Taille de marker en fonction du poids
    225     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);
    232256  }
    233257  // Trace du marker
     
    271295    if (opts == "connectpoints") ConnectPoints(true);
    272296    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    }
    273305    else {
    274306      // Si option non decode
     
    298330info += "  connectpoints: The points are connected by a line \n";
    299331info += "  noconnectpoints (this is the default) \n";
     332info += "  colorscale/nocolorscale (Use color scale for weight) \n";
     333info += "  sizescale/sizescale=nbins/nosizescale (Use marker size for weight) \n";
    300334info += "  and usual color/line/marker/... attribute decoding  \n";
    301335return;
Note: See TracChangeset for help on using the changeset viewer.