      SUBROUTINE LEGENDE(XMIN,XMAX,YMIN,YMAX,XXMI,XXMA,YYMI,YYMA,IOPT)
C
      INCLUDE 'com_options.f'
C
      REAL*4 XXX(6),YYY(6)
C
C Legendes
C
C legende simple
      ITYPLEG = 0
C
      IF (ILANG.EQ.0) THEN
        CALL COMMENTE_PS('Debut legende',13)
      ELSE
        CALL COMMENTE_PS('Begin legend',12)
      ENDIF
      USSFAC = 1./SQRT(FACLEG)
      IF (ICTFAC.GE.0.AND.ICTFAC.LE.16) THEN
        CALL GSPATF(ICTFAC)
      ELSE
        CALL GSPATF(0)
      ENDIF
      CALL GSPAT(16)
      CALL GSCOL(ICTLEG)
      CALL ASFCOL(ICTLEG)
      IF (FACLEG.EQ.1.) THEN
        CALL GSLSS(IFONT2)
      ELSEIF(FACLEG.GT.1.) THEN
        IF (FACLEG.GT.1.6) THEN
          CALL GSLSS(IFONT5)
        ELSE
          CALL GSLSS(IFONT4)
        ENDIF
      ELSE
        CALL GSLSS(IFONT3)
      ENDIF
      IF (ISLEG.EQ.0) THEN
        XMA = XMAX
        XMI = XMIN
        YMA = YMAX
        YMI = YMIN
      ELSE
        XMA = YMAX
        XMI = YMIN
        YMA = XMAX
        YMI = XMIN
      ENDIF
      TX   = (YMA-YMI)*.010*FACLEG
      TY   = (XMA-XMI)*.010*FACLEG
      TX = MIN(TX,TY)
      TY = TX
      YBOX = TX/0.45
      YLEG = YBOX+2.*TY
      DX1  = 3.25*TY/FACLEG
      DY1  = 3.25*TX/FACLEG
      DX2  = .75*TY*USSFAC
      DY2  = .75*TX*USSFAC
      CALL METSACCENTS(1)
      IF (IPOST.EQ.-1) THEN
        XLEG = TAILLE_CHAINE(LEG,LONLEG) + 2.*TY
      ELSE
        IF (FACLEG.GT.1.) THEN
          XLEG = FACLEG*TAILLE_CHAINE(LEG,LONLEG) + 2.*TY
        ELSE
          XLEG = TAILLE_CHAINE(LEG,LONLEG) + 2.*TY
        ENDIF
      ENDIF
      IF (ILEG.EQ.1) THEN
        X0 = XMI + DX1
        X1 = X0  + XLEG
        Y1 = YMA - DY1
        Y0 = Y1  - YLEG
        X2 = X0  + DX2
        X3 = X1  + DX2
        Y2 = Y0  - DY2
        Y3 = Y1  - DY2
      ELSEIF(ILEG.EQ.2) THEN
        X0 = XMA - DX1
        X1 = X0  - XLEG
        Y1 = YMA - DY1
        Y0 = Y1  - YLEG
        X2 = X0  - DX2
        X3 = X1  - DX2
        Y2 = Y0  - DY2
        Y3 = Y1  - DY2
      ELSEIF(ILEG.EQ.3) THEN
        X0 = XMA - DX1
        X1 = X0  - XLEG
        Y1 = YMI + DY1
        Y0 = Y1  + YLEG
        X2 = X0  - DX2
        X3 = X1  - DX2
        Y2 = Y0  + DY2
        Y3 = Y1  + DY2
      ELSEIF(ILEG.EQ.4) THEN
        X0 = XMI + DX1
        X1 = X0  + XLEG
        Y1 = YMI + DY1
        Y0 = Y1  + YLEG
        X2 = X0  + DX2
        X3 = X1  + DX2
        Y2 = Y0  + DY2
        Y3 = Y1  + DY2
      ELSE
        X0 = .5*(XMI + XMA - XLEG)
        X1 = X0 + XLEG
        Y0 = .5*(YMI + YMA - YLEG)
        Y1 = Y0 + YLEG
        X2 = X0  + DX2
        X3 = X1  + DX2
        Y2 = Y0  - DY2
        Y3 = Y1  - DY2
      ENDIF
C
      IF (IOPT.EQ.0) THEN
        IF (ITYPLEG.EQ.0) THEN
          IF (ISLEG.EQ.0) THEN
            XXMI = MIN(X0,X1)
            XXMA = MAX(X0,X1)
            YYMI = MIN(Y0,Y1)
            YYMA = MAX(Y0,Y1)
          ELSE
            YYMI = MIN(X0,X1)
            YYMA = MAX(X0,X1)
            XXMI = MIN(Y0,Y1)
            XXMA = MAX(Y0,Y1)
          ENDIF
        ELSE
          IF (ISLEG.EQ.0) THEN
            XXMI = MIN(X0,X1,X2,X3)
            XXMA = MAX(X0,X1,X2,X3)
            YYMI = MIN(Y0,Y1,Y2,Y3)
            YYMA = MAX(Y0,Y1,Y2,Y3)
          ELSE
            YYMI = MIN(X0,X1,X2,X3)
            YYMA = MAX(X0,X1,X2,X3)
            XXMI = MIN(Y0,Y1,Y2,Y3)
            XXMA = MAX(Y0,Y1,Y2,Y3)
          ENDIF
        ENDIF
        RETURN
      ENDIF
      IF (ITYPLEG.EQ.0) THEN
        XXX(1) = X0
        XXX(2) = X0
        XXX(3) = X1
        XXX(4) = X1
        YYY(1) = Y1
        YYY(2) = Y0
        YYY(3) = Y0
        YYY(4) = Y1
        NCADRE = 4
      ELSE
        XXX(1) = X0
        XXX(2) = X0
        XXX(3) = X2
        XXX(4) = X3
        XXX(5) = X3
        XXX(6) = X1
        YYY(1) = Y1
        YYY(2) = Y0
        YYY(3) = Y2
        YYY(4) = Y2
        YYY(5) = Y3
        YYY(6) = Y1
        NCADRE = 6
      ENDIF
      CALL GSLW(1)
      IF (ISLEG.EQ.0) THEN
        CALL MY_GSAREA(1,XXX,YYY,NCADRE)
      ELSE
        CALL MY_GSAREA(1,YYY,XXX,NCADRE)
      ENDIF
C
C Fignolage...
C
      IF (ITYPLEG.NE.0) THEN
        XXX(5) = X1
        YYY(5) = Y0
        IF (ISLEG.EQ.0) THEN
          CALL GSMOVE(XXX(2),YYY(2))
          CALL GSPLNE(2,XXX(5),YYY(5))
          CALL GSMOVE(XXX(5),YYY(5))
          CALL GSLINE(XXX(4),YYY(4))
        ELSE
          CALL GSMOVE(YYY(2),XXX(2))
          CALL GSPLNE(2,YYY(5),XXX(5))
          CALL GSMOVE(YYY(5),XXX(5))
          CALL GSLINE(YYY(4),XXX(4))
        ENDIF
      ENDIF
      CALL GSLW(0)
      XX1 = MIN(X0,X1) + TY
      IF (ISLEG.EQ.0) THEN
        YY1 = MIN(Y0,Y1) + TY
        CALL GSCHAR(XX1,YY1,LONLEG,LEG)
      ELSE
        YY1 = MAX(Y0,Y1) - TY
        CALL GSCA(0.,1.)
        CALL GSCHAR(YY1,XX1,LONLEG,LEG)
        CALL GSCA(1.,0.)
      ENDIF
      CALL METSACCENTS(0)
      IF (ILANG.EQ.0) THEN
        CALL COMMENTE_PS('Fin legende',11)
      ELSE
        CALL COMMENTE_PS('End legend',10)
      ENDIF
      END
C-----------------------------------------------------------------------
      SUBROUTINE TITIT(XMIN,XMAX,YMIN,YMAX)
C
      INCLUDE 'com_options.f'
C
C Titre du avoir3D
C
      CALL GSPATF(ICTFON)
      CALL ASFCOL(ICOLAX)
      CALL GSLSS(IFONT1)
      CALL GSBND(XMIN,XMAX,YMIN,YMAX)
      CALL GSCHAR2(XMIN+.015*(XMAX-XMIN),YMAX-.03*(YMAX-YMIN)
     &            ,LONTIT,TITAV)
      END
