Changeset 44 in Sophya for trunk/SophyaPI/PI/psfile.h


Ignore:
Timestamp:
Apr 9, 1997, 5:45:23 PM (28 years ago)
Author:
ansari
Message:

Modification de Nicolas pour sortie postscript (Reza 09/04/97)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaPI/PI/psfile.h

    r40 r44  
    1212 *        Au depart, 1UC == 1cm
    1313 *     - Les reperes sont orientes a la maniere XWindow
     14 *
     15 *  17/02/97 : modification des constructeurs(1-->eps,2-->ps)
     16 *             ajout du type enum orientation
    1417 *
    1518 */
     
    2225#endif
    2326#include "pisysdep.h"
     27//#include "piinclude.h"
    2428
    2529#include PIBWDG_H      // Types enumeres repris de Peida:PIFontSize...
     
    2933
    3034
    31 /*
    32  *  Unique format actuellement gere : A4
    33  *
    34  */
    35 enum PIPaperSizes { PI_A3 = 0, PI_A4 = 1, PI_A5 = 2, PI_NotDef = -1};
    36 
    37 #define PAGE_WIDTH   21.0   /* == 595 points */
    38 #define PAGE_HEIGHT  29.7   /* == 842 points */
    39 
    40 #define PORTRAIT  1
    41 #define LANDSCAPE 0
     35
     36/*
     37 *#define PAGE_WIDTH   21.0    == 595 points
     38 *#define PAGE_HEIGHT  29.7    == 842 points
     39 *#define PORTRAIT  1
     40 *#define LANDSCAPE 0
     41 */
    4242
    4343
    4444
    4545/* Valable pour une page, ou un bloc */
    46 typedef struct {
    47     float X0;         /* Coordonnes sommet NO  */
    48     float Y0;         /*  en unites courantes  */
    49     float Tx;         /* Format                */
    50     float Ty;         /*  en unites courantes  */
    51     float Dx;         /* Coord sommet SE       */
    52     float Dy;         /*  en unites courantes  */
    53     int orientation;  /* LANDSCAPE OU PORTRAIT */
    54 } Format;
    55 
    56 
    57 typedef struct{
    58     char *Name;
    59     int  Tx;     /* En 1/72e de pouce  !!  */
    60     int  Ty;     /* unite naturelle de ps  */
    61 } PIMedia;
    62 
     46/*typedef struct {
     47 *  float X0;          Coordonnes sommet NO 
     48 *  float Y0;           en unites courantes 
     49 *  float Tx;          Format               
     50 *  float Ty;           en unites courantes 
     51 *  float Dx;          Coord sommet SE       
     52 *  float Dy;           en unites courantes 
     53 *  int orientation;   LANDSCAPE OU PORTRAIT
     54 *} Format;
     55 */
     56
     57/*
     58 *typedef struct{
     59 *    char *Name;
     60 *    int  Tx;     En 1/72e de pouce  !!
     61 *    int  Ty;     unite naturelle de ps
     62 *} PIMedia;
     63 */
    6364
    6465
     
    6768
    6869public:
    69 
    70                   PSFile (char * FileName, float Tx = 0, float Ty = 0,
    71                           float Dx = 0, float Dy = 0);
    72 /*                PSFile (PSFile *File, int PageNum, int BlocNum);*/
    73 /*                PSFile (char * FileName, int PageNum, int BlocNum);*/
     70    /* Production fichier eps */
     71    PSFile (char * FileName, float sc = 1.0);
     72    /* Production fichier ps  */
     73    PSFile (char * FileName, PIOrientation orientation,
     74            PIPaperSize paperSize= PI_A4,
     75            float marginX = 1.0, float marginY = 1.0 ) ;
    7476
    7577    virtual      ~PSFile();
     
    7981
    8082
    81     /* A changer ?
    82      * Pourrait introduire des incompatibilites
    83      * en cas de chgt sur la struct format ?
    84      */
    85     virtual Format* GetFormat();
    86 
    87     /*Attributs graphiques */
     83    /*    virtual Format* GetFormat(); */
     84    /* Attributs graphiques */
    8885    virtual PIColors    GetDrawColor();
    8986    virtual PIColors    GetFillColor();
     
    9390    virtual PIMarker    GetMarker();
    9491
    95     virtual void  NewPage(float Dx, float Dy, int orientation);
     92    virtual void  NewPage(float Dx, float Dy, PIOrientation orientation);
    9693    virtual void  EndPage();
    9794    virtual void  NewBloc(float x0, float y0, float Tx, float Ty,
     
    130127    virtual void  DrawMarker  (float x0, float y0,
    131128                               PIMarker MrkType    = PI_NotDefMarker,
    132                                PIColors DrawColor  = PI_NotDefColor);
     129                               PIColors DrawColor  = PI_NotDefColor,
     130                               int MarkerSize=14);
    133131    virtual void  DrawMarkers (float *x0, float *y0, int n,
    134132                               PIMarker MrkType    = PI_NotDefMarker,
    135                                PIColors DrawColor  = PI_NotDefColor);
     133                               PIColors DrawColor  = PI_NotDefColor,
     134                               int MarkerSize=14);
    136135
    137136    virtual void  Image(float x0, float y0, float Tx, float Ty,
     
    140139                        PIColorMap *mColorMap);
    141140
    142 
    143 
    144 
    145 
    146 
    147 
    148     typedef struct {
    149         off_t begin;
    150         off_t end;
    151     } Offset;
    152    
     141#ifndef __DECCXX
     142private:
     143#endif
     144
     145
    153146    /* Blocs */
    154147    typedef struct {
    155148        int    num;
    156149        char*  label;
    157         Format format;
    158         Offset offset;
    159     } Bloc;
     150        float  X0, Y0;            /* coordonnees sommet NO */
     151        float  Tx, Ty;            /* Format */
     152        float  Dx, Dy;            /* Repere utilisateur */
     153        long  begin,end,tmp;   /* offsets dans le fichier */
     154    } Bloc ;
    160155    typedef list<Bloc> BlocList;  /* STL */
     156
    161157
    162158    /* Pages */
     
    164160        int num;
    165161        int BlocCounter;
    166         Format format;
    167         Offset offset;
    168         BlocList mBlocList;       /* Page == Liste de blocs */
    169     } Page;
     162        float Dx,Dy;              /* Sommet SE (unites utilisateur) */
     163        PIOrientation orientation;
     164        long  begin, end, tmp;    /* Offsets dans le fichier */
     165        BlocList mBlocList;       /* Page == Liste de blocs  */
     166    } Page ;
    170167    typedef list<Page> PageList;  /* STL */
    171168
     169#ifdef __DECCXX
    172170private:
    173 
    174     /* --> Toute la classe */
    175     static PSFile** PSFiles;      /* Tableau des PSFiles existants */
    176 
    177     /* --> le fichier */
     171#endif
     172
     173    /* Fichier ps/eps */
    178174    FILE *   mPSFile;
    179175    char *   mPSFileName;
     176    float    Tw,Th ;              /* Format, en cm */
     177    float    WMargin,HMargin ;    /* Marges minimales */
    180178    int      isEPS;               /* Vrai si PostScript Encapsule */
    181     Format   mFormat;             /* Format par defaut */
    182     int      PageCounter;         /* Nbre de pages */
    183     PageList mPageList;           /* Fichier == Liste de pages */
    184 
    185     /* Attributs graphiques */
     179    long     boundingBox;         /* Endroit ou est specifiee la bb */
     180    float    scale;               /* boundingbox = Dx*scale ; Dy*scale */
     181    PIPaperSize mPaperSize ;
     182    int      PageCounter;         /* nbr pages */
     183    int      FileEmpty;
     184    Page*    currentPage;        /* Avant empilage */
     185    Bloc*    currentBloc;        /* Avant empilage */
     186    PageList mPageList;          /* Fichier == Liste de pages */
     187
     188
     189    /* Attributs graphiques, initialises par constructeur */
    186190    enum PIColors    mDrawColor;  /* Couleur de trace courante */
    187191    enum PIColors    mFillColor;  /* Couleur de remplissage courante */
    188     enum PIFontAtt   mFontAtt;
    189     enum PIFontSize  mFontSize;
     192    enum PIFontAtt   mFontAtt; 
     193    enum PIFontSize  mFontSize; 
    190194    enum PILineAtt   mLineAtt;    /* Epaisseur d une ligne */
    191195    enum PIMarker    mMarker;     /* Marker courant */
    192 
    193 
    194     /* Ecriture du PostScript dans le fichier Physique */
    195     /* Le code se trouve ds PSDict.cc                  */
    196     virtual void  WriteHeader();
    197     virtual void  WriteTrailer();
    198     virtual void  WriteNewPage(Page *mPage);
    199     virtual void  WriteEndPage(Page *mPage);
    200     virtual void  WriteNewBloc(Bloc *mBloc);
    201     virtual void  WriteEndBloc(Bloc *mBloc);
    202     virtual void  WriteDrawString(float x, float y, char* s);
    203     virtual void  WriteDrawLine(float x1, float y1, float x2, float y2);
    204     virtual void  WriteDrawBox(float x0, float y0, float Tx, float Ty);
    205     virtual void  WriteDrawFBox(float x0, float y0, float Tx, float Ty);
    206     virtual void  WriteDrawCircle(float x0, float y0, float r);
    207     virtual void  WriteDrawFCircle(float x0, float y0, float r);
    208     virtual void  WriteDrawPolygon(float *x, float *y, int n);
    209     virtual void  WriteDrawFPolygon(float *x, float *y, int n);
    210     virtual void  WriteDrawMarker(float x0, float y0);
    211     virtual void  WriteDrawMarkers(float *x0, float *y0, int n);
    212     virtual void  WriteImage(float x0, float y0, float Tx, float Ty,
    213                      int Nx, int Ny, unsigned char *pict, PIColorMap *mColorMap);
    214     virtual void  WriteSetColor(PIColors mDrawColor);
    215     virtual void  WriteSetFont(PIFontAtt mFontAtt, int mFontSize);
    216     virtual void  WriteSetLineWidth(PILineAtt mLineAtt);
    217 };  /* End class PSFile */
     196    int              mMarkerSize; /* Taille (en points) du marker courant */
     197} ;
     198
    218199
    219200#endif/* PSFILE_H_SEEN */
Note: See TracChangeset for help on using the changeset viewer.