Changeset 119 in Sophya


Ignore:
Timestamp:
Jul 13, 1998, 8:08:21 PM (27 years ago)
Author:
ansari
Message:

1/ Premiere mise au point des DrawerTools, amelioration de PIImage Tools,
2/ creation de pipodrw.cc .h pour Drawers Outils PEIDA++
3/ ajout de P1DArrayAdapter Reza 12/07/98

Location:
trunk/SophyaPI/PI
Files:
2 added
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaPI/PI/Makefile

    r114 r119  
    44 
    55all: $(LIB)libPI.a
    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
     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)pipodrw.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)
     
    1212 
    1313clean:
    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
     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)pipodrw.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
    1515ifeq ($(CXX),cxx)
    1616        cd $(REPM); rm -f *.o
     
    2424 piwdgx.h piwdggen.h pimsghandler.h picmap.h picmapx.h picmapgen.h \
    2525 pigraphx.h pigraphgen.h pigraphuc.h psfile.h \
    26  $(EROSDEVREP)/Include/defs.h pigraph3d.h pibwdgx.h pigraphps.h
     26 $(EROSDEVREP)/Include/defs.h pigraph3d.h pibwdgx.h pigraphps.h \
     27 pidrwtools.h pistdwdgx.h pistdwdggen.h pioptmenux.h pioptmenugen.h \
     28 pimenux.h pimenugen.h piwindowx.h piwindowgen.h picontainerx.h \
     29 picontainergen.h piapplx.h piapplgen.h pimenubarx.h pimenubargen.h \
     30 picons.h
    2731$(OBJ)piapplgen.o: piapplgen.cc piapplgen.h pimsghandler.h pisysdep.h \
    2832 picontainerx.h picontainergen.h piwdgx.h piwdggen.h pimenubarx.h \
     
    4044 pimsghandler.h picmap.h picmapx.h picmapgen.h pigraphx.h pigraphgen.h \
    4145 pigraphuc.h psfile.h $(EROSDEVREP)/Include/defs.h pidrawer.h \
    42  pigraphps.h
     46 pigraphps.h pidrwtools.h pistdwdgx.h pistdwdggen.h pioptmenux.h \
     47 pioptmenugen.h pimenux.h pimenugen.h piwindowx.h piwindowgen.h \
     48 picontainerx.h picontainergen.h piapplx.h piapplgen.h pimenubarx.h \
     49 pimenubargen.h picons.h pibwdgx.h
    4350$(OBJ)pibwdgx.o: pibwdgx.cc pixtbaseP.h pibwdgx.h pisysdep.h pibwdggen.h \
    4451 piwdgx.h piwdggen.h pimsghandler.h picmap.h picmapx.h picmapgen.h \
     
    7178 $(EROSDEVREP)/Include/defs.h pigraphps.h pistdwdgx.h pistdwdggen.h \
    7279 pidrawer.h
    73 $(OBJ)pidrwtools.o: pidrwtools.cc pidrwtools.h pisysdep.h pimenux.h \
    74  pimenugen.h piwdgx.h piwdggen.h pimsghandler.h piapplx.h piapplgen.h \
    75  picontainerx.h picontainergen.h pimenubarx.h pimenubargen.h picons.h \
    76  pistdwdgx.h pistdwdggen.h pibwdgx.h pibwdggen.h picmap.h picmapx.h \
    77  picmapgen.h pigraphx.h pigraphgen.h pigraphuc.h psfile.h \
    78  $(EROSDEVREP)/Include/defs.h pigraphps.h piscdrawwdg.h piwindowx.h \
    79  piwindowgen.h pidrawer.h
     80$(OBJ)pidrwtools.o: pidrwtools.cc pidrwtools.h pisysdep.h pistdwdgx.h \
     81 pistdwdggen.h piwdgx.h piwdggen.h pimsghandler.h pioptmenux.h \
     82 pioptmenugen.h pimenux.h pimenugen.h piwindowx.h piwindowgen.h \
     83 picontainerx.h picontainergen.h piapplx.h piapplgen.h pimenubarx.h \
     84 pimenubargen.h picons.h pibwdgx.h pibwdggen.h picmap.h picmapx.h \
     85 picmapgen.h pigraphx.h pigraphgen.h pigraphuc.h psfile.h \
     86 $(EROSDEVREP)/Include/defs.h pigraphps.h piscdrawwdg.h pidrawer.h
    8087$(OBJ)pifilechogen.o: pifilechogen.cc pifilechogen.h pisysdep.h piwdgx.h \
    8188 piwdggen.h pimsghandler.h
     
    127134 pigraphuc.h psfile.h pipixmapx.h pipixmapgen.h pibwdgx.h pigraphps.h \
    128135 pistdwdgx.h pistdwdggen.h piwindowx.h piwindowgen.h picontainerx.h \
    129  picontainergen.h
     136 picontainergen.h piimgtools.h pioptmenux.h pioptmenugen.h pimenux.h \
     137 pimenugen.h piapplx.h piapplgen.h pimenubarx.h pimenubargen.h \
     138 picons.h pidrwtools.h
    130139$(OBJ)piimgtools.o: piimgtools.cc piimgtools.h pisysdep.h pistdwdgx.h \
    131  pistdwdggen.h piwdgx.h piwdggen.h pimsghandler.h pimenux.h \
    132  pimenugen.h pioptmenux.h pioptmenugen.h piwindowx.h piwindowgen.h \
     140 pistdwdggen.h piwdgx.h piwdggen.h pimsghandler.h pioptmenux.h \
     141 pioptmenugen.h pimenux.h pimenugen.h piwindowx.h piwindowgen.h \
    133142 picontainerx.h picontainergen.h piapplx.h piapplgen.h pimenubarx.h \
    134143 pimenubargen.h picons.h pibwdgx.h pibwdggen.h picmap.h picmapx.h \
     
    200209 picmapx.h picmapgen.h pigraphx.h pigraphgen.h pigraphuc.h psfile.h \
    201210 $(EROSDEVREP)/Include/defs.h pigraphps.h
    202 $(OBJ)piscdrawwdg.o: piscdrawwdg.cc $(EROSDEVREP)/Include/generalfit.h \
    203  $(EROSDEVREP)/Include/exceptions.h $(EROSDEVREP)/Include/defs.h \
     211$(OBJ)pipodrw.o: pipodrw.cc pipodrw.h pidrawer.h pibwdggen.h pisysdep.h \
     212 piwdgx.h piwdggen.h pimsghandler.h picmap.h picmapx.h picmapgen.h \
     213 pigraphx.h pigraphgen.h pigraphuc.h psfile.h \
     214 $(EROSDEVREP)/Include/defs.h $(EROSDEVREP)/Include/generalfit.h \
     215 $(EROSDEVREP)/Include/exceptions.h \
    204216 $(EROSDEVREP)/Include/peidainit.h \
    205217 $(EROSDEVREP)/Include/matrix.h $(EROSDEVREP)/Include/peida.h \
     
    208220 $(EROSDEVREP)/Include/ppersist.h \
    209221 $(EROSDEVREP)/Include/pclassids.h \
    210  $(EROSDEVREP)/Include/cvector.h piscdrawwdg.h pisysdep.h pibwdgx.h \
     222 $(EROSDEVREP)/Include/cvector.h
     223$(OBJ)piscdrawwdg.o: piscdrawwdg.cc piscdrawwdg.h pisysdep.h pibwdgx.h \
    211224 pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h picmap.h picmapx.h \
    212  picmapgen.h pigraphx.h pigraphgen.h pigraphuc.h psfile.h pigraphps.h \
    213  pistdwdgx.h pistdwdggen.h piwindowx.h piwindowgen.h picontainerx.h \
    214  picontainergen.h pidrawer.h
     225 picmapgen.h pigraphx.h pigraphgen.h pigraphuc.h psfile.h \
     226 $(EROSDEVREP)/Include/defs.h pigraphps.h pistdwdgx.h pistdwdggen.h \
     227 piwindowx.h piwindowgen.h picontainerx.h picontainergen.h pidrawer.h \
     228 pidrwtools.h pioptmenux.h pioptmenugen.h pimenux.h pimenugen.h \
     229 piapplx.h piapplgen.h pimenubarx.h pimenubargen.h picons.h
    215230$(OBJ)pistdwdggen.o: pistdwdggen.cc pistdwdggen.h pisysdep.h piwdgx.h \
    216231 piwdggen.h pimsghandler.h
  • trunk/SophyaPI/PI/parradapter.h

    r113 r119  
    33// LAL (Orsay) / IN2P3-CNRS  DAPNIA/SPP (Saclay) / CEA
    44
    5 // Cette classe est un adaptateur pour les PIImages et
    6 // autres classes de PI qui operent sur des structures
    7 // de type Tableaux 2-D (images, ...)
    85
    96#ifndef PARRADAPTER_SEEN
     
    1411#include "lut.h"
    1512
    16 class LUT;
     13class P1DArrayAdapter {
     14public :
     15                  P1DArrayAdapter(int sz=0) {mSize=sz; }
     16                  ~P1DArrayAdapter();
     17 
     18  virtual float   Value(int i) = 0;
     19  inline  int     Size() { return (mSize) ; }
     20     
     21protected :
     22  int mSize;
     23};
     24
     25// Cette classe est un adaptateur pour les PIImages et
     26// autres classes de PI qui operent sur des structures
     27// de type Tableaux 2-D (images, ...)
     28
    1729class P2DArrayAdapter {
    1830public :
     
    6678};
    6779
     80template <class T>
     81class P1DAdapter : public P1DArrayAdapter {
     82public :
     83                  P1DAdapter(T* data, int sz, bool ad=false) :
     84                    P1DArrayAdapter(sz)
     85                    { aDel = ad; mData = data; }
     86
     87  virtual         ~P1DAdapter() { if ( (aDel) && (mData != NULL) ) delete[] mData; }
     88  virtual float   Value(int i)
     89                    {  if ( (i < 0) || (i >= mSize) ) return(0.);
     90                    return(mData[i]); }
     91protected :
     92  bool aDel;
     93  T* mData;
     94};
     95
    6896
    6997template <class T>
  • trunk/SophyaPI/PI/pi3ddrw.cc

    r116 r119  
    88
    99#include "pi3ddrw.h"
     10#include "pidrwtools.h"
    1011
    1112
     
    238239  DrawXYZAxes();
    239240  Send(Msg(), PIMsg_Active);
     241  PIDrwTools::SetCurrentBaseWdg(this);
    240242}
    241243
     
    296298  DrawXYZAxes();
    297299  Send(Msg(), PIMsg_Active);
     300  PIDrwTools::SetCurrentBaseWdg(this);
    298301}
    299302
     
    370373{
    371374  Send(Msg(), PIMsg_Active);
     375  PIDrwTools::SetCurrentBaseWdg(this);
    372376  if ( (x > 50) || ( y > 50) ) return;
    373377  list<int>::iterator it = m3DrIl.begin();
  • trunk/SophyaPI/PI/pibwdggen.cc

    r118 r119  
    44#include "pidrawer.h"
    55#include "pigraphps.h"
     6#include "pidrwtools.h"
    67
    78// Les methodes de la classe  PIBWdgGen
     
    2526delete mWGrC;
    2627DeleteDrawers();
     28if (PIDrwTools::GetCurrentBaseWdg() == this)
     29  PIDrwTools::SetCurrentBaseWdg(NULL);
    2730}
    2831 
  • trunk/SophyaPI/PI/pidrwtools.cc

    r112 r119  
    44
    55#include <stdlib.h>
     6
    67#include "pidrwtools.h"
    78#include "piscdrawwdg.h"
    89
    910
    10 /* --Methode-- */
    11 PIDrwMenu::PIDrwMenu(PIApplication* par)
    12         : PIMenu(par->Menubar(), "DrawerTools")
    13 {
    14 pdm[0] = new PIMenu(this, "Color");
    15 pdm[0]->AppendItem("White", 303);
    16 AppendPDMenu(pdm[0]);
    17 }
    18 
    19 /* --Methode-- */
    20 PIDrwMenu::~PIDrwMenu()
    21 {
    22 int i;
    23 for(i=0; i<1; i++)  delete pdm[i];
    24 }
    25 
    26 /* --Methode-- */
    27 void PIDrwMenu::Process(PIMessage msg, PIMsgHandler* /*sender*/, void* data)
    28 {
     11PIDrwTools* PIDrwTools::cwdrwt = NULL;
     12PIBaseWdgGen* PIDrwTools::mCurBW = NULL;
     13
     14/* --Methode-- */
     15void PIDrwTools::ShowPIDrwTools()
     16{
     17if (cwdrwt == NULL)  cwdrwt = new PIDrwTools(PIApplicationGetApp());
     18cwdrwt->Show();
     19}
     20
     21/* --Methode-- */
     22void PIDrwTools::SetCurrentBaseWdg(PIBaseWdgGen* cbw)
     23{
     24mCurBW = cbw;
     25if (cwdrwt)  {
     26  cwdrwt->mNlb->SetLabel("0"); 
     27  cwdrwt->mNDr = 0;
     28  }
     29}
     30/* --Methode-- */
     31PIBaseWdgGen* PIDrwTools::GetCurrentBaseWdg()
     32{
     33return(mCurBW);
     34}
     35
     36/* --Methode-- */
     37PIDrwTools::PIDrwTools(PIApplication* par)
     38: PIWindow((PIMsgHandler*)par, "PIDrawerTools", PIWK_dialog, 240, 240, 150, 150)
     39{
     40int bsx, bsy, spx, spy;
     41
     42// On definit la taille a partir de la taille par defaut des composantes
     43// PIApplicationPrefCompSize(bsx, bsy);
     44par->PrefCompSz(bsx, bsy);
     45spx = bsx/10;
     46spy = bsy/4;
     47
     48int wszx = 5*spx+3.5*bsx;
     49int wszy = (6+3*0.85)*(spy+bsy);
     50SetSize(wszx, wszy);
     51
     52int cpx = spx*2;
     53int cpy = spy*2;
     54int csx = cpx;
     55int csy = cpy;
     56mLab[0] = new PILabel(this, "X Min Max", 1.5*bsx, bsy, cpx, cpy);
     57cpy += spy+bsy;
     58mLab[1] = new PILabel(this, "Y Min Max", 1.5*bsx, bsy, cpx, cpy);
     59mLab[0]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
     60mLab[1]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
     61
     62cpy = spy*2;
     63cpx += spx+1.5*bsx;
     64mText[0] = new PIText(this, "x_min_max", 2.0*bsx, bsy, cpx, cpy);
     65mText[0]->SetText("-1.0  1.0");
     66cpy += spy+bsy;
     67mText[1] = new PIText(this, "y_min_max", 2.0*bsx, bsy, cpx, cpy);
     68mText[1]->SetText("-1.0  1.0");
     69mText[0]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
     70mText[1]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
     71
     72cpx = 2*spx;
     73cpy += spy+bsy;
     74mCkb[0] = new PICheckBox(this,"AxeX-RtoL", 2000, 1.5*bsx, bsy, cpx, cpy);
     75cpx += spx+1.5*bsx;
     76mCkb[1] = new PICheckBox(this,"AxeY-UpDown", 2000, 1.5*bsx, bsy, cpx, cpy);
     77mCkb[0]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
     78mCkb[1]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
     79
     80cpy += spy+bsy;
     81cpx = 4*spx;;
     82mBut[0] = new PIButton(this, "Apply", 2500, bsx*1.5, bsy, cpx, cpy);
     83cpx += bsx*1.5+2*spx;
     84mBut[1] = new PIButton(this, "Dismiss", 2600,  bsx*1.5, bsy, cpx, cpy);
     85mBut[0]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
     86mBut[1]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
     87
     88int offy = cpy+bsy+spy*2;
     89
     90//  Option-Menu  Marker, Line, couleur, etc...
     91cpx = 2*spx;
     92cpy += 3*spy+bsy;
     93
     94int bsyo = bsy; 
     95int spyo = spy;
     96bsy = 0.85*bsy;   spy = 0.85*spy;
     97
     98mOpt[0] = new PIOptMenu(this, "bwt-opt-0", bsx*1.75, bsy, cpx, cpy);
     99mOpt[0]->AppendItem("Black", 101);
     100mOpt[0]->AppendItem("White", 102);
     101mOpt[0]->AppendItem("Grey", 103);
     102mOpt[0]->AppendItem("Red", 104);
     103mOpt[0]->AppendItem("Blue", 105);
     104mOpt[0]->AppendItem("Green", 106);
     105mOpt[0]->AppendItem("Yellow", 107);
     106mOpt[0]->AppendItem("Magenta", 108);
     107mOpt[0]->SetValue(101);
     108mOpt[0]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
     109
     110cpx += spx+1.75*bsx;
     111mOpt[1] = new PIOptMenu(this, "bwt-opt-1", bsx*1.75, bsy, cpx, cpy);
     112mOpt[1]->AppendItem("NoColor", 200);
     113mOpt[1]->AppendItem("Grey32", 201);
     114mOpt[1]->AppendItem("GreyInv32", 202);
     115mOpt[1]->AppendItem("ColRJ32", 203);
     116mOpt[1]->AppendItem("ColBR32", 204);
     117mOpt[1]->AppendItem("ColRV32", 205);
     118mOpt[1]->AppendItem("Grey128", 206);
     119mOpt[1]->AppendItem("GreyInv128", 207);
     120mOpt[1]->AppendItem("ColRJ128", 208);
     121mOpt[1]->AppendItem("ColBR128", 209);
     122mOpt[1]->AppendItem("Col16", 210);
     123mOpt[1]->SetValue(200);
     124mOpt[1]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
     125
     126
     127cpx = 2*spx;
     128cpy += spy+bsy;
     129mOpt[2] = new PIOptMenu(this, "bwt-opt-2", bsx*1.75, bsy, cpx, cpy);
     130mOpt[2]->AppendItem("Undef-Mrk", 300);
     131mOpt[2]->AppendItem("Mrk Dot(.)", 301);
     132mOpt[2]->AppendItem("Mrk Plus(+)", 302);
     133mOpt[2]->AppendItem("Mrk Cross(x)", 303);
     134mOpt[2]->AppendItem("Mrk Circle", 304);
     135mOpt[2]->AppendItem("Mrk FCircle", 305);
     136mOpt[2]->AppendItem("Mrk Box", 306);
     137mOpt[2]->AppendItem("Mrk FBox", 307);
     138mOpt[2]->AppendItem("Mrk Triangle", 308);
     139mOpt[2]->AppendItem("Mrk FTriangle", 309);
     140mOpt[2]->AppendItem("Mrk Star", 310);
     141mOpt[2]->AppendItem("Mrk FStar", 311);
     142mOpt[2]->SetValue(301);
     143mOpt[2]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
     144
     145cpx += spx+1.75*bsx;
     146mOpt[3] = new PIOptMenu(this, "bwt-opt-3", bsx*1.75, bsy, cpx, cpy);
     147mOpt[3]->AppendItem("Mrk 3 pt", 403);
     148mOpt[3]->AppendItem("Mrk 5 pt", 405);
     149mOpt[3]->AppendItem("Mrk 7 pt", 407);
     150mOpt[3]->AppendItem("Mrk 9 pt", 409);
     151mOpt[3]->AppendItem("Mrk 11 pt", 411);
     152mOpt[3]->AppendItem("Mrk 13 pt", 413);
     153mOpt[3]->AppendItem("Mrk 15 pt", 415);
     154mOpt[3]->SetValue(405);
     155mOpt[3]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
     156
     157cpx = 2*spx;
     158cpy += spy+bsy;
     159mOpt[4] = new PIOptMenu(this, "bwt-opt-4", bsx*1.75, bsy, cpx, cpy);
     160mOpt[4]->AppendItem("Normal-Font", 500);
     161mOpt[4]->AppendItem("Bold-Font", 501);
     162mOpt[4]->AppendItem("Ital-Font", 502);
     163mOpt[4]->AppendItem("Small-Font", 510);
     164mOpt[4]->AppendItem("Small-Bold-Font", 511);
     165mOpt[4]->AppendItem("Small-Ital-Font", 512);
     166mOpt[4]->AppendItem("Big-Font", 521);
     167mOpt[4]->AppendItem("Big-Bold-Font", 522);
     168mOpt[4]->AppendItem("Big-Ital-Font", 523);
     169mOpt[4]->SetValue(500);
     170mOpt[4]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
     171
     172cpx += spx+1.75*bsx;
     173mOpt[5] = new PIOptMenu(this, "bwt-opt-5", bsx*1.75, bsy, cpx, cpy);
     174mOpt[5]->AppendItem("Undef-Line", 600);
     175mOpt[5]->AppendItem("Thin-Line", 601);
     176mOpt[5]->AppendItem("Normal-Line", 602);
     177mOpt[5]->AppendItem("Thick-Line", 603);
     178mOpt[5]->SetValue(601);
     179mOpt[5]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
     180
     181cpx = 2*spx;
     182cpy += spy+bsyo;
     183bsy = bsyo; spy = spyo;
     184mButdr[0] = new PIButton(this, "Dr-", 3501, bsy, bsy, cpx, cpy, PIBtn_ArrowLeft);
     185cpx += bsy+0.25*spy;
     186mNlb = new PILabel(this,"NumDr", bsy, bsy, cpx, cpy);
     187mNlb->SetLabel("0");
     188mNDr = 0;
     189cpx += bsy+0.25*spy;
     190mButdr[1] = new PIButton(this, "Dr+", 3502, bsy, bsy, cpx, cpy, PIBtn_ArrowRight);
     191mButdr[0]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
     192mButdr[1]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
     193mNlb->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
     194
     195cpx += bsy+3*spx;
     196mButcf[0] = new PIButton(this, "SetAtt", 2800, bsx*0.85, bsy, cpx, cpy);
     197cpx += 0.85*bsx+spx;
     198mButcf[1] = new PIButton(this, "Refresh", 2900, bsx*0.85, bsy, cpx, cpy);
     199mButcf[0]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
     200mButcf[1]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
     201
     202cwdrwt = this;
     203
     204}
     205
     206/* --Methode-- */
     207PIDrwTools::~PIDrwTools()
     208{
     209if (cwdrwt == this)  cwdrwt = NULL;
     210for(int i=0; i<2; i++)
     211  {
     212  delete mLab[i];
     213  delete mBut[i];
     214  delete mText[i];
     215  delete mButdr[i];
     216  delete mButcf[i];
     217  }
     218for(int i=0; i<6; i++)  delete mOpt[i];
     219delete mNlb;
     220}
     221
     222/* --Methode-- */
     223void PIDrwTools::Show()
     224{
     225PIWindow::Show();
     226char buff[92];
     227mNDr = 0;
     228if ((mCurBW != NULL) && ( mCurBW->kind() == PIScDrawWdg::ClassId ) ) {
     229  PIScDrawWdg* scd = ( PIScDrawWdg*)mCurBW;
     230  sprintf(buff, "%g  %g", scd->XMin(), scd->XMax());
     231  mText[0]->SetText(buff);
     232  sprintf(buff, "%g  %g", scd->YMin(), scd->YMax());
     233  mText[1]->SetText(buff);
     234  if (scd->NbDrawers() > 1)  mNDr = 1;
     235  }
     236else {
     237  mText[0]->SetText("-1.0  1.0");
     238  mText[1]->SetText("-1.0  1.0");
     239  }
     240sprintf(buff, "%d", mNDr);
     241mNlb->SetLabel(buff);
     242
     243mCkb[0]->SetState(false);
     244mCkb[1]->SetState(false);
     245
     246mOpt[0]->SetValue(101);
     247mOpt[1]->SetValue(200);
     248mOpt[2]->SetValue(301);
     249mOpt[3]->SetValue(405);
     250mOpt[4]->SetValue(500);
     251mOpt[5]->SetValue(601);
     252
    29253return;
    30254}
     255
     256
     257/* --Methode-- */
     258void PIDrwTools::Process(PIMessage msg, PIMsgHandler* /*sender*/, void* /*data*/)
     259{
     260PIColors cols[9] = { PI_NotDefColor, PI_Black, PI_White, 
     261                     PI_Grey, PI_Red, PI_Blue,
     262                     PI_Green, PI_Yellow, PI_Magenta};
     263
     264PIMarker mrk[11] = { PI_DotMarker, PI_PlusMarker, PI_CrossMarker,
     265                     PI_CircleMarker, PI_FCircleMarker,
     266                     PI_BoxMarker, PI_FBoxMarker,
     267                     PI_TriangleMarker, PI_FTriangleMarker,
     268                     PI_StarMarker, PI_FStarMarker };
     269PILineAtt line[4] = { PI_NotDefLineAtt, PI_ThinLine, PI_NormalLine, PI_ThickLine};
     270
     271PIFontAtt fntatt[3] = { PI_RomanFont, PI_BoldFont, PI_ItalicFont };
     272PIFontSize fntsz[3] = { PI_NormalSizeFont, PI_SmallSizeFont, PI_BigSizeFont };
     273CMapId cmap[11] = {  CMAP_OTHER, CMAP_GREY32, CMAP_GREYINV32,
     274                     CMAP_COLRJ32, CMAP_COLBR32, CMAP_COLRV32, 
     275                     CMAP_GREY128, CMAP_GREYINV128, CMAP_COLRJ128, CMAP_COLBR128, CMAP_COL16 };
     276
     277msg = UserMsg(msg);
     278if (msg == 2600)  { Hide(); return; }
     279
     280if (mCurBW == NULL)   return;
     281
     282char strg[64];
     283float xmin, xmax, ymin, ymax;
     284int axrl = kAxeDirLtoR;
     285int ayud = kAxeDirDownUp;
     286int k, kk;
     287
     288switch (msg) {
     289
     290  case 2500 :
     291    sscanf(mText[0]->GetText().c_str(), "%g %g" , &xmin, &xmax);
     292    sscanf(mText[1]->GetText().c_str(), "%g %g" , &ymin, &ymax);
     293    if (mCkb[0]->GetState())  axrl = kAxeDirRtoL ;
     294    if (mCkb[1]->GetState())  ayud = kAxeDirUpDown;
     295    printf("--DBG-- %g-%g , %g-%g , %d %d \n", xmin, xmax, ymin, ymax, axrl, ayud);
     296    if ( mCurBW->kind() == PIScDrawWdg::ClassId ) ((PIScDrawWdg*)mCurBW)-> SetLimits(xmin, xmax, ymin, ymax, axrl, ayud);
     297    else mCurBW->SetDefaultDrawerLimits(xmin, xmax, ymin, ymax, axrl, ayud);
     298    mCurBW->Refresh();
     299    break;
     300
     301  case 2800 :
     302  case 2900 :
     303    {
     304    PIDrawer* drw = mCurBW->GetDrawer(mNDr);
     305    if (drw == NULL)  return;
     306    k = mOpt[0]->GetValue()-100;
     307    if ( (k < 0) || (k > 8) )  k = 0;
     308    drw->SetColAtt(cols[k]);
     309    k = mOpt[1]->GetValue()-200;
     310    if ( (k < 0) || (k > 10) )  k = 0;
     311    drw->SetColMapId(cmap[k]);
     312    k =  mOpt[2]->GetValue()-300;
     313    if ( (k < 0) || (k > 10) )  k = 0;
     314    kk =  mOpt[3]->GetValue()-400;
     315    if ( (kk < 1) || (kk > 27) )  kk = 1;
     316    drw->SetMarkerAtt(kk, mrk[k]);
     317    k =  ((mOpt[4]->GetValue()-500)/10)%3;
     318    kk = (mOpt[4]->GetValue()-500-10*k)%3;
     319    drw->SetFontAtt(fntsz[k], fntatt[kk]);
     320    k =  mOpt[5]->GetValue()-600;
     321    if ( (k < 0) || (k > 3) )  k = 0;
     322    drw->SetLineAtt(line[k]);
     323    if (msg == 2800) drw->Refresh();
     324    else mCurBW->Refresh();
     325    }
     326    break;       
     327
     328  case 3501 :
     329    mNDr--; 
     330    if (mNDr < 0)  mNDr = 0;
     331    sprintf(strg, "%d", mNDr);
     332    mNlb->SetLabel(strg);
     333    break;
     334  case 3502 :
     335    mNDr++; 
     336    if (mNDr >= mCurBW->NbDrawers())  mNDr--;
     337    sprintf(strg, "%d", mNDr);
     338    mNlb->SetLabel(strg);
     339    break;
     340
     341  default :
     342    break;
     343  }
     344
     345return;
     346}
     347
  • trunk/SophyaPI/PI/pidrwtools.h

    r112 r119  
    77
    88#include "pisysdep.h"
    9 #include PIMENU_H
     9#include PISTDWDG_H
     10#include PIOPTMENU_H
     11#include PIWIN_H
    1012#include PIAPP_H
     13#include "pibwdggen.h"
    1114
    12 class PIDrwMenu : public PIMenu
     15// --------- fenetre de dialogue pour modifs axes et options des Drawers ----------
     16// --------------------------------------------------------------------------------
     17
     18
     19class PIDrwTools : public PIWindow
    1320{
    1421public :
    15                         PIDrwMenu(PIApplication* app);
    16  virtual                ~PIDrwMenu();
     22  PIDrwTools(PIApplication* par);
     23  ~PIDrwTools();
     24  virtual void  Show();
     25
     26  static PIDrwTools* curlutw;
     27  static void ShowPIDrwTools();
     28  static void SetCurrentBaseWdg(PIBaseWdgGen* cbw);
     29  static PIBaseWdgGen* GetCurrentBaseWdg();
     30
    1731protected:
    18   virtual void          Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
    19 PIMenu* pdm[2];
     32  virtual void  Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
     33
     34private:
     35// Pour changer les axes
     36  PILabel* mLab[2];
     37  PIButton* mBut[2];
     38  PIText* mText[2];
     39  PICheckBox* mCkb[2];
     40// Pour couleur, fontes, etc
     41  PIOptMenu* mOpt[6];
     42  PILabel* mNlb;
     43  PIButton* mButdr[2];
     44  PIButton* mButcf[2];
     45  int mNDr;
     46  int mtyp, msz;
     47//
     48  static PIBaseWdgGen* mCurBW;
     49  static PIDrwTools* cwdrwt;
    2050};
    2151
  • trunk/SophyaPI/PI/piimage.cc

    r117 r119  
    1212#include "piimage.h"
    1313#include "piimgtools.h"
     14#include "pidrwtools.h"
    1415
    1516// --------------------------------------------------------------------------------
     
    338339  Send(Msg(), PIMsg_Active);
    339340  cur_piimage = this;
     341  PIDrwTools::SetCurrentBaseWdg(this);
    340342  }
    341343if (zow != NULL)   ComputeZoomPixmap();
     
    386388void PIImage::Keyboard(int key, PIKeyModifier kmod)
    387389{
     390cur_piimage = this;
    388391if (kmod == PIKM_Alt) {
    389392  if (key == 'V' || key == 'v') RequestSelection();  // Pour coller (copier/coller) 
    390393  if (key == 'Z' || key == 'z') { mdrw->ElDelAll();  Refresh(); } // Pour supprimer tous les signes
    391   if (key == 'O' || key == 'o') PIImgLutWind::ShowPIImgLutWind();   // Fentre LUT et options
     394  if (key == 'O' || key == 'o') PIImgTools::ShowPIImgTools();   // Fentre LUT et options
    392395  }
    393396
     
    421424Send(Msg(), PIMsg_Active);
    422425cur_piimage = this;
     426PIDrwTools::SetCurrentBaseWdg(this);
    423427if (img == NULL)  return;
    424428if ( PosW2Img(x, y, &xp, &yp) )  return;
     
    460464Send(Msg(), PIMsg_Active);
    461465cur_piimage = this;
     466PIDrwTools::SetCurrentBaseWdg(this);
    462467if (img == NULL)  return;
    463468if ( PosW2Img(x, y, &xpv0, &ypv0) )  {  xmv0 = -1;  return; }
     
    527532Send(Msg(), PIMsg_Active);
    528533cur_piimage = this;
     534PIDrwTools::SetCurrentBaseWdg(this);
    529535if (img == NULL)  return;
    530536if ( PosW2Img(x, y, &xp, &yp) )  { xmv0 = -1;  return; }
     
    583589{
    584590if (typ != PICP_string) return;
    585 int ll = (l<128) ? l+1 : 128;
    586 char pc[128];
     591int ll = (l<256) ? l+1 : 256;
     592char pc[256];
    587593strncpy(pc, (char*)pdata, ll-1);  pc[ll-1] = '\0';
    588594float fx, fy;
  • trunk/SophyaPI/PI/piimgtools.cc

    r118 r119  
    66
    77#include "piimgtools.h"
    8 #include PISTDWDG_H
    9 #include PIOPTMENU_H
    108#include "piimage.h"
    119
    1210// ------ Menu des options et fenetre de dialogue pour changement de LUT --------
    1311
    14 PIImgLutWind* PIImgLutWind::curlutw = NULL;
    15 /* --Methode-- */
    16 void PIImgLutWind::ShowPIImgLutWind()
    17 {
    18 if (curlutw == NULL)  curlutw = new PIImgLutWind(PIApplicationGetApp());
     12PIImgTools* PIImgTools::curlutw = NULL;
     13/* --Methode-- */
     14void PIImgTools::ShowPIImgTools()
     15{
     16if (curlutw == NULL)  curlutw = new PIImgTools(PIApplicationGetApp());
    1917curlutw->Show();
    2018}
    2119
    2220/* --Methode-- */
    23 PIImgLutWind::PIImgLutWind(PIApplication* par)
     21PIImgTools::PIImgTools(PIApplication* par)
    2422: PIWindow((PIMsgHandler*)par, "PIImageTools", PIWK_dialog, 240, 240, 150, 150)
    2523{
     
    9189
    9290int offy = cpy+bsy+spy*2;
    93 // printf("-DBG- PIImgLutWind()  SzX,Y= %d %d , ButPos= %d %d (off=%d)\n", wszx, wszy, cpx, cpy, offy);
     91// printf("-DBG- PIImgTools()  SzX,Y= %d %d , ButPos= %d %d (off=%d)\n", wszx, wszy, cpx, cpy, offy);
    9492
    9593cpx = 4*spx+2.75*bsx;
     
    198196
    199197/* --Methode-- */
    200 PIImgLutWind::~PIImgLutWind()
     198PIImgTools::~PIImgTools()
    201199{
    202200if (curlutw == this)  curlutw = NULL;
     
    218216
    219217/* --Methode-- */
    220 void PIImgLutWind::Show()
     218void PIImgTools::Show()
    221219{
    222220char buff[32];
     
    245243
    246244/* --Methode-- */
    247 void PIImgLutWind::Process(PIMessage msg, PIMsgHandler* /*sender*/, void* /*data*/)
     245void PIImgTools::Process(PIMessage msg, PIMsgHandler* /*sender*/, void* /*data*/)
    248246{
    249247float min, max, del;
     
    357355
    358356  default:
    359 //    printf("PIImgLutWind::Process Msg %d received \n", (int)msg);
     357//    printf("PIImgTools::Process Msg %d received \n", (int)msg);
    360358    break;
    361359  }
  • trunk/SophyaPI/PI/piimgtools.h

    r118 r119  
    1515// --------------------------------------------------------------------------------
    1616
    17 class PIImgLutWind : public PIWindow {
     17class PIImgTools : public PIWindow {
    1818public :
    19   PIImgLutWind(PIApplication* par);
    20   ~PIImgLutWind();
     19  PIImgTools(PIApplication* par);
     20  ~PIImgTools();
    2121  virtual void  Show();
    2222
    23   static PIImgLutWind* curlutw;
    24   static void ShowPIImgLutWind();
     23  static PIImgTools* curlutw;
     24  static void ShowPIImgTools();
    2525protected:
    2626  virtual void  Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
  • trunk/SophyaPI/PI/pintuple.h

    r107 r119  
    33
    44#include "ntuple.h"
    5 #include "piscdrawwdg.h"
     5#include "pidrawer.h"
    66
    77class PINTuple : public PIDrawer {
  • trunk/SophyaPI/PI/piscdrawwdg.cc

    r113 r119  
    1 #include "generalfit.h"
    21#include "piscdrawwdg.h"
     2#include "pidrwtools.h"
    33
    44PIScDrawWdg::PIScDrawWdg(PIContainerGen *par, char *nom,
     
    1717  mTrW = NULL;
    1818  SetTextWin(NULL);
     19
     20  ActivateKeyboard();
    1921  ActivateButton(1);    // Pour pouvoir activer la fenetre et coordonnees
    2022  ActivateMove(1);      //    "         "         "        "
     
    3032}
    3133
     34void
     35PIScDrawWdg::Keyboard(int key, PIKeyModifier kmod)
     36{
     37if (kmod == PIKM_Alt) {
     38  if (key == 'V' || key == 'v') RequestSelection();  // Pour coller (copier/coller) 
     39  if (key == 'Z' || key == 'z') { mBDrw->ElDelAll();  Refresh(); } // Pour supprimer tous les signes
     40  if (key == 'O' || key == 'o') {
     41    PIDrwTools::SetCurrentBaseWdg(this);
     42    PIDrwTools::ShowPIDrwTools();   // Fentre axes et
     43    }
     44  }
     45}
     46void
     47PIScDrawWdg::PasteSelection(unsigned int typ, void *pdata, unsigned int l)
     48{
     49if (typ != PICP_string) return;
     50int ll = (l<256) ? l+1 : 256;
     51char pc[256];
     52strncpy(pc, (char*)pdata, ll-1);  pc[ll-1] = '\0';
     53mBDrw->ElAddText(mPPos[0], mPPos[1], pc );
     54mBDrw->Refresh();
     55}
    3256
    3357void
     
    3862    return; // $CHECK$ exception ?
    3963  SetDefaultDrawerLimits(xmin, xmax, ymin, ymax, axrl, ayud);
     64  mBDrw->SetLimits(xmin, xmax, ymin, ymax, axrl, ayud);
    4065  mPPos[0] = 0.5*(XMin()+XMax());
    4166  mPPos[1] = 0.5*(YMin()+YMax());
     
    83108
    84109
    85 /*
    86 void
    87 PIScDrawWdg::Draw(PIGraphic* g)
    88 {
    89   EraseWindow();
    90   if (! LimitsFixed() ) {  //  On met a jour les limites a partir du premier Drawer
    91     PIDrawer* drw = GetDrawer(1);
    92     if (drw != NULL)   {   
    93       drw->UpdateSize();
    94       SetLimits(drw->XMin(), drw->XMax(), drw->YMin(), drw->YMax());
    95       }
    96     else SetLimits(0., 1., 0., 1.);
    97     }
    98 }
    99 
    100 void
    101 PIScDrawWdg::Draw(PIGraphic* g, int x0, int y0, int dx, int dy)
    102 {
    103 //  EraseWindow();
    104   if (! LimitsFixed() ) {  //  On met a jour les limites a partir du premier Drawer
    105     PIDrawer* drw = GetDrawer(1);
    106     if (drw != NULL)   {   
    107       drw->UpdateSize();
    108       SetLimits(drw->XMin(), drw->XMax(), drw->YMin(), drw->YMax());
    109       }
    110     else SetLimits(0., 1., 0., 1.);
    111     }
    112 }
    113 */
    114110
    115111// Gestion affichage coordonnees du point
     
    140136     }
    141137  Send(Msg(), PIMsg_Active);
    142 
     138  PIDrwTools::SetCurrentBaseWdg(this);
    143139}
    144140
     
    191187  mWGrC->SelLine(PI_ThinLine);
    192188  Send(Msg(), PIMsg_Active);
     189  PIDrwTools::SetCurrentBaseWdg(this);
    193190}
    194191
     
    228225
    229226
    230 //================================================================
    231 // PIFuncDrawer
    232 //================================================================
    233 
    234 PIFuncDrawer::PIFuncDrawer(PIFuncDrawer::FUNC f)
    235 : mFunc(f)
    236 {}
    237 
    238 PIFuncDrawer::~PIFuncDrawer()
    239 {
    240 }
    241 
    242 void
    243 PIFuncDrawer::Draw(PIGraphicUC* g, float /*xmin*/, float/*ymin*/, float/*xmax*/, float/*ymax*/)
    244 {
    245   PIGrCoord x1, x2, y1, y2;
    246   g->GetGrSpace(x1, x2, y1, y2);
    247   float xMax = x2;
    248   float xMin = x1;
    249   float yMax = y2;
    250   float yMin = y1;
    251   float xStep = (xMax - xMin)/100;
    252   float xOld = xMin;
    253   float yOld = mFunc(xMin);
    254   for (float x = xMin+xStep; x<xMax; x+=xStep) {
    255     double y = mFunc(x);
    256     if (y>yMin && yOld>yMin &&
    257         y<yMax && yOld<yMax)
    258            g->DrawLine(xOld, yOld, x, y);
    259     xOld = x;
    260     yOld = y;
    261   }
    262 }
    263 
    264 //================================================================
    265 // PIGFFDrawer
    266 //================================================================
    267 
    268 PIGFFDrawer::PIGFFDrawer(GeneralFunction* f)
    269 : mFunc(f), mNParms(f->NPar()), mParms(new double[mNParms])
    270 {
    271   ASSERT(f->NVar() == 1);
    272 }
    273 
    274 PIGFFDrawer::~PIGFFDrawer()
    275 {
    276   delete[] mParms;
    277 }
    278 
    279 void
    280 PIGFFDrawer::SetParms(double const* p)
    281 {
    282   for (int i=0; i<mNParms; i++)
    283     mParms[i] = p[i];
    284 }
    285 
    286 
    287 void
    288 PIGFFDrawer::Draw(PIGraphicUC* g, float /*xmin*/, float/*ymin*/, float/*xmax*/, float/*ymax*/)
    289 {
    290   PIGrCoord x1, x2, y1, y2;
    291   g->GetGrSpace(x1, x2, y1, y2);
    292   float xMax = x2;
    293   float xMin = x1;
    294   float yMax = y2;
    295   float yMin = y1;
    296   float xStep = (xMax - xMin)/100;
    297   float xOld = xMin;
    298   float yOld = 0;
    299 //  float yOld = f->Value(&xMin, mParms);
    300   for (float x = xMin+xStep; x<xMax; x+=xStep) {
    301    float y = 0; // $CHECK$
    302 //    float y = f->Value(&x, mParms);
    303     if (y>yMin && yOld>yMin &&
    304         y<yMax && yOld<yMax)
    305            g->DrawLine(xOld, yOld, x, y);
    306     xOld = x;
    307     yOld = y;
    308   }
    309 }
    310 
  • trunk/SophyaPI/PI/piscdrawwdg.h

    r113 r119  
    1111
    1212
    13 
    14 
    1513class PIScDrawWdg : public PIBaseWdg {
    1614public:
     
    2321  virtual long       kind() {return ClassId; }
    2422 
    25 //  virtual void       Draw(PIGraphic* g);
    26 //  virtual void       Draw(PIGraphic* g, int x0, int y0, int dx, int dy);
     23  virtual void       Keyboard(int key, PIKeyModifier kmod);
     24  virtual void       PasteSelection(unsigned int typ, void *pdata, unsigned int l);
    2725 
    2826  void               SetLimits(float xmin, float xmax, float ymin, float ymax,
     
    7876
    7977
    80 class PIFuncDrawer : public PIDrawer {
    81 public:
    82   typedef double(*FUNC)(double);
    83                      PIFuncDrawer(FUNC);
    84   virtual           ~PIFuncDrawer();
    85  
    86   virtual void       Draw(PIGraphicUC* g, float xmin, float ymin, float xmax, float ymax);
    87 protected:
    88   FUNC               mFunc;
    89 };
    90 
    91 class GeneralFunction;
    92 class PIGFFDrawer : public PIDrawer {
    93 public:
    94                      PIGFFDrawer(GeneralFunction*);
    95   virtual           ~PIGFFDrawer();
    96  
    97   virtual void       Draw(PIGraphicUC* g, float xmin, float ymin, float xmax, float ymax);
    98   virtual void       SetParms(double const*);
    99 protected:
    100   GeneralFunction*    mFunc;
    101   int                 mNParms;
    102   double*             mParms;
    103 };
    104 
    105 
    10678#endif
  • trunk/SophyaPI/PI/pistlist.cc

    r107 r119  
    44 
    55/* --Methode-- */
    6 PIStarList::PIStarList(StarList* stl, bool ad, int ayud)
     6PIStarList::PIStarList(StarList* stl, bool ad)
    77: PIDrawer(), mStL(stl)
    88{
    99  mAdDO = ad;   
    10   mAYdir = ayud; 
    1110  if (stl == NULL) return;
    1211  SetFluxLimits(1., -1.);
    13   SetXYLimits(1., -1., 1., -1.);
    1412}
    1513
     
    2018
    2119/* --Methode-- */
    22 void  PIStarList::SetFluxLimits(float fmin, float fmax, int nl, int msz0, bool refr)
     20void  PIStarList::SetFluxLimits(float fmin, float fmax, int nl, bool dispflx, bool refr)
    2321{
    2422  if (!mStL)  return; 
     
    3230  if (nl > 20)  nl = 20;
    3331  mNLev = nl; 
    34   if (msz0 < 0)  msz0 = 0;
    35   if (msz0 > 10)  msz0 = 10;
    36   mMSz0 = msz0;
     32  mDspFV = dispflx;
    3733  if (refr)  Refresh();
    3834  return;
    3935}
    40 
    41 /* --Methode-- */
    42 void  PIStarList::SetXYLimits(float xmin, float xmax, float ymin, float ymax, bool dfv, bool refr)
    43 {
    44   if (!mStL)  return; 
    45   if ((xmin < xmax) && (ymin < ymax)) {
    46     mXMin = xmin; mXMax = xmax; mYMin = ymin; mYMax = ymax;
    47     }
    48   else {
    49     double x1, x2, y1, y2;
    50     mStL->CalcXYLimits(x1, x2, y1, y2);
    51     mXMin = (float)x1; mXMax = (float)x2; mYMin = (float)y1; mYMax = (float)y2;
    52     }
    53   mDspFV = dfv;
    54   if (refr)  Refresh();
    55   return;   
    56 
    5736
    5837
     
    6443  // Commencer par trouver nos limites
    6544  float dx, dy;
     45  double x1, x2, y1, y2;
     46  mStL->CalcXYLimits(x1, x2, y1, y2);
    6647 
    67   dx = 0.02*(mXMax-mXMin);
    68   dy = 0.02*(mYMax-mYMin);
     48  dx = 0.02*(x2-x1);
     49  dy = 0.02*(y2-y1);
    6950 
    70   SetLimits(mXMin-dx, mXMax+dx, mYMin-dy, mYMax+dy, kAxeDirLtoR, mAYdir);
     51  SetLimits(x1-dx, x2+dx, y1-dy, y2+dy);
    7152  SetAxesFlags(kBoxAxes | kExtTicks | kLabels);
    7253}
     
    8465if (!mStL) return;
    8566
     67int msz = mMSz;
     68if (msz < 1) msz = 1;
     69
    8670g->SelFont();
    8771nok = 0;  nl2 = mNLev*2-1;
     
    9276  if ( (flx < mFmin) || (flx > mFmax) )  continue;
    9377  xp = sti->PosX();   yp = sti->PosY();
    94   if ( (xp < mXMin) || (xp > mXMax) || (yp < mYMin) || (yp > mYMax) )  continue;
    9578  if ( (xp < xmin) || (xp > xmax) || (yp < ymin) || (yp > ymax) )  continue;
    9679  nok++;
    97   sz = (int)((log10((double)flx/mF0))/mDLgF*(double)nl2-0.01) + mMSz0;
     80  sz = (int)((log10((double)flx/mF0))/mDLgF*(double)nl2-0.01) + msz;
    9881  if (sz < 2)  g->SelMarker(sz, PI_DotMarker);
    9982  else g->SelMarker(sz, PI_FCircleMarker);
  • trunk/SophyaPI/PI/pistlist.h

    r107 r119  
    77class PIStarList : public PIDrawer {
    88public:
    9                      PIStarList(StarList* stl, bool ad, int ayud=kAxeDirUpDown);
     9                     PIStarList(StarList* stl, bool ad);
    1010  virtual           ~PIStarList();
    1111 
     
    1313  virtual void       UpdateSize();
    1414 
    15   void               SetFluxLimits(float min=1., float max=-1., int nl=5,
    16                                    int msz0=0, bool refr=false);
    17   void               SetXYLimits(float xmin=1., float xmax=-1., float ymin=1., float ymax=-1.,
    18                                  bool dfv=false, bool refr=false);             
     15  void               SetFluxLimits(float min=1., float max=-1., int nl=5, bool dispflx=false, bool refr=false);
    1916
    2017  inline StarList*   StList()  { return(mStL); } 
    21   inline float       XMin()    { return(mXMin); }       
    22   inline float       XMax()    { return(mXMax); }       
    23   inline float       YMin()    { return(mYMin); }       
    24   inline float       YMax()    { return(mYMax); }       
    2518  inline float       FluxMin() { return(mFmin); }       
    2619  inline float       FluxMax() { return(mFmax); }
     
    3023  bool mAdDO;
    3124  float mFmin, mFmax;
    32   int mNLev, mMSz0;
     25  int mNLev;
    3326  double mF0, mDLgF;
    34   float mXMin, mXMax;
    35   float mYMin, mYMax;
    3627  bool mDspFV;
    37   int  mAYdir;
    38 
    3928};
    4029
Note: See TracChangeset for help on using the changeset viewer.