rasdaman complete source
rasgeo_globals.hh
Go to the documentation of this file.
1 /*
2  * This file is part of rasdaman community.
3  *
4  * Rasdaman community is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * Rasdaman community is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
16  *
17  * Copyright 2003 - 2011 Peter Baumann / rasdaman GmbH.
18  *
19  * For more information please see <http://www.rasdaman.org>
20  * or contact Peter Baumann via <baumann@rasdaman.com>.
21  */
22 /*************************************************************
23  *
24  * PURPOSE: Contains general defs used by the rasgeo tools and
25  * provides uniform command line parameter definitions (names,
26  * defaults, help texts) for the parameters used.
27  *
28  ************************************************************/
29 
30 #ifndef _RASGEO_GLOBALS_HH_
31 #define _RASGEO_GLOBALS_HH_
32 
33 #ifdef __VISUALC__
34 #pragma warning( disable : 4290 )
35 #endif
36 
37 //@ManMemo: Module: {\bf raslib}
38 
39 /*@Doc:
40  This class contains general defs used by the rasgeo tools and
41  provides uniform command line parameter definitions (names,
42  defaults, help texts) for the parameters used.
43 */
44 
45 // includes needed for the rasdaman types
46 #include "globals.hh"
47 
48 #include "raslib/rminit.hh"
49 #include "raslib/mitera.hh"
50 #include "raslib/type.hh"
51 #include "raslib/marraytype.hh"
52 #include "raslib/minterval.hh"
53 #include "raslib/primitivetype.hh"
54 #include "raslib/storageman.hh"
55 #include "raslib/mddtypes.hh"
56 
57 #include "rasodmg/marray.hh"
58 #include "rasodmg/ref.hh"
59 #include "rasodmg/set.hh"
60 #include "rasodmg/database.hh"
61 #include "rasodmg/storagelayout.hh"
62 #include "rasodmg/partinsert.hh"
63 #include "rasodmg/gmarray.hh"
64 #include "rasodmg/marray.hh"
65 #include "rasodmg/marray.hh"
66 #include "rasodmg/storagelayout.hh"
67 #include "rasodmg/dirtiling.hh"
68 #include "rasodmg/dirdecompose.hh"
70 #include "rasodmg/alignedtiling.hh"
71 #include "rasodmg/stattiling.hh"
72 #include "rasodmg/oqlquery.hh"
73 #include "rasodmg/polygon.hh"
74 #include "rasodmg/polycutout.hh"
75 
76 #define EXIT_USAGE 2
77 
79 #define LOG_INDENT " "
80 
81 
82 /*
83  * all known options
84  */
85 
86 #define PARAM_XMIN "xmin"
87 #define PARAM_XMAX "xmax"
88 #define PARAM_YMIN "ymin"
89 #define PARAM_YMAX "ymax"
90 #define PARAM_XRES "xres"
91 #define PARAM_YRES "yres"
92 
93 #define PARAM_HELP_FLAG 'h'
94 #define PARAM_HELP "help"
95 #define HELP_HELP "show command line switches"
96 
97 
98 #define PARAM_MDDTYPE_FLAG 'm'
99 #define PARAM_MDDTYPE "mddtype"
100 // database type for DEM
101 #define MDDTYPE_DEM "DoubleImage"
102 // database types for TK
103 #define MDDTYPE_TK_1 "GreyImage"
104 #define MDDTYPE_TK_2 "UShortImage"
105 #define MDDTYPE_TK_4 "ULongImage"
106 // size of pixel types in bytes:
107 #define MDDYTPE_TK_1_SIZE 1
108 #define MDDYTPE_TK_2_SIZE 2
109 #define MDDYTPE_TK_4_SIZE 4
110 #define HELP_MDDTYPE "<mdd-type> type of marray (mandatory)"
111 #define HELP_MDDTYPE_TK "<mdd-type> type of marray; deprecated, will be ignored"
112 
113 #define PARAM_COLL_FLAG 'c'
114 #define PARAM_COLL "collname"
115 #define HELP_COLL "<coll-name> name of collection (mandatory)"
116 
117 #define PARAM_DOMAIN "mdddomain"
118 #define HELP_DOMAIN "<mdd-domain> domain of marray, format: \'[x0:x1,y0:y1]\' (mandatory)"
119 
120 #define PARAM_FILE_FLAG 'f'
121 #define PARAM_FILE "file"
122 #define HELP_FILE "<file-name> input file"
123 
124 #define PARAM_READ_FLAG 'r'
125 #define PARAM_READ "read"
126 #define HELP_READ "<file-name> input file (deprecated)"
127 
128 #define PARAM_SERV_FLAG 's'
129 #define PARAM_SERV "server"
130 #define DEFAULT_SERV "localhost"
131 #define HELP_SERV "<host-name> rasdaman server"
132 
133 #define PARAM_PORT_FLAG 'p'
134 #define PARAM_PORT "port"
135 #define DEFAULT_PORT 7001
136 #define HELP_PORT "<p> rasmgr port number"
137 
138 #define PARAM_DB_FLAG 'd'
139 #define PARAM_DB "database"
140 #define HELP_DB "<db-name> name of database"
141 
142 #define PARAM_USER "user"
143 #define HELP_USER "<user-name> name of user (mandatory)"
144 
145 #define PARAM_PASSWD "passwd"
146 #define HELP_PASSWD "<user-passwd> password of user (mandatory)"
147 
148 #define PARAM_MDDOID "mddoid"
149 #define DEFAULT_MDDOID "none, apply to all objects in collection"
150 #define HELP_MDDOID "<mdd-oid> oid of the marray to work on, format: \'dbms|db|number\'. (*)"
151 
152 #define HELP_OVERLAY "<overlay-domain> domain updated in the db in case of overlay, format: \'[x0:x1,y0:y1]\' (*)"
153 
154 #define PARAM_CONV "conf"
155 #define DEFAULT_CONV "char"
156 #define DEFAULT_CONV_ORTHO "char"
157 #define DEFAULT_CONV_DEM "double"
158 #define HELP_CONV "<type-name> conversion type, one of: char (for images), float (for DEMs)"
159 
160 #define PARAM_ALIGN "align"
161 #define HELP_ALIGN "<pixels> extend update area to align with grid units of this edge length in pixels (good if this is db tile size)"
162 
163 #define INPUT_ASC "ASC"
164 #define INPUT_INT16 "int16"
165 const string help_input = string( "inputformat, one of " )
167  + ", " + format_name_jpeg
168  + ", " + format_name_tor + ", " + format_name_dem + " (or " + INPUT_ASC + "), " + INPUT_INT16 + " (unsigned; low byte first)"
169  + ", " + format_name_hdf + ", " + format_name_vff + ", " + format_name_ntf;
170 #define HELP_INPUT help_input.c_str()
171 
172 #define HELP_INPUT_P "<params> input file format parameters (see documentation)"
173 
174 #define PARAM_TILED "tiledupdate"
175 #define HELP_TILED "do update in tiles; use --align to specify tile size"
176 
177 #define PARAM_TRANS "transformat"
178 #define DEFAULT_TRANS r_Array
179 #define DEFAULT_TRANS_STR format_name_array
180 
181 #define PARAM_TRANS_P "transformatparams"
182 
183 #define PARAM_TRANSP_FLAG 't'
184 #define PARAM_TRANSP "transparent"
185 #define HELP_TRANSP "transparent update flag. If specified, black (0x0) data are treated as transparent during overlaying"
186 
187 #define PARAM_POLYGON "polygon"
188 #define HELP_POLYGON "<polygon-path> counter clockwise polygon path to clip away outside area. Needs insidepattern and/or outsidepattern"
189 
190 #define PARAM_SHRINK "shrink"
191 #define DEFAULT_SHRINK 0
192 #define HELP_SHRINK "<number> pixels that shrink polygon"
193 
194 #define PARAM_SCALE "scalelevels"
195 #define HELP_SCALE "<level-spec> list of scale levels, format: \'collection1:scalefactor1;collection2:scalefactor2;...\'"
196 #define SCALEITEM_SEPARATOR ':'
197 #define SCALELEVELS_SEPARATOR ';'
198 
199 #define HELP_SCALEFUNC "<function-name> scaling algorithm, one of: " + scale_function_name_subsampling + ", " + scale_function_name_bitaggregation
200 
201 // tiling based on tile byte size (used with 2-D rasgeo tools)
202 #define PARAM_TILING "tiling"
203 #define DEFAULT_TILING_STR tiling_name_sizetiling
204 #define DEFAULT_TILING 131072
205 
206 const string help_tiling = string( "<tiling-name> tiling strategy, one of: " ) +
207  tiling_name_notiling + ", " +
208  tiling_name_sizetiling + ", " +
213 #define HELP_TILING help_tiling.c_str()
214 
215 const string help_tiling_p = string( "<params> parameters for tiling strategy, one of (see documentation):\n" ) +
216  "\t\t- for " + tiling_name_notiling + ": " + r_No_Tiling::description + "\n" +
217  "\t\t- for " + tiling_name_sizetiling + ": " + r_Size_Tiling::description + "\n" +
218  "\t\t- for " + tiling_name_alignedtiling + ": " + r_Aligned_Tiling::description + "\n" +
219  "\t\t- for " + tiling_name_interesttiling + ": " + r_Interest_Tiling::description + "\n" +
220  "\t\t- for " + tiling_name_directionaltiling + ": " + r_Dir_Tiling::description + "\n" +
222 
223 #define PARAM_TILING_P "tilingparams"
224 #define HELP_TILING_P help_tiling_p.c_str()
225 
226 #define PARAM_STOR "storageformat"
227 #define DEFAULT_STOR r_Array
228 #define DEFAULT_STOR_STR format_name_array
229 #define DEFAULT_STOR_ORTHO r_ZLib
230 #define DEFAULT_STOR_STR_ORTHO format_name_zlib
231 #define DEFAULT_STOR_DEM r_ZLib
232 #define DEFAULT_STOR_STR_DEM format_name_zlib
233 #define DEFAULT_STOR_TK r_ZLib
234 #define DEFAULT_STOR_STR_TK format_name_zlib
235 #define HELP_STOR "<format> server storage format, one of: Array, ECW, Auto_Compression, ZLib, Pack_Bits, RLE, Sep_ZLib, Sep_RLE (see documentation for more choices)"
236 
237 #define PARAM_STOR_P "storageformatparams"
238 #define HELP_STOR_P "<params> parameters used for database storage (see documentation)"
239 
240 #define HELP_TRANS "<format> client/server transfer format, one of: Array, ECW, Auto_Compression, ZLib, Pack_Bits, RLE, Sep_ZLib, Sep_RLE (see documentation for more choices)"
241 #define HELP_TRANS_P "<params> parameters used for transfer; see documentation"
242 
243 #define PARAM_DATAFORMAT "inputformat"
244 #define DEFAULT_DATAFORMAT_STR format_name_tiff
245 #define DEFAULT_DATAFORMAT r_TIFF
246 #define DEFAULT_DATAFORMAT_DEM_STR format_name_dem
247 #define DEFAULT_DATAFORMAT_DEM r_DEM
248 #define HELP_DATAFORMAT "input format, one of TIFF, PNG, BMP, JPEG, TOR, DEM, HDF, VFF"
249 
250 #define PARAM_DATAFORMAT_P "inputformatparams"
251 #define HELP_DATAFORMAT_P "input file format parameters (see documentation)"
252 
253 #define PARAM_INPAT "insidepattern"
254 #define HELP_INPAT "<pattern> hex string defining pattern to fill interior of polygon. (*)"
255 
256 #define PARAM_OUTPAT "outsidepattern"
257 #define HELP_OUTPAT "<pattern> hex string defining pattern to fill exterior of polygon. (*)"
258 
259 #define PARAM_BUF "buffersize"
260 #define HELP_BUF "<buffer-size> number of cells written in one go with --tiledupdate. If --align is set then the minimum update size is the align value in each dimension. (*)"
261 #define DEFAULT_BUF 52428800
262 
263 #define PARAM_COLLTYPE "colltype"
264 #define HELP_COLLTYPE "<type-name> collection type name; deprecated, will be ignored"
265 
266 #define PARAM_V_FLAG 'v'
267 #define PARAM_VERBOSE "verbose"
268 #define HELP_VERBOSE "verbose log output"
269 
270 #define PARAM_DEBUG "debug"
271 #define HELP_DEBUG "print debugging information"
272 
273 #define PARAM_LAYER "layerlist"
274 #define HELP_LAYER "<list> file merge list, with bit layer position; format: 'layer_1:truePattern_1:falsePattern_1;layer_2:truePattern_2:falsePattern_2;...' where truePattern_i and falsePattern_i represent binary patterns expressed as decimal/hex/octal number"
275 #define LAYERITEM_SEPARATOR ':'
276 #define LAYER_WILDCARD '%'
277 #define LAYERLIST_SEPARATOR ';'
278 
279 #define DEFAULT_SKIP 0
280 
281 // --- for coordtrans ------------------------------------------------------
282 
283 #define PARAM_IN "infmt"
284 #define HELP_IN "<fmt> input format specifier"
285 
286 #define PARAM_X_FLAG 'x'
287 #define PARAM_X ""
288 #define HELP_X "<coord-value> horizontal input coordinate component for transformation (float number)"
289 
290 #define PARAM_Y_FLAG 'y'
291 #define PARAM_Y ""
292 #define HELP_Y "<coord-value> vertical input coordinate component for transformation (float number)"
293 
294 #define PARAM_S_FLAG 's'
295 #define PARAM_S "stripe"
296 #define HELP_S "<s> GK stripe (mandatory if '--infmt gk' is specified"
297 
298 #define PARAM_OUT "outfmt"
299 #define HELP_OUT "<fmt> output format specifier"
300 
301 #define PARAM_TASPLIT "tasplit"
302 #define HELP_TASPLIT "split insert transaction by doing intermediate commits (decreases memory hunger)"
303 
304 // --- for exporttif ------------------------------------------------------
305 
306 #define FLAG_BG 'b'
307 #define PARAM_BG "background"
308 #define HELP_BG "<hexnum> background of TIFF file as 6-digit hexadecimal RGB value"
309 #define DEFAULT_BG 0xFFFFFF
310 
311 #define PARAM_STREAMBUF "buffer"
312 #define HELP_STREAMBUF "<n> streaming buffer size (in bytes)"
313 #define DEFAULT_STREAMBUF 5242880L
314 
315 #define FLAG_SPECFILE 'i'
316 #define PARAM_SPECFILE "specfile"
317 #define HELP_SPEC "<filename> export specification file (mandatory); for a spec 'x.tif', file(s) 'xN.tif' will be generated with N running number"
318 #define DEFAULT_SPECFILE NULL
319 
320 #define FLAG_POLYGON 'p'
321 #define PARAM_POLYGON "polygon"
322 #define HELP_POLYGON "<filename> polygon cutout file; pixels outside the polygon will be set to background value"
323 
324 #define PARAM_TIFUNIT "tifunit"
325 #define HELP_TIFUNIT "<domain> edge size (in pixels) of an output mosaic; by default, a single image is generated"
326 
327 #define FLAG_TIF 't'
328 #define PARAM_TIF "tiffile"
329 #define HELP_TIF "<filename> name of output TIFF file (mandatory)"
330 
331 #define PARAM_TIFTYPE "tiftype"
332 #define HELP_TIFTPYE "<tiftype> TIFF image type, one of: binary, gray, rgb, 32bit"
333 #define DEFAULT_TIFTYPE_STR "rgb"
334 #define DEFAULT_TIFTYPE r_Convertor::ctype_rgb
335 
336 #define PARAM_TIFCOMP "tifcomp"
337 // see rasgeo/exporttools/hexcodec.cc, there admissible types are checked
338 #define HELP_TIFCOMP "<comp-name> TIFF compression to be applied, one of: none, ccittrle (binary); none, lzw (gray); none, lzw (rgb)"
339 
340 #define DEFAULT_TIFCOMP "none"
341 
342 #define PARAM_TIFRESUNIT "tifresunit"
343 #define HELP_TIFRESUNIT "<unit> TIFF file unit of resolution (mandatory)"
344 
345 #define PARAM_TIFRESVAL "tifresval"
346 #define HELP_TIFRESVAL "<n> TIFF file resolution (mandatory)"
347 
348 #define PARAM_TIFFTAG "tiftag" // need to remain consistent with other tif flags...
349 #define HELP_TIFFTAG "<k=t:v> set TIFF tag with numeric key k to value v of type t where t is one of: BYTE, ASCII, SHORT, LONG, RATIONAL, SBYTE, SSHORT, SLONG, SRATIONAL, FLOAT, DOUBLE."
350 
351 #define FLAG_GEOTIFTAG 'g'
352 #define PARAM_GEOTIFTAG "geotiftag" // need to remain consistent with other tif flags...
353 #define HELP_GEOTIFTAG "<xpixsize,yrot,xrot,ypixsize,xoffset,yoffset> TFW parameters (in TFW sequence), to be put into GeoTIFF tags."
354 
355 // --- for importdem ------------------------------------------------------
356 
357 #define PARAM_NOFLIPY "noflipy"
358 #define HELP_NOFLIPY "do not mirror y coordinates before inserting (default: flip vertically)"
359 
360 // --- for exportdem ------------------------------------------------------
361 
362 #define FLAG_DEMFILE 't'
363 #define PARAM_DEMFILE "demfile"
364 #define HELP_DEMFILE "<filename> name of DEM output file (mandatory)"
365 #define DEFAULT_DEMFILE NULL
366 
367 #define FLAG_DEMPAR CommandLineParser::noShortName
368 #define PARAM_DEMPAR "demparams"
369 #define HELP_DEMPAR "<dem-params> DEM parameter string, format: \"startx=<geocoord>,endx=<geocoord>,resx=<float>,starty=<geocoord>,endy=<geocoord>,resy=<float>\" (mandatory)"
370 #define DEFAULT_DEMPAR NULL
371 
372 #define FLAG_DEMMOS CommandLineParser::noShortName
373 #define PARAM_DEMMOS "unitdem"
374 #define HELP_DEMMOS "<domain> mosaic domain of output DEM files (default: generate one file)"
375 
376 // --- for importsegy ------------------------------------------------------
377 
378 // tiling based on tile extent (used with 2-D rasgeo tools)
379 #define PARAM_TILING_3D "tiling"
380 #define DEFAULT_TILING_3D "\'[0:128,0:128,0:128]\'"
381 #define HELP_TILING_3D "<tile-size> size of the tile to use, format: \'[0:x,0:y,0:z]\'"
382 
383 // list SEGY header info
384 #define FLAG_LIST 'l'
385 #define PARAM_LIST "list"
386 #define HELP_LIST "list contents of the EBCDIC header, the binary header, all the trace headers; then quit"
387 #define PARAM_NOTRACEHEADERS "noTraceHeaders"
388 #define HELP_NOTRACEHEADERS "If ping is present this will supress the output of the trace headers, otherwise it will be disregarded"
389 
390 
391 #endif // _RASGEO_GLOBALS_HH_
392 
static const char * description
Definition: tiling.hh:141
const char * tiling_name_interesttiling
const char * tiling_name_alignedtiling
const char * format_name_png
const char * format_name_ntf
static const char * description
Definition: stattiling.hh:192
const char * format_name_dem
static const char * description
Definition: alignedtiling.hh:151
static const char * description
Definition: dirtiling.hh:112
const char * format_name_tor
const string help_tiling_p
Definition: rasgeo_globals.hh:215
const char * format_name_vff
static const char * description
Definition: tiling.hh:212
const char * format_name_hdf
const string help_tiling
Definition: rasgeo_globals.hh:206
const char * tiling_name_sizetiling
const char * format_name_jpeg
static const char * description
Definition: interesttiling.hh:138
const char * format_name_tiff
const string help_input
Definition: rasgeo_globals.hh:165
const char * format_name_bmp
const char * tiling_name_directionaltiling
const char * tiling_name_statisticaltiling
const char * tiling_name_notiling