Changeset 113 in Sophya


Ignore:
Timestamp:
Jul 2, 1998, 7:20:09 PM (27 years ago)
Author:
ansari
Message:

Trace 3D, Ajout PICMapViewer PISurfDrawer PINtuple3D Reza 02/07/98

Location:
trunk/SophyaPI/PI
Files:
6 added
34 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaPI/PI/Makefile

    r112 r113  
    44 
    55all: $(LIB)libPI.a
    6 $(LIB)libPI.a : $(OBJ)lut.o $(OBJ)pi3ddrw.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.o
     6$(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
    77        $(AR) $(ARFLAGS)  $@ $?
    88ifeq ($(CXX),cxx)
     
    1111endif
    1212 
     13clean:
     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
     15ifeq ($(CXX),cxx)
     16        cd $(REPM); rm -f *.o
     17endif
     18 
    1319$(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
    1831$(OBJ)piapplgen.o: piapplgen.cc piapplgen.h pimsghandler.h pisysdep.h \
    1932 picontainerx.h picontainergen.h piwdgx.h piwdggen.h pimenubarx.h \
     
    3851$(OBJ)picmap.o: picmap.cc picmap.h pisysdep.h picmapx.h picmapgen.h
    3952$(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
    4057$(OBJ)picmapx.o: picmapx.cc piwdgx.h piwdggen.h pimsghandler.h picmapx.h \
    4158 picmapgen.h pisysdep.h
     
    6380 pistdwdgx.h pistdwdggen.h pibwdgx.h pibwdggen.h picmap.h picmapx.h \
    6481 picmapgen.h pigraphx.h pigraphgen.h pigraphuc.h psfile.h \
    65  $(EROSDEVREP)/Include/defs.h pigraphps.h pioptmenux.h \
    66  pioptmenugen.h piscdrawwdg.h piwindowx.h piwindowgen.h pidrawer.h
     82 $(EROSDEVREP)/Include/defs.h pigraphps.h piscdrawwdg.h piwindowx.h \
     83 piwindowgen.h pidrawer.h
    6784$(OBJ)pifilechogen.o: pifilechogen.cc pifilechogen.h pisysdep.h piwdgx.h \
    6885 piwdggen.h pimsghandler.h
     
    115132 pistdwdgx.h pistdwdggen.h piwindowx.h piwindowgen.h picontainerx.h \
    116133 picontainergen.h
    117 $(OBJ)piimgtools.o: piimgtools.cc piimgtools.h pisysdep.h pimenux.h \
    118  pimenugen.h piwdgx.h piwdggen.h pimsghandler.h piapplx.h piapplgen.h \
    119  picontainerx.h picontainergen.h pimenubarx.h pimenubargen.h picons.h \
    120  pistdwdgx.h pistdwdggen.h pibwdgx.h pibwdggen.h picmap.h picmapx.h \
    121  picmapgen.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 \
    124141 $(EROSDEVREP)/Include/machine.h lut.h pidrawer.h pipixmapx.h \
    125  pipixmapgen.h piwindowx.h piwindowgen.h
     142 pipixmapgen.h
    126143$(OBJ)piinit.o: piinit.cc $(EROSDEVREP)/Include/defs.h piinit.h \
    127144 $(EROSDEVREP)/Include/strecinit.h \
     
    149166 pimenugen.h piwdgx.h piwdggen.h pimsghandler.h
    150167$(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
    151177$(OBJ)pintuple.o: pintuple.cc pintuple.h $(EROSDEVREP)/Include/ntuple.h \
    152178 $(EROSDEVREP)/Include/ppersist.h $(EROSDEVREP)/Include/defs.h \
     
    218244 piwdgx.h piwdggen.h pimsghandler.h picmap.h picmapx.h picmapgen.h \
    219245 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
    220251$(OBJ)piup.o: piup.cc $(EROSDEVREP)/Include/ctimer.h \
    221252 $(EROSDEVREP)/Include/peida.h $(EROSDEVREP)/Include/defs.h \
  • trunk/SophyaPI/PI/exapp_1.cc

    r39 r113  
    33#include <string.h>
    44
    5 #include "ctimer.h"
    6 #include "strecinit.h"
    7 
    8 #include "pidrawwin.h"
    9 #include "pihisto.h"
    10 #include "psfile.h"
    11 
    125#include "exapp_1.h"
    136
    14 static int nbhis = 0;
     7
     8/* ........................................................... */
     9/*                    Classe ArgsWindow 
     10/* ........................................................... */
     11
     12
     13/* --Methode-- */
     14ArgsWind::ArgsWind(PIApplication *par)
     15: PIWindow((PIMsgHandler *)par, "Args", PIWK_dialog, 100, 100, 150, 150)
     16{
     17int bsx, bsy;
     18
     19// On definit la taille a partir de la taille par defaut des composantes
     20PIApplicationPrefCompSize(bsx, bsy);
     21// On redefinit la taille de la fenetre
     22SetSize(bsx*7, bsy*6);
     23
     24// Creation de champs "labels"
     25mLab[0] = new PILabel(this, "UserArg-1:", bsx*2, bsy, bsx/3, bsy/4);
     26mLab[1] = new PILabel(this, "UserArg-2", bsx*2, bsy, bsx/3, bsy/4 + (bsy/4+bsy) );
     27mLab[2] = new PILabel(this, "UserArg-3", bsx*2, bsy, bsx/3, bsy/4 + 2*(bsy/4+bsy) );
     28
     29// Creation de champs textes
     30mText[0] = new PIText(this, "UsArg1", bsx*4, bsy, bsx*2+(bsx*2/3), bsy/4);
     31mText[0]->SetText("Hello ");
     32mText[1] = new PIText(this, "UsArg2", bsx*4, bsy, bsx*2+(bsx*2/3), bsy/4 + (bsy/4+bsy) );
     33mText[1]->SetText("1. -1.");
     34mText[2] = new PIText(this, "UsArg3", bsx*4, bsy, bsx*2+(bsx*2/3), bsy/4 + 2*(bsy/4+bsy) );
     35mText[2]->SetText("1. -1.");
     36
     37// Creation de bouton d'action
     38//  Attention : Numero de message pour Process()
     39mBut[0] = new PIButton(this, "OK",  555, bsx*2, bsy, bsx, 4.5*bsy);
     40mBut[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
     43for(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  }
     47for(int i=0; i<2; i++) mBut[i]->SetBinding(PIBK_elastic , PIBK_elastic , PIBK_elastic , PIBK_elastic);
     48
     49}
     50
     51/* --Methode-- */
     52ArgsWind::~ArgsWind()
     53{
     54for(int i=0; i<3; i++)
     55  {
     56  delete mLab[i];
     57  delete mText[i];
     58  }
     59
     60delete mBut[0];
     61delete mBut[1];
     62}
     63
     64/* --Methode-- */
     65void ArgsWind::SetLabels(char *lab1, char *lab2, char *lab3)
     66// Permet de changer les etiquettes (les label)
     67{
     68mLab[0]->SetLabel(lab1);
     69mLab[1]->SetLabel(lab2);
     70mLab[2]->SetLabel(lab3);
     71}
     72
     73/* --Methode-- */
     74void ArgsWind::SetTexts(char *tx1, char *tx2, char *tx3)
     75// Permet de changer les contenu des champs texte
     76{
     77mText[0]->SetText(tx1);
     78mText[1]->SetText(tx2);
     79mText[2]->SetText(tx3);
     80
     81}
     82
     83/* --Methode-- */
     84void 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{
     90strcpy(tx1, mText[0]->GetText().c_str());
     91strcpy(tx2, mText[1]->GetText().c_str());
     92strcpy(tx3, mText[2]->GetText().c_str());
     93}
     94
     95/* --Methode-- */
     96void ArgsWind::Process(PIMessage msg, PIMsgHandler* /*sender*/, void* /*data*/)
     97{
     98float xmin, xmax, ymin, ymax;
     99float fmin, fmax;
     100
     101switch (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   
     116return;
     117}
     118
     119
     120/* ........................................................... */
     121/*                    Classe PITApp
     122/* ........................................................... */
     123
    15124static void mypact(void *);
    16125
    17126/* --Methode-- */
    18127PITApp::PITApp(int narg, char* arg[])
    19 : PIApplication(230, 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"
    20129{
    21130
     
    32141//  Arret et sortie du programme
    33142
    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);
     143m = new PIMenu(Menubar(),"Fichier");
     144m->AppendItem("Update", 10101);
     145m->AppendItem("Start", 10102);
     146m->AppendItem("Stop", 10103);
     147m->AppendItem("ArgsWindow", 10104);
     148m->AppendItem("Exit", 10105);
    39149// 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]);
     150AppendMenu(m);
     151
    54152
    55153// Creation de deux labels - Un pour l'heure, l'autre pour X-Y
    56154// 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);
     155lab = new PILabel(this->MainWin(), "time", 250, 50, 10, 10);
     156
    59157mPeriod.SetAction(mypact);
    60158
    61159// Fenetre de dialogue
    62160mAW = new ArgsWind(this);
    63 
    64 mCurW = NULL;    // Fenetre courante
    65161SetReady();
    66162}
     
    69165PITApp::~PITApp()
    70166{
    71 int i;
    72 for(i=0; i<2; i++)  { delete lab[i]; delete m[i]; }
     167delete m; delete lab;
    73168delete mAW;
    74169
     
    80175char strg[64];
    81176
    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
     179switch(UserMsg(msg))    {
     180
    96181    case 10101:     // On met a l'heure
    97182      mypact(NULL);   
     
    103188
    104189    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();
    106195      break;
    107196
    108197    case 10105:          // Sortie d'application
    109198      Stop();
    110       break;
    111 
    112 // ----------  2eme menu --------
    113 
    114     case 10201 :        //  Creation, Affichage d'histo
    115       PIDrawWindow *  draw;
    116       PIHisto *pih;
    117       Histo *h;
    118       float x;
    119 
    120       SetBusy();    // souris -> montre
    121       // Creation et remplissage d'histo
    122       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 trace
    128       draw = new PIDrawWindow(this, strg, PIWK_normal, 200, 200, 300, 300);
    129       // Creation d'un traceur d'histo
    130       pih = new PIHisto(h);   
    131 
    132       pih->SetAutoDelHisto(true);   // Histo delete quand window -> close
    133       // Accrochage du traceur d'histo a la fenetre de Draw
    134       draw->AddDrawer(pih);   
    135       // Designation du champ label pour affichage coordonnees quand click souris
    136       draw->DrawWdg()->SetTextWin(lab[1]);
    137       draw->SetAutoDelChilds(true); 
    138       // On affiche  la fenetre
    139       draw->Show();   
    140 
    141       SetReady();    //  souris->pointeur , on n'est plus occupe
    142       break;
    143 
    144     case 10202 :     // Apparition de la fenetre de dialogue
    145       mAW->Show();
    146       break;
    147 
    148     case 10203 :     // Suppression de la fenetre courante
    149       if (mCurW)  { mCurW->Hide();  delete mCurW;}
    150       lab[1]->SetLabel("");
    151       mCurW = NULL;
    152       break;
    153 
    154 
    155     case 10205 :      // Creation fichier PostScript
    156       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 .ps
    162         mCurW->PSPrint(mps,0,0);
    163         delete mps;
    164       }
    165199      break;
    166200
     
    169203            (int)msg, (int)UserMsg(msg),(int)ModMsg(msg));
    170204     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 textes
    193 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'action
    201 //  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 texte
    233 {
    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 texte
    243 // ATTENTION : Il faut qu'il y ait assez de place
    244 // ds tx1, tx2, tx3 pour que la fonction puisse y copier
    245 // les chaines
    246 {
    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 va
    262     this->Hide();
    263     pap->SetReady();
    264     break;
    265 
    266   case 555:    // Bouton OK
    267 // 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);
    273205   
    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  }
    281207return;
    282208}
     
    288214// Fonction pour lire l'heure de la machine et mettre a jour le champ label
    289215{
    290 int tm;
     216time_t tm;
    291217char *s;
    292218time(&tm);
    293219s = ctime(&tm);
    294220// printf("mypact_Info:  %d  (%s)", tm, s);
    295 app->lab[0]->SetLabel((string)s);
     221app->lab->SetLabel((string)s);
    296222return;
    297223}
    298224
     225// ................................................................
     226//                   programme principal
     227// ................................................................
     228
    299229int main(int narg, char *arg[])
    300230{
    301 
    302 // Initialisation de tout PEIDA (avec StarReco++)
    303 PeidaStarRecoInitiator InitStar;
    304 
     231//  Creation de l'objet application et appel de Run()
    305232app = new PITApp(narg, arg);
    306233puts("appel de Application.Run() ... ");
  • trunk/SophyaPI/PI/exapp_1.h

    r39 r113  
    1 #include <string.h>
    2 
    31#include "pisysdep.h"
    42
     
    75#include PISTDWDG_H
    86#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
    288
    299class ArgsWind : public PIWindow {
     
    3717
    3818private:
    39   PIApplication * pap;
    4019  PILabel  * mLab[3];
    4120  PIButton * mBut[2];
    4221  PIText * mText[3];
    4322  };
     23
     24class PITApp : public PIApplication {
     25public:
     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
     32private :
     33  PIMenu * m;
     34  PIPeriodX mPeriod;
     35  ArgsWind *mAW;
     36};
     37
     38
  • trunk/SophyaPI/PI/exclude

    r90 r113  
    2626sc_sample.cc
    2727exapp_1.cc
     28exapp_2.cc
    2829pitestapp.cc
    2930piup_def.cc
  • trunk/SophyaPI/PI/parradapter.cc

    r111 r113  
    1616offX = offY = 0;
    1717invX = invY = eXY = false;
     18DefineXYCoordinates(0.,0.,1.,1.);
    1819}
    1920
     
    2829invX = invx;  invY = invy;  eXY = exy;
    2930if ( (sx > 0) && (sy > 0) )   { sX = sx; sY = sy; }
    30 if (invX) { sgnX = -1;  offX = sX; }
     31if (invX) { sgnX = -1;  offX = sX-1; }
    3132else { sgnX = 1; offX = 0; }
    32 if (invY) { sgnY = -1;  offY = sY; }
     33if (invY) { sgnY = -1;  offY = sY-1; }
    3334else { sgnY = 1; offY = 0; }
    3435}
    3536
    3637/* --Methode-- */
     38void P2DArrayAdapter::DefineXYCoordinates(float x0, float y0, float dx, float dy)
     39{
     40mOx = x0;   mOy = y0;
     41mDx = dx;   mDy = dy;
     42}
     43
     44/* --Methode-- */
    3745void P2DArrayAdapter::XYfromxy(int ix, int iy, float& x, float& y)
    3846{
    39 x = ix;
    40 y = iy;
     47x = mOx+ix*mDx;
     48y = mOy+iy*mDy;
    4149}
    4250
  • trunk/SophyaPI/PI/parradapter.h

    r111 r113  
    2525  inline void     GetAxesConfiguration(bool& invx, bool& invy, bool& exy)
    2626                               { invx = invX; invy = invY; exy = eXY; }
     27
     28  virtual void    DefineXYCoordinates(float x0, float y0, float dx, float dy);
    2729// Doit etre defini par les classes derivees
    2830  virtual float   Value(int ix, int iy) = 0;   
     
    5860protected :
    5961  int sX, sY;
     62  float mOx, mDx, mOy, mDy;
    6063  int sgnX, sgnY;
    6164  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
    19#include "pi3ddrw.h"
    210
    3 PI3DDrawer::PI3DDrawer()
     11
     12// ......................................................................
     13// ........................  Classe PIDrawer3D ..........................
     14// ......................................................................
     15
     16
     17/* --Methode-- */
     18PIDrawer3D::PIDrawer3D()
    419        : PIDrawer()
    520{
    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-- */
     30PIDrawer3D::~PIDrawer3D()
     31{
     32}
     33
     34/* --Methode-- */
     35void 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-- */
     45void 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-- */
     57bool 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-- */
     69PIGraphicUC* 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-- */
     91PIDraw3DWdg::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-- */
     111PIDraw3DWdg::~PIDraw3DWdg()
     112{
     113  delete mGr3d;
     114}
     115
     116/* --Methode-- */
     117void 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-- */
     128void 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-- */
     139bool 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-- */
     146void 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-- */
     161int PIDraw3DWdg::AddDrawer3D(PIDrawer3D* dr3, bool ad)
     162{
     163if (!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  }
     171else {
     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  }
     177int id = AddDrawer(dr3, false, false, ad);
     178m3DrIl.push_back(id);
     179return(id);
     180}
     181
     182/* --Methode-- */
     183void 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-- */
     192void PIDraw3DWdg::DeleteDrawers()
     193{
     194  m3DrIl.erase(m3DrIl.begin(),  m3DrIl.end());
     195  PIBaseWdg::DeleteDrawers();
     196}
     197
     198/* --Methode-- */
     199void 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-- */
     226void 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-- */
     245void 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-- */
     258void 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-- */
     283void 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-- */
     308void 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-- */
     319void 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-- */
     351void 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
     367static int isw = 0;
     368void PIDraw3DWdg::But3Press(int x, int y)
     369x -= XSize()/2;
     370y -= YSize()/2;
     371
     372float fx = (float)x/XSize();
     373float fy = (float)y/YSize();
     374if ( (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}
     400if ((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}
     404else 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}
     408else  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}
     412else {
     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
     417Refresh();
     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"
    39#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
     17class PIDrawer3D : public PIDrawer
    518{
    6 PI3DDrawer();
    7 virtual ~PI3DDrawer();
     19public :
     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
     32protected :
     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
    839};
     40
     41
     42
     43class PIDraw3DWdg : public PIBaseWdg {
     44public:
     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
     75protected :
     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
    988#endif
  • trunk/SophyaPI/PI/pibwdggen.cc

    r111 r113  
    5757puts("Debug_PIBaseWdgGen::Draw() Efface la fenetre par defaut ! ");
    5858#endif
     59EraseWindow(0, 0, XSize(), YSize());
    5960if (fgdrawloop == 0)
    6061  { fgdrawloop=2;  Draw(g, 0, 0, XSize(), YSize()); }
  • trunk/SophyaPI/PI/pibwdggen.h

    r111 r113  
    8181// ------ Gestion des Drawers  ------
    8282  friend class PIDrawer;
    83           void       SetDefaultDrawRectangle(PIGrCoord x1, PIGrCoord y1,
     83  virtual void       SetDefaultDrawRectangle(PIGrCoord x1, PIGrCoord y1,
    8484                                             PIGrCoord x2, PIGrCoord y2, bool psz=true);
    85           void       SetDefaultDrawerLimits(float xmin, float xmax, float ymin, float ymax,
     85  virtual void       SetDefaultDrawerLimits(float xmin, float xmax, float ymin, float ymax,
    8686                                            int axrl=kAxeDirSame, int ayud=kAxeDirSame);
    87           int        AddDrawer(PIDrawer* drw, PIGrCoord x1, PIGrCoord y1,
     87  virtual int        AddDrawer(PIDrawer* drw, PIGrCoord x1, PIGrCoord y1,
    8888                               PIGrCoord x2, PIGrCoord y2,
    8989                               bool psz=true, bool clip=true, bool ad=false);
    90           int        AddDrawer(PIDrawer* drw, bool autolim=false, bool clip=true, bool ad=false);
    91           void       MoveResizeDrawer(int id, PIGrCoord x1, PIGrCoord y1,
     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,
    9292                                      PIGrCoord x2, PIGrCoord y2, bool psz=true);
    93           void       RemoveDrawer(int id);       // Ote un drawer de la liste
    94           void       DeleteDrawers();            // Ote et detruit tous les drawers
     93  virtual void       RemoveDrawer(int id);       // Ote un drawer de la liste
     94  virtual void       DeleteDrawers();            // Ote et detruit tous les drawers
    9595// Acces aux drawers
    96           int        NbDrawers();
    97           PIDrawer*  GetDrawerId(int id);   
    98           PIDrawer*  GetDrawer(int n);   
     96  virtual int        NbDrawers();
     97  virtual PIDrawer*  GetDrawerId(int id);   
     98  virtual PIDrawer*  GetDrawer(int n);   
    9999
    100100//  Trace des Drawers ...         
  • trunk/SophyaPI/PI/pidrawer.cc

    r111 r113  
    2020  mMSz = -1;
    2121  mMrk = PI_NotDefMarker;
     22  mCmapid = CMAP_OTHER;
    2223}
    2324
     
    106107
    107108void
     109PIDrawer::SetColMapId(CMapId cid)
     110{
     111  mCmapid = cid;
     112}
     113
     114void
    108115PIDrawer::SelGraAtt(PIGraphicUC* g)
    109116{
     
    116123                                  g->SelMarker(mMSz, mMrk);
    117124}
     125
    118126
    119127void
  • trunk/SophyaPI/PI/pidrawer.h

    r111 r113  
    5252                                PIFontAtt fat=PI_NotDefFontAtt);
    5353  void               SetMarkerAtt(int sz=-1, PIMarker mrk=PI_NotDefMarker);
     54  void               SetColMapId(CMapId cid=CMAP_OTHER);
    5455
    5556  void               SelGraAtt(PIGraphicUC* g);
     
    102103  PIFontAtt          mFAtt;
    103104  int                mMSz;
    104   PIMarker           mMrk;     
     105  PIMarker           mMrk; 
     106  CMapId             mCmapid;
    105107 
    106108};
  • 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
    15#include "pifilechogen.h"
    26
    37
    48/************* 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
    551
    652PIFileChooserGen::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
    15#include <stdio.h>
     6#include <math.h>
    27#include "pigraph3d.h"
    38
     9/* --Methode-- */
    410PIGraphic3D::PIGraphic3D(PIGraphicGen* g, PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy)
    511        : PIGraphicUC(g, x0, y0, dx, dy)
    612{
    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-- */
    1026PIGraphic3D::~PIGraphic3D()
    1127{
    1228}
     29
     30/* --Methode-- */
     31int PIGraphic3D::kind()
     32{
     33  return PI_3DGraphics;
     34}
     35
     36static float deuxpi = 2*M_PI;
     37static double ddeuxpi = 2*M_PI;
     38
     39/* --Methode-- */
     40void 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-- */
     74void 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-- */
     123bool 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-- */
     135void PIGraphic3D::PrintCS()
     136{
     137if (sO)  printf("PIGraphic3D::PrintCS() : Set3DCS_Obs(...) \n");
     138else  printf("PIGraphic3D::PrintCS() : Set3DCS(...) \n");
     139printf("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 );
     141printf("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]);
     143float x,y,z,xp,yp,zp, xpix, ypix;
     144x = xC, y = yC, z= zC;
     145C3DC2ObsCS(x, y, z, xp, yp, zp);
     146Proj3DC2GrC(x, y, z, xpix, ypix);
     147printf("C -> %g %g %g -> %g %g \n", xp, yp, zp, xpix, ypix);
     148x = xC+1, y = yC, z= zC;
     149C3DC2ObsCS(x, y, z, xp, yp, zp);
     150Proj3DC2GrC(x, y, z, xpix, ypix);
     151printf("C+(1,0,0) -> %g %g %g -> %g %g ", xp, yp, zp, xpix, ypix);
     152x = xC, y = yC+1, z= zC+1;
     153C3DC2ObsCS(x, y, z, xp, yp, zp);
     154Proj3DC2GrC(x, y, z, xpix, ypix);
     155printf("C+(0,1,1) -> %g %g %g -> %g %g \n", xp, yp, zp, xpix, ypix);
     156}
     157
     158/* --Methode-- */
     159void 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-- */
     176void 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-- */
     198void 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-- */
     208void 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-- */
     225void 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-- */
     235void 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-- */
     245void 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-- */
     261void 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-- */
     284void 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-- */
     306void 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-- */
     316void 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
    15#ifndef PIGRAPHIC3D_H_SEEN
    26#define PIGRAPHIC3D_H_SEEN
     
    610
    711
    8 class PIGraphic3D : PIGraphicUC
     12class PIGraphic3D : public PIGraphicUC
    913{
     14public:
    1015                     PIGraphic3D(PIGraphicGen* g, PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy);
    1116  virtual           ~PIGraphic3D();
    1217
     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 
     44protected:
     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()
    1352};
    1453
  • 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
    15// Classe generique de trace graphique de base (Ne peut etre instancie)
    26
  • 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
    15#ifndef PIGRAPHICGEN_H_SEEN
    26#define PIGRAPHICGEN_H_SEEN
     
    5256
    5357enum PIGraphicsType { PI_ScrWindowGraphics = 0, PI_PSFileGraphics = 1,
    54                       PI_UCGraphics = 2, PI_UC3DGraphics = 3 };
     58                      PI_UCGraphics = 2, PI_3DGraphics = 3 };
    5559
    5660// Classe generique de trace graphique de base :
     
    7781  virtual void       DrawCircle(PIGrCoord x0, PIGrCoord y0, PIGrCoord r)               = 0;
    7882  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; 
    8185  virtual void       DrawMarker(PIGrCoord x0, PIGrCoord y0)                            = 0;
    8286  virtual void       DrawMarkers(PIGrCoord *x, PIGrCoord *y, int n)                    = 0;
  • trunk/SophyaPI/PI/pigraphps.cc

    r71 r113  
    127127
    128128/* --Methode-- */
    129 void PIGraphicPS::DrawPolygon(PIGrCoord *x, PIGrCoord *y, int n)
     129void PIGraphicPS::DrawPolygon(PIGrCoord *x, PIGrCoord *y, int n, bool cinc)
    130130{
    131131int i;
     
    137137xtmp = new float[n];
    138138ytmp = new float[n];
    139 for(i=0;i<n;i++){
    140   xtmp[i] = (float)x[i];
    141   ytmp[i] = (float)y[i];
     139
     140float xoff,yoff;
     141if (cinc) { xoff=yoff=0.; }   // Coord en mode incremental
     142else { xoff = (float)x[0];  yoff = (float)y[0]; }   //   Coord en mode absolu
     143for(i=0;i<n;i++) {
     144  xtmp[i] = (float)x[i]-xoff;
     145  ytmp[i] = (float)y[i]-yoff;
    142146}
    143147mPSOut->DrawPolygon(xtmp,ytmp,n,mFCol,mLAtt);
     
    150154
    151155/* --Methode-- */
    152 void PIGraphicPS::DrawFPolygon(PIGrCoord *x, PIGrCoord *y, int n)
     156void PIGraphicPS::DrawFPolygon(PIGrCoord *x, PIGrCoord *y, int n, bool cinc)
    153157{
    154158int i;
     
    160164xtmp = new float[n];
    161165ytmp = new float[n];
    162 for(i=0;i<n;i++){
    163   xtmp[i] = (float)x[i];
    164   ytmp[i] = (float)y[i];
     166
     167float xoff,yoff;
     168if (cinc) { xoff=yoff=0.; }   // Coord en mode incremental
     169else { xoff = (float)x[0];  yoff = (float)y[0]; }   //   Coord en mode absolu
     170for(i=0;i<n;i++) {
     171  xtmp[i] = (float)x[i]-xoff;
     172  ytmp[i] = (float)y[i]-yoff;
    165173}
    166174mPSOut->DrawFPolygon(xtmp,ytmp,n,mFCol,mFCol,mLAtt);
  • trunk/SophyaPI/PI/pigraphps.h

    r71 r113  
    2727  virtual void       DrawCircle(PIGrCoord x0, PIGrCoord y0, PIGrCoord r);
    2828  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); 
    3131  virtual void       DrawMarker(PIGrCoord x0, PIGrCoord y0);
    3232  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
    15#include "pigraphuc.h"
    2 
    36
    47
     
    3033{
    3134return PI_UCGraphics;
     35}
     36
     37/* --Methode-- */
     38void 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);
    3244}
    3345
     
    89101void PIGraphicUC::UC2GrC(float x, float y, float& xpix, float& ypix)
    90102{
    91   xpix = (float)(xOrg + x*xScale + .5);
    92   ypix = (float)(yOrg + y*yScale + .5);
     103  xpix = (float)(xOrg + x*xScale);  // $CHECK$ Reza 21/06/98 ? + .5);
     104  ypix = (float)(yOrg + y*yScale);  // $CHECK$ Reza 21/06/98 ?+ .5);
    93105}
    94106
     
    327339
    328340/* --Methode-- */
    329 void PIGraphicUC::DrawPolygon(PIGrCoord *x, PIGrCoord *y, int n)
     341void PIGraphicUC::DrawPolygon(PIGrCoord *x, PIGrCoord *y, int n, bool cinc)
    330342{
    331343  PIGrCoord xc[NMXMULTP], yc[NMXMULTP];
     
    343355    pxc[i] = xf;  pyc[i] = yf;
    344356  }
    345   mGrC->DrawPolygon(pxc, pyc, n);
     357  mGrC->DrawPolygon(pxc, pyc, n, cinc);
    346358  if (n > NMXMULTP) { delete[] pxc;  delete[] pyc; }
    347359  return;
     
    349361 
    350362/* --Methode-- */
    351 void PIGraphicUC::DrawFPolygon(PIGrCoord *x, PIGrCoord *y, int n)
     363void PIGraphicUC::DrawFPolygon(PIGrCoord *x, PIGrCoord *y, int n, bool cinc)
    352364{
    353365  PIGrCoord xc[NMXMULTP], yc[NMXMULTP];
     
    365377    pxc[i] = xf;  pyc[i] = yf;
    366378  }
    367   mGrC->DrawFPolygon(pxc, pyc, n);
     379  mGrC->DrawFPolygon(pxc, pyc, n, cinc);
    368380  if (n > NMXMULTP) { delete[] pxc;  delete[] pyc; }
    369381  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
    15#ifndef PIGRAPHICUC_H_SEEN
    26#define PIGRAPHICUC_H_SEEN
     
    2226  virtual int        kind();
    2327
     28  virtual void       SetBaseGraphic(PIGraphicGen* g, PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy);
     29
    2430//  Espace des coordonnees
    2531  virtual void       GetGrSpace(PIGrCoord& xmin, PIGrCoord& xmax, PIGrCoord& ymin, PIGrCoord& ymax);
     
    3844  virtual void       DrawCircle(PIGrCoord x0, PIGrCoord y0, PIGrCoord r);
    3945  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); 
    4248  virtual void       DrawMarker(PIGrCoord x0, PIGrCoord y0);
    4349  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
    15#include <stdio.h>
    26
     
    125129
    126130/* --Methode-- */
    127 void PIGraphicX::DrawPolygon(PIGrCoord *x, PIGrCoord *y, int n)
     131void PIGraphicX::DrawPolygon(PIGrCoord *x, PIGrCoord *y, int n, bool cinc)
    128132{
    129133XPoint multipoint[NMXXPOINTS];
     
    135139else pxp = multipoint;
    136140for(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);
     141int mode = CoordModeOrigin;
     142if (cinc) mode =  CoordModePrevious;
     143XDrawLines(XtDisplay(MyWdg()), XtWindow(MyWdg()), DefGC(), pxp, n, mode);
    138144if (n > NMXXPOINTS)  delete[] pxp;
    139145
     
    143149
    144150/* --Methode-- */
    145 void PIGraphicX::DrawFPolygon(PIGrCoord *x, PIGrCoord *y, int n)
     151void PIGraphicX::DrawFPolygon(PIGrCoord *x, PIGrCoord *y, int n, bool cinc)
    146152{
    147153XPoint multipoint[NMXXPOINTS];
     
    153159else pxp = multipoint;
    154160for(i=0; i<n; i++)  { pxp[i].x = x[i];  pxp[i].y = y[i]; }
     161int mode = CoordModeOrigin;
     162if (cinc) mode =  CoordModePrevious;
    155163XFillPolygon(XtDisplay (MyWdg()), XtWindow(MyWdg()), DefGC(), pxp, n,
    156                         Complex, CoordModePrevious);
     164                        Complex, mode);
    157165if (n > NMXXPOINTS)  delete[] pxp;
    158166
  • 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
    15#ifndef PIGRAPHICX_H_SEEN
    26#define PIGRAPHICX_H_SEEN
     
    2024  virtual void       DrawCircle(PIGrCoord x0, PIGrCoord y0, PIGrCoord r);
    2125  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); 
    2428  virtual void       DrawMarker(PIGrCoord x0, PIGrCoord y0);
    2529  virtual void       DrawMarkers(PIGrCoord *x, PIGrCoord *y, int n);
  • trunk/SophyaPI/PI/piimage.cc

    r112 r113  
     1// Module PI : Peida Interactive     PIImage
    12// Affichage d'image            R. Ansari  05/95
    23// LAL (Orsay) / IN2P3-CNRS  DAPNIA/SPP (Saclay) / CEA
     
    740741if (winovis)  return;      // $CHECK$ Reza A enlever si possible 17/6/96
    741742
    742 g->SelGOMode(PI_GOXOR);
    743 if (GetColMapId() == CMAP_COLRJ32)
    744 g->SelForeground(PI_Yellow);
    745 else g->SelForeground(PI_Magenta);
     743g->SelGOMode(PI_GOCopy);
     744if ( (GetColMapId() == CMAP_GREY32) || (GetColMapId() == CMAP_GREYINV32) )  g->SelForeground(PI_Red);
     745else  g->SelForeground(PI_White);
    746746
    747747if (zoom < 3)  g->SelLine(PI_NormalLine);
     
    749749
    750750if ((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);
    756753}
    757754if ((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/95
     1// Module PI : Peida Interactive     PIImage
     2// Affichage d image            R. Ansari  05/95
    33// LAL (Orsay) / IN2P3-CNRS  DAPNIA/SPP (Saclay) / CEA
    44
  • 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
    15#include "pilistgen.h"
    26
     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//--
    367
    468PIListGen::PIListGen(PIContainerGen *par, char *nom,
  • trunk/SophyaPI/PI/pilistgen.h

    r54 r113  
    1616  virtual void       AppendItem(const char * item, PIMessage msg)=0;
    1717  virtual void       DeleteItem(const char *item)=0;
    18   virtual void       DeleteItem(PIMessage msg)=0;
     18  virtual void       DeleteItemMsg(PIMessage msg)=0;
    1919 
    2020  virtual void       SetMultipleSelect(bool ms=false)=0;
     
    2525
    2626  virtual void       SelectItem(const char * item)=0;
    27   virtual void       SelectItem(PIMessage msg)=0;
     27  virtual void       SelectItemMsg(PIMessage msg)=0;
    2828  virtual void       ClearSelItem(const char * item)=0;
    29   virtual void       ClearSelItem(PIMessage msg)=0;
     29  virtual void       ClearSelItemMsg(PIMessage msg)=0;
    3030
    3131  virtual long       kind() {return ClassId; }
  • trunk/SophyaPI/PI/pilistx.cc

    r98 r113  
    123123
    124124/* --Methode-- */
    125 void PIListX::DeleteItem(PIMessage msg)
     125void PIListX::DeleteItemMsg(PIMessage msg)
    126126{
    127127int n;
     
    179179
    180180/* --Methode-- */
    181 void PIListX::SelectItem(PIMessage msg)
     181void PIListX::SelectItemMsg(PIMessage msg)
    182182{
    183183int n;
     
    200200
    201201/* --Methode-- */
    202 void PIListX::ClearSelItem(PIMessage msg)
     202void PIListX::ClearSelItemMsg(PIMessage msg)
    203203{
    204204int n;
  • trunk/SophyaPI/PI/pilistx.h

    r54 r113  
    1212  virtual void       AppendItem(const char * item, PIMessage msg);
    1313  virtual void       DeleteItem(const char *item);
    14   virtual void       DeleteItem(PIMessage msg);
     14  virtual void       DeleteItemMsg(PIMessage msg);
    1515
    1616  virtual void       SetMultipleSelect(bool ms=false);
     
    2121
    2222  virtual void       SelectItem(const char * item);
    23   virtual void       SelectItem(PIMessage msg);
     23  virtual void       SelectItemMsg(PIMessage msg);
    2424  virtual void       ClearSelItem(const char * item);
    25   virtual void       ClearSelItem(PIMessage msg);
     25  virtual void       ClearSelItemMsg(PIMessage msg);
    2626
    2727// 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
    15#include "pimenubargen.h"
    26
    37#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//--
    444
    545PIMenubarGen::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
    15#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//--
    2114
    3115PIMenuGen::PIMenuGen(PIWdg* par, char* nom, PIMenuType pdpu)
  • trunk/SophyaPI/PI/piscdrawwdg.cc

    r111 r113  
    5252PIScDrawWdg::AddScDrawer(PIDrawer* d, bool ad)
    5353{
     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  }
    5459  return(AddDrawer(d, true, ad));
    5560}
     
    7782}
    7883
     84
     85/*
    7986void
    8087PIScDrawWdg::Draw(PIGraphic* g)
     
    104111    }
    105112}
    106 
     113*/
    107114
    108115// Gestion affichage coordonnees du point
  • trunk/SophyaPI/PI/piscdrawwdg.h

    r111 r113  
    1818
    1919                     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);
    2121  virtual            ~PIScDrawWdg();
    2222
    2323  virtual long       kind() {return ClassId; }
    2424 
    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);
    2727 
    2828  void               SetLimits(float xmin, float xmax, float ymin, float ymax,
  • trunk/SophyaPI/PI/pisysdep.h

    r71 r113  
    4444  #define PIPIXMAP_H "pipixmapx.h"
    4545
    46   #define PIPERIODIC_H "piperiodicx.h"
     46  #define PIPERIODIC_H "piperiodx.h"
    4747
    4848#endif
Note: See TracChangeset for help on using the changeset viewer.