Changeset 158 in Sophya
- Timestamp:
- Nov 16, 1998, 6:35:42 PM (27 years ago)
- Location:
- trunk/SophyaPI/PI
- Files:
-
- 31 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PI/pi3ddrw.cc
r155 r158 92 92 PIDraw3DWdg::PIDraw3DWdg(PIContainerGen *par, char *nom, int sx, int sy, int px, int py) 93 93 : PIBaseWdg(par, nom, sx, sy, px, py) 94 { 94 { 95 95 vfixed = false; 96 // SetDefaultDrawRectangle(0.12, 0.12, 0.88, 0.88, true); 96 97 SetDefaultDrawRectangle(0., 0., 1., 1., true); 98 mBDrw = new PIElDrawer; 99 mBDrw->SetLimits(0.12,0.88, 0.12,0.88, kAxeDirLtoR,kAxeDirDownUp); 100 AddDrawer(mBDrw, 0.12, 0.12, 0.88, 0.88, true, false, false); 101 mPx = mPy = 0; 97 102 98 103 lPx = lPy = 0; … … 100 105 cTeta = cPhi = 0.; cUlen = 1.; 101 106 107 ActivateKeyboard(); 102 108 ActivateButton(2); // Pour pouvoir tourner la camera 103 109 ActivateMove(2); … … 112 118 PIDraw3DWdg::~PIDraw3DWdg() 113 119 { 120 delete mBDrw; 114 121 delete mGr3d; 115 122 } … … 171 178 else Set3DView(xc, yc, zc, xo, yo, zo, dax, day, dco, psi); 172 179 Refresh(); 180 mBDrw->Refresh(); // ? Pour reecrire par-dessus ce qui a ete efface 173 181 } 174 182 … … 236 244 237 245 /* --Methode-- */ 246 void PIDraw3DWdg::Keyboard(int key, PIKeyModifier kmod) 247 { 248 if (kmod == PIKM_Alt) { 249 if (key == 'V' || key == 'v') RequestSelection(); // Pour coller (copier/coller) 250 if (key == 'Z' || key == 'z') { mBDrw->ElDelAll(); Refresh(); } // Pour supprimer tous les signes 251 if (key == 'O' || key == 'o') { 252 PIDrwTools::SetCurrentBaseWdg(this); 253 PIDrwTools::ShowPIDrwTools(); // Fentre axes et options de trace 254 } 255 } 256 } 257 /* --Methode-- */ 258 void PIDraw3DWdg::PasteSelection(unsigned int typ, void *pdata, unsigned int l) 259 { 260 if (typ != PICP_string) return; 261 int ll = (l<256) ? l+1 : 256; 262 char pc[256]; 263 strncpy(pc, (char*)pdata, ll-1); pc[ll-1] = '\0'; 264 // printf("PIDraw3DWdg::PasteSelection() / Debug %s - %d %d -> %g %g \n", pc, 265 // mPx, mPy, (float)mPx/(float)XSize(), 1.-(float)mPy/(float)YSize()); 266 mBDrw->ElAddText((float)mPx/(float)XSize(), 1.-(float)mPy/(float)YSize(), pc ); 267 mBDrw->Refresh(); 268 } 269 270 /* --Methode-- */ 238 271 void PIDraw3DWdg::But2Press(int x, int y) 239 272 { … … 247 280 lPx = x; lPy = y; 248 281 249 // Pour savoir si on se trouve ds la zone centrale 282 // Pour savoir si on se trouve ds la zone centrale 250 283 int czx = XSize()/10; 251 284 int czy = YSize()/10; 252 int dmix = x-XSize()/2; 253 int dmiy = y-YSize()/2; 254 if (dmix < 0) dmix = -dmix; 255 if (dmiy < 0) dmiy = -dmiy; 256 if ((dmix < czx) && (dmiy < czy)) rOfg = true; 257 else rOfg = false; 285 PIKeyModifier kmod; 286 unsigned long tm; 287 GetLastEventInfo(kmod, tm); 288 rOfg = false; 289 if (kmod == PIKM_Shift) rOfg = true; 290 else { 291 int dmix = x-XSize()/2; 292 int dmiy = y-YSize()/2; 293 if (dmix < 0) dmix = -dmix; 294 if (dmiy < 0) dmiy = -dmiy; 295 if ((dmix < czx) && (dmiy < czy)) rOfg = true; 296 } 258 297 259 298 cUlen = 0.5*(dax+day)*co*0.3; cDax = dax; cDay = day; clCO = co; … … 319 358 SetDrawers3DView(); 320 359 Refresh(); 360 mBDrw->Refresh(); 321 361 } 322 362 … … 382 422 SetDrawers3DView(); 383 423 Refresh(); 424 mBDrw->Refresh(); 384 425 } 385 426 … … 421 462 Send(Msg(), PIMsg_Active); 422 463 PIDrwTools::SetCurrentBaseWdg(this); 464 mPx = x; mPy = y; 423 465 if ( (x > 50) || ( y > 50) ) return; 424 466 Update3DView(); -
trunk/SophyaPI/PI/pi3ddrw.h
r155 r158 1 // This may look like C code, but it is really -*- C++ -*- 1 2 // Module PI : Peida Interactive PIDrawer3D PIDraw3DWdg 2 3 // Drawer et DrawWidget 3D R. Ansari 06/98 … … 14 15 #include <list> 15 16 16 // Traceur (Drawer) 3D 17 // ----------------- Traceur (Drawer) 3D ------------------- 18 17 19 class PIDrawer3D : public PIDrawer 18 20 { … … 40 42 41 43 44 //------------------------------ Classe PIDrawer3D -------------------- 42 45 43 46 class PIDraw3DWdg : public PIBaseWdg { … … 50 53 virtual long kind() {return ClassId; } 51 54 55 52 56 virtual void Set3DView_Obs(float xo, float yo, float zo, float teta, float phi, float psi, 53 57 float dax, float day, float co, float dco=0.2); … … 58 62 59 63 virtual void Update3DView(); // Vue 3-D a partir de Drawer No 1 64 65 inline void SetTitles(const char* tt=NULL, const char* tb=NULL) 66 { mBDrw->SetTitles(tt, tb); } 67 inline void SetTitles(string const & tt, string const & tb) 68 { mBDrw->SetTitles(tt, tb); } 60 69 61 70 int AddDrawer3D(PIDrawer3D*, bool ad=false); // Ajoute un Drawer … … 75 84 virtual void Ptr3Move(int x, int y); 76 85 86 virtual void Keyboard(int key, PIKeyModifier kmod); 87 virtual void PasteSelection(unsigned int typ, void *pdata, unsigned int l); 88 77 89 78 90 protected : … … 80 92 virtual void DrawXYZAxes(); 81 93 94 PIElDrawer* mBDrw; // Objet traceur d'elements de fond 95 int mPx, mPy; // Position pointeur - Bouton-1 96 82 97 bool vfixed; // SetView fait ou pas 83 98 list<int> m3DrIl; // Liste des Id drawers 3D -
trunk/SophyaPI/PI/pibwdggen.cc
r127 r158 1 // Module PI : Peida Interactive PIBaseWdg 2 // Classe de base pour nouvelles composantes graphiques 96 3 // LAL (Orsay) / IN2P3-CNRS DAPNIA/SPP (Saclay) / CEA 4 1 5 #include <stdio.h> 2 6 … … 6 10 #include "pidrwtools.h" 7 11 8 // Les methodes de la classe PIBWdgGen 12 13 //++ 14 // Class PIBaseWdg 15 // Lib PI 16 // include pibwdggen.h 17 // 18 // Classe de base pour la création de nouvelles composantes graphiques. 19 // Le traitement des événements liés à l'écran, clavier, souris se fait 20 // à travers des méthodes de cette classe : "Resize()", "But1Press()", ... 21 // La classe "PIBaseWdg" supporte en outre un mécanisme permettant 22 // d'associer un ou plusieurs objets traceur (*Drawer*) capables 23 // de se dessiner dans la fenêtre associée à l'objet. 24 // La classe "PIBaseWdgGen" définit l'interface et ne peut pas être instanciée 25 // directement (Méthodes virtuelles pures). Les objets instanciés sont de la 26 // classe "PIBaseWdg" et le fichier entête correspondant est "PIBWDG_H" 27 // défini dans "pisysdep.h". 28 //-- 29 //++ 30 // Links Parents 31 // PIWdg 32 //-- 33 //++ 34 // Links Voir aussi 35 // PIGraphic 36 // PIDrawer 37 //-- 38 39 // ---------- Les methodes de la classe PIBWdgGen ------------ 40 41 //++ 42 // Titre Constructeur 43 //-- 44 //++ 45 // PIBaseWdgGen(PIContainerGen *par, char *nom, int sx=10, int sy=10, int px=0, int py=0) 46 // Création d'un objet contenu dans l'objet *PIContainer* "par", de 47 // taille "sx,sy", se trouvant à la position "px,py" avec le nom "nom" 48 //-- 49 50 //++ 51 // Titre Méthodes 52 //-- 53 //++ 54 // void SetBackgroundColor(PIColors col=PI_White) 55 // Choix de la couleur de fond. 56 // void EraseWindow(int x0=0, int y0=0, int dx=0, int dy=0) 57 // Efface la zone rectangulaire définie par le coin "(x0,y0)" , 58 // de taille "dx,dy" à l'aide de la couleur de fond. 59 // void SelPointerShape(PIPointer ptr=PI_ArrowPointer) 60 // Choix de la forme du pointeur (souris) pour la fenêtre 61 // associée à l'objet. 62 //| PI_ArrowPointer, PI_CrossPointer, PI_HandPointer, PI_TDLRArrowPointer 63 // PIColors GetBackgroundColor() 64 // Renvoie la couleur de fond 65 // PIPointer GetPointerShape() 66 // Renvoie la forme du pointeur 67 // void Refresh() 68 // L'appel à cette méthode permet de retracer le contenu de la 69 // fenêtre et des "Drawer" associés. 70 //-- 71 72 //++ 73 // Titre Activation du traitement des événements 74 //-- 75 //++ 76 // void ActivatePtrCross() 77 // Active l'appel aux méthodes "Enter()" et "Leave()" lorsque la souris 78 // rentre ou sort de la fenêtre correspondante à l'objet 79 // void ActivateButton(int b) 80 // Active l'appel aux méthodes "ButbPress()" et "ButxRelease()" pour 81 // le bouton "b" de la souris ("b=1,2,3") 82 // void ActivateMove(int b) 83 // Active l'appel aux méthodes "PtrbMove()" lors des mouvements de 84 // la souris avec le bouton "b" enfoncé ("b=1,2,3") 85 // L'appel avec "bid=0" active l'appel à la méthode "PtrMove()" 86 // Lors des mouvements de souris sans bouton enfoncé. 87 // void ActivateKeyboard() 88 // Active l'appel à la méthode "Keyboard()" lors de l'appui sur les 89 // touches du clavier. 90 //-- 91 9 92 10 93 /* --Methode-- */ … … 42 125 43 126 127 //++ 128 // Titre Gestion des événements 129 //-- 130 //++ 131 // void Draw(PIGraphic* g, int x0, int y0, int dx, int dy) 132 // Méthode appelée lorsqu'il faut redessiner tout ou partie de 133 // la fenêtre. La zone a rafraîchir est determinée par 134 // "(x0,y0)", "dx,dy" et "g" est l'objet "PIGraphic" 135 // qui doit être utilisé. 136 // Cette méthode ne doit pas être appelé directement. 137 // Pour rafraîchir le contenu de la fenêtre, il faut appeler 138 // la méthode "Refresh()" 139 // void Resize() 140 // Méthode appelée lorsque la taille de l'objet est modifiée. 141 // "XSize()", "YSize()" fournissent la nouvelle taille de l'objet. 142 // void Enter() 143 // Méthode appelée lorsque le pointeur rentre dans la fenêtre 144 // (Si "ActivatePtrCross()" a été appelé ) 145 // void Leave() 146 // Méthode appelée lorsque le pointeur quitte la fenêtre 147 // (Si "ActivatePtrCross()" a été appelé ) 148 // void ButbPress(int x, int y) (b=1,2,3) 149 // Méthode appelée lorsque le bouton "b=1,2,3" de la souris est enfoncé. 150 // "x,y" : Position de la souris 151 // (Si "ActivateButton(b)" a été appelé ) 152 // void ButbRelease(int x, int y) (b=1,2,3) 153 // Méthode appelée lorsque le bouton "b=1,2,3" de la souris est relaché. 154 // "x,y" : Position de la souris 155 // (Si "ActivateButton(b)" a été appelé ) 156 // void PtrMove(int x, int y) 157 // Méthode appelée lors des mouvements de la souris. "x,y" : Position de la souris 158 // (Si "ActivateMove(0)" a été appelé ) 159 // void PtrbMove(int x, int y) (b=1,2,3) 160 // Méthode appelée lors des mouvements de la souris, avec le 161 // bouton "b=1,2,3" appuyé. "x,y" : Position de la souris 162 // (Si "ActivateMove(b)" a été appelé ) 163 // void Keyboard(int key, PIKeyModifier kmod) 164 // Méthode appelée en réponse à des actions sur le clavier. 165 // "key" est le code ASCII de la touche enfoncé - "kmod" indique 166 // si des touches speciaux étaient enfoncés en même temps. 167 //| kmod = PIKM_Blank | PIKM_Shift | PIKM_Alt | PIKM_Cntl 168 // Des constantes ont été définis pour certaines touches particulières 169 //| PIK_Return , PIK_Enter , PIK_BackSpace, PIK_Delete 170 //| PIK_Tab , PIK_Escape , PIK_Up , PIK_Down, 171 //| PIK_Right , PIK_Left , PIK_Previous , PIK_Next 172 //-- 173 44 174 /* --Methode-- */ 45 175 void PIBaseWdgGen::Draw(PIGraphic* g, int x0, int y0, int dx, int dy) … … 124 254 } 125 255 256 /* --Methode-- */ 257 void PIBaseWdgGen::PtrMove(int /*x*/, int /*y*/) 258 { 259 #ifdef DEBUG_RZXB 260 printf ("Debug_PIBaseWdgGen::PtrMove PosX,Y= %d %d \n", x, y); 261 #endif 262 return; 263 } 126 264 127 265 /* --Methode-- */ … … 167 305 } 168 306 307 //++ 308 // Titre Gestion des traceurs (PIDrawer) 309 // Un même "PIDrawer" peut être attaché simultanement à plusieurs "PIBaseWdg", ainsi 310 // que plusieurs fois au même "PIBaseWdg", avec des identificateurs différents. 311 //-- 312 //++ 313 // void SetDefaultDrawRectangle(PIGrCoord x1, PIGrCoord y1, PIGrCoord x2, PIGrCoord y2, bool psz=true) 314 // Définition du rectangle d'attachement par défaut. "(x1,y1)" et "(x2,y2)" determinent 315 // les positions des deux coins opposés. 316 // si "psz=true", les coordonnées sont supposées être des facteurs multiplicatifs 317 // des dimensions de l'objet. 318 // void SetDefaultDrawerLimits(float xmin, float xmax, float ymin, float ymax, - 319 // int axrl=kAxeDirSame, int ayud=kAxeDirSame) 320 // Définition du système de coordonnées par défaut d'un drawer attaché en "autolim=true" 321 // 322 //-- 323 169 324 /* --Methode-- */ 170 325 void PIBaseWdgGen::SetDefaultDrawRectangle(PIGrCoord x1, PIGrCoord y1, PIGrCoord x2, PIGrCoord y2, bool psz) … … 183 338 } 184 339 340 341 //++ 342 // int AddDrawer(PIDrawer* drw, PIGrCoord x1, PIGrCoord y1, PIGrCoord x2, PIGrCoord y2, - 343 // bool psz=true, bool clip=true, bool ad=false) 344 // Attachement d'un "PIDrawer" au rectangle défini les coordonnées des deux coins opposés. 345 // si "psz=true", les coordonnées sont supposées être des facteurs multiplicatifs 346 // des dimensions de l'objet. 347 // si "clip=true", "PIDrawer* drw" ne peut dessiner en dehors de son rectangle 348 // d'attachement. 349 // si "ad=true", le "PIDrawer* drw" est détruit lors de la destruction de l'objet PIBaseWdg. 350 // La méthode retourne l'identificateur du drawer attaché. 351 // int AddDrawer(PIDrawer* drw, bool autolim=false, bool clip=true, bool ad=false) 352 // Ajout d'un "PIDrawer" au rectangle d'attachement par défaut. 353 // Si "autolim=true", l'objet "PIBaseWdg" impose l'espace de coordonnées utilisateur 354 // à l'aide des valeurs définies par "SetDefaultDrawerLimits()". 355 // Si ""clip=true", "PIDrawer* drw" ne peut dessiner en dehors de son rectangle 356 // d'attachement. 357 // si "ad=true", le "PIDrawer* drw" est détruit lors de la destruction de l'objet PIBaseWdg. 358 // La méthode retourne l'identificateur du drawer attaché. 359 //-- 185 360 186 361 /* --Methode-- */ … … 220 395 221 396 397 //++ 398 // void MoveResizeDrawer(int id, PIGrCoord x1, PIGrCoord y1, PIGrCoord x2, PIGrCoord y2, bool psz=true) 399 // Modification du rectangle d'attachement du PIDrawer avec l'identificateur "id" , retourné 400 // par "AddDrawer()" 401 // void RemoveDrawer(int id) 402 // Ote le drawer "id" de la liste 403 // void DeleteDrawers() 404 // Ote tous les drawers de la liste. Détruit ceux ajoutés avec l'option "ad=true" 405 //-- 406 222 407 /* --Methode-- */ 223 408 void PIBaseWdgGen::MoveResizeDrawer(int id, PIGrCoord x1, PIGrCoord y1, PIGrCoord x2, PIGrCoord y2, bool psz) … … 257 442 } 258 443 444 //++ 445 // int NbDrawers() 446 // Retourne le nombre de PIDrawer attachés 447 // PIDrawer* GetDrawerId(int id) 448 // Retourne le PIDrawer avec l'identificateur id 449 // PIDrawer* GetDrawer(int n) 450 // Retourne le PIDrawer "n=0..NbDrawers()-1" de la liste 451 //-- 452 259 453 /* --Methode-- */ 260 454 int PIBaseWdgGen::NbDrawers() … … 280 474 } 281 475 476 477 //++ 478 // void CallDrawers(PIGraphic* g, int x0=0, int y0=0, int dx=0, int dy=0) 479 // Appel de la méthode de tracé pour tous les Drawers 480 // void CallDrawer(int id); 481 // Appel de la méthode de tracé pour le drawer avec l'identificateur "id" 482 //-- 282 483 283 484 /* --Methode-- */ -
trunk/SophyaPI/PI/pibwdggen.h
r127 r158 15 15 enum PIKeyModifier { PIKM_Blank = 0, PIKM_Shift = 1, PIKM_Alt = 2, PIKM_Cntl = 4 } ; 16 16 17 enum PIKeyValues { PIK_Return = 1+0x2000, PIK_Enter = 2+0x2000,18 PIK_BackSpace = 3+0x2000, PIK_Delete = 4+0x2000,19 PIK_Tab = 5+0x2000, PIK_Escape = 6+0x2000,20 PIK_Up = 11+0x2000, PIK_Down = 12+0x2000,21 PIK_Right = 13+0x2000, PIK_Left = 14+0x2000,22 PIK_Previous = 21+0x2000, PIK_Next = 22+0x2000} ;17 enum PIKeyValues { PIK_Return = 0xFF0D, PIK_Enter = 0xFF8D , 18 PIK_BackSpace = 0xFF08, PIK_Delete = 0xFFFF, 19 PIK_Tab = 0xFF09, PIK_Escape = 0xFF1B, 20 PIK_Up = 0xFF52, PIK_Down = 0xFF54, 21 PIK_Right = 0xFF53, PIK_Left = 0xFF51, 22 PIK_Previous = 0xFF55, PIK_Next = 0xFF56 } ; 23 23 24 24 … … 70 70 virtual void But3Press(int x, int y); 71 71 virtual void But3Release(int x, int y); 72 virtual void PtrMove(int x, int y); 72 73 virtual void Ptr1Move(int x, int y); 73 74 virtual void Ptr2Move(int x, int y); 74 75 virtual void Ptr3Move(int x, int y); 75 76 virtual void Keyboard(int key, PIKeyModifier kmod); 77 78 // Acces aux caracteristiques du dernier evenement 79 virtual void GetLastEventInfo(PIKeyModifier& kmod, unsigned long& tm) = 0; 76 80 77 81 // PostScript output -
trunk/SophyaPI/PI/pibwdgx.cc
r154 r158 1 // This may look like C code, but it is really -*- C++ -*- 2 // Module PI : Peida Interactive PIBaseWdg 3 // Reza 95-96 4 // LAL (Orsay) / IN2P3-CNRS DAPNIA/SPP (Saclay) / CEA 5 1 6 #include <stdio.h> 2 7 … … 29 34 30 35 Init(); 36 mWGrC = NULL; // PIGraphic (Contexte graphique) associe a la fenetre 37 finishDone = false; // FinishCreate() pas encore appele 31 38 32 39 CreateXtWdg(nom, piXtBaseWidgetClass, NULL, sx, sy, px, py); … … 42 49 mPtrS = PI_CrossPointer; 43 50 SelPointerShape(); 44 51 // PIGraphic (Contexte graphique) associe a la fenetre 52 // Si pas cree par FinishCreate() 53 if (!mWGrC) mWGrC = new PIGraphicX(this); 45 54 Manage(); 46 mWGrC = new PIGraphicX(this); // PIGraphic (Contexte graphique) associe a la fenetre47 55 } 48 56 … … 63 71 void PIBaseWdgX::FinishCreate() 64 72 { 73 if (finishDone) { 74 fprintf(stderr, "BUG/PIBaseWdgX::FinishCreate() multiple call \n"); 75 return; 76 } 65 77 // appele par la fenetre mere, apres XtRealize() 66 78 // J'active le backing store pour la fenetre X … … 80 92 // XChangeWindowAttributes(PIXDisplay(), XtWindow(XtWdg()), CWBackingPlanes|CWBackingStore, &xswa); 81 93 XChangeWindowAttributes(PIXDisplay(), mwi, CWBackingStore, &xswa); 94 95 // PIGraphic (Contexte graphique) associe a la fenetre 96 if (!mWGrC) mWGrC = new PIGraphicX(this); 97 mWGrC->TerminateInit(); 98 finishDone = true; // FinishCreate() fait 82 99 } 100 101 /* --Methode-- */ 102 bool PIBaseWdgX::IsVisible() 103 { 104 return (finishDone && PIWdg::IsVisible() ); 105 } 83 106 84 107 /* --Methode-- */ … … 114 137 unsigned long evtmask ; 115 138 116 if ( (bid < 1) && (bid > 3) ) return; 117 if (bid == 1) evtmask = Button1MotionMask | PointerMotionHintMask ; 139 // bid == 0 -> PointerMove sans bouton 140 if ( (bid < 0) && (bid > 3) ) return; 141 142 if (bid == 0) evtmask = PointerMotionHintMask ; 143 else if (bid == 1) evtmask = Button1MotionMask | PointerMotionHintMask ; 118 144 else if (bid == 2) evtmask = Button2MotionMask | PointerMotionHintMask ; 119 145 else if (bid == 3) evtmask = Button3MotionMask | PointerMotionHintMask ; … … 177 203 } 178 204 205 /* --Methode-- */ 206 void PIBaseWdgX::GetLastEventInfo(PIKeyModifier& kmod, unsigned long& tm) 207 { 208 unsigned int st; 209 Time t; 210 PIXGetLastEventInfo(st, t); 211 tm = t; 212 kmod = PIKM_Blank; 213 if (st & ShiftMask) kmod = (PIKeyModifier) (kmod | PIKM_Shift); 214 if (st & ControlMask) kmod = (PIKeyModifier) (kmod | PIKM_Cntl); 215 if (st & Mod1Mask) kmod = (PIKeyModifier) (kmod | PIKM_Alt); 216 return; 217 } 179 218 180 219 static bool fgbwdg = false ; -
trunk/SophyaPI/PI/pibwdgx.h
r80 r158 1 // This may look like C code, but it is really -*- C++ -*- 2 // Module PI : Peida Interactive PIBaseWdg 3 // Reza 95-96 4 // LAL (Orsay) / IN2P3-CNRS DAPNIA/SPP (Saclay) / CEA 5 1 6 #ifndef PIBWDGX_H_SEEN 2 7 #define PIBWDGX_H_SEEN … … 6 11 7 12 #include "pigraphx.h" 13 8 14 #include "pigraphps.h" 9 15 … … 34 40 virtual void AssignKeyboard(); 35 41 42 // Acces aux caracteristiques du dernier evenement 43 virtual void GetLastEventInfo(PIKeyModifier& kmod, unsigned long& tm); 44 45 // On redefinit IsVisible() pour tenir compte de l appel a FinsihCreate 46 virtual bool IsVisible(); 47 36 48 // Appel depuis le PIXtBaseWidget uniquement (ExposeEvt de Xt ) 37 49 virtual void eXposeProcess(int x0, int y0, int dx, int dy); … … 41 53 PIPointer mPtrS; 42 54 PIColors mBCol; 55 bool finishDone; // Si FinsihCreate appele 43 56 }; 44 57 -
trunk/SophyaPI/PI/picons.cc
r138 r158 586 586 int x,y; 587 587 588 // printf("PIConsole::DisplayLines(%d %d ) \n ", l1, l2); 588 // DBG printf("PIConsole::DisplayLines(%d %d ) -> %d - %lx \n ", l1, l2, 589 // (int)IsVisible(), (long)XtWindow(XtWdg())); 589 590 590 591 if (! IsVisible() ) return; -
trunk/SophyaPI/PI/picontainergen.cc
r154 r158 4 4 // E.Aubourg , R. Ansari 96 - 98 5 5 // LAL (Orsay) / IN2P3-CNRS DAPNIA/SPP (Saclay) / CEA 6 7 #include <stdio.h> 6 8 7 9 #include "picontainergen.h" … … 15 17 // organise la hiérarchie des objets "PIWdg" et donc aussi des "PIMsgHandler", 16 18 // contrôle la géométrie des objets "PIWdg" contenus, ainsi que leur 17 // visibilité et activité. La classe "PIContainer" est une des 19 // visibilité et activité. Le positionnement initial est controle par 20 // un objet *PILayoutMgr* qui peut eventuellement modifier la postion 21 // ou la taille de l'objet "PIWdg" ajouté. Les attributs d'attachement 22 // de l'objet ("PIWdg::SetBinding()") contrôle le repositionnement 23 // lors du changement de taille du "PIContainer". 24 // La classe "PIContainer" est une des 18 25 // classes de PI qui ont une implementation dépendante du systeme utilisé 19 26 // (Mac, XWindow, ...). La classe "PIContainerGen" est la classe qui … … 26 33 // Links Parents 27 34 // PIWdg 35 //-- 36 //++ 37 // Links Voir aussi 38 // PILayoutMgr 28 39 //-- 29 40 //++ … … 43 54 //-- 44 55 //++ 56 // void SetLayoutMgr(PILayoutMgr* nlay) 57 // Permet de changer le gestionnaire de positions ("PILayoutMgr") du conteneur, 58 // et donc la stratégie de positionnement des objets "PIWdg" fils. 59 // le LayoutMgr par défaut n'applique aucune contrainte sur la position 60 // ou la taille des objets ajoutés. 61 // Cette méthode ne peut être appelé que pour un conteneur vide (sans PIWdg fils). 62 // Il est conseillé de l'appeler juste après la création du "PIContainer" 63 // PILayoutMgr* GetLayoutMgr() 64 // Retourne le gestionnaire de positions/tailles du conteneur. 45 65 // void Show() 46 66 // Rend l'objet visible à l'écran. Tous les objets "PIWdg" contenus et qui sont dans … … 50 70 // void PSPrint(PSFile *psf, int ofx=0, int ofy=0) 51 71 // Appelle la méthode "PSPrint()" pour tous les objets contenus. 52 // void SetAutoDelChilds(bool ad = false)72 // void SetAutoDelChilds(bool ad = true) 53 73 // Contrôle le comportement de l'objet conteneur vis à vis des objets 54 74 // contenus lors de la destruction. si "ad=true", les objets contenus 55 75 // sont détruits lors de l'appel du destructeur de l'objet conteneur. 56 //-- 57 58 #define NCHALGRP 8 76 // int NbChilds() 77 // Retourne le nombre de "PIWdg" contenus. 78 // PIWdg* GetChild(int n) 79 // Retourne le "PIWdg" numéro "n" (0..NbChilds()-1) 80 //-- 81 //++ 82 // Titre Méthodes particulières 83 // Les méthodes ci-dessous ne doivent pas être appelées directement. 84 //-- 85 //++ 86 // void ChildAdd(PIWdg* child) 87 // Méthode qui est appelée lors de l'attachement d'un nouvel objet (création) 88 // Appelle la méthode correspondante du "PILayoutMgr" 89 // void ChildAdd(PIWdg* child) 90 // Méthode qui est appelée lors du détachement d'un objet (destruction) 91 // Appelle la méthode correspondante du "PILayoutMgr" 92 //-- 93 59 94 60 95 /* --Methode-- */ … … 63 98 : PIWdg(par, nom, sx, sy, px, py) 64 99 { 100 stvis = false; 101 stfcr = false; 102 layout = new PILayoutMgr; 103 layout->SetContainer(this); 104 } 105 106 107 /* --Methode-- */ 108 PIContainerGen::~PIContainerGen() 109 { 110 delete layout; 111 } 112 113 /* --Methode-- */ 114 void PIContainerGen::SetLayoutMgr(PILayoutMgr* nlay) 115 { 116 if (nlay == NULL) return; 117 if (NbChilds() > 0) { 118 fprintf(stderr, "PIContainerGen::SetLayoutMgr()/ Error! Container has childs (N = %d) \n", NbChilds()); 119 return; 120 } 121 delete layout; 122 layout = nlay; 123 layout->SetContainer(this); 124 } 125 126 /* --Methode-- */ 127 void PIContainerGen::PSPrint(PSFile *psf, int ofx, int ofy) 128 { 129 int i; 130 if (!psf) return; 131 if (!Visible()) return; 132 for(i=0; i<NbChilds(); i++) GetChild(i)->PSPrint(psf, ofx+XPos(), ofy+YPos()); 133 return; 134 } 135 136 /* --Methode-- */ 137 void PIContainerGen::Show() 138 { 139 stvis = true; 140 Manage(); 141 return; 142 } 143 144 /* --Methode-- */ 145 void PIContainerGen::Hide() 146 { 147 stvis = false; 148 UnManage(); 149 return; 150 } 151 152 /* --Methode-- */ 153 bool PIContainerGen::Visible() 154 { 155 if (Parent()) return(stvis && Parent()->Visible()); 156 else return(stvis && IsVisible()); 157 } 158 159 /* --Methode-- */ 160 void PIContainerGen::ChildAdd(PIWdg* child) 161 { 162 layout->ChildAdd(child); 163 // Reza 13/10/98 : il faut que child->FinishCreate() 164 // soit appele pour les PIWdg ajoute quand le container est deja affiche et son FinishCreate() appele 165 if (stfcr) child->FinishCreate(); 166 return; 167 } 168 169 /* --Methode-- */ 170 void PIContainerGen::ChildDel(PIWdg* child) 171 { 172 layout->ChildDel(child); 173 } 174 175 /* --Methode-- */ 176 int PIContainerGen::NbChilds() 177 { 178 return(layout->NbChilds()); 179 } 180 181 /* --Methode-- */ 182 PIWdg* PIContainerGen::GetChild(int n) 183 { 184 return(layout->GetChild(n)); 185 } 186 187 /* --Methode-- */ 188 void PIContainerGen::SetAutoDelChilds(bool ad) 189 { 190 layout->SetAutoDelChilds(ad) ; 191 } 192 193 194 /* --Methode-- */ 195 void PIContainerGen::FinishCreate() 196 { 197 if (stfcr) return; 198 int k; 199 for(k=0; k<NbChilds(); k++) GetChild(k)->FinishCreate(); 200 stfcr = true; 201 } 202 203 204 // ------------------------------------------------------------------ 205 // Classe PILayoutMgr (Gestionnaire de positions/tailles PIWdg fils 206 // ------------------------------------------------------------------ 207 //++ 208 // Class PILayoutMgr 209 // Lib PI 210 // include picontainergen.h 211 // 212 // Classe de gestionnaire de positions/tailles initiales des "PIWdg" 213 // fils pour les "PIContainer". 214 // La classe de base n'impose aucune contrainte sur les positions/tailles. 215 //-- 216 //++ 217 // Links Voir 218 // PIContainer 219 //-- 220 221 //++ 222 // Titre Constructeur, méthodes 223 //-- 224 //++ 225 // PILayoutMgr() 226 // Constructeur 227 // void ChildAdd(PIWdg* child) 228 // Méthode appelé lors de l'ajout d'un nouveau "PIWdg" au conteneur. 229 // void ChildDel(PIWdg* child) 230 // Méthode appelé lors de la suppression d'un "PIWdg" 231 // int NbChilds() 232 // Nombre de "PIWdg" gérés. 233 // PIWdg* GetChild(int n) 234 // Retourne l'objet "PIWdg" numéro "n" 235 //-- 236 237 #define NCHALGRP 8 238 239 /* --Methode-- */ 240 PILayoutMgr::PILayoutMgr() 241 { 65 242 mNCh = 0; 66 mACSup = false; // Suppression automatique des widgets fils au delete243 mACSup = true; // Suppression automatique des widgets fils au delete 67 244 mPaSup = false; 68 245 mChilds = new (PIWdg* [NCHALGRP]); 69 246 mMxCh = NCHALGRP; 70 stvis = false; 71 stfcr = false; 72 } 73 74 75 /* --Methode-- */ 76 PIContainerGen::~PIContainerGen() 247 mCont = NULL; 248 } 249 250 /* --Methode-- */ 251 PILayoutMgr::~PILayoutMgr() 77 252 { 78 253 mPaSup = true; // Pour prevenir ChildDel() … … 83 258 84 259 /* --Methode-- */ 85 void PIContainerGen::PSPrint(PSFile *psf, int ofx, int ofy) 86 { 87 int i; 88 if (!psf) return; 89 if (!Visible()) return; 90 for(i=0; i<mNCh; i++) mChilds[i]->PSPrint(psf, ofx+XPos(), ofy+YPos()); 91 return; 92 } 93 94 /* --Methode-- */ 95 void PIContainerGen::Show() 96 { 97 stvis = true; 98 Manage(); 99 return; 100 } 101 102 /* --Methode-- */ 103 void PIContainerGen::Hide() 104 { 105 stvis = false; 106 UnManage(); 107 return; 108 } 109 110 /* --Methode-- */ 111 bool PIContainerGen::Visible() 112 { 113 if (Parent()) return(stvis && Parent()->Visible()); 114 else return(stvis && IsVisible()); 115 } 116 117 /* --Methode-- */ 118 void PIContainerGen::ChildAdd(PIWdg* child) 260 void PILayoutMgr::ChildAdd(PIWdg* child) 119 261 { 120 262 if (child == NULL) return; … … 128 270 } 129 271 mChilds[mNCh] = child; mNCh++; 130 // Reza 13/10/98 : il faut que child->FinishCreate() 131 // soit appele pour les PIWdg ajoute quand le container est deja affiche et son FinishCreate() appele 132 if (stfcr) child->FinishCreate(); 133 return; 134 } 135 136 /* --Methode-- */ 137 void PIContainerGen::ChildDel(PIWdg* child) 138 { 139 if (mPaSup) return; // Ne rien faire si delete initie par Container-parent 272 return; 273 } 274 275 /* --Methode-- */ 276 void PILayoutMgr::ChildDel(PIWdg* child) 277 { 278 if (mPaSup) return; // Ne rien faire si delete initie par Container-parent : Le LayoutMgr lui-meme 140 279 if ((child == NULL) || (mNCh < 1)) return; 141 280 for(int i=0; i<mNCh; i++) … … 149 288 } 150 289 151 /* --Methode-- */152 int PIContainerGen::NbChilds()153 {154 return(mNCh);155 }156 157 /* --Methode-- */158 PIWdg* PIContainerGen::GetChild(int n)159 {160 if ( (n < 0) || (n >= mNCh)) return(NULL);161 return ((PIWdg*)mChilds[n]);162 }163 164 /* --Methode-- */165 void PIContainerGen::SetAutoDelChilds(bool ad)166 {167 mACSup = ad;168 return;169 }170 171 /* --Methode-- */172 void PIContainerGen::FinishCreate()173 {174 if (stfcr) return;175 int k;176 for(k=0; k<mNCh; k++) mChilds[k]->FinishCreate();177 stfcr = true;178 }179 -
trunk/SophyaPI/PI/picontainergen.h
r154 r158 1 // This may look like C code, but it is really -*- C++ -*- 2 // Module PI : Peida Interactive PIContainerGen 3 // E.Aubourg , R. Ansari 96 - 98 4 // LAL (Orsay) / IN2P3-CNRS DAPNIA/SPP (Saclay) / CEA 5 1 6 #ifndef PICONTAINERBASE_SEEN 2 7 #define PICONTAINERBASE_SEEN … … 6 11 #include PIWDG_H 7 12 13 class PIContainerGen; 14 // Classe gestionnaire du positionnement/tailles des PIWdg d'un PIContainer 15 class PILayoutMgr { 16 public: 17 PILayoutMgr(); 18 virtual ~PILayoutMgr(); 8 19 20 inline void SetContainer(PIContainerGen* pic) { mCont = pic; } 21 22 virtual void ChildAdd(PIWdg* child); 23 virtual void ChildDel(PIWdg* child); 24 25 inline int NbChilds() { return(mNCh); } 26 inline PIWdg* GetChild(int n) 27 { if ( (n < 0) || (n >= mNCh)) return(NULL); 28 else return (mChilds[n]); } 29 inline void SetAutoDelChilds(bool ad = true) { mACSup = ad; } 30 31 protected: 32 PIWdg ** mChilds; 33 int mNCh, mMxCh; 34 bool mPaSup, mACSup; 35 PIContainerGen* mCont; // Le PIContainer auquel on est attache 36 }; 37 38 // Classe conteneur pour le regroupement hierarchique (Fenetre/MsgHandler) des PIWdg 9 39 class PIContainerGen : public PIWdg 10 40 { … … 18 48 virtual long kind() {return ClassId; } 19 49 50 virtual void SetLayoutMgr(PILayoutMgr* nlay); 51 inline PILayoutMgr* GetLayoutMgr() { return(layout); } 52 20 53 virtual void PSPrint(PSFile *psf, int ofx=0, int ofy=0); 21 54 … … 28 61 virtual int NbChilds(); 29 62 virtual PIWdg* GetChild(int n); 63 void SetAutoDelChilds(bool ad = true); 30 64 31 void SetAutoDelChilds(bool ad = false);32 65 virtual void FinishCreate(); // appelle FinishCreate() pour les descendants 33 66 34 67 protected: 35 68 bool stvis, stfcr; // Statut visible ou pas, FinishCreate appele ou pas 36 PIWdg ** mChilds; 37 int mNCh, mMxCh; 38 bool mPaSup, mACSup; 69 PILayoutMgr* layout; // Gestionnaire de positionnement (/tailles) des PIWdg fils 39 70 }; 40 71 -
trunk/SophyaPI/PI/pidrawer.cc
r136 r158 1 // Module PI : Peida Interactive PIDrawer 2 // Classe de traceurs pouvat être attachés à une PIBaseWdg 3 // E. Aubourg , R.Ansari 96-98 4 // LAL (Orsay) / IN2P3-CNRS DAPNIA/SPP (Saclay) / CEA 5 1 6 #include "pidrawer.h" 2 7 #include "psfile.h" 8 9 //++ 10 // Class PIDrawer 11 // Lib PI 12 // include pidrawer.h 13 // 14 // Classe pour la création d'objets, capables de se dessiner 15 // dans une composante graphique ("PIBaseWdg"). 16 //-- 17 //++ 18 // Links Voir 19 // PIBaseWdg 20 //-- 21 22 //++ 23 // Titre Constructeurs et méthodes 24 //-- 25 26 //++ 27 // PIDawer() 28 // Constructeur. 29 //-- 3 30 4 31 PIDrawer::PIDrawer() … … 32 59 } 33 60 61 //++ 62 // void SetLimits(float xmin, float xmax, float ymin, float ymax, - 63 // int axrl=kAxeDirSame, int ayud=kAxeDirSame) 64 // Définit les limites du système de coordonnées. 65 // void SetAxesFlags(unsigned int flags=kAxesNone) 66 // Attributs de tracé d'axes 67 //| kStdAxes , kBoxAxes , kTicks , kIntTicks , kExtTicks 68 //| kMajTicks , kMinTicks , kLabels , kAxesDflt , kAxesNone 69 // void DrawAxes(PIGraphicUC* g) 70 // Méthode de tracé des axes 71 //-- 34 72 35 73 void … … 62 100 } 63 101 102 //++ 103 // void Draw(PIGraphicUC* g, float xmin, float ymin, float xmax, float ymax) 104 // Méthode qui est appelé lorsquer l'objet PIDrawer doit rafraichir la zone 105 // définie par "xmin-xmax" , "ymin-ymax" dans le système de coordonnées du 106 // PIDrawer. 107 // void Refresh() 108 // Rafraîchit le dessin du PIDrawer sur tous les PIBaseWdg auxquel il est attaché. 109 // void UpdateLimits() 110 // Cette méthode doit calculer les limites (X/Y Min-Max) préferées par l'objet 111 // et doit appeler "SetLimits()". L'implementation par défaut ne fait rien. 112 //-- 64 113 65 114 void … … 78 127 79 128 } 129 130 //++ 131 // Titre Les attributs graphiques 132 //-- 133 //++ 134 // void SetColAtt(PIColors fg=PI_NotDefColor, PIColors bg=PI_NotDefColor) 135 // Modifie la couleur d'avant-plan et de fond par défaut 136 // void SetLineAtt(PILineAtt lat=PI_NotDefLineAtt) 137 // Modifie l'attribut type de ligne 138 // void SetFontAtt(PIFontSize fsz=PI_NotDefFontSize, PIFontAtt fat=PI_NotDefFontAtt) 139 // L'attribut Type de fonte 140 // void SetMarkerAtt(int sz=-1, PIMarker mrk=PI_NotDefMarker) 141 // L'attribut type et taille de marker 142 // void SetColMapId(CMapId cid=CMAP_OTHER) 143 // L'attribut choix de la table de couleurs 144 // void SelGraAtt(PIGraphicUC* g) 145 // Modifie les attributs graphiques de "g" à partir des attributs courant 146 // de l'objet "PIDrawer" 147 //-- 80 148 81 149 void … … 384 452 { 385 453 mEn = 0; 454 titleT = titleB = ""; 386 455 } 387 456 … … 392 461 393 462 /* --Methode-- */ 463 void PIElDrawer::SetTitles(const char* tt, const char* tb) 464 { 465 if (tt != NULL) titleT = tt; 466 if (tb != NULL) titleB = tb; 467 } 468 469 /* --Methode-- */ 470 void PIElDrawer::SetTitles(string const & tt, string const & tb) 471 { 472 titleT = tt; titleB = tb; 473 } 474 475 /* --Methode-- */ 394 476 void PIElDrawer::Draw(PIGraphicUC* g, float /*xmin*/, float /*ymin*/, float /*xmax*/, float /*ymax*/) 395 477 { … … 397 479 398 480 SelGraAtt(g); // DrawAxes change certains attributs graphiques 481 if (mFSz == PI_NotDefFontSize) g->SelFont(PI_NormalSizeFont); 482 // Trace des titres 483 if ( (titleT.length() > 0) || (titleB.length() > 0) ) { 484 aXdir = false; // Vrai si Axe X de Droite vers Gauche 485 aYdir = false; // Vrai si Axe Y de Haut vers Bas 486 PIGrCoord gas, gds; 487 float fx, fy, fh; 488 // fh = g->GetFontHeightUC(gas, gds); 489 fh = 0.075*(YMax()-YMin()); 490 if ( titleT.length() > 0) { 491 fx = g->CalcStringWidth(titleT.c_str()); 492 if(aXdir) fx = XMax()-(XMax()-XMin()-fx)/2.; 493 else fx = XMin()+(XMax()-XMin()-fx)/2.; 494 if (aYdir) fy = YMin()-fh; 495 else fy = YMax()+fh; 496 g->DrawString(fx, fy, titleT.c_str()); 497 // printf(" PIElDrawer::Draw()/DBG (%g , %g) %s - %g \n", fx, fy, titleT.c_str(), fh); 498 } 499 if ( titleB.length() > 0) { 500 fx = g->CalcStringWidth(titleB.c_str()); 501 if(aXdir) fx = XMax()-(XMax()-XMin()-fx)/2.; 502 else fx = XMin()+(XMax()-XMin()-fx)/2.; 503 if (aYdir) fy = YMax()+fh*1.5; 504 else fy = YMin()-fh*1.5; 505 g->DrawString(fx, fy, titleB.c_str()); 506 // printf(" PIElDrawer::Draw()/DBG (%g , %g) %s - %g \n", fx, fy, titleT.c_str(), fh); 507 } 508 } 399 509 DrwElList::iterator it; 510 PIColors cc = g->GetForeground(); 400 511 for (it = mElist.begin(); it != mElist.end(); it++) 401 512 { 513 if ((*it).col != PI_NotDefColor) g->SelForeground((*it).col); 402 514 switch ( (*it).etyp ) 403 515 { … … 423 535 break; 424 536 } 425 } 426 } 427 428 429 /* --Methode-- */ 430 int PIElDrawer::ElAdd(int typ, PIGrCoord x, PIGrCoord y, PIGrCoord dx, PIGrCoord dy, char* s) 537 g->SelForeground(cc); 538 } 539 } 540 541 542 /* --Methode-- */ 543 int PIElDrawer::ElAdd(int typ, PIGrCoord x, PIGrCoord y, PIGrCoord dx, PIGrCoord dy, const char* s, PIColors c) 431 544 { 432 545 DrwEl dre; … … 435 548 dre.ex = x; dre.ey = y; 436 549 dre.edx = dx; dre.edy = dy; 550 dre.col = c; 437 551 if (s) dre.es = s; 438 552 mElist.push_back(dre); -
trunk/SophyaPI/PI/pidrawer.h
r127 r158 125 125 virtual ~PIElDrawer(); 126 126 127 virtual void SetTitles(const char* tt=NULL, const char* tb=NULL); 128 virtual void SetTitles(string const & tt, string const & tb); 129 127 130 virtual void Draw(PIGraphicUC* g, float xmin, float ymin, float xmax, float ymax); 128 131 129 inline int ElAddLine(PIGrCoord x1, PIGrCoord y1, PIGrCoord x2, PIGrCoord y2) 130 { return( ElAdd(PIDEL_Line, x1, y1, x2, y2, NULL) ); } 131 inline int ElAddText(PIGrCoord x, PIGrCoord y, char* s) 132 { return( ElAdd(PIDEL_Text, x, y, 0, 0, s) ); } 133 inline int ElAddRect(PIGrCoord x, PIGrCoord y, PIGrCoord dx, PIGrCoord dy) 134 { return( ElAdd(PIDEL_Rect, x, y, dx, dy, NULL) ); } 135 inline int ElAddFRect(PIGrCoord x, PIGrCoord y, PIGrCoord dx, PIGrCoord dy) 136 { return( ElAdd(PIDEL_FRect, x, y, dx, dy, NULL) ); } 137 inline int ElAddCirc(PIGrCoord x, PIGrCoord y, PIGrCoord r) 138 { return( ElAdd(PIDEL_Circ, x, y, r, r, NULL) ); } 139 inline int ElAddFCirc(PIGrCoord x, PIGrCoord y, PIGrCoord r) 140 { return( ElAdd(PIDEL_FCirc, x, y, r, r, NULL) ); } 132 inline int ElAddLine(PIGrCoord x1, PIGrCoord y1, PIGrCoord x2, PIGrCoord y2, 133 PIColors c=PI_NotDefColor) 134 { return( ElAdd(PIDEL_Line, x1, y1, x2, y2, NULL, c) ); } 135 inline int ElAddText(PIGrCoord x, PIGrCoord y, const char* s, PIColors c=PI_NotDefColor) 136 { return( ElAdd(PIDEL_Text, x, y, 0, 0, s, c) ); } 137 inline int ElAddRect(PIGrCoord x, PIGrCoord y, PIGrCoord dx, PIGrCoord dy, 138 PIColors c=PI_NotDefColor) 139 { return( ElAdd(PIDEL_Rect, x, y, dx, dy, NULL, c) ); } 140 inline int ElAddFRect(PIGrCoord x, PIGrCoord y, PIGrCoord dx, PIGrCoord dy, 141 PIColors c=PI_NotDefColor) 142 { return( ElAdd(PIDEL_FRect, x, y, dx, dy, NULL, c) ); } 143 inline int ElAddCirc(PIGrCoord x, PIGrCoord y, PIGrCoord r, PIColors c=PI_NotDefColor) 144 { return( ElAdd(PIDEL_Circ, x, y, r, r, NULL, c) ); } 145 inline int ElAddFCirc(PIGrCoord x, PIGrCoord y, PIGrCoord r, PIColors c=PI_NotDefColor) 146 { return( ElAdd(PIDEL_FCirc, x, y, r, r, NULL, c) ); } 141 147 142 148 void ElDel(int id); … … 144 150 145 151 protected: 146 int ElAdd(int typ, PIGrCoord x, PIGrCoord y, PIGrCoord dx, PIGrCoord dy, char* s); 152 int ElAdd(int typ, PIGrCoord x, PIGrCoord y, PIGrCoord dx, PIGrCoord dy, 153 const char* s, PIColors c=PI_NotDefColor); 147 154 #ifdef __DECCXX 148 155 public: … … 153 160 PIGrCoord edx,edy; 154 161 string es; 162 PIColors col; 155 163 }; 156 164 #ifdef __DECCXX … … 162 170 int mEn; 163 171 172 string titleT, titleB; // Titre Haut - Bas 173 164 174 }; 165 175 -
trunk/SophyaPI/PI/pidrwtools.cc
r149 r158 184 184 mOpt[4]->AppendItem("Ital", 513); 185 185 mOpt[4]->AppendItem("Small-Font", 521); 186 mOpt[4]->AppendItem("Small-Bold -Font", 522);187 mOpt[4]->AppendItem("Small-Ital -Font", 523);186 mOpt[4]->AppendItem("Small-Bold", 522); 187 mOpt[4]->AppendItem("Small-Ital", 523); 188 188 mOpt[4]->AppendItem("Big-Font", 531); 189 189 mOpt[4]->AppendItem("Big-Bold", 532); 190 190 mOpt[4]->AppendItem("Big-Ital", 533); 191 mOpt[4]->AppendItem("Huge-Font", 541); 192 mOpt[4]->AppendItem("Huge-Bold", 542); 193 mOpt[4]->AppendItem("Huge-Ital", 543); 191 194 mOpt[4]->SetValue(500); 192 195 mOpt[4]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic); … … 305 308 306 309 PIFontAtt fntatt[4] = { PI_NotDefFontAtt, PI_RomanFont, PI_BoldFont, PI_ItalicFont }; 307 PIFontSize fntsz[4] = { PI_NotDefFontSize, PI_NormalSizeFont, PI_SmallSizeFont, PI_BigSizeFont }; 310 PIFontSize fntsz[5] = { PI_NotDefFontSize, PI_NormalSizeFont, PI_SmallSizeFont, 311 PI_BigSizeFont, PI_HugeSizeFont }; 308 312 CMapId cmap[11] = { CMAP_OTHER, CMAP_GREY32, CMAP_GREYINV32, 309 313 CMAP_COLRJ32, CMAP_COLBR32, CMAP_COLRV32, -
trunk/SophyaPI/PI/pigraph3d.cc
r155 r158 6 6 #include <math.h> 7 7 #include "pigraph3d.h" 8 9 //++ 10 // Class PIGraphic3D 11 // Lib PI 12 // include pigraph3d.h 13 // 14 // Classe fournissant les services de tracé graphique 15 // en coordonnées utilisateur, et quelques primitives de tracé 3D 16 //-- 17 //++ 18 // Links Parent 19 // PIGraphicUC 20 //-- 21 22 //++ 23 // Titre Constructeurs, méthodes 24 //-- 25 //++ 26 // PIGraphic3D(PIGraphicGen* g, PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy) 27 // Constructeur d'un objet "PIGraph3D" à partir d'un "PIGraphic* g". L'espace 28 // de travail du nouvel objet "PIGraphic" correspond au rectangle défini par 29 // "(x0,y0)" , "dx,dy" du "PIGraphic" de départ. 30 // 31 // int kind() 32 // Renvoie le type ("= PI_3DGraphics") 33 //-- 8 34 9 35 /* --Methode-- */ … … 33 59 return PI_3DGraphics; 34 60 } 61 62 //++ 63 // Titre Système de coordonnées 3D et projection 64 // Le système de coordonnées 3D est défini par la position de l'observateur (caméra), 65 // la direction de visée ou la position du centre du champ, 66 // l'ouverture angulaire de la caméra selon les deux 67 // axes de la projection (X,Y), eventuellement un angle correspondant à la rotation 68 // du plan image ("psi"). Les angles d'Euler ("teta", "phi", "psi" ) sont utilisés 69 // dans la définition du système de coordonnées et la projection est de type 70 // perspective. 71 // 72 // Les coordonnées utilisateur définissant le plan image ("PIGraphicUC") vont de 73 // X: "-dax , +dax" Y : "-day , +day". 74 //-- 75 76 //++ 77 // void Set3DCS_Obs(float xo, float yo, float zo, float teta, float phi, float psi, - 78 // float dax, float day, float co, float dco=0.2) 79 // Définition du système de projection 3D à l'aide de la position de l'observateur 80 // et de la direction de visée. 81 //| xo,yo,zo : Position de l'observateur (camera) 82 //| teta,phi : Direction de visee 83 //| psi : rotation du plan image 84 //| dax , day : Ouverture du plan image selon les deux axes = Xmax,Ymax / Z 85 //| co : distance au centre du champ 86 //| dco : profondeur de champ 87 // 88 // void Set3DCS(float xc, float yc, float zc, float xo, float yo, float zo, - 89 // float dax, float day, float dco=0.2, float psi=0.) 90 // Définition du système de projection 3D à partir de la position de l'observateur et 91 // du centre du champ. 92 //| xc,yc,zc : Position du centre du champ 93 //| xo,yo,zo : Position de l'observateur (camera) 94 //| dax , day : Ouverture du plan image selon les deux axes = Xmax,Ymax / Z 95 //| dco : profondeur de champ 96 //| psi : rotation du plan image 97 //-- 35 98 36 99 static float deuxpi = 2*M_PI; … … 128 191 } 129 192 193 //++ 194 // bool Get3DCS(float& xc, float& yc, float& zc, float& xo, float& yo, float& zo, - 195 // float& teta, float& phi, float& psi, float& dax, float& day, float& co, float& dco); 196 // Renvoie les paramètres de définition du système de projection 3D. 197 // "Rc= true" si défini par "Set3DCS_Obs()" 198 // 199 // void RotateObserver(float teta, float phi, float psi=0., bool rel=true) 200 // Positionne l'observateur (la caméra) en maintenant la position 201 // du centre de champ fixe. Si "rel=false" : "teta, phi" determine la nouvelle 202 // direction de visée. Si "rel=false" : la direction de visée est tournée 203 // de l'angle "teta,phi". 204 // void RotateObject(float teta, float phi, bool rel=true) 205 // Repostionne le centre du champ en maintenant la position de l'observateur fixe. 206 // Si "rel=false" : "teta, phi" determine la nouvelle direction de visée. 207 // Si "rel=false" : la direction de visée est tournée de l'angle "teta,phi". 208 // 209 // void ZoomInOut(float fco, float fdax, float fday, bool rel=true) 210 // Eloigne ou approche l'observateur et modifie l'ouverture du plan image. 211 // si "real=true" : "fco, fdax, fday" sont des facteurs multiplicatifs 212 // par rapport aux valeurs actuelles, sinon des valeurs absolues. 213 //| fco : distance observateur - centre du champ 214 //| fdax, fday : ouverture du plan image 215 //-- 130 216 131 217 /* --Methode-- */ … … 141 227 } 142 228 229 230 /* --Methode-- */ 231 void PIGraphic3D::RotateObserver(float teta, float phi, float psi, bool rel) 232 // Positionne l'observateur (la camera) de maniere a ce que la direction de 233 // visee soit tO=teta, pO=phi (rel=false) / tO+=teta pO+=phi (rel=true) 234 // en conservant le centre de champ fixe 235 { 236 if (rel) { 237 teta += tO; 238 phi += fO; 239 psi += pO; 240 } 241 while (teta < 0.) teta += deuxpi; 242 while (teta > deuxpi) teta -= deuxpi; 243 if (teta > M_PI) { teta = M_PI-teta; phi = phi+M_PI; } 244 float xo,yo,zo; 245 zo = -cos((double)teta)*lCO+zC; 246 xo = -sin((double)teta)*cos((double)phi)*lCO+xC; 247 yo = -sin((double)teta)*sin((double)phi)*lCO+yC; 248 Set3DCS(xC,yC,zC, xo,yo,zo, daxO, dayO, dlCO, psi); 249 } 250 251 /* --Methode-- */ 252 void PIGraphic3D::RotateObject(float teta, float phi, bool rel) 253 // Positionne l'objet (centre du champ) de maniere a ce que la direction de 254 // visee soit tO=teta, pO=phi (rel=false) / tO+=teta pO+=phi (rel=true) 255 // en conservant la position de l'observateur fixe. 256 { 257 if (rel) { 258 teta += tO; 259 phi += fO; 260 } 261 while (teta < 0.) teta += deuxpi; 262 while (teta > deuxpi) teta -= deuxpi; 263 if (teta > M_PI) { teta = M_PI-teta; phi = phi+M_PI; } 264 float xc,yc,zc; 265 zc = cos((double)teta)*lCO+zO; 266 xc = sin((double)teta)*cos((double)phi)*lCO+xO; 267 yc = sin((double)teta)*sin((double)phi)*lCO+yO; 268 Set3DCS(xc,yc,zc, xO,yO,zO, daxO, dayO, dlCO, pO); 269 } 270 271 /* --Methode-- */ 272 void PIGraphic3D::ZoomInOut(float fco, float fdax, float fday, bool rel) 273 { 274 if (fco < 0.001) fco = 1.; 275 if (fdax < 0.001) fdax = 1.; 276 if (fday < 0.001) fday = 1.; 277 double dl; 278 if (rel) { 279 dl = fco*lCO; 280 fdax *= daxO; 281 fday *= dayO; 282 } 283 else dl = fco; 284 float xo,yo,zo; 285 if (dl < 1.e-5) dl = 1.e-5; 286 zo = zC-cos((double)tO)*dl; 287 xo = xC-sin((double)tO)*cos((double)fO)*dl; 288 yo = yC-sin((double)tO)*sin((double)fO)*dl; 289 Set3DCS(xC,yC,zC, xo,yo,zo, fdax, fday, dlCO, pO); 290 // Set3DCS_Obs(xo, yo, zo, tO, fO, pO, daxO*fda, dayO*fda, dl, dlCO); 291 } 292 293 /* --Methode-- */ 294 void PIGraphic3D::C3DC2ObsCS(float x, float y, float z, float& xp, float& yp, float& zp) 295 { 296 double xc, yc, zc; 297 xc = x-xO; yc = y-yO; zc = z-zO; 298 xp = RE[0][0]*xc+RE[0][1]*yc+RE[0][2]*zc; 299 yp = -RE[1][0]*xc+RE[1][1]*yc+RE[1][2]*zc; 300 zp = RE[2][0]*xc+RE[2][1]*yc+RE[2][2]*zc; 301 } 302 303 /* --Methode-- */ 304 void PIGraphic3D::Proj3DC2GrC(float x, float y, float z, float& xpix, float& ypix) 305 { 306 double xc, yc, zc; 307 float xp, yp, zp; 308 xc = x-xO; yc = y-yO; zc = z-zO; 309 xp = RE[0][0]*xc+RE[0][1]*yc+RE[0][2]*zc; 310 yp = RE[1][0]*xc+RE[1][1]*yc+RE[1][2]*zc; 311 zp = RE[2][0]*xc+RE[2][1]*yc+RE[2][2]*zc; 312 if ((zp>-1.e-6) && (zp < 1.e-6)) // Protection Divide/0 313 { xpix = ypix = 0.; return; } 314 xpix = (float)(xOrg + (xp/zp)*xScale); 315 ypix = (float)(yOrg + (yp/zp)*yScale); 316 // printf("-DBG-Proj3DC2GrC() %g %g %g -> %g %g %g -> %g %g %g -> (%g %g)\n", x,y,z,xc,yc,zc,xp,yp,zp,xp/zp,yp/zp); 317 // printf("-DBG- ... (%g %g %g - %g %g) %g %g - %g %g -> %g %g \n", xO,yO,zO, tO,fO, xOrg, yOrg,xScale,yScale ,xpix,ypix); 318 } 319 320 //++ 321 // Titre Primitives de tracé 3D 322 //-- 323 //++ 324 // void DrawString3D(PIGrCoord x0, PIGrCoord y0, PIGrCoord z0, char* s) 325 // Tracé de chaîne de caractères à la position "(x0,y0,z0)" 326 // void DrawOpaqueString3D(PIGrCoord x0, PIGrCoord y0, PIGrCoord z0, char* s) 327 // Tracé de chaîne opaque à la position "(x0,y0,z0)" 328 // void DrawLine3D(PIGrCoord x1, PIGrCoord y1, PIGrCoord z1, - 329 // PIGrCoord x2, PIGrCoord y2, PIGrCoord z2) 330 // Tracé d'une ligne entre les deux points "(x1,y1,z1)" et "(x2,y2,z2)" 331 // void DrawPolygon3D(PIGrCoord *x, PIGrCoord *y, PIGrCoord *z, int n) 332 // Tracé de contour de polygone - sommets définis par le tableau 333 // "(x[i],y[i],z[i])" , "i=0..n-1" 334 // void DrawFPolygon3D(PIGrCoord *x, PIGrCoord *y, PIGrCoord *z, int n) 335 // Tracé de polygone - "(x[i],y[i],z[i])" , "i=0..n-1" 336 // void DrawMarker3D(PIGrCoord x0, PIGrCoord y0, PIGrCoord z0) 337 // Tracé d'un signe (marker) au point "(x0,y0,z0)" 338 // void DrawMarkers3D(PIGrCoord *x, PIGrCoord *y, PIGrCoord *z, int n) 339 // Tracé de signes (marker) aux points "(x[i],y[i],z[i])" , "i=0..n-1" 340 //-- 341 342 /* --Methode-- */ 343 void PIGraphic3D::DrawString3D(PIGrCoord x0, PIGrCoord y0, PIGrCoord z0, const char* s) 344 { 345 if (!mGrC) return; 346 float xf, yf; 347 Proj3DC2GrC(x0, y0, z0, xf, yf); 348 mGrC->DrawString(xf, yf, s); 349 return; 350 } 351 352 /* --Methode-- */ 353 void PIGraphic3D::DrawOpaqueString3D(PIGrCoord x0, PIGrCoord y0, PIGrCoord z0, const char* s) 354 { 355 if (!mGrC) return; 356 float xf, yf; 357 Proj3DC2GrC(x0, y0, z0, xf, yf); 358 mGrC->DrawOpaqueString(xf, yf, s); 359 return; 360 } 361 362 /* --Methode-- */ 363 void PIGraphic3D::DrawLine3D(PIGrCoord x1, PIGrCoord y1, PIGrCoord z1, 364 PIGrCoord x2, PIGrCoord y2, PIGrCoord z2) 365 { 366 if (!mGrC) return; 367 float xf1, yf1, xf2, yf2; 368 Proj3DC2GrC(x1, y1, z1, xf1, yf1); 369 Proj3DC2GrC(x2, y2, z2, xf2, yf2); 370 // printf("-DBG-DrawLine3D() : %g %g %g -> %g %g | %g %g %g -> %g %g\n", 371 // (float)x1, (float)y1, (float)z1, xf1, yf1, 372 // (float)x2, (float)y2, (float)z2, xf2, yf2 ); 373 mGrC->DrawLine(xf1, yf1, xf2, yf2); 374 } 375 376 #define NMXMULTP 30 // Pour multipoint sans new 377 378 /* --Methode-- */ 379 void PIGraphic3D::DrawPolygon3D(PIGrCoord *x, PIGrCoord *y, PIGrCoord *z, int n) 380 { 381 PIGrCoord xc[NMXMULTP], yc[NMXMULTP]; 382 PIGrCoord *pxc, *pyc; 383 int i; 384 float xf, yf; 385 386 if (!mGrC) return; 387 if (n <= 0) return; 388 389 if (n > NMXMULTP) { pxc = new PIGrCoord[n]; pyc = new PIGrCoord[n]; } 390 else { pxc = xc; pyc = yc; } 391 for(i=0; i<n; i++) { 392 Proj3DC2GrC(x[i], y[i], z[i], xf, yf); 393 pxc[i] = xf; pyc[i] = yf; 394 } 395 mGrC->DrawPolygon(pxc, pyc, n, false); 396 if (n > NMXMULTP) { delete[] pxc; delete[] pyc; } 397 return; 398 } 399 400 401 /* --Methode-- */ 402 void PIGraphic3D::DrawFPolygon3D(PIGrCoord *x, PIGrCoord *y, PIGrCoord *z, int n) 403 { 404 PIGrCoord xc[NMXMULTP], yc[NMXMULTP]; 405 PIGrCoord *pxc, *pyc; 406 int i; 407 float xf, yf; 408 409 if (!mGrC) return; 410 if (n <= 0) return; 411 412 if (n > NMXMULTP) { pxc = new PIGrCoord[n]; pyc = new PIGrCoord[n]; } 413 else { pxc = xc; pyc = yc; } 414 for(i=0; i<n; i++) { 415 Proj3DC2GrC(x[i], y[i], z[i], xf, yf); 416 pxc[i] = xf; pyc[i] = yf; 417 } 418 mGrC->DrawFPolygon(pxc, pyc, n, false); 419 if (n > NMXMULTP) { delete[] pxc; delete[] pyc; } 420 return; 421 } 422 423 /* --Methode-- */ 424 void PIGraphic3D::DrawMarker3D(PIGrCoord x0, PIGrCoord y0, PIGrCoord z0) 425 { 426 if (!mGrC) return; 427 float xf, yf; 428 Proj3DC2GrC(x0, y0, z0, xf, yf); 429 mGrC->DrawMarker(xf, yf); 430 return; 431 } 432 433 /* --Methode-- */ 434 void PIGraphic3D::DrawMarkers3D(PIGrCoord *x, PIGrCoord *y, PIGrCoord *z, int n) 435 { 436 PIGrCoord xc[NMXMULTP], yc[NMXMULTP]; 437 PIGrCoord *pxc, *pyc; 438 int i; 439 float xf, yf; 440 441 if (!mGrC) return; 442 if (n <= 0) return; 443 444 if (n > NMXMULTP) { pxc = new PIGrCoord[n]; pyc = new PIGrCoord[n]; } 445 else { pxc = xc; pyc = yc; } 446 for(i=0; i<n; i++) { 447 Proj3DC2GrC(x[i], y[i], z[i], xf, yf); 448 pxc[i] = xf; pyc[i] = yf; 449 } 450 mGrC->DrawMarkers(pxc, pyc, n); 451 if (n > NMXMULTP) { delete[] pxc; delete[] pyc; } 452 return; 453 } 454 455 456 // Methode pour debugger 143 457 /* --Methode-- */ 144 458 void PIGraphic3D::PrintCS() … … 164 478 printf("C+(0,1,1) -> %g %g %g -> %g %g \n", xp, yp, zp, xpix, ypix); 165 479 } 166 167 /* --Methode-- */168 void PIGraphic3D::RotateObserver(float teta, float phi, float psi, bool rel)169 // Positionne l'observateur (la camera) de maniere a ce que la direction de170 // visee soit tO=teta, pO=phi (rel=false) / tO+=teta pO+=phi (rel=true)171 // en conservant le centre de champ fixe172 {173 if (rel) {174 teta += tO;175 phi += fO;176 psi += pO;177 }178 while (teta < 0.) teta += deuxpi;179 while (teta > deuxpi) teta -= deuxpi;180 if (teta > M_PI) { teta = M_PI-teta; phi = phi+M_PI; }181 float xo,yo,zo;182 zo = -cos((double)teta)*lCO+zC;183 xo = -sin((double)teta)*cos((double)phi)*lCO+xC;184 yo = -sin((double)teta)*sin((double)phi)*lCO+yC;185 Set3DCS(xC,yC,zC, xo,yo,zo, daxO, dayO, dlCO, psi);186 }187 188 /* --Methode-- */189 void PIGraphic3D::RotateObject(float teta, float phi, bool rel)190 // Positionne l'objet (centre du champ) de maniere a ce que la direction de191 // visee soit tO=teta, pO=phi (rel=false) / tO+=teta pO+=phi (rel=true)192 // en conservant la position de l'observateur fixe.193 {194 if (rel) {195 teta += tO;196 phi += fO;197 }198 while (teta < 0.) teta += deuxpi;199 while (teta > deuxpi) teta -= deuxpi;200 if (teta > M_PI) { teta = M_PI-teta; phi = phi+M_PI; }201 float xc,yc,zc;202 zc = cos((double)teta)*lCO+zO;203 xc = sin((double)teta)*cos((double)phi)*lCO+xO;204 yc = sin((double)teta)*sin((double)phi)*lCO+yO;205 Set3DCS(xc,yc,zc, xO,yO,zO, daxO, dayO, dlCO, pO);206 }207 208 /* --Methode-- */209 void PIGraphic3D::ZoomInOut(float fco, float fdax, float fday, bool rel)210 {211 if (fco < 0.001) fco = 1.;212 if (fdax < 0.001) fdax = 1.;213 if (fday < 0.001) fday = 1.;214 double dl;215 if (rel) {216 dl = fco*lCO;217 fdax *= daxO;218 fday *= dayO;219 }220 else dl = fco;221 float xo,yo,zo;222 if (dl < 1.e-5) dl = 1.e-5;223 zo = zC-cos((double)tO)*dl;224 xo = xC-sin((double)tO)*cos((double)fO)*dl;225 yo = yC-sin((double)tO)*sin((double)fO)*dl;226 Set3DCS(xC,yC,zC, xo,yo,zo, fdax, fday, dl, pO);227 // Set3DCS_Obs(xo, yo, zo, tO, fO, pO, daxO*fda, dayO*fda, dl, dlCO);228 }229 230 /* --Methode-- */231 void PIGraphic3D::C3DC2ObsCS(float x, float y, float z, float& xp, float& yp, float& zp)232 {233 double xc, yc, zc;234 xc = x-xO; yc = y-yO; zc = z-zO;235 xp = RE[0][0]*xc+RE[0][1]*yc+RE[0][2]*zc;236 yp = -RE[1][0]*xc+RE[1][1]*yc+RE[1][2]*zc;237 zp = RE[2][0]*xc+RE[2][1]*yc+RE[2][2]*zc;238 }239 240 /* --Methode-- */241 void PIGraphic3D::Proj3DC2GrC(float x, float y, float z, float& xpix, float& ypix)242 {243 double xc, yc, zc;244 float xp, yp, zp;245 xc = x-xO; yc = y-yO; zc = z-zO;246 xp = RE[0][0]*xc+RE[0][1]*yc+RE[0][2]*zc;247 yp = RE[1][0]*xc+RE[1][1]*yc+RE[1][2]*zc;248 zp = RE[2][0]*xc+RE[2][1]*yc+RE[2][2]*zc;249 if ((zp>-1.e-6) && (zp < 1.e-6)) // Protection Divide/0250 { xpix = ypix = 0.; return; }251 xpix = (float)(xOrg + (xp/zp)*xScale);252 ypix = (float)(yOrg + (yp/zp)*yScale);253 // printf("-DBG-Proj3DC2GrC() %g %g %g -> %g %g %g -> %g %g %g -> (%g %g)\n", x,y,z,xc,yc,zc,xp,yp,zp,xp/zp,yp/zp);254 // printf("-DBG- ... (%g %g %g - %g %g) %g %g - %g %g -> %g %g \n", xO,yO,zO, tO,fO, xOrg, yOrg,xScale,yScale ,xpix,ypix);255 }256 257 /* --Methode-- */258 void PIGraphic3D::DrawString3D(PIGrCoord x0, PIGrCoord y0, PIGrCoord z0, char* s)259 {260 if (!mGrC) return;261 float xf, yf;262 Proj3DC2GrC(x0, y0, z0, xf, yf);263 mGrC->DrawString(xf, yf, s);264 return;265 }266 267 /* --Methode-- */268 void PIGraphic3D::DrawOpaqueString3D(PIGrCoord x0, PIGrCoord y0, PIGrCoord z0, char* s)269 {270 if (!mGrC) return;271 float xf, yf;272 Proj3DC2GrC(x0, y0, z0, xf, yf);273 mGrC->DrawOpaqueString(xf, yf, s);274 return;275 }276 277 /* --Methode-- */278 void PIGraphic3D::DrawLine3D(PIGrCoord x1, PIGrCoord y1, PIGrCoord z1,279 PIGrCoord x2, PIGrCoord y2, PIGrCoord z2)280 {281 if (!mGrC) return;282 float xf1, yf1, xf2, yf2;283 Proj3DC2GrC(x1, y1, z1, xf1, yf1);284 Proj3DC2GrC(x2, y2, z2, xf2, yf2);285 // printf("-DBG-DrawLine3D() : %g %g %g -> %g %g | %g %g %g -> %g %g\n",286 // (float)x1, (float)y1, (float)z1, xf1, yf1,287 // (float)x2, (float)y2, (float)z2, xf2, yf2 );288 mGrC->DrawLine(xf1, yf1, xf2, yf2);289 }290 291 #define NMXMULTP 30 // Pour multipoint sans new292 293 /* --Methode-- */294 void PIGraphic3D::DrawPolygon3D(PIGrCoord *x, PIGrCoord *y, PIGrCoord *z, int n)295 {296 PIGrCoord xc[NMXMULTP], yc[NMXMULTP];297 PIGrCoord *pxc, *pyc;298 int i;299 float xf, yf;300 301 if (!mGrC) return;302 if (n <= 0) return;303 304 if (n > NMXMULTP) { pxc = new PIGrCoord[n]; pyc = new PIGrCoord[n]; }305 else { pxc = xc; pyc = yc; }306 for(i=0; i<n; i++) {307 Proj3DC2GrC(x[i], y[i], z[i], xf, yf);308 pxc[i] = xf; pyc[i] = yf;309 }310 mGrC->DrawPolygon(pxc, pyc, n, false);311 if (n > NMXMULTP) { delete[] pxc; delete[] pyc; }312 return;313 }314 315 316 /* --Methode-- */317 void PIGraphic3D::DrawFPolygon3D(PIGrCoord *x, PIGrCoord *y, PIGrCoord *z, int n)318 {319 PIGrCoord xc[NMXMULTP], yc[NMXMULTP];320 PIGrCoord *pxc, *pyc;321 int i;322 float xf, yf;323 324 if (!mGrC) return;325 if (n <= 0) return;326 327 if (n > NMXMULTP) { pxc = new PIGrCoord[n]; pyc = new PIGrCoord[n]; }328 else { pxc = xc; pyc = yc; }329 for(i=0; i<n; i++) {330 Proj3DC2GrC(x[i], y[i], z[i], xf, yf);331 pxc[i] = xf; pyc[i] = yf;332 }333 mGrC->DrawFPolygon(pxc, pyc, n, false);334 if (n > NMXMULTP) { delete[] pxc; delete[] pyc; }335 return;336 }337 338 /* --Methode-- */339 void PIGraphic3D::DrawMarker3D(PIGrCoord x0, PIGrCoord y0, PIGrCoord z0)340 {341 if (!mGrC) return;342 float xf, yf;343 Proj3DC2GrC(x0, y0, z0, xf, yf);344 mGrC->DrawMarker(xf, yf);345 return;346 }347 348 /* --Methode-- */349 void PIGraphic3D::DrawMarkers3D(PIGrCoord *x, PIGrCoord *y, PIGrCoord *z, int n)350 {351 PIGrCoord xc[NMXMULTP], yc[NMXMULTP];352 PIGrCoord *pxc, *pyc;353 int i;354 float xf, yf;355 356 if (!mGrC) return;357 if (n <= 0) return;358 359 if (n > NMXMULTP) { pxc = new PIGrCoord[n]; pyc = new PIGrCoord[n]; }360 else { pxc = xc; pyc = yc; }361 for(i=0; i<n; i++) {362 Proj3DC2GrC(x[i], y[i], z[i], xf, yf);363 pxc[i] = xf; pyc[i] = yf;364 }365 mGrC->DrawMarkers(pxc, pyc, n);366 if (n > NMXMULTP) { delete[] pxc; delete[] pyc; }367 return;368 } -
trunk/SophyaPI/PI/pigraph3d.h
r155 r158 1 // This may look like C code, but it is really -*- C++ -*- 1 2 // Module PI : Peida Interactive PIGraphic3D 2 3 // Trace graphiques 3D R. Ansari 06/98 … … 34 35 virtual void Proj3DC2GrC(float x, float y, float z, float& xpix, float& ypix); 35 36 36 virtual void DrawString3D(PIGrCoord x0, PIGrCoord y0, PIGrCoord z0, c har* s);37 virtual void DrawOpaqueString3D(PIGrCoord x0, PIGrCoord y0, PIGrCoord z0, c har* s);37 virtual void DrawString3D(PIGrCoord x0, PIGrCoord y0, PIGrCoord z0, const char* s); 38 virtual void DrawOpaqueString3D(PIGrCoord x0, PIGrCoord y0, PIGrCoord z0, const char* s); 38 39 virtual void DrawLine3D(PIGrCoord x1, PIGrCoord y1, PIGrCoord z1, 39 40 PIGrCoord x2, PIGrCoord y2, PIGrCoord z2); -
trunk/SophyaPI/PI/pigraphgen.cc
r147 r158 17 17 // "PIGraphicWin" ou "PIGraphicUC" ou ... 18 18 // La classe "PIGraphicWin" a une implementation dépendante du système 19 // utilisé et sa 20 // " 21 // Un type particulier *PIGrCoord* permettant de passer les coordonnées 22 // graphiques en entier ("int") ou en flottant ("float"). 23 //-- 24 25 // 26 // " 27 // " 28 // " 29 // " 30 // " 31 // " 19 // utilisé (Mac, XWindow, ...). 20 // Un type particulier *PIGrCoord* est défini pour la spécification 21 // des coordonnées graphiques. 22 //-- 23 //++ 24 // Links Voir aussi 25 // PIGrCoord 26 // PIColorMap 27 //-- 28 29 //++ 30 // Titre Constructeurs 31 //-- 32 //++ 33 // PIGraphic() 34 // Constructeur utilisé par les classes dérivées. 35 // PIGraphic(PIWdg* wdg) 36 // Constructeur pour les *PIGraphicWin*. Objet "PIGraphic" capable 37 // de tracer dans un "PIWdg". 38 //-- 39 //++ 40 //-- 41 // Titre Méthodes 42 //++ 43 // int kind() 44 // Renvoie le type de l'objet "PIGraphic" . 45 // * PI_ScrWindowGraphics : Objet PIGraphic associé à une fenêtre sur l'écran (PIWdg) 46 // * PI_PSFileGraphics : Objet PIGraphic à un fichier PostScript (pour impression papier) 47 // * PI_UCGraphics : Objet PIGraphic travaillant dans un système de coordonnées utilisateur. 48 // * PI_3DGraphics : Objet PIGraphic fournissant des méthodes de tracé en coordonnées 3-D 49 // void GetGrSpace(PIGrCoord& xmin, PIGrCoord& xmax, PIGrCoord& ymin, PIGrCoord& ymax) 50 // Renvoie les limites de l'espace graphique - Coordonnées fenêtre pour un PIGraphicWin, 51 // Limites définies par l'utilisateur pour un PIGraphicUC 52 // void Erase(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy) 53 // Efface le rectangle défini par le coin "x0,y0", de longeur et de largeur "dx,dy" 54 // en utilisant la couleur d'arrière plan (Background) 55 //-- 56 32 57 33 58 /* --Methode-- */ … … 52 77 return PI_ScrWindowGraphics; 53 78 } 79 54 80 55 81 /* --Methode-- */ … … 63 89 } 64 90 } 91 92 //++ 93 // Titre Tracés de texte 94 //-- 95 //++ 96 // void DrawString(PIGrCoord x, PIGrCoord y, const char* s, int pos = 0) 97 // Trace la chaîne de caractères "s" à la position "x,y", 98 // en utilisant la couleur d'avant-plan (Foreground) 99 // void DrawOpaqueString(PIGrCoord x, PIGrCoord y, const char* s, int pos = 0) 100 // Trace la chaîne de caractères "s" à la position "x,y" . La couleur d' 101 // arrière-plan est utilisée pour remplir la zone rectangulaire occupée par 102 // le tracé de texte. 103 //-- 104 105 //++ 106 // Titre Tracés de lignes et de figures géometriques 107 //-- 108 //++ 109 // void DrawLine(PIGrCoord x1, PIGrCoord y1, PIGrCoord x2, PIGrCoord y2) 110 // Trace une ligne entre les points de coordonnées "(x1,y1)" et "(x2,y2)", 111 // en utilisant la couleur d'avant-plan (Foreground) 112 // void DrawBox(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy) 113 // Tracé du contour d'un rectangle défini par la position du coin "(x0,y0)" 114 // et de taille "dx,dy" avec la couleur d'avant-plan. 115 // void DrawFBox(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy) 116 // Tracé d'un rectangle plein, défini par la position du coin "(x0,y0)" 117 // et de taille "dx,dy" avec la couleur d'avant-plan. 118 // void DrawCircle(PIGrCoord x0, PIGrCoord y0, PIGrCoord r) 119 // Tracé du contour d'un cercle centré en "(x0,y0)", de rayon "r" 120 // void DrawFCircle(PIGrCoord x0, PIGrCoord y0, PIGrCoord r) 121 // Tracé d'un cercle plein centré en "(x0,y0)", de rayon "r" 122 // void DrawOval(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy) 123 // Tracé d'une ellipse incluse dans le rectangle "(x0,y0)" , "dx,dy" 124 // void DrawFOval(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy) 125 // Tracé d'une ellipse pleine incluse dans le rectangle "(x0,y0)" , "dx,dy" 126 // void DrawPolygon(PIGrCoord *x, PIGrCoord *y, int n, bool cinc=true) 127 // Tracé du contour d'un polygone défini par le tableau des "n" points "x,y". 128 // Si "cinc==true", les coordonnées seront considérées comme relatives 129 // à la position du point "(x[0], y[0])". Dans le cas contraire, chaque couple 130 // "(x[i], y[i])" représentera les coordonnées absolues d'un coin du polygone. 131 // void DrawFPolygon(PIGrCoord *x, PIGrCoord *y, int n, bool cinc=true) 132 // Tracé d'un polygone plein de la couleur d'avant-plan. 133 // void DrawArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy, float degdeb, float degfin) 134 // Tracé d'un arc de cercle ou d'ellipse, inclu dans le "(x0,y0)" , "dx,dy" 135 // entre les angles (en degré) "degdeb" - "degfin" 136 // void DrawFArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy, float degdeb, float degfin) 137 // Tracé d'un arc plein, inclu dans le "(x0,y0)" , "dx,dy" 138 // entre les angles (en degré) "degdeb" - "degfin" 139 //-- 140 141 //++ 142 // Titre Tracés de signes 143 //-- 144 //++ 145 // void DrawMarker(PIGrCoord x0, PIGrCoord y0) 146 // Tracé d'un signe au point "(x0,y0)". Le choix du signe tracé s'effectue 147 // à travers la méthode "SelMarker()" 148 // void DrawMarkers(PIGrCoord *x, PIGrCoord *y, int n) 149 // Tracé de "n" signes aux points "(x[i],y[i])" 150 //-- 151 152 //++ 153 // Titre Tracé d'images (pixmap) 154 //-- 155 //++ 156 // void DrawPixmap(PIGrCoord x, PIGrCoord y, unsigned char *pix, int sx, int sy, PIColorMap* cmap) 157 // Tracé d'un pixmap dans un rectangle positionné en "(x,y)". Le tableau des pixels 158 // "pix", de taille "sx,sy" représente les index dans la table de couleur "cmap". 159 //-- 160 161 //++ 162 // Titre Modifications des attributs graphiques 163 //-- 164 //++ 165 // void SelForeground(PIColors col=PI_Black) 166 // Choix de la couleur de tracé d'avant-plan 167 //| PI_Black , PI_White, PI_Grey , PI_Red , PI_Blue , PI_Green , 168 //| PI_Yellow , PI_Magenta , PI_Cyan , PI_Turquoise , PI_NavyBlue , 169 //| PI_Orange , PI_SiennaRed , PI_Purple , PI_LimeGreen , PI_Gold 170 // void SelBackground(PIColors col=PI_White) 171 // Choix de la couleur d'arrière-plan 172 // void SelForeground(PIColorMap& cmap, int cid) 173 // Choix de la couleur de tracé d'avant-plan: Couleur numéro "cid" de la table de couleur "cmap" 174 // void SelBackground(PIColorMap& cmap, int cid) 175 // Choix de la couleur d'arrière-plan: Couleur numéro "cid" de la table de couleur "cmap" 176 // void SelGOMode(PIGOMode mod=PI_GOCopy) 177 // Choix du mode de tracé graphique: "PI_GOCopy" ou "PI_GOXOR" 178 // void SelFont(PIFontSize sz=PI_NormalSizeFont, PIFontAtt att=PI_RomanFont) 179 // Choix de la fonte pour le tracé de texte 180 //| PI_SmallSizeFont , PI_NormalSizeFont , PI_BigSizeFont, PI_HugeSizeFont 181 //| PI_RomanFont , PI_BoldFont , PI_ItalicFont 182 // void SelFontSzPt(int npt=12, PIFontAtt att=PI_RomanFont) 183 // Choix de la fonte avec spécification de taille en points (pixels sur l'écran) 184 // void SelLine(PILineAtt att=PI_NormalLine) 185 // Choix du type de ligne pour le tracé des lignes et contours 186 //| PI_NormalLine, PI_ThinLine , PI_ThickLine 187 //| PI_DashedLine, PI_ThinDashedLine , PI_ThickDashedLine 188 // void SelMarker(int msz=3, PIMarker mrk=PI_DotMarker) 189 // Choix de la taille et du type de signe pour "DrawMarker() / DrawMarkers()" 190 //| PI_DotMarker , PI_PlusMarker , PI_CrossMarker 191 //| PI_CircleMarker , PI_FCircleMarker , PI_BoxMarker , PI_FBoxMarker 192 //| PI_TriangleMarker , PI_FTriangleMarker , PI_StarMarker , PI_FStarMarker 193 // (Les "StarMaker" ne sont pas encore implémentés 11/98) 194 //-- 195 196 //++ 197 // Titre Sélection de la zone de tracé (clip) 198 //-- 199 //++ 200 // void SetClipRectangle(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy) 201 // Limite la zone de tracé permise au rectangle "(x0,y0)", "dx,dy" 202 // void ClearClipRectangle() 203 // Supprime si nécéssaire la limitation de la zone de tracé. 204 //-- 205 206 //++ 207 // Titre Accès aux attributs graphiques 208 //-- 209 //++ 210 // PIColors GetForeground() 211 // Renvoie la couleur de tracé d'avant-plan courante. 212 // ("PI_ColorFromMap" si défini à partir d'une table de couleur 213 // PIColors GetBackground() 214 // Renvoie la couleur d'arrière-plan courante. 215 // PIGOMode GetGOMode() 216 // Renvoie le mode de tracé graphique courante. 217 // PIFontAtt GetFontAtt() 218 // Renvoie les attributs de la fonte courante. 219 // int GetFontSize() 220 // Renvoie la taille de la fonte courante. 221 // PILineAtt GetLineAtt() 222 // Renvoie le type de ligne courant 223 // PIMarker GetMarker() 224 // Renvoie le type de signe (Marker) courant 225 // int GetMarkerSize() 226 // Renvoie la taille des signes (Marker) pour le marker courant 227 // int GetFontHeight(int& asc, int& desc) 228 // Renvoie la hauteur des caractères, ainsi que la taille au dessus 229 // et en-dessous de la ligne de base ("asc , desc") pour la fonte courante 230 // PIGrCoord CalcStringWidth(char const* s) 231 // Renvoie la largeur occupé par un texte s'il était affiché dans le 232 // système de coordonnées courant (Fenêtre ou UC). 233 //-- 234 235 //++ 236 // Titre Sauvegarde et rappel des attributs graphiques 237 //-- 238 //++ 239 // void SaveGraphicAtt() 240 // Sauvegarde des attributs graphiques courants 241 // void RestoreGraphicAtt() 242 // Utilisation de l'ensemble des attributs graphiques sauvegardés par un appel 243 // à "SaveGraphicAtt()" 244 //-- 245 65 246 66 247 /* --Methode-- */ … … 89 270 return; 90 271 } 272 273 274 275 276 //++ 277 // Class PIGrCoord 278 // Lib PI 279 // include pigraphgen.h 280 // 281 // Classe utilisé pour la spécifiaction de coordonnées graphique. 282 // Des constructeurs et des méthodes de conversion à partir 283 // et vers des "int", "float" et "double" sont définis. 284 // L'objet conserve le type effectif de l'argument lors de la 285 // création ou de la dernière affectation. 286 // 287 //| PIGrCoord gco; 288 //| gco = 3.141596 ; 289 //| int ic = gco; // ic -> 3 290 //| float fc = gco; // fc -> 3.141596 291 //-- 292 //++ 293 // Links Voir aussi 294 // PIGraphic 295 //-- 296 297 //++ 298 // Titre Constructeurs 299 //-- 300 //++ 301 // 302 // PIGrCoord() 303 // Constructeur par défaut ("intVal=floatVal=0") 304 // PIGrCoord(int a) 305 // Constructeur à partir de l'entier "a" 306 // PIGrCoord(float a) 307 // Constructeur à partir de la valeur flottante "a" 308 // PIGrCoord(double a) 309 // Constructeur à partir de la valeur flottante double précision "a" 310 //-- 311 //++ 312 // Titre Opérateurs de conversion 313 //-- 314 //++ 315 // operator int() 316 // Conversion en entier "int" 317 // operator short() 318 // Conversion en entier "short" 319 // operator unsigned int() 320 // Conversion en entier non signé "unsigned int" 321 // operator unsigned short() 322 // Conversion en entier non signé "unsigned short" 323 // operator float() 324 // Conversion en réél "float" 325 //-- 326 //++ 327 // Titre Opérateurs d'affectation 328 //-- 329 //++ 330 // PIGrCoord& operator= (int a) 331 // Affectation à partir de valeur entière "int" 332 // PIGrCoord& operator= (float a) 333 // Affectation à partir de valeur réélle "float" 334 // PIGrCoord& operator= (double a) 335 // Affectation à partir de valeur réélle double précision "double" 336 //-- -
trunk/SophyaPI/PI/pigraphgen.h
r141 r158 21 21 22 22 enum PIFontSize { PI_NotDefFontSize = -1, 23 PI_SmallSizeFont = 1, PI_NormalSizeFont = 2, PI_BigSizeFont = 3 }; 23 PI_SmallSizeFont = 1, PI_NormalSizeFont = 2, 24 PI_BigSizeFont = 3, PI_HugeSizeFont = 4 }; 24 25 25 26 enum PIFontAtt { PI_NotDefFontAtt = -1, … … 78 79 // Trace graphiques 79 80 virtual void Erase(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy) = 0; 80 virtual void DrawString(PIGrCoord x, PIGrCoord y, c har* s, int pos = 0) = 0;81 virtual void DrawOpaqueString(PIGrCoord x, PIGrCoord y, c har* s, int pos = 0) = 0;81 virtual void DrawString(PIGrCoord x, PIGrCoord y, const char* s, int pos = 0) = 0; 82 virtual void DrawOpaqueString(PIGrCoord x, PIGrCoord y, const char* s, int pos = 0) = 0; 82 83 virtual void DrawLine(PIGrCoord x1, PIGrCoord y1, PIGrCoord x2, PIGrCoord y2) = 0; 83 84 virtual void DrawBox(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy) = 0; … … 85 86 virtual void DrawCircle(PIGrCoord x0, PIGrCoord y0, PIGrCoord r) = 0; 86 87 virtual void DrawFCircle(PIGrCoord x0, PIGrCoord y0, PIGrCoord r) = 0; 88 virtual void DrawOval(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy) = 0; 89 virtual void DrawFOval(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy) = 0; 87 90 virtual void DrawPolygon(PIGrCoord *x, PIGrCoord *y, int n, bool cinc=true) = 0; 88 91 virtual void DrawFPolygon(PIGrCoord *x, PIGrCoord *y, int n, bool cinc=true) = 0; 92 virtual void DrawArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy, 93 float degdeb, float degfin) = 0; 94 virtual void DrawFArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy, 95 float degdeb, float degfin) = 0; 89 96 virtual void DrawMarker(PIGrCoord x0, PIGrCoord y0) = 0; 90 97 virtual void DrawMarkers(PIGrCoord *x, PIGrCoord *y, int n) = 0; -
trunk/SophyaPI/PI/pigraphps.cc
r147 r158 1 // Module PI : Peida Interactive PIGraphicPS 2 // Trace graphiques en PostScript R. Ansari 97 3 // LAL (Orsay) / IN2P3-CNRS DAPNIA/SPP (Saclay) / CEA 4 1 5 #include <stdio.h> 2 6 3 7 #include "pigraphps.h" 4 8 9 //++ 10 // Class PIGraphicPS 11 // Lib PI 12 // include pigraphps.h 13 // 14 // Classe les services de tracé graphique avec sortie PostScript 15 // Toutes les méthodes de tracé de "PIGraphic" sont redéfinies pour 16 // produire du PostScript 17 //-- 18 //++ 19 // Links Parent 20 // PIGraphic 21 //-- 22 //++ 23 // Links Voir aussi 24 // PSFile 25 //-- 26 27 //++ 28 // Titre Constructeurs, méthodes 29 //-- 30 //++ 31 // PIGraphicPS(PSFile * psf, float x0, float y0, float dx, float dy) 32 // Création d'un objet "PIGraphicPS" à partir d'un objet "PSFIle* psf". 33 // "(x0, y0)" détermine l'origine du nouveau bloc rectangulaire sur 34 // la page et "dx, dy" l'extension du bloc. 35 // PIGraphicPS(PSFile * psf, PIWdg* wdg, float ofx, float ofy) 36 // Création d'un objet "PIGraphicPS" à partir d'un objet "PSFIle* psf" 37 //| x0 = wdg->XPos()+ofx y0 = wdg->YPos()+ofy 38 //| dx = wdg->XSize() dy = wdg->YSize() 39 // 40 // int kind() 41 // Renvoie le type ("= PI_PSFileGraphics") 42 //-- 5 43 6 44 /* --Methode-- */ … … 70 108 71 109 /* --Methode-- */ 72 void PIGraphicPS::DrawString(PIGrCoord x, PIGrCoord y, c har* s, int /*pos*/)110 void PIGraphicPS::DrawString(PIGrCoord x, PIGrCoord y, const char* s, int /*pos*/) 73 111 { 74 112 if(mPSOut) … … 78 116 79 117 /* --Methode-- */ 80 void PIGraphicPS::DrawOpaqueString(PIGrCoord x, PIGrCoord y, c har* s, int /*pos*/)118 void PIGraphicPS::DrawOpaqueString(PIGrCoord x, PIGrCoord y, const char* s, int /*pos*/) 81 119 { 82 120 if(mPSOut) … … 125 163 mPSOut->DrawFCircle((float)x0,(float)y0,(float)r,mFCol,mFCol,mLAtt); 126 164 return; 165 } 166 167 /* --Methode-- */ 168 void PIGraphicPS::DrawOval(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy) 169 { 170 // $CHECK$ Reza/ Nicolas 12 Nov 98 - A faire 171 } 172 173 /* --Methode-- */ 174 void PIGraphicPS::DrawFOval(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy) 175 { 176 // $CHECK$ Reza/ Nicolas 12 Nov 98 - A faire 127 177 } 128 178 … … 182 232 183 233 return; 234 } 235 236 /* --Methode-- */ 237 void PIGraphicPS::DrawArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy,float degdeb, float degfin) 238 { 239 // $CHECK$ Reza/ Nicolas 12 Nov 98 - A faire 240 } 241 242 /* --Methode-- */ 243 void PIGraphicPS::DrawFArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy,float degdeb, float degfin) 244 { 245 // $CHECK$ Reza/ Nicolas 12 Nov 98 - A faire 184 246 } 185 247 -
trunk/SophyaPI/PI/pigraphps.h
r113 r158 20 20 // Trace graphiques 21 21 virtual void Erase(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy); 22 virtual void DrawString(PIGrCoord x, PIGrCoord y, c har* s, int pos = 0);23 virtual void DrawOpaqueString(PIGrCoord x, PIGrCoord y, c har* s, int pos = 0);22 virtual void DrawString(PIGrCoord x, PIGrCoord y, const char* s, int pos = 0); 23 virtual void DrawOpaqueString(PIGrCoord x, PIGrCoord y, const char* s, int pos = 0); 24 24 virtual void DrawLine(PIGrCoord x1, PIGrCoord y1, PIGrCoord x2, PIGrCoord y2); 25 25 virtual void DrawBox(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy); … … 27 27 virtual void DrawCircle(PIGrCoord x0, PIGrCoord y0, PIGrCoord r); 28 28 virtual void DrawFCircle(PIGrCoord x0, PIGrCoord y0, PIGrCoord r); 29 virtual void DrawOval(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy); 30 virtual void DrawFOval(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy); 29 31 virtual void DrawPolygon(PIGrCoord *x, PIGrCoord *y, int n, bool cinc=true); 30 32 virtual void DrawFPolygon(PIGrCoord *x, PIGrCoord *y, int n, bool cinc=true); 33 virtual void DrawArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy, 34 float degdeb, float degfin); 35 virtual void DrawFArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy, 36 float degdeb, float degfin); 31 37 virtual void DrawMarker(PIGrCoord x0, PIGrCoord y0); 32 38 virtual void DrawMarkers(PIGrCoord *x, PIGrCoord *y, int n); -
trunk/SophyaPI/PI/pigraphuc.cc
r139 r158 5 5 #include "pigraphuc.h" 6 6 7 //++ 8 // Class PIGraphicUC 9 // Lib PI 10 // include pigraphuc.h 11 // 12 // Classe fournissant les services de tracé graphique 13 // en coordonnées utilisateur. 14 // Toutes les méthodes de tracé de "PIGraphic" sont redéfinies pour 15 // accepter les arguments en système de coordonnées utilisateur. 16 //-- 17 //++ 18 // Links Parent 19 // PIGraphic 20 //-- 7 21 8 22 // Pour echanger deux valeurs PIGrCoord … … 10 24 static inline void fl_swap(float& grc1, float& grc2) 11 25 { swpfl = grc1; grc1 = grc2; grc2 = swpfl; } 26 27 //++ 28 // Titre Constructeurs, méthodes 29 //-- 30 //++ 31 // PIGraphicUC(PIGraphicGen* g, PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy) 32 // Constructeur d'un objet "PIGraphUC" à partir d'un "PIGraphicGen* g". L'espace 33 // de travail du nouvel objet "PIGraphic" correspond au rectangle défini par 34 // "(x0,y0)" , "dx,dy" du "PIGraphic" de départ. 35 // 36 // int kind() 37 // Renvoie le type ("= PI_UCGraphics") 38 // void SetBaseGraphic(PIGraphicGen* g, PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy) 39 // Permet de modifier l'objet "PIGraphic" de départ et l'espace graphique correspondant. 40 // 41 // void SelFontSz(PIGrCoord sz, PIFontAtt att=PI_RomanFont) 42 // Sélection de fonte avec la taille exprimée en coordonnées utilisateur 43 // void SelMarkerSz(PIGrCoord msz, PIMarker mrk=PI_DotMarker) 44 // Sélection de marker avec la taille exprimée en coordonnées utilisateur 45 //-- 12 46 13 47 /* --Methode-- */ … … 35 69 } 36 70 71 37 72 /* --Methode-- */ 38 73 void PIGraphicUC::SetBaseGraphic(PIGraphicGen* g, PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy) … … 51 86 } 52 87 88 //++ 89 // Titre Système de coordonnées utilisateur 90 //-- 91 //++ 92 // void SetUCS(float xmin, float xmax, float ymin, float ymax, - 93 // int axrl=kAxeDirSame, int ayud=kAxeDirSame) 94 // Définit le système de coordonnées utilisateur. Axe X de "xmin" à "xmax" , 95 // Axe Y de "ymin" à "ymax". "axrl", "ayud" définit le sens des axes 96 // sur la fenêtre : 97 //| kAxeDirSame : Pas de changement de sens 98 //| kAxeDirLtoR : Axe X croissant de gauche à droite 99 //| kAxeDirRtoL : Axe X croissant de droite à gauche 100 //| kAxeDirDownUp : Axe Y croissant de Bas vers Haut 101 //| kAxeDirUpDown : Axe Y croissant de Haut vers Bas 102 //| kAxeDirAuto : Sens determine a partir de la valeur relative de xmin, xmax, ymin, ymax 103 //| xmin < xmax : kAxeDirLtoR - xmax < xmin : kAxeDirRtoL 104 //| ymin < ymax : kAxeDirDownUp - ymax < ymin : kAxeDirUpDown 105 // Par défaut : "xmin=ymin=0." , "ymin=ymax=0." , "kAxeDirLtoR" , "kAxeDirDownUp" 106 // 107 // void UC2GrC(float x, float y, float& xpix, float& ypix) 108 // Transformation de coordonnées utilisateur "(x,y)" en coordoonnées 109 // de l'espace graphic de départ "(xpix, ypix)" 110 // void GrC2UC(float xpix, float ypix, float& x, float& y) 111 // Transformation de coordonnées de l'espace graphic de départ. en coordonnées utilisateur. 112 // void DUC2GrC(float dx, float dy, float& dxpix, float& dypix) 113 // Transformation de distances selon X,Y en coordonnées utilisateur "dx, dy" en distance 114 // dans l'espace graphique de départ "dxpix , dypix". 115 // void DGrC2UC(float dxpix, float dypix, float& dx, float& dy) 116 // Transformation de distances selon X,Y dans l'espace graphique de départ en distance 117 // dans l'espace de coordonnées utilisateur. 118 //-- 53 119 54 120 /* --Methode-- */ … … 172 238 173 239 /* --Methode-- */ 174 void PIGraphicUC::DrawString(PIGrCoord x, PIGrCoord y, c har* s, int pos)240 void PIGraphicUC::DrawString(PIGrCoord x, PIGrCoord y, const char* s, int pos) 175 241 { 176 242 if (!mGrC) return; … … 181 247 182 248 /* --Methode-- */ 183 void PIGraphicUC::DrawOpaqueString(PIGrCoord x, PIGrCoord y, c har* s, int pos)249 void PIGraphicUC::DrawOpaqueString(PIGrCoord x, PIGrCoord y, const char* s, int pos) 184 250 { 185 251 if (!mGrC) return; … … 338 404 } 339 405 406 /* --Methode-- */ 407 void PIGraphicUC::DrawOval(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy) 408 { 409 if (!mGrC) return; 410 411 float xf, yf, dxf, dyf; 412 UC2GrC(x0, y0, xf, yf); 413 DUC2GrC(dx, dy, dxf, dyf); 414 mGrC->DrawOval(xf, yf, dxf, dyf); 415 } 416 417 /* --Methode-- */ 418 void PIGraphicUC::DrawFOval(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy) 419 { 420 if (!mGrC) return; 421 422 float xf, yf, dxf, dyf; 423 UC2GrC(x0, y0, xf, yf); 424 DUC2GrC(dx, dy, dxf, dyf); 425 mGrC->DrawFOval(xf, yf, dxf, dyf); 426 } 427 340 428 #define NMXMULTP 30 // Pour multipoint sans new 341 429 … … 384 472 } 385 473 474 475 /* --Methode-- */ 476 void PIGraphicUC::DrawArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy, 477 float degdeb, float degfin) 478 { 479 if (!mGrC) return; 480 481 float xf, yf, dxf, dyf; 482 UC2GrC(x0, y0, xf, yf); 483 DUC2GrC(dx, dy, dxf, dyf); 484 mGrC->DrawArc(xf, yf, dxf, dyf, degdeb, degfin); 485 } 486 /* --Methode-- */ 487 void PIGraphicUC::DrawFArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy, 488 float degdeb, float degfin) 489 { 490 if (!mGrC) return; 491 492 float xf, yf, dxf, dyf; 493 UC2GrC(x0, y0, xf, yf); 494 DUC2GrC(dx, dy, dxf, dyf); 495 mGrC->DrawFArc(xf, yf, dxf, dyf, degdeb, degfin); 496 } 386 497 387 498 /* --Methode-- */ … … 596 707 return(mGrC->GetMarkerSize()); 597 708 } 709 /* --Methode-- */ 710 PIGrCoord PIGraphicUC::GetFontHeightUC(PIGrCoord& asc, PIGrCoord& desc) 711 { 712 asc = desc = 0; 713 if (!mGrC) return(0); 714 int h,a,d; 715 float fh, fa, fd, x; 716 h = mGrC->GetFontHeight(a, d) ; 717 DGrC2UC(0., h, x, fh); 718 DGrC2UC(0., a, x, fa); 719 DGrC2UC(0., d, x, fd); 720 asc = a; desc = d; 721 return(fh); 722 } 598 723 599 724 /* --Methode-- */ -
trunk/SophyaPI/PI/pigraphuc.h
r113 r158 37 37 // Trace graphiques 38 38 virtual void Erase(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy); 39 virtual void DrawString(PIGrCoord x, PIGrCoord y, c har* s, int pos = 0);40 virtual void DrawOpaqueString(PIGrCoord x, PIGrCoord y, c har* s, int pos = 0);39 virtual void DrawString(PIGrCoord x, PIGrCoord y, const char* s, int pos = 0); 40 virtual void DrawOpaqueString(PIGrCoord x, PIGrCoord y, const char* s, int pos = 0); 41 41 virtual void DrawLine(PIGrCoord x1, PIGrCoord y1, PIGrCoord x2, PIGrCoord y2); 42 42 virtual void DrawBox(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy); … … 44 44 virtual void DrawCircle(PIGrCoord x0, PIGrCoord y0, PIGrCoord r); 45 45 virtual void DrawFCircle(PIGrCoord x0, PIGrCoord y0, PIGrCoord r); 46 virtual void DrawOval(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy); 47 virtual void DrawFOval(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy); 46 48 virtual void DrawPolygon(PIGrCoord *x, PIGrCoord *y, int n, bool cinc=true); 47 virtual void DrawFPolygon(PIGrCoord *x, PIGrCoord *y, int n, bool cinc=true); 49 virtual void DrawFPolygon(PIGrCoord *x, PIGrCoord *y, int n, bool cinc=true); 50 virtual void DrawArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy, 51 float degdeb, float degfin); 52 virtual void DrawFArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy, 53 float degdeb, float degfin); 54 48 55 virtual void DrawMarker(PIGrCoord x0, PIGrCoord y0); 49 56 virtual void DrawMarkers(PIGrCoord *x, PIGrCoord *y, int n); … … 66 73 virtual void SelFontSz(PIGrCoord sz, PIFontAtt att=PI_RomanFont); 67 74 virtual void SelMarkerSz(PIGrCoord msz, PIMarker mrk=PI_DotMarker); 75 virtual PIGrCoord GetFontHeightUC(PIGrCoord& asc, PIGrCoord& desc); 68 76 69 77 // Selection de zone de trace (clip) … … 81 89 virtual int GetMarkerSize(); 82 90 83 virtual int 91 virtual int GetFontHeight(int& asc, int& desc); 84 92 virtual PIGrCoord CalcStringWidth(char const* s); 85 93 -
trunk/SophyaPI/PI/pigraphx.cc
r141 r158 14 14 #define NMAXFONTSZ 7 15 15 static XFontStruct * fntst[NMAXFONTSZ][3]; 16 static int fntsz[NMAXFONTSZ] = {8,10,12,14,1 6,20,24};16 static int fntsz[NMAXFONTSZ] = {8,10,12,14,18,24,36}; 17 17 static int SmallFontIndex = 1; 18 18 static int NormalFontIndex = 3; 19 static int BigFontIndex = 6; 19 static int BigFontIndex = 5; 20 static int HugeFontIndex = 6; 20 21 static PIFontAtt fntatt[3] = { PI_RomanFont, PI_BoldFont, PI_ItalicFont }; 21 22 #define NMAXCOL 16 … … 31 32 : PIGraphicGen(wdg) 32 33 { 34 33 35 Init(); 34 36 37 if (MyWdg()) { 38 mDisp = XtDisplay(MyWdg()); // Structure Display X associe 39 mWId = XtWindow(MyWdg()); // Le drawable X 40 } 41 else mDisp = PIXDisplay(); // Structure Display X associe 42 35 43 mDefGC = XCreateGC (PIXDisplay(), XtWindow(PIXtTopWdg()), 0, NULL); 44 36 45 mGOm = PI_GOCopy; 37 46 … … 53 62 54 63 /* --Methode-- */ 64 void PIGraphicX::TerminateInit() 65 { 66 if (MyWdg() == NULL) { fprintf(stderr, "BUG/PIGraphicX::TerminateInit() for NULL Wdg \n"); return; } 67 mDisp = XtDisplay(MyWdg()); // Structure Display X associe 68 mWId = XtWindow(MyWdg()); // Le drawable X 69 } 70 71 /* --Methode-- */ 55 72 void PIGraphicX::Erase(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy) 56 73 { 57 XClearArea ( XtDisplay(MyWdg()),XtWindow(MyWdg()), (int)x0, (int)y0, (int)dx, (int)dy, False );58 return; 59 } 60 61 /* --Methode-- */ 62 void PIGraphicX::DrawString(PIGrCoord x, PIGrCoord y, c har* s, int /*pos*/)63 { 64 XDrawString (XtDisplay (MyWdg()), XtWindow(MyWdg()),74 XClearArea (mDisp,mWId, (int)x0, (int)y0, (int)dx, (int)dy, False ); 75 return; 76 } 77 78 /* --Methode-- */ 79 void PIGraphicX::DrawString(PIGrCoord x, PIGrCoord y, const char* s, int /*pos*/) 80 { 81 XDrawString (XtDisplay (MyWdg()),mWId, 65 82 DefGC(), (int)x, (int)y, s, strlen(s)); 66 83 return; … … 68 85 69 86 /* --Methode-- */ 70 void PIGraphicX::DrawOpaqueString(PIGrCoord x, PIGrCoord y, c har* s, int /*pos*/)71 { 72 XDrawImageString (XtDisplay (MyWdg()), XtWindow(MyWdg()),87 void PIGraphicX::DrawOpaqueString(PIGrCoord x, PIGrCoord y, const char* s, int /*pos*/) 88 { 89 XDrawImageString (XtDisplay (MyWdg()),mWId, 73 90 DefGC(), (int)x, (int)y, s, strlen(s)); 74 91 return; … … 79 96 void PIGraphicX::DrawLine(PIGrCoord x1, PIGrCoord y1, PIGrCoord x2, PIGrCoord y2) 80 97 { 81 XDrawLine(XtDisplay (MyWdg()), XtWindow(MyWdg()), DefGC(), (int)x1, (int)y1, (int)x2, (int)y2);98 XDrawLine(XtDisplay (MyWdg()), mWId, DefGC(), (int)x1, (int)y1, (int)x2, (int)y2); 82 99 return; 83 100 } … … 93 110 if (idx < 0) { ix0 += idx; idx = -idx; } 94 111 if (idy < 0) { iy0 += idy; idy = -idy; } 95 XDrawRectangle(XtDisplay (MyWdg()), XtWindow(MyWdg()),112 XDrawRectangle(XtDisplay (MyWdg()), mWId, 96 113 DefGC(), ix0, iy0, idx, idy); 97 114 return; … … 107 124 if (idx < 0) { ix0 += idx; idx = -idx; } 108 125 if (idy < 0) { iy0 += idy; idy = -idy; } 109 XFillRectangle(XtDisplay (MyWdg()), XtWindow(MyWdg()),126 XFillRectangle(XtDisplay (MyWdg()), mWId, 110 127 DefGC(), ix0, iy0, idx, idy); 111 128 return; … … 115 132 void PIGraphicX::DrawCircle(PIGrCoord x0, PIGrCoord y0, PIGrCoord r) 116 133 { 117 XDrawArc(XtDisplay (MyWdg()), XtWindow(MyWdg()), DefGC(),134 XDrawArc(XtDisplay (MyWdg()), mWId, DefGC(), 118 135 (int)x0-(int)r, (int)y0-(int)r, 2*(int)r, 2*(int)r, 0, 360*64); 119 136 return; … … 123 140 void PIGraphicX::DrawFCircle(PIGrCoord x0, PIGrCoord y0, PIGrCoord r) 124 141 { 125 XFillArc(XtDisplay (MyWdg()), XtWindow(MyWdg()), DefGC(),142 XFillArc(XtDisplay (MyWdg()), mWId, DefGC(), 126 143 (int)x0-(int)r, (int)y0-(int)r, 2*(int)r, 2*(int)r, 0, 360*64); 144 return; 145 } 146 147 /* --Methode-- */ 148 void PIGraphicX::DrawOval(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy) 149 { 150 XDrawArc(XtDisplay (MyWdg()), mWId, DefGC(), 151 (int)x0, (int)y0, (int)dx, (int)dy, 0, 360*64); 152 return; 153 } 154 155 /* --Methode-- */ 156 void PIGraphicX::DrawFOval(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy) 157 { 158 XFillArc(XtDisplay (MyWdg()), mWId, DefGC(), 159 (int)x0, (int)y0, (int)dx, (int)dy, 0, 360*64); 127 160 return; 128 161 } … … 144 177 int mode = CoordModeOrigin; 145 178 if (cinc) mode = CoordModePrevious; 146 XDrawLines( XtDisplay(MyWdg()), XtWindow(MyWdg()), DefGC(), pxp, n, mode);179 XDrawLines(mDisp, mWId, DefGC(), pxp, n, mode); 147 180 if (n > NMXXPOINTS) delete[] pxp; 148 181 … … 164 197 int mode = CoordModeOrigin; 165 198 if (cinc) mode = CoordModePrevious; 166 XFillPolygon(XtDisplay (MyWdg()), XtWindow(MyWdg()), DefGC(), pxp, n,199 XFillPolygon(XtDisplay (MyWdg()), mWId, DefGC(), pxp, n, 167 200 Complex, mode); 168 201 if (n > NMXXPOINTS) delete[] pxp; 169 202 203 return; 204 } 205 206 /* --Methode-- */ 207 void PIGraphicX::DrawArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy, 208 float degdeb, float degfin) 209 { 210 XDrawArc(XtDisplay (MyWdg()), mWId, DefGC(), 211 (int)x0, (int)y0, (int)dx, (int)dy, (int)(degdeb*64.), (int)(degfin*64.)); 212 return; 213 } 214 215 /* --Methode-- */ 216 void PIGraphicX::DrawFArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy, 217 float degdeb, float degfin) 218 { 219 XFillArc(XtDisplay (MyWdg()), mWId, DefGC(), 220 (int)x0, (int)y0, (int)dx, (int)dy, (int)(degdeb*64.), (int)(degfin*64.)); 170 221 return; 171 222 } … … 180 231 181 232 if (mMrk == PI_DotMarker) 182 XDrawPoint( XtDisplay(MyWdg()), XtWindow(MyWdg()), DefGC(), (int)x0, (int)y0);233 XDrawPoint(mDisp, mWId, DefGC(), (int)x0, (int)y0); 183 234 184 235 else { … … 217 268 break; 218 269 default : 219 XDrawPoint( XtDisplay(MyWdg()), XtWindow(MyWdg()), DefGC(), x0, y0);270 XDrawPoint(mDisp, mWId, DefGC(), x0, y0); 220 271 break; 221 272 } … … 238 289 else pxp = multipoint; 239 290 for(i=0; i<n; i++) { pxp[i].x = x[i]; pxp[i].y = y[i]; } 240 XDrawPoints( XtDisplay(MyWdg()), XtWindow(MyWdg()), DefGC(), pxp, n, CoordModeOrigin);291 XDrawPoints(mDisp, mWId, DefGC(), pxp, n, CoordModeOrigin); 241 292 if (n > NMXXPOINTS) delete[] pxp; 242 293 } … … 263 314 264 315 265 xw = XtWindow(MyWdg());316 xw = mWId; 266 317 mdsp = PIXDisplay(); 267 318 scr = PIXScreen(); … … 294 345 if (col == mFCol) return; 295 346 if ( (col < 0) || (col >= NMAXCOL)) return; 296 XSetForeground( XtDisplay(MyWdg()), DefGC(), colpix[col]);347 XSetForeground(mDisp, DefGC(), colpix[col]); 297 348 mFCol = col; 298 349 return; … … 304 355 if (col == mBCol) return; 305 356 if ( (col < 0) || (col >= NMAXCOL)) return; 306 XSetBackground( XtDisplay(MyWdg()), DefGC(), colpix[col]);357 XSetBackground(mDisp, DefGC(), colpix[col]); 307 358 mBCol = col; 308 359 return; … … 328 379 { 329 380 case PI_GOCopy : 330 XSetFunction( XtDisplay(MyWdg()), DefGC(), GXcopy);381 XSetFunction(mDisp, DefGC(), GXcopy); 331 382 mGOm = mod; 332 383 break; 333 384 case PI_GOXOR : 334 XSetFunction( XtDisplay(MyWdg()), DefGC(), GXxor);385 XSetFunction(mDisp, DefGC(), GXxor); 335 386 mGOm = mod; 336 387 break; … … 377 428 i = BigFontIndex; 378 429 break; 430 case PI_HugeSizeFont: 431 i = HugeFontIndex; 432 break; 379 433 default: 380 434 i = NormalFontIndex; … … 432 486 break; 433 487 } 434 435 XSetLineAttributes(XtDisplay(MyWdg()), DefGC(), lt, lstyle, CapButt, JoinMiter); 488 if (lstyle != LineSolid) { 489 char dash[2]= {3,3}; 490 XSetDashes( mDisp, DefGC(), 0, dash, 2); 491 } 492 XSetLineAttributes(mDisp, DefGC(), lt, lstyle, CapButt, JoinMiter); 436 493 mLAtt = att; 437 494 return; … … 454 511 xr.x = x0; xr.y = y0; 455 512 xr.width = dx; xr.height = dy; 456 XSetClipRectangles( XtDisplay(MyWdg()), DefGC(), 0, 0, &xr, 1, Unsorted);457 XSetClipRectangles( XtDisplay(MyWdg()), dpxgc, 0, 0, &xr, 1, Unsorted);513 XSetClipRectangles(mDisp, DefGC(), 0, 0, &xr, 1, Unsorted); 514 XSetClipRectangles(mDisp, dpxgc, 0, 0, &xr, 1, Unsorted); 458 515 return; 459 516 } … … 462 519 void PIGraphicX::ClearClipRectangle() 463 520 { 464 XSetClipMask( XtDisplay(MyWdg()), DefGC(), None);465 XSetClipMask( XtDisplay(MyWdg()), dpxgc, None);521 XSetClipMask(mDisp, DefGC(), None); 522 XSetClipMask(mDisp, dpxgc, None); 466 523 return; 467 524 } … … 673 730 if (kkj < kkdsz) { kksel = kkk; kkdsz = kkj; } 674 731 } 732 if (kksel == NMAXFONTSZ-1) kksel = NMAXFONTSZ-2; 675 733 NormalFontIndex = kksel; 676 734 SmallFontIndex = (kksel > 1) ? kksel-2 : 0 ; 677 BigFontIndex = (kksel < NMAXFONTSZ-3) ? kksel+3 : NMAXFONTSZ-1 ; 735 BigFontIndex = NMAXFONTSZ-2 ; 736 if (BigFontIndex < NormalFontIndex) BigFontIndex = NormalFontIndex; 737 HugeFontIndex = NMAXFONTSZ-1; 678 738 679 739 //printf("PIGraphicX::Init()-DBG- FontIndex= %d %d %d (%d) \n", … … 754 814 mFSize = fntsz[isz]; 755 815 mFSt = fntst[isz][jat]; 756 XSetFont( XtDisplay(MyWdg()), DefGC(), fntst[isz][jat]->fid);757 return; 758 } 759 760 816 XSetFont(mDisp, DefGC(), fntst[isz][jat]->fid); 817 return; 818 } 819 820 -
trunk/SophyaPI/PI/pigraphx.h
r113 r158 1 // This may look like C code, but it is really -*- C++ -*- 1 2 // Module PI : Peida Interactive PIGraphicX 2 3 // Trace graphiques- Implementation X11 R. Ansari 97 … … 17 18 // Trace graphiques 18 19 virtual void Erase(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy); 19 virtual void DrawString(PIGrCoord x, PIGrCoord y, c har* s, int pos = 0);20 virtual void DrawOpaqueString(PIGrCoord x, PIGrCoord y, c har* s, int pos = 0);20 virtual void DrawString(PIGrCoord x, PIGrCoord y, const char* s, int pos = 0); 21 virtual void DrawOpaqueString(PIGrCoord x, PIGrCoord y, const char* s, int pos = 0); 21 22 virtual void DrawLine(PIGrCoord x1, PIGrCoord y1, PIGrCoord x2, PIGrCoord y2); 22 23 virtual void DrawBox(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy); … … 24 25 virtual void DrawCircle(PIGrCoord x0, PIGrCoord y0, PIGrCoord r); 25 26 virtual void DrawFCircle(PIGrCoord x0, PIGrCoord y0, PIGrCoord r); 27 virtual void DrawOval(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy); 28 virtual void DrawFOval(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy); 26 29 virtual void DrawPolygon(PIGrCoord *x, PIGrCoord *y, int n, bool cinc=true); 27 30 virtual void DrawFPolygon(PIGrCoord *x, PIGrCoord *y, int n, bool cinc=true); 31 virtual void DrawArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy, 32 float degdeb, float degfin); 33 virtual void DrawFArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy, 34 float degdeb, float degfin); 28 35 virtual void DrawMarker(PIGrCoord x0, PIGrCoord y0); 29 36 virtual void DrawMarkers(PIGrCoord *x, PIGrCoord *y, int n); … … 66 73 // Pour recuperer le pixcol d une couleur (pour X) 67 74 PIXColor GetPixelValueforColor(PIColors col); 75 // Pour initialiser mWId apres creation de fenetre 76 virtual void TerminateInit(); 77 68 78 protected: 69 79 void Init(); … … 72 82 inline SysDWdg MyWdg() {return(myWdg->XtWdg()); } 73 83 inline void SelectBCol(PIXColor col) 74 {XSetBackground( XtDisplay(MyWdg()), DefGC(), col); mBCol = PI_ColorFromMap; mBCfMap = col; }84 {XSetBackground(mDisp, DefGC(), col); mBCol = PI_ColorFromMap; mBCfMap = col; } 75 85 inline void SelectFCol(PIXColor col) 76 {XSetForeground( XtDisplay(MyWdg()), DefGC(), col); mFCol = PI_ColorFromMap; mFCfMap = col; }86 {XSetForeground(mDisp, DefGC(), col); mFCol = PI_ColorFromMap; mFCfMap = col; } 77 87 88 // Structure et identificateur XWindow associe 89 GC mDefGC; 90 Display* mDisp; // Display X associe 91 Drawable mWId; // Identificateur Window/Drawable X 78 92 79 GC mDefGC;80 93 PIColors mFCol, mBCol; 81 94 PIGOMode mGOm; -
trunk/SophyaPI/PI/piscdrawwdg.cc
r147 r158 17 17 xEndDrag = yEndDrag = xBegDrag = yBegDrag = 0; 18 18 SetDefaultDrawRectangle(0.12, 0.12, 0.88, 0.88, true); 19 // SetDefaultDrawRectangle(0.12, 0.08, 0.88, 0.92, true); 19 20 AddDrawer(mBDrw, true, false, false); 20 21 -
trunk/SophyaPI/PI/piscdrawwdg.h
r130 r158 31 31 32 32 inline void SetAxesFlags(unsigned int flags=kAxesDflt) { mBDrw->SetAxesFlags(flags); } 33 34 inline void SetTitles(const char* tt=NULL, const char* tb=NULL) 35 { mBDrw->SetTitles(tt, tb); } 36 inline void SetTitles(string const & tt, string const & tb) 37 { mBDrw->SetTitles(tt, tb); } 33 38 34 39 int AddScDrawer(PIDrawer*, bool ad=false); // Ajoute un Drawer en auto … … 76 81 PIWindow * mTrW; 77 82 78 79 83 private: 80 84 bool UpdateText(int xp, int yp); -
trunk/SophyaPI/PI/pistzwin.cc
r153 r158 1 1 // This may look like C code, but it is really -*- C++ -*- 2 // Module PI : Peida Interactive PIStackWindow PIZoneWindow 2 // Module PI : Peida Interactive - Zone/Stack Layout 3 // PIStackLayout , PIZone Layout , PIStackWindow , PIZoneWindow 3 4 // R. Ansari 08/98 4 5 … … 8 9 #include "psfile.h" 9 10 10 // Fonction de l'objet PIPeriodic de PIStackWindow 11 static void myadperpact(void* a); 12 13 void myadperpact(void* a) 14 { 15 ((PIStackWindow*)a)->DispNext(); 16 } 17 /* --Methode-- */ 18 PIStackWindow::PIStackWindow(PIMsgHandler* par, char* nom, PIWindowKind k, 19 int sx, int sy, int px, int py) 20 : PIWindow(par, nom, k, sx, sy, px, py) , mPerad(1) 11 // -------------- Classe PIStackLayout -------------- 12 13 /* --Methode-- */ 14 PIStackLayout::PIStackLayout() 15 : PILayoutMgr() 21 16 { 22 17 mCurdisp = -1; 23 mPerad.SetAction(myadperpact, this); 24 } 25 26 27 /* --Methode-- */ 28 PIStackWindow::~PIStackWindow() 29 { 30 mPerad.Stop(); 31 Hide(); 32 } 33 34 /* --Methode-- */ 35 void PIStackWindow::ChildAdd(PIWdg* child) 18 } 19 20 /* --Methode-- */ 21 PIStackLayout::~PIStackLayout() 22 { 23 } 24 25 /* --Methode-- */ 26 void PIStackLayout::ChildAdd(PIWdg* child) 36 27 { 37 28 int k; 38 29 for(k=0; k<NbChilds(); k++) GetChild(k)->UnManage(); 39 PI Window::ChildAdd(child);30 PILayoutMgr::ChildAdd(child); 40 31 child->Manage(); 41 32 mCurdisp = NbChilds()-1; … … 44 35 45 36 /* --Methode-- */ 46 void PIStack Window::ChildDel(PIWdg* child)37 void PIStackLayout::ChildDel(PIWdg* child) 47 38 { 48 39 int k; 49 40 for(k=0; k<NbChilds(); k++) GetChild(k)->UnManage(); 50 PI Window::ChildDel(child);41 PILayoutMgr::ChildDel(child); 51 42 if (NbChilds() > 0) { 52 43 mCurdisp--; … … 60 51 61 52 /* --Methode-- */ 53 void PIStackLayout::DispNext() 54 { 55 if (NbChilds() < 1) return; 56 int n = (mCurdisp+1)%NbChilds(); 57 DispWdgNum(n); 58 } 59 60 /* --Methode-- */ 61 void PIStackLayout::DispWdgNum(int n) 62 { 63 if ( (n < 0) || (n >= NbChilds()) ) return; 64 for(int k=0; k<NbChilds(); k++) GetChild(k)->UnManage(); 65 mCurdisp = n; 66 GetChild(mCurdisp)->Manage(); 67 return; 68 } 69 70 71 // -------------- Classe PIStackWindow -------------- 72 73 // Fonction de l'objet PIPeriodic de PIStackWindow 74 static void myadperpact(void* a); 75 76 void myadperpact(void* a) 77 { 78 ((PIStackWindow*)a)->DispNext(); 79 } 80 81 /* --Methode-- */ 82 PIStackWindow::PIStackWindow(PIMsgHandler* par, char* nom, PIWindowKind k, 83 int sx, int sy, int px, int py) 84 : PIWindow(par, nom, k, sx, sy, px, py) , mPerad(1) 85 { 86 mPerad.SetAction(myadperpact, this); 87 delete layout; 88 layout = new PIStackLayout; 89 layout->SetContainer(this); 90 } 91 92 93 /* --Methode-- */ 94 PIStackWindow::~PIStackWindow() 95 { 96 mPerad.Stop(); 97 Hide(); 98 } 99 100 /* --Methode-- */ 101 void PIStackWindow::SetLayoutMgr(PILayoutMgr*) 102 { 103 fprintf(stderr, "PIStackWindow::SetLayoutMgr() - LayoutMgr cannot be changed \n"); 104 return; 105 } 106 107 /* --Methode-- */ 62 108 void PIStackWindow::PSPrint(PSFile *psf, int ofx, int ofy) 63 109 { … … 70 116 } 71 117 72 /* --Methode-- */73 PIWdg* PIStackWindow::CurrentWdg()74 {75 return(GetChild(mCurdisp));76 }77 78 /* --Methode-- */79 void PIStackWindow::DispNext()80 {81 if (NbChilds() < 1) return;82 mCurdisp = (mCurdisp+1)%NbChilds();83 PIWdg* wc = GetChild(mCurdisp);84 wc->Manage();85 int k;86 for(k=0; k<NbChilds(); k++)87 if (k != mCurdisp) GetChild(k)->UnManage();88 return;89 }90 118 91 119 /* --Methode-- */ … … 101 129 } 102 130 103 //------------------------------------------------------------------------------- 104 105 /* --Methode-- */ 106 PIZoneWindow::PIZoneWindow(PIMsgHandler* par, char* nom, PIWindowKind k, 107 int nzx, int nzy, int sx, int sy, int px, int py) 108 : PIWindow(par, nom, k, sx, sy, px, py) 131 //-------------------- Classe PIZoneLayout ------------------------------ 132 133 /* --Methode-- */ 134 PIZoneLayout::PIZoneLayout(int nzx, int nzy) 135 : PILayoutMgr() 109 136 { 110 137 mZWdg = NULL; … … 113 140 114 141 /* --Methode-- */ 115 PIZone Window::~PIZoneWindow()142 PIZoneLayout::~PIZoneLayout() 116 143 { 117 144 delete[] mZWdg; 118 145 } 119 146 120 /* --Methode-- */ 121 void PIZoneWindow::SetZone(int nzx, int nzy) 147 148 /* --Methode-- */ 149 void PIZoneLayout::SetZone(int nzx, int nzy) 122 150 { 123 151 int i; … … 140 168 141 169 /* --Methode-- */ 142 void PIZone Window::ChildAdd(PIWdg * child)170 void PIZoneLayout::ChildAdd(PIWdg * child) 143 171 { 144 172 if (!child) return; 145 173 int nx = mZc%mZx; 146 174 int ny = mZc/mZx; 147 PI Window::ChildAdd(child);175 PILayoutMgr::ChildAdd(child); 148 176 child->SetBinding(PIBK_free,PIBK_free,PIBK_free, PIBK_free); 149 int sx = XSize()/mZx;150 int sy = YSize()/mZy;177 int sx = mCont->XSize()/mZx; 178 int sy = mCont->YSize()/mZy; 151 179 child->SetPos(nx*sx, ny*sy); 152 180 child->SetSize(sx, sy); … … 162 190 163 191 /* --Methode-- */ 164 void PIZone Window::ChildDel(PIWdg * child)192 void PIZoneLayout::ChildDel(PIWdg * child) 165 193 { 166 194 if (!child) return; … … 168 196 for(k=0; k<mZx*mZy; k++) 169 197 if (mZWdg[k] == child) mZWdg[k] = NULL; 170 PI Window::ChildDel(child);171 return; 172 } 173 174 /* --Methode-- */ 175 void PIZone Window::NbZone(int& nzx, int& nzy)198 PILayoutMgr::ChildDel(child); 199 return; 200 } 201 202 /* --Methode-- */ 203 void PIZoneLayout::NbZone(int& nzx, int& nzy) 176 204 { 177 205 nzx = mZx; nzy = mZy; … … 179 207 180 208 /* --Methode-- */ 181 PIWdg* PIZone Window::NextChildPosSize(int& px, int& py, int& sx, int& sy)182 { 183 sx = XSize()/mZx;184 sy = YSize()/mZy;209 PIWdg* PIZoneLayout::NextChildPosSize(int& px, int& py, int& sx, int& sy) 210 { 211 sx = mCont->XSize()/mZx; 212 sy = mCont->YSize()/mZy; 185 213 int nx = mZc%mZx; 186 214 int ny = mZc/mZx; … … 188 216 return ((PIWdg*)mZWdg[mZc]); 189 217 } 218 219 220 //-------------------- Classe PIZoneWindow ------------------------------ 221 222 /* --Methode-- */ 223 PIZoneWindow::PIZoneWindow(PIMsgHandler* par, char* nom, PIWindowKind k, 224 int nzx, int nzy, int sx, int sy, int px, int py) 225 : PIWindow(par, nom, k, sx, sy, px, py) 226 { 227 delete layout; 228 layout = new PIZoneLayout(nzx, nzy); 229 layout->SetContainer(this); 230 } 231 232 /* --Methode-- */ 233 PIZoneWindow::~PIZoneWindow() 234 { 235 Hide(); 236 } 237 238 /* --Methode-- */ 239 void PIZoneWindow::SetLayoutMgr(PILayoutMgr*) 240 { 241 fprintf(stderr, "PIZoneWindow::SetLayoutMgr() - LayoutMgr cannot be changed \n"); 242 return; 243 } 244 -
trunk/SophyaPI/PI/pistzwin.h
r140 r158 10 10 #include PIPERIODIC_H 11 11 12 // ----------------------- Classe PIStackLayout ---------------------------- 13 // Pour Fenetre de type empilement , tout widget occupe la totalite 14 // de la fenetre - Un seul des widget visible (active) a chaque moment 15 16 class PIStackLayout : public PILayoutMgr { 17 public: 18 PIStackLayout(); 19 virtual ~PIStackLayout(); 20 21 virtual void ChildAdd(PIWdg* child); 22 virtual void ChildDel(PIWdg* child); 23 24 inline PIWdg* CurrentWdg() { return(GetChild(mCurdisp)); } 25 inline int NumCurrentWdg() { return(mCurdisp); } 26 virtual void DispNext(); 27 virtual void DispWdgNum(int n); 28 29 protected: 30 int mCurdisp; 31 }; 32 12 33 // ----------------------- Classe PIStackWindow ---------------------------- 13 // Fenetre de type empilement , tout widget occupe la totalite de la fenetre, 14 // Un seul des widget visible (active) a chaque moment 34 // Fenetre avec un PIStackLayout 15 35 16 36 class PIStackWindow : public PIWindow { … … 18 38 PIStackWindow(PIMsgHandler* par, char* nom, PIWindowKind k=PIWK_normal, 19 39 int sx=100, int sy=100, int px=0, int py=0); 20 40 virtual ~PIStackWindow(); 21 41 22 virtual void ChildAdd(PIWdg* child); 23 virtual void ChildDel(PIWdg* child); 24 42 virtual void SetLayoutMgr(PILayoutMgr* nlay); 25 43 virtual void PSPrint(PSFile *psf, int ofx=0, int ofy=0); 26 44 27 virtual PIWdg* CurrentWdg(); 28 virtual void DispNext(); 45 inline void DispNext() { ((PIStackLayout*)layout)->DispNext(); } 46 inline PIWdg* CurrentWdg() { return( ((PIStackLayout*)layout)->CurrentWdg() ); } 47 29 48 virtual void StartAutoDisp(int dt); 30 49 virtual void StopAutoDisp(); … … 32 51 protected: 33 52 PIPeriodic mPerad; 34 int mCurdisp; 53 }; 54 55 // ----------------------- Classe PIZoneLayout ---------------------------- 56 // Pour fenetre avec nzx*nzy zone d affichage - Les nouveaux widgets dans chaque 57 // zone viennent remplacer les anciennes - Ceux-ci sont detruits automatiquement 58 59 60 class PIZoneLayout : public PILayoutMgr { 61 public: 62 PIZoneLayout(int nzx=1, int nzy=1); 63 virtual ~PIZoneLayout(); 64 65 virtual void ChildAdd(PIWdg* child); 66 virtual void ChildDel(PIWdg* child); 67 virtual void SetZone(int nzx, int nzy); 68 virtual void NbZone(int& nzx, int& nzy); 69 virtual PIWdg* NextChildPosSize(int& px, int& py, int& sx, int& sy); 70 71 protected: 72 int mZx, mZy, mZc; 73 PIWdg** mZWdg; 35 74 }; 36 75 37 76 // ----------------------- Classe PIZoneWindow ---------------------------- 38 // Fenetre avec nzx*nzy zone d affichage - Les nouveaux widgets dans chaque 39 // zone viennent remplacer les anciennes - Ceux-ci sont detruits automatiquement 77 // Fenetre avec un PIZoneLayout 40 78 41 79 class PIZoneWindow : public PIWindow { … … 43 81 PIZoneWindow(PIMsgHandler* par, char* nom, PIWindowKind k=PIWK_normal, 44 82 int nzx=1, int nzy=1, int sx=100, int sy=100, int px=0, int py=0); 45 83 virtual ~PIZoneWindow(); 46 84 47 virtual void ChildAdd(PIWdg* child); 48 virtual void ChildDel(PIWdg* child); 49 virtual void SetZone(int nzx, int nzy); 50 virtual void NbZone(int& nzx, int& nzy); 51 virtual PIWdg* NextChildPosSize(int& px, int& py, int& sx, int& sy); 85 virtual void SetLayoutMgr(PILayoutMgr* nlay); 86 87 inline void SetZone(int nzx, int nzy) { ((PIZoneLayout*)layout)->SetZone(nzx, nzy); } 88 inline void NbZone(int& nzx, int& nzy) { ((PIZoneLayout*)layout)->NbZone(nzx, nzy); } 89 inline PIWdg* NextChildPosSize(int& px, int& py, int& sx, int& sy) 90 { return ( ((PIZoneLayout*)layout)->NextChildPosSize(px, py, sx, sy) ); } 52 91 53 92 protected: 54 int mZx, mZy, mZc;55 PIWdg** mZWdg;56 93 }; 94 57 95 #endif -
trunk/SophyaPI/PI/piwdggen.h
r140 r158 1 1 // This may look like C code, but it is really -*- C++ -*- 2 // Module PI : Peida Interactive PIW indowGen2 // Module PI : Peida Interactive PIWdgGen 3 3 // Reza 10/95 4 // LAL (Orsay) / IN2P3-CNRS DAPNIA/SPP (Saclay) / CEA 4 5 5 6 #ifndef PIWDG_H_SEEN -
trunk/SophyaPI/PI/piwdgx.h
r120 r158 90 90 unsigned long PIXGetLastEventSerial(); 91 91 void PIXSetLastEventTimeSerial(Time t, unsigned long ser); 92 void PIXGetLastEventInfo(unsigned int& st, Time& t); 92 93 93 94 -
trunk/SophyaPI/PI/pixtbase.cc
r110 r158 97 97 98 98 99 /* Last XEvent Serial Number and Time-Stamp */99 /* Last XEvent Serial Number and Time-Stamp , and Key-state */ 100 100 static Time last_time_xevt = 0; 101 101 static unsigned long last_serial_xevt = 0; 102 static unsigned int last_state_xevt = 0; 103 102 104 103 105 Time PIXGetLastEventTime() { return(last_time_xevt); } … … 105 107 void PIXSetLastEventTimeSerial(Time t, unsigned long ser) 106 108 { last_time_xevt = t; last_serial_xevt = ser; } 109 void PIXGetLastEventInfo(unsigned int& st, Time& t) 110 { st = last_state_xevt; t = last_time_xevt; } 107 111 108 112 /* Nouvelle-Fonction */ … … 203 207 last_time_xevt = evt->xcrossing.time; 204 208 last_serial_xevt = evt->xcrossing.serial; 209 last_state_xevt = evt->xcrossing.state; 205 210 // if (((PIXtBaseWidget)wdgp)->pixtbase.objet) 206 211 (((PIXtBaseWidget)wdgp)->pixtbase.objet)->Enter(); … … 214 219 last_time_xevt = evt->xcrossing.time; 215 220 last_serial_xevt = evt->xcrossing.serial; 221 last_state_xevt = evt->xcrossing.state; 216 222 // if (((PIXtBaseWidget)wdgp)->pixtbase.objet) 217 223 (((PIXtBaseWidget)wdgp)->pixtbase.objet)->Leave(); … … 221 227 last_time_xevt = evt->xbutton.time; 222 228 last_serial_xevt = evt->xbutton.serial; 229 last_state_xevt = evt->xbutton.state; 223 230 if ( (evt->xbutton.button == 1) && ( ((PIXtBaseWidget)wdgp)->pixtbase.myeventmask & Button1Mask) ) 224 231 (((PIXtBaseWidget)wdgp)->pixtbase.objet)->But1Press(evt->xbutton.x, evt->xbutton.y); … … 232 239 last_time_xevt = evt->xbutton.time; 233 240 last_serial_xevt = evt->xbutton.serial; 241 last_state_xevt = evt->xbutton.state; 234 242 if ( (evt->xbutton.button == 1) && ( ((PIXtBaseWidget)wdgp)->pixtbase.myeventmask & Button1Mask) ) 235 243 (((PIXtBaseWidget)wdgp)->pixtbase.objet)->But1Release(evt->xbutton.x, evt->xbutton.y); … … 250 258 } 251 259 else { key_but = evt->xmotion.state ; xw = evt->xmotion.x; yw = evt->xmotion.y; } 252 if ( !(key_but & ( Button1Mask | Button2Mask | Button3Mask ) ) ) break;260 // if ( !(key_but & ( Button1Mask | Button2Mask | Button3Mask ) ) ) break; 253 261 last_time_xevt = evt->xmotion.time; 254 262 last_serial_xevt = evt->xmotion.serial; 263 last_state_xevt = evt->xmotion.state; 255 264 if (key_but & Button1Mask ) 256 265 (((PIXtBaseWidget)wdgp)->pixtbase.objet)->Ptr1Move(xw, yw); … … 259 268 else if (key_but & Button3Mask ) 260 269 (((PIXtBaseWidget)wdgp)->pixtbase.objet)->Ptr3Move(xw, yw); 270 else if ( !(key_but & (Button4Mask|Button5Mask)) ) 271 (((PIXtBaseWidget)wdgp)->pixtbase.objet)->PtrMove(xw, yw); 261 272 } 262 273 break; -
trunk/SophyaPI/PI/psfile.cc
r154 r158 14 14 15 15 #include "psfile.h" 16 17 //++ 18 // Class PSFile 19 // Lib PI 20 // include psfile.h 21 // 22 // Classe encapsulant un fichier PostScript, fournissant des primitives 23 // graphiques produisant du code PostScript. 24 //-- 25 //++ 26 // Links Voir aussi 27 // PIGraphicPS 28 //-- 29 30 16 31 17 32 /* En cm */ … … 259 274 " 260 275 276 //++ 277 // Titre Constructeurs 278 //-- 279 //++ 280 // PSFile (const char * FileName, float sc = 1.0) 281 // Créateur pour fichier Encapsulated Postscript 282 // PSFile (const char * FileName, PIOrientation orientation, - 283 // PIPaperSize paperSize= PI_A4, - 284 // float marginX = 5.0, float marginY = 5.0 ) 285 // Créateur pour fichier Postscript 286 //-- 261 287 262 288 /* … … 671 697 672 698 673 void PSFile::DrawString (float x, float y, c har *s,699 void PSFile::DrawString (float x, float y, const char *s, 674 700 PIColors DrawColor, 675 701 PIFontAtt FontAtt, -
trunk/SophyaPI/PI/psfile.h
r147 r158 103 103 104 104 /* Trace */ 105 virtual void DrawString (float x, float y, c har *s,105 virtual void DrawString (float x, float y, const char *s, 106 106 PIColors DrawColor = PI_NotDefColor, 107 107 PIFontAtt FontAtt = PI_NotDefFontAtt,
Note:
See TracChangeset
for help on using the changeset viewer.