(no subject)

From: fred (fred AT scd.ucar.edu)
Date: Mon Sep 13 2004 - 15:01:46 MDT

  • Next message: Jun Chen: "Where is simulatebg"

    > I want to open an ngcm metafile with a different filname than the
    > usual gmeta default and be able to append to it. It appears that this
    > is possible using the GESC subroutine and the right escape code.

       .
       .
       .

    > Kevin
    >
    > --------------------------------------------------------------------------
    > | |
    > | Kevin I. Hodges |
    > | ESSC (Enviromental Systems Science Center) |
    > | University of Reading, |
    > | Harry Pitt Building, |
    > | 3 Earley Gate, |
    > | Whiteknights, PO Box 238, Tel: 0118 931 8741 |
    > | Reading RG6 6AL, U.K. Fax: 0118 931 6413 |
    > | |
    > | email: kih@mail.nerc-essc.ac.uk |
    > | WWW: http://www.nerc-essc.ac.uk/~kih/Home.html |
    > | |
    > --------------------------------------------------------------------------

    Escape function -1389 was implemented in 1996 primarily to support
    internal functionality for NCL. It was never meant to be used by
    the outside world, except for the most fearless. Its usage
    is not at all easy. Nevertheless, here is a description of
    its usage and an example. Use at your own risk.

    Description of the IDR argument for GESC -1389:

    IDR is an array of CHARACTER*80 strings.

    IDR(1) contains seven parameters as per:

      IDR(1)( 1: 5) - Workstation ID.
      IDR(1)( 6:10) - Connecition ID.
      IDR(1)(11:15) - Workstation type.
      IDR(1)(16:20) - Flags whether an attribute context is being supplied.
      IDR(1)(21:25) - Number of colors in the supplied color table.
      IDR(1)(26:30) - First color index to associate with the colors
                      in the color table.
      IDR(1)(31:35) - Desired option.
                        0 - reopen and supply the color table.
                        1 - additionally reestablish the GKS context.
                        2 - additionally send the GKS context to the metafile.
                        3 - send current GKS context to the metafile.

    IDR(2)-IDR(5) contains the name of the metafile to be appended to
                   (137 characters max).

    If an attribute context is being supplied (see the example to
    clarify what this is), then that is stored in IDR(6)-IDR(11);
    otherwise the color table starts at IDR(6). If an attribute
    context is being supplied, then the color table starts at IDR(12).

    A call to GESC *replaces* a call to GOPWK.
      
    Below is an example that appends to the previously-existing
    metafile "gmeta_append", sends an attribute context where you
    can establish new attributes that did not apply to the original
    metafile, and establishes a color table. The color table is
    requied; the attribute context is not.

          PROGRAM QCONP
    C
          PARAMETER (IWTYPE=8)
          CHARACTER*80 IDR(72),ODR
    C
          REAL ZZX(9), ZZYL(9), ZZYM(9), CIRX(9), CIRY(9)
          INTEGER ICELLS(24,12)
    C
          DATA ZZX / -9.0, -8.0, -7.0, -6.0, -5.0, -4.0, -3.0, -2.0, -1.0/
          DATA ZZYL/ 6.5, 8.5, 6.5, 8.5, 6.5, 8.5, 6.5, 8.5, 6.5/
          DATA ZZYM/ -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0/
          DATA CIRX / 6.15, 5.26, 4.25, 3.59, 3.59, 4.25, 5.26, 6.15, 6.50/
          DATA CIRY / 8.46, 8.98, 8.80, 8.01, 6.99, 6.20, 6.02, 6.54, 7.50/
    C
    C Workstation ID.
    C
          DATA IDR(1)( 1: 5)/' 1'/
    C
    C Connecition ID.
    C
          DATA IDR(1)( 6:10)/' 2'/
    C
    C Workstation type.
    C
          DATA IDR(1)(11:15)/' 1'/
    C
    C Flag indicating if the attribute context is supplied.
    C
          DATA IDR(1)(16:20)/' 1'/
    C
    C Number of colors in the supplied color table.
    C
          DATA IDR(1)(21:25)/' 9'/
    C
    C First color index to associate with the colors in the color table.
    C
          DATA IDR(1)(26:30)/' 0'/
    C
    C Desired option.
    C 0 - reopen and supply the color table.
    C 1 - additionally reestablish the GKS context.
    C 2 - additionally send the GKS context to the metafile.
    C 3 - send current GKS context to the metafile.
    C
          DATA IDR(1)(31:35)/' 2'/
    C
          DATA IDR(1)(36:60)/' '/
          DATA IDR(1)(61:80)/' '/
    C
          DATA IDR(2)( 1:40)/'gmeta_append '/
          DATA IDR(2)(41:80)/' '/
          DATA IDR(3)( 1:40)/' '/
          DATA IDR(3)(41:80)/' '/
          DATA IDR(4)( 1:40)/' '/
          DATA IDR(4)(41:80)/' '/
          DATA IDR(5)( 1:40)/' '/
          DATA IDR(5)(41:80)/' '/
    C
    C 1.) Clip indicator.
    C
          DATA IDR(6)( 1: 4)/' 0'/
    C
    C 2.) Polyline index.
    C
          DATA IDR(6)( 5: 8)/' 1'/
    C
    C 3.) Line type.
    C
          DATA IDR(6)( 9:12)/' 1'/
    C
    C 4.) Line color index.
    C
          DATA IDR(6)(13:16)/' 5'/
    C
    C 5.) Marker index.
    C
          DATA IDR(6)(17:20)/' 1'/
    C
    C 6.) Marker type.
    C
          DATA IDR(6)(21:24)/' 2'/
    C
    C 7.) Marker color index.
    C
          DATA IDR(6)(25:28)/' 4'/
    C
    C 8.) Text index.
    C
          DATA IDR(6)(29:32)/' 1'/
    C
    C 9.) Text font.
    C
          DATA IDR(6)(33:36)/' 13'/
    C
    C 10.) Text precision.
    C
          DATA IDR(6)(37:40)/' 2'/
    C
    C 11.) Text color index.
    C
          DATA IDR(6)(41:44)/' 2'/
    C
    C 12.) Text path.
    C
          DATA IDR(6)(45:48)/' 0'/
    C
    C 13.) Text horizontal alignment.
    C
          DATA IDR(6)(49:52)/' 2'/
    C
    C 14.) Text vertical alignment.
    C
          DATA IDR(6)(53:56)/' 3'/
    C
    C 15.) Fill area index.
    C
          DATA IDR(6)(57:60)/' 1'/
    C
    C 16.) Fill area interior style.
    C
          DATA IDR(6)(61:64)/' 3'/
    C
    C 17.) Fill area style index.
    C
          DATA IDR(6)(65:68)/' 3'/
    C
    C 18.) Fill area color index.
    C
          DATA IDR(6)(69:72)/' 3'/
    C
    C 19.) Linetype ASF
    C
          DATA IDR(6)(73:76)/' 1'/
    C
    C 20.) Linewidth scale factor ASF.
    C
          DATA IDR(6)(77:80)/' 1'/
    C
    C 21.) Polyline color index ASF.
    C
          DATA IDR(7)( 1: 4)/' 1'/
    C
    C 22.) Marker type ASF.
    C
          DATA IDR(7)( 5: 8)/' 1'/
    C
    C 23.) Marker size scale factor ASF.
    C
          DATA IDR(7)( 9:12)/' 1'/
    C
    C 24.) Polymarker color index ASF.
    C
          DATA IDR(7)(13:16)/' 1'/
    C
    C 25.) Text font and precision ASF.
    C
          DATA IDR(7)(17:20)/' 1'/
    C
    C 26.) Character expansion factor ASF.
    C
          DATA IDR(7)(21:24)/' 1'/
    C
    C 27.) Character spacing ASF.
    C
          DATA IDR(7)(25:28)/' 1'/
    C
    C 28.) Text color index ASF.
    C
          DATA IDR(7)(29:32)/' 1'/
    C
    C 29.) Fill area interior style ASF.
    C
          DATA IDR(7)(33:36)/' 1'/
    C
    C 30.) Fill area style index ASF.
    C
          DATA IDR(7)(37:40)/' 1'/
    C
    C 31.) Fill area color index ASF.
    C
          DATA IDR(7)(41:44)/' 1'/
    C
    C 1.) Linewidth scale factor.
    C
          DATA IDR( 8)( 1:16)/' 5.0000000E+000'/
    C
    C 2.) Marker scale factor.
    C
          DATA IDR( 8)(17:32)/' 5.0000000E+000'/
    C
    C 3.) Character expansion factor.
    C
          DATA IDR( 8)(33:48)/' 1.0000000E+000'/
    C
    C 4.) Character spacing.
    C
          DATA IDR( 8)(49:64)/' 0.0000000E+000'/
    C
    C 5.) Character height (world coordinates)
    C
          DATA IDR( 8)(65:80)/' 6.0000000E-001'/
    C
    C 6.) Character up vector, X coordinate (world coordinates)
    C
          DATA IDR( 9)( 1:16)/' 0.0000000E+000'/
    C
    C 7.) Character up vector, Y coordinate (world coordinates)
    C
          DATA IDR( 9)(17:32)/' 1.0000000E+000'/
    C
    C 8.) Pattern size, X
    C
          DATA IDR( 9)(33:48)/' 1.0000000E+000'/
    C
    C 9.) pattern size, Y
    C
          DATA IDR( 9)(49:64)/' 1.0000000E+000'/
    C
    C 10.) Pattern reference point, X
    C
          DATA IDR( 9)(65:80)/' 0.0000000E+000'/
    C
    C 11.) Pattern reference point, Y
    C
          DATA IDR(10)( 1:16)/' 0.0000000E+000'/
    C
    C 12.) Clip rectangle, X left (NDC)
    C
          DATA IDR(10)(17:32)/' 2.0000000E-001'/
    C
    C 13.) Clip rectangle, X right (NDC)
    C
          DATA IDR(10)(33:48)/' 8.0000000E-001'/
    C
    C 14.) Clip rectangle, Y bottom. (NDC)
    C
          DATA IDR(10)(49:64)/' 2.0000000E-001'/
    C
    C 15.) Clip rectangle, Y top. (NDC)
    C
          DATA IDR(10)(65:80)/' 8.0000000E-001'/
    C
    C 16.) Char up vector, X component.
    C
          DATA IDR(11)( 1:16)/' 0.0000000E+000'/
    C
    C 17.) Char up vector, Y component.
    C
          DATA IDR(11)(17:32)/' 1.0000000E-002'/
    C
    C 18.) Char base vector, X component.
    C
          DATA IDR(11)(33:48)/' 1.0000000E-002'/
    C
    C 19.) Char base vector, Y component.
    C
          DATA IDR(11)(49:64)/' 0.0000000E+000'/
    C
          DATA IDR(11)(65:80)/' '/
    C
    C Color table.
    C
          DATA IDR(12)( 1:42)/' 1.000 1.000 1.000 0.000 0.000 0.000 1.000'/
          DATA IDR(12)(43:80)/' 0.000 0.000 0.000 1.000 0.000 '/
    C
          DATA IDR(13)( 1:42)/' 0.000 0.000 1.000 0.000 1.000 1.000 1.000'/
          DATA IDR(13)(43:80)/' 0.000 1.000 1.000 1.000 0.000 '/
    C
          DATA IDR(14)( 1:42)/' 0.500 0.500 0.500 '/
          DATA IDR(14)(43:80)/' '/
    C
          CALL GOPKS(6,0)
    C
          CALL GSTXCI(8)
          CALL GSCLIP(0)
          CALL GSCHH(.6)
    C
    C Re-open the metafile as specified above.
    C
          CALL GESC(-1389,13,IDR,1,1,ODR)
    C
    C Activate the metafile.
    C
          CALL GACWK(1)
    C
          CALL GSWN (1, -10.0, 10.0, -10.0, 10.0)
          CALL GSVP (1, 0.1, 0.9, 0.1, 0.9)
          CALL GSELNT(1)
    C
    C Draw some stuff to append as an additional frame.
    C
          CALL GPL (9, ZZX, ZZYL)
          CALL GFA (9, CIRX, CIRY)
          CALL GPM (9, ZZX, ZZYM)
          DO 25 IX=1,24
            JX = MOD(IX,2)
            DO 20 IY=1,12
              JY = MOD(IY,2)
              IF ((JX.EQ.1 .AND. JY.EQ.1) .OR. (JX.EQ.0 .AND. JY.EQ.0)) THEN
                ICELLS (IX,IY) = 1
              ELSE
                ICELLS (IX,IY) = 0
              ENDIF
       20 CONTINUE
       25 CONTINUE
          CALL GCA (1.5,-1.25,8.5,1.25, 24, 12, 1, 1, 24, 12, ICELLS)
          CALL GTX (0.0, -11., 'Example text string')
          CALL FRAME
    C
          CALL GDAWK(1)
          CALL GCLWK(1)
          CALL GCLKS
    C
          STOP
          END

    Fred Clare

    ---------------------------------------------
    Fred Clare fred@ucar.edu 303-497-1284
    Visualization & Enabling Technologies Section
    NCAR Scientific Computing Division
    ---------------------------------------------
    _______________________________________________
    ncarg-talk mailing list
    ncarg-talk@ucar.edu
    http://mailman.ucar.edu/mailman/listinfo/ncarg-talk



    This archive was generated by hypermail 2b29 : Tue Sep 14 2004 - 08:08:51 MDT