~ubuntu-branches/ubuntu/wily/grass/wily

« back to all changes in this revision

Viewing changes to imagery/i.ortho.photo/photo.2target/target.c

Tags: 7.0.0~rc1+ds1-1~exp1
* New upstream release candidate.
* Repack upstream tarball, remove precompiled Python objects.
* Add upstream metadata.
* Update gbp.conf and Vcs-Git URL to use the experimental branch.
* Update watch file for GRASS 7.0.
* Drop build dependencies for Tcl/Tk, add build dependencies:
  python-numpy, libnetcdf-dev, netcdf-bin, libblas-dev, liblapack-dev
* Update Vcs-Browser URL to use cgit instead of gitweb.
* Update paths to use grass70.
* Add configure options: --with-netcdf, --with-blas, --with-lapack,
  remove --with-tcltk-includes.
* Update patches for GRASS 7.
* Update copyright file, changes:
  - Update copyright years
  - Group files by license
  - Remove unused license sections
* Add patches for various typos.
* Fix desktop file with patch instead of d/rules.
* Use minimal dh rules.
* Bump Standards-Version to 3.9.6, no changes.
* Use dpkg-maintscript-helper to replace directories with symlinks.
  (closes: #776349)
* Update my email to use @debian.org address.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#include <unistd.h>
2
 
#include <string.h>
3
 
#include <grass/imagery.h>
4
 
#include "globals.h"
5
 
#include "local_proto.h"
6
 
 
7
 
/* read the target for the group and cast it into the alternate GRASS env */
8
 
 
9
 
static int which_env;
10
 
 
11
 
int get_target(void)
12
 
{
13
 
    char location[40];
14
 
    char mapset[40];
15
 
    char buf[1024];
16
 
    int stat;
17
 
    char tl[100];
18
 
    char math_exp[100];
19
 
    char units[100];
20
 
    char nd[100];
21
 
 
22
 
    elev_layer = (char *)G_malloc(40 * sizeof(char));
23
 
    mapset_elev = (char *)G_malloc(40 * sizeof(char));
24
 
 
25
 
    /*fprintf (stderr,"Looking for target location\n"); */
26
 
 
27
 
    if (!I_get_target(group.name, location, mapset)) {
28
 
        sprintf(buf, "Target information missing for group [%s]\n",
29
 
                group.name);
30
 
        goto error;
31
 
    }
32
 
 
33
 
/***
34
 
fprintf (stderr,"target location: %s\n", location);
35
 
fprintf (stderr,"target mapset: %s\n", mapset);
36
 
fprintf (stderr,"Checking target access\n");
37
 
G_sleep (3);
38
 
****/
39
 
    sprintf(buf, "%s/%s", G_gisdbase(), location);
40
 
    if (access(buf, 0) != 0) {
41
 
        sprintf(buf, "Target location [%s] not found\n", location);
42
 
        goto error;
43
 
    }
44
 
    G__create_alt_env();
45
 
    G__setenv("LOCATION_NAME", location);
46
 
    stat = G__mapset_permissions(mapset);
47
 
    if (stat > 0) {
48
 
        G__setenv("MAPSET", mapset);
49
 
        G__create_alt_search_path();
50
 
        G__switch_env();
51
 
        G__switch_search_path();
52
 
        which_env = 0;
53
 
 
54
 
        /* get the block elevation layer raster map  in target location */
55
 
 
56
 
/***
57
 
fprintf (stderr,"Looking for elevation file in block: %s\n", block.name);
58
 
G_sleep (3);
59
 
***/
60
 
        /* Return the elev name from the group file ELEVATION */
61
 
        if (!I_get_group_elev(group.name, elev_layer, mapset_elev,
62
 
                              tl, math_exp, units, nd)) {
63
 
            sprintf(buf, "Elevation information missing.for group [%s] \n",
64
 
                    group.name);
65
 
            goto error;
66
 
        }
67
 
 
68
 
/**
69
 
fprintf (stderr,"Block elevation: %s in %s\n", elev_layer, mapset_elev);
70
 
G_sleep (3);
71
 
**/
72
 
        return 1;
73
 
    }
74
 
    sprintf(buf, "Mapset [%s] in target location [%s] - ", mapset, location);
75
 
    strcat(buf, stat == 0 ? "permission denied\n" : "not found\n");
76
 
 
77
 
 
78
 
  error:
79
 
 
80
 
/****
81
 
    strcat (buf, "Please run i.target for block ");
82
 
    strcat (buf, block.name);
83
 
****/
84
 
    G_fatal_error(buf);
85
 
}
86
 
 
87
 
int select_current_env(void)
88
 
{
89
 
    if (which_env != 0) {
90
 
        G__switch_env();
91
 
        G__switch_search_path();
92
 
        which_env = 0;
93
 
    }
94
 
 
95
 
    return 0;
96
 
}
97
 
 
98
 
int select_target_env(void)
99
 
{
100
 
    if (which_env != 1) {
101
 
        G__switch_env();
102
 
        G__switch_search_path();
103
 
        which_env = 1;
104
 
    }
105
 
 
106
 
    return 0;
107
 
}