Changeset 2003 in Sophya for trunk


Ignore:
Timestamp:
May 15, 2002, 5:24:19 PM (23 years ago)
Author:
ansari
Message:

Amelioration protection de PIDrawer::SetLimits() et PIGraphicUC::SetUCS() pour xmax-xmin petits - Reza 15/5/2002

Location:
trunk/SophyaPI/PI
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaPI/PI/Makefile

    r1904 r2003  
    8989 piwdggen.h pimsghandler.h picolist.h
    9090$(OBJ)pidrawer.o: pidrawer.cc $(INC)machdefs.h \
    91  pidrawer.h pibwdggen.h pisysdep.h piwdgx.h piwdggen.h pimsghandler.h \
    92  picolist.h picmap.h picmapx.h picmapgen.h pigraphx.h pigraphgen.h \
    93  pifontx.h pifontgen.h pigraphuc.h pievthandler.h psfile.h pigratt.h \
    94  pidrwtools.h pistdwdgx.h pistdwdggen.h pioptmenux.h pioptmenugen.h \
    95  pimenux.h pimenugen.h piwindowx.h piwindowgen.h picontainerx.h \
    96  picontainergen.h piapplx.h piapplgen.h pimenubarx.h pimenubargen.h \
    97  picons.h pibwdgx.h pigraphps.h
     91 $(INC)utilgeom.h pidrawer.h pibwdggen.h \
     92 pisysdep.h piwdgx.h piwdggen.h pimsghandler.h picolist.h picmap.h \
     93 picmapx.h picmapgen.h pigraphx.h pigraphgen.h pifontx.h pifontgen.h \
     94 pigraphuc.h pievthandler.h psfile.h pigratt.h pidrwtools.h \
     95 pistdwdgx.h pistdwdggen.h pioptmenux.h pioptmenugen.h pimenux.h \
     96 pimenugen.h piwindowx.h piwindowgen.h picontainerx.h picontainergen.h \
     97 piapplx.h piapplgen.h pimenubarx.h pimenubargen.h picons.h pibwdgx.h \
     98 pigraphps.h ucckprot.h
    9899$(OBJ)pidrawwin.o: pidrawwin.cc pidrawwin.h pisysdep.h \
    99100 $(INC)machdefs.h piwindowx.h piwindowgen.h \
     
    154155 pigraphuc.h pisysdep.h pigraphgen.h piwdgx.h piwdggen.h \
    155156 pimsghandler.h picolist.h picmap.h picmapx.h picmapgen.h pifontx.h \
    156  pifontgen.h
     157 pifontgen.h ucckprot.h
    157158$(OBJ)pigraphx.o: pigraphx.cc pigraphx.h pisysdep.h \
    158159 $(INC)machdefs.h pigraphgen.h piwdgx.h \
  • trunk/SophyaPI/PI/pidrawer.cc

    r1974 r2003  
    1212#include "pidrwtools.h"
    1313
    14 #include <math.h>
    15 //  Pour la declaration de finite() isnan() ...
    16 #if defined(SunOS)
    17 #include <ieeefp.h>
    18 #endif
     14#include "ucckprot.h"
    1915
    2016//++
     
    128124//    return;
    129125//    }
    130 #if defined(OSF1) || defined(SunOS) || (defined(Linux) && !defined(__KCC__) )
    131   if (!finite(xmin) || !finite(xmax) || !finite(ymin) || !finite(ymax)) {
     126 
     127  if (!UC_CheckFinite(xmin, xmax) || !UC_CheckFinite(ymin, ymax)) {
    132128    cerr << "PIDrawer::SetLimits() Error - Non finite value for x/ymin-max ! " << endl;
    133129    return;
    134130    }
    135 #endif
     131
    136132  if (axrl == kAxeDirLtoR)  aXdir = false;
    137133  else if (axrl == kAxeDirRtoL)  aXdir = true;
    138134  if (ayud == kAxeDirDownUp)  aYdir = false;
    139135  else if (ayud == kAxeDirUpDown)  aYdir = true;
     136  //  cerr << " DBG-SetLimits xmax-xmin= " << xmax-xmin << " xmin,max="
     137  //     << xmin << "," << xmax << endl;
     138  UC_CheckMinMaxDiff(xmin, xmax);
     139  //cerr << " DBG-SetLimits ymax-ymin= " << ymax-ymin << " ymin,max="
     140  //     << ymin << "," << ymax << endl;
     141  UC_CheckMinMaxDiff(ymin, ymax);
    140142  xMin = xmin;
    141143  xMax = xmax;
     
    545547PIDrawer::DrawHLabels(PIGraphicUC* g, double y, double xBeg, double xStep, unsigned long just)
    546548{
    547   double fsz = xMajTickLen*4.;
     549  double fsz = xMajTickLen*3.5;
    548550  if(axesAFSz) g->SelFontSz(fsz);
    549551
     
    584586PIDrawer::DrawVLabels(PIGraphicUC* g, double x, double yBeg, double yStep, unsigned long just)
    585587{
    586   double fsz = xMajTickLen*4.;
     588  double fsz = xMajTickLen*3.5;
    587589  if(axesAFSz) g->SelFontSz(fsz);
    588590
  • trunk/SophyaPI/PI/pigraphuc.cc

    r2001 r2003  
    77#include "pigraphuc.h"
    88
    9 #include <math.h>
    10 //  Pour la declaration de finite() isnan() ...
    11 #if defined(SunOS)
    12 #include <ieeefp.h>
    13 #endif
    14 
    15 //define PETIT_DBLE 1.e-39
    16 //define PREC_DBLE  1.e-5
    17 //define PROT_DBLE  1.e-19
    18 #define PETIT_DBLE 1.e-100
    19 // qque probleme sur le trace - J'augmente les marges - Reza 14/5/2002
    20 // #define PREC_DBLE  1.e-16 
    21 #define PREC_DBLE  1.e-14
    22 #define PROT_DBLE  1.e-40
     9#include "ucckprot.h"
     10
    2311
    2412//++
     
    178166  }
    179167
    180   double xym;
    181   //DBG-REZA  cerr << " DBG-SetUCS() xmax-xmin = " << xmax-xmin << " xmin,max=" << xmin << "," << xmax << endl;
    182   if ((xmax-xmin) < PREC_DBLE*fabs(xmax+xmin)) {
    183     xym = fabs(xmax);  xym = (xym > PETIT_DBLE) ? xym : PETIT_DBLE;
    184     xmax += PREC_DBLE/2.*xym;
    185     xmin -= PREC_DBLE/2.*xym;
    186     //DBG-REZA  cerr << " PIGraphicUC::SetUCS() xmin,max=" << xmin << "," << xmax << " xym=" << xym << endl;
    187   }
    188   //DBG-REZAcerr << " DBG-SetUCS() ymax-ymin = " << ymax-ymin << " ymin,max=" << ymin << "," << ymax << endl;
    189   if ((ymax-ymin) < PREC_DBLE*fabs(ymax+ymin)) {
    190     xym = fabs(ymax);  xym = (xym > PETIT_DBLE) ? xym : PETIT_DBLE;
    191     ymax += PREC_DBLE/2.*xym;
    192     ymin -= PREC_DBLE/2.*xym;
    193     //DBG-REZAcerr << " PIGraphicUC::SetUCS() ymin,max=" << ymin << "," << ymax << " xym=" << xym << endl;
    194   }
    195   //    xym = fabs(xmax+xmin); xym = (xym > PETIT_DBLE) ? xym : PETIT_DBLE;
    196   // if ((xmax-xmin)/xym < PREC_DBLE) {xmin=xmin-PREC_DBLE/2.*xym; xmax=xmin+PREC_DBLE*xym;}
    197   // xym = fabs(ymax+ymin); xym = (xym > PETIT_DBLE) ? xym : PETIT_DBLE;
    198   // if ((ymax-ymin)/xym < PREC_DBLE) {ymin=ymin-PREC_DBLE/2.*xym; ymax=ymin+PREC_DBLE*xym;}
     168  UC_CheckMinMaxDiff(xmin, xmax);
     169  UC_CheckMinMaxDiff(ymin, ymax);
     170
     171  //  xym = fabs(xmax+xmin); xym = (xym > PETIT_DBLE) ? xym : PETIT_DBLE;
     172  //  if ((xmax-xmin)/xym < PREC_DBLE) {xmin=xmin-PREC_DBLE/2.*xym; xmax=xmin+PREC_DBLE*xym;}
     173  //  xym = fabs(ymax+ymin); xym = (xym > PETIT_DBLE) ? xym : PETIT_DBLE;
     174  //  if ((ymax-ymin)/xym < PREC_DBLE) {ymin=ymin-PREC_DBLE/2.*xym; ymax=ymin+PREC_DBLE*xym;}
    199175//  if (xmax <= xmin  || ymax <= ymin) {
    200176//    cerr << "PIGraphicUC::SetUCS() Error - xmax <= xmin  || ymax <= ymin ! " << endl;
    201177//    return;
    202178//    }
    203 #if defined(OSF1) || defined(SunOS) || (defined(Linux) && !defined(__KCC__) )
    204   if (!finite(xmin) || !finite(xmax) || !finite(ymin) || !finite(ymax)) {
     179
     180  if (!UC_CheckFinite(xmin, xmax) || !UC_CheckFinite(ymin, ymax)) {
    205181    cerr << "PIGraphicUC::SetUCS() Error - Non finite value for x/ymin-max ! " << endl;
    206182    return;
    207183    }
    208 #endif
     184
    209185  if (axrl == kAxeDirLtoR)  aXdir = false;
    210186  else if (axrl == kAxeDirRtoL)  aXdir = true;
     
    216192  yMax = ymax;
    217193
    218   xScale = xWd/(xMax-xMin);
    219   if (xScale < PROT_DBLE)  xScale = PROT_DBLE;  // Protection
     194  xScale = UC_LimitProtectDouble(xWd/(xMax-xMin)); // Protection
    220195  if (aXdir)  {
    221196    xScale = -xScale;
     
    225200  xOrg += xW0;
    226201
    227   yScale = yWd/(yMax-yMin);
    228   if (yScale < PROT_DBLE)  yScale = PROT_DBLE;  // Protection
     202  yScale = UC_LimitProtectDouble(yWd/(yMax-yMin)); // Protection 
    229203  if (!aYdir) {
    230204    yScale = -yScale;
     
    259233  xMinLog = (xMin > PETIT_DBLE) ? xMin : ( (1. < xMax/10.) ? 1. : xMax/10.);
    260234  xScaleLog = xWd*(xMax-xMinLog)/(xMax-xMin) / (log10(xMax)-log10(xMinLog));
    261   if (xScaleLog < PROT_DBLE)  xScaleLog = PROT_DBLE; // Protection
     235  xScaleLog = UC_LimitProtectDouble(xScaleLog); // Protection
    262236  if (aXdir)  {
    263237    xScaleLog = -xScaleLog;
     
    276250  yMinLog = (yMin > PETIT_DBLE) ? yMin : ( (1. < yMax/10.) ? 1. : yMax/10.);
    277251  yScaleLog = yWd*(yMax-yMinLog)/(yMax-yMin) / (log10(yMax)-log10(yMinLog));
    278   if (yScaleLog < PROT_DBLE)  yScaleLog = PROT_DBLE; // Protection
     252  yScaleLog = UC_LimitProtectDouble(yScaleLog); // Protection
    279253  if (!aYdir) {
    280254    yScaleLog = -yScaleLog;
  • trunk/SophyaPI/PI/piscdrawwdg.cc

    r1970 r2003  
    9191  mBDrw->SetName("AxesDrw");
    9292  SetLimits(-1.,1.,-1.,1.,kAxeDirLtoR,kAxeDirDownUp);
     93  // SetDefaultDrawRectangle(0.12, 0.12, 0.88, 0.88, true); fait par SetAxesFlags() - Reza Mai 2002
    9394  SetAxesFlags(kBoxAxes | kExtTicks | kLabels); 
    9495  FreeLimits();
    9596  xEndDrag = yEndDrag = xBegDrag = yBegDrag = 0;
    96   SetDefaultDrawRectangle(0.12, 0.12, 0.88, 0.88, true);
    97 //  SetDefaultDrawRectangle(0.12, 0.08, 0.88, 0.92, true);
    9897  AddDrawer(mBDrw, true, false, false);
    9998
     
    205204}
    206205
     206void
     207PIScDrawWdg::SetAxesFlags(unsigned int flags)
     208{
     209  mBDrw->SetAxesFlags(flags);
     210  if ((flags & kBoxAxes) == kBoxAxes)
     211    SetDefaultDrawRectangle(0.13, 0.09, 0.93, 0.89, true);
     212  else
     213    SetDefaultDrawRectangle(0.06, 0.06, 0.94, 0.94, true);
     214}
     215
    207216int
    208217PIScDrawWdg::DecodeOptionString(vector<string> & opt, bool rmdecopt)
    209218{
    210219  if (opt.size() == 0)  return(0); 
     220  unsigned int aflg = BaseDrawer()->GetAxesFlags();
    211221  int ndec1 = BaseDrawer()->DecodeOptionString(opt, rmdecopt);
     222  if (aflg != BaseDrawer()->GetAxesFlags())
     223    SetAxesFlags(BaseDrawer()->GetAxesFlags());
    212224  vector<string> udopt;
    213225  unsigned int k = 0;
  • trunk/SophyaPI/PI/piscdrawwdg.h

    r1914 r2003  
    3636  virtual void       UpdateLimits();  // Calcule et change les limites a partir de Drawer-No-1
    3737
    38   inline void        SetAxesFlags(unsigned int flags=kBoxAxes | kExtTicks | kLabels)
    39                                   { mBDrw->SetAxesFlags(flags); }
     38  virtual void       SetAxesFlags(unsigned int flags=kBoxAxes | kExtTicks | kLabels);
     39
    4040  inline void        SetTitles(const char* tt=NULL, const char* tb=NULL)
    4141                            { mBDrw->SetTitles(tt, tb); }
Note: See TracChangeset for help on using the changeset viewer.