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

« back to all changes in this revision

Viewing changes to include/raster3d.h

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
#ifndef GRASS_RASTER3D_H
 
2
#define GRASS_RASTER3D_H
 
3
 
 
4
#include <grass/gis.h>
 
5
#include <grass/raster.h>
 
6
 
 
7
#define RASTER3D_MAP_VERSION 2 /* Second version of the raster 3D map layout.
 
8
                                * Old maps withput version information are
 
9
                                * defined as version == 1 when reading the header.
 
10
                                */
 
11
 
 
12
#define RASTER3D_TILE_SAME_AS_FILE 2
 
13
 
 
14
#define RASTER3D_NO_COMPRESSION 0
 
15
#define RASTER3D_COMPRESSION 1
 
16
 
 
17
#define RASTER3D_MAX_PRECISION -1
 
18
 
 
19
#define RASTER3D_NO_CACHE 0
 
20
#define RASTER3D_USE_CACHE_DEFAULT -1
 
21
#define RASTER3D_USE_CACHE_X -2
 
22
#define RASTER3D_USE_CACHE_Y -3
 
23
#define RASTER3D_USE_CACHE_Z -4
 
24
#define RASTER3D_USE_CACHE_XY -5
 
25
#define RASTER3D_USE_CACHE_XZ -6
 
26
#define RASTER3D_USE_CACHE_YZ -7
 
27
#define RASTER3D_USE_CACHE_XYZ -8
 
28
 
 
29
#define RASTER3D_DEFAULT_WINDOW NULL
 
30
 
 
31
#define RASTER3D_DIRECTORY      "grid3"
 
32
#define RASTER3D_CELL_ELEMENT   "cell"
 
33
#define RASTER3D_CATS_ELEMENT   "cats"
 
34
#define RASTER3D_RANGE_ELEMENT  "range"
 
35
#define RASTER3D_HEADER_ELEMENT "cellhd"
 
36
#define RASTER3D_HISTORY_ELEMENT "hist"
 
37
#define RASTER3D_COLOR_ELEMENT  "color"
 
38
#define RASTER3D_COLOR2_DIRECTORY  "colr2"
 
39
#define RASTER3D_MASK_MAP       "RASTER3D_MASK"
 
40
#define RASTER3D_WINDOW_ELEMENT   "WIND3"
 
41
#define RASTER3D_DEFAULT_WINDOW_ELEMENT   "DEFAULT_WIND3"
 
42
#define RASTER3D_WINDOW_DATABASE "windows3d"
 
43
#define RASTER3D_PERMANENT_MAPSET "PERMANENT"
 
44
 
 
45
/*---------------------------------------------------------------------------*/
 
46
 
 
47
typedef struct
 
48
{
 
49
 
 
50
    double north, south;
 
51
    double east, west;
 
52
    double top, bottom;
 
53
 
 
54
    /* dimension of data in "cells"; rows == #x; cols == #y; depths == #z */
 
55
    int rows, cols, depths;
 
56
 
 
57
    double ns_res, ew_res, tb_res;
 
58
 
 
59
    int proj;                   /* Projection (see gis.h) */
 
60
    int zone;                   /* Projection zone (see gis.h) */
 
61
 
 
62
} RASTER3D_Region;
 
63
 
 
64
/*---------------------------------------------------------------------------*/
 
65
 
 
66
struct RASTER3D_Map;
 
67
 
 
68
typedef void resample_fn(struct RASTER3D_Map *, int, int, int, void *, int);
 
69
 
 
70
/*---------------------------------------------------------------------------*/
 
71
 
 
72
typedef struct RASTER3D_Map
 
73
{
 
74
        int version; /* The version of the raster 3D map layout */
 
75
 
 
76
    char *fileName;
 
77
    char *tempName;
 
78
    char *mapset;
 
79
 
 
80
    /* operation performed on map */
 
81
    int operation;              /* RASTER3D_WRITE_DATA or RASTER3D_READ_DATA */
 
82
 
 
83
    /* region */
 
84
    RASTER3D_Region region;
 
85
 
 
86
    /* window for map */
 
87
    RASTER3D_Region window;
 
88
 
 
89
    /* resmapling function used for map. default is nearest neighbor */
 
90
    resample_fn *resampleFun;
 
91
 
 
92
    /* units */
 
93
    char* unit;          /* space (U_METER, ...) */
 
94
    int vertical_unit; /* space or time (U_METER, ..., U_YEAR, ...) */
 
95
 
 
96
    /* dimension of a single tile in "cells" */
 
97
    int tileX, tileY, tileZ;
 
98
 
 
99
    /* # of tiles in x, y, and z direction */
 
100
    int nx, ny, nz;
 
101
 
 
102
    /* data file specific information */
 
103
 
 
104
    /* file descriptor */
 
105
    int data_fd;                /* file descriptor */
 
106
 
 
107
    /* type in which data is stored on file */
 
108
    int type;                   /* DCELL_TYPE or FCELL_TYPE */
 
109
 
 
110
    /* data concering the compression */
 
111
    int precision;              /* RASTER3D_MAX_PRECISION or, 0 .. 23 for float, 
 
112
                                   0 .. 52 for double */
 
113
    int compression;            /* RASTER3D_NO_COMPRESSION or RASTER3D_COMPRESSION */
 
114
    int useLzw;                 /* RASTER3D_USE_LZW or RASTER3D_NO_LZW !!! only kept for backward compatibility */
 
115
    int useRle;                 /* RASTER3D_USE_RLE or RASTER3D_NO_RLE !!! only kept for backward compatibility */
 
116
    int useXdr;                 /* RASTER3D_USE_XDR or RASTER3D_NO_XDR !!! only kept for backward compatibility */
 
117
 
 
118
    /* pointer to first tile in file */
 
119
    int offset;
 
120
 
 
121
    /* pointer to the first index entry in file */
 
122
    long indexOffset;
 
123
 
 
124
    /* sizeof (long) of the system on which the file is/was written */
 
125
    int indexLongNbytes;
 
126
 
 
127
    /* max # bytes used in the representation of indices; this is equal to */
 
128
    /* # bytes used in the representation of "indexOffset" */
 
129
    int indexNbytesUsed;
 
130
 
 
131
    /* pointer to the last entry in the file */
 
132
    int fileEndPtr;
 
133
 
 
134
    /* indicates if index is stored in file; used for RASTER3D_READ_DATA only */
 
135
    int hasIndex;               /* RASTER3D_HAS_INDEX or RASTER3D_NO_INDEX */
 
136
 
 
137
    /* information concerning internal storage of data */
 
138
 
 
139
    /* index specific information */
 
140
    /* index[i] == the offset of tile "i" in the data file */
 
141
    long *index;
 
142
 
 
143
    /* tileLength[i] == # bytes used to store tile "i" */
 
144
    int *tileLength;
 
145
 
 
146
    /* tile specific information */
 
147
 
 
148
    /* type in which data is stored in memory */
 
149
    int typeIntern;             /* DCELL_TYPE or FCELL_TYPE */
 
150
 
 
151
    /* in non-cache mode the "data" array is used to store one tile */
 
152
    char *data;
 
153
 
 
154
    /* index of tile currently stored in "data"; -1 if none */
 
155
    int currentIndex;
 
156
 
 
157
    /* cache related variables */
 
158
 
 
159
    int useCache;               /* 1 if cache is used */
 
160
    void *cache;                /* pointer to cache structure */
 
161
    int cacheFD;                /* file descriptor of cache file -- write mode only */
 
162
    char *cacheFileName;        /* filename of cache file -- write mode only */
 
163
    long cachePosLast;          /* position of last entry in cache file -- write */
 
164
    /* mode only */
 
165
 
 
166
    /* range info */
 
167
    struct FPRange range;
 
168
 
 
169
    /* some constants stored for efficiency */
 
170
 
 
171
    /* number of bytes required to store a single value of "type" */
 
172
    int numLengthExtern;
 
173
 
 
174
    /* number of bytes required to store a single value of "typeIntern" */
 
175
    int numLengthIntern;
 
176
 
 
177
    /* see header.c for details */
 
178
    int clipX, clipY, clipZ;
 
179
    int tileXY, tileSize;
 
180
    int nxy, nTiles;
 
181
 
 
182
    /* mask related information */
 
183
 
 
184
    int useMask;                /* 1 if mask is used; 0 otherwise */
 
185
 
 
186
} RASTER3D_Map;
 
187
 
 
188
/*---------------------------------------------------------------------------*/
 
189
 
 
190
typedef struct
 
191
{
 
192
 
 
193
    char *elts;                 /* ptr to array of elts */
 
194
    int nofElts;                /* size of "elts" */
 
195
    int eltSize;                /* size of elt in "elts" */
 
196
 
 
197
    int *names;                 /* name[i] is the name of elts[i] */
 
198
 
 
199
    char *locks;                /* lock[i] == 1 iff elts[i] is locked
 
200
                                   lock[i] == 0 iff elts[i] is unlocked but active
 
201
                                   lock[i] == 2 iff elts[i] doesn't contain valid data */
 
202
    int autoLock;               /* 1 if auto locking is turned on */
 
203
    int nofUnlocked;            /* nof tiles which are unlocked */
 
204
    int minUnlocked;            /* min nof elts which have to remain unlocked. min = 1 */
 
205
 
 
206
    int *next, *prev;           /* prev/next pointers for fifo */
 
207
    int first, last;            /* index (into next) of first and last elt in fifo */
 
208
    /* first == -1 iff fifo is empty */
 
209
 
 
210
    int (*eltRemoveFun) ();     /* callback activated if the contents of an 
 
211
                                   elt needs to be removed */
 
212
    void *eltRemoveFunData;     /* pointer to user data passed along with 
 
213
                                   eltRemoveFun */
 
214
    int (*eltLoadFun) ();       /* callback activated to load contents of an elt */
 
215
    void *eltLoadFunData;       /* pointer to user data passed along with 
 
216
                                   eltLoadFun */
 
217
 
 
218
    void *hash;                 /* ptr to hashTable used to relate external names to
 
219
                                   internal indices (elts) */
 
220
 
 
221
} RASTER3D_cache;
 
222
 
 
223
/*---------------------------------------------------------------------------*/
 
224
 
 
225
typedef struct
 
226
{
 
227
 
 
228
    int nofNames;
 
229
    int *index;
 
230
    char *active;
 
231
    int lastName;
 
232
    int lastIndex;
 
233
    int lastIndexActive;
 
234
 
 
235
} Rast3d_cache_hash;
 
236
 
 
237
/*---------------------------------------------------------------------------*/
 
238
 
 
239
/*Structures */
 
240
typedef struct _d_interval
 
241
{
 
242
    double low, high;
 
243
    int inf;
 
244
    struct _d_interval *next;
 
245
} d_Interval;
 
246
 
 
247
typedef struct _d_mask
 
248
{
 
249
    d_Interval *list;
 
250
} d_Mask;
 
251
 
 
252
/*---------------------------------------------------------------------------*/
 
253
 
 
254
typedef int write_fn(int, const void *, void *);
 
255
typedef int read_fn(int, void *, void *);
 
256
 
 
257
/*---------------------------------------------------------------------------*/
 
258
 
 
259
/*============================== Prototypes ================================*/
 
260
 
 
261
#include <grass/defs/raster3d.h>
 
262
 
 
263
#endif /* #ifndef GRASS_RASTER3D_H */