head	8.7;
access;
symbols;
locks; strict;
comment	@c @;


8.7
date	2026.05.11.12.01.11;	author mcalabre;	state Exp;
branches;
next	8.6;

8.6
date	2026.03.29.13.53.57;	author mcalabre;	state Exp;
branches
	8.6.1.1;
next	8.5;

8.5
date	2025.12.06.13.47.42;	author mcalabre;	state Exp;
branches
	8.5.1.1;
next	8.4;

8.4
date	2024.10.28.13.56.18;	author mcalabre;	state Exp;
branches
	8.4.1.1;
next	8.3;

8.3
date	2024.05.13.16.33.01;	author mcalabre;	state Exp;
branches
	8.3.1.1;
next	8.2;

8.2
date	2023.11.16.10.00.31;	author mcalabre;	state Exp;
branches
	8.2.1.1;
next	8.1;

8.1
date	2023.07.05.17.12.07;	author mcalabre;	state Exp;
branches
	8.1.1.1;
next	8.0;

8.0
date	2023.07.01.06.15.05;	author mcalabre;	state Exp;
branches
	8.0.1.1;
next	7.13;

7.13
date	2022.10.07.03.43.35;	author mcalabre;	state Exp;
branches
	7.13.1.1;
next	7.12;

7.12
date	2022.09.09.04.57.58;	author mcalabre;	state Exp;
branches
	7.12.1.1;
next	7.11;

7.11
date	2022.04.26.06.13.52;	author mcalabre;	state Exp;
branches
	7.11.1.1;
next	7.10;

7.10
date	2022.04.23.14.25.15;	author mcalabre;	state Exp;
branches
	7.10.1.1;
next	7.9;

7.9
date	2022.03.25.15.14.49;	author mcalabre;	state Exp;
branches
	7.9.1.1;
next	7.8;

7.8
date	2022.03.25.06.11.50;	author mcalabre;	state Exp;
branches
	7.8.1.1;
next	7.7;

7.7
date	2021.07.12.06.36.49;	author mcalabre;	state Exp;
branches
	7.7.1.1;
next	7.6;

7.6
date	2021.04.13.12.57.02;	author mcalabre;	state Exp;
branches
	7.6.1.1;
next	7.5;

7.5
date	2021.03.20.05.54.59;	author mcalabre;	state Exp;
branches
	7.5.1.1;
next	7.4;

7.4
date	2021.01.31.02.24.52;	author mcalabre;	state Exp;
branches
	7.4.1.1;
next	7.3;

7.3
date	2020.06.03.03.37.03;	author mcalabre;	state Exp;
branches
	7.3.1.1;
next	7.2;

7.2
date	2020.03.09.07.31.24;	author mcalabre;	state Exp;
branches
	7.2.1.1;
next	7.1;

7.1
date	2019.12.31.13.25.20;	author mcalabre;	state Exp;
branches
	7.1.1.1;
next	6.4;

6.4
date	2019.08.15.09.30.18;	author mcalabre;	state Exp;
branches
	6.4.1.1;
next	6.3;

6.3
date	2019.07.12.07.33.40;	author mcalabre;	state Exp;
branches
	6.3.1.1;
next	6.2;

6.2
date	2018.10.20.10.03.14;	author mcalabre;	state Exp;
branches
	6.2.1.1;
next	6.1;

6.1
date	2018.10.19.08.35.17;	author mcalabre;	state Exp;
branches
	6.1.1.1;
next	5.20;

5.20
date	2018.10.05.05.32.42;	author mcalabre;	state Exp;
branches
	5.20.1.1;
next	5.19;

5.19
date	2018.07.26.15.37.05;	author mcalabre;	state Exp;
branches
	5.19.1.1;
next	5.18;

5.18
date	2018.01.10.08.32.14;	author mcalabre;	state Exp;
branches
	5.18.1.1;
next	5.17;

5.17
date	2017.09.18.08.44.25;	author mcalabre;	state Exp;
branches
	5.17.1.1;
next	5.16;

5.16
date	2017.01.15.04.25.03;	author mcalabre;	state Exp;
branches
	5.16.1.1;
next	5.15;

5.15
date	2016.04.05.12.55.13;	author mcalabre;	state Exp;
branches
	5.15.1.1;
next	5.14;

5.14
date	2016.02.07.10.49.33;	author mcalabre;	state Exp;
branches
	5.14.1.1;
next	5.13;

5.13
date	2016.01.26.08.51.16;	author mcalabre;	state Exp;
branches
	5.13.1.1;
next	5.12;

5.12
date	2015.11.15.02.13.03;	author mcalabre;	state Exp;
branches
	5.12.1.1;
next	5.11;

5.11
date	2015.10.18.09.13.08;	author mcalabre;	state Exp;
branches
	5.11.1.1;
next	5.10;

5.10
date	2015.10.09.08.19.18;	author mcalabre;	state Exp;
branches
	5.10.1.1;
next	5.9;

5.9
date	2015.07.21.09.20.04;	author mcalabre;	state Exp;
branches
	5.9.1.1;
next	5.8;

5.8
date	2015.07.08.11.04.03;	author mcalabre;	state Exp;
branches
	5.8.1.1;
next	5.7;

5.7
date	2015.06.29.02.44.19;	author mcalabre;	state Exp;
branches
	5.7.1.1;
next	5.6;

5.6
date	2015.06.14.07.11.26;	author mcalabre;	state Exp;
branches
	5.6.1.1;
next	5.5;

5.5
date	2015.05.05.13.16.34;	author mcalabre;	state Exp;
branches
	5.5.1.1;
next	5.4;

5.4
date	2015.04.21.14.41.08;	author mcalabre;	state Exp;
branches
	5.4.1.1;
next	5.3;

5.3
date	2015.04.21.02.50.54;	author mcalabre;	state Exp;
branches
	5.3.1.1;
next	5.2;

5.2
date	2015.04.15.12.35.10;	author mcalabre;	state Exp;
branches
	5.2.1.1;
next	5.1;

5.1
date	2015.04.07.10.56.39;	author mcalabre;	state Exp;
branches
	5.1.1.1;
next	5.0;

5.0
date	2015.04.05.12.25.03;	author mcalabre;	state Exp;
branches
	5.0.1.1;
next	4.25;

4.25
date	2014.12.14.14.29.38;	author mcalabre;	state Exp;
branches
	4.25.1.1;
next	4.24;

4.24
date	2014.09.18.15.25.02;	author mcalabre;	state Exp;
branches
	4.24.1.1;
next	4.23;

4.23
date	2014.05.13.05.50.53;	author mcalabre;	state Exp;
branches
	4.23.1.1;
next	4.22;

4.22
date	2014.04.12.15.03.54;	author mcalabre;	state Exp;
branches
	4.22.1.1;
next	4.21;

4.21
date	2014.03.24.05.12.29;	author mcalabre;	state Exp;
branches
	4.21.1.1;
next	4.20;

4.20
date	2013.12.18.05.42.51;	author mcalabre;	state Exp;
branches
	4.20.1.1;
next	4.19;

4.19
date	2013.09.29.14.17.53;	author mcalabre;	state Exp;
branches
	4.19.1.1;
next	4.18;

4.18
date	2013.07.13.10.00.06;	author mcalabre;	state Exp;
branches
	4.18.1.1;
next	4.17;

4.17
date	2013.01.29.05.29.22;	author cal103;	state Exp;
branches
	4.17.1.1;
next	4.16;

4.16
date	2012.11.07.04.42.45;	author cal103;	state Exp;
branches
	4.16.1.1;
next	4.15;

4.15
date	2012.09.26.14.26.06;	author cal103;	state Exp;
branches
	4.15.1.1;
next	4.14;

4.14
date	2012.07.13.10.02.47;	author cal103;	state Exp;
branches
	4.14.1.1;
next	4.13;

4.13
date	2012.03.14.07.39.31;	author cal103;	state Exp;
branches
	4.13.1.1;
next	4.12;

4.12
date	2012.02.29.07.57.57;	author cal103;	state Exp;
branches
	4.12.1.1;
next	4.11;

4.11
date	2012.02.20.23.30.03;	author cal103;	state Exp;
branches
	4.11.1.1;
next	4.10;

4.10
date	2012.02.05.23.41.45;	author cal103;	state Exp;
branches
	4.10.1.1;
next	4.9;

4.9
date	2012.01.24.05.40.30;	author cal103;	state Exp;
branches
	4.9.1.1;
next	4.8;

4.8
date	2011.08.15.08.05.55;	author cal103;	state Exp;
branches
	4.8.1.1;
next	4.7;

4.7
date	2011.02.07.07.03.43;	author cal103;	state Exp;
branches
	4.7.1.1;
next	4.6;

4.6
date	2010.11.16.06.15.32;	author cal103;	state Exp;
branches
	4.6.1.1;
next	4.5;

4.5
date	2010.07.16.07.01.27;	author cal103;	state Exp;
branches
	4.5.1.1;
next	4.4;

4.4
date	2009.08.06.07.54.40;	author cal103;	state Exp;
branches
	4.4.1.1;
next	4.3;

4.3
date	2007.12.27.05.49.14;	author cal103;	state Exp;
branches
	4.3.1.1;
next	4.2;

4.2
date	2005.09.21.13.27.15;	author cal103;	state Exp;
branches
	4.2.1.1;
next	4.1;

4.1
date	2005.08.19.13.39.28;	author cal103;	state Exp;
branches;
next	4.0;

4.0
date	2005.02.04.12.22.25;	author cal103;	state Exp;
branches;
next	3.6;

3.6
date	2004.08.24.08.34.02;	author cal103;	state Exp;
branches;
next	3.5;

3.5
date	2004.06.28.05.26.38;	author mcalabre;	state Exp;
branches;
next	3.4;

3.4
date	2004.02.10.23.56.37;	author mcalabre;	state Exp;
branches;
next	3.3;

3.3
date	2003.10.22.07.34.59;	author mcalabre;	state Exp;
branches;
next	3.2;

3.2
date	2003.09.09.07.58.57;	author mcalabre;	state Exp;
branches;
next	3.1;

3.1
date	2003.04.28.05.02.51;	author mcalabre;	state Exp;
branches;
next	1.21;

1.21
date	2000.11.13.07.18.21;	author mcalabre;	state Exp;
branches;
next	1.20;

1.20
date	2000.05.24.05.22.20;	author mcalabre;	state Exp;
branches;
next	1.19;

1.19
date	2000.05.10.04.54.48;	author mcalabre;	state Exp;
branches;
next	1.18;

1.18
date	99.12.01.04.14.08;	author mcalabre;	state Exp;
branches;
next	1.17;

1.17
date	99.12.01.04.12.09;	author mcalabre;	state Exp;
branches;
next	1.16;

1.16
date	99.07.22.02.04.03;	author mcalabre;	state Exp;
branches;
next	1.15;

1.15
date	99.06.01.01.12.26;	author mcalabre;	state Exp;
branches;
next	1.14;

1.14
date	97.04.14.23.31.10;	author mcalabre;	state Exp;
branches;
next	1.13;

1.13
date	97.04.11.02.15.17;	author mcalabre;	state Exp;
branches;
next	1.12;

1.12
date	97.04.09.01.57.19;	author mcalabre;	state Exp;
branches;
next	1.11;

1.11
date	97.04.03.04.14.08;	author mcalabre;	state Exp;
branches;
next	1.10;

1.10
date	97.03.18.07.30.16;	author mcalabre;	state Exp;
branches;
next	1.9;

1.9
date	97.03.14.06.58.29;	author mcalabre;	state Exp;
branches;
next	1.8;

1.8
date	97.03.13.06.57.17;	author mcalabre;	state Exp;
branches;
next	1.7;

1.7
date	97.03.11.06.53.24;	author mcalabre;	state Exp;
branches;
next	1.6;

1.6
date	97.03.10.22.31.50;	author mcalabre;	state Exp;
branches;
next	1.5;

1.5
date	97.02.19.06.58.56;	author mcalabre;	state Exp;
branches;
next	1.4;

1.4
date	97.02.18.03.39.34;	author mcalabre;	state Exp;
branches;
next	1.3;

1.3
date	97.02.07.05.48.22;	author mcalabre;	state Exp;
branches;
next	1.2;

1.2
date	97.02.07.03.57.14;	author mcalabre;	state Exp;
branches;
next	1.1;

1.1
date	96.12.18.06.41.22;	author mcalabre;	state Exp;
branches;
next	;

4.2.1.1
date	2005.12.05.03.23.34;	author cal103;	state Exp;
branches;
next	;

4.3.1.1
date	2007.12.27.13.26.31;	author cal103;	state Exp;
branches;
next	4.3.1.2;

4.3.1.2
date	2009.07.23.04.17.17;	author cal103;	state Exp;
branches;
next	;

4.4.1.1
date	2009.08.10.08.55.45;	author cal103;	state Exp;
branches;
next	;

4.5.1.1
date	2010.07.16.07.05.33;	author cal103;	state Exp;
branches;
next	;

4.6.1.1
date	2010.11.16.06.16.20;	author cal103;	state Exp;
branches;
next	;

4.7.1.1
date	2011.02.07.07.04.23;	author cal103;	state Exp;
branches;
next	;

4.8.1.1
date	2011.08.15.08.07.07;	author cal103;	state Exp;
branches;
next	;

4.9.1.1
date	2012.01.24.05.41.46;	author cal103;	state Exp;
branches;
next	;

4.10.1.1
date	2012.02.05.23.42.47;	author cal103;	state Exp;
branches;
next	;

4.11.1.1
date	2012.02.20.23.31.14;	author cal103;	state Exp;
branches;
next	;

4.12.1.1
date	2012.02.29.07.59.11;	author cal103;	state Exp;
branches;
next	;

4.13.1.1
date	2012.03.14.07.40.39;	author cal103;	state Exp;
branches;
next	4.13.1.2;

4.13.1.2
date	2012.07.13.03.43.52;	author cal103;	state Exp;
branches;
next	;

4.14.1.1
date	2012.07.13.10.05.05;	author cal103;	state Exp;
branches;
next	;

4.15.1.1
date	2012.09.26.14.27.53;	author cal103;	state Exp;
branches;
next	;

4.16.1.1
date	2012.11.07.04.45.58;	author cal103;	state Exp;
branches;
next	;

4.17.1.1
date	2013.01.29.05.32.33;	author cal103;	state Exp;
branches;
next	;

4.18.1.1
date	2013.07.13.10.02.40;	author mcalabre;	state Exp;
branches;
next	;

4.19.1.1
date	2013.09.29.14.20.41;	author mcalabre;	state Exp;
branches;
next	;

4.20.1.1
date	2013.12.18.05.46.57;	author mcalabre;	state Exp;
branches;
next	;

4.21.1.1
date	2014.03.24.05.15.31;	author mcalabre;	state Exp;
branches;
next	;

4.22.1.1
date	2014.04.12.15.06.34;	author mcalabre;	state Exp;
branches;
next	;

4.23.1.1
date	2014.05.13.05.53.52;	author mcalabre;	state Exp;
branches;
next	;

4.24.1.1
date	2014.09.18.15.28.12;	author mcalabre;	state Exp;
branches;
next	;

4.25.1.1
date	2014.12.14.14.32.48;	author mcalabre;	state Exp;
branches;
next	;

5.0.1.1
date	2015.04.05.12.28.04;	author mcalabre;	state Exp;
branches;
next	;

5.1.1.1
date	2015.04.07.11.01.13;	author mcalabre;	state Exp;
branches;
next	;

5.2.1.1
date	2015.04.15.12.39.18;	author mcalabre;	state Exp;
branches;
next	;

5.3.1.1
date	2015.04.21.02.54.06;	author mcalabre;	state Exp;
branches;
next	;

5.4.1.1
date	2015.04.21.14.44.32;	author mcalabre;	state Exp;
branches;
next	;

5.5.1.1
date	2015.05.05.13.21.04;	author mcalabre;	state Exp;
branches;
next	;

5.6.1.1
date	2015.06.14.07.14.48;	author mcalabre;	state Exp;
branches;
next	;

5.7.1.1
date	2015.06.29.02.47.27;	author mcalabre;	state Exp;
branches;
next	;

5.8.1.1
date	2015.07.08.11.07.22;	author mcalabre;	state Exp;
branches;
next	;

5.9.1.1
date	2015.07.21.09.28.12;	author mcalabre;	state Exp;
branches;
next	;

5.10.1.1
date	2015.10.09.08.22.40;	author mcalabre;	state Exp;
branches;
next	;

5.11.1.1
date	2015.10.18.09.16.31;	author mcalabre;	state Exp;
branches;
next	;

5.12.1.1
date	2015.11.15.02.16.18;	author mcalabre;	state Exp;
branches;
next	;

5.13.1.1
date	2016.01.26.08.54.36;	author mcalabre;	state Exp;
branches;
next	;

5.14.1.1
date	2016.02.07.10.52.48;	author mcalabre;	state Exp;
branches;
next	;

5.15.1.1
date	2016.04.05.12.58.39;	author mcalabre;	state Exp;
branches;
next	;

5.16.1.1
date	2017.01.15.04.29.04;	author mcalabre;	state Exp;
branches;
next	;

5.17.1.1
date	2017.09.18.08.46.01;	author mcalabre;	state Exp;
branches;
next	;

5.18.1.1
date	2018.01.10.08.33.04;	author mcalabre;	state Exp;
branches;
next	;

5.19.1.1
date	2018.07.26.15.41.42;	author mcalabre;	state Exp;
branches;
next	;

5.20.1.1
date	2018.10.05.05.33.33;	author mcalabre;	state Exp;
branches;
next	;

6.1.1.1
date	2018.10.19.08.36.15;	author mcalabre;	state Exp;
branches;
next	;

6.2.1.1
date	2018.10.20.10.04.15;	author mcalabre;	state Exp;
branches;
next	;

6.3.1.1
date	2019.07.12.07.34.37;	author mcalabre;	state Exp;
branches;
next	;

6.4.1.1
date	2019.08.15.09.31.29;	author mcalabre;	state Exp;
branches;
next	;

7.1.1.1
date	2019.12.31.13.28.19;	author mcalabre;	state Exp;
branches;
next	;

7.2.1.1
date	2020.03.09.07.34.50;	author mcalabre;	state Exp;
branches;
next	;

7.3.1.1
date	2020.06.03.03.38.11;	author mcalabre;	state Exp;
branches;
next	;

7.4.1.1
date	2021.01.31.02.26.24;	author mcalabre;	state Exp;
branches;
next	;

7.5.1.1
date	2021.03.20.05.56.42;	author mcalabre;	state Exp;
branches;
next	;

7.6.1.1
date	2021.04.13.13.00.37;	author mcalabre;	state Exp;
branches;
next	;

7.7.1.1
date	2021.07.12.06.38.28;	author mcalabre;	state Exp;
branches;
next	;

7.8.1.1
date	2022.03.25.06.14.15;	author mcalabre;	state Exp;
branches;
next	;

7.9.1.1
date	2022.03.25.15.16.40;	author mcalabre;	state Exp;
branches;
next	;

7.10.1.1
date	2022.04.23.14.26.55;	author mcalabre;	state Exp;
branches;
next	;

7.11.1.1
date	2022.04.26.06.15.33;	author mcalabre;	state Exp;
branches;
next	;

7.12.1.1
date	2022.09.09.05.00.36;	author mcalabre;	state Exp;
branches;
next	;

7.13.1.1
date	2022.10.07.03.45.47;	author mcalabre;	state Exp;
branches;
next	;

8.0.1.1
date	2023.07.01.06.22.45;	author mcalabre;	state Exp;
branches;
next	;

8.1.1.1
date	2023.07.05.17.15.01;	author mcalabre;	state Exp;
branches;
next	;

8.2.1.1
date	2023.11.16.10.05.59;	author mcalabre;	state Exp;
branches;
next	;

8.3.1.1
date	2024.05.13.16.35.40;	author mcalabre;	state Exp;
branches;
next	;

8.4.1.1
date	2024.10.28.13.58.42;	author mcalabre;	state Exp;
branches;
next	;

8.5.1.1
date	2025.12.06.14.05.17;	author mcalabre;	state Exp;
branches;
next	8.5.1.2;

8.5.1.2
date	2026.03.29.13.45.57;	author mcalabre;	state Exp;
branches;
next	;

8.6.1.1
date	2026.03.29.14.19.28;	author mcalabre;	state Exp;
branches;
next	;


desc
@PGPLOT routine to draw and label a non-linear coordinate grid.
@


8.7
log
@WCSLIB 8.7
@
text
@*=======================================================================
*                              PGSBOX 8.7
*-----------------------------------------------------------------------
*
* ATTENTION!
* ----------
*
* PGCRVL is defunct.
*
* Do not use this routine - use PGSBOX instead.
* ---------------------------------------------
*
* What remains here is a driver for the more general PGSBOX routine
* which is not based on pixel coordinates.
*
* This residue of PGCRVL exists mainly for backwards compatibility.
* PGCRVL's old AXEN argument is here translated into the BLC and TRC
* arguments required by PGSBOX.
*
* New applications should use PGSBOX directly.
*
* Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.
* http://www.atnf.csiro.au/computing/software/wcs
* $Id: pgcrvl.f,v 8.6.1.1 2026/03/29 14:19:28 mcalabre Exp mcalabre $
*=======================================================================
      SUBROUTINE PGCRVL (AXEN, IDENTS, OPT, LABCTL, LABDEN, CI, GCODE,
     :   TIKLEN, NG1, GRID1, NG2, GRID2, DOEQ, NLFUNC, NLC, NLI, NLD,
     :   NLCPRM, NLIPRM, NLDPRM, NC, IC, CACHE, IERR)
*-----------------------------------------------------------------------
      LOGICAL   DOEQ
      INTEGER   AXEN(2), CI(7), GCODE(2), IC, IERR, LABCTL, LABDEN, NC,
     :          NG1, NG2, NLC, NLD, NLI, NLIPRM(NLI)
      REAL      BLC(2), TRC(2)
      DOUBLE PRECISION CACHE(4,0:NC), GRID1(0:NG1), GRID2(0:NG2),
     :          NLDPRM(NLD), TIKLEN
      CHARACTER IDENTS(3)*(*), NLCPRM(NLC)*1, OPT(2)*(*)

      EXTERNAL NLFUNC
*-----------------------------------------------------------------------
      BLC(1) = 0.5
      BLC(2) = 0.5
      TRC(1) = AXEN(1) + 0.5
      TRC(2) = AXEN(2) + 0.5

      CALL PGSBOX (BLC, TRC, IDENTS, OPT, LABCTL, LABDEN, CI, GCODE,
     :  TIKLEN, NG1, GRID1, NG2, GRID2, DOEQ, NLFUNC, NLC, NLI, NLD,
     :  NLCPRM, NLIPRM, NLDPRM, NC, IC, CACHE, IERR)

      RETURN
      END
@


8.6
log
@WCSLIB 8.6
@
text
@d2 1
a2 1
*                              PGSBOX 8.6
d24 1
a24 1
* $Id: pgcrvl.f,v 8.5.1.2 2026/03/29 13:45:57 mcalabre Exp mcalabre $
@


8.6.1.1
log
@WCSLIB 8.6 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 8.6 2026/03/29 13:53:57 mcalabre Exp $
@


8.5
log
@WCSLIB 8.5
@
text
@d2 1
a2 1
*                              PGSBOX 8.5
d23 2
a24 2
* http://www.atnf.csiro.au/people/Mark.Calabretta
* $Id: pgcrvl.f,v 8.4.1.1 2024/10/28 13:58:42 mcalabre Exp mcalabre $
@


8.5.1.1
log
@WCSLIB 8.5 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 8.5 2025/12/06 13:47:42 mcalabre Exp $
@


8.5.1.2
log
@Updated the URL for WCSLIB on ATNF's website.
@
text
@d23 2
a24 2
* http://www.atnf.csiro.au/computing/software/wcs
* $Id: pgcrvl.f,v 8.5.1.1 2025/12/06 14:05:17 mcalabre Exp mcalabre $
@


8.4
log
@WCSLIB 8.4
@
text
@d2 1
a2 1
*                              PGSBOX 8.4
d24 1
a24 1
* $Id: pgcrvl.f,v 8.3.1.1 2024/05/13 16:35:40 mcalabre Exp mcalabre $
@


8.4.1.1
log
@WCSLIB 8.4 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 8.4 2024/10/28 13:56:18 mcalabre Exp $
@


8.3
log
@WCSLIB 8.3
@
text
@d2 1
a2 1
*                              PGSBOX 8.3
d24 1
a24 1
* $Id: pgcrvl.f,v 8.2.1.1 2023/11/16 10:05:59 mcalabre Exp mcalabre $
@


8.3.1.1
log
@WCSLIB 8.3 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 8.3 2024/05/13 16:33:01 mcalabre Exp $
@


8.2
log
@WCSLIB 8.2
@
text
@d2 1
a2 1
*                              PGSBOX 8.2
d24 1
a24 1
* $Id: pgcrvl.f,v 8.1.1.1 2023/07/05 17:15:01 mcalabre Exp mcalabre $
@


8.2.1.1
log
@WCSLIB 8.2 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 8.2 2023/11/16 10:00:31 mcalabre Exp $
@


8.1
log
@WCSLIB 8.1
@
text
@d2 1
a2 1
*                              PGSBOX 8.1
d24 1
a24 1
* $Id: pgcrvl.f,v 8.0.1.1 2023/07/01 06:22:45 mcalabre Exp mcalabre $
@


8.1.1.1
log
@WCSLIB 8.1 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 8.1 2023/07/05 17:12:07 mcalabre Exp $
@


8.0
log
@WCSLIB 8.0
@
text
@d2 1
a2 1
*                              PGSBOX 8.0
d24 1
a24 1
* $Id: pgcrvl.f,v 7.13.1.1 2022/10/07 03:45:47 mcalabre Exp mcalabre $
@


8.0.1.1
log
@WCSLIB 8.0 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 8.0 2023/07/01 06:15:05 mcalabre Exp $
@


7.13
log
@WCSLIB 7.13
@
text
@d2 1
a2 1
*                              PGSBOX 7.13
d24 1
a24 1
* $Id: pgcrvl.f,v 7.12.1.1 2022/09/09 05:00:36 mcalabre Exp mcalabre $
@


7.13.1.1
log
@WCSLIB 7.13 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 7.13 2022/10/07 03:43:35 mcalabre Exp $
@


7.12
log
@WCSLIB 7.12
@
text
@d2 1
a2 1
*                              PGSBOX 7.12
d24 1
a24 1
* $Id: pgcrvl.f,v 7.11.1.1 2022/04/26 06:15:33 mcalabre Exp mcalabre $
@


7.12.1.1
log
@WCSLIB 7.12 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 7.12 2022/09/09 04:57:58 mcalabre Exp $
@


7.11
log
@WCSLIB 7.11
@
text
@d2 1
a2 1
*                              PGSBOX 7.11
d24 1
a24 1
* $Id: pgcrvl.f,v 7.10.1.1 2022/04/23 14:26:55 mcalabre Exp mcalabre $
@


7.11.1.1
log
@WCSLIB 7.11 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 7.11 2022/04/26 06:13:52 mcalabre Exp $
@


7.10
log
@WCSLIB 7.10
@
text
@d2 1
a2 1
*                              PGSBOX 7.10
d24 1
a24 1
* $Id: pgcrvl.f,v 7.9.1.1 2022/03/25 15:16:40 mcalabre Exp mcalabre $
@


7.10.1.1
log
@WCSLIB 7.10 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 7.10 2022/04/23 14:25:15 mcalabre Exp $
@


7.9
log
@WCSLIB 7.9
@
text
@d2 1
a2 1
*                              PGSBOX 7.9
d24 1
a24 1
* $Id: pgcrvl.f,v 7.8.1.1 2022/03/25 06:14:15 mcalabre Exp mcalabre $
@


7.9.1.1
log
@WCSLIB 7.9 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 7.9 2022/03/25 15:14:49 mcalabre Exp $
@


7.8
log
@WCSLIB 7.8
@
text
@d2 1
a2 1
*                              PGSBOX 7.8
d24 1
a24 1
* $Id: pgcrvl.f,v 7.7.1.1 2021/07/12 06:38:28 mcalabre Exp mcalabre $
@


7.8.1.1
log
@WCSLIB 7.8 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 7.8 2022/03/25 06:11:50 mcalabre Exp $
@


7.7
log
@WCSLIB 7.7
@
text
@d2 1
a2 1
*                              PGSBOX 7.7
d24 1
a24 1
* $Id: pgcrvl.f,v 7.6.1.1 2021/04/13 13:00:37 mcalabre Exp mcalabre $
@


7.7.1.1
log
@WCSLIB 7.7 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 7.7 2021/07/12 06:36:49 mcalabre Exp $
@


7.6
log
@WCSLIB 7.6
@
text
@d2 1
a2 1
*                              PGSBOX 7.6
d24 1
a24 1
* $Id: pgcrvl.f,v 7.5.1.1 2021/03/20 05:56:42 mcalabre Exp mcalabre $
@


7.6.1.1
log
@WCSLIB 7.6 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 7.6 2021/04/13 12:57:02 mcalabre Exp $
@


7.5
log
@WCSLIB 7.5
@
text
@d2 1
a2 1
*                              PGSBOX 7.5
d24 1
a24 1
* $Id: pgcrvl.f,v 7.4.1.1 2021/01/31 02:26:24 mcalabre Exp mcalabre $
@


7.5.1.1
log
@WCSLIB 7.5 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 7.5 2021/03/20 05:54:59 mcalabre Exp $
@


7.4
log
@WCSLIB 7.4
@
text
@d2 1
a2 1
*                              PGSBOX 7.4
d24 1
a24 1
* $Id: pgcrvl.f,v 7.3.1.1 2020/06/03 03:38:11 mcalabre Exp $
@


7.4.1.1
log
@WCSLIB 7.4 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 7.4 2021/01/31 02:24:52 mcalabre Exp $
@


7.3
log
@WCSLIB 7.3
@
text
@d2 1
a2 1
*                              PGSBOX 7.3
d24 1
a24 1
* $Id: pgcrvl.f,v 7.2.1.1 2020/03/09 07:34:50 mcalabre Exp mcalabre $
@


7.3.1.1
log
@WCSLIB 7.3 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 7.3 2020/06/03 03:37:03 mcalabre Exp $
@


7.2
log
@WCSLIB 7.2
@
text
@d2 1
a2 1
*                              PGSBOX 7.2
d24 1
a24 1
* $Id: pgcrvl.f,v 7.1.1.1 2019/12/31 13:28:19 mcalabre Exp mcalabre $
@


7.2.1.1
log
@WCSLIB 7.2 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 7.2 2020/03/09 07:31:24 mcalabre Exp $
@


7.1
log
@WCSLIB 7.1
@
text
@d2 1
a2 1
*                              PGSBOX 7.1
d24 1
a24 1
* $Id: pgcrvl.f,v 6.4.1.1 2019/08/15 09:31:29 mcalabre Exp mcalabre $
@


7.1.1.1
log
@WCSLIB 7.1 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 7.1 2019/12/31 13:25:20 mcalabre Exp $
@


6.4
log
@WCSLIB 6.4
@
text
@d2 1
a2 1
*                              PGSBOX 6.4
d24 1
a24 1
* $Id: pgcrvl.f,v 6.3.1.1 2019/07/12 07:34:37 mcalabre Exp mcalabre $
@


6.4.1.1
log
@WCSLIB 6.4 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 6.4 2019/08/15 09:30:18 mcalabre Exp $
@


6.3
log
@WCSLIB 6.3
@
text
@d2 1
a2 1
*                              PGSBOX 6.3
d24 1
a24 1
* $Id: pgcrvl.f,v 6.2.1.1 2018/10/20 10:04:15 mcalabre Exp mcalabre $
@


6.3.1.1
log
@WCSLIB 6.3 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 6.3 2019/07/12 07:33:40 mcalabre Exp $
@


6.2
log
@WCSLIB 6.2
@
text
@d2 1
a2 1
*                              PGSBOX 6.2
d24 1
a24 1
* $Id: pgcrvl.f,v 6.1.1.1 2018/10/19 08:36:15 mcalabre Exp mcalabre $
@


6.2.1.1
log
@WCSLIB 6.2 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 6.2 2018/10/20 10:03:14 mcalabre Exp $
@


6.1
log
@WCSLIB 6.1
@
text
@d2 1
a2 1
*                              PGSBOX 6.1
d24 1
a24 1
* $Id: pgcrvl.f,v 5.20.1.1 2018/10/05 05:33:33 mcalabre Exp mcalabre $
@


6.1.1.1
log
@WCSLIB 6.1 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 6.1 2018/10/19 08:35:17 mcalabre Exp $
@


5.20
log
@WCSLIB 5.20
@
text
@d2 1
a2 1
*                              PGSBOX 5.20
d24 1
a24 1
* $Id: pgcrvl.f,v 5.19.1.1 2018/07/26 15:41:42 mcalabre Exp mcalabre $
@


5.20.1.1
log
@WCSLIB 5.20 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 5.20 2018/10/05 05:32:42 mcalabre Exp $
@


5.19
log
@WCSLIB 5.19
@
text
@d2 1
a2 1
*                              PGSBOX 5.19
d24 1
a24 1
* $Id: pgcrvl.f,v 5.18.1.1 2018/01/10 08:33:04 mcalabre Exp mcalabre $
@


5.19.1.1
log
@WCSLIB 5.19 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 5.19 2018/07/26 15:37:05 mcalabre Exp $
@


5.18
log
@WCSLIB 5.18
@
text
@d2 1
a2 1
*                              PGSBOX 5.18
d24 1
a24 1
* $Id: pgcrvl.f,v 5.17.1.1 2017/09/18 08:46:01 mcalabre Exp $
@


5.18.1.1
log
@WCSLIB 5.18 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 5.18 2018/01/10 08:32:14 mcalabre Exp $
@


5.17
log
@WCSLIB 5.17
@
text
@d2 1
a2 1
*                              PGSBOX 5.17
d24 1
a24 1
* $Id: pgcrvl.f,v 5.16.1.1 2017/01/15 04:29:04 mcalabre Exp mcalabre $
@


5.17.1.1
log
@WCSLIB 5.17 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 5.17 2017/09/18 08:44:25 mcalabre Exp $
@


5.16
log
@WCSLIB 5.16
@
text
@d2 1
a2 1
*                              PGSBOX 5.16
d24 1
a24 1
* $Id: pgcrvl.f,v 5.15.1.1 2016/04/05 12:58:39 mcalabre Exp mcalabre $
@


5.16.1.1
log
@WCSLIB 5.16 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 5.16 2017/01/15 04:25:03 mcalabre Exp $
@


5.15
log
@WCSLIB 5.15
@
text
@d2 1
a2 1
*                              PGSBOX 5.15
d24 1
a24 1
* $Id: pgcrvl.f,v 5.14.1.1 2016/02/07 10:52:48 mcalabre Exp mcalabre $
@


5.15.1.1
log
@WCSLIB 5.15 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 5.15 2016/04/05 12:55:13 mcalabre Exp $
@


5.14
log
@WCSLIB 5.14
@
text
@d2 1
a2 1
*                              PGSBOX 5.14
d24 1
a24 1
* $Id: pgcrvl.f,v 5.13.1.1 2016/01/26 08:54:36 mcalabre Exp mcalabre $
@


5.14.1.1
log
@WCSLIB 5.14 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 5.14 2016/02/07 10:49:33 mcalabre Exp $
@


5.13
log
@WCSLIB 5.13
@
text
@d2 1
a2 1
*                              PGSBOX 5.13
d24 1
a24 1
* $Id: pgcrvl.f,v 5.12.1.1 2015/11/15 02:16:18 mcalabre Exp $
@


5.13.1.1
log
@WCSLIB 5.13 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 5.13 2016/01/26 08:51:16 mcalabre Exp $
@


5.12
log
@WCSLIB 5.12
@
text
@d2 1
a2 1
*                              PGSBOX 5.12
d24 1
a24 1
* $Id: pgcrvl.f,v 5.11.1.1 2015/10/18 09:16:31 mcalabre Exp mcalabre $
@


5.12.1.1
log
@WCSLIB 5.12 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 5.12 2015/11/15 02:13:03 mcalabre Exp $
@


5.11
log
@WCSLIB 5.11
@
text
@d2 1
a2 1
*                              PGSBOX 5.11
d24 1
a24 1
* $Id: pgcrvl.f,v 5.10.1.1 2015/10/09 08:22:40 mcalabre Exp mcalabre $
@


5.11.1.1
log
@WCSLIB 5.11 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 5.11 2015/10/18 09:13:08 mcalabre Exp $
@


5.10
log
@WCSLIB 5.10
@
text
@d2 1
a2 1
*                              PGSBOX 5.10
d24 1
a24 1
* $Id: pgcrvl.f,v 5.9.1.1 2015/07/21 09:28:12 mcalabre Exp mcalabre $
@


5.10.1.1
log
@WCSLIB 5.10 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 5.10 2015/10/09 08:19:18 mcalabre Exp $
@


5.9
log
@WCSLIB 5.9
@
text
@d2 1
a2 1
*                              PGSBOX 5.9
d24 1
a24 1
* $Id: pgcrvl.f,v 5.8.1.1 2015/07/08 11:07:22 mcalabre Exp mcalabre $
@


5.9.1.1
log
@WCSLIB 5.9 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 5.9 2015/07/21 09:20:04 mcalabre Exp $
@


5.8
log
@WCSLIB 5.8
@
text
@d2 1
a2 1
*                              PGSBOX 5.8
d24 1
a24 1
* $Id: pgcrvl.f,v 5.7.1.1 2015/06/29 02:47:27 mcalabre Exp mcalabre $
@


5.8.1.1
log
@WCSLIB 5.8 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 5.8 2015/07/08 11:04:03 mcalabre Exp $
@


5.7
log
@WCSLIB 5.7
@
text
@d2 1
a2 1
*                              PGSBOX 5.7
d24 1
a24 1
* $Id: pgcrvl.f,v 5.6.1.1 2015/06/14 07:14:48 mcalabre Exp mcalabre $
@


5.7.1.1
log
@WCSLIB 5.7 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 5.7 2015/06/29 02:44:19 mcalabre Exp $
@


5.6
log
@WCSLIB 5.6
@
text
@d2 1
a2 1
*                              PGSBOX 5.6
d24 1
a24 1
* $Id: pgcrvl.f,v 5.5.1.1 2015/05/05 13:21:04 mcalabre Exp mcalabre $
@


5.6.1.1
log
@WCSLIB 5.6 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 5.6 2015/06/14 07:11:26 mcalabre Exp $
@


5.5
log
@WCSLIB 5.5
@
text
@d2 1
a2 1
*                              PGSBOX 5.5
d24 1
a24 1
* $Id: pgcrvl.f,v 5.4.1.1 2015/04/21 14:44:32 mcalabre Exp mcalabre $
@


5.5.1.1
log
@WCSLIB 5.5 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 5.5 2015/05/05 13:16:34 mcalabre Exp $
@


5.4
log
@WCSLIB 5.4
@
text
@d2 1
a2 1
*                              PGSBOX 5.4
d24 1
a24 1
* $Id: pgcrvl.f,v 5.3.1.1 2015/04/21 02:54:06 mcalabre Exp mcalabre $
@


5.4.1.1
log
@WCSLIB 5.4 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 5.4 2015/04/21 14:41:08 mcalabre Exp $
@


5.3
log
@WCSLIB 5.3
@
text
@d2 1
a2 1
*                              PGSBOX 5.3
d24 1
a24 1
* $Id: pgcrvl.f,v 5.2.1.1 2015/04/15 12:39:18 mcalabre Exp mcalabre $
@


5.3.1.1
log
@WCSLIB 5.3 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 5.3 2015/04/21 02:50:54 mcalabre Exp $
@


5.2
log
@WCSLIB 5.2
@
text
@d2 1
a2 1
*                              PGSBOX 5.2
d24 1
a24 1
* $Id: pgcrvl.f,v 5.1.1.1 2015/04/07 11:01:13 mcalabre Exp mcalabre $
@


5.2.1.1
log
@WCSLIB 5.2 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 5.2 2015/04/15 12:35:10 mcalabre Exp $
@


5.1
log
@WCSLIB 5.1
@
text
@d2 1
a2 1
*                              PGSBOX 5.1
d24 1
a24 1
* $Id: pgcrvl.f,v 5.0.1.1 2015/04/05 12:28:04 mcalabre Exp mcalabre $
@


5.1.1.1
log
@WCSLIB 5.1 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 5.1 2015/04/07 10:56:39 mcalabre Exp $
@


5.0
log
@WCSLIB 5.0
@
text
@d2 1
a2 1
*                              PGSBOX 5.0
d24 1
a24 1
* $Id: pgcrvl.f,v 4.25.1.1 2014/12/14 14:32:48 mcalabre Exp mcalabre $
@


5.0.1.1
log
@WCSLIB 5.0 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 5.0 2015/04/05 12:25:03 mcalabre Exp $
@


4.25
log
@WCSLIB 4.25
@
text
@d2 1
a2 1
*                              PGSBOX 4.25
d24 1
a24 1
* $Id: pgcrvl.f,v 4.24.1.1 2014/09/18 15:28:12 mcalabre Exp mcalabre $
@


4.25.1.1
log
@WCSLIB 4.25 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 4.25 2014/12/14 14:29:38 mcalabre Exp $
@


4.24
log
@WCSLIB 4.24
@
text
@d2 1
a2 1
*                              PGSBOX 4.24
d24 1
a24 1
* $Id: pgcrvl.f,v 4.23.1.1 2014/05/13 05:53:52 mcalabre Exp mcalabre $
@


4.24.1.1
log
@WCSLIB 4.24 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 4.24 2014/09/18 15:25:02 mcalabre Exp $
@


4.23
log
@WCSLIB 4.23
@
text
@d2 1
a2 1
*                              PGSBOX 4.23
d24 1
a24 1
* $Id: pgcrvl.f,v 4.22.1.1 2014/04/12 15:06:34 mcalabre Exp mcalabre $
@


4.23.1.1
log
@WCSLIB 4.23 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 4.23 2014/05/13 05:50:53 mcalabre Exp $
@


4.22
log
@WCSLIB 4.22
@
text
@d2 1
a2 1
*                              PGSBOX 4.22
d24 1
a24 1
* $Id: pgcrvl.f,v 4.21.1.1 2014/03/24 05:15:31 mcalabre Exp mcalabre $
@


4.22.1.1
log
@WCSLIB 4.22 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 4.22 2014/04/12 15:03:54 mcalabre Exp $
@


4.21
log
@WCSLIB 4.21
@
text
@d2 1
a2 1
*                              PGSBOX 4.21
d24 1
a24 1
* $Id: pgcrvl.f,v 4.20.1.1 2013/12/18 05:46:57 mcalabre Exp $
@


4.21.1.1
log
@WCSLIB 4.21 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 4.21 2014/03/24 05:12:29 mcalabre Exp $
@


4.20
log
@WCSLIB 4.20
@
text
@d2 1
a2 1
*                              PGSBOX 4.20
d24 1
a24 1
* $Id: pgcrvl.f,v 4.19.1.1 2013/09/29 14:20:41 mcalabre Exp mcalabre $
@


4.20.1.1
log
@WCSLIB 4.20 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 4.20 2013/12/18 05:42:51 mcalabre Exp $
@


4.19
log
@WCSLIB 4.19
@
text
@d2 1
a2 1
*                              PGSBOX 4.19
d24 1
a24 1
* $Id: pgcrvl.f,v 4.18.1.1 2013/07/13 10:02:40 mcalabre Exp mcalabre $
@


4.19.1.1
log
@WCSLIB 4.19 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 4.19 2013/09/29 14:17:53 mcalabre Exp $
@


4.18
log
@WCSLIB 4.18
@
text
@d2 1
a2 1
*                              PGSBOX 4.18
d24 1
a24 1
* $Id: pgcrvl.f,v 4.17.1.1 2013/01/29 05:32:33 cal103 Exp cal103 $
@


4.18.1.1
log
@WCSLIB 4.18 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 4.18 2013/07/13 10:00:06 mcalabre Exp $
@


4.17
log
@WCSLIB 4.17
@
text
@d2 1
a2 1
*                              PGSBOX 4.17
d24 1
a24 1
* $Id: pgcrvl.f,v 4.16.1.1 2012/11/07 04:45:58 cal103 Exp cal103 $
@


4.17.1.1
log
@WCSLIB 4.17 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 4.17 2013/01/29 05:29:22 cal103 Exp $
@


4.16
log
@WCSLIB 4.16
@
text
@d2 1
a2 1
*                              PGSBOX 4.16
d24 1
a24 1
* $Id: pgcrvl.f,v 4.15.1.1 2012/09/26 14:27:53 cal103 Exp cal103 $
@


4.16.1.1
log
@WCSLIB 4.16 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 4.16 2012/11/07 04:42:45 cal103 Exp $
@


4.15
log
@WCSLIB 4.15
@
text
@d2 1
a2 1
*                              PGSBOX 4.15
d24 1
a24 1
* $Id: pgcrvl.f,v 4.14.1.1 2012/07/13 10:05:05 cal103 Exp cal103 $
@


4.15.1.1
log
@WCSLIB 4.15 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 4.15 2012/09/26 14:26:06 cal103 Exp $
@


4.14
log
@WCSLIB 4.14
@
text
@d2 1
a2 1
*                              PGSBOX 4.14
d24 1
a24 1
* $Id: pgcrvl.f,v 4.13.1.2 2012/07/13 03:43:52 cal103 Exp cal103 $
@


4.14.1.1
log
@WCSLIB 4.14 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 4.14 2012/07/13 10:02:47 cal103 Exp $
@


4.13
log
@WCSLIB 4.13
@
text
@d2 1
a2 1
*                              PGSBOX 4.13
d22 3
a24 3
* Author: Mark Calabretta, Australia Telescope National Facility
* http://www.atnf.csiro.au/~mcalabre/index.html
* $Id: pgcrvl.f,v 4.12.1.1 2012/02/29 07:59:11 cal103 Exp cal103 $
@


4.13.1.1
log
@WCSLIB 4.13 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 4.13 2012/03/14 07:39:31 cal103 Exp $
@


4.13.1.2
log
@Changed contact details.
@
text
@d22 3
a24 3
* Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.
* http://www.atnf.csiro.au/people/Mark.Calabretta
* $Id: pgcrvl.f,v 4.13.1.1 2012/03/14 07:40:39 cal103 Exp cal103 $
@


4.12
log
@WCSLIB 4.12
@
text
@d2 1
a2 1
*                              PGSBOX 4.12
d24 1
a24 1
* $Id: pgcrvl.f,v 4.11.1.1 2012/02/20 23:31:14 cal103 Exp cal103 $
@


4.12.1.1
log
@WCSLIB 4.12 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 4.12 2012/02/29 07:57:57 cal103 Exp $
@


4.11
log
@WCSLIB 4.11
@
text
@d2 1
a2 1
*                              PGSBOX 4.11
d24 1
a24 1
* $Id: pgcrvl.f,v 4.10.1.1 2012/02/05 23:42:47 cal103 Exp cal103 $
@


4.11.1.1
log
@WCSLIB 4.11 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 4.11 2012/02/20 23:30:03 cal103 Exp $
@


4.10
log
@WCSLIB 4.10
@
text
@d2 1
a2 1
*                              PGSBOX 4.10
d24 1
a24 1
* $Id: pgcrvl.f,v 4.9.1.1 2012/01/24 05:41:46 cal103 Exp cal103 $
@


4.10.1.1
log
@WCSLIB 4.10 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 4.10 2012/02/05 23:41:45 cal103 Exp $
@


4.9
log
@WCSLIB 4.9
@
text
@d2 1
a2 1
*                              PGSBOX 4.9
d24 1
a24 1
* $Id: pgcrvl.f,v 4.8.1.1 2011/08/15 08:07:07 cal103 Exp cal103 $
@


4.9.1.1
log
@WCSLIB 4.9 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 4.9 2012/01/24 05:40:30 cal103 Exp $
@


4.8
log
@WCSLIB 4.8
@
text
@d2 1
a2 1
*                              PGSBOX 4.8
d24 1
a24 1
* $Id: pgcrvl.f,v 4.7.1.1 2011/02/07 07:04:23 cal103 Exp cal103 $
@


4.8.1.1
log
@WCSLIB 4.8 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 4.8 2011/08/15 08:05:55 cal103 Exp $
@


4.7
log
@WCSLIB 4.7
@
text
@d2 1
a2 1
*                              PGSBOX 4.7
d24 1
a24 1
* $Id: pgcrvl.f,v 4.6.1.1 2010/11/16 06:16:20 cal103 Exp cal103 $
@


4.7.1.1
log
@WCSLIB 4.7 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 4.7 2011/02/07 07:03:43 cal103 Exp $
@


4.6
log
@WCSLIB 4.6
@
text
@d2 1
a2 1
*                              PGSBOX 4.6
d24 1
a24 1
* $Id: pgcrvl.f,v 4.5.1.1 2010/07/16 07:05:33 cal103 Exp cal103 $
@


4.6.1.1
log
@WCSLIB 4.6 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 4.6 2010/11/16 06:15:32 cal103 Exp $
@


4.5
log
@WCSLIB 4.5
@
text
@d2 1
a2 1
*                              PGSBOX 4.5
d24 1
a24 1
* $Id: pgcrvl.f,v 4.4.1.1 2009/08/10 08:55:45 cal103 Exp cal103 $
@


4.5.1.1
log
@WCSLIB 4.5 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 4.5 2010/07/16 07:01:27 cal103 Exp $
@


4.4
log
@WCSLIB 4.4
@
text
@d2 1
a2 1
*                              PGSBOX 4.4
d24 1
a24 1
* $Id: pgcrvl.f,v 4.3.1.2 2009/07/23 04:17:17 cal103 Exp cal103 $
@


4.4.1.1
log
@WCSLIB 4.4 development branch.
@
text
@d24 1
a24 1
* $Id: pgcrvl.f,v 4.4 2009/08/06 07:54:40 cal103 Exp $
@


4.3
log
@PGSBOX 4.3
@
text
@d2 1
a2 1
*                              PGSBOX 4.3
d5 2
a6 2
*   ATTENTION!
*   ----------
d8 1
a8 1
*   PGCRVL is defunct.
d10 2
a11 2
*   Do not use this routine - use PGSBOX instead.
*   ---------------------------------------------
d13 2
a14 2
*   What remains here is a driver for the more general PGSBOX routine
*   which is not based on pixel coordinates.
d16 3
a18 3
*   This residue of PGCRVL exists mainly for backwards compatibility.
*   PGCRVL's old AXEN argument is here translated into the BLC and TRC
*   arguments required by PGSBOX.
d20 1
a20 1
*   New applications should use PGSBOX directly.
d22 3
a24 3
*   Author: Mark Calabretta, Australia Telescope National Facility
*   http://www.atnf.csiro.au/~mcalabre/index.html
*   $Id: pgcrvl.f,v 4.2.1.1 2005/12/05 03:23:34 cal103 Exp cal103 $
d46 2
a47 2
     :   TIKLEN, NG1, GRID1, NG2, GRID2, DOEQ, NLFUNC, NLC, NLI, NLD,
     :   NLCPRM, NLIPRM, NLDPRM, NC, IC, CACHE, IERR)
@


4.3.1.1
log
@PGSBOX 4.3 development branch.
@
text
@d2 1
a2 1
*                              PGSBOX 4.4
d24 1
a24 1
*   $Id: pgcrvl.f,v 4.3 2007/12/27 05:49:14 cal103 Exp cal103 $
@


4.3.1.2
log
@Changed indentation.
@
text
@d5 2
a6 2
* ATTENTION!
* ----------
d8 1
a8 1
* PGCRVL is defunct.
d10 2
a11 2
* Do not use this routine - use PGSBOX instead.
* ---------------------------------------------
d13 2
a14 2
* What remains here is a driver for the more general PGSBOX routine
* which is not based on pixel coordinates.
d16 3
a18 3
* This residue of PGCRVL exists mainly for backwards compatibility.
* PGCRVL's old AXEN argument is here translated into the BLC and TRC
* arguments required by PGSBOX.
d20 1
a20 1
* New applications should use PGSBOX directly.
d22 3
a24 3
* Author: Mark Calabretta, Australia Telescope National Facility
* http://www.atnf.csiro.au/~mcalabre/index.html
* $Id: pgcrvl.f,v 4.3.1.1 2007/12/27 13:26:31 cal103 Exp cal103 $
d46 2
a47 2
     :  TIKLEN, NG1, GRID1, NG2, GRID2, DOEQ, NLFUNC, NLC, NLI, NLD,
     :  NLCPRM, NLIPRM, NLDPRM, NC, IC, CACHE, IERR)
@


4.2
log
@PGSBOX 4.2
@
text
@d2 1
a2 1
*                              PGSBOX 4.2
d24 1
a24 1
*   $Id: pgcrvl.f,v 4.1 2005/08/19 13:39:28 cal103 Exp cal103 $
@


4.2.1.1
log
@PGSBOX 4.2 development branch.
@
text
@d2 1
a2 1
*                              PGSBOX 4.3
d24 1
a24 1
*   $Id: pgcrvl.f,v 4.2 2005/09/21 13:27:15 cal103 Exp cal103 $
@


4.1
log
@PGSBOX 4.1
@
text
@d2 1
a2 1
*                              PGSBOX 4.1
d24 1
a24 1
*   $Id: pgcrvl.f,v 4.0 2005/02/04 12:22:25 cal103 Exp cal103 $
@


4.0
log
@PGSBOX 4.0
@
text
@d2 1
a2 1
*                              PGSBOX 4.0
d24 1
a24 1
*   $Id: pgcrvl.f,v 3.6 2004/08/24 08:34:02 cal103 Exp cal103 $
@


3.6
log
@PGSBOX 3.6
@
text
@d2 1
a2 1
*                              PGSBOX 3.6
d24 1
a24 1
*   $Id: pgcrvl.f,v 3.5 2004/06/28 05:26:38 mcalabre Exp mcalabre $
@


3.5
log
@PGSBOX 3.5
@
text
@d2 1
a2 1
*                              PGSBOX 3.5
d24 1
a24 1
*   $Id: pgcrvl.f,v 3.4 2004/02/10 23:56:37 mcalabre Exp mcalabre $
@


3.4
log
@PGSBOX 3.4
@
text
@d2 1
a2 1
*                              PGSBOX 3.4
d23 2
a24 1
*   $Id: pgcrvl.f,v 3.3 2003/10/22 07:34:59 mcalabre Exp mcalabre $
@


3.3
log
@PGSBOX 3.3
@
text
@d2 1
a2 1
*                              PGSBOX 3.3
d23 1
a23 1
*   $Id: pgcrvl.f,v 3.2 2003/09/09 07:58:57 mcalabre Exp mcalabre $
@


3.2
log
@PGSBOX 3.2
@
text
@d2 1
a2 1
*                              PGSBOX 3.2
d23 1
a23 1
*   $Id: pgcrvl.f,v 3.1 2003/04/28 05:02:51 mcalabre Exp mcalabre $
@


3.1
log
@PGSBOX 3.1
Added a more prominent warning to the prologue.
@
text
@d2 2
d23 1
a23 1
*   $Id: pgcrvl.f,v 1.21 2000/11/13 07:18:21 mcalabre Exp mcalabre $
@


1.21
log
@PGCRVL has now been reduced to a driver for the more general PGSBOX routine.
@
text
@d8 3
d21 1
a21 1
*   $Id: pgcrvl.f,v 1.20 2000/05/24 05:22:20 mcalabre Exp mcalabre $
@


1.20
log
@Fix for a portability problem, some Fortran compilers require the backslash
character to be escaped (with a backslash - hence '\\') and others don't.
@
text
@d3 2
a4 2
*   PGCRVL - a non-linear coordinate axis plotter for PGPLOT.
*   Copyright (C) 1997-2000, Mark Calabretta
d6 1
a6 4
*   This library is free software; you can redistribute it and/or
*   modify it under the terms of the GNU Library General Public
*   License as published by the Free Software Foundation; either
*   version 2 of the License, or (at your option) any later version.
d8 2
a9 4
*   This library is distributed in the hope that it will be useful,
*   but WITHOUT ANY WARRANTY; without even the implied warranty of
*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
*   Library General Public License for more details.
d11 3
a13 3
*   You should have received a copy of the GNU Library General Public
*   License along with this library; if not, write to the Free
*   Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
d15 1
a15 7
*   Correspondence concerning PGCRVL may be directed to:
*      Internet email: mcalabre@@atnf.csiro.au
*      Postal address: Dr. Mark Calabretta,
*                      Australia Telescope National Facility,
*                      P.O. Box 76,
*                      Epping, NSW, 2121,
*                      AUSTRALIA
a16 379
*=======================================================================
*
*   PGCRVL draws and labels a curvilinear coordinate grid.
*
*   Given:
*      AXEN     I(2)     Number of pixels on each axis of the image.
*                        Pixel coordinate (1,1) corresponds to the
*                        centre of the pixel in the bottom left-hand
*                        corner (BLC).  Thus pixel coordinates of the
*                        BLC of the frame are (0.5,0.5) and the TRC
*                        frame pixel coordinates are
*                        (AXEN(1)+0.5,AXEN(2)+0.5).
*
*      IDENTS   C(3)*(*) Identification strings:
*                           1: Name of the first world coordinate
*                              element used for axis labelling.
*                           2: Name of the second world coordinate.
*                           3: Title, written at top.
*
*      OPT      C(2)*(*) Formatting control for the world coordinates,
*                        used for axis labelling (see notes 1 and 2):
*                           ' ': plain numeric
*                           'A': angle in degrees expressed in
*                                decimal notation normalized in the
*                                range [0,360).
*                           'B': as 'A' but normalized in the range
*                                (-180,180].
*                           'C': as 'A' but unnormalized.
*                           'D': angle in degrees expressed in
*                                sexagesimal notation, DD^MM'SS".S,
*                                normalized in the range [0,360).
*                           'E': as 'D' but normalized in the range
*                                (-180,180].
*                           'F': as 'D' but unnormalized.
*                           'G': angle in degrees expressed in
*                                hms notation, HHhMMmSSs.S, normalized
*                                in the range [0,24) hours.
*                           'H': as 'G' but normalized in the range
*                                (-12,12] hours.
*                           'I': as 'G' but unnormalized.
*                           'L': logarithmic (see note 2)
*                           'T': time in hours expressed as HH:MM:SS.S
*
*                        For the angular types, NLFUNC is assumed to
*                        return the angle in degrees whereupon it will
*                        be formatted for display in the specified way.
*                        For example, an angle of -417.2958 degrees
*                        (returned by NLFUNC):
*
*                            'A':  302^.7042
*                            'B':  -57^.2958
*                            'C': -417^.2958
*                            'D':  302^42'15"
*                            'E':  -57^17'45"
*                            'F': -417^17'45"
*                            'H':   20h10m49s
*                            'I':   -3h49m11s
*                            'J':  -27h49m11s
*
*                        These are properly superscripted.
*
*      LABCTL   I        Decimal encoded grid labelling control:
*                             -1: Accumulate information on grid labels
*                                 (see note 3) but do not write them.
*                              0: Let PGCRVL decide what edges to label.
*                              1: Label bottom of frame with the first
*                                 world coordinate.
*                              2: Label bottom of frame with the second
*                                 world coordinate.
*                             10: ... left side of frame.
*                             20: ... left side of frame.
*                            100: ... top of frame.
*                            200: ... top of frame.
*                           1000: ... right side of frame.
*                           2000: ... right side of frame.
*                          10000: Write labels from information
*                                 accumulated in previous calls without
*                                 drawing grid lines or tick marks.
*
*                        LABCTL = 0 usually gets what you want.
*                        LABCTL = 3333 labels all sides with both world
*                        coordinates.
*
*      LABDEN   I        Decimal encoded labelling density control for
*                        use where PGCRVL is called upon to determine a
*                        suitable grid spacing (e.g. via NG1 = 0,
*                        GRID1(0) = 0).  LABDEN = 100*D2 + D1 where
*                        D1, and D2 are the approximate number of grid
*                        lines for the first and second world
*                        coordinate.  LABDEN = 0 is effectively the same
*                        as LABDEN = 808.
*
*      CI       I(7)     Table of predefined colours established by
*                        calls to PGSCR.  This is used to control the
*                        colour used for different parts of the plot.
*                        CI table entries are used as follows:
*
*                                                 world
*                                               coordinate
*                        Index      usage        element
*                        -----  --------------  ----------
*                          1      grid lines        1
*                          2      grid lines        2
*                          3    numeric labels      1
*                          4    numeric labels      2
*                          5    axis annotation     1
*                          6    axis annotation     2
*                          7        title           -
*
*                        For example, CI(3) is used for numeric labels
*                        for the first world coordinate.
*
*                        Colour selection is disabled for component J
*                        if CI(J) < 0.
*
*      GCODE(2) I        Code for the type of grid to draw for each
*                        world coordinate:
*                           0: No grid or tick marks.
*                           1: Tick marks (on all edges).
*                           2: Full coordinate grid.
*
*                        Tick marks can be restricted to particular
*                        edges of the frame; a negative GCODE is
*                        interpreted as a decimal encoded control
*                        variable:
*                             -1: bottom
*                            -10: left
*                           -100: top
*                          -1000: right
*
*                        The digit scales the basic tick length.  For
*                        example, GCODE(1) = -102 restricts tick marks
*                        for the first world coordinate to the bottom
*                        and top edges of the frame.  Those on the
*                        bottom will be twice the length specified by
*                        TIKLEN.
*
*      TIKLEN   D        Tick length, in mm.  Negative values produce
*                        outside tick marks.
*
*      NG1      I        Upper array index for GRID1.
*
*      GRID1    D(0:NG1) Grid values in WORLD(1) in the same units as
*                        returned by NLFUNC.
*
*                        If NG1 is zero, then
*                           a) if GRID1(0) is non-zero it defines a
*                              uniform grid spacing.
*                           b) if GRID1(0) is zero a suitable spacing
*                              will be determined (see LABDEN).
*
*                        If NG1 is greater than zero, then GRID1(0) is
*                        ignored.
*
*      NG2      I        Upper array index for GRID2.
*
*      GRID2    D(0:NG2) Grid values in WORLD(2) in the same units as
*                        returned by NLFUNC.
*
*      DOEQ     L        If NG1 = NG2 = 0, and GRID1(0) = 0D0 and/or
*                        GRID2(0) = 0D0, then choose the same grid
*                        spacing for each world coordinate.
*
*      NLFUNC   Ext      Non-linear coordinate function, see below.
*
*      NLC      I        Number of elements in NLCPRM (must be >0).
*
*      NLI      I        Number of elements in NLIPRM (must be >0).
*
*      NLD      I        Number of elements in NLDPRM (must be >0).
*
*   Given and/or returned:
*      NLCPRM   C(NLC)*1 Character coefficients for NLFUNC.
*
*      NLIPRM   I(NLI)   Integer coefficients for NLFUNC.
*
*      NLDPRM   D(NLD)   Double precision coefficients for NLFUNC.
*
*      NC       I        Upper array index for CACHE.
*
*      IC       I        Current number of entries in the CACHE table.
*                        Should be set to -1 on the first call to
*                        PGCRVL (see note 3).
*
*      CACHE    D(4,0:NC)
*                        Table of points where the tick marks or grid
*                        lines cross the frame (see note 3).
*                           1: Frame segment
*                              1: bottom
*                              2: left
*                              3: top
*                              4: right
*                           2: X or Y-pixel coordinate.
*                           3: World coordinate element (1 or 2).
*                           4: Value.
*
*                        CACHE(,0) is used to cache the extrema of the
*                        coordinate values between calls.
*
*   Returned:
*      IERR     I        Error status
*                           0: Success
*                           1: Initialization error
*
*   Notes on PGCRVL
*   ---------------
*
*    1) Where a logarithmic world coordinate type is indicated PGCRVL
*       chooses grid lines and labels on the basis that the value
*       returned by NLFUNC is a base 10 logarithm.  PGCRVL does not
*       itself take logarithms or antilogarithms.  For example, if the
*       range of values returned by NLFUNC were 0.9 - 2.5, then PGCRVL
*       would draw a subset of the following set of grid lines and
*       labels:
*
*                   value          label
*            ------------------    -----
*            0.9031 = log10(8)      8
*            0.9542 = log10(9)      9
*            1.0000 = log10(10)    10**1
*            1.3010 = log10(20)     2
*            1.4771 = log10(30)     3
*            1.6021 = log10(40)     4
*            1.6990 = log10(50)     5
*            1.7782 = log10(60)     6
*            1.8451 = log10(70)     7
*            1.9031 = log10(80)     8
*            1.9542 = log10(90)     9
*            2.0000 = log10(100)   10**2
*            2.3010 = log10(200)    2
*            2.4771 = log10(300)    3
*
*       The subset chosen depends on the coordinate increment as
*       specified by the caller (e.g. via NG1 = 0, GRID1(0) != 0) or as
*       deduced by PGCRVL from the required density of grid lines
*       specified in the LABDEN argument.  The selection is made
*       according to the following table:
*
*            increment          grid lines
*           (0.00,0.12]   1, 2, 3, 4, 5, 6, 7, 8, 9
*           (0.12,0.18]   1, 2, 3, 4, 5,    7
*           (0.18,0.23]   1, 2, 3,    5,    7
*           (0.23,0.28]   1, 2, 3,    5
*           (0.28,0.40]   1, 2,       5
*           (0.40,0.70]   1, 3
*           (0.70,1.00]   1
*
*       For increments greater than 1 the nearest integer is used.
*
*    2) PGCRVL will attempt to handle discontinuities in angle, such as
*       may occur when cycling through 360 degrees, wherever the
*       discontinuity may occur, for example
*
*          359 -> 0 -> 1
*
*       or
*
*          179 -> 180 -> -179
*
*       Only single cycles are detected, so the sequence
*
*          -360 -> 0 -> 359 -> 0 -> 359
*
*       would not be handled properly.  In such cases NLFUNC should be
*       changed to return a normalized angle, or else a continuous
*       sequence.
*
*    3) PGCRVL maintains a table of axis crossings, CACHE, in which it
*       stores information used for axis labelling.  The caller need not
*       normally be concerned about the use of this table other than to
*       provide sufficient space.
*
*       However, a coordinate grid may be produced via multiple calls to
*       PGCRVL with deferment of axis labelling.  This might be done to
*       change the pen colour and/or thickness for different sets of
*       grid lines.  The table accumulates information from each
*       successive call until the labels are produced.  The table index,
*       IC, may be reset to zero by the caller to discard the
*       information collected.
*
*       The extrema of the world coordinate elements are stored in
*       CACHE(,0).  When a coordinate grid is plotted with multiple calls
*       to PGCRVL the initial call should always have IC set to -1 to
*       signal that PGCRVL needs to determine the extrema.  On
*       subsequent calls with IC non-negative PGCRVL uses the extrema
*       cached from the first call.  This can speed up execution
*       considerably.
*
*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*
*   The curvilinear coordinate grid is defined by external function
*   NLFUNC whose interface is defined as follows:
*
*   Given:
*      OPCODE   I        Transformation code:
*                           +2: Compute a set of pixel coordinates which
*                               describe a path between this and the
*                               previous pair of world coordinates
*                               remembered from the last call with
*                               OPCODE = +1 or +2.  Usually only takes
*                               a single step unless traversing a
*                               discontinuity or some other
*                               irregularity (see explanation below).
*                           +1: Compute pixel coordinates from world
*                               coordinates.
*                            0: Initialize.
*                           -1: Compute world coordinates from pixel
*                               coordinates.
*
*      NLC      I        Number of elements in NLCPRM (must be >0).
*
*      NLI      I        Number of elements in NLIPRM (must be >0).
*
*      NLD      I        Number of elements in NLDPRM (must be >0).
*
*   Given and/or returned:
*      NLCPRM   C(NLC)*1 Character array.
*
*      NLIPRM   I(NLI)   Integer coefficients.
*
*      NLDPRM   D(NLD)   Double precision coefficients.
*
*      WORLD    D(2)     World coordinates.  Given if OPCODE > 0,
*                        returned if OPCODE < 0.
*
*      PIXEL    D(2)     Pixel coordinates.  Given if OPCODE < 0,
*                        returned if OPCODE > 0.
*
*      CONTRL   I        Control flag for OPCODE = +2:
*                           0: Normal state.
*                           1: Force PGCRVL to flush its plotting buffer
*                              and call NLFUNC again with the same world
*                              coordinates.
*                           2: Force PGCRVL to call NLFUNC again with
*                              the same world coordinates (without
*                              flushing its plotting buffer).
*
*      CONTXT   D(20)    Context elements for OPCODE = +2.
*
*   Returned:
*      IERR     I        Error status
*                           0: Success.
*                           1: Invalid parameters.
*                           2: Invalid world coordinate.
*                           3: Invalid pixel coordinate.
*
*   PGCRVL passes its NLCPRM, NLIPRM, and NLDPRM adjustable size array
*   arguments of length NLC, NLI, and NLD to NLFUNC without
*   modification.  Comments within NLFUNC should specify the parameters
*   it wants passed to it via these arrays.
*
*   PGCRVL first calls NLFUNC with OPCODE = 0 to cause it to initialize
*   its work arrays (if necessary).  It then uses OPCODE = -1 to
*   determine the range of world coordinate values.  It anchors the
*   start of each coordinate grid line with a call with OPCODE = +1, and
*   then tracks it with OPCODE = +2.
*
*   The CONTXT array is also passed to NLFUNC without modification to
*   allow it to preserve state information between calls for OPCODE = 2.
*   In particular, NLFUNC can use this to detect discontinuities in the
*   grid lines.
*
*   The CONTRL argument is provided so that NLFUNC can force PGCRVL to
*   call it again with or without flushing its plotting buffer.  This
*   may be needed when plotting a grid line through a discontinuity.
*   PGCRVL does not modify CONTRL.
*
*   Notes on NLFUNC
*   ---------------
*    1) NLFUNC must define a single-valued function, that is, each
*       pixel coordinate (i,j) must map to a unique world coordinate
*       pair (x,y).
*
*    2) Notwithstanding the fact that PGCRVL declares NLCPRM, NLIPRM,
*       and NLDPRM as single dimension arrays of length NLC, NLI, and
*       NLD, NLFUNC may treat these as higher-dimensional arrays, for
*       example, NLDPRM(2,NLD).  (The FORTRAN standard requires that
*       only the last dimension is adjustable.)
*
d18 1
a18 1
*   $Id: pgcrvl.f,v 1.19 2000/05/10 04:54:48 mcalabre Exp mcalabre $
d24 7
a30 16
      INTEGER   BUFSIZ
      PARAMETER (BUFSIZ = 2048)

      LOGICAL   DOEQ, GETEND, INSIDE, ISANGL(2), MAJOR, PRVIN
      INTEGER   AXEN(2), CI(7), CI0, CJ(7), CONTRL, DENS(2), FSEG,
     :          GCODE(2), IC, IERR, IPIX, ISTEP, IWJ, IWK, J, JPIX, K,
     :          L, LABCTL, LABDEN, LDIV(2), LTABL(6,2:6), N1, N2, NC,
     :          NG(2), NG1, NG2, NLC, NLD, NLI, NLIPRM(NLI), NP, NW(2),
     :          TCODE(2,4)
      REAL      S, WPIX(4), X1, X2, XPOINT, XR(BUFSIZ), XSCL, XVP1,
     :          XVP2, Y1, Y2, YR(BUFSIZ), YSCL, YVP1, YVP2
      DOUBLE PRECISION CONTXT(20), CACHE(4,0:NC), D1, D2, DW(2), FACT,
     :          G0(2), GSTEP(2), GRID1(0:NG1), GRID2(0:NG2),
     :          NLDPRM(NLD), PIXEL(2), STEP, TIKLEN, TMP, VMAX(2,2),
     :          VMIN(2,2), WMAX(2), WMIN(2), WORLD(2)
      CHARACTER IDENTS(3)*(*), NLCPRM(NLC)*1, OPT(2)*(*), TYPE(2)
a32 19

*     Approximate number of grid lines for each coordinate.
      INTEGER DENS0
      PARAMETER (DENS0 = 8)

*     Number of steps per grid line.
      INTEGER NSTEP
      PARAMETER (NSTEP = 80)

*     Double precision round-off tolerance.
      DOUBLE PRECISION TOL
      PARAMETER (TOL = 1D-8)

*     Table of logarithmic grid values.
      DATA LTABL /3, 10,  0,  0,  0,  0,
     :            2,  5, 10,  0,  0,  0,
     :            2,  3,  5, 10,  0,  0,
     :            2,  3,  5,  7, 10,  0,
     :            2,  3,  4,  5,  7, 10/
d34 4
a37 8
*  Initialize.
      CALL NLFUNC (0, NLC, NLI, NLD, NLCPRM, NLIPRM, NLDPRM, WORLD,
     :   PIXEL, CONTRL, CONTXT, IERR)
*     Quick return for now.
      IF (IERR.NE.0) THEN
         IERR = 1
         RETURN
      END IF
d39 3
a41 1518
      NG(1) = NG1
      NG(2) = NG2

      TYPE(1) = OPT(1)(1:1)
      TYPE(2) = OPT(2)(1:1)

*     Extend the PGPLOT window and rescale it to pixels.
      CALL PGQVP (0, XVP1, XVP2, YVP1, YVP2)
      CALL PGQWIN (WPIX(1), WPIX(2), WPIX(3), WPIX(4))
      CALL PGSVP (0.0, 1.0, 0.0, 1.0)
      XSCL = AXEN(1)/(XVP2-XVP1)
      YSCL = AXEN(2)/(YVP2-YVP1)
      CALL PGSWIN (0.5-XSCL*XVP1, AXEN(1)+0.5+XSCL*(1.0-XVP2),
     :             0.5-YSCL*YVP1, AXEN(2)+0.5+YSCL*(1.0-YVP2))

*     Labels only?
      IF (LABCTL.GE.10000) GO TO 120


*  Find world coordinate ranges.
      IF (IC.GE.0) THEN
*        Extrema cached from a previous call.
         WMIN(1) = CACHE(1,0)
         WMAX(1) = CACHE(2,0)
         WMIN(2) = CACHE(3,0)
         WMAX(2) = CACHE(4,0)
      ELSE
*        Coarse search to find approximate ranges.
         WMIN(1) =  1D99
         WMAX(1) = -1D99
         WMIN(2) =  1D99
         WMAX(2) = -1D99

*        Need to consider cycles in angle through 360 degrees.
         ISANGL(1) = INDEX('ABCDEFGHI',TYPE(1)).NE.0
         ISANGL(2) = INDEX('ABCDEFGHI',TYPE(2)).NE.0
         VMIN(1,1) =  1D99
         VMIN(1,2) =  1D99
         VMAX(1,1) = -1D99
         VMAX(1,2) = -1D99
         VMIN(2,1) =  1D99
         VMIN(2,2) =  1D99
         VMAX(2,1) = -1D99
         VMAX(2,2) = -1D99

*        Decimate the image.
         N1 = AXEN(1)/10 + 1
         N2 = AXEN(2)/10 + 1
         D1 = DBLE(AXEN(1))/N1
         D2 = DBLE(AXEN(2))/N2

         PIXEL(1) = 0.5D0
         DO 20 IPIX = 0, N1

            PIXEL(2) = 0.5D0
            DO 10 JPIX = 0, N2
               CALL NLFUNC (-1, NLC, NLI, NLD, NLCPRM, NLIPRM, NLDPRM,
     :            WORLD, PIXEL, CONTRL, CONTXT, IERR)
               IF (IERR.NE.0) GO TO 10

               IF (WORLD(1).LT.WMIN(1)) WMIN(1) = WORLD(1)
               IF (WORLD(1).GT.WMAX(1)) WMAX(1) = WORLD(1)
               IF (WORLD(2).LT.WMIN(2)) WMIN(2) = WORLD(2)
               IF (WORLD(2).GT.WMAX(2)) WMAX(2) = WORLD(2)

               IF (ISANGL(1)) THEN
*                 Normalize to the range [0,360).
                  WORLD(1) = MOD(WORLD(1), 360D0)
                  IF (WORLD(1).LT.0D0) WORLD(1) = WORLD(1) + 360D0
                  IF (WORLD(1).LT.VMIN(1,1)) VMIN(1,1) = WORLD(1)
                  IF (WORLD(1).GT.VMAX(1,1)) VMAX(1,1) = WORLD(1)

*                 Normalize to the range (-180,180].
                  IF (WORLD(1).GT.180D0) WORLD(1) = WORLD(1) - 360D0
                  IF (WORLD(1).LT.VMIN(1,2)) VMIN(1,2) = WORLD(1)
                  IF (WORLD(1).GT.VMAX(1,2)) VMAX(1,2) = WORLD(1)
               END IF

               IF (ISANGL(2)) THEN
*                 Normalize to the range [0,360).
                  WORLD(2) = MOD(WORLD(2), 360D0)
                  IF (WORLD(2).LT.0D0) WORLD(2) = WORLD(2) + 360D0
                  IF (WORLD(2).LT.VMIN(2,1)) VMIN(2,1) = WORLD(2)
                  IF (WORLD(2).GT.VMAX(2,1)) VMAX(2,1) = WORLD(2)

*                 Normalize to the range (-180,180].
                  IF (WORLD(2).GT.180D0) WORLD(2) = WORLD(2) - 360D0
                  IF (WORLD(2).LT.VMIN(2,2)) VMIN(2,2) = WORLD(2)
                  IF (WORLD(2).GT.VMAX(2,2)) VMAX(2,2) = WORLD(2)
               END IF

               PIXEL(2) = PIXEL(2) + D2
 10         CONTINUE

            PIXEL(1) = PIXEL(1) + D1
 20      CONTINUE

*        Check for cycles in angle.
         DO 30 J = 1, 2
            IF (ISANGL(J)) THEN
               IF (WMAX(J)-WMIN(J).LT.360D0 .AND.
     :             WMAX(J)-WMIN(J).GT.VMAX(J,1)-VMIN(J,1)+TOL) THEN
*                 Must have a cycle, preserve the sign.
                  IF (WMAX(J).GE.0D0) THEN
                     WMIN(J) = VMIN(J,1)
                     WMAX(J) = VMAX(J,1)
                  ELSE
                     WMIN(J) = VMIN(J,1) - 360D0
                     WMAX(J) = VMAX(J,1) - 360D0
                  END IF
               END IF

               IF (WMAX(J)-WMIN(J).LT.360D0 .AND.
     :             WMAX(J)-WMIN(J).GT.VMAX(J,2)-VMIN(J,2)+TOL) THEN
*                 Must have a cycle, preserve the sign.
                  IF (WMAX(J).GE.0D0) THEN
                     IF (VMAX(J,2).GE.0D0) THEN
                        WMIN(J) = VMIN(J,2)
                        WMAX(J) = VMAX(J,2)
                     ELSE
                        WMIN(J) = VMIN(J,2) + 360D0
                        WMAX(J) = VMAX(J,2) + 360D0
                     END IF
                  ELSE
                     IF (VMAX(J,2).LT.0D0) THEN
                        WMIN(J) = VMIN(J,2)
                        WMAX(J) = VMAX(J,2)
                     ELSE
                        WMIN(J) = VMIN(J,2) - 360D0
                        WMAX(J) = VMAX(J,2) - 360D0
                     END IF
                  END IF
               END IF
            END IF
 30      CONTINUE

*        Cache extrema for subsequent calls.
         CACHE(1,0) = WMIN(1)
         CACHE(2,0) = WMAX(1)
         CACHE(3,0) = WMIN(2)
         CACHE(4,0) = WMAX(2)

         IC = 0
      END IF

*     Choose an appropriate grid spacing.
      IF (LABDEN.GT.0) THEN
*        User specified grid density.
         DENS(1) = MOD(LABDEN,100)
         DENS(2) = LABDEN/100
         IF (DENS(1).EQ.0) DENS(1) = DENS0
         IF (DENS(2).EQ.0) DENS(2) = DENS0
      ELSE
*        Default grid density.
         DENS(1) = DENS0
         DENS(2) = DENS0
      END IF

      G0(1) = GRID1(0)
      G0(2) = GRID2(0)
      DO 40 J = 1, 2
         IF (J.EQ.1) THEN
            K = 2
         ELSE
            K = 1
         END IF

         IF (NG(J).EQ.0 .AND. G0(J).NE.0D0) THEN
            GSTEP(J) = G0(J)
         ELSE IF (DOEQ .AND. NG(K).EQ.0 .AND. G0(K).NE.0D0) THEN
            GSTEP(J) = G0(K)
         ELSE
            DW(J) = WMAX(J) - WMIN(J)
            STEP = DW(J)/DENS(J)
            IF (INDEX('ABCDEF',TYPE(J)).NE.0 .AND. STEP.GE.1D0) THEN
*              Angle with multi-degree increment.
               IF (STEP.LT.1.5D0) THEN
                  STEP = 1D0
               ELSE IF (STEP.LT.3D0) THEN
                  STEP = 2D0
               ELSE IF (STEP.LT.7D0) THEN
                  STEP = 5D0
               ELSE IF (STEP.LT.12D0) THEN
                  STEP = 10D0
               ELSE IF (STEP.LT.20D0) THEN
                  STEP = 15D0
               ELSE IF (STEP.LT.40D0) THEN
                  STEP = 30D0
               ELSE IF (STEP.LT.70D0) THEN
                  STEP = 45D0
               ELSE IF (STEP.LT.120D0) THEN
                  STEP = 90D0
               ELSE IF (STEP.LT.270D0) THEN
                  STEP = 180D0
               ELSE IF (STEP.LT.520D0) THEN
                  STEP = 360D0
               ELSE
                  STEP = 360D0*INT(STEP/360D0 + 0.5)
               END IF

            ELSE IF (INDEX('GHI',TYPE(J)).NE.0 .AND. STEP.GE.15D0 .OR.
     :         TYPE(J).EQ.'T' .AND. STEP.GE.1D0) THEN
*              Angle or time in hms format with multi-hour increment.

               FACT = 1D0
               IF (INDEX('GHI',TYPE(J)).NE.0) THEN
*                 Rescale degrees to hours.
                  FACT = FACT/15D0
                  STEP = STEP/15D0
               END IF

               IF (STEP.LT.1.5D0) THEN
                  STEP = 1D0
               ELSE IF (STEP.LT.2.5D0) THEN
                  STEP = 2D0
               ELSE IF (STEP.LT.3.5D0) THEN
                  STEP = 3D0
               ELSE IF (STEP.LT.5D0) THEN
                  STEP = 4D0
               ELSE IF (STEP.LT.7D0) THEN
                  STEP = 6D0
               ELSE IF (STEP.LT.10D0) THEN
                  STEP = 8D0
               ELSE IF (STEP.LT.15D0) THEN
                  STEP = 12D0
               ELSE IF (STEP.LT.21D0) THEN
                  STEP = 18D0
               ELSE IF (STEP.LT.36D0) THEN
                  STEP = 24D0
               ELSE
                  STEP = 24D0*INT(STEP/24D0 + 0.5)
               END IF

               STEP = STEP/FACT

            ELSE IF (INDEX('GHI',TYPE(J)).NE.0 .AND. STEP.LT.15D0 .OR.
     :               INDEX('DEFT',TYPE(J)).NE.0 .AND. STEP.LT.1D0) THEN
*              Angle or time in sexagesimal format with sub-degree/hour
*              increment.

               FACT = 1D0
               IF (INDEX('GHI',TYPE(J)).NE.0) THEN
*                 Rescale degrees to hours.
                  FACT = FACT/15D0
                  STEP = STEP/15D0
               END IF

               FACT = FACT*60D0
               STEP = STEP*60D0
               IF (STEP.LT.1D0) THEN
*                 Sub-minute increment.
                  FACT = FACT*60D0
                  STEP = STEP*60D0
               END IF

               IF (STEP.LT.1D0) THEN
*                 Sub-second increment.
                  TMP = 10D0**(INT(LOG10(STEP))-1)
                  IF (1.5*TMP.GE.STEP) THEN
                     STEP = TMP
                  ELSE
                     IF (3D0*TMP.GE.STEP) THEN
                        STEP = 2D0*TMP
                     ELSE
                        IF (7D0*TMP.GE.STEP) THEN
                           STEP = 5D0*TMP
                        ELSE
                           STEP = 10D0*TMP
                        END IF
                     END IF
                  END IF

               ELSE
                  IF (STEP.LT.1.5D0) THEN
                     STEP = 1D0
                  ELSE IF (STEP.LT.2.5D0) THEN
                     STEP = 2D0
                  ELSE IF (STEP.LT.3.5D0) THEN
                     STEP = 3D0
                  ELSE IF (STEP.LT.4.5D0) THEN
                     STEP = 4D0
                  ELSE IF (STEP.LT.5.5D0) THEN
                     STEP = 5D0
                  ELSE IF (STEP.LT.8D0) THEN
                     STEP = 6D0
                  ELSE IF (STEP.LT.11D0) THEN
                     STEP = 10D0
                  ELSE IF (STEP.LT.14D0) THEN
                     STEP = 12D0
                  ELSE IF (STEP.LT.18D0) THEN
                     STEP = 15D0
                  ELSE IF (STEP.LT.25D0) THEN
                     STEP = 20D0
                  ELSE IF (STEP.LT.45D0) THEN
                     STEP = 30D0
                  ELSE
                     STEP = 60D0
                  END IF
               END IF

               STEP = STEP/FACT

            ELSE
*              Just numbers.
               TMP = 10D0**INT(LOG10(STEP))
               IF (STEP.LT.1D0) TMP = TMP/10D0

               IF (1.5D0*TMP.GE.STEP) THEN
                  STEP = TMP
               ELSE
                  IF (3D0*TMP.GE.STEP) THEN
                     STEP = 2D0*TMP
                  ELSE
                     IF (7D0*TMP.GE.STEP) THEN
                        STEP = 5D0*TMP
                     ELSE
                        STEP = 10D0*TMP
                     END IF
                  END IF
               END IF

*              Adjust the step size for logarithmic values.
               IF (TYPE(J).EQ.'L') THEN
                  IF (STEP.GT.0.7D0) THEN
                     LDIV(J) = 1
                     STEP = NINT(STEP)
                  ELSE
                     IF (STEP.GT.0.4D0) THEN
                        LDIV(J) = 2
                     ELSE IF (STEP.GT.0.28D0) THEN
                        LDIV(J) = 3
                     ELSE IF (STEP.GT.0.23D0) THEN
                        LDIV(J) = 4
                     ELSE IF (STEP.GT.0.18D0) THEN
                        LDIV(J) = 5
                     ELSE IF (STEP.GT.0.12D0) THEN
                        LDIV(J) = 6
                     ELSE
                        LDIV(J) = 9
                     END IF

                     STEP = 1D0/LDIV(J)
                  END IF
               END IF
            END IF

            GSTEP(J) = STEP
         END IF
 40   CONTINUE

*     Equal grid spacing?
      IF (DOEQ .AND. NG(1).EQ.0 .AND. NG(2).EQ.0) THEN
         IF (GRID1(0).EQ.0D0 .AND. GRID2(0).EQ.0D0) THEN
            GSTEP(1) = MIN(GSTEP(1), GSTEP(2))
            GSTEP(2) = GSTEP(1)
         ELSE IF (GRID1(0).EQ.0D0) THEN
            GSTEP(1) = GSTEP(2)
         ELSE IF (GRID2(0).EQ.0D0) THEN
            GSTEP(2) = GSTEP(1)
         END IF
      END IF

*     Fine tune the end points.
      DO 50 J = 1, 2
         IF (TYPE(J).EQ.'L') THEN
            WMIN(J) = AINT(WMIN(J)-1D0)
            WMAX(J) = AINT(WMAX(J)+1D0)
         ELSE
            TMP = AINT(WMIN(J)/GSTEP(J))*GSTEP(J)
            IF (TMP.GE.WMIN(J)) TMP = TMP - GSTEP(J)
            WMIN(J) = TMP
            TMP = AINT(WMAX(J)/GSTEP(J))*GSTEP(J)
            IF (TMP.LE.WMAX(J)) TMP = TMP + GSTEP(J)
            WMAX(J) = TMP
         END IF
         DW(J) = WMAX(J) - WMIN(J)
 50   CONTINUE


*  Draw the grid.
*     Get absolute scale for tick marks.
      CALL PGQVP (2, X1, X2, Y1, Y2)
      XSCL = (X2-X1)/AXEN(1)
      YSCL = (Y2-Y1)/AXEN(2)

*     Decode tick mark control.
      DO 60 J = 1, 2
         IF (GCODE(J).EQ.2) THEN
            TCODE(J,1) = -1
            TCODE(J,2) = -1
            TCODE(J,3) = -1
            TCODE(J,4) = -1
         ELSE IF (GCODE(J).EQ.1) THEN
            TCODE(J,1) = 1
            TCODE(J,2) = 1
            TCODE(J,3) = 1
            TCODE(J,4) = 1
         ELSE IF (GCODE(J).LT.0) THEN
            K = ABS(GCODE(J))
            TCODE(J,1) = MOD(K,10)
            TCODE(J,2) = MOD(K/10,10)
            TCODE(J,3) = MOD(K/100,10)
            TCODE(J,4) = MOD(K/1000,10)
         ELSE
            TCODE(J,1) = 0
            TCODE(J,2) = 0
            TCODE(J,3) = 0
            TCODE(J,4) = 0
         END IF
 60   CONTINUE

*     Determine initial colour.
      CALL PGQCI (CI0)
      DO 70 J = 1, 7
         IF (CI(J).GE.0) THEN
            CJ(J) = CI(J)
         ELSE
            CJ(J) = CI0
         END IF
 70   CONTINUE

*     Draw each set of grid lines.
      DO 110 J = 1, 2
         IF (GCODE(J).EQ.0) GO TO 110

         IF (J.EQ.1) THEN
            CALL PGSCI (CJ(1))
            K = 2
         ELSE
            CALL PGSCI (CJ(2))
            K = 1
         END IF

         IF (NG(J).GT.0) THEN
            NW(J) = NG(J)
         ELSE
            NW(J) = NINT(DW(J)/GSTEP(J))
         END IF

         DO 100 IWJ = 0, NW(J)
            MAJOR = .FALSE.

*           Determine the world coordinate of the grid line.
            IF (NG(J).GT.0) THEN
*              User-specified.
               IF (IWJ.EQ.0) GO TO 100
               WORLD(1) = GRID1(IWJ)
               WORLD(2) = GRID2(IWJ)
            ELSE
*              Internally computed.
               WORLD(J) = WMIN(J) + IWJ*GSTEP(J)

*              Logarithmic?
               IF (TYPE(J).EQ.'L') THEN
                  TMP = MOD(WORLD(J),1D0)
                  IF (TMP.LT.0D0) TMP = TMP + 1D0
                  L = NINT(TMP*LDIV(J))

                  IF (L.EQ.0) THEN
*                    Major tick mark.
                     MAJOR = .TRUE.
                  ELSE
*                    Adjust logarithmic scales.
                     IF (LDIV(J).LE.6) THEN
                        L = LTABL(L,LDIV(J))
                     ELSE
                        L = L + 1
                     END IF

                     WORLD(J) = WORLD(J) - TMP + LOG10(DBLE(L))
                  END IF
               END IF
            END IF

            NP = 0
            GETEND = .TRUE.
            DO 90 IWK = 0, NSTEP
               WORLD(K) = WMIN(K) + IWK*(DW(K)/NSTEP)

               IF (GETEND) THEN
*                 Get end-point context.
                  CALL NLFUNC (1, NLC, NLI, NLD, NLCPRM, NLIPRM, NLDPRM,
     :               WORLD, PIXEL, CONTRL, CONTXT, IERR)
                  IF (IERR.EQ.0) THEN
                     X1 = REAL(PIXEL(1))
                     Y1 = REAL(PIXEL(2))
                     INSIDE = X1.GT.0.5 .AND. X1.LT.AXEN(1)+0.5 .AND.
     :                        Y1.GT.0.5 .AND. Y1.LT.AXEN(2)+0.5

                     NP = 1
                     XR(1) = X1
                     YR(1) = Y1

                     PRVIN  = INSIDE
                     GETEND = .FALSE.
                  END IF
                  GO TO 90
               END IF

               DO 80 ISTEP = 1, 1000
                  CALL NLFUNC (2, NLC, NLI, NLD, NLCPRM, NLIPRM, NLDPRM,
     :               WORLD, PIXEL, CONTRL, CONTXT, IERR)
                  IF (IERR.NE.0) THEN
*                    Flush buffer.
                     IF (NP.GT.0) CALL PGLINE(NP, XR, YR)
                     GO TO 100
                  END IF

                  IF (NP.EQ.BUFSIZ) THEN
*                    Recycle buffer.
                     CALL PGLINE(NP, XR, YR)
                     XR(1) = XR(NP)
                     YR(1) = YR(NP)
                     NP = 1
                  END IF

                  X2 = REAL(PIXEL(1))
                  Y2 = REAL(PIXEL(2))
                  INSIDE = X2.GT.0.5 .AND. X2.LT.AXEN(1)+0.5 .AND.
     :                     Y2.GT.0.5 .AND. Y2.LT.AXEN(2)+0.5

                  IF (NP.EQ.0) THEN
                     NP = 1
                     XR(1) = X2
                     YR(1) = Y2
                  ELSE
                     IF (INSIDE) THEN
*                       This point is inside the frame...
                        IF (.NOT.PRVIN) THEN
*                          ...but the previous one was outside.
                           X1 = XR(NP)
                           Y1 = YR(NP)

                           IF (X2.NE.X1) THEN
                              S = (Y2-Y1)/(X2-X1)
                              IF (XR(NP).LE.0.5) THEN
                                 FSEG = 2
                                 XR(NP) = 0.5
                                 XPOINT = Y1 + (XR(NP) - X1)*S
                                 YR(NP) = XPOINT
                              ELSE IF (XR(NP).GE.AXEN(1)+0.5) THEN
                                 FSEG = 4
                                 XR(NP) = AXEN(1) + 0.5
                                 XPOINT = Y1 + (XR(NP) - X1)*S
                                 YR(NP) = XPOINT
                              END IF
                           END IF

                           IF (Y2.NE.Y1) THEN
                              S = (X2-X1)/(Y2-Y1)
                              IF (YR(NP).LE.0.5) THEN
                                 FSEG = 1
                                 YR(NP) = 0.5
                                 XPOINT = X1 + (YR(NP) - Y1)*S
                                 XR(NP) = XPOINT
                              ELSE IF (YR(NP).GE.AXEN(2)+0.5) THEN
                                 FSEG = 3
                                 YR(NP) = AXEN(2) + 0.5
                                 XPOINT = X1 + (YR(NP) - Y1)*S
                                 XR(NP) = XPOINT
                              END IF
                           END IF

*                          Record this crossing point.
                           IF (TCODE(J,FSEG).NE.0) THEN
                              IF (IC.LT.NC) THEN
                                 IC = IC + 1
                                 CACHE(1,IC) = FSEG
                                 CACHE(2,IC) = XPOINT
                                 CACHE(3,IC) = J
                                 CACHE(4,IC) = WORLD(J)
                              END IF
                           END IF

                           IF (TCODE(J,FSEG).GT.0) THEN
*                             Just want tick marks.
                              X1 = XR(NP)
                              Y1 = YR(NP)
                              S = SQRT((XSCL*(X2-X1))**2 +
     :                                 (YSCL*(Y2-Y1))**2)/TCODE(J,FSEG)
                              IF (MAJOR) S = S/1.5
                              NP = NP + 1
                              XR(NP) = X1 + (X2-X1)*TIKLEN/S
                              YR(NP) = Y1 + (Y2-Y1)*TIKLEN/S

                              CALL PGLINE(NP, XR, YR)
                              NP = 1
                           END IF
                        END IF

                        IF (GCODE(J).EQ.2) THEN
*                          Full grid.
                           NP = NP + 1
                        END IF
                        XR(NP) = X2
                        YR(NP) = Y2
                     ELSE
*                       This point is outside the frame...
                        IF (PRVIN) THEN
*                          ...but the previous one was inside.
                           X1 = XR(NP)
                           Y1 = YR(NP)

                           NP = NP + 1
                           XR(NP) = X2
                           YR(NP) = Y2
                           IF (X2.NE.X1) THEN
                              S = (Y2-Y1)/(X2-X1)
                              IF (XR(NP).LE.0.5) THEN
                                 FSEG = 2
                                 XR(NP) = 0.5
                                 XPOINT = Y1 + (XR(NP) - X1)*S
                                 YR(NP) = XPOINT
                              ELSE IF (XR(NP).GE.AXEN(1)+0.5) THEN
                                 FSEG = 4
                                 XR(NP) = AXEN(1)+0.5
                                 XPOINT = Y1 + (XR(NP) - X1)*S
                                 YR(NP) = XPOINT
                              END IF
                           END IF

                           IF (Y2.NE.Y1) THEN
                              S = (X2-X1)/(Y2-Y1)
                              IF (YR(NP).LE.0.5) THEN
                                 FSEG = 1
                                 YR(NP) = 0.5
                                 XPOINT = X1 + (YR(NP) - Y1)*S
                                 XR(NP) = XPOINT
                              ELSE IF (YR(NP).GE.AXEN(2)+0.5) THEN
                                 FSEG = 3
                                 YR(NP) = AXEN(2)+0.5
                                 XPOINT = X1 + (YR(NP) - Y1)*S
                                 XR(NP) = XPOINT
                              END IF
                           END IF

*                          Record this crossing point.
                           IF (TCODE(J,FSEG).NE.0) THEN
                              IF (IC.LT.NC) THEN
                                 IC = IC + 1
                                 CACHE(1,IC) = FSEG
                                 CACHE(2,IC) = XPOINT
                                 CACHE(3,IC) = J
                                 CACHE(4,IC) = WORLD(J)
                              END IF
                           END IF

                           IF (TCODE(J,FSEG).GT.0) THEN
*                             Just want tick marks.
                              X1 = XR(NP)
                              Y1 = YR(NP)
                              X2 = XR(NP-1)
                              Y2 = YR(NP-1)
                              S = SQRT((XSCL*(X2-X1))**2 +
     :                                 (YSCL*(Y2-Y1))**2)/TCODE(J,FSEG)
                              IF (MAJOR) S = S/1.5
                              XR(NP-1) = X1 + (X2-X1)*TIKLEN/S
                              YR(NP-1) = Y1 + (Y2-Y1)*TIKLEN/S
                           END IF

*                          Flush buffer.
                           IF (TCODE(J,FSEG).NE.0) THEN
                              CALL PGLINE(NP, XR, YR)
                           END IF
                           NP = 0
                        ELSE
*                          The previous point was also outside.
                           XR(NP) = X2
                           YR(NP) = Y2
                        END IF
                     END IF
                  END IF

                  PRVIN = INSIDE

                  IF (CONTRL.EQ.0) THEN
                     GO TO 90
                  ELSE IF (CONTRL.EQ.1) THEN
*                    Flush buffer.
                     IF (NP.GT.1) CALL PGLINE(NP, XR, YR)
                     NP = 0
                  END IF
 80            CONTINUE
 90         CONTINUE

            IF (NP.GT.1) CALL PGLINE(NP, XR, YR)
 100     CONTINUE
 110  CONTINUE


*  Produce axis labels.
 120  IF (LABCTL.NE.-1) CALL PGCRLB (AXEN, IDENTS, TYPE, LABCTL, CJ, NC,
     :   IC, CACHE)


*  Clean up.
*     Restore the original viewport, window and pen colour.
      CALL PGSVP (XVP1, XVP2, YVP1, YVP2)
      CALL PGSWIN (WPIX(1), WPIX(2), WPIX(3), WPIX(4))
      CALL PGSCI (CI0)

      RETURN
      END



*=======================================================================
*
*   PGCRLB is a helper routine for PGCRVL, not meant to be called
*   directly since it expects the viewport and window to be scaled to
*   the full extent; it labels a curvilinear coordinate grid.
*
*   Given:
*      AXEN     I(2)     Number of pixels on each axis of the image.
*
*      IDENTS   C(3)**   Identification strings (see PGCRVL).
*
*      TYPE     C(2)*1   Axis types, used for axis labelling (see
*                        PGCRVL).
*
*      LABCTL   I        Decimal encoded grid labelling control (see
*                        PGCRVL).
*
*      CI       I(7)     Colour table (see PGCRVL).
*
*   Given and/or returned:
*      NC       I        Upper array index for CACHE.
*
*      IC       I        Current number of entries in the CACHE table.
*
*      CACHE    D(4,0:NC)
*                        Table of points where the tick marks or grid
*                        lines cross the frame (see PGCRVL).
*
*   Author: Mark Calabretta, Australia Telescope National Facility
*=======================================================================
      SUBROUTINE PGCRLB (AXEN, IDENTS, TYPE, LABCTL, CI, NC, IC, CACHE)
*-----------------------------------------------------------------------
      LOGICAL   ANGLE, LFORCE, TICKIT
      INTEGER   AXEN(2), CI(7), EDGE, IC, IMAG(2), ITER, IWRLD, J, JC,
     :          K, K1, K2, L, LABCTL, LD, LM, LMAG(2), LS, LV, M, M1,
     :          M2, MM, NC, NCH, NI(2,0:4), NSWAP, PP, PRVD(2), PRVH(2),
     :          PRVM(2), PRVEDG, SKIP(4), SKOP(4)
      REAL      ANGL, FJUST, BNDRY(4), OMAG(2), SI(2), X, XBOX(4),
     :          XCH, XL, XW1, XW2, Y, YCH, YBOX(4), YL, YW1, YW2, Z
      DOUBLE PRECISION CACHE(4,0:NC), TMP
      CHARACTER ESCAPE*1, EXPONT*20, FMT*8, IDENTS(3)*(*), TEXT*80,
     :          TYPE(2)*1, TXT(2)*40

      DATA ESCAPE /'\\'/
*-----------------------------------------------------------------------
*  Normalize angular table entries.
      IF (INDEX('ABDEGH',TYPE(1)).NE.0 .OR.
     :    INDEX('ABDEGH',TYPE(2)).NE.0) THEN
         DO 10 J = 1, IC
            IF (CACHE(3,J).EQ.1D0) THEN
               IWRLD = 1
            ELSE
               IWRLD = 2
            END IF

            IF (INDEX('ADG', TYPE(IWRLD)).NE.0) THEN
               CACHE(4,J) = MOD(CACHE(4,J), 360D0)
               IF (CACHE(4,J).LT.0D0) CACHE(4,J) = CACHE(4,J) + 360D0
            ELSE IF (INDEX('BEH', TYPE(IWRLD)).NE.0) THEN
               CACHE(4,J) = MOD(CACHE(4,J), 360D0)
               IF (CACHE(4,J).LE.-180D0) THEN
                  CACHE(4,J) = CACHE(4,J) + 360D0
               ELSE IF (CACHE(4,J).GT.180D0) THEN
                  CACHE(4,J) = CACHE(4,J) - 360D0
               END IF
            END IF

            IF (INDEX('GHI', TYPE(IWRLD)).NE.0) THEN
*              Angle expressed as time.
               CACHE(4,J) = CACHE(4,J)/15D0
            END IF
 10      CONTINUE
      END IF


*  Reorganize the table entries.
*     Sort crossings for each of the four frame segments.
      DO 40 ITER = 1, IC
         NSWAP = 0
         DO 30 J = 1, IC-1
            IF (CACHE(1,J).LT.CACHE(1,J+1)) GO TO 30
            IF (CACHE(1,J).EQ.CACHE(1,J+1) .AND.
     :          CACHE(2,J).LE.CACHE(2,J+1)) GO TO 30

            NSWAP = NSWAP + 1
            DO 20 M = 1, 4
               TMP = CACHE(M,J)
               CACHE(M,J) = CACHE(M,J+1)
               CACHE(M,J+1) = TMP
 20         CONTINUE
 30      CONTINUE
         IF (NSWAP.EQ.0) GO TO 50
 40   CONTINUE

*     Squeeze out duplicates.
 50   JC = IC
      DO 90 J = 2, IC
         IF (J.GT.JC) GO TO 100

         DO 60 M = 1, 4
            IF (CACHE(M,J).NE.CACHE(M,J-1)) GO TO 90
 60      CONTINUE

*        This entry is the same as the previous one.
         JC = JC - 1
         DO 80 K = J, JC
            DO 70 M = 1, 4
               CACHE(M,K) = CACHE(M,K+1)
 70         CONTINUE
 80      CONTINUE
 90   CONTINUE

 100  IC = JC


*  How do we label the edges of the frame?
*     Determine separability indices.
      NI(1,0) = 0
      NI(1,1) = 0
      NI(1,2) = 0
      NI(1,3) = 0
      NI(1,4) = 0
      NI(2,0) = 0
      NI(2,1) = 0
      NI(2,2) = 0
      NI(2,3) = 0
      NI(2,4) = 0
      DO 110 J = 1, IC
         IF (CACHE(3,J).EQ.1D0) THEN
            IWRLD = 1
         ELSE
            IWRLD = 2
         END IF

         EDGE = NINT(CACHE(1,J))

         NI(IWRLD,0) = NI(IWRLD,0) + 1
         NI(IWRLD,EDGE) = NI(IWRLD,EDGE) + 1
 110  CONTINUE

      SI(1) = 0.0
      SI(2) = 0.0
      IF (NI(1,0).GT.0) SI(1) = 2.0*REAL(NI(1,1)+NI(1,3))/NI(1,0) - 1.0
      IF (NI(2,0).GT.0) SI(2) = 2.0*REAL(NI(2,1)+NI(2,3))/NI(2,0) - 1.0

*     Which coordinates go on which edges?
      IF (LABCTL.GT.0) THEN
*        User-defined.
         L = LABCTL
      ELSE
*        Work it out ourselves.
         L = 0
         IF (ABS(SI(1)-SI(2)).GT.1.0) THEN
*           Approximately horizontal/vertical grid lines.
            IF (SI(1).GT.SI(2)) THEN
*              First world coordinate with vertical grid lines.
               IF (NI(1,1).GT.3 .OR. NI(1,1).GE.NI(1,3)) THEN
*                 Label bottom of frame.
                  L = L + 1
               ELSE
*                 Label top of frame.
                  L = L + 100
               END IF

*              Second world coordinate with horizontal grid lines.
               IF (NI(2,2).GT.3 .OR. NI(2,2).GE.NI(2,4)) THEN
*                 Label left side of frame.
                  L = L + 20
               ELSE
*                 Label right side of frame.
                  L = L + 2000
               END IF
            ELSE
*              First world coordinate with horizontal grid lines.
               IF (NI(1,2).GT.3 .OR. NI(1,2).GE.NI(1,4)) THEN
*                 Label left side of frame.
                  L = L + 10
               ELSE
*                 Label right side of frame.
                  L = L + 1000
               END IF

*              Second world coordinate with vertical grid lines.
               IF (NI(2,1).GT.3 .OR. NI(2,1).GE.NI(2,3)) THEN
*                 Label bottom of frame.
                  L = L + 2
               ELSE
*                 Label top of frame.
                  L = L + 200
               END IF
            END IF
         ELSE
*           Skew grid lines or worse.
            IF (SI(1).GT.0.5D0) THEN
*              First world coordinate with vertical grid lines.
               IF (NI(1,1).GT.1 .OR. NI(1,1).GT.NI(1,3)) THEN
                  L = 1
               ELSE
                  L = 100
               END IF

               IF (SI(2).GT.0.5D0) THEN
*                 Second world coordinate also with vertical grid lines.
                  IF (L.EQ.1) THEN
                     L = 201
                  ELSE
                     IF (NI(2,1).GT.1 .OR. NI(2,1).GT.NI(2,3)) THEN
                        L = 102
                     ELSE
                        L = 300
                     END IF
                  END IF
               ELSE
*                 Second world coordinate with diagonal grid lines.
                  L = L + 2020
               END IF
            ELSE IF (SI(1).LT.-0.5D0) THEN
*              First world coordinate with horizontal grid lines.
               IF (NI(1,2).GT.1 .OR. NI(1,2).GT.NI(1,4)) THEN
                  L = 10
               ELSE
                  L = 1000
               END IF

               IF (SI(2).LT.-0.5D0) THEN
*                 Second world coordinate also with horizontal grid.
                  IF (L.EQ.10) THEN
                     L = 2010
                  ELSE
                     IF (NI(2,2).GT.1 .OR. NI(2,2).GT.NI(2,4)) THEN
                        L = 1020
                     ELSE
                        L = 3000
                     END IF
                  END IF
               ELSE
*                 Second world coordinate with diagonal grid lines.
                  L = L + 202
               END IF
            ELSE IF (SI(2).GT.0.5D0) THEN
*              Second world coordinate with vertical grid lines.
               IF (NI(2,1).GT.1 .OR. NI(2,1).GT.NI(2,3)) THEN
                  L = 1012
               ELSE
                  L = 1210
               END IF
            ELSE IF (SI(2).LT.-0.5D0) THEN
*              Second world coordinate with horizontal grid lines.
               IF (NI(2,2).GT.1 .OR. NI(2,2).GT.NI(2,4)) THEN
                  L = 121
               ELSE
                  L = 2101
               END IF
            ELSE
*              Desperation stakes!  Label all four axes.
               K1 = NI(1,3) + NI(1,1)
               K2 = NI(2,4) + NI(2,2)
               L = 2121

               M1 = NI(1,4) + NI(1,1)
               M2 = NI(2,3) + NI(2,2)
               IF (M1.GE.K1 .AND. M2.GE.K2) THEN
                  L  = 1221
                  K1 = M1
                  K2 = M2
               END IF

               M1 = NI(1,2) + NI(1,1)
               M2 = NI(2,4) + NI(2,3)
               IF (M1.GE.K1 .AND. M2.GE.K2) THEN
                  L  = 2211
                  K1 = M1
                  K2 = M2
               END IF

               M1 = NI(1,4) + NI(1,2)
               M2 = NI(2,3) + NI(2,1)
               IF (M1.GE.K1 .AND. M2.GE.K2) THEN
                  L  = 1212
                  K1 = M1
                  K2 = M2
               END IF

               M1 = NI(1,3) + NI(1,2)
               M2 = NI(2,4) + NI(2,1)
               IF (M1.GE.K1 .AND. M2.GE.K2) THEN
                  L  = 2112
                  K1 = M1
                  K2 = M2
               END IF

               M1 = NI(1,4) + NI(1,3)
               M2 = NI(2,2) + NI(2,1)
               IF (M1.GE.K1 .AND. M2.GE.K2) THEN
                  L  = 1122
                  K1 = M1
                  K2 = M2
               END IF
            END IF
         END IF
      END IF

*     Extract the information in a more usable form.
      SKIP(1) = MOD(L,10)
      SKIP(2) = MOD(L/10,10)
      SKIP(3) = MOD(L/100,10)
      SKIP(4) = MOD(L/1000,10)


*  Determine labelling precision.
*     Order of magnitude for plain numeric world coordinates.
      IMAG(1) = 0
      IMAG(2) = 0

      IF (TYPE(1).EQ.' ' .OR. TYPE(2).EQ.' ') THEN
         OMAG(1) = 0.0
         OMAG(2) = 0.0
         DO 120 J = 1, IC
            IF (CACHE(3,J).EQ.1D0) THEN
               IWRLD = 1
            ELSE
               IWRLD = 2
            END IF

            IF (TYPE(IWRLD).EQ.' ') THEN
*              Plain numeric.
               IF (CACHE(4,J).EQ.0D0) GO TO 120
               OMAG(IWRLD) = OMAG(IWRLD) + LOG10(ABS(CACHE(4,J)))
               IMAG(IWRLD) = IMAG(IWRLD) + 1
            END IF
 120     CONTINUE

         IF (IMAG(1).GT.0) IMAG(1) = INT(OMAG(1)/IMAG(1))
         IF (IMAG(1).GE.-2 .AND. IMAG(1).LE.4) IMAG(1) = 0

         IF (IMAG(2).GT.0) IMAG(2) = INT(OMAG(2)/IMAG(2))
         IF (IMAG(2).GE.-2 .AND. IMAG(2).LE.4) IMAG(2) = 0

*        Renormalize grid values.
         IF (IMAG(1).NE.0 .OR. IMAG(2).NE.0) THEN
            DO 130 J = 1, IC
               IF (CACHE(3,J).EQ.1D0) THEN
                  IWRLD = 1
               ELSE
                  IWRLD = 2
               END IF

               CACHE(4,J) = CACHE(4,J)/10D0**IMAG(IWRLD)
 130        CONTINUE
         END IF
      END IF

*     Sexagesimal labelling.
      IF (INDEX('DEFGHIT', TYPE(1)).NE.0 .OR.
     :    INDEX('DEFGHIT', TYPE(2)).NE.0) THEN
         LMAG(1) = -2
         LMAG(2) = -2

         DO 150 J = 1, IC
            IF (CACHE(3,J).EQ.1D0) THEN
               IWRLD = 1
            ELSE
               IWRLD = 2
            END IF

*           Skip non-sexagesimal coordinates.
            IF (INDEX('DEFGHIT', TYPE(IWRLD)).EQ.0) GO TO 150

*           Defeat rounding errors.
            LS = INT(ABS(CACHE(4,J)*3600D0) + 0.5D-6)
            LV = NINT(MOD(ABS(CACHE(4,J)*3600D0), 1D0)*1D6)
            IF (LV.NE.0) THEN
*              Sub-arcsec/second resolution.
               M = 1
               DO 140 K = 1, 6
                  M = M*10
                  IF (MOD(LV,M).NE.0) THEN
                     LMAG(IWRLD) = MAX(LMAG(IWRLD), 7-K)
                     GO TO 150
                  END IF
 140           CONTINUE
            ELSE IF (LMAG(IWRLD).LT.0) THEN
               IF (MOD(LS,60).NE.0) THEN
                  LMAG(IWRLD) = MAX(LMAG(IWRLD), 0)
               ELSE IF (MOD(LS,3600).NE.0) THEN
                  LMAG(IWRLD) = MAX(LMAG(IWRLD), -1)
               END IF
            END IF
 150     CONTINUE
      END IF


*  Produce labels.
      XW1 = 0.5
      XW2 = AXEN(1) + 0.5
      YW1 = 0.5
      YW2 = AXEN(2) + 0.5

*     These will define a box which just contains the labels.
      BNDRY(1) = YW1
      BNDRY(2) = XW1
      BNDRY(3) = YW2
      BNDRY(4) = XW2

*     These will record the edges on which labels were actually written.
      SKOP(1) = 0
      SKOP(2) = 0
      SKOP(3) = 0
      SKOP(4) = 0

*     Character height, in pixels.
      CALL PGQCS (4, XCH, YCH)
      PRVEDG = 0

*     Loop through the axis crossing table.
      DO 180 J = 1, IC
*        Determine the position.
         IF (CACHE(3,J).EQ.1D0) THEN
            IWRLD = 1
            CALL PGSCI (CI(3))
         ELSE
            CALL PGSCI (CI(4))
            IWRLD = 2
         END IF

         EDGE = NINT(CACHE(1,J))
         IF (EDGE.NE.PRVEDG) THEN
            PRVD(1) = -1
            PRVD(2) = -1
            PRVH(1) = -1
            PRVH(2) = -1
            PRVM(1) = -1
            PRVM(2) = -1
            XL = -999.0
            YL = -999.0
         END IF
         PRVEDG = EDGE
         LFORCE = .FALSE.

         IF (EDGE.EQ.1) THEN
*           Bottom.
            IF (IWRLD.EQ.1) THEN
               IF (MOD(SKIP(1),2).NE.1) GO TO 180
            ELSE
               IF (MOD(SKIP(1)/2,2).NE.1) GO TO 180
            END IF

            FJUST = 0.5
            X = CACHE(2,J)
            Y = YW1 - 1.5*YCH
         ELSE IF (EDGE.EQ.2) THEN
*           Left.
            IF (IWRLD.EQ.1) THEN
               IF (MOD(SKIP(2),2).NE.1) GO TO 180
            ELSE
               IF (MOD(SKIP(2)/2,2).NE.1) GO TO 180
            END IF

            FJUST = 1.0
            X = XW1 - 0.5*XCH
            Y = CACHE(2,J) - YCH/2.0
         ELSE IF (EDGE.EQ.3) THEN
*           Top.
            IF (IWRLD.EQ.1) THEN
               IF (MOD(SKIP(3),2).NE.1) GO TO 180
            ELSE
               IF (MOD(SKIP(3)/2,2).NE.1) GO TO 180
            END IF

            FJUST = 0.5
            X = CACHE(2,J)
            Y = YW2 + 0.5*YCH
         ELSE IF (EDGE.EQ.4) THEN
*           Right.
            IF (IWRLD.EQ.1) THEN
               IF (MOD(SKIP(4),2).NE.1) GO TO 180
            ELSE
               IF (MOD(SKIP(4)/2,2).NE.1) GO TO 180
            END IF

            FJUST = 0.0
            X = XW2 + 0.5*XCH
            Y = CACHE(2,J) - YCH/2.0
         END IF

*        Format the numeric label.
         IF (INDEX('ABC', TYPE(IWRLD)).NE.0) THEN
*           Decimal angle; allow up to 6 decimal digits.
            TMP = ABS(CACHE(4,J)) + 0.5D-6
            LD  = INT(TMP)

            K = 1
            IF (CACHE(4,J).LT.0D0) THEN
*              Insert a minus sign.
               TEXT(1:1) = '-'
               K = 2
            END IF

            CALL PGNUMB (LD, 0, 1, TEXT(K:), NCH)
            K = K + NCH
            TEXT(K:) = ESCAPE // 'uo' // ESCAPE // 'd'
            K = K + 4

            LV = INT(MOD(TMP,1D0)*1D6)
            IF (LV.NE.0) CALL PGNUMB (LV, -6, 1, TEXT(K:), NCH)
            TEXT(K:K) = 'd'

         ELSE IF (INDEX('DEFGHIT', TYPE(IWRLD)).NE.0) THEN
*           Sexagesimal format; angle or time?
            ANGLE = INDEX('DEF', TYPE(IWRLD)).NE.0
            L = LMAG(IWRLD)

*           Use integer arithmetic to avoid rounding problems.
            TMP = ABS(CACHE(4,J))*3600D0 + 0.5D-6
            LV = INT(TMP)

*           Degree/hour field.
            LD = LV/3600

            K = 1
            IF (L.EQ.-2 .OR. LD.NE.PRVD(IWRLD)) THEN
*              Write the degree/hour field.
               IF (CACHE(4,J).LT.0D0) THEN
*                 Insert a minus sign.
                  TEXT(1:1) = '-'
                  K = 2
               END IF

               IF (ANGLE) THEN
*                 Angle.
                  CALL PGNUMB (LD, 0, 1, TEXT(K:), NCH)
                  K = K + NCH
                  TEXT(K:) = ESCAPE // 'uo' // ESCAPE // 'd'
                  K = K + 5
               ELSE
*                 Time.
                  IF (LD.LE.9 .AND. TYPE(IWRLD).NE.'T') THEN
*                    Write leading zeroes in the hour field.
                     WRITE (TEXT(K:), '(I2.2)') LD
                     K = K + 2
                  ELSE
                     CALL PGNUMB (LD, 0, 1, TEXT(K:), NCH)
                     K = K + NCH
                  END IF
                  TEXT(K:) = ESCAPE // 'uh' // ESCAPE // 'd'
                  K = K + 5
               END IF

            END IF

            IF (L.GE.-1) THEN
*              Arcminute/minute field.
               LV = LV - LD*3600
               LM = LV/60

               IF (L.EQ.-1 .OR. K.GT.1 .OR. LM.NE.PRVM(IWRLD)) THEN
                  IF (ANGLE) THEN
                     WRITE (TEXT(K:), '(I2.2,A)') LM, ''''
                     K = K + 3
                  ELSE
                     WRITE (TEXT(K:), '(I2.2,A)') LM,
     :                  ESCAPE // 'um' // ESCAPE // 'd'
                     K = K + 7
                  END IF
               END IF

               IF (L.GE.0) THEN
*                 Arcsec/second field.
                  LS = LV - LM*60

                  IF (ANGLE) THEN
                     WRITE (TEXT(K:), '(I2.2,A)') LS, '"'
                     K = K + 3
                  ELSE
                     WRITE (TEXT(K:), '(I2.2,A)') LS,
     :                  ESCAPE // 'us' // ESCAPE // 'd'
                     K = K + 7
                  END IF

                  IF (L.GT.0) THEN
*                    Sub-arcsec/second field.
                     WRITE (FMT, '(A,I1,A,I1,A)') '(A,I', L, '.', L, ')'
                     LV = INT(MOD(TMP,1D0)*10**L)
                     WRITE (TEXT(K:), FMT) '.', LV
                  END IF
               END IF
            END IF

         ELSE IF (TYPE(IWRLD).EQ.'L') THEN
*           Logarithmic.
            TMP = MOD(CACHE(4,J),1D0)
            IF (TMP.LT.0D0) TMP = TMP + 1D0
            MM = NINT(10D0**TMP)
            IF (MM.EQ.10) THEN
               TMP = TMP - 1D0
               MM = 1
            END IF

            PP = NINT(CACHE(4,J) - TMP)

            IF (MM.NE.1) THEN
               WRITE (TEXT, '(I1)') MM
            ELSE
*              FORTRAN is really abysmal sometimes.
               WRITE (TEXT, '(I8)') PP
               DO 160 K = 1, 8
                  IF (TEXT(K:K).NE.' ') GO TO 170
 160           CONTINUE
 170           TEXT = '10' // ESCAPE // 'u' // TEXT(K:8)

               LFORCE = .TRUE.
            END IF

         ELSE
*           Plain number; allow up to six significant digits.
            IF (CACHE(4,J).NE.0D0) THEN
               PP = INT(LOG10(ABS(CACHE(4,J)))) - 6
               MM = NINT(CACHE(4,J)/10D0**PP)
            ELSE
               PP = 0
               MM = 0
            END IF

            CALL PGNUMB (MM, PP, 0, TEXT, NCH)
         END IF

*        Write the label if it doesn't overlap the previous one.
         CALL PGQTXT (X, Y, 0.0, FJUST, TEXT, XBOX, YBOX)
         IF (LFORCE .OR. XBOX(1).GT.XL .OR. YBOX(1).GT.YL) THEN
            IF (IWRLD.EQ.1) THEN
               CALL PGSCI (CI(3))
            ELSE
               CALL PGSCI (CI(4))
            END IF

            CALL PGPTXT (X, Y, 0.0, FJUST, TEXT)
            XL = XBOX(4) + XCH
            YL = YBOX(2) + 0.5*YCH

*           Sexagesimal formatting.
            PRVD(IWRLD) = LD
            PRVM(IWRLD) = LM

*           Record the fact.
            IF (IWRLD.EQ.1) THEN
               SKOP(EDGE) = 2*(SKOP(EDGE)/2) + 1
            ELSE
               SKOP(EDGE) = 2 + MOD(SKOP(EDGE),2)
            END IF

*           Boundary within which the numeric labels lie.
            IF (EDGE.EQ.1) THEN
               IF (YBOX(1).LT.BNDRY(1)) BNDRY(1) = YBOX(1)
            ELSE IF (EDGE.EQ.2) THEN
               IF (XBOX(1).LT.BNDRY(2)) BNDRY(2) = XBOX(1)
            ELSE IF (EDGE.EQ.3) THEN
               IF (YBOX(2).GT.BNDRY(3)) BNDRY(3) = YBOX(2)
            ELSE IF (EDGE.EQ.4) THEN
               IF (XBOX(4).GT.BNDRY(4)) BNDRY(4) = XBOX(4)
            END IF

*           Check the distance to the previous grid line.
            IF (J.GT.1) THEN
               IF (CACHE(1,J).EQ.CACHE(1,J-1)) THEN
                  IF (EDGE.EQ.1 .OR. EDGE.EQ.3) THEN
                     TICKIT = XBOX(1).LT.CACHE(2,J-1)
                  ELSE
                     TICKIT = YBOX(1).LT.CACHE(2,J-1)
                  END IF
               END IF
            END IF

*           Check the distance to the next grid line.
            IF (J.LT.IC) THEN
               IF (CACHE(1,J).EQ.CACHE(1,J+1)) THEN
                  IF (EDGE.EQ.1 .OR. EDGE.EQ.3) THEN
                     TICKIT = XBOX(2).GT.CACHE(2,J+1)
                  ELSE
                     TICKIT = YBOX(2).GT.CACHE(2,J+1)
                  END IF
               END IF
            END IF

*           Density of grid lines is high.
            IF (TICKIT) THEN
*              Draw outside pip mark.
               Z = REAL(CACHE(2,J))
               IF (EDGE.EQ.1) THEN
                  CALL PGMOVE (Z, YW1-0.3*YCH)
                  CALL PGDRAW (Z, YW1)
               ELSE IF (EDGE.EQ.2) THEN
                  CALL PGMOVE (XW1-0.3*XCH, Z)
                  CALL PGDRAW (XW1, Z)
               ELSE IF (EDGE.EQ.3) THEN
                  CALL PGMOVE (Z, YW2+0.3*YCH)
                  CALL PGDRAW (Z, YW2)
               ELSE IF (EDGE.EQ.4) THEN
                  CALL PGMOVE (XW2+0.3*XCH, Z)
                  CALL PGDRAW (XW2, Z)
               END IF
            END IF
         END IF
 180  CONTINUE


*  Write the identification strings.
*     World coordinates.
      DO 260 EDGE = 1, 4
         TEXT = ' '

         DO 230 IWRLD = 1, 2
            TXT(IWRLD) = ' '

            IF (MOD(SKOP(EDGE)/IWRLD,2).EQ.0) GO TO 230

            L = LEN(IDENTS(IWRLD))
            DO 190 K = 1, L
               IF (IDENTS(IWRLD)(K:K).NE.' ') THEN
                  TXT(IWRLD) = IDENTS(IWRLD)(K:L)
                  GO TO 200
               END IF
 190        CONTINUE

 200        IF (IMAG(IWRLD).NE.0) THEN
               DO 210 K = 40, 1, -1
                  IF (TXT(IWRLD)(K:K).NE.' ') GO TO 220
 210           CONTINUE

*              Add scaling information.
 220           CALL PGNUMB (IMAG(IWRLD), 0, 1, EXPONT, NCH)
               TXT(IWRLD)(K+1:) = '  x10' // ESCAPE // 'u' // EXPONT
            END IF

 230     CONTINUE

         K = 0
         IF (TXT(1).NE.' ') THEN
*           Identify first world coordinate...
            TEXT = TXT(1)
            CALL PGSCI (CI(5))

            IF (TXT(2).NE.' ') THEN
*              ...and also second world coordinate.
               DO 240 K = 40, 1, -1
                  IF (TEXT(K:K).NE.' ') GO TO 250
 240           CONTINUE

 250           K = K + 1
               TEXT(K:) = ',  ' // TXT(2)
            END IF
         ELSE IF (TXT(2).NE.' ') THEN
*           Identify second world coordinate only.
            TEXT = TXT(2)
            CALL PGSCI (CI(6))
         ELSE
*           No text to write.
            GO TO 260
         END IF

         IF (EDGE.EQ.1) THEN
            X = (XW1 + XW2)/2.0
            Y = BNDRY(1) - 1.5*YCH
            ANGL = 0.0
         ELSE IF (EDGE.EQ.2) THEN
            IF (TEXT(2:).EQ.' ') THEN
*              One character, write upright.
               X = BNDRY(2) - 1.0*XCH
               Y = (YW1 + YW2)/2.0
               ANGL = 0.0
            ELSE
               X = BNDRY(2) - 0.5*XCH
               Y = (YW1 + YW2)/2.0
               ANGL = 90.0
            END IF
         ELSE IF (EDGE.EQ.3) THEN
            X = (XW1 + XW2)/2.0
            Y = BNDRY(3) + 0.5*YCH
            ANGL = 0.0
            BNDRY(3) = BNDRY(3) + 1.5*YCH
         ELSE IF (EDGE.EQ.4) THEN
            IF (TEXT(2:).EQ.' ') THEN
*              One character, write upright.
               X = BNDRY(4) + 1.0*XCH
               Y = (YW1 + YW2)/2.0
               ANGL = 0.0
            ELSE
               X = BNDRY(4) + 0.5*XCH
               Y = (YW1 + YW2)/2.0
               ANGL = -90.0
            END IF
         END IF

         IF (K.EQ.0) THEN
            CALL PGPTXT (X, Y, ANGL, 0.5, TEXT)
         ELSE
*           Two-colour annotation.
            CALL PGQTXT (X, Y, ANGL, 0.5, TEXT, XBOX, YBOX)
            CALL PGPTXT (XBOX(1), YBOX(1), ANGL, 0.0, TEXT(:K))
            CALL PGSCI (CI(6))
            CALL PGPTXT (XBOX(4), YBOX(4), ANGL, 1.0, TEXT(K+1:))
         END IF

 260  CONTINUE

*     Title.
      IF (IDENTS(3).NE.' ') THEN
         CALL PGSCI (CI(7))
         X = (XW1 + XW2)/2.0
         Y = BNDRY(3) + 0.5*YCH
         CALL PGPTXT (X, Y, 0.0, 0.5, IDENTS(3))
      END IF

@


1.19
log
@Updated date in copyright notice.
@
text
@d188 1
a188 1
*                        GRID2(0) = 0D0, then chose the same grid
d408 1
a408 1
*   $Id: pgcrvl.f,v 1.18 1999/12/01 04:14:08 mcalabre Exp mcalabre $
d1207 4
a1210 2
      CHARACTER EXPONT*20, FMT*8, IDENTS(3)*(*), TEXT*80, TYPE(2)*1,
     :          TXT(2)*40
d1667 1
a1667 1
            TEXT(K:) = '\\uo\\d'
d1699 1
a1699 1
                  TEXT(K:) = '\\uo\\d'
d1711 1
a1711 1
                  TEXT(K:) = '\\uh\\d'
d1727 2
a1728 1
                     WRITE (TEXT(K:), '(I2.2,A)') LM, '\\um\\d'
d1741 2
a1742 1
                     WRITE (TEXT(K:), '(I2.2,A)') LS,'\\us\\d'
d1775 1
a1775 1
 170           TEXT = '10\\u' // TEXT(K:8)
d1897 1
a1897 1
               TXT(IWRLD)(K+1:) = '  x10\\u' // EXPONT
@


1.18
log
@The test for whether a point was inside the frame was done in double
precision but the pixel coordinates were then converted to single
precision for subsequent calculations.  On rare occasions rounding error
could move an internal point onto the frame line hence making it external.
This then led to a floating divide by zero if tick marks were being plotted.
@
text
@d4 1
a4 1
*   Copyright (C) 1997-1999, Mark Calabretta
d408 1
a408 1
*   $Id: pgcrvl.f,v 1.16 1999/07/22 02:04:03 mcalabre Exp mcalabre $
@


1.17
log
@Amended copyright notice; converted continuation character from "*" to ":".
@
text
@d945 4
a948 4
                     INSIDE = PIXEL(1).GT.0.5 .AND.
     :                        PIXEL(1).LT.AXEN(1)+0.5 .AND.
     :                        PIXEL(2).GT.0.5 .AND.
     :                        PIXEL(2).LT.AXEN(2)+0.5
d951 2
a952 2
                     XR(1) = PIXEL(1)
                     YR(1) = PIXEL(2)
d977 4
a980 4
                  INSIDE = PIXEL(1).GT.0.5 .AND.
     :                     PIXEL(1).LT.AXEN(1)+0.5 .AND.
     :                     PIXEL(2).GT.0.5 .AND.
     :                     PIXEL(2).LT.AXEN(2)+0.5
d984 2
a985 2
                     XR(1) = PIXEL(1)
                     YR(1) = PIXEL(2)
a992 2
                           X2 = PIXEL(1)
                           Y2 = PIXEL(2)
d1055 2
a1056 2
                        XR(NP) = PIXEL(1)
                        YR(NP) = PIXEL(2)
a1062 2
                           X2 = PIXEL(1)
                           Y2 = PIXEL(2)
d1065 2
a1066 2
                           XR(NP) = PIXEL(1)
                           YR(NP) = PIXEL(2)
d1128 2
a1129 2
                           XR(NP) = PIXEL(1)
                           YR(NP) = PIXEL(2)
@


1.16
log
@Added copyright notice.
@
text
@d20 1
a20 1
*   Correspondence concerning WCSLIB may be directed to:
d408 1
a408 1
*   $Id: pgcrvl.f,v 1.15 1999/06/01 01:12:26 mcalabre Exp mcalabre $
d411 2
a412 2
     *   TIKLEN, NG1, GRID1, NG2, GRID2, DOEQ, NLFUNC, NLC, NLI, NLD,
     *   NLCPRM, NLIPRM, NLDPRM, NC, IC, CACHE, IERR)
d419 4
a422 4
     *          GCODE(2), IC, IERR, IPIX, ISTEP, IWJ, IWK, J, JPIX, K,
     *          L, LABCTL, LABDEN, LDIV(2), LTABL(6,2:6), N1, N2, NC,
     *          NG(2), NG1, NG2, NLC, NLD, NLI, NLIPRM(NLI), NP, NW(2),
     *          TCODE(2,4)
d424 1
a424 1
     *          XVP2, Y1, Y2, YR(BUFSIZ), YSCL, YVP1, YVP2
d426 3
a428 3
     *          G0(2), GSTEP(2), GRID1(0:NG1), GRID2(0:NG2),
     *          NLDPRM(NLD), PIXEL(2), STEP, TIKLEN, TMP, VMAX(2,2),
     *          VMIN(2,2), WMAX(2), WMIN(2), WORLD(2)
d447 4
a450 4
     *            2,  5, 10,  0,  0,  0,
     *            2,  3,  5, 10,  0,  0,
     *            2,  3,  5,  7, 10,  0,
     *            2,  3,  4,  5,  7, 10/
d454 1
a454 1
     *   PIXEL, CONTRL, CONTXT, IERR)
d474 1
a474 1
     *             0.5-YSCL*YVP1, AXEN(2)+0.5+YSCL*(1.0-YVP2))
d518 1
a518 1
     *            WORLD, PIXEL, CONTRL, CONTXT, IERR)
d562 1
a562 1
     *             WMAX(J)-WMIN(J).GT.VMAX(J,1)-VMIN(J,1)+TOL) THEN
d574 1
a574 1
     *             WMAX(J)-WMIN(J).GT.VMAX(J,2)-VMIN(J,2)+TOL) THEN
d662 1
a662 1
     *         TYPE(J).EQ.'T' .AND. STEP.GE.1D0) THEN
d697 1
a697 1
     *               INDEX('DEFT',TYPE(J)).NE.0 .AND. STEP.LT.1D0) THEN
d943 1
a943 1
     *               WORLD, PIXEL, CONTRL, CONTXT, IERR)
d946 3
a948 3
     *                        PIXEL(1).LT.AXEN(1)+0.5 .AND.
     *                        PIXEL(2).GT.0.5 .AND.
     *                        PIXEL(2).LT.AXEN(2)+0.5
d962 1
a962 1
     *               WORLD, PIXEL, CONTRL, CONTXT, IERR)
d978 3
a980 3
     *                     PIXEL(1).LT.AXEN(1)+0.5 .AND.
     *                     PIXEL(2).GT.0.5 .AND.
     *                     PIXEL(2).LT.AXEN(2)+0.5
d1042 1
a1042 1
     *                                 (YSCL*(Y2-Y1))**2)/TCODE(J,FSEG)
d1119 1
a1119 1
     *                                 (YSCL*(Y2-Y1))**2)/TCODE(J,FSEG)
d1157 1
a1157 1
     *   IC, CACHE)
d1205 3
a1207 3
     *          K, K1, K2, L, LABCTL, LD, LM, LMAG(2), LS, LV, M, M1,
     *          M2, MM, NC, NCH, NI(2,0:4), NSWAP, PP, PRVD(2), PRVH(2),
     *          PRVM(2), PRVEDG, SKIP(4), SKOP(4)
d1209 1
a1209 1
     *          XCH, XL, XW1, XW2, Y, YCH, YBOX(4), YL, YW1, YW2, Z
d1212 1
a1212 1
     *          TXT(2)*40
d1216 1
a1216 1
     *    INDEX('ABDEGH',TYPE(2)).NE.0) THEN
d1251 1
a1251 1
     *          CACHE(2,J).LE.CACHE(2,J+1)) GO TO 30
d1523 1
a1523 1
     *    INDEX('DEFGHIT', TYPE(2)).NE.0) THEN
@


1.15
log
@Fixed a problem with degree formatting in PGCRLB.
@
text
@d3 27
d408 1
a408 1
*   $Id: pgcrvl.f,v 1.14 1997/04/14 23:31:10 mcalabre Exp mcalabre $
@


1.14
log
@*** empty log message ***
@
text
@d284 1
a284 1
*       to signal that PGCRVL needs to determine the extrema.  On
d381 1
a381 1
*   $Id: pgcrvl.f,v 1.13 1997/04/11 02:15:17 mcalabre Exp mcalabre $
d1643 1
a1643 1
            K = K + 5
d1647 1
@


1.13
log
@*** empty log message ***
@
text
@d110 2
a111 2
*                        For example, if CI(3) is used for numeric
*                        labels for the first world coordinate.
d114 1
a114 1
*                        if CI(J) <= 0.
d381 1
a381 1
*   $Id: pgcrvl.f,v 1.12 1997/04/09 01:57:19 mcalabre Exp mcalabre $
d848 1
a848 1
         IF (CI(J).GT.0) THEN
d1931 1
a1931 1
         IF (K.EQ.0 .OR. CI(6).LE.0) THEN
@


1.12
log
@*** empty log message ***
@
text
@d7 6
d20 1
a20 1
*      TYPE     C(2)*1   Formatting control for the world coordinates,
d38 1
a38 1
*                           'H': as 'H' but normalized in the range
d40 1
a40 1
*                           'I': as 'H' but unnormalized.
d93 16
a108 21
*      CI       I        Index into a predefined set of colours
*                        established by calls to PGSCR.  This is used
*                        optionally to control the colour used for
*                        different parts of the plot.  Offsets from CI
*                        are used as follows:
*
*                                                  world
*                                                coordinate
*                        Offset      usage        element
*                        ------  --------------  ----------
*                          +0      grid lines        1
*                          +1      grid lines        2
*                          +2    numeric labels      1
*                          +3    numeric labels      2
*                          +4    axis annotation     1
*                          +5    axis annotation     2
*                          +6        title           -
*
*                        For example, if CI = 24, then colour 26 will be
*                        used for numeric labels for the first world
*                        coordinate.
d110 2
a111 1
*                        Colour selection is disabled if CI < 0.
d113 3
d216 16
a231 16
*            value    label
*            ------   -----
*            0.9031     8
*            0.9542     9
*            1.0000   10**1
*            1.3010     2
*            1.4771     3
*            1.6021     4
*            1.6990     5
*            1.7782     6
*            1.8451     7
*            1.9031     8
*            1.9542     9
*            2.0000   10**2
*            2.3010     2
*            2.4771     3
d381 1
a381 1
*   $Id: pgcrvl.f,v 1.11 1997/04/03 04:14:08 mcalabre Exp mcalabre $
d383 1
a383 1
      SUBROUTINE PGCRVL (AXEN, IDENTS, TYPE, LABCTL, LABDEN, CI, GCODE,
d390 6
a395 5
      LOGICAL   DOEQ, GETEND, INSIDE, ISANGL(2), PRVIN
      INTEGER   AXEN(2), CI, CI0, CONTRL, DENS(2), FSEG, GCODE(2), IC,
     *          IERR, IPIX, ISTEP, IWJ, IWK, J, JPIX, K, L, LABCTL,
     *          LABDEN, LDIV(2), LTABL(6,2:6), N1, N2, NC, NG(2), NG1,
     *          NG2, NLC, NLD, NLI, NLIPRM(NLI), NP, NW(2), TCODE(2,4)
d402 1
a402 1
      CHARACTER IDENTS(3)*(*), NLCPRM(NLC)*1, TYPE(2)*1
d437 3
d450 1
a450 1
      IF (LABCTL.GE.10000) GO TO 110
d628 1
a628 1
               ELSE IF (STEP.LT.360D0) THEN
d631 1
a631 1
                  STEP = 360D0*MOD(STEP,360D0)
d651 1
a651 1
               ELSE IF (STEP.LT.4.5D0) THEN
d653 1
a653 1
               ELSE IF (STEP.LT.5D0) THEN
d655 1
a655 1
               ELSE IF (STEP.LT.7D0) THEN
d657 1
a657 1
               ELSE IF (STEP.LT.10D0) THEN
d659 3
a661 1
               ELSE IF (STEP.LT.18D0) THEN
d664 1
a664 1
                  STEP = 24D0*MOD(STEP,24D0)
d847 7
d856 2
a857 2
      DO 100 J = 1, 2
         IF (GCODE(J).EQ.0) GO TO 100
d860 1
a860 1
            IF (CI.GT.0) CALL PGSCI (CI)
d863 1
a863 1
            IF (CI.GT.0) CALL PGSCI (CI+1)
d873 4
a876 1
         DO 90 IWJ = 0, NW(J)
d878 2
a879 1
               IF (IWJ.EQ.0) GO TO 90
d883 1
d886 1
a886 1
*              Logarithmic.
d892 5
a896 1
                  IF (L.NE.0) THEN
d910 1
a910 1
            DO 80 IWK = 0, NSTEP
d930 1
a930 1
                  GO TO 80
d933 1
a933 1
               DO 70 ISTEP = 1, 1000
d939 1
a939 1
                     GO TO 90
d1016 1
d1093 1
d1114 1
a1114 1
                     GO TO 80
d1120 2
a1121 2
 70            CONTINUE
 80         CONTINUE
d1124 2
a1125 2
 90      CONTINUE
 100  CONTINUE
d1129 1
a1129 1
 110  IF (LABCTL.NE.-1) CALL PGCRLB (AXEN, IDENTS, TYPE, LABCTL, CI, NC,
d1155 1
a1155 1
*      TYPE     C*1(2)   Axis types, used for axis labelling (see
d1161 1
a1161 1
*      CI       I        Colour index (see PGCRVL).
d1177 4
a1180 4
      INTEGER   AXEN(2), CI, EDGE, IC, IMAG(2), ITER, IWRLD, J, JC, K,
     *          L, LABCTL, LD, LM, LMAG(2), LS, LV, M, MM, NC, NCH,
     *          NI(2,0:4), NSWAP, PP, PRVD(2), PRVH(2), PRVM(2), PRVEDG,
     *          SKIP(4), SKOP(4)
d1337 6
d1345 9
a1353 1
                  L = 201
d1356 1
a1356 1
                  L = 2021
d1360 6
d1368 9
a1376 1
                  L = 2010
d1379 1
a1379 1
                  L = 212
d1383 5
a1387 1
               L = 1012
d1390 5
a1394 1
               L = 121
d1397 2
a1398 1
               K = NI(2,4) + NI(1,3) + NI(2,2) + NI(1,1)
d1401 38
a1438 28
               M = NI(1,4) + NI(2,3) + NI(2,2) + NI(1,1)
               IF (M.GT.K) THEN
                  L = 1221
                  K = M
               END IF

               M = NI(2,4) + NI(2,3) + NI(1,2) + NI(1,1)
               IF (M.GT.K) THEN
                  L = 2211
                  K = M
               END IF

               M = NI(1,4) + NI(2,3) + NI(1,2) + NI(2,1)
               IF (M.GT.K) THEN
                  L = 1212
                  K = M
               END IF

               M = NI(2,4) + NI(1,3) + NI(1,2) + NI(2,1)
               IF (M.GT.K) THEN
                  L = 2112
                  K = M
               END IF

               M = NI(1,4) + NI(1,3) + NI(2,2) + NI(2,1)
               IF (M.GT.K) THEN
                  L = 1122
                  K = M
d1561 1
a1561 1
            IF (CI.GT.0) CALL PGSCI (CI+2)
d1563 1
a1563 1
            IF (CI.GT.0) CALL PGSCI (CI+3)
d1768 4
a1771 6
            IF (CI.GT.0) THEN
               IF (IWRLD.EQ.1) THEN
                  CALL PGSCI (CI+2)
               ELSE
                  CALL PGSCI (CI+3)
               END IF
d1878 1
a1878 1
            IF (CI.GT.0) CALL PGSCI (CI+4)
d1892 1
a1892 1
            IF (CI.GT.0) CALL PGSCI (CI+5)
d1931 1
a1931 1
         IF (K.EQ.0 .OR. CI.LT.0) THEN
d1937 1
a1937 1
            CALL PGSCI (CI+5)
d1945 1
a1945 1
         IF (CI.GT.0) CALL PGSCI (CI+6)
@


1.11
log
@*** empty log message ***
@
text
@d81 5
a85 4
*                        GRID1(0) != 0).  LABDEN = 100*D2 + D1 where
*                        D1, and D2 are the approximate densities of the
*                        first and second world coordinates.  LABDEN = 0
*                        is effectively the same as LABDEN = 808.
d174 1
a174 2
*      NC       I        Total number of locations in the CROSS table
*                        (must be >0).
d176 3
a178 1
*      IC       I        Current number of entries in the CROSS table.
d180 2
a181 1
*      CROSS    D(4,NC)  Table of points where the tick marks or grid
d192 3
d263 1
a263 1
*    3) PGCRVL maintains a table of axis crossings, CROSS, in which it
d276 8
d295 4
a298 1
*                               OPCODE = +1 or +2.
d329 3
a331 2
*                           2: Call NLFUNC again with the same world
*                              coordinates.
d376 1
a376 1
*   $Id: pgcrvl.f,v 1.10 1997/03/18 07:30:16 mcalabre Exp $
d380 1
a380 1
     *   NLCPRM, NLIPRM, NLDPRM, NC, IC, CROSS, IERR)
d392 1
a392 1
      DOUBLE PRECISION CONTXT(20), CROSS(4,NC), D1, D2, DW(2), FACT,
a429 1
      IF (IC.LT.0) IC = 0
d441 1
a441 1
      IF (LABCTL.GE.10000) GO TO 100
d445 90
a534 82
*     Coarse search to find approximate ranges.
      WMIN(1) =  1D99
      WMAX(1) = -1D99
      WMIN(2) =  1D99
      WMAX(2) = -1D99

*     Need to consider cycles in angle through 360 degrees.
      ISANGL(1) = INDEX('ABCDEFGHI',TYPE(1)).NE.0
      ISANGL(2) = INDEX('ABCDEFGHI',TYPE(2)).NE.0
      VMIN(1,1) =  1D99
      VMIN(1,2) =  1D99
      VMAX(1,1) = -1D99
      VMAX(1,2) = -1D99
      VMIN(2,1) =  1D99
      VMIN(2,2) =  1D99
      VMAX(2,1) = -1D99
      VMAX(2,2) = -1D99

*     Decimate the image.
      N1 = AXEN(1)/10 + 1
      N2 = AXEN(2)/10 + 1
      D1 = DBLE(AXEN(1))/N1
      D2 = DBLE(AXEN(2))/N2

      PIXEL(1) = 0.5D0
      DO 20 IPIX = 0, N1

         PIXEL(2) = 0.5D0
         DO 10 JPIX = 0, N2
            CALL NLFUNC (-1, NLC, NLI, NLD, NLCPRM, NLIPRM, NLDPRM,
     *         WORLD, PIXEL, CONTRL, CONTXT, IERR)
            IF (IERR.NE.0) GO TO 10

            IF (WORLD(1).LT.WMIN(1)) WMIN(1) = WORLD(1)
            IF (WORLD(1).GT.WMAX(1)) WMAX(1) = WORLD(1)
            IF (WORLD(2).LT.WMIN(2)) WMIN(2) = WORLD(2)
            IF (WORLD(2).GT.WMAX(2)) WMAX(2) = WORLD(2)

            IF (ISANGL(1)) THEN
*              Normalize to the range [0,360).
               WORLD(1) = MOD(WORLD(1), 360D0)
               IF (WORLD(1).LT.0D0) WORLD(1) = WORLD(1) + 360D0
               IF (WORLD(1).LT.VMIN(1,1)) VMIN(1,1) = WORLD(1)
               IF (WORLD(1).GT.VMAX(1,1)) VMAX(1,1) = WORLD(1)

*              Normalize to the range (-180,180].
               IF (WORLD(1).GT.180D0) WORLD(1) = WORLD(1) - 360D0
               IF (WORLD(1).LT.VMIN(1,2)) VMIN(1,2) = WORLD(1)
               IF (WORLD(1).GT.VMAX(1,2)) VMAX(1,2) = WORLD(1)
            END IF

            IF (ISANGL(2)) THEN
*              Normalize to the range [0,360).
               WORLD(2) = MOD(WORLD(2), 360D0)
               IF (WORLD(2).LT.0D0) WORLD(2) = WORLD(2) + 360D0
               IF (WORLD(2).LT.VMIN(2,1)) VMIN(2,1) = WORLD(2)
               IF (WORLD(2).GT.VMAX(2,1)) VMAX(2,1) = WORLD(2)

*              Normalize to the range (-180,180].
               IF (WORLD(2).GT.180D0) WORLD(2) = WORLD(2) - 360D0
               IF (WORLD(2).LT.VMIN(2,2)) VMIN(2,2) = WORLD(2)
               IF (WORLD(2).GT.VMAX(2,2)) VMAX(2,2) = WORLD(2)
            END IF

            PIXEL(2) = PIXEL(2) + D2
 10      CONTINUE

         PIXEL(1) = PIXEL(1) + D1
 20   CONTINUE

*     Check for cycles in angle.
      DO 30 J = 1, 2
         IF (ISANGL(J)) THEN
            IF (WMAX(J)-WMIN(J).LT.360D0 .AND.
     *          WMAX(J)-WMIN(J).GT.VMAX(J,1)-VMIN(J,1)+TOL) THEN
*              Must have a cycle, preserve the sign.
               IF (WMAX(J).GE.0D0) THEN
                  WMIN(J) = VMIN(J,1)
                  WMAX(J) = VMAX(J,1)
               ELSE
                  WMIN(J) = VMIN(J,1) - 360D0
                  WMAX(J) = VMAX(J,1) - 360D0
a535 1
            END IF
d537 11
a547 7
            IF (WMAX(J)-WMIN(J).LT.360D0 .AND.
     *          WMAX(J)-WMIN(J).GT.VMAX(J,2)-VMIN(J,2)+TOL) THEN
*              Must have a cycle, preserve the sign.
               IF (WMAX(J).GE.0D0) THEN
                  IF (VMAX(J,2).GE.0D0) THEN
                     WMIN(J) = VMIN(J,2)
                     WMAX(J) = VMAX(J,2)
d549 7
a555 2
                     WMIN(J) = VMIN(J,2) + 360D0
                     WMAX(J) = VMAX(J,2) + 360D0
a556 8
               ELSE
                  IF (VMAX(J,2).LT.0D0) THEN
                     WMIN(J) = VMIN(J,2)
                     WMAX(J) = VMAX(J,2)
                  ELSE
                     WMIN(J) = VMIN(J,2) - 360D0
                     WMAX(J) = VMAX(J,2) - 360D0
                  END IF
d559 10
a568 2
         END IF
 30   CONTINUE
d786 1
a786 1
      DO 45 J = 1, 2
d799 1
a799 1
 45   CONTINUE
d809 1
a809 1
      DO 50 J = 1, 2
d832 1
a832 1
 50   CONTINUE
d838 2
a839 2
      DO 90 J = 1, 2
         IF (GCODE(J).EQ.0) GO TO 90
d855 1
a855 1
         DO 80 IWJ = 0, NW(J)
d857 1
a857 1
               IF (IWJ.EQ.0) GO TO 80
d883 1
a883 1
            DO 70 IWK = 0, NSTEP
d903 1
a903 1
                  GO TO 70
d906 1
a906 1
               DO 60 ISTEP = 1, 1000
d912 1
a912 1
                     GO TO 80
d976 4
a979 4
                                 CROSS(1,IC) = FSEG
                                 CROSS(2,IC) = XPOINT
                                 CROSS(3,IC) = J
                                 CROSS(4,IC) = WORLD(J)
d1050 4
a1053 4
                                 CROSS(1,IC) = FSEG
                                 CROSS(2,IC) = XPOINT
                                 CROSS(3,IC) = J
                                 CROSS(4,IC) = WORLD(J)
d1085 1
a1085 1
                     GO TO 70
d1091 2
a1092 2
 60            CONTINUE
 70         CONTINUE
d1095 2
a1096 2
 80      CONTINUE
 90   CONTINUE
d1100 2
a1101 2
 100  IF (LABCTL.NE.-1) CALL PGCRLB (AXEN, IDENTS, TYPE, LABCTL, CI, NC,
     *   IC, CROSS)
d1135 1
a1135 1
*      NC       I        Total number of locations in the CROSS table.
d1137 1
a1137 1
*      IC       I        Current number of entries in the CROSS table.
d1139 2
a1140 1
*      CROSS    D(4,NC)  Table of points where the tick marks or grid
d1145 1
a1145 1
      SUBROUTINE PGCRLB (AXEN, IDENTS, TYPE, LABCTL, CI, NC, IC, CROSS)
d1154 1
a1154 1
      DOUBLE PRECISION CROSS(4,NC), TMP
d1161 2
a1162 2
         DO 10 J = 1, NC
            IF (CROSS(3,J).EQ.1D0) THEN
d1169 2
a1170 2
               CROSS(4,J) = MOD(CROSS(4,J), 360D0)
               IF (CROSS(4,J).LT.0D0) CROSS(4,J) = CROSS(4,J) + 360D0
d1172 5
a1176 5
               CROSS(4,J) = MOD(CROSS(4,J), 360D0)
               IF (CROSS(4,J).LE.-180D0) THEN
                  CROSS(4,J) = CROSS(4,J) + 360D0
               ELSE IF (CROSS(4,J).GT.180D0) THEN
                  CROSS(4,J) = CROSS(4,J) - 360D0
d1182 1
a1182 1
               CROSS(4,J) = CROSS(4,J)/15D0
d1193 3
a1195 3
            IF (CROSS(1,J).LT.CROSS(1,J+1)) GO TO 30
            IF (CROSS(1,J).EQ.CROSS(1,J+1) .AND.
     *          CROSS(2,J).LE.CROSS(2,J+1)) GO TO 30
d1199 3
a1201 3
               TMP = CROSS(M,J)
               CROSS(M,J) = CROSS(M,J+1)
               CROSS(M,J+1) = TMP
d1213 1
a1213 1
            IF (CROSS(M,J).NE.CROSS(M,J-1)) GO TO 90
d1220 1
a1220 1
               CROSS(M,K) = CROSS(M,K+1)
d1241 1
a1241 1
         IF (CROSS(3,J).EQ.1D0) THEN
d1247 1
a1247 1
         EDGE = NINT(CROSS(1,J))
d1384 1
a1384 1
            IF (CROSS(3,J).EQ.1D0) THEN
d1392 2
a1393 2
               IF (CROSS(4,J).EQ.0D0) GO TO 120
               OMAG(IWRLD) = OMAG(IWRLD) + LOG10(ABS(CROSS(4,J)))
d1407 1
a1407 1
               IF (CROSS(3,J).EQ.1D0) THEN
d1413 1
a1413 1
               CROSS(4,J) = CROSS(4,J)/10D0**IMAG(IWRLD)
d1425 1
a1425 1
            IF (CROSS(3,J).EQ.1D0) THEN
d1435 2
a1436 2
            LS = INT(ABS(CROSS(4,J)*3600D0) + 0.5D-6)
            LV = NINT(MOD(ABS(CROSS(4,J)*3600D0), 1D0)*1D6)
d1483 1
a1483 1
         IF (CROSS(3,J).EQ.1D0) THEN
d1491 1
a1491 1
         EDGE = NINT(CROSS(1,J))
d1514 1
a1514 1
            X = CROSS(2,J)
d1526 1
a1526 1
            Y = CROSS(2,J) - YCH/2.0
d1536 1
a1536 1
            X = CROSS(2,J)
d1548 1
a1548 1
            Y = CROSS(2,J) - YCH/2.0
d1554 1
a1554 1
            TMP = ABS(CROSS(4,J)) + 0.5D-6
d1558 1
a1558 1
            IF (CROSS(4,J).LT.0D0) THEN
d1578 1
a1578 1
            TMP = ABS(CROSS(4,J))*3600D0 + 0.5D-6
d1587 1
a1587 1
               IF (CROSS(4,J).LT.0D0) THEN
d1653 1
a1653 1
            TMP = MOD(CROSS(4,J),1D0)
d1661 1
a1661 1
            PP = NINT(CROSS(4,J) - TMP)
d1678 3
a1680 3
            IF (CROSS(4,J).NE.0D0) THEN
               PP = INT(LOG10(ABS(CROSS(4,J)))) - 6
               MM = NINT(CROSS(4,J)/10D0**PP)
d1728 1
a1728 1
               IF (CROSS(1,J).EQ.CROSS(1,J-1)) THEN
d1730 1
a1730 1
                     TICKIT = XBOX(1).LT.CROSS(2,J-1)
d1732 1
a1732 1
                     TICKIT = YBOX(1).LT.CROSS(2,J-1)
d1739 1
a1739 1
               IF (CROSS(1,J).EQ.CROSS(1,J+1)) THEN
d1741 1
a1741 1
                     TICKIT = XBOX(2).GT.CROSS(2,J+1)
d1743 1
a1743 1
                     TICKIT = YBOX(2).GT.CROSS(2,J+1)
d1751 1
a1751 1
               Z = REAL(CROSS(2,J))
@


1.10
log
@*** empty log message ***
@
text
@d24 1
a24 1
*                                sexagesimal notation, DD:MM:SS.S,
d30 1
a30 1
*                                hms notation, HH:MM:SS.S, normalized
d144 1
a144 1
*                              will be determined.
d326 1
a326 1
*   modification.  Comments within NLFUNC must specify the parameters
d351 6
d358 1
a358 1
*   $Id: pgcrvl.f,v 1.9 1997/03/14 06:58:29 mcalabre Exp mcalabre $
d386 1
a386 1
*     Number of steps per grid interval.
d388 1
a388 1
      PARAMETER (NSTEP = 20)
d596 1
d599 1
a599 1
                  FACT = 1D0/15D0
a600 2
               ELSE
                  FACT = 1D0
d630 1
d633 1
a633 1
                  FACT = 1D0/15D0
a634 2
               ELSE
                  FACT = 1D0
d641 1
a641 1
                  FACT = 3600D0
d850 2
a851 2
            DO 70 IWK = 0, NINT(DW(K)/GSTEP(K))*NSTEP
               WORLD(K) = WMIN(K) + IWK*(GSTEP(K)/NSTEP)
a1390 3
*           Skip non-sexagesimal coordinates.
            IF (INDEX('DEFGHIT', TYPE(J)).EQ.0) GO TO 150

d1396 3
@


1.9
log
@*** empty log message ***
@
text
@d44 9
a52 9
*                            'A':  302.7042
*                            'B':  -57.2958
*                            'C': -417.2958
*                            'D':  302:42:15
*                            'E':  -57:17:45
*                            'F': -417:17:45
*                            'H':   20:10:49
*                            'I':   -3:49:11
*                            'J':  -27:49:11
d54 2
d57 3
a59 2
*                             -1: No grid labels.
*                              0: Let PGCRVL decide (see note 3).
d70 3
d78 8
d112 2
a113 2
*                           0: No grid.
*                           1: Tick marks.
d116 15
a130 2
*      TIKLEN   D        Tick length for GCODE = 1, in mm.  Negative
*                        values produce outside tick marks.
d132 3
d160 1
a160 1
*      NLC      I        Number of elements in NLCPRM.
d162 1
a162 1
*      NLI      I        Number of elements in NLIPRM.
d164 1
a164 1
*      NLD      I        Number of elements in NLDPRM.
d173 2
a174 1
*      NC       I        Total number of locations in the CROSS table.
d179 1
a179 1
*                        lines cross the frame.
a188 2
*                        Usage is described below.
*
d224 3
a226 3
*       deduced by PGCRVL from the required density of grid lines (see
*       note 3).  The selection is made according to the following
*       table:
d257 1
a257 8
*    3) Where PGCRVL is called upon to determine a suitable grid spacing
*       the LABCTL argument can be used to control the approximate
*       density of lines.  If LABCTL < -1, then it is treated as a
*       decimal encoded value -(D1+100*D2) where D1, and D2 are the
*       approximate densities of the first and second world coordinates.
*       LABCTL = 0 is effectively the same as LABCTL = -808.
*
*    4) PGCRVL maintains a table of axis crossings, CROSS, in which it
d266 3
a268 2
*       successive call until the labels are produced, at which time the
*       table index, IC, is zeroed.
d288 1
a288 1
*      NLC      I        Number of elements in NLCPRM.
d290 1
a290 1
*      NLI      I        Number of elements in NLIPRM.
d292 1
a292 1
*      NLD      I        Number of elements in NLDPRM.
d352 1
a352 1
*   $Id: pgcrvl.f,v 1.8 1997/03/13 06:57:17 mcalabre Exp mcalabre $
d354 3
a356 3
      SUBROUTINE PGCRVL (AXEN, IDENTS, TYPE, LABCTL, CI, GCODE, TIKLEN,
     *   NG1, GRID1, NG2, GRID2, DOEQ, NLFUNC, NLC, NLI, NLD, NLCPRM,
     *   NLIPRM, NLDPRM, NC, IC, CROSS, IERR)
d364 2
a365 2
     *          LDIV, LTABL(6,2:6), N1, N2, NC, NG(2), NG1, NG2, NLC,
     *          NLD, NLI, NLIPRM(NLI), NP, NW(2)
d408 12
d479 1
a479 1
 
d532 1
a532 1
      IF (LABCTL.LT.-1) THEN
d534 2
a535 2
         DENS(1) = MOD(-LABCTL,100)
         DENS(2) = -LABCTL/100
d657 1
a657 1
                  
d710 1
a710 1
                     LDIV = 1
d714 1
a714 1
                        LDIV = 2
d716 1
a716 1
                        LDIV = 3
d718 1
a718 1
                        LDIV = 4
d720 1
a720 1
                        LDIV = 5
d722 1
a722 1
                        LDIV = 6
d724 1
a724 1
                        LDIV = 9
d727 1
a727 1
                     STEP = 1D0/LDIV
d749 14
a762 16
      TMP = AINT(WMIN(1)/GSTEP(1))*GSTEP(1)
      IF (TMP.GE.WMIN(1)) TMP = TMP - GSTEP(1)
      WMIN(1) = TMP
      TMP = AINT(WMAX(1)/GSTEP(1))*GSTEP(1)
      IF (TMP.LE.WMAX(1)) TMP = TMP + GSTEP(1)
      WMAX(1) = TMP

      TMP = AINT(WMIN(2)/GSTEP(2))*GSTEP(2)
      IF (TMP.GE.WMIN(2)) TMP = TMP - GSTEP(2)
      WMIN(2) = TMP
      TMP = AINT(WMAX(2)/GSTEP(2))*GSTEP(2)
      IF (TMP.LE.WMAX(2)) TMP = TMP + GSTEP(2)
      WMAX(2) = TMP

      DW(1) = WMAX(1) - WMIN(1)
      DW(2) = WMAX(2) - WMIN(2)
a765 9
*     Extend the PGPLOT window and rescale it to pixels.
      CALL PGQVP (0, XVP1, XVP2, YVP1, YVP2)
      CALL PGQWIN (WPIX(1), WPIX(2), WPIX(3), WPIX(4))
      CALL PGSVP (0.0, 1.0, 0.0, 1.0)
      XSCL = AXEN(1)/(XVP2-XVP1)
      YSCL = AXEN(2)/(YVP2-YVP1)
      CALL PGSWIN (0.5-XSCL*XVP1, AXEN(1)+0.5+XSCL*(1.0-XVP2),
     *             0.5-YSCL*YVP1, AXEN(2)+0.5+YSCL*(1.0-YVP2))

d771 26
d801 2
a802 2
      DO 80 J = 1, 2
         IF (GCODE(J).EQ.0) GO TO 80
d818 1
a818 1
         DO 70 IWJ = 0, NW(J)
d820 1
a820 1
               IF (IWJ.EQ.0) GO TO 70
d830 1
a830 1
                  L = NINT(TMP*LDIV)
d833 2
a834 2
                     IF (LDIV.LE.6) THEN
                        L = LTABL(L,LDIV)
d846 1
a846 1
            DO 60 IWK = 0, NINT(DW(K)/GSTEP(K))*NSTEP
d854 4
a857 4
                     INSIDE = PIXEL(1).GE.0.5 .AND.
     *                        PIXEL(1).LE.AXEN(1)+0.5 .AND.
     *                        PIXEL(2).GE.0.5 .AND.
     *                        PIXEL(2).LE.AXEN(2)+0.5
d866 1
a866 1
                  GO TO 60
d869 1
a869 1
               DO 50 ISTEP = 1, 1000
d875 1
a875 1
                     GO TO 70
d886 4
a889 4
                  INSIDE = PIXEL(1).GE.0.5 .AND.
     *                     PIXEL(1).LE.AXEN(1)+0.5 .AND.
     *                     PIXEL(2).GE.0.5 .AND.
     *                     PIXEL(2).LE.AXEN(2)+0.5
d907 1
a907 1
                              IF (XR(NP).LT.0.5) THEN
d912 1
a912 1
                              ELSE IF (XR(NP).GT.AXEN(1)+0.5) THEN
d922 1
a922 1
                              IF (YR(NP).LT.0.5) THEN
d927 1
a927 1
                              ELSE IF (YR(NP).GT.AXEN(2)+0.5) THEN
d936 8
a943 6
                           IF (IC.LT.NC) THEN
                              IC = IC + 1
                              CROSS(1,IC) = FSEG
                              CROSS(2,IC) = XPOINT
                              CROSS(3,IC) = J
                              CROSS(4,IC) = WORLD(J)
d946 1
a946 1
                           IF (GCODE(J).EQ.1) THEN
d951 1
a951 1
     *                                 (YSCL*(Y2-Y1))**2)
d981 1
a981 1
                              IF (XR(NP).LT.0.5) THEN
d986 1
a986 1
                              ELSE IF (XR(NP).GT.AXEN(1)+0.5) THEN
d996 1
a996 1
                              IF (YR(NP).LT.0.5) THEN
d1001 1
a1001 1
                              ELSE IF (YR(NP).GT.AXEN(2)+0.5) THEN
d1010 8
a1017 6
                           IF (IC.LT.NC) THEN
                              IC = IC + 1
                              CROSS(1,IC) = FSEG
                              CROSS(2,IC) = XPOINT
                              CROSS(3,IC) = J
                              CROSS(4,IC) = WORLD(J)
d1020 1
a1020 1
                           IF (GCODE(J).EQ.1) THEN
d1027 1
a1027 1
     *                                 (YSCL*(Y2-Y1))**2)
d1033 3
a1035 1
                           CALL PGLINE(NP, XR, YR)
d1048 1
a1048 1
                     GO TO 60
d1054 2
a1055 2
 50            CONTINUE
 60         CONTINUE
d1058 2
a1059 2
 70      CONTINUE
 80   CONTINUE
d1063 1
a1063 1
      IF (LABCTL.NE.-1) CALL PGLBLR (AXEN, IDENTS, TYPE, LABCTL, CI, NC,
d1080 1
a1080 1
*   PGLBLR is a helper routine for PGCRVL, not meant to be called
a1100 1
*                        Reset to zero on return.
d1107 1
a1107 1
      SUBROUTINE PGLBLR (AXEN, IDENTS, TYPE, LABCTL, CI, NC, IC, CROSS)
d1149 1
d1190 1
a1190 1
*  Determine which axes to label.
d1220 1
d1712 1
a1712 1
*              Draw outside tick mark.
d1791 10
a1800 3
            X = BNDRY(2) - 0.5*XCH
            Y = (YW1 + YW2)/2.0
            ANGL = 90.0
d1807 10
a1816 3
            X = BNDRY(4) + 0.5*XCH
            Y = (YW1 + YW2)/2.0
            ANGL = -90.0
a1838 4

*  Clean up.
*     Reset the table index.
      IC = 0
@


1.8
log
@*** empty log message ***
@
text
@d15 1
a15 1
*                        used for axis labelling:
d35 1
d168 39
a206 4
*    1) PGCRVL maintains a table of axis crossings, CROSS, in which it
*       stores information used for axis labelling.  The caller need not
*       normally be concerned about the use of this table other than to
*       provide sufficient space.
d208 1
a208 6
*       However, a coordinate grid may be produced via multiple calls to
*       PGCRVL with deferment of axis labelling.  This might be done to
*       change the pen colour and/or thickness for different sets of
*       grid lines.  The table accumulates information from each
*       successive call until the labels are produced, at which time the
*       table index, IC, is zeroed.
d235 13
a247 1
*-----------------------------------------------------------------------
d329 1
a329 1
*   $Id: pgcrvl.f,v 1.7 1997/03/11 06:53:24 mcalabre Exp mcalabre $
d340 3
a342 3
     *          IERR, IPIX, ISTEP, IWJ, IWK, J, JPIX, K, LABCTL, N1, N2,
     *          NC, NG(2), NG1, NG2, NLC, NLD, NLI, NLIPRM(NLI), NP,
     *          NW(2)
d364 7
d671 24
d775 17
d1054 1
a1054 1
      LOGICAL   ANGLE, TICKIT
d1329 1
a1329 1
         DO 135 J = 1, IC
d1331 1
a1331 1
            IF (INDEX('DEFGHIT', TYPE(1)).EQ.0) GO TO 135
d1345 1
a1345 1
               DO 133 K = 1, 6
d1349 1
a1349 1
                     GO TO 135
d1351 1
a1351 1
 133           CONTINUE
d1359 1
a1359 1
 135     CONTINUE
d1386 1
a1386 1
      DO 160 J = 1, IC
d1408 1
d1413 1
a1413 1
               IF (MOD(SKIP(1),2).NE.1) GO TO 160
d1415 1
a1415 1
               IF (MOD(SKIP(1)/2,2).NE.1) GO TO 160
d1424 1
a1424 1
               IF (MOD(SKIP(2),2).NE.1) GO TO 160
d1426 1
a1426 1
               IF (MOD(SKIP(2)/2,2).NE.1) GO TO 160
d1435 1
a1435 1
               IF (MOD(SKIP(3),2).NE.1) GO TO 160
d1437 1
a1437 1
               IF (MOD(SKIP(3)/2,2).NE.1) GO TO 160
d1446 1
a1446 1
               IF (MOD(SKIP(4),2).NE.1) GO TO 160
d1448 1
a1448 1
               IF (MOD(SKIP(4)/2,2).NE.1) GO TO 160
d1556 25
d1596 1
a1596 1
         IF (XBOX(1).GT.XL .OR. YBOX(1).GT.YL) THEN
d1607 1
a1607 1
            YL = YBOX(2) + YCH
d1672 1
a1672 1
 160  CONTINUE
d1677 1
a1677 1
      DO 240 EDGE = 1, 4
d1680 1
a1680 1
         DO 210 IWRLD = 1, 2
d1683 1
a1683 1
            IF (MOD(SKOP(EDGE)/IWRLD,2).EQ.0) GO TO 210
d1686 1
a1686 1
            DO 170 K = 1, L
d1689 1
a1689 1
                  GO TO 180
d1691 1
a1691 1
 170        CONTINUE
d1693 4
a1696 4
 180        IF (IMAG(IWRLD).NE.0) THEN
               DO 190 K = 40, 1, -1
                  IF (TXT(IWRLD)(K:K).NE.' ') GO TO 200
 190           CONTINUE
d1699 1
a1699 1
 200           CALL PGNUMB (IMAG(IWRLD), 0, 1, EXPONT, NCH)
d1703 1
a1703 1
 210     CONTINUE
d1713 3
a1715 3
               DO 220 K = 40, 1, -1
                  IF (TEXT(K:K).NE.' ') GO TO 230
 220           CONTINUE
d1717 1
a1717 1
 230           K = K + 1
d1726 1
a1726 1
            GO TO 240
d1758 1
a1758 1
 240  CONTINUE
@


1.7
log
@*** empty log message ***
@
text
@d29 1
a29 1
*                           'H': angle in degrees expressed in
d32 1
a32 1
*                           'I': as 'H' but normalized in the range
d34 1
a34 1
*                           'J': as 'H' but unnormalized.
d55 1
a55 1
*                              0: Let PGCRVL decide.
d197 7
d286 1
a286 1
*   $Id: pgcrvl.f,v 1.6 1997/03/10 22:31:50 mcalabre Exp mcalabre $
d296 3
a298 3
      INTEGER   AXEN(2), CI, CI0, CONTRL, FSEG, GCODE(2), IC, IERR,
     *          IPIX, ISTEP, IWJ, IWK, J, JPIX, K, LABCTL, N1, N2, NC,
     *          NG(2), NG1, NG2, NLC, NLD, NLI, NLIPRM(NLI), NP, NSUB,
d300 2
a301 2
      REAL      PGRND, S, WPIX(4), X1, X2, XPOINT, XR(BUFSIZ), XSCL,
     *          XVP1, XVP2, Y1, Y2, YR(BUFSIZ), YSCL, YVP1, YVP2
d310 3
a312 3
*     Parameter which controls the number of grid lines.
      INTEGER QUANT
      PARAMETER (QUANT = 12)
d447 12
d474 1
a474 1
            STEP = DW(J)/QUANT
d501 1
a501 1
            ELSE IF (INDEX('HIJ',TYPE(J)).NE.0 .AND. STEP.GE.15D0 .OR.
d505 1
a505 1
               IF (INDEX('HIJ',TYPE(J)).NE.0) THEN
d535 1
a535 1
            ELSE IF (INDEX('HIJ',TYPE(J)).NE.0 .AND. STEP.LT.15D0 .OR.
d540 1
a540 1
               IF (INDEX('HIJ',TYPE(J)).NE.0) THEN
d558 15
a572 1
                  STEP = PGRND(FLOAT(STEP), NSUB)
d605 16
a620 1
               STEP = PGRND(FLOAT(STEP), NSUB)
d916 1
a916 1
      IF (LABCTL.GE.0) CALL PGLBLR (AXEN, IDENTS, TYPE, LABCTL, CI, NC,
d963 1
a963 1
      LOGICAL   TICKIT
d965 2
a966 1
     *          L, LABCTL, M, MM, NC, NCH, NI(2,0:4), NSWAP, PP, PRVEDG,
d968 2
a969 2
      REAL      ANGL, FJUST, BNDRY(4), OMAG(2), SI(2), X, XBOX(4), XCH,
     *          XL, XW1, XW2, Y, YCH, YBOX(4), YL, YW1, YW2, Z
d971 2
a972 1
      CHARACTER EXPONT*20, IDENTS(3)*(*), TEXT*80, TYPE(2)*1, TXT(2)*40
d975 2
a976 2
      IF (INDEX('ABDEHI',TYPE(1)).NE.0 .OR.
     *    INDEX('ABDEHI',TYPE(2)).NE.0) THEN
d984 1
a984 1
            IF (INDEX('ADH', TYPE(IWRLD)).NE.0) THEN
d987 1
a987 1
            ELSE IF (INDEX('BEI', TYPE(IWRLD)).NE.0) THEN
d995 5
d1043 2
a1044 1
*  Determine separability indices.
d1074 1
d1077 1
d1182 6
d1189 2
a1190 3
*  Determine the order of magnitude for each world coordinate.
      OMAG(1) = 0.0
      OMAG(2) = 0.0
d1193 36
a1228 5
      DO 120 J = 1, IC
         IF (CROSS(3,J).EQ.1D0) THEN
            IWRLD = 1
         ELSE
            IWRLD = 2
d1230 1
d1232 10
a1241 14
         IF (CROSS(4,J).EQ.0D0) GO TO 120
         OMAG(IWRLD) = OMAG(IWRLD) + LOG10(ABS(CROSS(4,J)))
         IMAG(IWRLD) = IMAG(IWRLD) + 1
 120  CONTINUE

      IF (IMAG(1).GT.0) IMAG(1) = INT(OMAG(1)/IMAG(1))
      IF (IMAG(2).GT.0) IMAG(2) = INT(OMAG(2)/IMAG(2))

      IF (IMAG(1).GE.-2 .AND. IMAG(1).LE.4) IMAG(1) = 0
      IF (IMAG(2).GE.-2 .AND. IMAG(2).LE.4) IMAG(2) = 0

*     Renormalize grid values.
      IF (IMAG(1).NE.0 .OR. IMAG(2).NE.0) THEN
         DO 130 J = 1, IC
d1248 21
a1268 2
            CROSS(4,J) = CROSS(4,J)/10.0**IMAG(IWRLD)
 130     CONTINUE
d1278 1
d1284 1
a1284 5
      SKIP(1) = MOD(L,10)
      SKIP(2) = MOD(L/10,10)
      SKIP(3) = MOD(L/100,10)
      SKIP(4) = MOD(L/1000,10)

d1294 1
d1296 1
a1296 8
         EDGE = NINT(CROSS(1,J))

         IF (EDGE.NE.PRVEDG) THEN
            XL = -999.0
            YL = -999.0
         END IF
         PRVEDG = EDGE

d1305 13
d1364 100
a1463 4
*        Allow up to six significant digits.
         IF (CROSS(4,J).NE.0D0) THEN
            PP = INT(LOG10(ABS(CROSS(4,J)))) - 6
            MM = NINT(CROSS(4,J)/10.0**PP)
d1465 10
a1474 2
            PP = 0
            MM = 0
a1475 1
         CALL PGNUMB (MM, PP, 0, TEXT, NCH)
d1492 4
d1541 1
a1541 1
                  CALL PGMOVE (Z, YW1-0.5*YCH)
d1544 1
a1544 1
                  CALL PGMOVE (XW1-0.5*XCH, Z)
d1547 1
a1547 1
                  CALL PGMOVE (Z, YW2+0.5*YCH)
d1550 1
a1550 1
                  CALL PGMOVE (XW2+0.5*XCH, Z)
d1577 1
a1577 1
               DO 190 K = 80, 1, -1
@


1.6
log
@*** empty log message ***
@
text
@d10 1
a10 1
*                              element (as returned by NLFUNC).
a16 1
*                           'L': logarithmic
d53 42
a126 18
*      LABCTL   I        Decimal encoded grid labelling control:
*                             -1: No grid labels.
*                              0: Let PGCRVL decide.
*                              1: Label bottom of frame with the first
*                                 world coordinate.
*                              2: Label bottom of frame with the second
*                                 world coordinate.
*                             10: ... left side of frame.
*                             20: ... left side of frame.
*                            100: ... top of frame.
*                            200: ... top of frame.
*                           1000: ... right side of frame.
*                           2000: ... right side of frame.
*
*                        LABCTL = 0 usually gets what you want.
*                        LABCTL = 3333 labels all sides with both world
*                        coordinates.
*
d279 1
a279 1
*   $Id: pgcrvl.f,v 1.5 1997/02/19 06:58:56 mcalabre Exp mcalabre $
d281 2
a282 2
      SUBROUTINE PGCRVL (AXEN, IDENTS, TYPE, GCODE, TIKLEN, NG1, GRID1,
     *   NG2, GRID2, DOEQ, LABCTL, NLFUNC, NLC, NLI, NLD, NLCPRM,
d289 4
a292 3
      INTEGER   AXEN(2), CONTRL, FSEG, GCODE(2), IC, IERR, IPIX, ISTEP,
     *          IWJ, IWK, J, JPIX, K, LABCTL, N1, N2, NC, NG(2), NG1,
     *          NG2, NLC, NLD, NLI, NLIPRM(NLI), NP, NSUB, NW(2)
d625 3
d633 1
d636 1
a865 4
*     Contract the PGPLOT window still leaving it scaled it to pixels.
      CALL PGSVP (XVP1, XVP2, YVP1, YVP2)
      CALL PGSWIN (0.5, AXEN(1)+0.5, 0.5, AXEN(2)+0.5)

d868 2
a869 1
      IF (LABCTL.GE.0) CALL PGLBLR (IDENTS, TYPE, LABCTL, NC, IC, CROSS)
d873 2
a874 1
*     Restore the original window.
d876 1
a882 2


d886 2
a887 2
*   directly although it could be if needed; it labels a curvilinear
*   coordinate grid.
d890 2
d900 2
d913 1
a913 1
      SUBROUTINE PGLBLR (IDENTS, TYPE, LABCTL, NC, IC, CROSS)
d916 5
a920 6
      INTEGER   EDGE, IC, IMAG(2), ITER, IWRLD, J, JC, K, L, LABCTL, M,
     *          MM, NC, NCH, NI(2,0:4), NSWAP, PP, PRVEDG, SKIP(4),
     *          SKOP(4)
      REAL      FJUST, BNDRY(4), OMAG(2), SI(2), X, XBOX(4), XCH, XL,
     *          XSCL, XVP1, XVP2, XW1, XW2, Y, YCH, YBOX(4), YL,
     *          YSCL, YVP1, YVP2, YW1, YW2, Z
d922 1
a922 1
      CHARACTER EXPONT*20, IDENTS(3)*(*), TEXT*80, TYPE(2)*1
a1016 5
      if (ic.lt.nc) then
         cross(1,ic+1) = si(1)
         cross(2,ic+1) = si(2)
      end if

d1061 29
a1089 3
*           Skew grid lines or worse, label all sides.
            K = NI(1,1) + NI(2,2) + NI(1,3) + NI(2,4)
            L = 1212
d1091 5
a1095 5
            M = NI(1,1) + NI(2,2) + NI(2,3) + NI(1,4)
            IF (M.GT.K) THEN
               L = 1221
               K = M
            END IF
d1097 5
a1101 5
            M = NI(1,1) + NI(1,2) + NI(2,3) + NI(2,4)
            IF (M.GT.K) THEN
               L = 1122
               K = M
            END IF
d1103 5
a1107 5
            M = NI(2,1) + NI(1,2) + NI(2,3) + NI(1,4)
            IF (M.GT.K) THEN
               L = 2121
               K = M
            END IF
d1109 5
a1113 5
            M = NI(2,1) + NI(1,2) + NI(1,3) + NI(2,4)
            IF (M.GT.K) THEN
               L = 2112
               K = M
            END IF
d1115 5
a1119 4
            M = NI(2,1) + NI(2,2) + NI(1,3) + NI(1,4)
            IF (M.GT.K) THEN
               L = 2211
               K = M
d1162 5
a1166 8
*  Reset the viewport so that we can draw tick marks outside the frame.
      CALL PGQVP (0, XVP1, XVP2, YVP1, YVP2)
      CALL PGQWIN (XW1, XW2, YW1, YW2)
      CALL PGSVP (0.0, 1.0, 0.0, 1.0)
      XSCL = (XW2-XW1)/(XVP2-XVP1)
      YSCL = (YW2-YW1)/(YVP2-YVP1)
      CALL PGSWIN (XW1-XSCL*XVP1, XW2+XSCL*(1.0-XVP2),
     *             YW1-YSCL*YVP1, YW2+YSCL*(1.0-YVP2))
a1167 2

*  Produce labels.
d1198 1
d1200 1
d1263 8
d1339 1
a1339 1
      DO 230 EDGE = 1, 4
d1342 4
a1345 8
         M = 0
         DO 220 IWRLD = 1, 2
            IF (MOD(SKOP(EDGE)/IWRLD,2).EQ.0) GO TO 220

            IF (M.GT.0) THEN
               TEXT(M+1:) = ',  '
               M = M + 3
            END IF
d1350 1
a1350 1
                  TEXT(M+1:) = IDENTS(IWRLD)(K:L)
d1355 4
a1358 3
 180        DO 190 K = 80, 1, -1
               IF (TEXT(K:K).NE.' ') GO TO 200
 190        CONTINUE
a1359 1
 200        IF (IMAG(IWRLD).NE.0) THEN
d1361 2
a1362 2
               CALL PGNUMB (IMAG(IWRLD), 0, 1, EXPONT, NCH)
               TEXT(K+1:) = '  x10\\u' // EXPONT
d1365 44
a1408 4
            DO 210 M = 80, 1, -1
               IF (TEXT(M:M).NE.' ') GO TO 220
 210        CONTINUE
 220     CONTINUE
d1410 8
a1417 22
         IF (TEXT.NE.' ') THEN
            IF (EDGE.EQ.1) THEN
               X = (XW1 + XW2)/2.0
               Y = BNDRY(1) - 1.5*YCH
               CALL PGPTXT (X, Y, 0.0, 0.5, TEXT)
            END IF
            IF (EDGE.EQ.2) THEN
               X = BNDRY(2) - 0.5*XCH
               Y = (YW1 + YW2)/2.0
               CALL PGPTXT (X, Y, 90.0, 0.5, TEXT)
            END IF
            IF (EDGE.EQ.3) THEN
               X = (XW1 + XW2)/2.0
               Y = BNDRY(3) + 0.5*YCH
               CALL PGPTXT (X, Y, 0.0, 0.5, TEXT)
               BNDRY(3) = BNDRY(3) + 1.5*YCH
            END IF
            IF (EDGE.EQ.4) THEN
               X = BNDRY(4) + 0.5*XCH
               Y = (YW1 + YW2)/2.0
               CALL PGPTXT (X, Y, -90.0, 0.5, TEXT)
            END IF
d1419 2
a1420 1
 230  CONTINUE
d1424 1
a1431 4
*     Restore the original viewport.
      CALL PGSVP (XVP1, XVP2, YVP1, YVP2)
      CALL PGSWIN (XW1, XW2, YW1, YW2)

@


1.5
log
@*** empty log message ***
@
text
@d8 8
a15 1
*      TYPE     C*1(2)   Axis types, used for axis labelling:
d19 11
a29 1
*                                decimal notation
d31 5
a35 5
*                                signed hms notation, HH:MM:SS.S
*                           'R': angle in degrees expressed in
*                                positive hms notation, HH:MM:SS.S
*                           'S': angle in degrees expressed in
*                                sexagesimal notation, DD:MM:SS.S
d41 2
a42 1
*                        For example, an angle of -57.2958 degrees:
d44 9
a52 4
*                            'A': -57.2958
*                            'H':  -3:49:11
*                            'R':  20:10:49
*                            'S': -57:17:45
d54 2
a55 1
*      GCODE(2) I        Code for the type of grid to draw:
d60 2
a61 1
*      TIKLEN   D        Tick length for GCODE = 1, in mm.
d88 1
a92 2
*                              3: Label bottom of frame with both
*                                 world coordinates.
a94 1
*                             30: ... left side of frame.
a96 1
*                            300: ... top of frame.
a98 1
*                           3000: ... right side of frame.
d100 3
a102 1
*                        LABCTL = 21 usually gets what you want.
d113 1
a113 1
*      NLCPRM   C*1(NLC) Character coefficients for NLFUNC.
d125 1
a125 3
*                           1: Value.
*                           2: Axis (1 or 2).
*                           3: Frame segment
d130 5
a134 1
*                           4: X or Y-pixel coordinate.
d141 32
d174 2
d249 5
a253 2
*   Notes
*   -----
d256 1
a256 1
*   $Id: pgcrvl.f,v 1.4 1997/02/18 03:39:34 mcalabre Exp mcalabre $
d258 3
a260 3
      SUBROUTINE PGCRVL (AXEN, TYPE, GCODE, TIKLEN, NG1, GRID1, NG2,
     *   GRID2, DOEQ, LABCTL, NLFUNC, NLC, NLI, NLD, NLCPRM, NLIPRM,
     *   NLDPRM, NC, IC, CROSS, IERR)
d265 1
a265 1
      LOGICAL   DOEQ, GETEND, INSIDE, PRVIN
d269 2
a270 2
      REAL      PGRND, S, WPIX(4), X1, X2, XPOINT, XR(BUFSIZ), XSCL, Y1,
     *          Y2, YR(BUFSIZ), YSCL
d273 3
a275 3
     *          NLDPRM(NLD), PIXEL(2), STEP, TIKLEN, TMP, WMAX(2),
     *          WMIN(2), WORLD(2)
      CHARACTER NLCPRM(NLC)*1, TYPE(2)*1
d286 4
d312 12
d327 2
a328 2
      D1 = DBLE(AXEN(1)+1)/N1
      D2 = DBLE(AXEN(2)+1)/N2
d344 26
d376 39
d418 1
a418 1
      DO 30 J = 1, 2
d432 1
a432 1
            IF (INDEX('AS',TYPE(J)).NE.0 .AND. STEP.GE.1D0) THEN
d458 1
a458 1
            ELSE IF (INDEX('HR',TYPE(J)).NE.0 .AND. STEP.GE.15D0 .OR.
d462 1
a462 1
               IF (INDEX('HR',TYPE(J)).NE.0) THEN
d492 2
a493 2
            ELSE IF (INDEX('HR',TYPE(J)).NE.0 .AND. STEP.LT.15D0 .OR.
     *               INDEX('ST',TYPE(J)).NE.0 .AND. STEP.LT.1D0) THEN
d497 1
a497 1
               IF (INDEX('HR',TYPE(J)).NE.0) THEN
d553 1
a553 1
 30   CONTINUE
d569 1
a569 1
      IF (TMP.GT.WMIN(1)) TMP = TMP - GSTEP(1)
d572 1
a572 1
      IF (TMP.LT.WMAX(1)) TMP = TMP + GSTEP(1)
d576 1
a576 1
      IF (TMP.GT.WMIN(2)) TMP = TMP - GSTEP(2)
d579 1
a579 1
      IF (TMP.LT.WMAX(2)) TMP = TMP + GSTEP(2)
d585 11
a600 6

*  Draw the grid.
*     Rescale PGPLOT window to pixels.
      CALL PGQWIN (WPIX(1), WPIX(2), WPIX(3), WPIX(4))
      CALL PGSWIN (0.5, AXEN(1)+0.5, 0.5, AXEN(2)+0.5)

d602 2
a603 2
      DO 70 J = 1, 2
         IF (GCODE(J).EQ.0) GO TO 70
d617 1
a617 1
         DO 60 IWJ = 0, NW(J)
d619 1
a619 1
               IF (IWJ.EQ.0) GO TO 60
d628 1
a628 1
            DO 50 IWK = 0, NINT(DW(K)/GSTEP(K))*NSTEP
d641 3
a643 5
                     IF (INSIDE) THEN
                        NP = 1
                        XR(1) = PIXEL(1)
                        YR(1) = PIXEL(2)
                     END IF
d648 1
a648 1
                  GO TO 50
d651 1
a651 1
               DO 40 ISTEP = 1, 1000
d657 1
a657 1
                     GO TO 60
d668 1
a668 1
                  INSIDE = PIXEL(1).GE.0.5 .AND. 
d670 1
a670 1
     *                     PIXEL(2).GE.0.5 .AND. 
d824 1
a824 1
                     GO TO 50
d830 2
a831 2
 40            CONTINUE
 50         CONTINUE
d834 6
a839 2
 60      CONTINUE
 70   CONTINUE
d843 1
a843 2
      IF (LABCTL.GE.0) CALL PGLBLR (AXEN, TYPE, LABCTL, GSTEP, NC, IC,
     *   CROSS)
d847 1
a847 1
*     Restore PGPLOT window scale.
d860 2
a861 1
*   directly; it labels a curvilinear coordinate grid.
d864 1
a864 21
*      AXEN     I(2)     Number of pixels on each axis of the image.
*
*      TYPE     C*1(2)   Axis types, used for axis labelling.
*
*      LABCTL   I        Decimal encoded grid labelling control:
*                             -1: No grid labels.
*                              1: Label bottom of frame with the first
*                                 world coordinate.
*                              2: Label bottom of frame with the second
*                                 world coordinate.
*                              3: Label bottom of frame with both
*                                 world coordinates.
*                             10: ... left side of frame.
*                             20: ... left side of frame.
*                             30: ... left side of frame.
*                            100: ... top of frame.
*                            200: ... top of frame.
*                            300: ... top of frame.
*                           1000: ... right side of frame.
*                           2000: ... right side of frame.
*                           3000: ... right side of frame.
d866 2
a867 1
*                        LABCTL = 21 usually gets what you want.
d869 2
a870 1
*      GSTEP    D(2)     Grid step size.
d876 1
d879 1
a879 9
*                        lines cross the frame.
*                           1: Value.
*                           2: Axis (1 or 2).
*                           3: Frame segment
*                              1: bottom
*                              2: left
*                              3: top
*                              4: right
*                           4: X or Y-pixel coordinate.
a880 3
*   Notes
*   -----
*
d883 1
a883 1
      SUBROUTINE PGLBLR (AXEN, TYPE, LABCTL, GSTEP, NC, IC, CROSS)
d885 9
a893 5
      INTEGER   AXEN(2), IC, ITER, IWRLD, J, JC, K, LABCTL, M, NC,
     *          NI(2), NSWAP, SKIP(4)
      REAL      CH, FJUST, X, Y
      DOUBLE PRECISION CROSS(4,NC), GSTEP(2), SI(2), TMP
      CHARACTER TEXT*80, TYPE(2)*1
d895 24
d921 1
a921 1
      DO 30 ITER = 1, IC
d923 2
a924 2
         DO 20 J = 1, IC-1
            IF (CROSS(1,J).LT.CROSS(1,J+1)) GO TO 20
d926 1
a926 1
     *          CROSS(2,J).LE.CROSS(2,J+1)) GO TO 20
d929 1
a929 1
            DO 10 M = 1, 4
d933 4
a936 4
 10         CONTINUE
 20      CONTINUE
         IF (NSWAP.EQ.0) GO TO 40
 30   CONTINUE
d939 3
a941 7
 40   JC = IC
      DO 80 J = 2, IC
         IF (J.GT.JC) GO TO 90

         DO 50 M = 1, 4
            IF (CROSS(M,J).NE.CROSS(M,J-1)) GO TO 80
 50      CONTINUE
d943 4
d949 2
a950 2
         DO 70 K = J, JC
            DO 60 M = 1, 4
d952 112
a1063 3
 60         CONTINUE
 70      CONTINUE
 80   CONTINUE
d1065 7
a1071 1
 90   IC = JC
d1074 6
a1079 6
*  Determine separability indices (informational only).
      NI(1) = 0
      NI(2) = 0
      SI(1) = 0D0
      SI(2) = 0D0
      DO 100 J = 1, IC
d1081 1
a1081 3
            NI(1) = NI(1) + 1
            IF (CROSS(1,J).EQ.1D0 .OR. CROSS(1,J).EQ.3D0)
     *         SI(1) = SI(1) + 1D0
d1083 25
a1107 9
            NI(2) = NI(2) + 1
            IF (CROSS(1,J).EQ.1D0 .OR. CROSS(1,J).EQ.3D0)
     *         SI(2) = SI(2) + 1D0
         END IF
 100  CONTINUE

      IF (IC.LT.NC) THEN
         IF (NI(1).GT.0) CROSS(1,IC+1) = 2D0*(SI(1)/NI(1) - 0.5D0)
         IF (NI(2).GT.0) CROSS(2,IC+1) = 2D0*(SI(2)/NI(2) - 0.5D0)
d1111 10
d1122 14
a1135 4
      SKIP(1) = MOD(LABCTL,10)
      SKIP(2) = MOD(LABCTL/10,10)
      SKIP(3) = MOD(LABCTL/100,10)
      SKIP(4) = MOD(LABCTL/1000,10)
d1138 2
a1139 2
      CALL PGQCH (CH)
      CH = CH*(AXEN(2) + 1.0)/40.0
d1141 9
a1149 1
      DO 130 J = 1, IC
d1156 1
a1156 1
         IF (CROSS(1,J).EQ.1D0) THEN
d1159 1
a1159 1
               IF (MOD(SKIP(1),2).NE.1) GO TO 130
d1161 1
a1161 1
               IF (MOD(SKIP(1)/2,2).NE.1) GO TO 130
d1166 2
a1167 2
            Y = 0.5 - 1.5*CH
         ELSE IF (CROSS(1,J).EQ.2D0) THEN
d1170 1
a1170 1
               IF (MOD(SKIP(2),2).NE.1) GO TO 130
d1172 1
a1172 1
               IF (MOD(SKIP(2)/2,2).NE.1) GO TO 130
d1176 3
a1178 3
            X = 0.5 - 0.5*CH
            Y = CROSS(2,J) - CH/2.0
         ELSE IF (CROSS(1,J).EQ.3D0) THEN
d1181 1
a1181 1
               IF (MOD(SKIP(3),2).NE.1) GO TO 130
d1183 1
a1183 1
               IF (MOD(SKIP(3)/2,2).NE.1) GO TO 130
d1188 2
a1189 2
            Y = AXEN(2) + 0.5 + 0.5*CH
         ELSE IF (CROSS(1,J).EQ.4D0) THEN
d1192 1
a1192 1
               IF (MOD(SKIP(4),2).NE.1) GO TO 130
d1194 1
a1194 1
               IF (MOD(SKIP(4)/2,2).NE.1) GO TO 130
d1198 79
a1276 2
            X = AXEN(2) + 0.5 + 0.5*CH
            Y = CROSS(2,J) - CH/2.0
d1278 2
d1281 3
a1283 1
*        To be expanded (using PGNUMB)...
d1285 27
a1311 1
         WRITE (TEXT, '(F15.0)') CROSS(4,J)
d1313 21
a1333 5
*        Squeeze out leading blanks.
         DO 110 K = 1, 80
            IF (TEXT(K:K).NE.' ') THEN
               TEXT = TEXT(K:14)
               GO TO 120
d1335 20
a1354 1
 110     CONTINUE
d1356 2
a1357 2
 120     CALL PGPTXT (X, Y, 0.0, FJUST, TEXT)
 130  CONTINUE
@


1.4
log
@*** empty log message ***
@
text
@d61 20
d194 1
a194 1
*   $Id: pgcrvl.f,v 1.3 1997/02/07 05:48:22 mcalabre Exp mcalabre $
d197 2
a198 2
     *   GRID2, DOEQ, NLFUNC, NLC, NLI, NLD, NLCPRM, NLIPRM, NLDPRM,
     *   NC, IC, CROSS, IERR)
d205 2
a206 2
     *          IWJ, IWK, J, JPIX, K, NC, NG(2), NG1, NG2, NLC, NLD,
     *          NLI, NLIPRM(NLI), NP, NSUB, NW(2)
d209 4
a212 3
      DOUBLE PRECISION CONTXT(20), CROSS(4,NC), DW(2), FACT, G0(2),
     *          GSTEP(2), GRID1(0:NG1), GRID2(0:NG2), NLDPRM(NLD),
     *          PIXEL(2), STEP, TIKLEN, TMP, WMAX(2), WMIN(2), WORLD(2)
d247 10
a256 4
      DO 20 IPIX = 1, AXEN(1), 10
         PIXEL(1) = DBLE(IPIX)
         DO 10 JPIX = 1, AXEN(2), 10
            PIXEL(2) = DBLE(JPIX)
d265 2
d268 2
d427 1
a427 1
      WMIN(1) = TMP - GSTEP(1)
d430 1
a430 1
      WMAX(1) = TMP + GSTEP(1)
d434 1
a434 1
      WMIN(2) = TMP - GSTEP(2)
d437 1
a437 1
      WMAX(2) = TMP + GSTEP(2)
d487 15
a501 1
                  IF (IERR.EQ.0) GETEND = .FALSE.
d574 4
a577 4
                              CROSS(1,IC) = WORLD(J)
                              CROSS(2,IC) = J
                              CROSS(3,IC) = FSEG
                              CROSS(4,IC) = XPOINT
d646 4
a649 4
                              CROSS(1,IC) = WORLD(J)
                              CROSS(2,IC) = J
                              CROSS(3,IC) = FSEG
                              CROSS(4,IC) = XPOINT
d693 2
a694 1
      CALL PGLBLR (AXEN, TYPE, NC, IC, CROSS)
d718 22
d749 6
a754 2
*                           3: X-pixel coordinate.
*                           4: Y-pixel coordinate.
d761 1
a761 1
      SUBROUTINE PGLBLR (AXEN, TYPE, NC, IC, CROSS)
d763 5
a767 3
      INTEGER   AXEN(2), IC, ITER, J, JC, K, NC, NSWAP
      DOUBLE PRECISION CROSS(4,NC), TMP
      CHARACTER TYPE(2)*1
a770 1
      JC = 0
d774 3
a776 3
            IF (CROSS(3,J).LT.CROSS(3,J+1)) GO TO 20
            IF (CROSS(3,J).EQ.CROSS(3,J+1) .AND.
     *          CROSS(4,J).LE.CROSS(4,J+1)) GO TO 20
d779 4
a782 4
            DO 10 K = 1, 4
               TMP = CROSS(K,J)
               CROSS(K,J) = CROSS(K,J+1)
               CROSS(K,J+1) = TMP
d788 121
a908 1
 40   CONTINUE
@


1.3
log
@*** empty log message ***
@
text
@d32 3
a34 3
*                           0: No grid
*                           1: Tick marks
*                           2: Full coordinate grid
d76 15
d133 1
a133 1
*                           0: Normal state
d144 4
a147 2
*                              0: Success.
*                           else: Failure.
d174 1
a174 1
*   $Id: pgcrvl.f,v 1.2 1997/02/07 03:57:14 mcalabre Exp mcalabre $
d178 1
a178 1
     *   IERR)
d183 9
a191 9
      LOGICAL   DOEQ, INSIDE, PRVIN
      INTEGER   AXEN(2), CONTRL, GCODE(2), IERR, IPIX, ISTEP, IWJ, IWK,
     *          J, JPIX, K, NG(2), NG1, NG2, NLC, NLD, NLI, NLIPRM(NLI),
     *          NP, NSUB, NW(2)
      REAL      PGRND, S, WPIX(4), X1, X2, XR(BUFSIZ), XSCL, Y1, Y2,
     *          YR(BUFSIZ), YSCL
      DOUBLE PRECISION CONTXT(20), DW(2), FACT, G0(2), GSTEP(2),
     *          GRID1(0:NG1), GRID2(0:NG2), NLDPRM(NLD), PIXEL(2),
     *          STEP, TIKLEN, TMP, WMAX(2), WMIN(2), WORLD(2)
d215 1
a446 6
*           Get end-point context.
            WORLD(K) = WMIN(K)
            CALL NLFUNC (1, NLC, NLI, NLD, NLCPRM, NLIPRM, NLDPRM,
     *         WORLD, PIXEL, CONTRL, CONTXT, IERR)
            IF (IERR.NE.0) GO TO 60

d448 1
d452 8
d499 1
d501 2
a502 1
                                 YR(NP) = Y1 + (0.5 - X1)*S
d504 4
a507 2
                                 XR(NP) = AXEN(1)+0.5
                                 YR(NP) = Y1 + (AXEN(1)+0.5 - X1)*S
d514 1
a514 1
                                 XR(NP) = X1 + (0.5 - Y1)*S
d516 2
d519 4
a522 2
                                 XR(NP) = X1 + (AXEN(2)+0.5 - Y1)*S
                                 YR(NP) = AXEN(2)+0.5
d526 9
d571 1
d573 2
a574 1
                                 YR(NP) = Y1 + (0.5 - X1)*S
d576 1
d578 2
a579 1
                                 YR(NP) = Y1 + (AXEN(1)+0.5 - X1)*S
d586 1
a586 1
                                 XR(NP) = X1 + (0.5 - Y1)*S
d588 2
d591 1
a591 1
                                 XR(NP) = X1 + (AXEN(2)+0.5 - Y1)*S
d593 2
d598 9
d647 4
d654 62
@


1.2
log
@*** empty log message ***
@
text
@d3 1
a3 1
*   PGCRVL draws and labels a non-linear coordinate grid.
d31 2
a32 2
*      GCODE    I        Code for the type of grid to draw:
*                           0: Full coordinate grid
d34 1
d36 2
d81 72
a154 1
*    1) NLFUNC operation...
d157 1
a157 1
*   $Id: pgcrvl.f,v 1.1 1996/12/18 06:41:22 mcalabre Exp mcalabre $
d159 3
a161 2
      SUBROUTINE PGCRVL (AXEN, TYPE, GCODE, NG1, GRID1, NG2, GRID2,
     *   DOEQ, NLFUNC, NLC, NLI, NLD, NLCPRM, NLIPRM, NLDPRM, IERR)
d167 2
a168 2
      INTEGER   AXEN(2), CONTRL, GCODE, IERR, IPIX, ISTEP, IWJ, IWK, J,
     *          JPIX, K, NG(2), NG1, NG2, NLC, NLD, NLI, NLIPRM(NLI),
d174 1
a174 1
     *          STEP, TMP, WMAX(2), WMIN(2), WORLD(2)
d240 1
a240 1
            IF (INDEX(TYPE(J),'AS').NE.0 .AND. STEP.GE.1D0) THEN
d266 1
a266 1
            ELSE IF (INDEX(TYPE(J),'HR').NE.0 .AND. STEP.GE.15D0 .OR.
d270 1
a270 1
               IF (INDEX(TYPE(J),'HR').NE.0) THEN
d300 2
a301 2
            ELSE IF (INDEX(TYPE(J),'HR').NE.0 .AND. STEP.LT.15D0 .OR.
     *               INDEX(TYPE(J),'ST').NE.0 .AND. STEP.LT.1D0) THEN
d305 1
a305 1
               IF (INDEX(TYPE(J),'HR').NE.0) THEN
d394 3
a396 5
      IF (GCODE.NE.0) THEN
         CALL PGQVP (2, X1, X2, Y1, Y2)
         XSCL = (X2-X1)/AXEN(1)
         YSCL = (Y2-Y1)/AXEN(2)
      END IF
d406 2
d497 1
a497 1
                           IF (GCODE.NE.0) THEN
d504 2
a505 2
                              XR(NP) = X1 + (X2-X1)*GCODE/S
                              YR(NP) = Y1 + (Y2-Y1)*GCODE/S
d512 1
a512 1
                        IF (GCODE.EQ.0) THEN
d552 1
a552 1
                           IF (GCODE.NE.0) THEN
d560 2
a561 2
                              XR(NP-1) = X1 + (X2-X1)*GCODE/S
                              YR(NP-1) = Y1 + (Y2-Y1)*GCODE/S
@


1.1
log
@Initial revision
@
text
@a0 2
Make function interface independent of WCSLIB.  E.g. vel vs ra.

d3 1
a3 1
*   PGWCSL draws and labels a celestial coordinate grid.
d8 31
a38 2
*      CTYPE    C(2)*8   Coordinate axis types corresponding to the FITS
*                        CTYPEn header cards.
d40 5
a44 2
*      CRPIX    D(2)     Coordinate reference pixels corresponding to
*                        the FITS CRPIXn header cards.
d46 2
a47 2
*      PC       D(2,2)   Linear transformation matrix corresponding to
*                        the FITS PCiiijjj header cards.
d49 1
a49 2
*      CDELT    D(2)     Coordinate increments corresponding to the
*                        FITS CDELTn header cards.
d51 2
a52 2
*      CRVAL    D(2)     Coordinate reference values corresponding to
*                        the FITS CRVALn header cards.
d54 3
a56 3
*      LNGPOL   D        Native longitude and latitude of the pole of
*      LATPOL   D        the celestial coordinate system, corresponding
*                        to the FITS LONGPOLE and LATPOLE header cards.
d58 1
a58 2
*      PROJP    D(0:9)   Projection parameters corresponding to the FITS
*                        PROJPn header cards.
d60 1
a60 2
*      GRIDSP   D        Grid spacing, degrees.  If zero, find a
*                        suitable value.
d62 11
d75 2
a76 6
*                           0: Success.
*                           1: Invalid coordinate transformation
*                              parameters.
*                           2: Invalid projection parameters.
*                           3: Invalid world coordinate.
*                           4: Invalid linear transformation parameters.
d80 1
a80 1
*    1)
d83 1
a83 1
*   $Id$
d85 2
a86 2
      SUBROUTINE PGWCSL (AXEN, CTYPE, CRPIX, PC, CDELT, CRVAL, LNGPOL,
     *   LATPOL, PROJP, GRIDSP, IERR)
d91 12
a102 9
      INTEGER   AXEN(2), IERR, ILAT, ILNG, IPIX, JPIX, NLAT, NLNG, NP,
     *          WCS(0:3)
      REAL      WPIX(4), XR(BUFSIZ), YR(BUFSIZ)
      DOUBLE PRECISION CDELT(2), CEL(10), CRPIX(2), CRVAL(2), DLAT,
     *          DLNG, GRID, GRIDSP, IMGCRD(2), LAT(2), LATPOL, LIN(19),
     *          LNG(2), LNGPOL, NCRVAL(2), NTV(10), PC(2,2), PHI,
     *          PIXCRD(2), PRJ(0:20), PROJP(0:9), PRVPHI, THETA, TMP,
     *          WORLD(2)
      CHARACTER CTYPE(2)*8
d109 2
a110 2
      INTEGER GSTEP
      PARAMETER (GSTEP = 20)
d113 7
a119 33
*     Spherical coordinate transformation coefficients.
      CEL(1)  = CRVAL(1)
      CEL(2)  = CRVAL(2)
      CEL(3)  = LNGPOL
      CEL(4)  = LATPOL
      CEL(5)  = 0

*     Spherical projection coefficients.
      PRJ(0)  = PROJP(0)
      PRJ(1)  = PROJP(1)
      PRJ(2)  = PROJP(2)
      PRJ(3)  = PROJP(3)
      PRJ(4)  = PROJP(4)
      PRJ(5)  = PROJP(5)
      PRJ(6)  = PROJP(6)
      PRJ(7)  = PROJP(7)
      PRJ(8)  = PROJP(8)
      PRJ(9)  = PROJP(9)
      PRJ(10) = 0D0
      PRJ(11) = 0D0

*     Linear transformation coefficients.
      LIN(1)  = 0
      LIN(2)  = 2
      LIN(3)  = 2
      LIN(4)  = CRPIX(1)
      LIN(5)  = CRPIX(2)
      LIN(6)  = PC(1,1)
      LIN(7)  = PC(2,1)
      LIN(8)  = PC(1,2)
      LIN(9)  = PC(2,2)
      LIN(10) = CDELT(1)
      LIN(11) = CDELT(2)
d121 2
a122 4
*     Deal with WCS initialization errors here.
      CALL WCSSET (2, CTYPE, WCS, IERR)
*     Quick return for now.
      IF (IERR.NE.0) RETURN
d125 1
a125 1
*  Find longitude and latitude ranges.
d127 4
a130 4
      LNG(1) =  999D0
      LNG(2) = -999D0
      LAT(1) =  999D0
      LAT(2) = -999D0
d134 1
a134 1
         PIXCRD(1) = DBLE(IPIX)
d136 3
a138 3
            PIXCRD(2) = DBLE(JPIX)
            CALL WCSREV (CTYPE, WCS, PIXCRD, LIN, IMGCRD, PRJ, PHI,
     *         THETA, CRVAL, CEL, WORLD, IERR)
d141 4
a144 4
            IF (WORLD(WCS(1)).LT.LNG(1)) LNG(1) = WORLD(WCS(1))
            IF (WORLD(WCS(1)).GT.LNG(2)) LNG(2) = WORLD(WCS(1))
            IF (WORLD(WCS(2)).LT.LAT(1)) LAT(1) = WORLD(WCS(2))
            IF (WORLD(WCS(2)).GT.LAT(2)) LAT(2) = WORLD(WCS(2))
d148 76
a223 2
      IF (LAT(1).LT.-90D0) LAT(1) = -90D0
      IF (LAT(2).GT.+90D0) LAT(2) = +90D0
d225 54
a278 15
      GRID = GRIDSP
      IF (GRID.EQ.0D0) THEN
*        Choose an appropriate grid spacing.
         DLNG = LNG(2) - LNG(1)
         DLAT = LAT(2) - LAT(1)
         GRID = MIN(DLNG, DLAT)/QUANT
         IF (GRID.GE.1D0) THEN
            IF (GRID.LE.1.5D0) THEN
               GRID = 1D0
            ELSE IF (GRID.LT.3D0) THEN
               GRID = 2D0
            ELSE IF (GRID.LT.7D0) THEN
               GRID = 5D0
            ELSE IF (GRID.LT.12D0) THEN
               GRID = 10D0
d280 2
a281 1
               GRID = 15D0
d283 14
d301 23
a323 15
      TMP = AINT(LNG(1)/GRID)*GRID
      IF (TMP.GT.LNG(1)) TMP = TMP - GRID
      LNG(1) = TMP - GRID
      TMP = AINT(LNG(2)/GRID)*GRID
      IF (TMP.LT.LNG(2)) TMP = TMP + GRID
      LNG(2) = TMP + GRID
      
      TMP = AINT(LAT(1)/GRID)*GRID
      IF (TMP.GT.LAT(1)) TMP = TMP - GRID
      LAT(1) = TMP - GRID
      IF (LAT(1).LT.-90D0) LAT(1) = LAT(1) + GRID
      TMP = AINT(LAT(2)/GRID)*GRID
      IF (TMP.LT.LAT(2)) TMP = TMP + GRID
      LAT(2) = TMP + GRID
      IF (LAT(2).GT.+90D0) LAT(2) = LAT(2) - GRID
a324 2
      DLNG = LNG(2) - LNG(1)
      DLAT = LAT(2) - LAT(1)
a325 1

d331 7
a337 22
*     Draw meridians.
      NLNG = NINT(DLNG/GRID)
      DO 40 ILNG = 0, NLNG
         WORLD(WCS(1)) = LNG(1) + ILNG*GRID

         NP = 0
         NLAT = GSTEP*NINT(DLAT/GRID)
         DO 30 ILAT = 0, NLAT
            WORLD(WCS(2)) = LAT(1) + ILAT*(GRID/GSTEP)
            IF (WORLD(WCS(2)).GT.90D0) WORLD(WCS(2)) = 90D0
            CALL WCSFWD (CTYPE, WCS, WORLD, CRVAL, CEL, PHI, THETA,
     *         PRJ, IMGCRD, LIN, PIXCRD, IERR)
*           Ignore IERR for now.

            IF (NP.GT.0) THEN
               IF (ABS(PHI-PRVPHI).GT.30D0) THEN
*                 Rough truncation for now.
                  IF (NP.GT.1) CALL PGLINE(NP, XR, YR)
                  NP = 0
               END IF
            END IF
            PRVPHI = PHI
d339 5
a343 6
            IF (NP.EQ.BUFSIZ) THEN
               CALL PGLINE(NP, XR, YR)
               NP = 1
               XR(1) = XR(BUFSIZ)
               YR(1) = YR(BUFSIZ)
            END IF
d345 7
a351 26
            NP = NP + 1
            XR(NP) = PIXCRD(1)
            YR(NP) = PIXCRD(2)
 30      CONTINUE
         CALL PGLINE(NP, XR, YR)
 40   CONTINUE

*     Draw parallels.
      NLAT = NINT(DLAT/GRID)
      DO 60 ILAT = 0, NLAT
         WORLD(WCS(2)) = LAT(1) + ILAT*GRID
 
         NP = 0
         NLNG = GSTEP*NINT(DLNG/GRID)
         DO 50 ILNG = 0, NLNG
            WORLD(WCS(1)) = LNG(1) + ILNG*(GRID/GSTEP)
            CALL WCSFWD (CTYPE, WCS, WORLD, CRVAL, CEL, PHI, THETA,
     *         PRJ, IMGCRD, LIN, PIXCRD, IERR)
*           Ignore IERR for now.
 
            IF (NP.GT.0) THEN
               IF (ABS(PHI-PRVPHI).GT.30D0) THEN
*                 Rough truncation for now.
                  IF (NP.GT.1) CALL PGLINE(NP, XR, YR)
                  NP = 0
               END IF
a352 1
            PRVPHI = PHI
d354 161
a514 83
            IF (NP.EQ.BUFSIZ) THEN
               CALL PGLINE(NP, XR, YR)
               NP = 1
               XR(1) = XR(BUFSIZ)
               YR(1) = YR(BUFSIZ)
            END IF
 
            NP = NP + 1
            XR(NP) = PIXCRD(1)
            YR(NP) = PIXCRD(2)
 50      CONTINUE
         CALL PGLINE(NP, XR, YR)
 60   CONTINUE


*  Draw the map boundary.
*     Get parameters for native coordinates.
      PIXCRD(1) = CRPIX(1)
      PIXCRD(2) = CRPIX(2)
      CALL WCSREV (CTYPE, WCS, PIXCRD, LIN, IMGCRD, PRJ, PHI, THETA,
     *   CRVAL, CEL, WORLD, IERR)
      NCRVAL(1) = PHI
      NCRVAL(2) = THETA

*     Assume non-zenithal for now.
      NTV(1) = 0D0
      NTV(2) = 0D0
      NTV(3) = 999D0
      NTV(4) = 999D0
      NTV(5) = 0D0

*     Draw the outer meridians.
      DO 80 ILNG = -180, 180, 360
         WORLD(WCS(1)) = DBLE(ILNG)
 
         NP = 0
         NLAT = GSTEP*NINT(180D0/GRID)
         DO 70 ILAT = 0, NLAT
            WORLD(WCS(2)) = -90D0 + ILAT*(GRID/GSTEP)
            IF (WORLD(WCS(2)).GT.90D0) WORLD(WCS(2)) = 90D0
            CALL WCSFWD (CTYPE, WCS, WORLD, NCRVAL, NTV, PHI, THETA,
     *         PRJ, IMGCRD, LIN, PIXCRD, IERR)
*           Ignore IERR for now.
 
            IF (NP.EQ.BUFSIZ) THEN
               CALL PGLINE(NP, XR, YR)
               NP = 1
               XR(1) = XR(BUFSIZ)
               YR(1) = YR(BUFSIZ)
            END IF
 
            NP = NP + 1
            XR(NP) = PIXCRD(1)
            YR(NP) = PIXCRD(2)
 70      CONTINUE
         CALL PGLINE(NP, XR, YR)
 80   CONTINUE

*     Draw poles.
      DO 100 ILAT = -90, 90, 180
         WORLD(WCS(2)) = DBLE(ILAT)
 
         NP = 0
         NLNG = GSTEP*NINT(360D0/GRID)
         DO 90 ILNG = 0, NLNG
            WORLD(WCS(1)) = LNG(1) + ILNG*(GRID/GSTEP)
            CALL WCSFWD (CTYPE, WCS, WORLD, NCRVAL, NTV, PHI, THETA,
     *         PRJ, IMGCRD, LIN, PIXCRD, IERR)
*           Ignore IERR for now.
 
            IF (NP.EQ.BUFSIZ) THEN
               CALL PGLINE(NP, XR, YR)
               NP = 1
               XR(1) = XR(BUFSIZ)
               YR(1) = YR(BUFSIZ)
            END IF
 
            NP = NP + 1
            XR(NP) = PIXCRD(1)
            YR(NP) = PIXCRD(2)
 90      CONTINUE
         CALL PGLINE(NP, XR, YR)
 100  CONTINUE
@
