Changeset 2262 in Sophya for trunk/SophyaPI
- Timestamp:
- Nov 14, 2002, 8:10:05 PM (23 years ago)
- Location:
- trunk/SophyaPI/PI
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PI/pi3ddrw.h
r2164 r2262 80 80 // -- Pour compatibilite avec l'interface precedente , Reza 08/2002 81 81 inline void ElDel(int id) { eltsMgr.ElDel(id); } 82 inline void ElDelLast() { eltsMgr.ElDelLast(); } 82 83 inline void ElDelAll() { eltsMgr.ElDelAll(); } 83 84 -
trunk/SophyaPI/PI/pi3dwdg.cc
r2164 r2262 37 37 // * <Alt>V : Copier/*Coller* Ajout du texte du buffer copier/coller 38 38 // sur l'objet à la position courante de la souris 39 // * <Alt>Z : Supprime les textes et signes ajoutés au dessin. 39 // * <Alt>Z : Supprime les élément graphiques ajoutés au dessin. 40 // * <Alt>E : Supprime le dernier élément graphique ajouté. 40 41 // * <Alt>A : Active/desactive l'affichage des axes 41 42 // * <Alt>R : Reinitialise la vue 3D (vue par défaut) et rafraichit le dessin. … … 236 237 if (key == 'V' || key == 'v') RequestSelection(); // Pour coller (copier/coller) 237 238 else if (key == 'Z' || key == 'z') { mBDrw->ElDelAll(); Refresh(); } // Pour supprimer tous les signes 239 else if (key == 'E' || key == 'e') { mBDrw->ElDelLast(); Refresh(); } // Pour supprimer le dernier element ajoute 238 240 else if (key == 'O' || key == 'o') { // fenetre des options de controle du drawer actif 239 241 PIDrawer* actdrw = GetActiveDrawer(); -
trunk/SophyaPI/PI/pieldrw.cc
r2260 r2262 47 47 ElDelAll(); 48 48 } 49 50 /* Des macros pour passer des coord normalise aux coord graphique */ 51 #define CN_To_CG_X(x) x0_g+dx_g*(double)x 52 #define CN_To_CG_Y(y) y0_g+dy_g*(double)y 53 #define D_CN_To_CG_X(x) dx_g*(double)x 54 #define D_CN_To_CG_Y(y) dy_g*(double)y 55 #define CN_To_CG_R(r) 0.5*(dx_g+dy_g)*(double)r 56 49 57 /* --Methode-- */ 50 58 //++ … … 55 63 DrwElList::iterator it; 56 64 g->SaveGraphicAtt(); 65 66 PIGrCoord x1g,x2g,y1g,y2g,xg,yg; 67 double x0_g, dx_g, y0_g, dy_g; 68 g->GetGrSpace(x1g,x2g,y1g,y2g); 69 x0_g = x1g; y0_g = y1g; 70 dx_g = (double)x2g-(double)x1g; 71 dy_g = (double)y2g-(double)y1g; 72 57 73 for (it = mElist.begin(); it != mElist.end(); it++) 58 74 { … … 75 91 { 76 92 case PIDEL_Line : 77 g->DrawLine((*it).ex, (*it).ey, (*it).edx, (*it).edy ); 93 if ((*it).scc) // Coord specifie normalise 0..1 94 g->DrawLine(CN_To_CG_X((*it).ex), CN_To_CG_Y((*it).ey), 95 D_CN_To_CG_X((*it).edx), D_CN_To_CG_Y((*it).edy) ); 96 else g->DrawLine((*it).ex, (*it).ey, (*it).edx, (*it).edy ); 78 97 break; 79 98 case PIDEL_Mark : 80 g->DrawMarker((*it).ex, (*it).ey); 99 if ((*it).scc) // Coord specifie normalise 0..1 100 g->DrawMarker(CN_To_CG_X((*it).ex), CN_To_CG_Y((*it).ey)); 101 else g->DrawMarker((*it).ex, (*it).ey); 81 102 break; 82 103 case PIDEL_Arrow : 83 g->DrawArrowMarker((*it).ex, (*it).ey, (*it).edx, (*it).edy, true); 104 if ((*it).scc) // Coord specifie normalise 0..1 105 g->DrawArrowMarker(CN_To_CG_X((*it).ex), CN_To_CG_Y((*it).ey), 106 D_CN_To_CG_X((*it).edx), D_CN_To_CG_Y((*it).edy) ); 107 else g->DrawArrowMarker((*it).ex, (*it).ey, (*it).edx, (*it).edy, true); 84 108 break; 85 109 case PIDEL_Text : 86 g->DrawString((*it).ex, (*it).ey, ((*it).es->txt.c_str()), (*it).es->txtpd ); 110 if ((*it).scc) // Coord specifie normalise 0..1 111 g->DrawString(CN_To_CG_X((*it).ex), CN_To_CG_Y((*it).ey), 112 ((*it).es->txt.c_str()), (*it).es->txtpd ); 113 else g->DrawString((*it).ex, (*it).ey, ((*it).es->txt.c_str()), (*it).es->txtpd ); 114 break; 115 case PIDEL_CText : 116 if ((*it).scc) { // Coord specifie normalise 0..1 117 xg = CN_To_CG_X((*it).ex); 118 yg = CN_To_CG_Y((*it).ey); 119 } 120 else { 121 xg = (*it).ex; 122 yg = (*it).ey; 123 } 124 if ((*it).es->attss) 125 g->DrawCompString(xg, yg, (*it).es->txt.c_str(), (*it).es->txt_up->c_str(), 126 (*it).es->txt_dn->c_str(), (*it).es->attss->GetFont(), 127 (*it).es->txtpd ); 128 else 129 g->DrawCompString(xg, yg, (*it).es->txt.c_str(), (*it).es->txt_up->c_str(), 130 (*it).es->txt_dn->c_str(), (*it).es->txtpd ); 131 87 132 break; 88 133 case PIDEL_Rect : 89 g->DrawBox((*it).ex, (*it).ey, (*it).edx, (*it).edy ); 134 if ((*it).scc) // Coord specifie normalise 0..1 135 g->DrawBox(CN_To_CG_X((*it).ex), CN_To_CG_Y((*it).ey), 136 D_CN_To_CG_X((*it).edx), D_CN_To_CG_Y((*it).edy) ); 137 else g->DrawBox((*it).ex, (*it).ey, (*it).edx, (*it).edy ); 90 138 break; 91 139 case PIDEL_FRect : 92 g->DrawFBox((*it).ex, (*it).ey, (*it).edx, (*it).edy ); 140 if ((*it).scc) // Coord specifie normalise 0..1 141 g->DrawFBox(CN_To_CG_X((*it).ex), CN_To_CG_Y((*it).ey), 142 D_CN_To_CG_X((*it).edx), D_CN_To_CG_Y((*it).edy) ); 143 else g->DrawFBox((*it).ex, (*it).ey, (*it).edx, (*it).edy ); 93 144 break; 94 145 case PIDEL_Circ : 95 g->DrawCircle((*it).ex, (*it).ey, (*it).edx ); 146 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 ); 96 149 break; 97 150 case PIDEL_FCirc : 98 g->DrawFCircle((*it).ex, (*it).ey, (*it).edx ); 151 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 ); 99 154 break; 100 155 case PIDEL_Arc : 101 g->Draw3PtArc((*it).xpol[0], (*it).ypol[0], (*it).xpol[1], 102 (*it).ypol[1], (*it).xpol[2], (*it).ypol[2] ); 156 if ((*it).scc) // Coord specifie normalise 0..1 157 g->Draw3PtArc(CN_To_CG_X((*it).xpol[0]), CN_To_CG_X((*it).xpol[1]), 158 CN_To_CG_X((*it).xpol[2]), CN_To_CG_Y((*it).ypol[0]), 159 CN_To_CG_Y((*it).ypol[1]), CN_To_CG_Y((*it).ypol[1]) ); 160 else g->Draw3PtArc((*it).xpol[0], (*it).ypol[0], (*it).xpol[1], 161 (*it).ypol[1], (*it).xpol[2], (*it).ypol[2] ); 103 162 break; 104 163 case PIDEL_FArc : 105 g->Draw3PtFArc((*it).xpol[0], (*it).ypol[0], (*it).xpol[1], 106 (*it).ypol[1], (*it).xpol[2], (*it).ypol[2] ); 164 if ((*it).scc) // Coord specifie normalise 0..1 165 g->Draw3PtFArc(CN_To_CG_X((*it).xpol[0]), CN_To_CG_X((*it).xpol[1]), 166 CN_To_CG_X((*it).xpol[2]), CN_To_CG_Y((*it).ypol[0]), 167 CN_To_CG_Y((*it).ypol[1]), CN_To_CG_Y((*it).ypol[1]) ); 168 else g->Draw3PtFArc((*it).xpol[0], (*it).ypol[0], (*it).xpol[1], 169 (*it).ypol[1], (*it).xpol[2], (*it).ypol[2] ); 107 170 break; 108 171 case PIDEL_Poly : 109 g->DrawPolygon((*it).xpol, (*it).ypol, (*it).npol, false );110 break;111 172 case PIDEL_FPoly : 112 g->DrawFPolygon((*it).xpol, (*it).ypol, (*it).npol, false ); 173 if ((*it).scc) { // Coord specifie normalise 0..1 174 PIGrCoord* grx = new PIGrCoord[(*it).npol]; 175 PIGrCoord* gry = new PIGrCoord[(*it).npol]; 176 for(int jk=0; jk<(*it).npol; jk++) { 177 grx[jk] = CN_To_CG_X((*it).xpol[jk]); 178 gry[jk] = CN_To_CG_Y((*it).ypol[jk]); 179 } 180 if ((*it).etyp == PIDEL_Poly) 181 g->DrawPolygon(grx, gry, (*it).npol, false ); 182 else g->DrawFPolygon(grx, gry, (*it).npol, false ); 183 delete[] grx; 184 delete[] gry; 185 } 186 else { 187 if ((*it).etyp == PIDEL_Poly) 188 g->DrawPolygon((*it).xpol, (*it).ypol, (*it).npol, false ); 189 else g->DrawFPolygon((*it).xpol, (*it).ypol, (*it).npol, false ); 190 } 113 191 break; 114 192 default : … … 120 198 121 199 //++ 122 // int ElAddText(PIGrCoord x, PIGrCoord y, const char* s) 123 // int ElAddText(PIGrCoord x, PIGrCoord y, const char* s, PIGraphicAtt gatt) 124 // int ElAddText(PIGrCoord x, PIGrCoord y, string const & s) 125 // int ElAddText(PIGrCoord x, PIGrCoord y, string const & s, PIGraphicAtt gatt) 126 // Ajout d'un élément texte (possibilité de spécification d'un attribut graphique). 200 // int ElAddText(double x, double y, const char* s, bool fgsc=false) 201 // int ElAddText(double x, double y, const char* s, PIGraphicAtt gatt, \ 202 // unsigned long tpd, bool fgsc=false) 203 // int ElAddText(double x, double y, string const & s, bool fgsc=false) 204 // int ElAddText(double x, double y, string const & s, PIGraphicAtt gatt, \ 205 // unsigned long tpd, bool fgsc=false) 206 // Ajout d'un élément texte (possibilité de spécification d'un attribut graphique 207 // et d'un attribut de direction et de positionnement de texte "tpd"). 208 // si "fgsc==true", coordonnées spécifiées considerées normalisées entre 0 et 1. 127 209 // Renvoie le numéro identificateur de l'élément. 128 210 // 129 // int ElAddLine(PIGrCoord x1, PIGrCoord y1, PIGrCoord x2, PIGrCoord y2) 130 // int ElAddLine(PIGrCoord x1, PIGrCoord y1, PIGrCoord x2, PIGrCoord y2, PIGraphicAtt gatt) 211 // int ElAddCompText(double x, double y, string const& s, PIGraphicAtt const & gatt, \ 212 // string const& s_up, string const& s_dn, \ 213 // unsigned long tpd=0, bool fgsc=false) 214 // int ElAddCompText(double x, double y, string const& s, PIGraphicAtt const & gatt, \ 215 // string const& s_up, string const& s_dn, \ 216 // unsigned long tpd=0, bool fgsc=false) 217 // int ElAddCompText(double x, double y, string const& s, PIGraphicAtt const & gatt, \ 218 // string const& s_up, string const& s_dn, PIGraphicAtt const & attss, \ 219 // unsigned long tpd=0, bool fgsc=false) 220 // Ajout d'un élément texte avec exposant ("s_up") et indice ("s_dn"). 221 // Il est possible de spécifier un attribut graphique ("gatt"), attribut de 222 // de direction et de positionnement de texte ("tpd"), ainsi qu'un attribut graphique 223 // (fonte en particulier) pour le texte en exposant/indice ("attss"). 224 // si "fgsc==true", coordonnées spécifiées considerées normalisées entre 0 et 1. 225 // Renvoie le numéro identificateur de l'élément. 226 // 227 // int ElAddLine(double x1, double y1, double x2, double y2, bool fgsc=false) 228 // int ElAddLine(double x1, double y1, double x2, double y2, PIGraphicAtt gatt, bool fgsc=false) 131 229 // Ajout d'un élément de ligne (possibilité de spécification d'un attribut graphique). 230 // si "fgsc==true", coordonnées spécifiées considerées normalisées entre 0 et 1. 132 231 // Renvoie le numéro identificateur de l'élément. 133 232 // 134 // int ElAddRect( PIGrCoord x, PIGrCoord y, PIGrCoord dx, PIGrCoord dy)135 // int ElAddRect( PIGrCoord x, PIGrCoord y, PIGrCoord dx, PIGrCoord dy, PIGraphicAtt gatt)233 // int ElAddRect(double x, double y, double dx, double dy, bool fgsc=false) 234 // int ElAddRect(double x, double y, double dx, double dy, PIGraphicAtt gatt, bool fgsc=false) 136 235 // Ajout d'un élément de type rectangle (possibilité de spécification d'un attribut graphique). 137 // Renvoie le numéro identificateur de l'élément. 138 // 139 // int ElAddFRect(PIGrCoord x, PIGrCoord y, PIGrCoord dx, PIGrCoord dy) 140 // int ElAddFRect(PIGrCoord x, PIGrCoord y, PIGrCoord dx, PIGrCoord dy, PIGraphicAtt gatt) 236 // si "fgsc==true", coordonnées spécifiées considerées normalisées entre 0 et 1. 237 // Renvoie le numéro identificateur de l'élément. 238 // 239 // int ElAddFRect(double x, double y, double dx, double dy, bool fgsc=false) 240 // int ElAddFRect(double x, double y, double dx, double dy, PIGraphicAtt gatt, bool fgsc=false) 141 241 // Ajout d'un élément de type rectangle plein 142 242 // (possibilité de spécification d'un attribut graphique). 143 // Renvoie le numéro identificateur de l'élément. 144 // 145 // int ElAddCirc(PIGrCoord x, PIGrCoord y, PIGrCoord r) 146 // int ElAddCirc(PIGrCoord x, PIGrCoord y, PIGrCoord r, PIGraphicAtt gatt) 243 // si "fgsc==true", coordonnées spécifiées considerées normalisées entre 0 et 1. 244 // Renvoie le numéro identificateur de l'élément. 245 // 246 // int ElAddCirc(double x, double y, double r, bool fgsc=false) 247 // int ElAddCirc(double x, double y, double r, PIGraphicAtt gatt, bool fgsc=false) 147 248 // Ajout d'un élément de type cercle (possibilité de spécification d'un attribut graphique). 148 // Renvoie le numéro identificateur de l'élément. 149 // 150 // int ElAddFCirc(PIGrCoord x, PIGrCoord y, PIGrCoord r) 151 // int ElAddFCirc(PIGrCoord x, PIGrCoord y, PIGrCoord r, PIGraphicAtt gatt) 249 // si "fgsc==true", coordonnées spécifiées considerées normalisées entre 0 et 1. 250 // Renvoie le numéro identificateur de l'élément. 251 // 252 // int ElAddFCirc(double x, double y, double r, bool fgsc=false) 253 // int ElAddFCirc(double x, double y, double r, PIGraphicAtt gatt, bool fgsc=false) 152 254 // Ajout d'un élément de type cercle plein avec un attribut de couleur. 153 // Renvoie le numéro identificateur de l'élément. 154 // 155 // int ElAddArc(PIGrCoord x1, PIGrCoord y1, PIGrCoord x2, PIGrCoord y2 \ 156 // PIGrCoord x3, PIGrCoord y3) 157 // int ElAddArc(PIGrCoord x1, PIGrCoord y1, PIGrCoord x2, PIGrCoord y2 \ 158 // PIGrCoord x3, PIGrCoord y3, PIGraphicAtt gatt) 255 // si "fgsc==true", coordonnées spécifiées considerées normalisées entre 0 et 1. 256 // Renvoie le numéro identificateur de l'élément. 257 // 258 // int ElAddArc(double x1, double y1, double x2, double y2 \ 259 // double x3, double y3, bool fgsc=false) 260 // int ElAddArc(double x1, double y1, double x2, double y2 \ 261 // double x3, double y3, PIGraphicAtt gatt, bool fgsc=false) 159 262 // Ajout d'un élément de type arc défini par trois points 160 263 // (possibilité de spécification d'un attribut graphique). 161 // Renvoie le numéro identificateur de l'élément. 162 // 163 // int ElAddFArc(PIGrCoord x1, PIGrCoord y1, PIGrCoord x2, PIGrCoord y2 \ 164 // PIGrCoord x3, PIGrCoord y3) 165 // int ElAddFArc(PIGrCoord x1, PIGrCoord y1, PIGrCoord x2, PIGrCoord y2 \ 166 // PIGrCoord x3, PIGrCoord y3, PIGraphicAtt gatt) 264 // si "fgsc==true", coordonnées spécifiées considerées normalisées entre 0 et 1. 265 // Renvoie le numéro identificateur de l'élément. 266 // 267 // int ElAddFArc(double x1, double y1, double x2, double y2 \ 268 // double x3, double y3, bool fgsc=false) 269 // int ElAddFArc(double x1, double y1, double x2, double y2 \ 270 // double x3, double y3, PIGraphicAtt gatt, bool fgsc=false) 167 271 // Ajout d'un élément de type arc plein défini par trois points 168 272 // (possibilité de spécification d'un attribut graphique). 169 // Renvoie le numéro identificateur de l'élément. 170 // 171 // int ElAddPoly(vector<PIGrCoord>& x, vector<PIGrCoord>& y) 172 // int ElAddPoly(vector<PIGrCoord>& x, vector<PIGrCoord>& y, PIGraphicAtt gatt) 273 // si "fgsc==true", coordonnées spécifiées considerées normalisées entre 0 et 1. 274 // Renvoie le numéro identificateur de l'élément. 275 // 276 // int ElAddPoly(vector<double>& x, vector<double>& y, bool fgsc=false) 277 // int ElAddPoly(vector<double>& x, vector<double>& y, PIGraphicAtt gatt, bool fgsc=false) 173 278 // Ajout d'un élément de type polygone (possibilité de spécification d'un attribut graphique). 174 // Renvoie le numéro identificateur de l'élément. 175 // 176 // int ElAddFPoly(vector<PIGrCoord>& x, vector<PIGrCoord>& y) 177 // int ElAddFPoly(vector<PIGrCoord>& x, vector<PIGrCoord>& y, PIGraphicAtt gatt) 279 // si "fgsc==true", coordonnées spécifiées considerées normalisées entre 0 et 1. 280 // Renvoie le numéro identificateur de l'élément. 281 // 282 // int ElAddFPoly(vector<double>& x, vector<double>& y, bool fgsc=false) 283 // int ElAddFPoly(vector<double>& x, vector<double>& y, PIGraphicAtt gatt, bool fgsc=false) 178 284 // Ajout d'un élément de type polygone plein 179 285 // (possibilité de spécification d'un attribut graphique). 286 // si "fgsc==true", coordonnées spécifiées considerées normalisées entre 0 et 1. 180 287 // Renvoie le numéro identificateur de l'élément. 181 288 // 182 289 // void ElDel(int id) 183 290 // Suppression de l'élément avec l'identificateur "id". 291 // void ElDelLast() 292 // Suppression du dernier élément ajouté. 184 293 // void ElDelAll() 185 294 // Suppression de tous les éléments de l'objet. … … 188 297 189 298 /* --Methode-- */ 190 int PIElDrwMgr::ElAdd(int typ, PIGrCoord x, PIGrCoord y, PIGrCoord dx, PIGrCoorddy,191 const char* s, PIGraphicAtt const& att, unsigned long tpd )299 int PIElDrwMgr::ElAdd(int typ, double x, double y, double dx, double dy, 300 const char* s, PIGraphicAtt const& att, unsigned long tpd, bool fgsc) 192 301 { 193 302 DrwEl dre; … … 201 310 dre.es->txt = s; 202 311 dre.es->txtpd = tpd; 312 dre.es->txt_up = dre.es->txt_dn = NULL; 313 dre.es->attss = NULL; 203 314 } 204 315 else dre.es = NULL; 205 316 dre.xpol = dre.ypol = NULL; 206 317 dre.npol = 0; 318 dre.scc = fgsc; 207 319 mElist.push_back(dre); 208 320 return(mEn); … … 210 322 211 323 /* --Methode-- */ 212 int PIElDrwMgr::ElAdd(int typ, vector<PIGrCoord>& x, vector<PIGrCoord>& y, PIGraphicAtt const& att) 324 int PIElDrwMgr::ElAdd(double x, double y, const char* s, PIGraphicAtt const & att, const char* s_up, 325 const char* s_dn, PIGraphicAtt const * gass, unsigned long tpd, bool fgsc) 326 { 327 DrwEl dre; 328 mEn++; 329 dre.eid = mEn; dre.etyp = PIDEL_CText; 330 dre.ex = x; dre.ey = y; 331 dre.edx = 0; dre.edy = 0; 332 dre.gatt = att; 333 dre.es = new TxtEl; 334 if (s) dre.es->txt = s; 335 dre.es->txtpd = tpd; 336 dre.es->txt_up = new string; 337 if (s_up) *(dre.es->txt_up) = s_up; 338 dre.es->txt_dn = new string; 339 if (s_dn) *(dre.es->txt_dn) = s_dn; 340 if (gass) dre.es->attss = new PIGraphicAtt(*gass); 341 else dre.es->attss = NULL; 342 dre.xpol = dre.ypol = NULL; 343 dre.npol = 0; 344 dre.scc = fgsc; 345 mElist.push_back(dre); 346 return(mEn); 347 } 348 349 /* --Methode-- */ 350 int PIElDrwMgr::ElAdd(int typ, vector<double>& x, vector<double>& y, 351 PIGraphicAtt const& att, bool fgsc) 213 352 { 214 353 DrwEl dre; … … 229 368 } 230 369 } 370 dre.scc = fgsc; 231 371 mElist.push_back(dre); 232 372 return(mEn); … … 234 374 235 375 /* --Methode-- */ 236 int PIElDrwMgr::ElAdd(int typ, PIGrCoord* x, PIGrCoord* y, int n,237 PIGraphicAtt const & att )238 { 239 vector< PIGrCoord> vx, vy;376 int PIElDrwMgr::ElAdd(int typ, double* x, double* y, int n, 377 PIGraphicAtt const & att, bool fgsc) 378 { 379 vector<double> vx, vy; 240 380 for(int k=0; k<n; k++) { 241 381 vx.push_back(x[k]); 242 382 vy.push_back(y[k]); 243 383 } 244 return ( ElAdd(typ, vx, vy, att ) );384 return ( ElAdd(typ, vx, vy, att, fgsc) ); 245 385 } 246 386 … … 252 392 for (it = mElist.begin(); it != mElist.end(); it++) { 253 393 if ( (*it).eid == id) { 254 if ( (*it).es ) delete (*it).es; 394 if ( (*it).es ) { 395 if ( (*it).es->txt_up ) delete (*it).es->txt_up; 396 if ( (*it).es->txt_dn ) delete (*it).es->txt_dn; 397 if ( (*it).es->attss ) delete (*it).es->attss; 398 delete (*it).es; 399 } 255 400 if ( (*it).xpol ) delete[] (*it).xpol; 256 401 if ( (*it).ypol ) delete[] (*it).ypol; … … 306 451 307 452 //++ 308 // PIElDrawer() 309 // Constructeur 310 //-- 311 312 /* --Methode-- */ 313 PIElDrawer::PIElDrawer() 314 { 453 // PIElDrawer(bool fgclip=true) 454 // Constructeur - Si "fgclip=false", appel a PIGraphicUC::NoClip() ds Draw() 455 //-- 456 457 /* --Methode-- */ 458 PIElDrawer::PIElDrawer(bool fgclip) 459 { 460 fgClip = fgclip; 315 461 ShowTitles(); 316 462 ShowAxesLabels(); 317 463 } 318 464 … … 397 543 { 398 544 SelGraAtt(g); 399 g->NoClip(); // On ne clip pas les BaseDrawer - Reza Nov 2002 545 if (!fgClip) g->NoClip(); 400 546 DrawAxes(g); // Trace des axes 401 547 // g->SelFont(PI_NormalSizeFont); -
trunk/SophyaPI/PI/pieldrw.h
r2242 r2262 27 27 28 28 // ---- 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, PIGrCoordy2,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) ); } 34 34 35 35 // ---- 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, PIGrCoordy2,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) ); } 41 41 42 42 // ---- 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) ); } 47 47 48 48 // ---- 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 59 74 60 75 // ---- 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, PIGrCoorddy,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, PIGrCoorddy,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) ); } 72 87 73 88 // ---- 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) ); } 83 100 84 101 // ---- Ajout d' arcs 85 inline int ElAddArc( PIGrCoord x1, PIGrCoord y1, PIGrCoord x2, PIGrCoordy2,86 PIGrCoord x3, PIGrCoord y3)87 { PIGraphicAtt gatt; PIGrCoordx[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, PIGrCoordy2,93 PIGrCoord x3, PIGrCoord y3, PIGraphicAtt const & gatt)94 { PIGrCoordx[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, PIGrCoordy2,100 PIGrCoord x3, PIGrCoord y3)101 { PIGraphicAtt gatt; PIGrCoordx[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, PIGrCoordy2,107 PIGrCoord x3, PIGrCoord y3, PIGraphicAtt const & gatt)108 { PIGrCoordx[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) ); } 112 129 113 130 // ---- 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) ); } 118 136 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) ); } 124 143 125 144 void ElDel(int id); 145 inline void ElDelLast() { ElDel(mEn); } 126 146 void ElDelAll(); 127 147 128 148 protected: 129 int ElAdd(int typ, PIGrCoord x, PIGrCoord y, PIGrCoord dx, PIGrCoorddy,149 int ElAdd(int typ, double x, double y, double dx, double dy, 130 150 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); 136 160 137 161 struct TxtEl { 138 162 string txt; 139 163 unsigned long txtpd; 164 string* txt_up; 165 string* txt_dn; 166 PIGraphicAtt* attss; 140 167 }; 141 168 142 169 struct DrwEl{ 143 170 int eid, etyp; 144 PIGrCoordex,ey;145 PIGrCoordedx,edy;171 double ex,ey; 172 double edx,edy; 146 173 PIGraphicAtt gatt; 147 174 TxtEl* es; … … 149 176 PIGrCoord* ypol; 150 177 int npol; 178 bool scc; // true -> scale coordinate (user-coord : 0..1 1 151 179 }; 152 180 … … 160 188 { 161 189 public: 162 PIElDrawer( );190 PIElDrawer(bool fgclip=true); 163 191 virtual ~PIElDrawer(); 164 192 … … 184 212 // -- Pour compatibilite avec l'interface precedente , Reza 08/2002 185 213 inline void ElDel(int id) { eltsMgr.ElDel(id); } 214 inline void ElDelLast() { eltsMgr.ElDelLast(); } 186 215 inline void ElDelAll() { eltsMgr.ElDelAll(); } 187 216 188 inline int ElAddText( PIGrCoord x, PIGrCoordy, const char* s)217 inline int ElAddText(double x, double y, const char* s) 189 218 { return eltsMgr.ElAddText(x, y, s); } 190 219 … … 197 226 PIGraphicAtt labelAtt; // Attributs graphiques de trace de label d'axes 198 227 bool showAxesLabels; // Affichage des labels d'axes si true 199 228 bool fgClip; // Si true, appel a PIGraphicUC::Clip() ds Draw() 200 229 }; 201 230 -
trunk/SophyaPI/PI/pigraphgen.cc
r2258 r2262 7 7 #include "pigraphgen.h" 8 8 #include <math.h> 9 #include <iostream.h> 9 10 #include "ucckprot.h" 10 11 -
trunk/SophyaPI/PI/piimage.cc
r2235 r2262 46 46 // * <Alt>P : Active/désactive l'affichage de l'indicateur de la postion du pavé 47 47 // * <Alt>X : Active/désactive l'affichage des coupes X,Y 48 // * <Alt>Z : Supprime les textes et signes ajoutés au dessin. 48 // * <Alt>Z : Supprime les élément graphiques ajoutés au dessin. 49 // * <Alt>E : Supprime le dernier élément graphique ajouté. 49 50 // * <Alt>+ <Cntl>+ : Augmentation du facteur de zoom 50 51 // * <Alt>- <Cntl>- : Diminution du facteur de zoom … … 137 138 zmgv = 1; 138 139 139 mdrw = new PIElDrawer( );140 mdrw = new PIElDrawer(false); 140 141 gvdrw = new PIElDrawer(); 141 142 AddDrawer(mdrw, true, false, false); … … 700 701 else if (key == 'V' || key == 'v') RequestSelection(); // Pour coller (copier/coller) 701 702 else if (key == 'Z' || key == 'z') { mdrw->ElDelAll(); Refresh(); } // Pour supprimer tous les signes 703 else if (key == 'E' || key == 'e') { mdrw->ElDelLast(); Refresh(); } // Pour supprimer le dernier element ajoute 702 704 else if (key == 'O' || key == 'o') PIImgTools::ShowPIImgTools(); // Fentre LUT et options 703 705 else if (key == 'G' || key == 'g') { // Fentre attributs graphiques -
trunk/SophyaPI/PI/piscdrawwdg.cc
r2242 r2262 37 37 // sur l'objet à la position courante. 38 38 // * <Alt>I : Affiche et met a jour la fenetre Texte-Info . 39 // * <Alt>Z : Supprime les textes et signes ajoutés au dessin. 39 // * <Alt>Z : Supprime les élément graphiques ajoutés au dessin. 40 // * <Alt>E : Supprime le dernier élément graphique ajouté. 40 41 // * <Alt>P : fenetre des options de drawing des contours 41 42 //-- … … 87 88 mPosFDX = mPosFDY = 0; 88 89 89 mBDrw = new PIElDrawer ;90 mBDrw = new PIElDrawer(false); 90 91 mBDrw->SetName("AxesDrw"); 91 92 SetLimits(-1.,1.,-1.,1.,kAxeDirLtoR,kAxeDirDownUp); … … 134 135 else if (key == 'V' || key == 'v') RequestSelection(); // Pour coller (copier/coller) 135 136 else if (key == 'Z' || key == 'z') { mBDrw->ElDelAll(); Refresh(); } // Pour supprimer tous les signes 137 else if (key == 'E' || key == 'e') { mBDrw->ElDelLast(); Refresh(); } // Pour supprimer le dernier element ajoute 136 138 else if (key == 'O' || key == 'o') { // fenetre des options de controle du drawer actif 137 139 PIDrawer* actdrw = GetActiveDrawer(); -
trunk/SophyaPI/PI/piversion.h
r2242 r2262 2 2 #define PIVERSION_H_SEEN 3 3 4 #define PI_VERSIONNUMBER 3. 854 #define PI_VERSIONNUMBER 3.90 5 5 6 6 #endif
Note:
See TracChangeset
for help on using the changeset viewer.