Changeset 2262 in Sophya for trunk/SophyaPI/PI/pieldrw.h


Ignore:
Timestamp:
Nov 14, 2002, 8:10:05 PM (23 years ago)
Author:
ansari
Message:
  • Suite (et Fin ?) trace arc a partir de 3 points
  • Amelioration de PIElDrawer, en particulier possibilite de specifier des coordonnees normalisee entre 0 et 1, CompositeText, Polygones, ...
  • Ajout <Alt>E pour suppression dernier element graphique ajoute

Reza 14/11/2002

File:
1 edited

Legend:

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

    r2242 r2262  
    2727
    2828  // ---- Ajout de lignes
    29   inline int    ElAddLine(PIGrCoord x1, PIGrCoord y1, PIGrCoord x2, PIGrCoord y2)
    30     { PIGraphicAtt gatt; return( ElAdd(PIDEL_Line, x1, y1, x2, y2, NULL, gatt) ); } 
    31   inline int    ElAddLine(PIGrCoord x1, PIGrCoord y1, PIGrCoord x2, PIGrCoord y2,
    32                           PIGraphicAtt const & gatt)
    33     { return( ElAdd(PIDEL_Line, x1, y1, x2, y2, NULL, gatt) ); } 
     29  inline int    ElAddLine(double x1, double y1, double x2, double y2, bool fgsc=false)
     30    { PIGraphicAtt gatt; return( ElAdd(PIDEL_Line, x1, y1, x2, y2, NULL, gatt, 0, fgsc) ); } 
     31  inline int    ElAddLine(double x1, double y1, double x2, double y2,
     32                          PIGraphicAtt const & gatt, bool fgsc=false)
     33    { return( ElAdd(PIDEL_Line, x1, y1, x2, y2, NULL, gatt, 0, fgsc) ); } 
    3434
    3535  // ---- Ajout de fleches
    36   inline int    ElAddArrow(PIGrCoord x1, PIGrCoord y1, PIGrCoord x2, PIGrCoord y2)
    37     { PIGraphicAtt gatt; return( ElAdd(PIDEL_Arrow, x1, y1, x2, y2, NULL, gatt) ); } 
    38   inline int    ElAddArrow(PIGrCoord x1, PIGrCoord y1, PIGrCoord x2, PIGrCoord y2,
    39                            PIGraphicAtt const & gatt)
    40     { return( ElAdd(PIDEL_Arrow, x1, y1, x2, y2, NULL, gatt) ); } 
     36  inline int    ElAddArrow(double x1, double y1, double x2, double y2, bool fgsc=false)
     37    { PIGraphicAtt gatt; return( ElAdd(PIDEL_Arrow, x1, y1, x2, y2, NULL, gatt, 0, fgsc) ); } 
     38  inline int    ElAddArrow(double x1, double y1, double x2, double y2,
     39                           PIGraphicAtt const & gatt, bool fgsc=false)
     40    { return( ElAdd(PIDEL_Arrow, x1, y1, x2, y2, NULL, gatt, 0, fgsc) ); } 
    4141
    4242  // ---- Ajout de marker
    43   inline int    ElAddMarker(PIGrCoord x, PIGrCoord y)
    44     { PIGraphicAtt gatt; return( ElAdd(PIDEL_Circ, x, y, 0, 0, NULL, gatt) ); } 
    45   inline int    ElAddMarker(PIGrCoord x, PIGrCoord y, PIGraphicAtt const & gatt)
    46     { return( ElAdd(PIDEL_Mark, x, y, 0, 0, NULL, gatt) ); } 
     43  inline int    ElAddMarker(double x, double y, bool fgsc=false)
     44    { PIGraphicAtt gatt; return( ElAdd(PIDEL_Circ, x, y, 0, 0, NULL, gatt, 0, fgsc) ); } 
     45  inline int    ElAddMarker(double x, double y, PIGraphicAtt const & gatt, bool fgsc=false)
     46    { return( ElAdd(PIDEL_Mark, x, y, 0, 0, NULL, gatt, 0, fgsc) ); } 
    4747
    4848  // ---- Ajout de texte
    49   inline int    ElAddText(PIGrCoord x, PIGrCoord y, const char* s)
    50     { PIGraphicAtt gatt; return( ElAdd(PIDEL_Text, x, y, 0, 0, s, gatt) ); } 
    51   inline int    ElAddText(PIGrCoord x, PIGrCoord y, const char* s,
    52                           PIGraphicAtt const & gatt, unsigned long tpd)
    53     { return( ElAdd(PIDEL_Text, x, y, 0, 0, s, gatt, tpd) ); } 
    54   inline int    ElAddText(PIGrCoord x, PIGrCoord y, string const & s)
    55     { PIGraphicAtt gatt; return( ElAdd(PIDEL_Text, x, y, 0, 0, s.c_str(), gatt) ); } 
    56   inline int    ElAddText(PIGrCoord x, PIGrCoord y, string const & s,
    57                           PIGraphicAtt const & gatt, unsigned long tpd)
    58     { return( ElAdd(PIDEL_Text, x, y, 0, 0, s.c_str(), gatt, tpd) ); } 
     49  inline int    ElAddText(double x, double y, const char* s, bool fgsc=false)
     50    { PIGraphicAtt gatt; return( ElAdd(PIDEL_Text, x, y, 0, 0, s, gatt, 0, fgsc) ); } 
     51  inline int    ElAddText(double x, double y, const char* s,
     52                          PIGraphicAtt const & gatt, unsigned long tpd, bool fgsc=false)
     53    { return( ElAdd(PIDEL_Text, x, y, 0, 0, s, gatt, tpd, fgsc) ); } 
     54  inline int    ElAddText(double x, double y, string const & s, bool fgsc=false)
     55    { PIGraphicAtt gatt; return( ElAdd(PIDEL_Text, x, y, 0, 0, s.c_str(), gatt, 0, fgsc) ); } 
     56  inline int    ElAddText(double x, double y, string const & s,
     57                          PIGraphicAtt const & gatt, unsigned long tpd, bool fgsc=false)
     58    { return( ElAdd(PIDEL_Text, x, y, 0, 0, s.c_str(), gatt, tpd, fgsc) ); } 
     59
     60  // ---- Ajout de texte composite avec exposant - indice
     61  inline int    ElAddCompText(double x, double y, string const& s, string const& s_up,
     62                              string const& s_dn, unsigned long tpd=0, bool fgsc=false)
     63    { PIGraphicAtt gatt;
     64      return( ElAdd(x, y, s.c_str(), gatt, s_up.c_str(), s_dn.c_str(), NULL, tpd, fgsc) ); }
     65  inline int    ElAddCompText(double x, double y, string const& s, PIGraphicAtt const & gatt,
     66                              string const& s_up, string const& s_dn,
     67                              unsigned long tpd=0, bool fgsc=false)
     68    { return( ElAdd(x, y, s.c_str(), gatt, s_up.c_str(), s_dn.c_str(), NULL, tpd, fgsc) ); }
     69  inline int    ElAddCompText(double x, double y, string const& s, PIGraphicAtt const & gatt,
     70                              string const& s_up, string const& s_dn, PIGraphicAtt const & attss,
     71                              unsigned long tpd=0, bool fgsc=false)
     72    { return( ElAdd(x, y, s.c_str(), gatt, s_up.c_str(), s_dn.c_str(), &attss, tpd, fgsc) ); }
     73 
    5974
    6075  // ---- Ajout de rectangles
    61   inline int    ElAddRect(PIGrCoord x, PIGrCoord y, PIGrCoord dx, PIGrCoord dy)
    62     { PIGraphicAtt gatt; return( ElAdd(PIDEL_Rect, x, y, dx, dy, NULL, gatt) ); } 
    63   inline int    ElAddRect(PIGrCoord x, PIGrCoord y, PIGrCoord dx, PIGrCoord dy,
    64                           PIGraphicAtt const & gatt)
    65     { return( ElAdd(PIDEL_Rect, x, y, dx, dy, NULL, gatt) ); } 
    66 
    67   inline int    ElAddFRect(PIGrCoord x, PIGrCoord y, PIGrCoord dx, PIGrCoord dy)
    68     { PIGraphicAtt gatt; return( ElAdd(PIDEL_FRect, x, y, dx, dy, NULL, gatt) ); } 
    69   inline int    ElAddFRect(PIGrCoord x, PIGrCoord y, PIGrCoord dx, PIGrCoord dy,
    70                            PIGraphicAtt const & gatt)
    71     { return( ElAdd(PIDEL_FRect, x, y, dx, dy, NULL, gatt) ); } 
     76  inline int    ElAddRect(double x, double y, double dx, double dy, bool fgsc=false)
     77    { PIGraphicAtt gatt; return( ElAdd(PIDEL_Rect, x, y, dx, dy, NULL, gatt, 0, fgsc) ); } 
     78  inline int    ElAddRect(double x, double y, double dx, double dy,
     79                          PIGraphicAtt const & gatt, bool fgsc=false)
     80    { return( ElAdd(PIDEL_Rect, x, y, dx, dy, NULL, gatt, 0, fgsc) ); } 
     81
     82  inline int    ElAddFRect(double x, double y, double dx, double dy, bool fgsc=false)
     83    { PIGraphicAtt gatt; return( ElAdd(PIDEL_FRect, x, y, dx, dy, NULL, gatt, 0, fgsc) ); } 
     84  inline int    ElAddFRect(double x, double y, double dx, double dy,
     85                           PIGraphicAtt const & gatt, bool fgsc=false)
     86    { return( ElAdd(PIDEL_FRect, x, y, dx, dy, NULL, gatt, 0, fgsc) ); } 
    7287
    7388  // ---- Ajout de cercles
    74   inline int    ElAddCirc(PIGrCoord x, PIGrCoord y, PIGrCoord r)
    75     { PIGraphicAtt gatt; return( ElAdd(PIDEL_Circ, x, y, r, r, NULL, gatt) ); } 
    76   inline int    ElAddCirc(PIGrCoord x, PIGrCoord y, PIGrCoord r, PIGraphicAtt const & gatt)
    77     { return( ElAdd(PIDEL_Circ, x, y, r, r, NULL, gatt) ); } 
    78 
    79   inline int    ElAddFCirc(PIGrCoord x, PIGrCoord y, PIGrCoord r)
    80     { PIGraphicAtt gatt; return( ElAdd(PIDEL_FCirc, x, y, r, r, NULL, gatt) ); } 
    81   inline int    ElAddFCirc(PIGrCoord x, PIGrCoord y, PIGrCoord r, PIGraphicAtt const & gatt)
    82     { return( ElAdd(PIDEL_FCirc, x, y, r, r, NULL, gatt) ); } 
     89  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) ); } 
     91  inline int    ElAddCirc(double x, double y, double r,
     92                          PIGraphicAtt const & gatt, bool fgsc=false)
     93    { return( ElAdd(PIDEL_Circ, x, y, r, r, NULL, gatt, 0, fgsc) ); } 
     94
     95  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) ); } 
     97  inline int    ElAddFCirc(double x, double y, double r,
     98                           PIGraphicAtt const & gatt, bool fgsc=false)
     99    { return( ElAdd(PIDEL_FCirc, x, y, r, r, NULL, gatt, 0, fgsc) ); } 
    83100
    84101  // ---- Ajout d' arcs
    85   inline int    ElAddArc(PIGrCoord x1, PIGrCoord y1, PIGrCoord x2, PIGrCoord y2,
    86                          PIGrCoord x3, PIGrCoord y3)
    87     { PIGraphicAtt gatt; PIGrCoord x[3], y[3];
    88       x[0] = x1; x[1] = x2; x[2] = x3;
    89       y[0] = y1; y[1] = y2; y[2] = y3;
    90       return( ElAdd(PIDEL_Arc, x, y, 3, gatt) ); } 
    91 
    92   inline int    ElAddArc(PIGrCoord x1, PIGrCoord y1, PIGrCoord x2, PIGrCoord y2,
    93                          PIGrCoord x3, PIGrCoord y3, PIGraphicAtt const & gatt)
    94     { PIGrCoord x[3], y[3];
    95       x[0] = x1; x[1] = x2; x[2] = x3;
    96       y[0] = y1; y[1] = y2; y[2] = y3;
    97       return( ElAdd(PIDEL_Arc, x, y, 3, gatt) ); } 
    98 
    99   inline int    ElAddFArc(PIGrCoord x1, PIGrCoord y1, PIGrCoord x2, PIGrCoord y2,
    100                           PIGrCoord x3, PIGrCoord y3)
    101     { PIGraphicAtt gatt; PIGrCoord x[3], y[3];
    102       x[0] = x1; x[1] = x2; x[2] = x3;
    103       y[0] = y1; y[1] = y2; y[2] = y3;
    104       return( ElAdd(PIDEL_FArc, x, y, 3, gatt) ); } 
    105 
    106   inline int    ElAddFArc(PIGrCoord x1, PIGrCoord y1, PIGrCoord x2, PIGrCoord y2,
    107                           PIGrCoord x3, PIGrCoord y3, PIGraphicAtt const & gatt)
    108     { PIGrCoord x[3], y[3];
    109       x[0] = x1; x[1] = x2; x[2] = x3;
    110       y[0] = y1; y[1] = y2; y[2] = y3;
    111       return( ElAdd(PIDEL_FArc, x, y, 3, gatt) ); } 
     102  inline int    ElAddArc(double x1, double y1, double x2, double y2,
     103                         double x3, double y3, bool fgsc=false)
     104    { PIGraphicAtt gatt; double x[3], y[3];
     105      x[0] = x1; x[1] = x2; x[2] = x3;
     106      y[0] = y1; y[1] = y2; y[2] = y3;
     107      return( ElAdd(PIDEL_Arc, x, y, 3, gatt, fgsc) ); } 
     108
     109  inline int    ElAddArc(double x1, double y1, double x2, double y2,
     110                         double x3, double y3, PIGraphicAtt const & gatt, bool fgsc=false)
     111    { double x[3], y[3];
     112      x[0] = x1; x[1] = x2; x[2] = x3;
     113      y[0] = y1; y[1] = y2; y[2] = y3;
     114      return( ElAdd(PIDEL_Arc, x, y, 3, gatt, fgsc) ); } 
     115
     116  inline int    ElAddFArc(double x1, double y1, double x2, double y2,
     117                          double x3, double y3, bool fgsc=false)
     118    { PIGraphicAtt gatt; double x[3], y[3];
     119      x[0] = x1; x[1] = x2; x[2] = x3;
     120      y[0] = y1; y[1] = y2; y[2] = y3;
     121      return( ElAdd(PIDEL_FArc, x, y, 3, gatt, fgsc) ); } 
     122
     123  inline int    ElAddFArc(double x1, double y1, double x2, double y2,
     124                          double x3, double y3, PIGraphicAtt const & gatt, bool fgsc=false)
     125    { double x[3], y[3];
     126      x[0] = x1; x[1] = x2; x[2] = x3;
     127      y[0] = y1; y[1] = y2; y[2] = y3;
     128      return( ElAdd(PIDEL_FArc, x, y, 3, gatt, fgsc) ); } 
    112129
    113130  // ---- Ajout de polygones
    114   inline int    ElAddPoly(vector<PIGrCoord>& x, vector<PIGrCoord>& y)
    115     { PIGraphicAtt gatt; return( ElAdd(PIDEL_Poly, x, y, gatt) ); } 
    116   inline int    ElAddPoly(vector<PIGrCoord>& x, vector<PIGrCoord>& y, PIGraphicAtt const & gatt)
    117     { return( ElAdd(PIDEL_Poly, x, y, gatt) ); }
     131  inline int    ElAddPoly(vector<double>& x, vector<double>& y, bool fgsc=false)
     132    { PIGraphicAtt gatt; return( ElAdd(PIDEL_Poly, x, y, gatt, fgsc) ); } 
     133  inline int    ElAddPoly(vector<double>& x, vector<double>& y,
     134                          PIGraphicAtt const & gatt, bool fgsc=false)
     135    { return( ElAdd(PIDEL_Poly, x, y, gatt, fgsc) ); }
    118136 
    119   inline int    ElAddFPoly(vector<PIGrCoord>& x, vector<PIGrCoord>& y)
    120     { PIGraphicAtt gatt; return( ElAdd(PIDEL_FPoly, x, y, gatt) ); } 
    121   inline int    ElAddFPoly(vector<PIGrCoord>& x, vector<PIGrCoord>& y, PIGraphicAtt const & gatt)
    122 
    123     { return( ElAdd(PIDEL_FPoly, x, y, gatt) ); } 
     137  inline int    ElAddFPoly(vector<double>& x, vector<double>& y, bool fgsc=false)
     138    { PIGraphicAtt gatt; return( ElAdd(PIDEL_FPoly, x, y, gatt, fgsc) ); } 
     139  inline int    ElAddFPoly(vector<double>& x, vector<double>& y,
     140                           PIGraphicAtt const & gatt, bool fgsc=false)
     141
     142    { return( ElAdd(PIDEL_FPoly, x, y, gatt, fgsc) ); } 
    124143
    125144  void               ElDel(int id);
     145  inline void        ElDelLast() { ElDel(mEn); }
    126146  void               ElDelAll();
    127147
    128148protected:
    129   int                ElAdd(int typ, PIGrCoord x, PIGrCoord y, PIGrCoord dx, PIGrCoord dy,
     149  int                ElAdd(int typ, double x, double y, double dx, double dy,
    130150                           const char* s, PIGraphicAtt const & att,
    131                            unsigned long txtposdir=0);
    132   int                ElAdd(int typ, vector<PIGrCoord>& x, vector<PIGrCoord>& y,
    133                            PIGraphicAtt const & att);
    134   int                ElAdd(int typ, PIGrCoord* x, PIGrCoord* y, int n,
    135                            PIGraphicAtt const & att);
     151                           unsigned long txtposdir, bool fgsc);
     152  int                ElAdd(double x, double y, const char* s, PIGraphicAtt const & att,
     153                           const char* s_up, const char* s_dn, PIGraphicAtt const * gass,
     154                           unsigned long tpd, bool fgsc);
     155
     156  int                ElAdd(int typ, vector<double>& x, vector<double>& y,
     157                           PIGraphicAtt const & att, bool fgsc);
     158  int                ElAdd(int typ, double* x, double* y, int n,
     159                           PIGraphicAtt const & att, bool fgsc);
    136160
    137161  struct TxtEl {
    138162    string txt;
    139163    unsigned long txtpd;
     164    string* txt_up;
     165    string* txt_dn;
     166    PIGraphicAtt* attss;
    140167  };
    141168
    142169  struct DrwEl{
    143170    int eid, etyp;
    144     PIGrCoord ex,ey;
    145     PIGrCoord edx,edy;
     171    double ex,ey;
     172    double edx,edy;
    146173    PIGraphicAtt gatt;
    147174    TxtEl* es;
     
    149176    PIGrCoord* ypol;
    150177    int npol;
     178    bool scc;  // true -> scale coordinate (user-coord : 0..1 1
    151179  };
    152180
     
    160188{
    161189public:
    162                      PIElDrawer();
     190                     PIElDrawer(bool fgclip=true);
    163191  virtual           ~PIElDrawer();
    164192
     
    184212// -- Pour compatibilite avec l'interface precedente , Reza 08/2002
    185213  inline void        ElDel(int id) { eltsMgr.ElDel(id); }
     214  inline void        ElDelLast()   { eltsMgr.ElDelLast(); }
    186215  inline void        ElDelAll()    { eltsMgr.ElDelAll(); }
    187216 
    188   inline int         ElAddText(PIGrCoord x, PIGrCoord y, const char* s)
     217  inline int         ElAddText(double x, double y, const char* s)
    189218                                   { return eltsMgr.ElAddText(x, y, s); }
    190219
     
    197226  PIGraphicAtt labelAtt;       // Attributs graphiques de trace de label d'axes
    198227  bool showAxesLabels;         // Affichage des labels d'axes si true
    199 
     228  bool fgClip;                 // Si true, appel a PIGraphicUC::Clip() ds Draw()
    200229};
    201230
Note: See TracChangeset for help on using the changeset viewer.