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

« back to all changes in this revision

Viewing changes to vector/v.in.dxf/add_text.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:
2
2
#include <string.h>
3
3
#include "global.h"
4
4
 
5
 
int add_text(struct dxf_file *dxf, struct Map_info *Map)
 
5
void add_text(struct dxf_file *dxf, struct Map_info *Map)
6
6
{
7
7
    int code;
8
 
    char layer[DXF_BUF_SIZE];
 
8
    char handle[DXF_BUF_SIZE];  /* entity handle, 16 hexadecimal digits */
 
9
    char layer[DXF_BUF_SIZE];   /* layer name */
9
10
    int layer_flag = 0;         /* indicates if a layer name has been found */
10
11
    int xflag = 0;              /* indicates if a x value has been found */
11
12
    int yflag = 0;              /* indicates if a y value has been found */
14
15
    char label[DXF_BUF_SIZE];   /* read in from dxf file */
15
16
    int label_len = 0;
16
17
 
 
18
    handle[0] = 0;
17
19
    strcpy(layer, UNIDENTIFIED_LAYER);
18
20
 
19
21
    zpnts[0] = 0.0;
20
22
    /* read in lines and process information until a 0 is read in */
21
23
    while ((code = dxf_get_code(dxf)) != 0) {
22
24
        if (code == -2)
23
 
            return -1;
 
25
            return;
24
26
 
25
27
        switch (code) {
26
28
        case 1:         /* label value */
27
29
            label_len = strlen(dxf_buf);
28
30
            strcpy(label, dxf_buf);
29
31
            break;
 
32
        case 5:         /* entity handle */
 
33
            strcpy(handle, dxf_buf);
 
34
            break;
30
35
        case 8:         /* layer name */
31
36
            if (!layer_flag && *dxf_buf) {
32
37
                if (flag_list) {
33
 
                    if (!is_layer_in_list(dxf_buf)) {
34
 
                        add_layer_to_list(dxf_buf);
35
 
                        fprintf(stdout, _("Layer %d: %s\n"), num_layers,
36
 
                                dxf_buf);
37
 
                    }
38
 
                    return 0;
 
38
                    if (!is_layer_in_list(dxf_buf))
 
39
                        add_layer_to_list(dxf_buf, 1);
 
40
                    return;
39
41
                }
40
 
                /* skip if layers != NULL && (
 
42
                /* skip if (opt_layers != NULL && (
41
43
                 * (flag_invert == 0 && is_layer_in_list == 0) ||
42
44
                 * (flag_invert == 1 && is_layer_in_list == 1)
43
45
                 * )
44
46
                 */
45
 
                if (layers && flag_invert == is_layer_in_list(dxf_buf))
46
 
                    return 0;
 
47
                if (opt_layers && flag_invert == is_layer_in_list(dxf_buf))
 
48
                    return;
47
49
                strcpy(layer, dxf_buf);
48
50
                layer_flag = 1;
49
51
            }
79
81
    }
80
82
 
81
83
    if (label_len == 0)
82
 
        return -2;
 
84
        return;
83
85
 
84
86
    if (xflag && yflag) {
85
87
        /* TODO */
111
113
        ypnts[3] = ypnts[0] + (length * sin(theta));
112
114
        zpnts[3] = zpnts[0];
113
115
 
114
 
        write_line(Map, layer, 5);
 
116
        write_vect(Map, layer, "TEXT", handle, "", 5, GV_LINE);
115
117
#endif
116
 
        write_text(Map, layer, label);
 
118
        write_vect(Map, layer, "TEXT", handle, label, 1, GV_POINT);
117
119
    }
118
120
 
119
 
    return 0;
 
121
    return;
120
122
}