Changeset 147 in Sophya for trunk/SophyaPI


Ignore:
Timestamp:
Oct 1, 1998, 2:50:47 PM (27 years ago)
Author:
ercodmgr
Message:

Correction bugs trace et PostScript (Reza+Nicolas) 1/10/98

Location:
trunk/SophyaPI/PI
Files:
5 edited

Legend:

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

    r113 r147  
    66
    77#include "pigraphgen.h"
     8
     9//++
     10// Class        PIGraphic
     11// Lib          PI
     12// include      pigraphgen.h
     13//
     14//      Classe de base fournissant les services de tracé graphique.
     15//      La classe PIGraphicGen définit l'interface à travers des méthodes
     16//      virtuelles pures. Les objets instanciés doivent être de la classe
     17//      "PIGraphicWin" ou "PIGraphicUC" ou ...
     18//      La classe "PIGraphicWin" a une implementation dépendante du système
     19//      utilisé et sa
     20//      "
     21//      Un type particulier *PIGrCoord* permettant de passer les coordonnées
     22//      graphiques en entier ("int") ou en flottant ("float").
     23//--
     24
     25//
     26//      "
     27//      "
     28//      "
     29//      "
     30//      "
     31//      "
    832
    933/* --Methode-- */
  • trunk/SophyaPI/PI/pigraphps.cc

    r130 r147  
    4848SelMarker(1, PI_DotMarker);
    4949
    50 if (psf) psf->NewBloc(x0, y0, dx, dx, dy, dy);
     50if (psf) psf->NewBloc(x0, y0, dx, dy, dx, dy);
    5151mXmin = mYmin = 0.;
    5252mXmax = dx;  mYmax = dy;
  • trunk/SophyaPI/PI/piscdrawwdg.cc

    r134 r147  
    331331// Trace des lignes
    332332  float xp2, yp2;
    333   if (mAy) { xp = mAx->Value(0); yp = mAy->Value(0); }
    334   else { xp = mAx->X(0);  yp = mAx->Value(0); }
     333  if (mAy) { xp2 = mAx->Value(0); yp2 = mAy->Value(0); }
     334  else { xp2 = mAx->X(0);  yp2 = mAx->Value(0); }
    335335  for(i=1; i<mSz; i++) {
     336    xp = xp2; yp = yp2;
    336337    if (mAy) { xp2 = mAx->Value(i); yp2 = mAy->Value(i); }
    337338    else { xp2 = mAx->X(i);  yp2 = mAx->Value(i); }
     
    339340         ((xp2 < xmin) || (xp2 > xmax) || (yp2 < ymin) || (yp2 > ymax)) )  continue;
    340341    g->DrawLine(xp, yp, xp2, yp2);
    341     xp = xp2; yp = yp2;
    342   }
    343 }
     342  }
     343}
  • trunk/SophyaPI/PI/psfile.cc

    r130 r147  
    3131  PI_ColorFromMap, PI_Black, PI_White, PI_Grey, PI_Red, PI_Blue,\
    3232  PI_Green, PI_Yellow, PI_Magenta, PI_NotDefColor,\
     33  PI_Cyan, PI_Turquoise, PI_NavyBlue,\
     34  PI_Orange, PI_SiennaRed, PI_Purple,\
     35  PI_LimeGreen, PI_Gold,\
    3336  \
    3437  PI_RomanFont, PI_BoldFont, PI_ItalicFont, PI_NotDefFontAtt,\
     
    5154/C%-2d  {0.996 0.0   0.996 setrgbcolor} bind def %% PI_Magenta\n\
    5255/C%-2d  {}                              bind def %% PI_NotDefColor\n\
     56/C%-2d  {0.0   0.996 0.996 setrgbcolor} bind def %% PI_Cyan\n\
     57/C%-2d  {0.250 0.875 0.813 setrgbcolor} bind def %% PI_Turquoise\n\
     58/C%-2d  {0.0   0.0   0.500 setrgbcolor} bind def %% PI_NavyBlue\n\
     59/C%-2d  {0.996 0.644 0.0   setrgbcolor} bind def %% PI_Orange\n\
     60/C%-2d  {0.625 0.320 0.176 setrgbcolor} bind def %% PI_SiennaRed\n\
     61/C%-2d  {0.625 0.125 0.937 setrgbcolor} bind def %% PI_Purple\n\
     62/C%-2d  {0.195 0.800 0.195 setrgbcolor} bind def %% PI_LimeGreen\n\
     63/C%-2d  {0.996 0.840 0.0   setrgbcolor} bind def %% PI_Gold\n\
    5364/F%-2d  {/Courier   findfont} bind def       %% PI_RomanFont\n\
    5465/F%-2d  {/Courier-Bold    findfont} bind def       %% PI_BoldFont\n\
     
    273284      mFontSize(PI_NormalSizeFont),
    274285      mLineAtt(PI_NormalLine),
    275       mMarker(PI_DotMarker)
     286      mMarker(PI_DotMarker),
     287      setFontDone(true)
    276288{
    277289    char*  date = new (char[64] ) ;
     
    335347    mFontSize(PI_NormalSizeFont),
    336348    mLineAtt(PI_NormalLine),
    337     mMarker(PI_DotMarker)
     349    mMarker(PI_DotMarker),
     350    setFontDone(true)
    338351{
    339352    char * date = new(char[64]) ;
     
    492505     */
    493506    else {
     507        // Si marges <= 0 on les met a 2cm
     508        if(WMargin<=0) WMargin = 2. ;
     509        if(HMargin<=0) HMargin = 2. ;
    494510        /* Eviter image reduite a un point...ou moins... */
    495511        if((tw = Tw - 2*WMargin) < (Tw/10)) {
     
    503519        /* Portrait ou Landscape ? */
    504520        if(orientation == PI_Auto)
    505             if( ((tw < th) && (Dx < Dy)) ||
     521            if( ((tw < th) && (Dx < 1.2*Dy)) ||
    506522                ((tw > th) && (Dx > Dy) ))
    507523                currentPage->orientation = PI_Portrait ;
     
    511527        if(currentPage->orientation == PI_Portrait) {
    512528            if( (tw/Dx) < (th/Dy) )
    513                 scale = tw/Dx ;
     529//              scale = tw/Dx ;
     530                scale = tw/Tw ;
    514531            else
    515                 scale = th/Dy;
     532//              scale = th/Dy;
     533                scale = th/Th;
    516534            fprintf(mPSFile,
    517535                    "%.2f %.2f %.2f cm %.2f cm %.2f cm %.2f cm newref\n",
    518536                    Dx, Dy,
    519                     Dx*scale, Dy*scale,
     537//                  Dx*scale, Dy*scale,
     538                    Tw*scale, Th*scale,
    520539                    0.5*(Tw-tw), -0.5*(Th+th)) ;
    521540        }
     
    523542            /* Idem avec X<->Y */
    524543            if( (th/Dx) < (th/Dy) )
    525                 scale = th/Dx;
     544//              scale = th/Dx;
     545                scale = th/Tw;
    526546            else
    527                 scale = tw/Dy ;
     547//              scale = tw/Dy ;
     548                scale = tw/Th;
    528549            fprintf(mPSFile,
    529550               "-90 rotate %.2f %.2f %.2f cm %.2f cm %.2f cm %.2f cm newref\n",
    530551               Dx, Dy,
    531                Dx*scale, Dy*scale,
     552//             Dx*scale, Dy*scale,
     553               Th*scale, Tw*scale,
    532554               0.5*(Th-th), 0.5*(Tw-tw));
    533555        }
     
    656678
    657679    fprintf(mPSFile, "gs %.2f Ux %.2f Uy m (%s) S gr\n", x, y, s) ;
     680    setFontDone = true ;
    658681}
    659682
     
    881904        mMarker = MrkType;
    882905
    883     if(MarkerSize != mMarkerSize) {
     906    if(MarkerSize != mMarkerSize || setFontDone) {
    884907        mMarkerSize = MarkerSize ;
    885908        fprintf(mPSFile, "/PIMarkers ff %d scf sf\n", mMarkerSize) ;
     909        setFontDone = false ;
    886910    }
    887911    /* Dessin */
    888912    fprintf(mPSFile, "%.2f Ux %.2f Uy m (\\%#o) show\n", x0, y0, mMarker) ;
    889 
    890913}
    891914
     
    908931        mMarker = MrkType;
    909932
    910     if(MarkerSize != mMarkerSize) {
     933    if(MarkerSize != mMarkerSize || setFontDone) {
    911934        mMarkerSize = MarkerSize ;
    912935        fprintf(mPSFile, "/PIMarkers ff %d scf sf\n", mMarkerSize) ;
     936        setFontDone = false ;
    913937    }
    914938    /* Dessin */
  • trunk/SophyaPI/PI/psfile.h

    r130 r147  
    7676    PSFile (const char * FileName, PIOrientation orientation,
    7777            PIPaperSize paperSize= PI_A4,
    78             float marginX = 1.0, float marginY = 1.0 ) ;
     78            float marginX = 5.0, float marginY = 5.0 ) ;
    7979
    8080    virtual      ~PSFile();
     
    203203    enum PIMarker    mMarker;     /* Marker courant */
    204204    int              mMarkerSize; /* Taille (en points) du marker courant */
     205    bool setFontDone ; /* Pour forcer la selection de Marker apres DrawString() */
    205206} ;
    206207
Note: See TracChangeset for help on using the changeset viewer.