Debian Codegraph @

gctp/src/untfz.c

raw
1 /*******************************************************************************
2 NAME UNTFZ
3
4 PURPOSE: This function determines the convergence factor between the
5 input unit type and the output unit type. Valid types include:
6
7 0 = Radians 3 = Seconds of arc
8 1 = U.S. feet 4 = Degrees of arc
9 2 = Meters 5 = International feet
10
11 PROGRAMMER DATE
12 ---------- ----
13 T. Mittan MARCH, 1993
14
15 ALGORITHM REFERENCES
16
17 1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological
18 Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United
19 State Government Printing Office, Washington D.C., 1987.
20
21 2. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections",
22 U.S. Geological Survey Professional Paper 1453 , United State Government
23 Printing Office, Washington D.C., 1989.
24 *******************************************************************************/
25 #include <stdio.h>
26 #include "cproj.h"
27 #include "proj.h"
28
29 static double factors[6][6] = {{1.0, 0.0, 0.0, 206264.8062470963,
30 57.29577951308231, 0.0}, {0.0, 1.0, .3048006096012192,
31 0.0, 0.0, 1.000002000004}, {0.0, 3.280833333333333, 1.0,
32 0.0, 0.0, 3.280839895013124}, {.484813681109536e-5,
33 0.0, 0.0, 1.0, .27777777777778e-3, 0.0},
34 {.0174532925199433, 0.0, 0.0, 3600, 1.0, 0.0},
35 {0.0, .999998, .3048, 0.0, 0.0, 1.0}};
36
37 /* Convert DMS packed angle into deg
38 ----------------------------------*/
39 long untfz(
40 long inunit,
41 long outunit,
42 double *factor)
43 {
44 if ((outunit >= 0) && (outunit <= MAXUNIT) && (inunit >= 0)
45 && (inunit <= MAXUNIT))
46 {
47 *factor = factors[inunit][outunit];
48 if (*factor == 0.0)
49 {
50 p_error("Uncompatable unit codes","untfz-code");
51 return(1101);
52 }
53 }
54 else
55 {
56 p_error("Illegal source or target unit code","untfz-unit");
57 return(5);
58 }
59
60 return(OK);
61 }