Changeset 113 in Sophya
- Timestamp:
- Jul 2, 1998, 7:20:09 PM (27 years ago)
- Location:
- trunk/SophyaPI/PI
- Files:
-
- 6 added
- 34 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PI/Makefile
r112 r113 4 4 5 5 all: $(LIB)libPI.a 6 $(LIB)libPI.a : $(OBJ)lut.o $(OBJ)p i3ddrw.o $(OBJ)piapplgen.o $(OBJ)piapplx.o $(OBJ)pibwdggen.o $(OBJ)pibwdgx.o $(OBJ)picmap.o $(OBJ)picmapgen.o $(OBJ)picmapx.o $(OBJ)picons.o $(OBJ)picontainergen.o $(OBJ)picontainerx.o $(OBJ)pidrawer.o $(OBJ)pidrawwin.o $(OBJ)pidrwtools.o $(OBJ)pifilechogen.o $(OBJ)pifilechox.o $(OBJ)pigraph3d.o $(OBJ)pigraphgen.o $(OBJ)pigraphps.o $(OBJ)pigraphuc.o $(OBJ)pigraphx.o $(OBJ)pihisto.o $(OBJ)pihisto2d.o $(OBJ)piimage.o $(OBJ)piimgtools.o $(OBJ)piinit.o $(OBJ)pilistgen.o $(OBJ)pilistx.o $(OBJ)pimenubargen.o $(OBJ)pimenubarx.o $(OBJ)pimenugen.o $(OBJ)pimenux.o $(OBJ)pimsghandler.o $(OBJ)pintuple.o $(OBJ)pioptmenugen.o $(OBJ)pioptmenux.o $(OBJ)piperiodx.o $(OBJ)pipixmapgen.o $(OBJ)pipixmapx.o $(OBJ)piscdrawwdg.o $(OBJ)pistdwdggen.o $(OBJ)pistdwdgx.o $(OBJ)pistlist.o $(OBJ)piup.o $(OBJ)piwdggen.o $(OBJ)piwdgx.o $(OBJ)piwindowgen.o $(OBJ)piwindowx.o $(OBJ)pixtbase.o $(OBJ)psfile.o6 $(LIB)libPI.a : $(OBJ)lut.o $(OBJ)parradapter.o $(OBJ)pi3ddrw.o $(OBJ)piapplgen.o $(OBJ)piapplx.o $(OBJ)pibwdggen.o $(OBJ)pibwdgx.o $(OBJ)picmap.o $(OBJ)picmapgen.o $(OBJ)picmapview.o $(OBJ)picmapx.o $(OBJ)picons.o $(OBJ)picontainergen.o $(OBJ)picontainerx.o $(OBJ)pidrawer.o $(OBJ)pidrawwin.o $(OBJ)pidrwtools.o $(OBJ)pifilechogen.o $(OBJ)pifilechox.o $(OBJ)pigraph3d.o $(OBJ)pigraphgen.o $(OBJ)pigraphps.o $(OBJ)pigraphuc.o $(OBJ)pigraphx.o $(OBJ)pihisto.o $(OBJ)pihisto2d.o $(OBJ)piimage.o $(OBJ)piimgtools.o $(OBJ)piinit.o $(OBJ)pilistgen.o $(OBJ)pilistx.o $(OBJ)pimenubargen.o $(OBJ)pimenubarx.o $(OBJ)pimenugen.o $(OBJ)pimenux.o $(OBJ)pimsghandler.o $(OBJ)pintup3d.o $(OBJ)pintuple.o $(OBJ)pioptmenugen.o $(OBJ)pioptmenux.o $(OBJ)piperiodx.o $(OBJ)pipixmapgen.o $(OBJ)pipixmapx.o $(OBJ)piscdrawwdg.o $(OBJ)pistdwdggen.o $(OBJ)pistdwdgx.o $(OBJ)pistlist.o $(OBJ)pisurfdr.o $(OBJ)piup.o $(OBJ)piwdggen.o $(OBJ)piwdgx.o $(OBJ)piwindowgen.o $(OBJ)piwindowx.o $(OBJ)pixtbase.o $(OBJ)psfile.o 7 7 $(AR) $(ARFLAGS) $@ $? 8 8 ifeq ($(CXX),cxx) … … 11 11 endif 12 12 13 clean: 14 rm -f $(OBJ)lut.o $(OBJ)parradapter.o $(OBJ)pi3ddrw.o $(OBJ)piapplgen.o $(OBJ)piapplx.o $(OBJ)pibwdggen.o $(OBJ)pibwdgx.o $(OBJ)picmap.o $(OBJ)picmapgen.o $(OBJ)picmapview.o $(OBJ)picmapx.o $(OBJ)picons.o $(OBJ)picontainergen.o $(OBJ)picontainerx.o $(OBJ)pidrawer.o $(OBJ)pidrawwin.o $(OBJ)pidrwtools.o $(OBJ)pifilechogen.o $(OBJ)pifilechox.o $(OBJ)pigraph3d.o $(OBJ)pigraphgen.o $(OBJ)pigraphps.o $(OBJ)pigraphuc.o $(OBJ)pigraphx.o $(OBJ)pihisto.o $(OBJ)pihisto2d.o $(OBJ)piimage.o $(OBJ)piimgtools.o $(OBJ)piinit.o $(OBJ)pilistgen.o $(OBJ)pilistx.o $(OBJ)pimenubargen.o $(OBJ)pimenubarx.o $(OBJ)pimenugen.o $(OBJ)pimenux.o $(OBJ)pimsghandler.o $(OBJ)pintup3d.o $(OBJ)pintuple.o $(OBJ)pioptmenugen.o $(OBJ)pioptmenux.o $(OBJ)piperiodx.o $(OBJ)pipixmapgen.o $(OBJ)pipixmapx.o $(OBJ)piscdrawwdg.o $(OBJ)pistdwdggen.o $(OBJ)pistdwdgx.o $(OBJ)pistlist.o $(OBJ)pisurfdr.o $(OBJ)piup.o $(OBJ)piwdggen.o $(OBJ)piwdgx.o $(OBJ)piwindowgen.o $(OBJ)piwindowx.o $(OBJ)pixtbase.o $(OBJ)psfile.o 15 ifeq ($(CXX),cxx) 16 cd $(REPM); rm -f *.o 17 endif 18 13 19 $(OBJ)lut.o: lut.cc $(EROSDEVREP)/Include/defs.h lut.h 14 $(OBJ)pi3ddrw.o: pi3ddrw.cc pi3ddrw.h pidrawer.h pibwdggen.h pisysdep.h \ 15 piwdgx.h piwdggen.h pimsghandler.h picmap.h picmapx.h picmapgen.h \ 16 pigraphx.h pigraphgen.h pigraphuc.h psfile.h \ 17 $(EROSDEVREP)/Include/defs.h 20 $(OBJ)parradapter.o: parradapter.cc $(EROSDEVREP)/Include/ctimer.h \ 21 $(EROSDEVREP)/Include/peida.h $(EROSDEVREP)/Include/defs.h \ 22 $(EROSDEVREP)/Include/utils.h $(EROSDEVREP)/Include/machine.h \ 23 $(EROSDEVREP)/Include/perrors.h \ 24 $(EROSDEVREP)/Include/exceptions.h \ 25 $(EROSDEVREP)/Include/peidainit.h $(EROSDEVREP)/Include/fmath.h \ 26 parradapter.h lut.h 27 $(OBJ)pi3ddrw.o: pi3ddrw.cc pi3ddrw.h pisysdep.h pidrawer.h pibwdggen.h \ 28 piwdgx.h piwdggen.h pimsghandler.h picmap.h picmapx.h picmapgen.h \ 29 pigraphx.h pigraphgen.h pigraphuc.h psfile.h \ 30 $(EROSDEVREP)/Include/defs.h pigraph3d.h pibwdgx.h pigraphps.h 18 31 $(OBJ)piapplgen.o: piapplgen.cc piapplgen.h pimsghandler.h pisysdep.h \ 19 32 picontainerx.h picontainergen.h piwdgx.h piwdggen.h pimenubarx.h \ … … 38 51 $(OBJ)picmap.o: picmap.cc picmap.h pisysdep.h picmapx.h picmapgen.h 39 52 $(OBJ)picmapgen.o: picmapgen.cc picmapgen.h pisysdep.h picmapx.h picmap.h 53 $(OBJ)picmapview.o: picmapview.cc picmapview.h pisysdep.h pibwdgx.h \ 54 pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h picmap.h picmapx.h \ 55 picmapgen.h pigraphx.h pigraphgen.h pigraphuc.h psfile.h \ 56 $(EROSDEVREP)/Include/defs.h pigraphps.h 40 57 $(OBJ)picmapx.o: picmapx.cc piwdgx.h piwdggen.h pimsghandler.h picmapx.h \ 41 58 picmapgen.h pisysdep.h … … 63 80 pistdwdgx.h pistdwdggen.h pibwdgx.h pibwdggen.h picmap.h picmapx.h \ 64 81 picmapgen.h pigraphx.h pigraphgen.h pigraphuc.h psfile.h \ 65 $(EROSDEVREP)/Include/defs.h pigraphps.h pi optmenux.h \66 pi optmenugen.h piscdrawwdg.h piwindowx.h piwindowgen.h pidrawer.h82 $(EROSDEVREP)/Include/defs.h pigraphps.h piscdrawwdg.h piwindowx.h \ 83 piwindowgen.h pidrawer.h 67 84 $(OBJ)pifilechogen.o: pifilechogen.cc pifilechogen.h pisysdep.h piwdgx.h \ 68 85 piwdggen.h pimsghandler.h … … 115 132 pistdwdgx.h pistdwdggen.h piwindowx.h piwindowgen.h picontainerx.h \ 116 133 picontainergen.h 117 $(OBJ)piimgtools.o: piimgtools.cc piimgtools.h pisysdep.h pi menux.h \118 pi menugen.h piwdgx.h piwdggen.h pimsghandler.h piapplx.h piapplgen.h \119 pi containerx.h picontainergen.h pimenubarx.h pimenubargen.h picons.h \120 pi stdwdgx.h pistdwdggen.h pibwdgx.h pibwdggen.h picmap.h picmapx.h \121 pi cmapgen.h pigraphx.h pigraphgen.h pigraphuc.h psfile.h \122 $(EROSDEVREP)/Include/defs.h pigraphps.h pioptmenux.h \123 pioptmenugen.h piimage.h parradapter.h \134 $(OBJ)piimgtools.o: piimgtools.cc piimgtools.h pisysdep.h pistdwdgx.h \ 135 pistdwdggen.h piwdgx.h piwdggen.h pimsghandler.h pimenux.h \ 136 pimenugen.h pioptmenux.h pioptmenugen.h piwindowx.h piwindowgen.h \ 137 picontainerx.h picontainergen.h piapplx.h piapplgen.h pimenubarx.h \ 138 pimenubargen.h picons.h pibwdgx.h pibwdggen.h picmap.h picmapx.h \ 139 picmapgen.h pigraphx.h pigraphgen.h pigraphuc.h psfile.h \ 140 $(EROSDEVREP)/Include/defs.h pigraphps.h piimage.h parradapter.h \ 124 141 $(EROSDEVREP)/Include/machine.h lut.h pidrawer.h pipixmapx.h \ 125 pipixmapgen.h piwindowx.h piwindowgen.h142 pipixmapgen.h 126 143 $(OBJ)piinit.o: piinit.cc $(EROSDEVREP)/Include/defs.h piinit.h \ 127 144 $(EROSDEVREP)/Include/strecinit.h \ … … 149 166 pimenugen.h piwdgx.h piwdggen.h pimsghandler.h 150 167 $(OBJ)pimsghandler.o: pimsghandler.cc pimsghandler.h 168 $(OBJ)pintup3d.o: pintup3d.cc pintup3d.h $(EROSDEVREP)/Include/ntuple.h \ 169 $(EROSDEVREP)/Include/ppersist.h $(EROSDEVREP)/Include/defs.h \ 170 $(EROSDEVREP)/Include/machine.h $(EROSDEVREP)/Include/perrors.h \ 171 $(EROSDEVREP)/Include/exceptions.h \ 172 $(EROSDEVREP)/Include/peidainit.h \ 173 $(EROSDEVREP)/Include/pclassids.h pi3ddrw.h pisysdep.h pidrawer.h \ 174 pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h picmap.h picmapx.h \ 175 picmapgen.h pigraphx.h pigraphgen.h pigraphuc.h psfile.h pigraph3d.h \ 176 pibwdgx.h pigraphps.h 151 177 $(OBJ)pintuple.o: pintuple.cc pintuple.h $(EROSDEVREP)/Include/ntuple.h \ 152 178 $(EROSDEVREP)/Include/ppersist.h $(EROSDEVREP)/Include/defs.h \ … … 218 244 piwdgx.h piwdggen.h pimsghandler.h picmap.h picmapx.h picmapgen.h \ 219 245 pigraphx.h pigraphgen.h pigraphuc.h psfile.h 246 $(OBJ)pisurfdr.o: pisurfdr.cc pisurfdr.h parradapter.h \ 247 $(EROSDEVREP)/Include/defs.h $(EROSDEVREP)/Include/machine.h \ 248 lut.h pi3ddrw.h pisysdep.h pidrawer.h pibwdggen.h piwdgx.h piwdggen.h \ 249 pimsghandler.h picmap.h picmapx.h picmapgen.h pigraphx.h pigraphgen.h \ 250 pigraphuc.h psfile.h pigraph3d.h pibwdgx.h pigraphps.h 220 251 $(OBJ)piup.o: piup.cc $(EROSDEVREP)/Include/ctimer.h \ 221 252 $(EROSDEVREP)/Include/peida.h $(EROSDEVREP)/Include/defs.h \ -
trunk/SophyaPI/PI/exapp_1.cc
r39 r113 3 3 #include <string.h> 4 4 5 #include "ctimer.h"6 #include "strecinit.h"7 8 #include "pidrawwin.h"9 #include "pihisto.h"10 #include "psfile.h"11 12 5 #include "exapp_1.h" 13 6 14 static int nbhis = 0; 7 8 /* ........................................................... */ 9 /* Classe ArgsWindow 10 /* ........................................................... */ 11 12 13 /* --Methode-- */ 14 ArgsWind::ArgsWind(PIApplication *par) 15 : PIWindow((PIMsgHandler *)par, "Args", PIWK_dialog, 100, 100, 150, 150) 16 { 17 int bsx, bsy; 18 19 // On definit la taille a partir de la taille par defaut des composantes 20 PIApplicationPrefCompSize(bsx, bsy); 21 // On redefinit la taille de la fenetre 22 SetSize(bsx*7, bsy*6); 23 24 // Creation de champs "labels" 25 mLab[0] = new PILabel(this, "UserArg-1:", bsx*2, bsy, bsx/3, bsy/4); 26 mLab[1] = new PILabel(this, "UserArg-2", bsx*2, bsy, bsx/3, bsy/4 + (bsy/4+bsy) ); 27 mLab[2] = new PILabel(this, "UserArg-3", bsx*2, bsy, bsx/3, bsy/4 + 2*(bsy/4+bsy) ); 28 29 // Creation de champs textes 30 mText[0] = new PIText(this, "UsArg1", bsx*4, bsy, bsx*2+(bsx*2/3), bsy/4); 31 mText[0]->SetText("Hello "); 32 mText[1] = new PIText(this, "UsArg2", bsx*4, bsy, bsx*2+(bsx*2/3), bsy/4 + (bsy/4+bsy) ); 33 mText[1]->SetText("1. -1."); 34 mText[2] = new PIText(this, "UsArg3", bsx*4, bsy, bsx*2+(bsx*2/3), bsy/4 + 2*(bsy/4+bsy) ); 35 mText[2]->SetText("1. -1."); 36 37 // Creation de bouton d'action 38 // Attention : Numero de message pour Process() 39 mBut[0] = new PIButton(this, "OK", 555, bsx*2, bsy, bsx, 4.5*bsy); 40 mBut[1] = new PIButton(this, "Cancel", 777, bsx*2, bsy, 4*bsx, 4.5*bsy); 41 42 // Taille et position proportionnelles a la taille de la fenetre pour les elements 43 for(int i=0; i<3; i++) { 44 mLab[i]->SetBinding(PIBK_elastic , PIBK_elastic , PIBK_elastic , PIBK_elastic); 45 mText[i]->SetBinding(PIBK_elastic , PIBK_elastic , PIBK_elastic , PIBK_elastic); 46 } 47 for(int i=0; i<2; i++) mBut[i]->SetBinding(PIBK_elastic , PIBK_elastic , PIBK_elastic , PIBK_elastic); 48 49 } 50 51 /* --Methode-- */ 52 ArgsWind::~ArgsWind() 53 { 54 for(int i=0; i<3; i++) 55 { 56 delete mLab[i]; 57 delete mText[i]; 58 } 59 60 delete mBut[0]; 61 delete mBut[1]; 62 } 63 64 /* --Methode-- */ 65 void ArgsWind::SetLabels(char *lab1, char *lab2, char *lab3) 66 // Permet de changer les etiquettes (les label) 67 { 68 mLab[0]->SetLabel(lab1); 69 mLab[1]->SetLabel(lab2); 70 mLab[2]->SetLabel(lab3); 71 } 72 73 /* --Methode-- */ 74 void ArgsWind::SetTexts(char *tx1, char *tx2, char *tx3) 75 // Permet de changer les contenu des champs texte 76 { 77 mText[0]->SetText(tx1); 78 mText[1]->SetText(tx2); 79 mText[2]->SetText(tx3); 80 81 } 82 83 /* --Methode-- */ 84 void ArgsWind::GetTexts(char *tx1, char *tx2, char *tx3) 85 // Permet de recuperer les contenus des champs texte 86 // ATTENTION : Il faut qu'il y ait assez de place 87 // ds tx1, tx2, tx3 pour que la fonction puisse y copier 88 // les chaines 89 { 90 strcpy(tx1, mText[0]->GetText().c_str()); 91 strcpy(tx2, mText[1]->GetText().c_str()); 92 strcpy(tx3, mText[2]->GetText().c_str()); 93 } 94 95 /* --Methode-- */ 96 void ArgsWind::Process(PIMessage msg, PIMsgHandler* /*sender*/, void* /*data*/) 97 { 98 float xmin, xmax, ymin, ymax; 99 float fmin, fmax; 100 101 switch (UserMsg(msg)) 102 { 103 case 777: // Bouton cancel - On s'en va 104 this->Hide(); 105 break; 106 107 case 555: // Bouton OK 108 // On recupere les textes des 3 champs : 109 printf("ArgsWind::Process() Txt[0] = %s \n", mText[0]->GetText().c_str()); 110 sscanf(mText[1]->GetText().c_str(),"%g %g", &xmin, &xmax); 111 printf("... XMin/Max= %g %g \n", xmin, xmax); 112 this->Hide(); 113 break; 114 } 115 116 return; 117 } 118 119 120 /* ........................................................... */ 121 /* Classe PITApp 122 /* ........................................................... */ 123 15 124 static void mypact(void *); 16 125 17 126 /* --Methode-- */ 18 127 PITApp::PITApp(int narg, char* arg[]) 19 : PIApplication(2 30, 100, narg, arg), mPeriod(1) // Periode de 1 seconde pour le "timer"128 : PIApplication(270, 100, narg, arg), mPeriod(1) // Periode de 1 seconde pour le "timer" 20 129 { 21 130 … … 32 141 // Arret et sortie du programme 33 142 34 m[0] = new PIPDMenu((PIMsgHandler *)Menubar(),"Fichier"); 35 m[0]->AppendItem("Update", 10101); 36 m[0]->AppendItem("Start", 10102); 37 m[0]->AppendItem("Stop", 10103); 38 m[0]->AppendItem("Exit", 10105); 143 m = new PIMenu(Menubar(),"Fichier"); 144 m->AppendItem("Update", 10101); 145 m->AppendItem("Start", 10102); 146 m->AppendItem("Stop", 10103); 147 m->AppendItem("ArgsWindow", 10104); 148 m->AppendItem("Exit", 10105); 39 149 // On accroche le menu au Menubar 40 AppendMenu(m[0]); 41 42 // 2eme Menu 43 // Histo : Creation, affichage d'un histo 44 // Args : Affichage d'une fenetre de dialogue avec champs texte 45 // Fermeture fenetre histo + suppression d'histo 46 47 m[1] = new PIPDMenu((PIMsgHandler *)Menubar(),"Actions"); 48 m[1]->AppendItem("Histo", 10201); 49 m[1]->AppendItem("Args", 10202); 50 m[1]->AppendItem("Close", 10203); 51 m[1]->AppendItem("PS", 10205); 52 // On accroche le menu au Menubar 53 AppendMenu(m[1]); 150 AppendMenu(m); 151 54 152 55 153 // Creation de deux labels - Un pour l'heure, l'autre pour X-Y 56 154 // de la fenetre histo 57 lab [0] = new PILabel(this->MainWin(), "time", 210, 30, 10, 10);58 lab[1] = new PILabel(this->MainWin(), "info", 210, 30, 10, 50); 155 lab = new PILabel(this->MainWin(), "time", 250, 50, 10, 10); 156 59 157 mPeriod.SetAction(mypact); 60 158 61 159 // Fenetre de dialogue 62 160 mAW = new ArgsWind(this); 63 64 mCurW = NULL; // Fenetre courante65 161 SetReady(); 66 162 } … … 69 165 PITApp::~PITApp() 70 166 { 71 int i; 72 for(i=0; i<2; i++) { delete lab[i]; delete m[i]; } 167 delete m; delete lab; 73 168 delete mAW; 74 169 } … … 80 175 char strg[64]; 81 176 82 // Gestion fenetre courante 83 if (ModMsg(msg) == PIMsg_Active) 84 { 85 PIWdg *sndw; 86 sndw = (PIWdg *)sender; 87 if (sndw->kind() == PIWindow::ClassId) mCurW = (PIWindow *)sender; 88 } 89 90 else 91 { 92 switch(UserMsg(msg)) 93 { 94 95 // --------- 1er menu ---------- 177 // Gestion des actions en fonctions des messages 178 179 switch(UserMsg(msg)) { 180 96 181 case 10101: // On met a l'heure 97 182 mypact(NULL); … … 103 188 104 189 case 10103: 105 mPeriod.Stop(); // On demarre la montre 190 mPeriod.Stop(); // On arrete la montre 191 break; 192 193 case 10104 : // Apparition de la fenetre de dialogue 194 mAW->Show(); 106 195 break; 107 196 108 197 case 10105: // Sortie d'application 109 198 Stop(); 110 break;111 112 // ---------- 2eme menu --------113 114 case 10201 : // Creation, Affichage d'histo115 PIDrawWindow * draw;116 PIHisto *pih;117 Histo *h;118 float x;119 120 SetBusy(); // souris -> montre121 // Creation et remplissage d'histo122 h = new Histo(0., 200., 100);123 for(int i=0; i<100; i++)124 { x = (2*i+1.); h->Add(x, x*(200.-x)); }125 126 nbhis++; sprintf(strg, "Histo %d", nbhis);127 // Creation d'une fenetre de trace128 draw = new PIDrawWindow(this, strg, PIWK_normal, 200, 200, 300, 300);129 // Creation d'un traceur d'histo130 pih = new PIHisto(h);131 132 pih->SetAutoDelHisto(true); // Histo delete quand window -> close133 // Accrochage du traceur d'histo a la fenetre de Draw134 draw->AddDrawer(pih);135 // Designation du champ label pour affichage coordonnees quand click souris136 draw->DrawWdg()->SetTextWin(lab[1]);137 draw->SetAutoDelChilds(true);138 // On affiche la fenetre139 draw->Show();140 141 SetReady(); // souris->pointeur , on n'est plus occupe142 break;143 144 case 10202 : // Apparition de la fenetre de dialogue145 mAW->Show();146 break;147 148 case 10203 : // Suppression de la fenetre courante149 if (mCurW) { mCurW->Hide(); delete mCurW;}150 lab[1]->SetLabel("");151 mCurW = NULL;152 break;153 154 155 case 10205 : // Creation fichier PostScript156 if(mCurW) {157 PSFile *mps;158 printf("Open PSFile (exapp_1.ps) \n");159 mps = new PSFile("exapp_1.ps",14,10,160 mCurW->XSize(),mCurW->YSize());161 // Contenu fenetre courante ds .ps162 mCurW->PSPrint(mps,0,0);163 delete mps;164 }165 199 break; 166 200 … … 169 203 (int)msg, (int)UserMsg(msg),(int)ModMsg(msg)); 170 204 break; 171 }172 }173 return;174 }175 176 /* ........................................................... */177 /* Classe ArgsWindow (Appel UserProc Function) */178 /* ........................................................... */179 180 181 /* --Methode-- */182 ArgsWind::ArgsWind(PIApplication *par)183 : PIWindow((PIMsgHandler *)par, "Args", PIWK_dialog, 260, 200, 150, 150)184 {185 pap = par;186 187 // Creation de champs "labels"188 mLab[0] = new PILabel(this, "FMin Max:", 100, 35, 20, 10);189 mLab[1] = new PILabel(this, "XMin Max:", 100, 35, 20, 55);190 mLab[2] = new PILabel(this, "YMin Max:", 100, 35, 20, 100);191 192 // Creation de champs textes193 mText[0] = new PIText(this, "UsArg1", 130, 35, 120, 10);194 mText[0]->SetText("1. -1.");195 mText[1] = new PIText(this, "UsArg2", 130, 35, 120, 55);196 mText[1]->SetText("1. -1.");197 mText[2] = new PIText(this, "UsArg3", 130, 35, 120, 100);198 mText[2]->SetText("1. -1.");199 200 // Creation de bouton d'action201 // Attention : Numero de message pour Process()202 mBut[0] = new PIButton(this, "OK", 555, 70, 30, 30, 160);203 mBut[1] = new PIButton(this, "Cancel", 777, 70, 30, 160, 160);204 FinishCreate();205 206 }207 208 /* --Methode-- */209 ArgsWind::~ArgsWind()210 {211 for(int i=0; i<3; i++)212 {213 delete mLab[i];214 delete mText[i];215 }216 217 delete mBut[0];218 delete mBut[1];219 }220 221 /* --Methode-- */222 void ArgsWind::SetLabels(char *lab1, char *lab2, char *lab3)223 // Permet de changer les etiquettes (les label)224 {225 mLab[0]->SetLabel(lab1);226 mLab[1]->SetLabel(lab2);227 mLab[2]->SetLabel(lab3);228 }229 230 /* --Methode-- */231 void ArgsWind::SetTexts(char *tx1, char *tx2, char *tx3)232 // Permet de changer les contenu des champs texte233 {234 mText[0]->SetText(tx1);235 mText[1]->SetText(tx2);236 mText[2]->SetText(tx3);237 238 }239 240 /* --Methode-- */241 void ArgsWind::GetTexts(char *tx1, char *tx2, char *tx3)242 // Permet de recuperer les contenus des champs texte243 // ATTENTION : Il faut qu'il y ait assez de place244 // ds tx1, tx2, tx3 pour que la fonction puisse y copier245 // les chaines246 {247 strcpy(tx1, mText[0]->GetText().c_str());248 strcpy(tx2, mText[1]->GetText().c_str());249 strcpy(tx3, mText[2]->GetText().c_str());250 251 }252 253 /* --Methode-- */254 void ArgsWind::Process(PIMessage msg, PIMsgHandler* /*sender*/, void* /*data*/)255 {256 float xmin, xmax, ymin, ymax;257 float fmin, fmax;258 259 switch (UserMsg(msg))260 {261 case 777: // Bouton cancel - On s'en va262 this->Hide();263 pap->SetReady();264 break;265 266 case 555: // Bouton OK267 // On recupere les textes des 3 champs :268 for(int i=0; i<3; i++)269 printf("ArgsWind::Process() Txt[%d] = %s \n", i, mText[i]->GetText().c_str());270 sscanf(mText[0]->GetText().c_str(),"%g %g", &fmin, &fmax);271 sscanf(mText[1]->GetText().c_str(),"%g %g", &xmin, &xmax);272 sscanf(mText[2]->GetText().c_str(),"%g %g", &ymin, &ymax);273 205 274 printf("... FMin/Max= %g %g XMin/Max= %g %g YMin/Max= %g %g\n", 275 fmin, fmax, xmin, xmax, ymin, ymax); 276 this->Hide(); 277 pap->SetReady(); 278 break; 279 } 280 206 } 281 207 return; 282 208 } … … 288 214 // Fonction pour lire l'heure de la machine et mettre a jour le champ label 289 215 { 290 int tm;216 time_t tm; 291 217 char *s; 292 218 time(&tm); 293 219 s = ctime(&tm); 294 220 // printf("mypact_Info: %d (%s)", tm, s); 295 app->lab [0]->SetLabel((string)s);221 app->lab->SetLabel((string)s); 296 222 return; 297 223 } 298 224 225 // ................................................................ 226 // programme principal 227 // ................................................................ 228 299 229 int main(int narg, char *arg[]) 300 230 { 301 302 // Initialisation de tout PEIDA (avec StarReco++) 303 PeidaStarRecoInitiator InitStar; 304 231 // Creation de l'objet application et appel de Run() 305 232 app = new PITApp(narg, arg); 306 233 puts("appel de Application.Run() ... "); -
trunk/SophyaPI/PI/exapp_1.h
r39 r113 1 #include <string.h>2 3 1 #include "pisysdep.h" 4 2 … … 7 5 #include PISTDWDG_H 8 6 #include PIWIN_H 9 #include "piperiodx.h" // PIPERIODIC_H 10 11 class ArgsWind; 12 13 class PITApp : public PIApplication { 14 public: 15 PITApp(int narg=0, char* arg[]=NULL); 16 ~PITApp(); 17 virtual void Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL); 18 19 // protected : 20 21 PIPDMenu * m[2]; 22 PILabel *lab[2]; 23 PIPeriodX mPeriod; 24 PIWindow *mCurW; 25 ArgsWind *mAW; 26 }; 27 7 #include PIPERIODIC_H 28 8 29 9 class ArgsWind : public PIWindow { … … 37 17 38 18 private: 39 PIApplication * pap;40 19 PILabel * mLab[3]; 41 20 PIButton * mBut[2]; 42 21 PIText * mText[3]; 43 22 }; 23 24 class PITApp : public PIApplication { 25 public: 26 PITApp(int narg=0, char* arg[]=NULL); 27 ~PITApp(); 28 virtual void Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL); 29 30 PILabel *lab; 31 32 private : 33 PIMenu * m; 34 PIPeriodX mPeriod; 35 ArgsWind *mAW; 36 }; 37 38 -
trunk/SophyaPI/PI/exclude
r90 r113 26 26 sc_sample.cc 27 27 exapp_1.cc 28 exapp_2.cc 28 29 pitestapp.cc 29 30 piup_def.cc -
trunk/SophyaPI/PI/parradapter.cc
r111 r113 16 16 offX = offY = 0; 17 17 invX = invY = eXY = false; 18 DefineXYCoordinates(0.,0.,1.,1.); 18 19 } 19 20 … … 28 29 invX = invx; invY = invy; eXY = exy; 29 30 if ( (sx > 0) && (sy > 0) ) { sX = sx; sY = sy; } 30 if (invX) { sgnX = -1; offX = sX ; }31 if (invX) { sgnX = -1; offX = sX-1; } 31 32 else { sgnX = 1; offX = 0; } 32 if (invY) { sgnY = -1; offY = sY ; }33 if (invY) { sgnY = -1; offY = sY-1; } 33 34 else { sgnY = 1; offY = 0; } 34 35 } 35 36 36 37 /* --Methode-- */ 38 void P2DArrayAdapter::DefineXYCoordinates(float x0, float y0, float dx, float dy) 39 { 40 mOx = x0; mOy = y0; 41 mDx = dx; mDy = dy; 42 } 43 44 /* --Methode-- */ 37 45 void P2DArrayAdapter::XYfromxy(int ix, int iy, float& x, float& y) 38 46 { 39 x = ix;40 y = iy;47 x = mOx+ix*mDx; 48 y = mOy+iy*mDy; 41 49 } 42 50 -
trunk/SophyaPI/PI/parradapter.h
r111 r113 25 25 inline void GetAxesConfiguration(bool& invx, bool& invy, bool& exy) 26 26 { invx = invX; invy = invY; exy = eXY; } 27 28 virtual void DefineXYCoordinates(float x0, float y0, float dx, float dy); 27 29 // Doit etre defini par les classes derivees 28 30 virtual float Value(int ix, int iy) = 0; … … 58 60 protected : 59 61 int sX, sY; 62 float mOx, mDx, mOy, mDy; 60 63 int sgnX, sgnY; 61 64 int offX, offY; -
trunk/SophyaPI/PI/pi3ddrw.cc
r111 r113 1 // Module PI : Peida Interactive PIDrawer3D PIDraw3DWdg 2 // Drawer et DrawWidget 3D R. Ansari 06/98 3 // LAL (Orsay) / IN2P3-CNRS DAPNIA/SPP (Saclay) / CEA 4 5 #include <stdio.h> 6 #include <stdlib.h> 7 #include <math.h> 8 1 9 #include "pi3ddrw.h" 2 10 3 PI3DDrawer::PI3DDrawer() 11 12 // ...................................................................... 13 // ........................ Classe PIDrawer3D .......................... 14 // ...................................................................... 15 16 17 /* --Methode-- */ 18 PIDrawer3D::PIDrawer3D() 4 19 : PIDrawer() 5 20 { 6 } 7 PI3DDrawer::~PI3DDrawer() 8 { 9 } 21 xO = yC = 0.; zO = -10.; 22 xC = yC = zC = 0.; 23 tO = fO = pO = 0.; 24 daxO = dayO = 0.25; 25 lCO = 10.; dlCO = 3.; 26 v3D_obs = false; 27 } 28 29 /* --Methode-- */ 30 PIDrawer3D::~PIDrawer3D() 31 { 32 } 33 34 /* --Methode-- */ 35 void PIDrawer3D::Set3DView_Obs(float xo, float yo, float zo, float teta, float phi, float psi, 36 float dax, float day, float co, float dco) 37 { 38 tO = teta; fO = phi; pO = psi; 39 daxO = dax; dayO = day; 40 lCO = co; dlCO = dco; 41 v3D_obs = true; 42 } 43 44 /* --Methode-- */ 45 void PIDrawer3D::Set3DView(float xc, float yc, float zc, float xo, float yo, float zo, 46 float dax, float day, float dco, float psi) 47 { 48 xC = xc; yC = yc; zC = zc; 49 xO = xo; yO = yo; zO = zo; 50 pO = psi; 51 daxO = dax; dayO = day; 52 dlCO = dco; 53 v3D_obs = false; 54 } 55 56 /* --Methode-- */ 57 bool PIDrawer3D::Get3DView(float& xc, float& yc, float& zc, float& xo, float& yo, float& zo, 58 float& teta, float& phi, float& psi, float& dax, float& day, float& co, float& dco) 59 { 60 xo = xO; yo = yO; zo = zO; 61 xc = xC; yc = yC; zc = zC; 62 teta = tO; phi = fO; psi = pO; 63 dax = daxO; day = dayO; 64 co = lCO; dco = dlCO; 65 return(v3D_obs); 66 } 67 68 /* --Methode-- */ 69 PIGraphicUC* PIDrawer3D::SetDrwWdg(PIBaseWdgGen* drw, int x0, int y0, int dx, int dy, PIGraphicGen* g) 70 { 71 mBWdg = drw; 72 xW0 = x0; yW0 = y0; 73 xWd = dx; yWd = dy; 74 if (mGrUC) delete mGrUC; 75 PIGraphic3D* gr3d; 76 gr3d = new PIGraphic3D(g, x0, y0, dx, dy); 77 if (v3D_obs) gr3d->Set3DCS_Obs(xO, yO, zO, tO, fO, pO, daxO, dayO, lCO, dlCO); 78 else gr3d->Set3DCS(xC,yC,zC, xO, yO, zO, daxO, dayO, dlCO, pO); 79 mGrUC = gr3d; 80 return(gr3d); 81 } 82 83 84 85 // ...................................................................... 86 // ........................ Classe PIDrawer3D .......................... 87 // ...................................................................... 88 89 90 /* --Methode-- */ 91 PIDraw3DWdg::PIDraw3DWdg(PIContainerGen *par, char *nom, int sx, int sy, int px, int py) 92 : PIBaseWdg(par, nom, sx, sy, px, py) 93 { 94 vfixed = false; 95 SetDefaultDrawRectangle(0., 0., 1., 1., true); 96 97 lPx = lPy = 0; 98 lCol = PI_Black; 99 cTeta = cPhi = 0.; cUlen = 1.; 100 101 ActivateButton(1); // Pour pouvoir tourner la camera 102 ActivateMove(1); 103 ActivateButton(2); // Pour deplacer la camera le long de son axe 104 ActivateMove(2); 105 ActivateButton(3); // Pour pouvoir tourner la camera 106 107 mGr3d = new PIGraphic3D(mWGrC, 0, 0, sx, sy); 108 } 109 110 /* --Methode-- */ 111 PIDraw3DWdg::~PIDraw3DWdg() 112 { 113 delete mGr3d; 114 } 115 116 /* --Methode-- */ 117 void PIDraw3DWdg::Set3DView_Obs(float xo, float yo, float zo, float teta, float phi, float psi, 118 float dax, float day, float co, float dco) 119 { 120 mGr3d->Set3DCS_Obs(xo, yo, zo, teta, phi, psi, dax, day, co, dco); 121 list<int>::iterator it; 122 for(it = m3DrIl.begin(); it != m3DrIl.end(); it++) 123 (dynamic_cast<PIDrawer3D*>(GetDrawerId(*it)))->Set3DView_Obs(xo, yo, zo, teta, phi, psi, dax, day, co, dco); 124 vfixed = true; 125 } 126 127 /* --Methode-- */ 128 void PIDraw3DWdg::Set3DView(float xc, float yc, float zc, float xo, float yo, float zo, 129 float dax, float day, float dco, float psi) 130 { 131 mGr3d->Set3DCS(xc, yc, zc, xo, yo, zo, dax, day, dco, psi); 132 list<int>::iterator it; 133 for(it = m3DrIl.begin(); it != m3DrIl.end(); it++) 134 (dynamic_cast<PIDrawer3D*>(GetDrawerId(*it)))->Set3DView(xc, yc, zc, xo, yo, zo, dax, day, dco, psi); 135 vfixed = true; 136 } 137 138 /* --Methode-- */ 139 bool PIDraw3DWdg::Get3DView(float& xc, float& yc, float& zc, float& xo, float& yo, float& zo, 140 float& teta, float& phi, float& psi, float& dax, float& day, float& co, float& dco) 141 { 142 return(mGr3d->Get3DCS(xc, yc, zc, xo, yo, zo, teta, phi, psi, dax, day, co, dco)); 143 } 144 145 /* --Methode-- */ 146 void PIDraw3DWdg::Update3DView() 147 { 148 float xc, yc, zc, xo, yo, zo; 149 float teta, phi, psi; 150 float dax, day, co, dco; 151 bool vo; 152 vo = mGr3d->Get3DCS( xc, yc, zc, xo, yo, zo, teta, phi, psi, dax, day, co, dco); 153 list<int>::iterator it; 154 if (vo) for(it = m3DrIl.begin(); it != m3DrIl.end(); it++) 155 (dynamic_cast<PIDrawer3D*>(GetDrawerId(*it)))->Set3DView_Obs(xo, yo, zo, teta, phi, psi, dax, day, co, dco); 156 else for(it = m3DrIl.begin(); it != m3DrIl.end(); it++) 157 (dynamic_cast<PIDrawer3D*>(GetDrawerId(*it)))->Set3DView(xc, yc, zc, xo, yo, zo, dax, day, dco, psi); 158 } 159 160 /* --Methode-- */ 161 int PIDraw3DWdg::AddDrawer3D(PIDrawer3D* dr3, bool ad) 162 { 163 if (!vfixed) { 164 dr3->UpdateSize(); 165 float xo, yo, zo, xc, yc, zc, teta, phi, psi, dax, day, co, dco; 166 bool vobs; 167 vobs = dr3->Get3DView(xc, yc, zc, xo, yo, zo, teta, phi, psi, dax, day, co, dco); 168 if (vobs) Set3DView_Obs(xo, yo, zo, teta, phi, psi, dax, day, co, dco); 169 else Set3DView(xc, yc, zc, xo, yo, zo, dax, day, dco, psi); 170 } 171 else { 172 float xc, yc, zc, xo, yo, zo, teta, phi, psi, dax, day, co, dco; 173 if ( Get3DView(xc, yc, zc, xo, yo, zo, teta, phi, psi, dax, day, co, dco) ) 174 dr3->Set3DView_Obs(xo, yo, zo, teta, phi, psi, dax, day, co, dco); 175 else dr3->Set3DView(xc, yc, zc, xo, yo, zo, dax, day, co, psi); 176 } 177 int id = AddDrawer(dr3, false, false, ad); 178 m3DrIl.push_back(id); 179 return(id); 180 } 181 182 /* --Methode-- */ 183 void PIDraw3DWdg::RemoveDrawer(int id) 184 { 185 list<int>::iterator it; 186 for(it = m3DrIl.begin(); it != m3DrIl.end(); it++) 187 if ( (*it) == id ) { m3DrIl.erase(it); break; } 188 PIBaseWdg::RemoveDrawer(id); 189 } 190 191 /* --Methode-- */ 192 void PIDraw3DWdg::DeleteDrawers() 193 { 194 m3DrIl.erase(m3DrIl.begin(), m3DrIl.end()); 195 PIBaseWdg::DeleteDrawers(); 196 } 197 198 /* --Methode-- */ 199 void PIDraw3DWdg::But1Press(int x, int y) 200 { 201 mGr3d->SetBaseGraphic(mWGrC, 0, 0, XSize(), YSize()); 202 float xc, yc, zc, xo, yo, zo; 203 float teta, phi, psi; 204 float dax, day, co, dco; 205 mGr3d->Get3DCS(xc, yc, zc, xo, yo, zo, teta, phi, psi, dax, day, co, dco); 206 // puts("\n PIDraw3DWdg::But1Press() "); 207 // mGr3d->PrintCS(); 208 lPx = x; lPy = y; 209 cUlen = 0.5*(dax+day)*co*0.3; cDax = dax; cDay = day; clCO = co; 210 cTeta = teta; cPhi = phi; 211 SelPointerShape(PI_TDLRArrowPointer); 212 lCol = mWGrC->GetForeground(); 213 mWGrC->SelForeground(GetBackgroundColor()); 214 /* 215 { 216 char buff[256]; 217 sprintf(buff, "But1Press() C=%g %g %g T,P=%g %g ", xc, yc, zc, cTeta, cPhi); 218 mWGrC->DrawOpaqueString(0,20,buff); 219 } 220 */ 221 DrawXYZAxes(); 222 Send(Msg(), PIMsg_Active); 223 } 224 225 /* --Methode-- */ 226 void PIDraw3DWdg::Ptr1Move(int x, int y) 227 { 228 DrawXYZAxes(); 229 float phi = M_PI+cPhi; 230 float teta = M_PI-cTeta; 231 phi += (M_PI*0.4*(float)(x-lPx)/XSize()); 232 teta -= (M_PI*0.4*(float)(y-lPy)/YSize()); 233 mGr3d->RotateObserver(teta, phi, 0., false); 234 /* { 235 char buff[256]; 236 sprintf(buff, "Ptr1Move() T,P=%g %g -> %g %g ", cTeta, cPhi, teta, phi); 237 mWGrC->DrawOpaqueString(0,20,buff); 238 } 239 */ 240 DrawXYZAxes(); 241 } 242 243 244 /* --Methode-- */ 245 void PIDraw3DWdg::But1Release(int x, int y) 246 { 247 DrawXYZAxes(); 248 // puts("\n PIDraw3DWdg::But1Release()"); 249 // mGr3d->PrintCS(); 250 SelPointerShape(PI_ArrowPointer); 251 mWGrC->SelForeground(lCol); 252 Update3DView(); 253 Refresh(); 254 } 255 256 257 /* --Methode-- */ 258 void PIDraw3DWdg::But2Press(int x, int y) 259 { 260 float xc, yc, zc, xo, yo, zo; 261 float teta, phi, psi; 262 float dax, day, co, dco; 263 mGr3d->Get3DCS(xc, yc, zc, xo, yo, zo, teta, phi, psi, dax, day, co, dco); 264 mGr3d->SetBaseGraphic(mWGrC, 0, 0, XSize(), YSize()); 265 lPx = x; lPy = y; 266 cUlen = 0.5*(dax+day)*co*0.3; cDax = dax; cDay = day; clCO = co; 267 cTeta = teta; cPhi = phi; 268 SelPointerShape(PI_TDLRArrowPointer); 269 lCol = mWGrC->GetForeground(); 270 mWGrC->SelForeground(GetBackgroundColor()); 271 /* 272 { 273 char buff[256]; 274 sprintf(buff, "But2Press() C=%g %g %g O= %g %g %g L= %g ", xc, yc, zc, xo, yo, zo, co); 275 mWGrC->DrawOpaqueString(0,20,buff); 276 } 277 */ 278 DrawXYZAxes(); 279 Send(Msg(), PIMsg_Active); 280 } 281 282 /* --Methode-- */ 283 void PIDraw3DWdg::Ptr2Move(int x, int y) 284 { 285 DrawXYZAxes(); 286 float rapx = (float)(x-lPx)/XSize(); 287 if (rapx > 0.) rapx = rapx*2.+1; 288 else rapx += 1.; 289 if (rapx < 0.3) rapx = 0.3; 290 if (rapx > 3.) rapx = 3.; 291 float rapy = (float)(y-lPy)/YSize(); 292 if (rapy > 0.) rapy = rapy*2.+1; 293 else rapy += 1.; 294 if (rapy < 0.3) rapy = 0.3; 295 if (rapy > 3.) rapy = 3.; 296 /* 297 { 298 char buff[256]; 299 sprintf(buff, "Ptr2Move() Rap=%g %g -> %g %g %g ", rapx, rapy, rapy*clCO, rapx*cDax, rapx*cDay); 300 mWGrC->DrawOpaqueString(0,20,buff); 301 } 302 */ 303 mGr3d->ZoomInOut(rapy*clCO, rapx*cDax, rapx*cDay, false); 304 DrawXYZAxes(); 305 } 306 307 /* --Methode-- */ 308 void PIDraw3DWdg::But2Release(int x, int y) 309 { 310 DrawXYZAxes(); 311 SelPointerShape(PI_ArrowPointer); 312 mWGrC->SelForeground(lCol); 313 Update3DView(); 314 Refresh(); 315 } 316 317 318 /* --Methode-- */ 319 void PIDraw3DWdg::DrawXYZAxes() 320 { 321 mWGrC->SelGOMode(PI_GOXOR); 322 PIGrCoord x1,y1,z1,x2,y2,z2; 323 float xc,yc,zc,xo,yo,zo,teta,phi,psi,dax,day,co,dco; 324 mGr3d->Get3DCS(xc,yc,zc,xo,yo,zo,teta,phi,psi,dax,day,co,dco); 325 float len = cUlen; 326 x1 = xc; y1 = yc; z1 = zc; 327 x2 = xc+len; y2 = yc; z2 = zc; 328 mGr3d->DrawLine3D(x1, y1, z1, x2, y2, z2); 329 x2 = xc+len*1.1; 330 mGr3d->DrawString3D(x2, y2, z2, "X"); 331 x2 = xc; y2 = yc+len; z2 = zc; 332 mGr3d->DrawLine3D(x1, y1, z1, x2, y2, z2); 333 y2 = yc+len*1.1; 334 mGr3d->DrawString3D(x2, y2, z2, "Y"); 335 x2 = xc; y2 = yc; z2 = zc+len; 336 mGr3d->DrawLine3D(x1, y1, z1, x2, y2, z2); 337 z2 = zc+len*1.1; 338 mGr3d->DrawString3D(x2, y2, z2, "Z"); 339 // mGr3d->DrawCircle(0., 0., daxO*0.30); 340 char buff[256]; 341 sprintf(buff, " C: %g %g %g -> O: %g %g %g (T/P0= %g %g) ", xc,yc,zc, xo, yo, zo, cTeta, cPhi); 342 mWGrC->DrawString(0,20,buff); 343 sprintf(buff, " T,P= %g %g %g lCO= %g dax= %g %g UL=%g ", teta,phi,psi,co,dax,day,cUlen); 344 mWGrC->DrawString(0,40,buff); 345 mWGrC->SelGOMode(PI_GOCopy); 346 347 } 348 349 350 /* --Methode-- */ 351 void PIDraw3DWdg::But3Press(int x, int y) 352 { 353 list<int>::iterator it = m3DrIl.begin(); 354 if (it == m3DrIl.end()) return; 355 PIDrawer3D* dr3 = dynamic_cast<PIDrawer3D*>(GetDrawerId(*it)); 356 if (dr3 == NULL) return; 357 dr3->UpdateSize(); 358 float xo, yo, zo, xc, yc, zc, teta, phi, psi, dax, day, co, dco; 359 bool vobs; 360 vobs = dr3->Get3DView(xc, yc, zc, xo, yo, zo, teta, phi, psi, dax, day, co, dco); 361 if (vobs) Set3DView_Obs(xo, yo, zo, teta, phi, psi, dax, day, co, dco); 362 else Set3DView(xc, yc, zc, xo, yo, zo, dax, day, dco, psi); 363 Refresh(); 364 } 365 366 /* Pour debugger sur bouton-3 367 static int isw = 0; 368 void PIDraw3DWdg::But3Press(int x, int y) 369 x -= XSize()/2; 370 y -= YSize()/2; 371 372 float fx = (float)x/XSize(); 373 float fy = (float)y/YSize(); 374 if ( (fx<0.2) && (fx>-0.2) && (fy<0.2) && (fy>-0.2) ) { 375 376 if ((isw%3) == 0) { 377 Set3DView(0., 0., 0., 0., 0., -3. , 0.3, 0.3, 2); 378 puts("\n Set3DView(0., 0., 0., 0., 0., -3. , 0.3, 0.3, 2)"); 379 } 380 else if ((isw%3) == 1) { 381 Set3DView(0., 0., 0., 2., 1., 3. , 0.3, 0.3, 2); 382 puts("\n Set3DView(0., 0., 0., 2., 1., 3. , 0.3, 0.3, 2)"); 383 } 384 else if ((isw%3) == 2) { 385 Set3DView_Obs(0.,4.,0.,3.14159/2.,-3.14159/2.,0.,0.25,0.25,4.,2.); 386 puts("\n Set3DView_Obs(0.,4.,0.,3.14159/2.,3.14159/2.,0.,0.25,0.25,4.,2.)"); 387 } 388 isw++; 389 mGr3d->PrintCS(); 390 float xc,yc,zc,xo,yo,zo,teta,phi,psi,dax,day,co,dco; 391 mGr3d->Get3DCS(xc,yc,zc,xo,yo,zo,teta,phi,psi,dax,day,co,dco); 392 mGr3d->Set3DCS(xc,yc,zc,xo,yo,zo,dax,day,dco,psi); 393 mGr3d->PrintCS(); 394 mGr3d->Set3DCS_Obs(xo,yo,zo,teta,phi,psi,dax,day,co,dco); 395 mGr3d->PrintCS(); 396 puts(" --------------------- \n"); 397 Refresh(); 398 return; 399 } 400 if ((x > 0) && (y > 0) ) { 401 puts(" But3Press()Set3DView(0., 0., 0., 5., 0., 0. , 0.3, 0.3, 2)"); 402 Set3DView(0., 0., 0., 5., 0., 0. , 0.3, 0.3, 2); 403 } 404 else if ((x < 0) && (y > 0) ) { 405 puts(" But3Press()Set3DView(0., 0., 0., 0., 5., 1. , 0.3, 0.3, 2) "); 406 Set3DView(0., 0., 0., 0., 5., 1. , 0.3, 0.3, 2); 407 } 408 else if ((x < 0) && (y < 0) ) { 409 puts(" But3Press()Set3DView(0., 0., 0., 1., 1., 5. , 0.3, 0.3, 2)"); 410 Set3DView(0., 0., 0., 1., 1., 5. , 0.3, 0.3, 2); 411 } 412 else { 413 puts(" But3Press()Set3DView(0., 0., 0., -3., -3., 3. , 0.3, 0.3, 2)"); 414 Set3DView(0., 0., 0., -3., -3., 3. , 0.3, 0.3, 2); 415 } 416 417 Refresh(); 418 */ -
trunk/SophyaPI/PI/pi3ddrw.h
r111 r113 1 #ifndef PI3DDRW_H_SEEN 2 #define PI3DDRW_H_SEEN 1 // Module PI : Peida Interactive PIDrawer3D PIDraw3DWdg 2 // Drawer et DrawWidget 3D R. Ansari 06/98 3 // LAL (Orsay) / IN2P3-CNRS DAPNIA/SPP (Saclay) / CEA 4 5 #ifndef PIDRW3D_H_SEEN 6 #define PIDRW3D_H_SEEN 7 8 #include "pisysdep.h" 3 9 #include "pidrawer.h" 4 class PI3DDrawer : PIDrawer 10 #include "pigraph3d.h" 11 12 #include PIBWDG_H 13 14 #include <list> 15 16 // Traceur (Drawer) 3D 17 class PIDrawer3D : public PIDrawer 5 18 { 6 PI3DDrawer(); 7 virtual ~PI3DDrawer(); 19 public : 20 PIDrawer3D(); 21 virtual ~PIDrawer3D(); 22 23 virtual void Set3DView_Obs(float xo, float yo, float zo, float teta, float phi, float psi, 24 float dax, float day, float co, float dco=0.2); 25 virtual void Set3DView(float xc, float yc, float zc, float xo, float yo, float zo, 26 float dax, float day, float dco=0.2, float psi=0.); 27 bool Get3DView(float& xc, float& yc, float& zc, float& xo, float& yo, float& zo, 28 float& teta, float& phi, float& psi, float& dax, float& day, float& co, float& dco); 29 30 virtual PIGraphicUC* SetDrwWdg(PIBaseWdgGen* drw, int x0, int y0, int dx, int dy, PIGraphicGen* g); 31 32 protected : 33 float xO, yO, zO; // Position observateur = camera 34 float xC, yC, zC; // Position centre du champ 35 float tO,fO,pO; // Orientation observateur (Teta, Phi, Psi, Angles d Euler) 36 float daxO, dayO; // Demi-ouverture de la camera suivant les deux axes de projection (xp/zp, yp/zp) 37 float lCO, dlCO; // Distance Camera-Centre du champ et profondeur de champ 38 bool v3D_obs; // Si defini par Set3DView_Obs 8 39 }; 40 41 42 43 class PIDraw3DWdg : public PIBaseWdg { 44 public: 45 enum {ClassId = 5500}; 46 47 PIDraw3DWdg(PIContainerGen *par, char *nom, 48 int sx=100, int sy=100, int px=0, int py=0); 49 virtual ~PIDraw3DWdg(); 50 virtual long kind() {return ClassId; } 51 52 virtual void Set3DView_Obs(float xo, float yo, float zo, float teta, float phi, float psi, 53 float dax, float day, float co, float dco=0.2); 54 virtual void Set3DView(float xc, float yc, float zc, float xo, float yo, float zo, 55 float dax, float day, float dco=0.2, float psi=0.); 56 bool Get3DView(float& xc, float& yc, float& zc, float& xo, float& yo, float& zo, 57 float& teta, float& phi, float& psi, float& dax, float& day, float& co, float& dco); 58 59 int AddDrawer3D(PIDrawer3D*, bool ad=false); // Ajoute un Drawer 60 61 // Pour tenir trace des Drawers-3D qui sont detruits 62 virtual void RemoveDrawer(int id); 63 virtual void DeleteDrawers(); 64 65 virtual void But1Press(int x, int y); 66 virtual void But1Release(int x, int y); 67 virtual void Ptr1Move(int x, int y); 68 69 virtual void But2Press(int x, int y); 70 virtual void But2Release(int x, int y); 71 virtual void Ptr2Move(int x, int y); 72 73 virtual void But3Press(int x, int y); 74 75 protected : 76 virtual void Update3DView(); 77 virtual void DrawXYZAxes(); 78 79 bool vfixed; // SetView fait ou pas 80 list<int> m3DrIl; // Liste des Id drawers 3D 81 PIGraphic3D* mGr3d; // PIGraphic3D courante 82 int lPx, lPy; // dernier position pointeur 83 PIColors lCol; // Couleur 84 float cTeta, cPhi, cUlen; // Pour garder valeurs avant rotation, Unite de longeur 85 float clCO, cDax, cDay; // Pour garder les valeurs avant Zoom In/Out 86 }; 87 9 88 #endif -
trunk/SophyaPI/PI/pibwdggen.cc
r111 r113 57 57 puts("Debug_PIBaseWdgGen::Draw() Efface la fenetre par defaut ! "); 58 58 #endif 59 EraseWindow(0, 0, XSize(), YSize()); 59 60 if (fgdrawloop == 0) 60 61 { fgdrawloop=2; Draw(g, 0, 0, XSize(), YSize()); } -
trunk/SophyaPI/PI/pibwdggen.h
r111 r113 81 81 // ------ Gestion des Drawers ------ 82 82 friend class PIDrawer; 83 83 virtual void SetDefaultDrawRectangle(PIGrCoord x1, PIGrCoord y1, 84 84 PIGrCoord x2, PIGrCoord y2, bool psz=true); 85 85 virtual void SetDefaultDrawerLimits(float xmin, float xmax, float ymin, float ymax, 86 86 int axrl=kAxeDirSame, int ayud=kAxeDirSame); 87 87 virtual int AddDrawer(PIDrawer* drw, PIGrCoord x1, PIGrCoord y1, 88 88 PIGrCoord x2, PIGrCoord y2, 89 89 bool psz=true, bool clip=true, bool ad=false); 90 91 90 virtual int AddDrawer(PIDrawer* drw, bool autolim=false, bool clip=true, bool ad=false); 91 virtual void MoveResizeDrawer(int id, PIGrCoord x1, PIGrCoord y1, 92 92 PIGrCoord x2, PIGrCoord y2, bool psz=true); 93 94 93 virtual void RemoveDrawer(int id); // Ote un drawer de la liste 94 virtual void DeleteDrawers(); // Ote et detruit tous les drawers 95 95 // Acces aux drawers 96 97 98 96 virtual int NbDrawers(); 97 virtual PIDrawer* GetDrawerId(int id); 98 virtual PIDrawer* GetDrawer(int n); 99 99 100 100 // Trace des Drawers ... -
trunk/SophyaPI/PI/pidrawer.cc
r111 r113 20 20 mMSz = -1; 21 21 mMrk = PI_NotDefMarker; 22 mCmapid = CMAP_OTHER; 22 23 } 23 24 … … 106 107 107 108 void 109 PIDrawer::SetColMapId(CMapId cid) 110 { 111 mCmapid = cid; 112 } 113 114 void 108 115 PIDrawer::SelGraAtt(PIGraphicUC* g) 109 116 { … … 116 123 g->SelMarker(mMSz, mMrk); 117 124 } 125 118 126 119 127 void -
trunk/SophyaPI/PI/pidrawer.h
r111 r113 52 52 PIFontAtt fat=PI_NotDefFontAtt); 53 53 void SetMarkerAtt(int sz=-1, PIMarker mrk=PI_NotDefMarker); 54 void SetColMapId(CMapId cid=CMAP_OTHER); 54 55 55 56 void SelGraAtt(PIGraphicUC* g); … … 102 103 PIFontAtt mFAtt; 103 104 int mMSz; 104 PIMarker mMrk; 105 PIMarker mMrk; 106 CMapId mCmapid; 105 107 106 108 }; -
trunk/SophyaPI/PI/pifilechogen.cc
r23 r113 1 // Module PI : Peida Interactive PIFileChooser 2 // Selecteur de fichier 96-97 3 // LAL (Orsay) / IN2P3-CNRS DAPNIA/SPP (Saclay) / CEA 4 1 5 #include "pifilechogen.h" 2 6 3 7 4 8 /************* PIFileChooserGen ************/ 9 10 //++ 11 // Class PIFileChooser 12 // Lib PI 13 // include pifilechogen.h 14 // 15 // Composant graphique de type sélecteur de fichier, permettant de choisir 16 // un nom de fichier et de naviguer dans les répertoires. 17 // "PIFileChooserGen" définit l'interface (classe virtuelle pure). Les objets 18 // instanciés doivent être de la classe "PIFileChooser" déclarée dans le fichier 19 // entête "PIFILECHO_H". Le message associé à l'objet est envoyé completé 20 // avec "PIMsg_OK" si un nom de fichier a été choisi. la variable "data" 21 // est alors un pointeur sur une chaîne de caractères ("char *"), 22 // contenant le nom complet du fichier. Si aucun fichier n'a été 23 // sélectionné, le message de l'objet est completé avec "PIMsg_Cancel" et 24 // le "datä contient le pointeur "NULL". 25 //-- 26 //++ 27 // Links Parents 28 // PIWdg 29 //-- 30 //++ 31 // Titre Constructeur et méthodes 32 //-- 33 //++ 34 // PIFileChooser(PIMsgHandler* par, char* nom, PIMessage msg) 35 // Création d'un objet sélecteur de fichier, avec le message "msg". 36 // void Show() 37 // Affiche la fenêtre de sélection des fichiers 38 // void AcceptNewFile(bool acc) 39 // Active ("acc=true") ou désactive la possibilité de spécifier 40 // un nouveau fichier. 41 // void SetPath(string const&) 42 // Définit le chemin d'accès (répertoire) choisi par défaut 43 // void SetFileName(string const&) 44 // Nom de fichier sélectionné par défaut 45 // string GetPath() 46 // Retourne le chemin d'accès. NON IMPLEMENTE EN X/MOTIF (06/98) 47 // string GetFileName() 48 // Retourne le nom complet du fichier sélectionné. 49 //-- 50 5 51 6 52 PIFileChooserGen::PIFileChooserGen(PIMsgHandler* par, char* nom, PIMessage msg) -
trunk/SophyaPI/PI/pigraph3d.cc
r111 r113 1 // Module PI : Peida Interactive PIGraphic3D 2 // Trace graphiques 3D R. Ansari 06/98 3 // LAL (Orsay) / IN2P3-CNRS DAPNIA/SPP (Saclay) / CEA 4 1 5 #include <stdio.h> 6 #include <math.h> 2 7 #include "pigraph3d.h" 3 8 9 /* --Methode-- */ 4 10 PIGraphic3D::PIGraphic3D(PIGraphicGen* g, PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy) 5 11 : PIGraphicUC(g, x0, y0, dx, dy) 6 12 { 7 printf("PIGraphic3D::PIGraphic3D : Rien n'est code ! \n"); 8 } 9 13 int i,j; 14 for(i=0; i<3; i++) 15 for(j=0; j<3; j++) RE[i][j] = 0.; 16 RE[0][0] = RE[1][1] = RE[2][2] = 1.; 17 xO = yC = 0.; zO = -10.; 18 xC = yC = zC = 0.; 19 tO = fO = pO = 0.; 20 daxO = dayO = 0.25; 21 lCO = 10.; dlCO = 0.2; 22 sO = false; 23 } 24 25 /* --Methode-- */ 10 26 PIGraphic3D::~PIGraphic3D() 11 27 { 12 28 } 29 30 /* --Methode-- */ 31 int PIGraphic3D::kind() 32 { 33 return PI_3DGraphics; 34 } 35 36 static float deuxpi = 2*M_PI; 37 static double ddeuxpi = 2*M_PI; 38 39 /* --Methode-- */ 40 void PIGraphic3D::Set3DCS_Obs(float xo, float yo, float zo, float teta, float phi, float psi, 41 float dax, float day, float co, float dco) 42 { 43 sO = true; 44 xO = xo; yO = yo; zO = zo; 45 if (teta > M_PI) teta = M_PI; 46 if (teta < 0.) teta = 0.; 47 if (phi < 0.) phi = 0.; 48 if (phi > deuxpi) phi = deuxpi; 49 tO = teta; fO = phi; pO = psi; 50 if (dax < 0.) dax = -dax; 51 if (day < 0.) day = -day; 52 daxO = dax; dayO = day; 53 lCO = co; dlCO = dco; 54 SetUCS(-dax, dax, -day, day, kAxeDirLtoR, kAxeDirDownUp); 55 double ct = cos((double)tO); 56 double st = sin((double)tO); 57 // (Teta,Phi) = Direction de visee 58 // Les angles d'Euler correspondants sont Teta, Phi+Pi/2 59 double cf = cos((double)fO+M_PI_2); 60 double sf = sin((double)fO+M_PI_2); 61 double cp = cos((double)pO); 62 double sp = sin((double)pO); 63 RE[0][0] = cf*cp-sf*ct*sp; RE[0][1] = sf*cp+cf*ct*sp; RE[0][2] = st*sp; 64 RE[1][0] = -cf*sp-sf*ct*cp; RE[1][1] = -sf*sp+cf*ct*cp; RE[1][2] = st*cp; 65 RE[2][0] = sf*st; RE[2][1] = -cf*st; RE[2][2] = ct; 66 cf = cos((double)fO); 67 sf = sin((double)fO); 68 zC = ct*lCO+zO; 69 xC = st*cf*lCO+xO; 70 yC = st*sf*lCO+yO; 71 } 72 73 /* --Methode-- */ 74 void PIGraphic3D::Set3DCS(float xc, float yc, float zc, float xo, float yo, float zo, 75 float dax, float day, float dco, float psi) 76 { 77 sO = false; 78 xO = xo; yO = yo; zO = zo; 79 xC = xc; yC = yc; zC = zc; 80 double dx,dy,dz,dl; 81 // On calcule le vecteur OC Observateur -> Centre du champ, ca nous donne donc teta,phi de visee 82 dx = xc-xo; dy = yc-yo; dz = zc-zo; 83 if (dax < 0.) dax = -dax; 84 if (day < 0.) day = -day; 85 daxO = dax; dayO = day; 86 SetUCS(-dax, dax, -day, day, kAxeDirLtoR, kAxeDirDownUp); 87 lCO = sqrt(dx*dx+dy*dy+dz*dz); 88 if (lCO < 1.e-6) { 89 printf("PIGraphic3D::Set3DCS()/Warning : Length(CO) = %g -> CS par defaut \n", lCO); 90 int i,j; 91 for(i=0; i<3; i++) 92 for(j=0; j<3; j++) RE[i][j] = 0.; 93 RE[0][0] = RE[1][1] = RE[2][2] = 1.; 94 xO = yC = 0.; zO = -10.; 95 xC = yC = zC = 0.; 96 tO = fO = pO = 0.; 97 daxO = dayO = 0.25; 98 lCO = 10.; dlCO = 0.2; 99 return; 100 } 101 dlCO = dco; 102 double lxy = sqrt(dx*dx+dy*dy); 103 double ct,st,cf,sf; 104 ct = dz/lCO; 105 st = sqrt(1-ct*ct); 106 pO = psi; 107 tO = acos(ct); 108 if (lxy < 1.e-6) { fO = 0.; cf = 0.; } 109 else { cf = dx/lxy; fO = acos(cf); if (dy < 0.) fO = ddeuxpi-fO; } 110 // (Teta,Phi) = Direction de visee 111 // Les angles d'Euler correspondants sont Teta, Phi+Pi/2 112 cf = cos((double)fO+M_PI_2); 113 sf = sin((double)fO+M_PI_2); 114 double cp = cos((double)psi); 115 double sp = sin((double)psi); 116 RE[0][0] = cf*cp-sf*ct*sp; RE[0][1] = sf*cp+cf*ct*sp; RE[0][2] = st*sp; 117 RE[1][0] = -cf*sp-sf*ct*cp; RE[1][1] = -sf*sp+cf*ct*cp; RE[1][2] = st*cp; 118 RE[2][0] = sf*st; RE[2][1] = -cf*st; RE[2][2] = ct; 119 } 120 121 122 /* --Methode-- */ 123 bool PIGraphic3D::Get3DCS(float& xc, float& yc, float& zc, float& xo, float& yo, float& zo, 124 float& teta, float& phi, float& psi, float& dax, float& day, float& co, float& dco) 125 { 126 xc = xC; yc = yC; zc = zC; 127 xo = xO; yo = yO; zo = zO; 128 teta = tO; phi = fO; psi = pO; 129 dax = daxO; day = dayO; 130 co = lCO; dco = dlCO; 131 return(sO); 132 } 133 134 /* --Methode-- */ 135 void PIGraphic3D::PrintCS() 136 { 137 if (sO) printf("PIGraphic3D::PrintCS() : Set3DCS_Obs(...) \n"); 138 else printf("PIGraphic3D::PrintCS() : Set3DCS(...) \n"); 139 printf("C: %g %g %g ->O: %g %g %g - T,P= %g %g %g lCO= %g %g | %g %g - %g %g \n", 140 xC,yC,zC, xO, yO, zO, tO, fO, pO, lCO, dlCO, xOrg, xScale, yOrg, yScale ); 141 printf("RE[3][3]= %g %g %g | %g %g %g | %g %g %g\n", 142 RE[0][0], RE[0][1], RE[0][2], RE[1][0], RE[1][1], RE[1][2], RE[2][0], RE[2][1], RE[2][2]); 143 float x,y,z,xp,yp,zp, xpix, ypix; 144 x = xC, y = yC, z= zC; 145 C3DC2ObsCS(x, y, z, xp, yp, zp); 146 Proj3DC2GrC(x, y, z, xpix, ypix); 147 printf("C -> %g %g %g -> %g %g \n", xp, yp, zp, xpix, ypix); 148 x = xC+1, y = yC, z= zC; 149 C3DC2ObsCS(x, y, z, xp, yp, zp); 150 Proj3DC2GrC(x, y, z, xpix, ypix); 151 printf("C+(1,0,0) -> %g %g %g -> %g %g ", xp, yp, zp, xpix, ypix); 152 x = xC, y = yC+1, z= zC+1; 153 C3DC2ObsCS(x, y, z, xp, yp, zp); 154 Proj3DC2GrC(x, y, z, xpix, ypix); 155 printf("C+(0,1,1) -> %g %g %g -> %g %g \n", xp, yp, zp, xpix, ypix); 156 } 157 158 /* --Methode-- */ 159 void PIGraphic3D::RotateObserver(float teta, float phi, float psi, bool rel) 160 { 161 if (rel) { 162 teta = M_PI-tO-teta; 163 phi = M_PI+fO+phi; 164 psi = pO+psi; 165 } 166 if (teta < 0.) teta = 0.; 167 if (teta > M_PI) teta = M_PI; 168 float xo,yo,zo; 169 zo = cos((double)teta)*lCO+zC; 170 xo = sin((double)teta)*cos((double)phi)*lCO+xC; 171 yo = sin((double)teta)*sin((double)phi)*lCO+yC; 172 Set3DCS(xC,yC,zC, xo,yo,zo, daxO, dayO, dlCO, psi); 173 } 174 175 /* --Methode-- */ 176 void PIGraphic3D::ZoomInOut(float fco, float fdax, float fday, bool rel) 177 { 178 if (fco < 0.001) fco = 1.; 179 if (fdax < 0.001) fdax = 1.; 180 if (fday < 0.001) fday = 1.; 181 double dl; 182 if (rel) { 183 dl = fco*lCO; 184 fdax *= daxO; 185 fday *= dayO; 186 } 187 else dl = fco; 188 float xo,yo,zo; 189 if (dl < 1.e-5) dl = 1.e-5; 190 zo = zC-cos((double)tO)*dl; 191 xo = xC-sin((double)tO)*cos((double)fO)*dl; 192 yo = yC-sin((double)tO)*sin((double)fO)*dl; 193 Set3DCS(xC,yC,zC, xo,yo,zo, fdax, fday, dl, pO); 194 // Set3DCS_Obs(xo, yo, zo, tO, fO, pO, daxO*fda, dayO*fda, dl, dlCO); 195 } 196 197 /* --Methode-- */ 198 void PIGraphic3D::C3DC2ObsCS(float x, float y, float z, float& xp, float& yp, float& zp) 199 { 200 double xc, yc, zc; 201 xc = x-xO; yc = y-yO; zc = z-zO; 202 xp = RE[0][0]*xc+RE[0][1]*yc+RE[0][2]*zc; 203 yp = RE[1][0]*xc+RE[1][1]*yc+RE[1][2]*zc; 204 zp = RE[2][0]*xc+RE[2][1]*yc+RE[2][2]*zc; 205 } 206 207 /* --Methode-- */ 208 void PIGraphic3D::Proj3DC2GrC(float x, float y, float z, float& xpix, float& ypix) 209 { 210 double xc, yc, zc; 211 float xp, yp, zp; 212 xc = x-xO; yc = y-yO; zc = z-zO; 213 xp = RE[0][0]*xc+RE[0][1]*yc+RE[0][2]*zc; 214 yp = RE[1][0]*xc+RE[1][1]*yc+RE[1][2]*zc; 215 zp = RE[2][0]*xc+RE[2][1]*yc+RE[2][2]*zc; 216 if ((zp>-1.e-6) && (zp < 1.e-6)) // Protection Divide/0 217 { xpix = ypix = 0.; return; } 218 xpix = (float)(xOrg + (xp/zp)*xScale); 219 ypix = (float)(yOrg + (yp/zp)*yScale); 220 // 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); 221 // 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); 222 } 223 224 /* --Methode-- */ 225 void PIGraphic3D::DrawString3D(PIGrCoord x0, PIGrCoord y0, PIGrCoord z0, char* s) 226 { 227 if (!mGrC) return; 228 float xf, yf; 229 Proj3DC2GrC(x0, y0, z0, xf, yf); 230 mGrC->DrawString(xf, yf, s); 231 return; 232 } 233 234 /* --Methode-- */ 235 void PIGraphic3D::DrawOpaqueString3D(PIGrCoord x0, PIGrCoord y0, PIGrCoord z0, char* s) 236 { 237 if (!mGrC) return; 238 float xf, yf; 239 Proj3DC2GrC(x0, y0, z0, xf, yf); 240 mGrC->DrawOpaqueString(xf, yf, s); 241 return; 242 } 243 244 /* --Methode-- */ 245 void PIGraphic3D::DrawLine3D(PIGrCoord x1, PIGrCoord y1, PIGrCoord z1, 246 PIGrCoord x2, PIGrCoord y2, PIGrCoord z2) 247 { 248 if (!mGrC) return; 249 float xf1, yf1, xf2, yf2; 250 Proj3DC2GrC(x1, y1, z1, xf1, yf1); 251 Proj3DC2GrC(x2, y2, z2, xf2, yf2); 252 // printf("-DBG-DrawLine3D() : %g %g %g -> %g %g | %g %g %g -> %g %g\n", 253 // (float)x1, (float)y1, (float)z1, xf1, yf1, 254 // (float)x2, (float)y2, (float)z2, xf2, yf2 ); 255 mGrC->DrawLine(xf1, yf1, xf2, yf2); 256 } 257 258 #define NMXMULTP 30 // Pour multipoint sans new 259 260 /* --Methode-- */ 261 void PIGraphic3D::DrawPolygon3D(PIGrCoord *x, PIGrCoord *y, PIGrCoord *z, int n) 262 { 263 PIGrCoord xc[NMXMULTP], yc[NMXMULTP]; 264 PIGrCoord *pxc, *pyc; 265 int i; 266 float xf, yf; 267 268 if (!mGrC) return; 269 if (n <= 0) return; 270 271 if (n > NMXMULTP) { pxc = new PIGrCoord[n]; pyc = new PIGrCoord[n]; } 272 else { pxc = xc; pyc = yc; } 273 for(i=0; i<n; i++) { 274 Proj3DC2GrC(x[i], y[i], z[i], xf, yf); 275 pxc[i] = xf; pyc[i] = yf; 276 } 277 mGrC->DrawPolygon(pxc, pyc, n, false); 278 if (n > NMXMULTP) { delete[] pxc; delete[] pyc; } 279 return; 280 } 281 282 283 /* --Methode-- */ 284 void PIGraphic3D::DrawFPolygon3D(PIGrCoord *x, PIGrCoord *y, PIGrCoord *z, int n) 285 { 286 PIGrCoord xc[NMXMULTP], yc[NMXMULTP]; 287 PIGrCoord *pxc, *pyc; 288 int i; 289 float xf, yf; 290 291 if (!mGrC) return; 292 if (n <= 0) return; 293 294 if (n > NMXMULTP) { pxc = new PIGrCoord[n]; pyc = new PIGrCoord[n]; } 295 else { pxc = xc; pyc = yc; } 296 for(i=0; i<n; i++) { 297 Proj3DC2GrC(x[i], y[i], z[i], xf, yf); 298 pxc[i] = xf; pyc[i] = yf; 299 } 300 mGrC->DrawFPolygon(pxc, pyc, n, false); 301 if (n > NMXMULTP) { delete[] pxc; delete[] pyc; } 302 return; 303 } 304 305 /* --Methode-- */ 306 void PIGraphic3D::DrawMarker3D(PIGrCoord x0, PIGrCoord y0, PIGrCoord z0) 307 { 308 if (!mGrC) return; 309 float xf, yf; 310 Proj3DC2GrC(x0, y0, z0, xf, yf); 311 mGrC->DrawMarker(xf, yf); 312 return; 313 } 314 315 /* --Methode-- */ 316 void PIGraphic3D::DrawMarkers3D(PIGrCoord *x, PIGrCoord *y, PIGrCoord *z, int n) 317 { 318 PIGrCoord xc[NMXMULTP], yc[NMXMULTP]; 319 PIGrCoord *pxc, *pyc; 320 int i; 321 float xf, yf; 322 323 if (!mGrC) return; 324 if (n <= 0) return; 325 326 if (n > NMXMULTP) { pxc = new PIGrCoord[n]; pyc = new PIGrCoord[n]; } 327 else { pxc = xc; pyc = yc; } 328 for(i=0; i<n; i++) { 329 Proj3DC2GrC(x[i], y[i], z[i], xf, yf); 330 pxc[i] = xf; pyc[i] = yf; 331 } 332 mGrC->DrawMarkers(pxc, pyc, n); 333 if (n > NMXMULTP) { delete[] pxc; delete[] pyc; } 334 return; 335 } -
trunk/SophyaPI/PI/pigraph3d.h
r111 r113 1 // Module PI : Peida Interactive PIGraphic3D 2 // Trace graphiques 3D R. Ansari 06/98 3 // LAL (Orsay) / IN2P3-CNRS DAPNIA/SPP (Saclay) / CEA 4 1 5 #ifndef PIGRAPHIC3D_H_SEEN 2 6 #define PIGRAPHIC3D_H_SEEN … … 6 10 7 11 8 class PIGraphic3D : PIGraphicUC12 class PIGraphic3D : public PIGraphicUC 9 13 { 14 public: 10 15 PIGraphic3D(PIGraphicGen* g, PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy); 11 16 virtual ~PIGraphic3D(); 12 17 18 virtual int kind(); 19 20 // Definition du systeme de projection 3D-2D 21 virtual void Set3DCS_Obs(float xo, float yo, float zo, float teta, float phi, float psi, 22 float dax, float day, float co, float dco=0.2); 23 virtual void Set3DCS(float xc, float yc, float zc, float xo, float yo, float zo, 24 float dax, float day, float dco=0.2, float psi=0.); 25 virtual bool Get3DCS(float& xc, float& yc, float& zc, float& xo, float& yo, float& zo, 26 float& teta, float& phi, float& psi, float& dax, float& day, float& co, float& dco); 27 28 virtual void PrintCS(); // Pour debugger 29 virtual void RotateObserver(float teta, float phi, float psi=0., bool rel=true); 30 virtual void ZoomInOut(float fco, float fdax, float fday, bool rel=true); 31 32 virtual void C3DC2ObsCS(float x, float y, float z, float& xp, float& yp, float& zp); 33 virtual void Proj3DC2GrC(float x, float y, float z, float& xpix, float& ypix); 34 35 virtual void DrawString3D(PIGrCoord x0, PIGrCoord y0, PIGrCoord z0, char* s); 36 virtual void DrawOpaqueString3D(PIGrCoord x0, PIGrCoord y0, PIGrCoord z0, char* s); 37 virtual void DrawLine3D(PIGrCoord x1, PIGrCoord y1, PIGrCoord z1, 38 PIGrCoord x2, PIGrCoord y2, PIGrCoord z2); 39 virtual void DrawPolygon3D(PIGrCoord *x, PIGrCoord *y, PIGrCoord *z, int n); 40 virtual void DrawFPolygon3D(PIGrCoord *x, PIGrCoord *y, PIGrCoord *z, int n); 41 virtual void DrawMarker3D(PIGrCoord x0, PIGrCoord y0, PIGrCoord z0); 42 virtual void DrawMarkers3D(PIGrCoord *x, PIGrCoord *y, PIGrCoord *z, int n); 43 44 protected: 45 double xO, yO, zO; // Position observateur = camera 46 double xC, yC, zC; // Position centre du champ 47 double tO,fO,pO; // Orientation observateur (Teta, Phi, Psi, Angles d Euler) 48 double daxO, dayO; // Demi-ouverture de la camera suivant les deux axes de projection (xp/zp, yp/zp) 49 double lCO, dlCO; // Distance Camera-Centre du champ et profondeur de champ 50 double RE[3][3]; // Matrice de rotation 51 bool sO; // Vrai si fait par Set3DCS_Obs() 13 52 }; 14 53 -
trunk/SophyaPI/PI/pigraphgen.cc
r71 r113 1 // Module PI : Peida Interactive PIGraphic 2 // Primitives de trace graphiques R. Ansari 97 3 // LAL (Orsay) / IN2P3-CNRS DAPNIA/SPP (Saclay) / CEA 4 1 5 // Classe generique de trace graphique de base (Ne peut etre instancie) 2 6 -
trunk/SophyaPI/PI/pigraphgen.h
r98 r113 1 // Module PI : Peida Interactive PIGraphic 2 // Primitives de trace graphiques R. Ansari 97 3 // LAL (Orsay) / IN2P3-CNRS DAPNIA/SPP (Saclay) / CEA 4 1 5 #ifndef PIGRAPHICGEN_H_SEEN 2 6 #define PIGRAPHICGEN_H_SEEN … … 52 56 53 57 enum PIGraphicsType { PI_ScrWindowGraphics = 0, PI_PSFileGraphics = 1, 54 PI_UCGraphics = 2, PI_ UC3DGraphics = 3 };58 PI_UCGraphics = 2, PI_3DGraphics = 3 }; 55 59 56 60 // Classe generique de trace graphique de base : … … 77 81 virtual void DrawCircle(PIGrCoord x0, PIGrCoord y0, PIGrCoord r) = 0; 78 82 virtual void DrawFCircle(PIGrCoord x0, PIGrCoord y0, PIGrCoord r) = 0; 79 virtual void DrawPolygon(PIGrCoord *x, PIGrCoord *y, int n )= 0;80 virtual void DrawFPolygon(PIGrCoord *x, PIGrCoord *y, int n )= 0;83 virtual void DrawPolygon(PIGrCoord *x, PIGrCoord *y, int n, bool cinc=true) = 0; 84 virtual void DrawFPolygon(PIGrCoord *x, PIGrCoord *y, int n, bool cinc=true) = 0; 81 85 virtual void DrawMarker(PIGrCoord x0, PIGrCoord y0) = 0; 82 86 virtual void DrawMarkers(PIGrCoord *x, PIGrCoord *y, int n) = 0; -
trunk/SophyaPI/PI/pigraphps.cc
r71 r113 127 127 128 128 /* --Methode-- */ 129 void PIGraphicPS::DrawPolygon(PIGrCoord *x, PIGrCoord *y, int n )129 void PIGraphicPS::DrawPolygon(PIGrCoord *x, PIGrCoord *y, int n, bool cinc) 130 130 { 131 131 int i; … … 137 137 xtmp = new float[n]; 138 138 ytmp = new float[n]; 139 for(i=0;i<n;i++){ 140 xtmp[i] = (float)x[i]; 141 ytmp[i] = (float)y[i]; 139 140 float xoff,yoff; 141 if (cinc) { xoff=yoff=0.; } // Coord en mode incremental 142 else { xoff = (float)x[0]; yoff = (float)y[0]; } // Coord en mode absolu 143 for(i=0;i<n;i++) { 144 xtmp[i] = (float)x[i]-xoff; 145 ytmp[i] = (float)y[i]-yoff; 142 146 } 143 147 mPSOut->DrawPolygon(xtmp,ytmp,n,mFCol,mLAtt); … … 150 154 151 155 /* --Methode-- */ 152 void PIGraphicPS::DrawFPolygon(PIGrCoord *x, PIGrCoord *y, int n )156 void PIGraphicPS::DrawFPolygon(PIGrCoord *x, PIGrCoord *y, int n, bool cinc) 153 157 { 154 158 int i; … … 160 164 xtmp = new float[n]; 161 165 ytmp = new float[n]; 162 for(i=0;i<n;i++){ 163 xtmp[i] = (float)x[i]; 164 ytmp[i] = (float)y[i]; 166 167 float xoff,yoff; 168 if (cinc) { xoff=yoff=0.; } // Coord en mode incremental 169 else { xoff = (float)x[0]; yoff = (float)y[0]; } // Coord en mode absolu 170 for(i=0;i<n;i++) { 171 xtmp[i] = (float)x[i]-xoff; 172 ytmp[i] = (float)y[i]-yoff; 165 173 } 166 174 mPSOut->DrawFPolygon(xtmp,ytmp,n,mFCol,mFCol,mLAtt); -
trunk/SophyaPI/PI/pigraphps.h
r71 r113 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 DrawPolygon(PIGrCoord *x, PIGrCoord *y, int n );30 virtual void DrawFPolygon(PIGrCoord *x, PIGrCoord *y, int n );29 virtual void DrawPolygon(PIGrCoord *x, PIGrCoord *y, int n, bool cinc=true); 30 virtual void DrawFPolygon(PIGrCoord *x, PIGrCoord *y, int n, bool cinc=true); 31 31 virtual void DrawMarker(PIGrCoord x0, PIGrCoord y0); 32 32 virtual void DrawMarkers(PIGrCoord *x, PIGrCoord *y, int n); -
trunk/SophyaPI/PI/pigraphuc.cc
r111 r113 1 // Module PI : Peida Interactive PIGraphicUC 2 // Trace graphiques User-Coordinates R. Ansari 97 3 // LAL (Orsay) / IN2P3-CNRS DAPNIA/SPP (Saclay) / CEA 4 1 5 #include "pigraphuc.h" 2 3 6 4 7 … … 30 33 { 31 34 return PI_UCGraphics; 35 } 36 37 /* --Methode-- */ 38 void PIGraphicUC::SetBaseGraphic(PIGraphicGen* g, PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy) 39 { 40 mGrC = g; 41 xW0 = x0; yW0 = y0; 42 xWd = dx; yWd = dy; 43 SetUCS(xMin, xMax, yMin, yMax, kAxeDirSame, kAxeDirSame); 32 44 } 33 45 … … 89 101 void PIGraphicUC::UC2GrC(float x, float y, float& xpix, float& ypix) 90 102 { 91 xpix = (float)(xOrg + x*xScale + .5);92 ypix = (float)(yOrg + y*yScale 103 xpix = (float)(xOrg + x*xScale); // $CHECK$ Reza 21/06/98 ? + .5); 104 ypix = (float)(yOrg + y*yScale); // $CHECK$ Reza 21/06/98 ?+ .5); 93 105 } 94 106 … … 327 339 328 340 /* --Methode-- */ 329 void PIGraphicUC::DrawPolygon(PIGrCoord *x, PIGrCoord *y, int n )341 void PIGraphicUC::DrawPolygon(PIGrCoord *x, PIGrCoord *y, int n, bool cinc) 330 342 { 331 343 PIGrCoord xc[NMXMULTP], yc[NMXMULTP]; … … 343 355 pxc[i] = xf; pyc[i] = yf; 344 356 } 345 mGrC->DrawPolygon(pxc, pyc, n );357 mGrC->DrawPolygon(pxc, pyc, n, cinc); 346 358 if (n > NMXMULTP) { delete[] pxc; delete[] pyc; } 347 359 return; … … 349 361 350 362 /* --Methode-- */ 351 void PIGraphicUC::DrawFPolygon(PIGrCoord *x, PIGrCoord *y, int n )363 void PIGraphicUC::DrawFPolygon(PIGrCoord *x, PIGrCoord *y, int n, bool cinc) 352 364 { 353 365 PIGrCoord xc[NMXMULTP], yc[NMXMULTP]; … … 365 377 pxc[i] = xf; pyc[i] = yf; 366 378 } 367 mGrC->DrawFPolygon(pxc, pyc, n );379 mGrC->DrawFPolygon(pxc, pyc, n, cinc); 368 380 if (n > NMXMULTP) { delete[] pxc; delete[] pyc; } 369 381 return; -
trunk/SophyaPI/PI/pigraphuc.h
r111 r113 1 // Module PI : Peida Interactive PIGraphicUC 2 // Trace graphiques User-Coordinates R. Ansari 97 3 // LAL (Orsay) / IN2P3-CNRS DAPNIA/SPP (Saclay) / CEA 4 1 5 #ifndef PIGRAPHICUC_H_SEEN 2 6 #define PIGRAPHICUC_H_SEEN … … 22 26 virtual int kind(); 23 27 28 virtual void SetBaseGraphic(PIGraphicGen* g, PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy); 29 24 30 // Espace des coordonnees 25 31 virtual void GetGrSpace(PIGrCoord& xmin, PIGrCoord& xmax, PIGrCoord& ymin, PIGrCoord& ymax); … … 38 44 virtual void DrawCircle(PIGrCoord x0, PIGrCoord y0, PIGrCoord r); 39 45 virtual void DrawFCircle(PIGrCoord x0, PIGrCoord y0, PIGrCoord r); 40 virtual void DrawPolygon(PIGrCoord *x, PIGrCoord *y, int n );41 virtual void DrawFPolygon(PIGrCoord *x, PIGrCoord *y, int n );46 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); 42 48 virtual void DrawMarker(PIGrCoord x0, PIGrCoord y0); 43 49 virtual void DrawMarkers(PIGrCoord *x, PIGrCoord *y, int n); -
trunk/SophyaPI/PI/pigraphx.cc
r79 r113 1 // Module PI : Peida Interactive PIGraphicX 2 // Trace graphiques- Implementation X11 R. Ansari 97 3 // LAL (Orsay) / IN2P3-CNRS DAPNIA/SPP (Saclay) / CEA 4 1 5 #include <stdio.h> 2 6 … … 125 129 126 130 /* --Methode-- */ 127 void PIGraphicX::DrawPolygon(PIGrCoord *x, PIGrCoord *y, int n )131 void PIGraphicX::DrawPolygon(PIGrCoord *x, PIGrCoord *y, int n, bool cinc) 128 132 { 129 133 XPoint multipoint[NMXXPOINTS]; … … 135 139 else pxp = multipoint; 136 140 for(i=0; i<n; i++) { pxp[i].x = x[i]; pxp[i].y = y[i]; } 137 XDrawLines(XtDisplay(MyWdg()), XtWindow(MyWdg()), DefGC(), pxp, n, CoordModePrevious); 141 int mode = CoordModeOrigin; 142 if (cinc) mode = CoordModePrevious; 143 XDrawLines(XtDisplay(MyWdg()), XtWindow(MyWdg()), DefGC(), pxp, n, mode); 138 144 if (n > NMXXPOINTS) delete[] pxp; 139 145 … … 143 149 144 150 /* --Methode-- */ 145 void PIGraphicX::DrawFPolygon(PIGrCoord *x, PIGrCoord *y, int n )151 void PIGraphicX::DrawFPolygon(PIGrCoord *x, PIGrCoord *y, int n, bool cinc) 146 152 { 147 153 XPoint multipoint[NMXXPOINTS]; … … 153 159 else pxp = multipoint; 154 160 for(i=0; i<n; i++) { pxp[i].x = x[i]; pxp[i].y = y[i]; } 161 int mode = CoordModeOrigin; 162 if (cinc) mode = CoordModePrevious; 155 163 XFillPolygon(XtDisplay (MyWdg()), XtWindow(MyWdg()), DefGC(), pxp, n, 156 Complex, CoordModePrevious);164 Complex, mode); 157 165 if (n > NMXXPOINTS) delete[] pxp; 158 166 -
trunk/SophyaPI/PI/pigraphx.h
r90 r113 1 // Module PI : Peida Interactive PIGraphicX 2 // Trace graphiques- Implementation X11 R. Ansari 97 3 // LAL (Orsay) / IN2P3-CNRS DAPNIA/SPP (Saclay) / CEA 4 1 5 #ifndef PIGRAPHICX_H_SEEN 2 6 #define PIGRAPHICX_H_SEEN … … 20 24 virtual void DrawCircle(PIGrCoord x0, PIGrCoord y0, PIGrCoord r); 21 25 virtual void DrawFCircle(PIGrCoord x0, PIGrCoord y0, PIGrCoord r); 22 virtual void DrawPolygon(PIGrCoord *x, PIGrCoord *y, int n );23 virtual void DrawFPolygon(PIGrCoord *x, PIGrCoord *y, int n );26 virtual void DrawPolygon(PIGrCoord *x, PIGrCoord *y, int n, bool cinc=true); 27 virtual void DrawFPolygon(PIGrCoord *x, PIGrCoord *y, int n, bool cinc=true); 24 28 virtual void DrawMarker(PIGrCoord x0, PIGrCoord y0); 25 29 virtual void DrawMarkers(PIGrCoord *x, PIGrCoord *y, int n); -
trunk/SophyaPI/PI/piimage.cc
r112 r113 1 // Module PI : Peida Interactive PIImage 1 2 // Affichage d'image R. Ansari 05/95 2 3 // LAL (Orsay) / IN2P3-CNRS DAPNIA/SPP (Saclay) / CEA … … 740 741 if (winovis) return; // $CHECK$ Reza A enlever si possible 17/6/96 741 742 742 g->SelGOMode(PI_GOXOR); 743 if (GetColMapId() == CMAP_COLRJ32) 744 g->SelForeground(PI_Yellow); 745 else g->SelForeground(PI_Magenta); 743 g->SelGOMode(PI_GOCopy); 744 if ( (GetColMapId() == CMAP_GREY32) || (GetColMapId() == CMAP_GREYINV32) ) g->SelForeground(PI_Red); 745 else g->SelForeground(PI_White); 746 746 747 747 if (zoom < 3) g->SelLine(PI_NormalLine); … … 749 749 750 750 if ((xcurs>=0) && (ycurs>=0)) { 751 // PIPixmap::Draw(g, xcurs-CURSHSIZE, ycurs-CURSHSIZE, CURSHSIZE*2, CURSHSIZE*2); 752 g->DrawLine(xcurs-CURSHSIZE, ycurs, xcurs-4, ycurs); 753 g->DrawLine(xcurs+4, ycurs, xcurs+CURSHSIZE, ycurs); 754 g->DrawLine(xcurs, ycurs-CURSHSIZE, xcurs, ycurs-4); 755 g->DrawLine(xcurs, ycurs+4, xcurs, ycurs+CURSHSIZE); 751 PIPixmap::Draw(g, xcurs-3, ycurs-CURSHSIZE, 6, CURSHSIZE*2); 752 PIPixmap::Draw(g, xcurs-CURSHSIZE, ycurs-3, CURSHSIZE*2, 6); 756 753 } 757 754 if ((xc >= 0) && (yc >= 0)) -
trunk/SophyaPI/PI/piimage.h
r111 r113 1 // This may look like C code, but it is really -*- C++ -*-2 // Affichage d 'image R. Ansari 05/951 // Module PI : Peida Interactive PIImage 2 // Affichage d image R. Ansari 05/95 3 3 // LAL (Orsay) / IN2P3-CNRS DAPNIA/SPP (Saclay) / CEA 4 4 -
trunk/SophyaPI/PI/pilistgen.cc
r30 r113 1 // Module PI : Peida Interactive PIList 2 // Liste 96-97 3 // LAL (Orsay) / IN2P3-CNRS DAPNIA/SPP (Saclay) / CEA 4 1 5 #include "pilistgen.h" 2 6 7 //++ 8 // Class PIList 9 // Lib PI 10 // include pilistgen.h 11 // 12 // Composant graphique de type liste, permettant d'afficher une liste 13 // d'éléments, qui peuvent être sélectionnés à l'aide du pointeur (souris). 14 // "PIListGen" définit l'interface (classe virtuelle pure). Les objets 15 // instanciés doivent être de la classe "PIList" déclarée dans le fichier 16 // entête "PILIST_H". Lors de la sélection d'un des éléments, 17 // le message correspondant complété par "PIMsg_Select" est envoyé. 18 // Le modifier "PIMsg_ClearSel" est appliqué lorsque d'une dé-sélection. 19 //-- 20 //++ 21 // Links Parents 22 // PIWdg 23 //-- 24 25 //++ 26 // Titre Constructeur 27 //-- 28 //++ 29 // PIListGen(PIContainerGen* par, char* nom, int sx=100, int sy=100, int px=0, int py=0) 30 // Création d'un objet liste (PIList). 31 //-- 32 33 //++ 34 // Titre Ajout et suppression d'éléments 35 //-- 36 //++ 37 // void AppendItem(char* nom, PIMessage msg) 38 // Ajoute un élément à la liste. 39 // void DeleteItem(const char *item) 40 // Supprime l'élément "item" de la liste. 41 // void DeleteItemMsg(PIMessage msg) 42 // Supprime l'élément identifié par le message "msg" de la liste. 43 //-- 44 //++ 45 // Titre Gestion des sélections 46 //-- 47 //++ 48 // void SetMultipleSelect(bool ms=false) 49 // Active ("ms=true") ou désactive la possibilité de sélection multiple. 50 // int GetNbSelection() 51 // Renvoie le nombre d'éléments sélectionnés. 52 // PIMessage GetSelection(int num=0) 53 // Renvoie le message correspondant à la sélection numéro "n". L'ordre 54 // dans lequel les sélections sont retournées est indéfini. 55 // string GetSelectionStr(int num=0) 56 // Renvoie la chaîne de caractères correspondant à l'élément sélectionné 57 // numéro "n". 58 // void SelectItem(const char* item) 59 // Permet de sélectionner l'élément "item". 60 // void SelectItemMsg(PIMessage msg) 61 // Permet de sélectionner l'élément identifié par le message "msg". 62 // void ClearSelItem(const char* item) 63 // Efface la sélection pour l'élément "item". 64 // void ClearSelItemMsg(PIMessage msg) 65 // Efface la sélection pour l'élément identifié par le message "msg". 66 //-- 3 67 4 68 PIListGen::PIListGen(PIContainerGen *par, char *nom, -
trunk/SophyaPI/PI/pilistgen.h
r54 r113 16 16 virtual void AppendItem(const char * item, PIMessage msg)=0; 17 17 virtual void DeleteItem(const char *item)=0; 18 virtual void DeleteItem (PIMessage msg)=0;18 virtual void DeleteItemMsg(PIMessage msg)=0; 19 19 20 20 virtual void SetMultipleSelect(bool ms=false)=0; … … 25 25 26 26 virtual void SelectItem(const char * item)=0; 27 virtual void SelectItem (PIMessage msg)=0;27 virtual void SelectItemMsg(PIMessage msg)=0; 28 28 virtual void ClearSelItem(const char * item)=0; 29 virtual void ClearSelItem (PIMessage msg)=0;29 virtual void ClearSelItemMsg(PIMessage msg)=0; 30 30 31 31 virtual long kind() {return ClassId; } -
trunk/SophyaPI/PI/pilistx.cc
r98 r113 123 123 124 124 /* --Methode-- */ 125 void PIListX::DeleteItem (PIMessage msg)125 void PIListX::DeleteItemMsg(PIMessage msg) 126 126 { 127 127 int n; … … 179 179 180 180 /* --Methode-- */ 181 void PIListX::SelectItem (PIMessage msg)181 void PIListX::SelectItemMsg(PIMessage msg) 182 182 { 183 183 int n; … … 200 200 201 201 /* --Methode-- */ 202 void PIListX::ClearSelItem (PIMessage msg)202 void PIListX::ClearSelItemMsg(PIMessage msg) 203 203 { 204 204 int n; -
trunk/SophyaPI/PI/pilistx.h
r54 r113 12 12 virtual void AppendItem(const char * item, PIMessage msg); 13 13 virtual void DeleteItem(const char *item); 14 virtual void DeleteItem (PIMessage msg);14 virtual void DeleteItemMsg(PIMessage msg); 15 15 16 16 virtual void SetMultipleSelect(bool ms=false); … … 21 21 22 22 virtual void SelectItem(const char * item); 23 virtual void SelectItem (PIMessage msg);23 virtual void SelectItemMsg(PIMessage msg); 24 24 virtual void ClearSelItem(const char * item); 25 virtual void ClearSelItem (PIMessage msg);25 virtual void ClearSelItemMsg(PIMessage msg); 26 26 27 27 // Mis en public pour Callback Xt -
trunk/SophyaPI/PI/pimenubargen.cc
r2 r113 1 // Module PI : Peida Interactive PIMenubar 2 // Barre de menu 96-97 3 // LAL (Orsay) / IN2P3-CNRS DAPNIA/SPP (Saclay) / CEA 4 1 5 #include "pimenubargen.h" 2 6 3 7 #include PIAPP_H 8 9 //++ 10 // Class PIMenubar 11 // Lib PI 12 // include pimenubargen.h 13 // 14 // Composant graphique de type Barre des menus . 15 // "PIMenubarGen" définit l'interface (classe virtuelle pure). Les objets 16 // instanciés doivent être de la classe "PIMenubar" déclarée dans le fichier 17 // entête "PIMENUBAR_H". 18 //-- 19 //++ 20 // Links Parents 21 // PIWdg 22 //-- 23 //++ 24 // Links Voir aussi 25 // PIMenu 26 //-- 27 28 //++ 29 // Titre Constructeur, méthodes 30 //-- 31 //++ 32 // PIMenubar(PIApplicationGen* par, char* nom) 33 // Création d'un objet Menubar. 34 // void AppendMenu(PIMenu* pdm) 35 // Rajoute un menu à la barre de menu. Le menu sera affiché avec un titre identique à son nom. 36 // void RemoveMenu(PIMenu* pdm) 37 // Supprime le menu "pdm" de la barre de menu, sans le détruire (delete). 38 // void SetSensitivity(PIMenu* pdm, bool sens=true) 39 // Permet de rendre sensible ("sens=true") ou insensible un menu. Le titre d'un menu 40 // insensible est affiché, mais ne peut être séléctionné. 41 // bool IsSensitive(PIMenu* pdm) 42 // Indique si le menu "pdm" est sensible ou pas. 43 //-- 4 44 5 45 PIMenubarGen::PIMenubarGen(PIApplicationGen* par, char* nom) -
trunk/SophyaPI/PI/pimenugen.cc
r110 r113 1 // Module PI : Peida Interactive PIMenu 2 // Menu 96-97 3 // LAL (Orsay) / IN2P3-CNRS DAPNIA/SPP (Saclay) / CEA 4 1 5 #include "pimenugen.h" 6 7 //++ 8 // Class PIMenu 9 // Lib PI 10 // include pimenugen.h 11 // 12 // Composant graphique de type menu. 13 // "PIMenuGen" définit l'interface (classe virtuelle pure). Les objets 14 // instanciés doivent être de la classe "PIMenu" déclarée dans le fichier 15 // entête "PIMENUBAR_H". Lors de la séléction d'une des options du menu 16 // Le message correspondant complété par "PIMsg_Click" est envoyé à l'objet 17 // par "SendSelf()". 18 //-- 19 //++ 20 // Links Parents 21 // PIWdg 22 //-- 23 //++ 24 // Links Voir aussi 25 // PIMenubar 26 //-- 27 28 29 30 //++ 31 // Titre Constructeur 32 //-- 33 //++ 34 // PIMenu(PIWdg* par, char* nom, PIMenuType pdpu=k_UTMenu) 35 // Création d'un objet Menubar. "pdpu" peut prendre les valeurs 36 // "k_UTMenu", "k_PopupMenu", "k_PulldownMenu". Un menu de type 37 // "PulldownMenu" est destiné à être accroché à un Menubar ou 38 // comme sous-menu d'un autre menu. Si l'objet parent est de type 39 // "PIMenu" ou "PIMenubar", un PulldownMenu est créé par défaut. Un 40 // menu de type PopupMenu est créé dans les autres cas. 41 // PIMenuType MType() 42 // Renvoie le type du menu : "k_PopupMenu" ou "k_PulldownMenu". 43 //-- 44 45 //++ 46 // Titre Ajout et suppression des options du menu 47 //-- 48 // 49 //++ 50 // void AppendItem(char* nom, PIMessage msg, char* sc=NULL) 51 // Permet d'ajouter une option au menu. Un raccourci clavier peut être spécifié 52 // par "sc". 53 // void AppendCheckItem(char* nom, PIMessage msg, char* sc=NULL) 54 // Permet d'ajouter une option avec état ON/OFF au menu. 55 // void AppendPDMenu(PIMenu* pdm, char* sc=NULL) 56 // Ajoute un menu déroulant comme sous-menu. 57 // void DeleteItem(char* nom) 58 // Permet de supprimer une option du menu identifiée par le titre ("nom"). 59 // Si le nom désigne un menu déroulant, celui-ci n'est pas détruit (par "delete"). 60 // void DeleteItemMsg(PIMessage msg) 61 // Permet de supprimer une option du menu identifiée par le message ("msg"). 62 // void DeleteItemNum(int n) 63 // Suppression de l'option numéro "n". 64 //-- 65 //++ 66 // Titre Gestion des options 67 //-- 68 //++ 69 // void SetSensitivity(char* nom, bool sens=true) 70 // Rend sensible ("sens=true") ou insensible l'option du menu identifiée par "nom". 71 // Une option insensible est affichée, mais ne peut être sélectionnée. 72 // void SetSensitivityMsg(PIMessage msg, bool sens=true) 73 // Rend sensible ("sens=true") ou insensible l'option du menu identifiée par le message "msg". 74 // void SetSensitivityNum(int n, bool sens=true) 75 // Rend sensible ("sens=true") ou insensible l'option numéro "n". 76 // bool IsSensitive(char* nom) 77 // Indique si l'option "nom" est sensible ou pas. 78 // bool IsSensitiveMsg(PIMessage msg) 79 // Indique si l'option identifiée par le message "msg" est sensible ou pas. 80 // bool IsSensitiveNum(int n) 81 // Indique si l'option numéro "n" est sensible ou pas. 82 //-- 83 //++ 84 // Titre Options à état (CheckItem) 85 // Le champ "data" de "Send()/SendSelf()" contient un pointeur sur une variable 86 // de type bool, indiquant l'état (On/Off) de l'option, lors de la séléction des 87 // options à état ("CheckItem"). Les méthodes suivantes ne s'appliquent qu'aux 88 // options de type CheckItem. 89 //-- 90 //++ 91 // void SetState(char* nom, bool st=false) 92 // Change l'état de l'option "nom". 93 // void SetStateMsg(PIMessage msg, bool st=false) 94 // Change l'état de l'option identifiée par le message "msg". 95 // void SetStateNum(int n, bool st=false) 96 // Change l'état de l'option numéro "n". 97 // bool GetState(char* nom) 98 // Renvoie l'état de l'option "nom". 99 // bool GetStateMsg(PIMessage msg) 100 // Renvoie l'état de l'option identifiée par le message "msg". 101 // bool GetStateNum(int n) 102 // Renvoie l'état de l'option numéro "n". 103 //-- 104 105 //++ 106 // Titre Affichage des PopupMenu 107 //-- 108 //++ 109 // void Show() 110 // Affiche le menu (de type "k_PopupMenu" uniquement) à la position courante du pointeur. 111 // void Show(PIWdg* w, int px, int py) 112 // Affiche le menu (de type "k_PopupMenu" uniquement) à la position "px,py" de l'objet "w". 113 //-- 2 114 3 115 PIMenuGen::PIMenuGen(PIWdg* par, char* nom, PIMenuType pdpu) -
trunk/SophyaPI/PI/piscdrawwdg.cc
r111 r113 52 52 PIScDrawWdg::AddScDrawer(PIDrawer* d, bool ad) 53 53 { 54 if (d == NULL) return(-1); 55 if (! LimitsFixed() ) { // On met a jour les limites 56 d->UpdateSize(); 57 SetLimits(d->XMin(), d->XMax(), d->YMin(), d->YMax()); 58 } 54 59 return(AddDrawer(d, true, ad)); 55 60 } … … 77 82 } 78 83 84 85 /* 79 86 void 80 87 PIScDrawWdg::Draw(PIGraphic* g) … … 104 111 } 105 112 } 106 113 */ 107 114 108 115 // Gestion affichage coordonnees du point -
trunk/SophyaPI/PI/piscdrawwdg.h
r111 r113 18 18 19 19 PIScDrawWdg(PIContainerGen *par, char *nom, 20 int sx=10 , int sy=10, int px=0, int py=0);20 int sx=100, int sy=100, int px=0, int py=0); 21 21 virtual ~PIScDrawWdg(); 22 22 23 23 virtual long kind() {return ClassId; } 24 24 25 virtual void Draw(PIGraphic* g);26 virtual void Draw(PIGraphic* g, int x0, int y0, int dx, int dy);25 // virtual void Draw(PIGraphic* g); 26 // virtual void Draw(PIGraphic* g, int x0, int y0, int dx, int dy); 27 27 28 28 void SetLimits(float xmin, float xmax, float ymin, float ymax, -
trunk/SophyaPI/PI/pisysdep.h
r71 r113 44 44 #define PIPIXMAP_H "pipixmapx.h" 45 45 46 #define PIPERIODIC_H "piperiod icx.h"46 #define PIPERIODIC_H "piperiodx.h" 47 47 48 48 #endif
Note:
See TracChangeset
for help on using the changeset viewer.