!=====================================================================
! NGDP: Dashpack, A Software Package for Drawing Dashed Lines
!=====================================================================
!
! The NCAR Graphics package DASHPACK draws curves using dashed-line
! patterns that may include gap-portion specifiers, solid-portion
! specifiers, and label-string specifiers. DASHPACK is intended to
! replace and unify the old family of NCAR Graphics routines
! (DASHLINE, DASHCHAR, DASHSMTH, and DASHSUPR), all of which date from
! the early 1970s or before. At the time of its introduction, DASHPACK
! will do anything that DASHLINE, DASHCHAR, and DASHSMTH will (and a
! number of things that they won't); it does not yet functionally
! replace all of DASHSUPR, but it is intended that this will
! eventually happen. For the moment, the older routines will stay in
! NCAR Graphics.
!
! ~~~~~~~~~~~~~~~~~~~~~~~~~~
! Parameter-Setting Routines
! ~~~~~~~~~~~~~~~~~~~~~~~~~~
!
! NG_DPSETC set the value of a CHARACTER internal parameter
! NG_DPSETI set the value of an INTEGER internal parameter
! NG_DPSETR set the value of a REAL internal parameter
!
! NG_DPGETC get the value of a CHARACTER internal parameter
! NG_DPGETI get the value of an INTEGER internal parameter
! NG_DPGETR get the value of a REAL internal parameter
!
! NG_DPRSET restore the default values of DASHPACK parameters.
!
! NG_DPSET1 set internal parameters (added by CNCARG)
! NG_DPGET1 get internal parameters (added by CNCARG)
!
! ~~~~~~~~~~~~~~~~~~~~~~
! Curve-Drawing Routines
! ~~~~~~~~~~~~~~~~~~~~~~
!
! NG_DPCURV draws a complete curve with a single call.
!
! NG_DPFRST does a "pen-up" move to the first in a sequence of points
! defining a curve.
!
! NG_DPVECT does a "pen-down" move to the next in a sequence of
! points defining a curve.
!
! NG_DPLAST is called to say that the latest call to DPVECT was
! the last one in the sequence, that drawing of the curve
! should be completed, and that buffers should be flushed.
!
! NG_DPLINE draws the straight line joining two points. (No smoothing
! takes place, even if smoothing is turned on.)
!
! NG_DPSMTH is called to create a smooth curve passing through a
! sequence of points and then to interpolate points along
! that smoothed curve and pass them on to DPDRAW.
!
! NG_DPDRAW is called to just draw the curve by connecting a given
! sequence of points (smoothing is not to be done).
!
! NG_DPDPWS is used to create a character dash pattern in which
! certain characters select symbols.
!
! ~~~~~~~~~~~~~~~~~~~
! Internal Parameters
! ~~~~~~~~~~~~~~~~~~~
!
! ANGF is the internal parameter 'SAF' (for "String Angle Flag"). When
! 'SAF' has the value zero, strings are written along a curve in the
! direction in which the curve is being drawn. If 'SAF' is negative,
! all angles are written in the direction ABS('SAF') degrees, but this
! is done only if 'LTL' is non-zero; otherwise, the code behaves as if
! 'SAF' were zero. When 'SAF' is greater than zero, strings are written
! along the curve, but the angle is adjusted by adding multiples of 180
! degrees so that the resulting angle lies in the range from ANGF-90 to
! ANGF+90 degrees. (Generally, when ANGF is different from zero, it is
! either -360 or +360, which ensures that labels are as nearly upright
! as possible on the frame). Note that, if embedded character strings
! in the dash pattern are broken (either because there are "breakpoint"
! characters in the strings or because 'SCF' is non-zero), using 'SAF'
! non-zero could give undesirable results: some characters in such a
! string might be rotated and others might not be. Therefore, in such
! cases, a non-zero value of 'SAF' is treated as zero.
! The default value is 360.0
!
! CHDP is the internal parameter 'DPT' (for "Dash PaTtern"), defining
! the character dash pattern. It is accessed by DPGETC/DPSETC. (When
! 'DPT' is accessed by DPGETI/DPSETI, the internal variable INDP is
! meant.) When 'DPS' is greater than or equal to zero, it says that
! CHDP specifies the dash pattern. CHDP may contain occurrences of the
! character 'CRS' to specify a solid part of the line and the character
! 'CRG' to specify a gap. Other characters form strings that are to be
! written along the line; within such strings, the character 'CRB' may
! be used to specify places where the string may be broken (which has
! the effect of making the characters follow the curve instead of being
! written in a straight line).
! The default value is '$$$$$$$$$$$$$$$$'
!
! CHRB is the internal parameter 'CRB' (for "Character Representing
! Break") - the character that, when used in a character dash pattern,
! represents a "breakpoint" - a position at which an embedded string
! of characters may be broken. Example: if 'DPT' has the value
!
! '$_$_$_1|3|.|6|2|:L1:4|1|0:S:14:N:_',
!
! and other internal parameters have their default values, the dollar
! signs represent solid parts of the line and the underscores represent
! gaps; the rest of the characters form a string to be written along
! the line. Each of the substrings '1', '3', '.', '6', '2', ':L1:4'
! (which represents the "times" sign), '1', and '0:S:14:N:' (which
! represents "zero to the power 14") will be written using a separate
! call to PLCHHQ. The effect of this will be to make the whole label
! follow the bends of the curve, while ensuring that each call to
! PLCHHQ contains the appropriate "function codes" to make the call
! write the desired characters.
! The default value is '|'
!
! CHRG is the internal parameter 'CRG' (for "Character Representing
! Gap") - the character that, when used in a character dash pattern,
! represents a gap in the line.
! The default value is '_'
!
! CHRS is the internal parameter 'CRS' (for "Character Representing
! Solid") - the character that, when used in a character dash pattern,
! represents a solid part of the line.
! The default value is '$'
!
! DBPI is the internal parameter 'SSL' (for "Smoothed Segment Length"),
! which defines the distance between points interpolated along smooth
! curves. It is given as a fraction of the distance across the plotter
! frame.
! The default value is 0.01
!
! EPSI is the internal parameter 'EPS' (for "EPSilon"), which specifies
! how far apart two points have to be to be considered distinct. It is
! given as a fraction of the distance across the plotter frame.
! The default value is 0.000001
!
! IDPS is the internal parameter 'DPS' (for "Dash Pattern Selector") -
! a dash pattern selector switch. When IDPS is negative and equal to
! "-n", it says to use the "n" low-order bits of the current integer
! dash pattern. When IDPS is zero, it says to use all the characters
! of the current character dash pattern. When IDPS is positive and
! equal to "+n", it says to use the first "n" characters of the current
! character dash pattern.
! The default value is 0
!
! ILTL is the internal parameter 'LTL' (for "Lines Through Labels"),
! which may be set non-zero to cause curve lines to be drawn through
! the strings that serve as line labels. By default, 'LTL' is zero,
! in which case each such string is written within its own gap in
! the line.
! The default value is 0
!
! INDP is the internal parameter 'DPT' (for "Dash PaTtern"), defining
! the integer dash pattern. It is accessed by DPGETI/DPSETI. (When
! 'DPT' is accessed by DPGETC/DPSETC, the internal variable CHDP is
! meant.) When 'DPS' is less than zero, it says how many low-order
! bits of INDP are to be used. Each zero bit represents a gap and each
! one bit represents a solid part of the line.
! The default value is 65535
!
! IPCF is the internal parameter 'PCF' (for "PlotChar Flag"), which
! says which routine is to be called to plot character strings.
! The value 0 says to call NG_PLCHHQ, otherwise call NG_PLCHMQ.
! The default value is 0.
!
! ISBF is the internal parameter 'SBF' (for "String Buffering Flag");
! when set non-zero, it turns on a buffering mechanism for character
! strings to be written as part of a dash pattern. Turning buffering
! on ensures that, if the end of a curve occurs anywhere within a
! contiguous group of strings, none of those strings is written;
! instead, that part of the curve is drawn using only the gap and
! solid elements of the dash pattern. If buffering is turned off,
! there may be gaps at the ends of curves; if, in addition, 'SCF'
! is non-zero or breakpoints are specified in the embedded character
! strings, the result may be to write only part of a character string
! at the end of a curve.
! The default value is 1
!
! ISCF is the internal parameter 'SCF' (for "Single-Character Flag");
! when set non-zero, it says that character strings embedded in dash
! patterns are to be broken into single characters, each of which is
! written separately. This has the effect of making the characters
! appear to follow the curve being drawn. (Note, however, that it is
! not appropriate for 'SCF' to be non-zero when PLCHHQ is being used
! and an embedded character string contains function codes that are
! meaningful to that routine; in that case, one should leave 'SCF' = 0
! and use the "break character" 'CRB' to tell DASHPACK where to break
! the string.)
! The default value is 0
!
! LCDP is the internal parameter 'DPL' (for "Dash Pattern Length").
! Its value is set whenever a call to DPSETC sets 'DPT' - to the length
! of the character string that the call sets 'DPT' to - but 'DPL' may
! also be set independently by a subsequent call to DPSETI, specifying
! the use of fewer characters of the string previously given.
! The default value is 16
!
! RLS1 and RLS2 are the internal parameters 'LS1' and 'LS2' (for "Label
! Spacing 1 and 2"). The first of these specifies the widths of extra
! gaps to be placed before and after a label. The second specifies the
! amount of additional gap space that will be provided for each label
! substring written by a single call to PLCHHQ/MQ/LQ (in addition to
! the length of the string itself). Both are stated as multipliers of
! the current character width.
! The default values are 0.5, and 0.0 seprarately
!
! RMFS is the internal parameter 'MFS' (for "Multiplier for First
! Solid"). If the first element of a dash pattern specifies a solid
! chunk of line, its length is multiplied by the current value of RMFS.
! This can be used to help ensure that labels along adjacent, nearly
! identical, curves (as, for example, when drawing contour lines) do
! not overlap each other. (This feature of the old dash package is
! duplicated here for what use it may have in the new one.)
! The default value is 1.0
!
! TENS is the internal parameter 'TCS' (for "Tension on Cubic Splines");
! if it is set non-negative, it turns on smoothing of the lines drawn;
! the value zero says to use cubic splines; values greater than zero
! say to use splines under tension and specify what tension to use.
! Values greater than about 15 should be avoided, as they can cause
! overflows in the smoothing routines. Note that DPSMTH always smooths;
! it treats a negative value of TENS as zero and uses cubic splines.
! The default value is -1.0
!
! WCHR is the internal parameter 'WOC' (for "Width Of Character"), which
! specifies the width of the characters to be used in writing character
! strings, given as a fraction of the width of the plotter frame.
! The default value is 0.01
!
! WGAP is the internal parameter 'WOG' (for "Width of Gap"), which
! specifies the width of a gap in a dashed line, given as a fraction
! of the width of the plotter frame.
! The default value is 0.005
!
! WSLD is the internal parameter 'WOS' (for "Width of Solid"), which
! specifies the width of a solid in a dashed line, given as a fraction
! of the width of the plotter frame.
! The default value is 0.005
!
!-------------------
! added by CNCARG
!-------------------
!
! TXCI is the internal parameter 'TXC' (for "Color Index of Label-Text"),
! which specifies the pen (color index) used to draw text.
! The default value is -1
!
! PMCI is the internal parameter 'PMC' (for "Color Index of Label-Marker")
! which specifies the pen (color index) used to draw marker.
! The default value is -1
!
! Note: "-1" means using current ployline color index to draw
!
!=====================================================================
!
! SUBROUTINE NG_DPSET1( LCDP, IDPS, INDP, RLS1, RLS2,&
! ILTL, RMFS, IPCF, ISBF, ISCF,&
! ANGF, DBPI, TENS, WCHR, WGAP,&
! WSLD, EPSI, TXCI, PMCI, CHDP,&
! CHRB, CHRG, CHRS )
!
! Routine to set internal parameters
!
! Variables:
!
! REAL, INTENT(IN), OPTIONAL :: ANGF, DBPI, EPSI, RLS1, RLS2
! REAL, INTENT(IN), OPTIONAL :: RMFS, TENS, WCHR, WGAP, WSLD
! INTEGER, INTENT(IN), OPTIONAL :: IDPS, ILTL, INDP, IPCF, ISBF
! INTEGER, INTENT(IN), OPTIONAL :: ISCF, LCDP, TXCI, PMCI
! CHARACTER(*), INTENT(IN), OPTIONAL :: CHDP, CHRB, CHRG, CHRS
!
! LCDP - 'DPL', (for "Dash Pattern Length")
! IDPS - 'DPS', (for "Dash Pattern Selector")
! INDP - 'DPT', (for "Dash PaTtern") (integer)
! RLS1 - 'LS1', (for "Label Spacing 1")
! RLS2 - 'LS2', (for "Label Spacing 2")
! ILTL - 'LTL', (for "Lines Through Labels")
! RMFS - 'MFS', (for "Multiplier for First Solid")
! IPCF - 'PCF', (for "PlotChar Flag")
! ISBF - 'SBF', (for "String Buffering Flag")
! ISCF - 'SCF', (for "Single-Character Flag")
! ANGF - 'SAF', (for "String Angle Flag")
! DBPI - 'SSL', (for "Smoothed Segment Length")
! TENS - 'TCS', (for "Tension on Cubic Splines")
! WCHR - 'WOC', (for "Width Of Character")
! WGAP - 'WOG', (for "Width of Gap")
! WSLD - 'WOS', (for "Width of Solid")
! EPSI - 'EPS', (for "EPSilon")
! TXCI - 'TXC', (for "Pen Number or color index of Label-Text")
! PMCI - 'PMC', (for "Pen Number or color index of Label-Marker")
! CHDP - 'DPT', (for "Dash PaTtern") (character)
! CHRB - 'CRB', (for "Character Representing Break")
! CHRG - 'CRG', (for "Character Representing Gap")
! CHRS - 'CRS', (for "Character Representing Solid")
!
!---------------------------------------------------------------------
!
! SUBROUTINE NG_DPGET1( LCDP, IDPS, INDP, RLS1, RLS2,&
! ILTL, RMFS, IPCF, ISBF, ISCF,&
! ANGF, DBPI, TENS, WCHR, WGAP,&
! WSLD, EPSI, TXCI, PMCI, CHDP,&
! CHRB, CHRG, CHRS )
!
! Routine to set internal parameters
!
! Variables:
!
! REAL, INTENT(OUT), OPTIONAL :: ANGF, DBPI, EPSI, RLS1, RLS2
! REAL, INTENT(OUT), OPTIONAL :: RMFS, TENS, WCHR, WGAP, WSLD
! INTEGER, INTENT(OUT), OPTIONAL :: IDPS, ILTL, INDP, IPCF, ISBF
! INTEGER, INTENT(OUT), OPTIONAL :: ISCF, LCDP, TXCI, PMCI
! CHARACTER(*), INTENT(OUT), OPTIONAL :: CHDP, CHRB, CHRG, CHRS
!
!=====================================================================
! Old family of NCAR DASH (DASHLINE, DASHCHAR, DASHSMTH, and DASHSUPR)
!=====================================================================
!
!=======================================
! Dash-Line Setting Routines
!=======================================
!
! SUBROUTINE NG_DASHDC( IPAT, JCRT, JSIZ )
! Routine to set character-string dash pattern with labels
!
! IPAT
! A character string of arbitrary length
! (60 characters seems to be a practical
! limit) which specifies the dash pattern
! to be used. A dollar sign "$" in IPAT
! indicates solid; an underscore "_" indicates
! a gap. Any character in IPAT which is not
! a dollar sign or underscore is considered
! to be part of a line label. Each line label
! can be at most 15 characters in length.
! Sufficient white space is reserved in the
! dashed line for writing line labels.
!
! JCRT
! The length in plotter address units per
! $ or underscore.
!
! JSIZE
! Is the size of the plotted characters:
! . If between 0 and 3 , it is 1., 1.5, 2.
! and 3. times an 8 plotter address unit
! width.
! . If greater than 3, it is the character
! width in plotter address units.
!
!---------------------------------------
!
! SUBROUTINE NG_DASHDB( IPAT )
! Routine to set binary dash pattern without labels
!
! IPAT is a 16-bit dash pattern. By default
! each bit in the pattern represents 3 plotter
! address units (1=solid, 0=blank)
!
!=======================================
! Dash-Line Drawing Routines
!=======================================
!
! NG_CURVED(X,Y,N)
! X and Y are arrays of NG world coordinate values
! of length N or greater. Line segments obeying
! the specified dash pattern are drawn to
! connect the N points.
!
! NG_FRSTD(X,Y)
! The current pen position is set to
! the NG world coordinate value (X,Y)
!
! NG_VECTD(X,Y)
! A line segment is drawn between the
! NG world coordinate value (X,Y) and the
! most recent pen position. (X,Y) then
! becomes the most recent pen position.
!
! NG_LASTD()
! When using FRSTD and VECTD, LASTD may be
! called (no arguments needed). If the dashed
! line package was leaving a space for characters,
! and the line ended before there was enough space
! for the characters, the space left will be
! filled in if LASTD is called.
!
! NG_LINED(XA,XB,YA,YB) ! no smoothing
! A line is drawn between NG world coordinate
! values (XA,YA) and (XB,YB).
!
!---------------------------------------------------------------------
!
! SUBROUTINE NG_DASHDC( IPAT, JCRT, JSIZ )
! USE CNCARG
! IMPLICIT NONE
! CHARACTER(*), INTENT(IN) :: IPAT
! INTEGER, INTENT(IN) :: JCRT, JSIZ
! INTEGER :: ISIZ
! REAL :: WIDTH1, WIDTH2
!
! WIDTH1 = REAL(JCRT-1)/1023.0
! SELECT CASE( JSIZ )
! CASE( 0 )
! ISIZ=8
! CASE( 1 )
! ISIZ=12
! CASE( 2 )
! ISIZ=16
! CASE( 3 )
! ISIZ=24
! CASE DEFAULT
! ISIZ=JSIZ
! END SELECT
! WIDTH2 = REAL(ISIZ)/1023.0
!
! CALL NG_DPSETI( 'DPS - DASH PATTERN SELECTOR', 0 )
! CALL NG_DPSETC( 'DPT - DASH PATTERN (CHARACTER)', IPAT )
! CALL NG_DPSETR( 'WOG - WIDTH OF GAP', WIDTH1 )
! CALL NG_DPSETR( 'WOS - WIDTH OF SOLID', WIDTH1 )
! CALL NG_DPSETR( 'WOC - WIDTH OF CHARACTER', WIDTH2 )
!
! END SUBROUTINE NG_DASHDC
!
! !-------------------------------------
!
! SUBROUTINE NG_DASHDB( IPAT )
! USE CNCARG
! IMPLICIT NONE
! INTEGER, INTENT(IN) :: IPAT
!
! CALL NG_DPSETI( 'DPS - DASH PATTERN SELECTOR', -16 )
! CALL NG_DPSETI( 'DPT - DASH PATTERN (INTEGER)', IPAT )
!
! END SUBROUTINE NG_DASHDB
!
! !-------------------------------------
!
! SUBROUTINE NG_CURVED( x, y, n )
! USE CNCARG
! IMPLICIT NONE
! INTEGER, INTENT(IN) :: n
! REAL, INTENT(IN) :: x(n), y(n) ! NG world coordinates
!
! CALL NG_DPCURV( x, y, n )
!
! END SUBROUTINE NG_CURVED
!
! !-------------------------------------
!
! SUBROUTINE NG_FRSTD( x, y )
! USE CNCARG
! IMPLICIT NONE
! REAL, INTENT(IN) :: x, y ! NG world coordinates
!
! CALL NG_DPFRST( x, y )
!
! END SUBROUTINE NG_FRSTD
!
! !-------------------------------------
!
! SUBROUTINE NG_VECTD( x, y )
! USE CNCARG
! IMPLICIT NONE
! REAL, INTENT(IN) :: x, y ! NG world coordinates
!
! CALL NG_DPVECT( x, y )
!
! END SUBROUTINE NG_VECTD
!
! !-------------------------------------
!
! SUBROUTINE NG_LINED( x1, y1, x2, y2 )
! USE CNCARG
! IMPLICIT NONE
! REAL, INTENT(IN) :: x1, y1, x2, y2 ! NG world coordinates
!
! CALL NG_DPLINE( x1, y1, x2, y2 )
!
! END SUBROUTINE NG_LINED
!
!=====================================================================
! Refer "NCAR menu" for interfacing DASKPACK in detail
!=====================================================================