Changeset 2264 in Sophya


Ignore:
Timestamp:
Nov 15, 2002, 12:54:16 AM (23 years ago)
Author:
ansari
Message:

Ajout gestion trace d'arc specifie avec angle ds PIElDrawer - Reza 14/11/2002

Location:
trunk/SophyaPI/PI
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaPI/PI/pieldrw.cc

    r2262 r2264  
    145145        case PIDEL_Circ :
    146146          if ((*it).scc)  // Coord specifie normalise 0..1
    147             g->DrawCircle(CN_To_CG_X((*it).ex), CN_To_CG_Y((*it).ey), CN_To_CG_R((*it).edx) );
    148           else  g->DrawCircle((*it).ex, (*it).ey, (*it).edx );
     147            g->DrawCircle(CN_To_CG_X((*it).ex), CN_To_CG_Y((*it).ey), CN_To_CG_R((*it).er) );
     148          else  g->DrawCircle((*it).ex, (*it).ey, (*it).er );
    149149          break;
    150150        case PIDEL_FCirc :
    151151          if ((*it).scc)  // Coord specifie normalise 0..1
    152             g->DrawFCircle(CN_To_CG_X((*it).ex), CN_To_CG_Y((*it).ey), CN_To_CG_R((*it).edx) );
    153           else g->DrawFCircle((*it).ex, (*it).ey, (*it).edx );
     152            g->DrawFCircle(CN_To_CG_X((*it).ex), CN_To_CG_Y((*it).ey), CN_To_CG_R((*it).er) );
     153          else g->DrawFCircle((*it).ex, (*it).ey, (*it).er );
    154154          break;
    155155        case PIDEL_Arc :
     156          if ((*it).scc)  // Coord specifie normalise 0..1
     157            g->DrawArc(CN_To_CG_X((*it).ex), CN_To_CG_Y((*it).ey), CN_To_CG_R((*it).er),
     158                       CN_To_CG_R((*it).er), (*it).edx, (*it).edy );
     159          else  g->DrawArc((*it).ex, (*it).ey, (*it).er, (*it).er,
     160                           (*it).edx, (*it).edy );
     161          break;
     162        case PIDEL_FArc :
     163          if ((*it).scc)  // Coord specifie normalise 0..1
     164            g->DrawFArc(CN_To_CG_X((*it).ex), CN_To_CG_Y((*it).ey), CN_To_CG_R((*it).er),
     165                        CN_To_CG_R((*it).er), (*it).edx, (*it).edy );
     166          else  g->DrawFArc((*it).ex, (*it).ey, (*it).er, (*it).er,
     167                            (*it).edx, (*it).edy );
     168          break;
     169        case PIDEL_Arc3P :
    156170          if ((*it).scc)  // Coord specifie normalise 0..1
    157171            g->Draw3PtArc(CN_To_CG_X((*it).xpol[0]), CN_To_CG_X((*it).xpol[1]),
     
    161175                             (*it).ypol[1], (*it).xpol[2], (*it).ypol[2] );
    162176          break;
    163         case PIDEL_FArc :
     177        case PIDEL_FArc3P :
    164178          if ((*it).scc)  // Coord specifie normalise 0..1
    165179            g->Draw3PtFArc(CN_To_CG_X((*it).xpol[0]), CN_To_CG_X((*it).xpol[1]),
     
    256270//      Renvoie le numéro identificateur de l'élément.
    257271//
     272// int  ElAddArc(double x, double y, double r, double a1, double da, bool fgsc=false)
     273// int  ElAddArc(double x, double y, double r, double a1, double da, \
     274//               PIGraphicAtt gatt, bool fgsc=false)
     275//      Ajout d'un élément de type arc de cercle défini par un angle de départ "a1"
     276//      et une extension angulaire "da".
     277//      Il est possible de spécifier un attribut graphique.
     278//      si "fgsc==true", coordonnées spécifiées considerées normalisées entre 0 et 1.
     279//      Renvoie le numéro identificateur de l'élément.
     280//
     281// int  ElAddFArc(double x, double y, double r, double a1, double da, bool fgsc=false)
     282// int  ElAddFArc(double x, double y, double r, double a1, double da, \
     283//                PIGraphicAtt gatt, bool fgsc=false)
     284//      Ajout d'un élément de type arc de cercle plein défini par un angle de
     285//      départ "a1" et une extension angulaire "da".
     286//      Il est possible de spécifier un attribut graphique.
     287//      si "fgsc==true", coordonnées spécifiées considerées normalisées entre 0 et 1.
     288//      Renvoie le numéro identificateur de l'élément.
     289//
    258290// int  ElAddArc(double x1, double y1, double x2, double y2 \
    259291//               double x3, double y3, bool fgsc=false)
     
    298330/* --Methode-- */
    299331int PIElDrwMgr::ElAdd(int typ, double x, double  y, double dx, double dy,
    300                       const char* s, PIGraphicAtt const& att, unsigned long tpd, bool fgsc)
     332                      const char* s, PIGraphicAtt const& att,
     333                      unsigned long tpd, bool fgsc, double r)
    301334{
    302335  DrwEl dre;
     
    305338  dre.ex = x;   dre.ey = y;
    306339  dre.edx = dx;  dre.edy = dy;
     340  dre.er = r;
    307341  dre.gatt = att;
    308342  if (s)  {
     
    329363  dre.eid = mEn; dre.etyp = PIDEL_CText;
    330364  dre.ex = x;   dre.ey = y;
    331   dre.edx = 0;  dre.edy = 0;
     365  dre.edx = 0;  dre.edy = 0;
     366  dre.er = 0.;
    332367  dre.gatt = att;
    333368  dre.es = new TxtEl;
     
    356391  dre.ex = dre.ey = 0;
    357392  dre.edx = dre.edy = 0;
     393  dre.er = 0.;
    358394  dre.gatt = att;
    359395  dre.es = NULL;
  • trunk/SophyaPI/PI/pieldrw.h

    r2262 r2264  
    88#include "pidrawer.h"
    99
    10 //  Classe avec gestion d une liste d elements a tracer
     10/*  ------------------- Classe PIElDrwMgr ------------------------  */
     11//  Classe avec gerant d une liste d elements a tracer
    1112
    1213class PIElDrwMgr
     
    1718         PIDEL_Circ = 5, PIDEL_FCirc = 6,
    1819         PIDEL_Arc = 7,  PIDEL_FArc = 8,
    19          PIDEL_Poly = 9, PIDEL_FPoly = 10,
    20          PIDEL_Mark = 11, PIDEL_Arrow = 12,
    21          PIDEL_CText = 13  } ;
     20         PIDEL_Arc3P = 9,  PIDEL_FArc3P = 10,
     21         PIDEL_Poly = 11, PIDEL_FPoly = 12,
     22         PIDEL_Mark = 13, PIDEL_Arrow = 14,
     23         PIDEL_CText = 15  } ;
    2224
    2325                PIElDrwMgr();
     
    8890  // ---- Ajout de cercles
    8991  inline int    ElAddCirc(double x, double y, double r, bool fgsc=false)
    90     { PIGraphicAtt gatt; return( ElAdd(PIDEL_Circ, x, y, r, r, NULL, gatt, 0, fgsc) ); } 
     92    { PIGraphicAtt gatt;
     93      return( ElAdd(PIDEL_Circ, x, y, 0., 360., NULL, gatt, 0, fgsc, r) ); } 
    9194  inline int    ElAddCirc(double x, double y, double r,
    9295                          PIGraphicAtt const & gatt, bool fgsc=false)
    93     { return( ElAdd(PIDEL_Circ, x, y, r, r, NULL, gatt, 0, fgsc) ); } 
     96    { return( ElAdd(PIDEL_Circ, x, y, 0., 360., NULL, gatt, 0, fgsc, r) ); } 
    9497
    9598  inline int    ElAddFCirc(double x, double y, double r, bool fgsc=false)
    96     { PIGraphicAtt gatt; return( ElAdd(PIDEL_FCirc, x, y, r, r, NULL, gatt, 0, fgsc) ); } 
     99    { PIGraphicAtt gatt;
     100      return( ElAdd(PIDEL_FCirc, x, y, 0., 360., NULL, gatt, 0, fgsc, r) ); } 
    97101  inline int    ElAddFCirc(double x, double y, double r,
    98102                           PIGraphicAtt const & gatt, bool fgsc=false)
    99     { return( ElAdd(PIDEL_FCirc, x, y, r, r, NULL, gatt, 0, fgsc) ); } 
    100 
    101   // ---- Ajout d' arcs
     103    { return( ElAdd(PIDEL_FCirc, x, y, 0., 360., NULL, gatt, 0, fgsc, r) ); } 
     104
     105  // ---- Ajout d' arcs specifies par deux angles
     106  inline int    ElAddArc(double x, double y, double r,
     107                         double a, double da, bool fgsc=false)
     108    { PIGraphicAtt gatt;
     109      return( ElAdd(PIDEL_Arc, x, y, a, da, NULL, gatt, 0, fgsc, r) ); } 
     110  inline int    ElAddArc(double x, double y, double r, double a, double da,
     111                         PIGraphicAtt const & gatt, bool fgsc=false)
     112    { return( ElAdd(PIDEL_Arc, x, y, a, da, NULL, gatt, 0, fgsc, r) ); } 
     113
     114  inline int    ElAddFArc(double x, double y, double r,
     115                          double a, double da, bool fgsc=false)
     116    { PIGraphicAtt gatt;
     117      return( ElAdd(PIDEL_FArc, x, y, a, da, NULL, gatt, 0, fgsc, r) ); } 
     118  inline int    ElAddFArc(double x, double y, double r, double a, double da,
     119                          PIGraphicAtt const & gatt, bool fgsc=false)
     120    { return( ElAdd(PIDEL_FArc, x, y, a, da, NULL, gatt, 0, fgsc, r) ); } 
     121
     122  // ---- Ajout d' arcs specifies par 3 points
    102123  inline int    ElAddArc(double x1, double y1, double x2, double y2,
    103124                         double x3, double y3, bool fgsc=false)
     
    105126      x[0] = x1; x[1] = x2; x[2] = x3;
    106127      y[0] = y1; y[1] = y2; y[2] = y3;
    107       return( ElAdd(PIDEL_Arc, x, y, 3, gatt, fgsc) ); } 
     128      return( ElAdd(PIDEL_Arc3P, x, y, 3, gatt, fgsc) ); } 
    108129
    109130  inline int    ElAddArc(double x1, double y1, double x2, double y2,
     
    112133      x[0] = x1; x[1] = x2; x[2] = x3;
    113134      y[0] = y1; y[1] = y2; y[2] = y3;
    114       return( ElAdd(PIDEL_Arc, x, y, 3, gatt, fgsc) ); } 
     135      return( ElAdd(PIDEL_Arc3P, x, y, 3, gatt, fgsc) ); } 
    115136
    116137  inline int    ElAddFArc(double x1, double y1, double x2, double y2,
     
    119140      x[0] = x1; x[1] = x2; x[2] = x3;
    120141      y[0] = y1; y[1] = y2; y[2] = y3;
    121       return( ElAdd(PIDEL_FArc, x, y, 3, gatt, fgsc) ); } 
     142      return( ElAdd(PIDEL_FArc3P, x, y, 3, gatt, fgsc) ); } 
    122143
    123144  inline int    ElAddFArc(double x1, double y1, double x2, double y2,
     
    126147      x[0] = x1; x[1] = x2; x[2] = x3;
    127148      y[0] = y1; y[1] = y2; y[2] = y3;
    128       return( ElAdd(PIDEL_FArc, x, y, 3, gatt, fgsc) ); } 
     149      return( ElAdd(PIDEL_FArc3P, x, y, 3, gatt, fgsc) ); } 
    129150
    130151  // ---- Ajout de polygones
     
    149170  int                ElAdd(int typ, double x, double y, double dx, double dy,
    150171                           const char* s, PIGraphicAtt const & att,
    151                            unsigned long txtposdir, bool fgsc);
     172                           unsigned long txtposdir, bool fgsc, double r=0.);
    152173  int                ElAdd(double x, double y, const char* s, PIGraphicAtt const & att,
    153174                           const char* s_up, const char* s_dn, PIGraphicAtt const * gass,
     
    169190  struct DrwEl{
    170191    int eid, etyp;
    171     double ex,ey;
     192    double ex,ey,er;
    172193    double edx,edy;
    173194    PIGraphicAtt gatt;
     
    176197    PIGrCoord* ypol;
    177198    int npol;
    178     bool scc;  // true -> scale coordinate (user-coord : 0..1 1
     199    bool scc;  // true -> normalized coordinates ( 0..1 )
    179200  };
    180201
     
    184205 
    185206};
     207
     208/*  ------------------- Classe PIElDrawer ------------------------  */
     209// Classe de Drawer capable de gerer une liste d'elements a tracer
    186210
    187211class PIElDrawer : public PIDrawer
  • trunk/SophyaPI/PI/pigraphuc.cc

    r2257 r2264  
    638638  UC2GrC(x0, y0, xf, yf);
    639639  DUC2GrC(dx, dy, dxf, dyf);
     640  // $CHECK$ - Reza Nov 2002 , Il faudra aussi tenir compte de l'axe X
     641  if (!isAxeYDirUpDown()) degdeb = 360.-(degdeb+deltadeg);
    640642  mGrC->DrawArc(xf, yf, dxf, dyf, degdeb, deltadeg);
    641643}
     
    649651  UC2GrC(x0, y0, xf, yf);
    650652  DUC2GrC(dx, dy, dxf, dyf);
     653  // $CHECK$ - Reza Nov 2002 , Il faudra aussi tenir compte de l'axe X
     654  if (!isAxeYDirUpDown()) degdeb = 360.-(degdeb+deltadeg);
    651655  mGrC->DrawFArc(xf, yf, dxf, dyf, degdeb, deltadeg);
    652656}
Note: See TracChangeset for help on using the changeset viewer.