~ubuntu-branches/debian/sid/gdal/sid

« back to all changes in this revision

Viewing changes to ogr/ogrsf_frmts/idrisi/generate_test_files.c

  • Committer: Package Import Robot
  • Author(s): Francesco Paolo Lovergine
  • Date: 2012-05-07 15:04:42 UTC
  • mfrom: (5.5.16 experimental)
  • Revision ID: package-import@ubuntu.com-20120507150442-2eks97loeh6rq005
Tags: 1.9.0-1
* Ready for sid, starting transition.
* All symfiles updated to latest builds.
* Added dh_numpy call in debian/rules to depend on numpy ABI.
* Policy bumped to 3.9.3, no changes required.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/******************************************************************************
 
2
 * $Id$
 
3
 *
 
4
 * Project:  
 
5
 * Purpose:  Generate sample .VCT files
 
6
 * Author:   Even Rouault, <even dot rouault at mines dash paris dot org>
 
7
 *
 
8
 ******************************************************************************
 
9
 * Copyright (c) 2011, Even Rouault <even dot rouault at mines dash paris dot org>
 
10
 *
 
11
 * Permission is hereby granted, free of charge, to any person obtaining a
 
12
 * copy of this software and associated documentation files (the "Software"),
 
13
 * to deal in the Software without restriction, including without limitation
 
14
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 
15
 * and/or sell copies of the Software, and to permit persons to whom the
 
16
 * Software is furnished to do so, subject to the following conditions:
 
17
 *
 
18
 * The above copyright notice and this permission notice shall be included
 
19
 * in all copies or substantial portions of the Software.
 
20
 *
 
21
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 
22
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
23
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
 
24
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 
25
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 
26
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 
27
 * DEALINGS IN THE SOFTWARE.
 
28
 ****************************************************************************/
 
29
 
 
30
#include <stdio.h>
 
31
 
 
32
int main(int argc, char* argv[])
 
33
{
 
34
    char c;
 
35
    int i;
 
36
    int nfeatures;
 
37
    int nodes;
 
38
    int nparts;
 
39
    FILE* f;
 
40
    double id, x, y;
 
41
    double minx, maxx, miny, maxy;
 
42
 
 
43
    f = fopen("points.vct", "wb");
 
44
    c = 0x01;
 
45
    fwrite(&c, 1, 1, f);
 
46
    nfeatures = 2;
 
47
    fwrite(&nfeatures, 1, sizeof(int), f);
 
48
    for(i=5;i<0x105;i++)
 
49
    {
 
50
        c = 0;
 
51
        fwrite(&c, 1, 1, f);
 
52
    }
 
53
 
 
54
    id = 1;
 
55
    x = 400000;
 
56
    y = 5000000;
 
57
    fwrite(&id, 1, sizeof(double), f);
 
58
    fwrite(&x, 1, sizeof(double), f);
 
59
    fwrite(&y, 1, sizeof(double), f);
 
60
 
 
61
    id = 2;
 
62
    x = 600000;
 
63
    y = 4000000;
 
64
    fwrite(&id, 1, sizeof(double), f);
 
65
    fwrite(&x, 1, sizeof(double), f);
 
66
    fwrite(&y, 1, sizeof(double), f);
 
67
 
 
68
    fclose(f);
 
69
 
 
70
 
 
71
 
 
72
    f = fopen("lines.vct", "wb");
 
73
    c = 0x02;
 
74
    fwrite(&c, 1, 1, f);
 
75
    nfeatures = 2;
 
76
    fwrite(&nfeatures, 1, sizeof(int), f);
 
77
    for(i=5;i<0x105;i++)
 
78
    {
 
79
        c = 0;
 
80
        fwrite(&c, 1, 1, f);
 
81
    }
 
82
 
 
83
    id = 10;
 
84
    minx = 400000;
 
85
    miny = 4500000;
 
86
    maxx = 600000;
 
87
    maxy = 5000000;
 
88
    fwrite(&id, 1, sizeof(double), f);
 
89
    fwrite(&minx, 1, sizeof(double), f);
 
90
    fwrite(&miny, 1, sizeof(double), f);
 
91
    fwrite(&maxx, 1, sizeof(double), f);
 
92
    fwrite(&maxy, 1, sizeof(double), f);
 
93
    nodes = 2;
 
94
    fwrite(&nodes, 1, sizeof(int), f);
 
95
    x = 400000;
 
96
    y = 5000000;
 
97
    fwrite(&x, 1, sizeof(double), f);
 
98
    fwrite(&y, 1, sizeof(double), f);
 
99
    x = 600000;
 
100
    y = 4500000;
 
101
    fwrite(&x, 1, sizeof(double), f);
 
102
    fwrite(&y, 1, sizeof(double), f);
 
103
 
 
104
    id = 20;
 
105
    minx = 400000;
 
106
    miny = 4000000;
 
107
    maxx = 600000;
 
108
    maxy = 4500000;
 
109
    fwrite(&id, 1, sizeof(double), f);
 
110
    fwrite(&minx, 1, sizeof(double), f);
 
111
    fwrite(&miny, 1, sizeof(double), f);
 
112
    fwrite(&maxx, 1, sizeof(double), f);
 
113
    fwrite(&maxy, 1, sizeof(double), f);
 
114
    nodes = 2;
 
115
    fwrite(&nodes, 1, sizeof(int), f);
 
116
    x = 450000;
 
117
    y = 4000000;
 
118
    fwrite(&x, 1, sizeof(double), f);
 
119
    fwrite(&y, 1, sizeof(double), f);
 
120
    x = 550000;
 
121
    y = 4500000;
 
122
    fwrite(&x, 1, sizeof(double), f);
 
123
    fwrite(&y, 1, sizeof(double), f);
 
124
 
 
125
    fclose(f);
 
126
 
 
127
 
 
128
 
 
129
    f = fopen("polygons.vct", "wb");
 
130
    c = 0x03;
 
131
    fwrite(&c, 1, 1, f);
 
132
    nfeatures = 1;
 
133
    fwrite(&nfeatures, 1, sizeof(int), f);
 
134
    for(i=5;i<0x105;i++)
 
135
    {
 
136
        c = 0;
 
137
        fwrite(&c, 1, 1, f);
 
138
    }
 
139
 
 
140
    id = 1;
 
141
    minx = 400000;
 
142
    miny = 4000000;
 
143
    maxx = 600000;
 
144
    maxy = 5000000;
 
145
    fwrite(&id, 1, sizeof(double), f);
 
146
    fwrite(&minx, 1, sizeof(double), f);
 
147
    fwrite(&miny, 1, sizeof(double), f);
 
148
    fwrite(&maxx, 1, sizeof(double), f);
 
149
    fwrite(&maxy, 1, sizeof(double), f);
 
150
    nparts = 2;
 
151
    fwrite(&nparts, 1, sizeof(int), f);
 
152
    nodes = 10;
 
153
    fwrite(&nodes, 1, sizeof(int), f);
 
154
 
 
155
    nodes = 5;
 
156
    fwrite(&nodes, 1, sizeof(int), f);
 
157
    x = 400000;
 
158
    y = 4000000;
 
159
    fwrite(&x, 1, sizeof(double), f);
 
160
    fwrite(&y, 1, sizeof(double), f);
 
161
    x = 400000;
 
162
    y = 5000000;
 
163
    fwrite(&x, 1, sizeof(double), f);
 
164
    fwrite(&y, 1, sizeof(double), f);
 
165
    x = 600000;
 
166
    y = 5000000;
 
167
    fwrite(&x, 1, sizeof(double), f);
 
168
    fwrite(&y, 1, sizeof(double), f);
 
169
    x = 600000;
 
170
    y = 4000000;
 
171
    fwrite(&x, 1, sizeof(double), f);
 
172
    fwrite(&y, 1, sizeof(double), f);
 
173
    x = 400000;
 
174
    y = 4000000;
 
175
    fwrite(&x, 1, sizeof(double), f);
 
176
    fwrite(&y, 1, sizeof(double), f);
 
177
 
 
178
 
 
179
    nodes = 5;
 
180
    fwrite(&nodes, 1, sizeof(int), f);
 
181
    x = 450000;
 
182
    y = 4250000;
 
183
    fwrite(&x, 1, sizeof(double), f);
 
184
    fwrite(&y, 1, sizeof(double), f);
 
185
    x = 450000;
 
186
    y = 4750000;
 
187
    fwrite(&x, 1, sizeof(double), f);
 
188
    fwrite(&y, 1, sizeof(double), f);
 
189
    x = 550000;
 
190
    y = 4750000;
 
191
    fwrite(&x, 1, sizeof(double), f);
 
192
    fwrite(&y, 1, sizeof(double), f);
 
193
    x = 550000;
 
194
    y = 4250000;
 
195
    fwrite(&x, 1, sizeof(double), f);
 
196
    fwrite(&y, 1, sizeof(double), f);
 
197
    x = 450000;
 
198
    y = 4250000;
 
199
    fwrite(&x, 1, sizeof(double), f);
 
200
    fwrite(&y, 1, sizeof(double), f);
 
201
 
 
202
    fclose(f);
 
203
 
 
204
    return 0;
 
205
}