Changeset 535 in Sophya for trunk/SophyaPI


Ignore:
Timestamp:
Nov 1, 1999, 11:54:32 PM (26 years ago)
Author:
ercodmgr
Message:

Amelioration pour PIGraphUC/Echelle Log et documentation - Reza 1/11/99

Location:
trunk/SophyaPI/PI
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaPI/PI/pibwdggen.cc

    r505 r535  
    338338mDrXmin = xmin;   mDrXmax = xmax;
    339339mDrYmin = ymin;   mDrYmax = ymax;
    340 mDXdir = axrl;    mDYdir = ayud;
     340if ( (axrl != kAxeDirSame) && (axrl != kAxeDirAuto) )  mDXdir = axrl;   
     341if ( (ayud != kAxeDirSame) && (ayud != kAxeDirAuto) )  mDYdir = ayud;
    341342}
    342343
  • trunk/SophyaPI/PI/picmapview.cc

    r316 r535  
    55#include "picmapview.h"
    66
     7//++
     8// Class        PICMapView
     9// Lib          PI
     10// include      picmapview.h
     11//
     12//      Classe permettant la visualisation d'une table de couleur.
     13//--
     14//++
     15// Links        Voir aussi
     16// PIColorMap
     17//--
     18
     19//++
     20// Titre        Constructeur
     21//--
     22//++
     23//  PICMapView(PIContainerGen *par, char *nom, int sx=256, int sy=10, int px=0, int py=0);
     24//      Constructeur - Le choix d'affichage (vertical ou horizontal) dépend
     25//      du rapport des tailles "sx", "sy"
     26//--
    727
    828
     
    2444}
    2545
     46
     47
     48//++
     49// Titre        Méthodes
     50//--
     51//++
     52// long  kind()
     53//      Retourne PICMapView::ClassId .
     54// void   SetColMap(PIColorMap* cmp=NULL, float min=1., float max=-1., bool refr=true)
     55//      Choix de la table de couleur et valeurs min et max. Si "refr==true",
     56//      la méthode "Refresh()" est appelée.
     57// void  SetColMapId(CMapId cmapid, float min=1., float max=-1., bool refr=true)
     58//      Choix de la table de couleur en utilisant le "CMapId" et
     59//      définition des valeurs min et max. Si "refr==true",
     60//      la méthode "Refresh()" est appelée.
     61//--
    2662 
    2763/* --Methode-- */
  • trunk/SophyaPI/PI/pidrawer.cc

    r505 r535  
    308308PIDrawer::CalcTicks()
    309309{
    310   BestTicks(xMin,xMax,7,xMajTickStep);
     310  int ntick_x = (aXlog) ? 4 : 7;
     311  BestTicks(xMin,xMax,ntick_x,xMajTickStep);
    311312  xMinTickStep = xMajTickStep/5;
    312313  xFirstMajTick = int(xMin / xMajTickStep) * xMajTickStep;
     
    315316  if (xFirstMinTick < xMin) xFirstMinTick += xMinTickStep;
    316317
    317   BestTicks(yMin,yMax,12,yMajTickStep);
     318  int ntick_y = (aYlog) ? 6 : 12;
     319  BestTicks(yMin,yMax,ntick_y,yMajTickStep);
    318320  yMinTickStep = yMajTickStep/5;
    319321  yFirstMajTick = int(yMin / yMajTickStep) * yMajTickStep;
     
    439441    if (flags & kLabels) {
    440442      if (!aYdir) {
    441         DrawHLabels(g, yMin-xMajTickLen*8, xFirstMajTick, xMajTickStep,0);
    442         DrawHLabels(g, yMax+xMajTickLen*2, xFirstMajTick, xMajTickStep,0);
     443        DrawHLabels(g, g->DeltaUCY(yMin, -xMajTickLen*8), xFirstMajTick, xMajTickStep,0);
     444        DrawHLabels(g, g->DeltaUCY(yMax,  xMajTickLen*2), xFirstMajTick, xMajTickStep,0);
    443445      }
    444446      else {
    445         DrawHLabels(g, yMin-xMajTickLen*2, xFirstMajTick, xMajTickStep,0);
    446         DrawHLabels(g, yMax+xMajTickLen*8, xFirstMajTick, xMajTickStep,0);
     447        DrawHLabels(g, g->DeltaUCY(yMin, -xMajTickLen*2), xFirstMajTick, xMajTickStep,0);
     448        DrawHLabels(g, g->DeltaUCY(yMax,  xMajTickLen*8), xFirstMajTick, xMajTickStep,0);
    447449      }
    448450      if (!aXdir) {
    449         DrawVLabels(g, xMin-yMajTickLen*2, yFirstMajTick, yMajTickStep,1);
    450         DrawVLabels(g, xMax+yMajTickLen*2, yFirstMajTick, yMajTickStep,-1);
     451        DrawVLabels(g, g->DeltaUCX(xMin, -yMajTickLen*2), yFirstMajTick, yMajTickStep,1);
     452        DrawVLabels(g, g->DeltaUCX(xMax,  yMajTickLen*2), yFirstMajTick, yMajTickStep,-1);
    451453      }
    452454      else {
    453         DrawVLabels(g, xMin-yMajTickLen*2, yFirstMajTick, yMajTickStep,-1);
    454         DrawVLabels(g, xMax+yMajTickLen*2, yFirstMajTick, yMajTickStep,1);
     455        DrawVLabels(g, g->DeltaUCX(xMin, -yMajTickLen*2), yFirstMajTick, yMajTickStep,-1);
     456        DrawVLabels(g, g->DeltaUCX(xMax,  yMajTickLen*2), yFirstMajTick, yMajTickStep,1);
    455457      }
    456458    }
     
    478480{
    479481  for (double x=xBeg; x<=xMax; x += xStep)
    480     g->DrawLine(x, y-tickDown, x, y+tickUp);
     482    g->DrawLine(x, g->DeltaUCY(y, -tickDown), x, g->DeltaUCY(y, tickUp));
    481483}
    482484
     
    485487{
    486488  for (double y=yBeg; y<=yMax; y += yStep)
    487     g->DrawLine(x-tickLeft, y, x+tickRight, y);
     489    g->DrawLine(g->DeltaUCX(x, -tickLeft), y, g->DeltaUCX(x,tickRight), y);
    488490}
    489491
     
    509511        xOffset = 0;
    510512      if (aXdir)  xOffset = -xOffset;
    511       g->DrawString(x+xOffset, y, label);
     513      g->DrawString(g->DeltaUCX(x,xOffset), y, label);
    512514  }
    513515}
     
    530532        xOffset = 0;
    531533      if (aXdir)  xOffset = -xOffset;
    532       g->DrawString(x+xOffset, y, label);
     534      g->DrawString(g->DeltaUCX(x, xOffset), y, label);
    533535  }
    534536}
     
    597599  if ( titleT.length() > 0) {
    598600      fx = g->CalcStringWidth(titleT.c_str());
    599       if(aXdir) fx = XMax()-(XMax()-XMin()-fx)/2.;
    600       else fx = XMin()+(XMax()-XMin()-fx)/2.;
    601       if (aYdir) fy = YMin()-fh;
    602       else fy = YMax()+fh;
     601      if(aXdir) fx = g->DeltaUCX(XMax(), -(XMax()-XMin()-fx)/2.);
     602      else fx = g->DeltaUCX(XMin(), (XMax()-XMin()-fx)/2.);
     603      if (g->isAxeYDirUpDown()) fy = g->DeltaUCY(YMin(), -fh);
     604      else fy = g->DeltaUCY(YMax(), fh);
    603605      g->DrawString(fx, fy, titleT.c_str());
    604606//      printf(" PIElDrawer::Draw()/DBG (%g , %g) %s  - %g \n", fx, fy, titleT.c_str(), fh);
     
    606608  if ( titleB.length() > 0) {
    607609      fx = g->CalcStringWidth(titleB.c_str());
    608       if(aXdir) fx = XMax()-(XMax()-XMin()-fx)/2.;
    609       else fx = XMin()+(XMax()-XMin()-fx)/2.;
    610       if (aYdir) fy =  YMax()+fh*1.5;
    611       else fy = YMin()-fh*1.5;
     610      if(aXdir) fx = g->DeltaUCX(XMax(), -(XMax()-XMin()-fx)/2.);
     611      else fx = g->DeltaUCX(XMin(), (XMax()-XMin()-fx)/2.);
     612      if (g->isAxeYDirUpDown()) fy =  g->DeltaUCY(YMax(), fh*1.5);
     613      else fy = g->DeltaUCY(YMin(), -fh*1.5);
    612614      g->DrawString(fx, fy, titleB.c_str());
    613615//      printf(" PIElDrawer::Draw()/DBG (%g , %g) %s  - %g \n", fx, fy, titleT.c_str(), fh);
  • trunk/SophyaPI/PI/pigraphuc.cc

    r505 r535  
    120120// bool  isLogScaleY()
    121121//      Renvoie "true" si échelle logarithmique pour l'axe X,Y
     122// bool  isAxeXDirRtoL()
     123//      Renvoie "true" si axe X de droite a gauche
     124// bool  isAxeYDirUpDown()
     125//      Renvoie "true" si axe Y de haut vers vbas.
    122126//     
    123127// void  UC2GrC(double x, double y, double& xpix, double& ypix)
     
    132136//      Transformation de distances selon X,Y dans l'espace graphique de départ en distance
    133137//      dans l'espace de  coordonnées utilisateur.
     138//
     139// void  LinUC2GrC(double x, double y, double& xpix, double& ypix)
     140//      Transformation de coordonnées utilisateur "(x,y)" en coordoonnées
     141//      de l'espace graphic de départ "(xpix, ypix)", sans utilisation de
     142//      l'échelle logarithmique.
     143// double  DeltaUCX(double x, double dx)
     144//      Retourne la nouvelle coordonnée X, correspondant a "x" décalée de
     145//      "dx", avec "dx" exprimé en échelle linéaire.
     146// double  DeltaUCY(double y, double dy)
     147//      Retourne la nouvelle coordonnée Y, coorespondant a "y" décalée de
     148//      "dy", avec "dy" exprimé en échelle linéaire.
    134149//--
    135150
     
    218233  }
    219234  else xOrgLog   = -log10(xMinLog) * xScaleLog + (xOrg + xMinLog*xScale);
     235  //  if (xMinLog > xMin)
     236  //    cerr << "PIGraphicUC::SetLogScale() Warning - Linear Scale for X < " << xMinLog << endl;
    220237}
    221238else {
     
    233250    }
    234251  else yOrgLog   = -log10(yMinLog) * yScaleLog + (yOrg + yMinLog*yScale);
     252  //  if (yMinLog > yMin)
     253  //    cerr << "PIGraphicUC::SetLogScale() Warning - Linear Scale for Y < " << yMinLog << endl;
    235254
    236255else {
     
    293312  if (dy < 0.) dy = -dy;
    294313}
     314
     315/* --Methode-- */
     316void PIGraphicUC::LinUC2GrC(double x, double y, double& xpix, double& ypix)
     317{
     318  xpix = (double)(xOrg + x*xScale); 
     319  ypix = (double)(yOrg + y*yScale); 
     320}
     321
     322/* --Methode-- */
     323double PIGraphicUC::DeltaUCX(double x, double dx)
     324{
     325  if (!aXlog) return(x+dx);
     326  double xpix, dxpix, tmp, ret;
     327  UC2GrC(x, yMin, xpix, tmp);
     328  DUC2GrC(dx, 0., dxpix, tmp);
     329  if ( ((dx < 0.) && !aXdir) || ((dx >= 0.) && aXdir) )  dxpix = -dxpix;
     330  GrC2UC(xpix+dxpix, yW0, ret, tmp);
     331  return(ret); 
     332}
     333
     334/* --Methode-- */
     335double PIGraphicUC::DeltaUCY(double y, double dy)
     336{
     337  if (!aYlog) return(y+dy);
     338  double ypix, dypix, tmp, ret;
     339  UC2GrC(xMin, y, tmp, ypix);
     340  DUC2GrC(0, dy, tmp, dypix);
     341  if ( ((dy < 0.) && aYdir) || ((dy >= 0.) && !aYdir) )  dypix = -dypix;
     342  GrC2UC(xW0, ypix+dypix, tmp, ret);
     343  return(ret); 
     344}
     345
     346
    295347
    296348/* --Methode-- */
  • trunk/SophyaPI/PI/pigraphuc.h

    r505 r535  
    3838  inline  bool       isLogScaleX() { return aXlog; }
    3939  inline  bool       isLogScaleY() { return aYlog; }
     40  inline  bool       isAxeXDirRtoL()   { return aXdir; }
     41  inline  bool       isAxeYDirUpDown() { return aYdir; }
    4042
    4143//  Trace graphiques
     
    105107  virtual void       DUC2GrC(double dx, double dy, double& dxpix, double& dypix);
    106108  virtual void       DGrC2UC(double dxpix, double dypix, double& dx, double& dy);
     109  virtual void       LinUC2GrC(double x, double y, double& xpix, double& ypix);
     110  virtual double     DeltaUCX(double x, double dx);
     111  virtual double     DeltaUCY(double y, double dy);
    107112
    108113  void   NoClip() {clip = false; }
  • trunk/SophyaPI/PI/piimage.cc

    r485 r535  
    5757
    5858//++
    59 // Titre        Constructeurs, méthodes
     59// Titre        Constructeurs
    6060//--
    6161//++
  • trunk/SophyaPI/PI/pioptmenugen.cc

    r329 r535  
     1// Module PI : Peida Interactive     PIOptMenu
     2// Menu a option                                96-97
     3// LAL (Orsay) / IN2P3-CNRS  DAPNIA/SPP (Saclay) / CEA
     4
    15#include "pioptmenugen.h"
    26
     7//++
     8// Class        PIOptMenu
     9// Lib          PI
     10// include      pioptmenugen.h
     11//
     12//      Composant graphique de type menu à options.
     13//      "PIOptMenuGen" définit l'interface (classe virtuelle pure). Les objets
     14//      instanciés doivent être de la classe "PIOptMenu" déclarée dans le fichier
     15//      entête "PIOPTMENU_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//++
     21// Links        Parents
     22// PIWdg
     23//--
     24//++
     25// Links        Voir aussi
     26// PIMenu
     27//--
     28
     29//++
     30// Titre        Constructeurs
     31//--
     32//++
     33// PIOptMenuGen(PIContainerGen* par, const char* nom, int sx=50, int sy=15, int px=0, int py=0)
     34//      Constructeur.
     35//--
    336
    437PIOptMenuGen::PIOptMenuGen(PIContainerGen* par, const char* nom, int sx, int sy, int px, int py)
     
    1043{}
    1144
     45//++
     46// Titre        Méthodes
     47//--
    1248
     49//++
     50// long  kind()
     51//      Retourne PIOptMenuGen::ClassId
     52// PIMenu*  Menu()
     53//      Retourne le menu associé.
     54// void  AppendItem(const char* nom, PIMessage msg)
     55//      Permet d'ajouter une option au menu.
     56// string  GetValueStr()
     57//      Retourne la chaine de caracteres correspondant au choix courant.
     58// PIMessage  GetValue()
     59//      Retourne le message correspondant au choix courant.
     60// void  SetValueStr(string & s)
     61//      Permet de sélectionner l'option correspondant a la chaine "s".
     62// void  SetValue(PIMessage msg)
     63//      Permet de sélectionner l'option correspondant au message "msg".
     64//--
     65
     66
  • trunk/SophyaPI/PI/piscdrawwdg.cc

    r505 r535  
    167167  if (d == NULL) return;
    168168  d->UpdateLimits();
    169   SetLimits(d->XMin(), d->XMax(), d->YMin(), d->YMax());
     169  SetLimits(d->XMin(), d->XMax(), d->YMin(), d->YMax(), mDXdir, mDYdir);
    170170  Refresh();
    171171  return; 
     
    178178  if (! LimitsFixed() ) {  //  On met a jour les limites
    179179    d->UpdateLimits();
    180     SetLimits(d->XMin(), d->XMax(), d->YMin(), d->YMax());
     180    SetLimits(d->XMin(), d->XMax(), d->YMin(), d->YMax(), mDXdir, mDYdir);
    181181  }
    182182  return(AddDrawer(d, true, ad));
Note: See TracChangeset for help on using the changeset viewer.