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

« back to all changes in this revision

Viewing changes to vector/v.to.3d/main.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:
7
7
 *               
8
8
 * PURPOSE:      Performs transformation of 2D vector features to 3D
9
9
 *
10
 
 * COPYRIGHT:    (C) 2008 by the GRASS Development Team
 
10
 * COPYRIGHT:    (C) 2008-2010 by the GRASS Development Team
11
11
 *
12
12
 *               This program is free software under the GNU General Public
13
13
 *               License (>=v2). Read the file COPYING that comes with GRASS
17
17
 
18
18
#include <stdlib.h>
19
19
#include <grass/gis.h>
20
 
#include <grass/Vect.h>
 
20
#include <grass/vector.h>
21
21
#include <grass/glocale.h>
22
22
 
23
23
#include "local_proto.h"
27
27
    struct GModule *module;
28
28
    struct opts opt;
29
29
    struct Map_info In, Out;
30
 
    BOUND_BOX box;
31
 
    int field, type;
32
 
    int ret;
 
30
    struct bound_box box;
 
31
    int type;
33
32
    
34
33
    G_gisinit(argv[0]);
35
34
 
36
35
    module = G_define_module();
37
 
    module->keywords = _("vector, transformation, 3D");
 
36
    G_add_keyword(_("vector"));
 
37
    G_add_keyword(_("geometry"));
 
38
    G_add_keyword(_("3D"));
38
39
    module->description =
39
40
        _("Performs transformation of 2D vector features to 3D.");
40
41
 
42
43
 
43
44
    if (G_parser(argc, argv))
44
45
        exit(EXIT_FAILURE);
45
 
 
46
 
    field = atoi(opt.field->answer);
 
46
    
47
47
    type = Vect_option_to_types(opt.type);
48
48
 
49
49
    if (!opt.reverse->answer) {
64
64
    }
65
65
 
66
66
    Vect_check_input_output_name(opt.input->answer, opt.output->answer,
67
 
                                 GV_FATAL_EXIT);
68
 
 
 
67
                                 G_FATAL_EXIT);
 
68
    
69
69
    /* open input vector, topology not needed */
70
70
    Vect_set_open_level(1);
71
 
    if (Vect_open_old(&In, opt.input->answer, "") < 1)
 
71
    if (Vect_open_old2(&In, opt.input->answer, "", opt.field->answer) < 1)
72
72
        G_fatal_error(_("Unable to open vector map <%s>"), opt.input->answer);
73
 
 
 
73
    Vect_set_error_handler_io(&In, &Out);
 
74
    
74
75
    if (opt.reverse->answer && !Vect_is_3d(&In)) {
75
 
        Vect_close(&In);
76
76
        G_fatal_error(_("Vector map <%s> is 2D"), opt.input->answer);
77
77
    }
78
78
 
79
79
    if (!opt.reverse->answer && Vect_is_3d(&In)) {
80
 
        Vect_close(&In);
81
80
        G_fatal_error(_("Vector map <%s> is 3D"), opt.input->answer);
82
81
    }
83
82
 
100
99
        }
101
100
    }
102
101
 
103
 
    G_message(_("Transforming features..."));
104
 
    ret = 0;
105
102
    if (opt.reverse->answer) {
106
103
        /* 3d -> 2d */
107
 
        ret = trans3d(&In, &Out, type, field, opt.column->answer);
 
104
        trans3d(&In, &Out, type, opt.field->answer, opt.column->answer);
108
105
    }
109
106
    else {
110
107
        /* 2d -> 3d */
113
110
        if (opt.height->answer) {
114
111
            height = atof(opt.height->answer);
115
112
        }
116
 
        ret = trans2d(&In, &Out, type, height, field, opt.column->answer);
117
 
    }
118
 
 
119
 
    if (ret < 0) {
120
 
        Vect_close(&In);
121
 
        Vect_close(&Out);
122
 
        Vect_delete(opt.output->answer);
123
 
        G_fatal_error(_("%s failed"), G_program_name());
 
113
        trans2d(&In, &Out, type, height, opt.field->answer, opt.column->answer);
124
114
    }
125
115
 
126
116
    if (!opt.reverse->answer && !opt.table->answer) {