~ubuntu-branches/ubuntu/breezy/proj/breezy

« back to all changes in this revision

Viewing changes to src/geod_set.c

  • Committer: Bazaar Package Importer
  • Author(s): Peter S Galbraith
  • Date: 2004-11-06 19:44:53 UTC
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20041106194453-axnsmkh1zplal8mz
Tags: upstream-4.4.9
ImportĀ upstreamĀ versionĀ 4.4.9

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#ifndef lint
2
2
static const char SCCSID[]="@(#)geod_set.c      4.8     95/09/23        GIE     REL";
3
3
#endif
 
4
 
 
5
#define _IN_GEOD_SET
 
6
 
 
7
#include <string.h>
4
8
#include "projects.h"
5
9
#include "geodesic.h"
 
10
#include "emess.h"
6
11
        void
7
12
geod_set(int argc, char **argv) {
8
13
        paralist *start = 0, *curr;
19
24
                else
20
25
                        start = curr = pj_mkparam(argv[i]);
21
26
        /* set elliptical parameters */
22
 
        if (pj_ell_set(start, &a, &es)) emess(1,"ellipse setup failure");
 
27
        if (pj_ell_set(start, &geod_a, &es)) emess(1,"ellipse setup failure");
23
28
        /* set units */
24
29
        if (name = pj_param(start, "sunits").s) {
25
30
                char *s;
26
 
 
27
 
                for (i = 0; (s = pj_units[i].id) && strcmp(name, s) ; ++i) ;
 
31
                struct PJ_UNITS *unit_list = pj_get_units_ref();
 
32
                for (i = 0; (s = unit_list[i].id) && strcmp(name, s) ; ++i) ;
28
33
                if (!s)
29
34
                        emess(1,"%s unknown unit conversion id", name);
30
 
                fr_meter = 1. / (to_meter = atof(pj_units[i].to_meter));
 
35
                fr_meter = 1. / (to_meter = atof(unit_list[i].to_meter));
31
36
        } else
32
37
                to_meter = fr_meter = 1.;
33
38
        if (ellipse = es != 0.) {
34
39
                onef = sqrt(1. - es);
35
 
                f = 1 - onef;
36
 
                f2 = f/2;
37
 
                f4 = f/4;
38
 
                f64 = f*f/64;
 
40
                geod_f = 1 - onef;
 
41
                f2 = geod_f/2;
 
42
                f4 = geod_f/4;
 
43
                f64 = geod_f*geod_f/64;
39
44
        } else {
40
45
                onef = 1.;
41
 
                f = f2 = f4 = f64 = 0.;
 
46
                geod_f = f2 = f4 = f64 = 0.;
42
47
        }
43
48
        /* check if line or arc mode */
44
49
        if (pj_param(start, "tlat_1").i) {
51
56
                        lam2 = pj_param(start, "rlon_2").f;
52
57
                        geod_inv();
53
58
                        geod_pre();
54
 
                } else if (S = pj_param(start, "dS").f) {
 
59
                } else if (geod_S = pj_param(start, "dS").f) {
55
60
                        al12 = pj_param(start, "rA").f;
56
61
                        geod_pre();
57
62
                        geod_for();
60
65
                        if (!(del_alpha = pj_param(start, "rdel_A").f))
61
66
                                emess(1,"del azimuth == 0");
62
67
                } else if (del_S = fabs(pj_param(start, "ddel_S").f)) {
63
 
                        n_S = S / del_S + .5;
 
68
                        n_S = geod_S / del_S + .5;
64
69
                } else if ((n_S = pj_param(start, "in_S").i) <= 0)
65
70
                        emess(1,"no interval divisor selected");
66
71
        }