Changeset 2469 in Sophya for trunk/SophyaPI/PIext/pintuple.cc


Ignore:
Timestamp:
Dec 2, 2003, 8:36:10 PM (22 years ago)
Author:
cmv
Message:

gestion trace linges avec DrawPolygon cmv 02/12/03

File:
1 edited

Legend:

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

    r2388 r2469  
    140140
    141141/* --Methode-- */
     142#define NMXMULTP_LOCAL  30   // Pour multipoint sans new
    142143void PINTuple::Draw(PIGraphicUC* g, double xmin, double ymin, double xmax, double ymax)
    143144{
    144145double xp,yp,xer,yer,wp;
    145146double xl,yl;
    146 int nok;
     147int nok,npolyg;
    147148
    148149if (!mNT) return;
     
    158159PIColorMap * cmap = NULL;
    159160double dwc = 1.;
    160 double nwc = 1.;
     161int nwc = 1;
    161162bool revcmap;
    162163CMapId mcmapid = GetGraphicAtt().GetColMapId(revcmap);
     
    165166  cmap->ReverseColorIndex(revcmap);
    166167  nwc = cmap->NCol();
    167   dwc = (wMax-wMin)/nwc;
     168  dwc = (wMax-wMin)/(double)nwc;
    168169}
    169170
     
    187188nok = 0; 
    188189xp = yp = xl = yl = 0;
     190PIGrCoord xpolyg[NMXMULTP_LOCAL], ypolyg[NMXMULTP_LOCAL];
     191npolyg = 0; 
    189192for (long i=0; i<(long)mNT->NbLines(); i++) {
    190   xl = xp;  yl = yp; 
     193  xl = xp;  yl = yp;
    191194  xp = mNT->GetCell(i, xK);
    192195  yp = mNT->GetCell(i, yK);
     
    213216  }
    214217
    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
    217228  if ( xebK >= 0 ) {
    218229    xer = mNT->GetCell(i, xebK);
     
    223234    if(yer>0.) g->DrawLine(xp, yp-yer, xp, yp+yer);
    224235  }
     236
    225237  // Trace du marker
    226238  if ((wK >= 0)||(lK < 0)||(mmrk != PI_NotDefMarker))  g->DrawMarker(xp, yp);
     239
    227240  // Trace eventuel du label
    228241  if (lK >= 0) g->DrawString(xp, yp, mNT->GetCelltoString(i, lK).c_str());
    229242
    230243}
     244
     245// Fin du trace d'une ligne reliant les points  si necessaire
     246if( connectPts && npolyg>1 )
     247  {g->DrawPolygon(xpolyg,ypolyg,npolyg,false); npolyg=0;}
    231248
    232249if (stats) { // Trace de stats
     
    262279return;
    263280}
     281#undef NMXMULTP_LOCAL
    264282
    265283/* --Methode-- */
Note: See TracChangeset for help on using the changeset viewer.