fileio-geotiff.h
1 /*
2 
3 MIT License
4 
5 Copyright (c) 2017 FMI Open Development / Markus Peura, first.last@fmi.fi
6 
7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software and associated documentation files (the "Software"), to deal
9 in the Software without restriction, including without limitation the rights
10 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 copies of the Software, and to permit persons to whom the Software is
12 furnished to do so, subject to the following conditions:
13 
14 The above copyright notice and this permission notice shall be included in all
15 copies or substantial portions of the Software.
16 
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 SOFTWARE.
24 
25 */
26 /*
27 Part of Rack development has been done in the BALTRAD projects part-financed
28 by the European Union (European Regional Development Fund and European
29 Neighbourhood Partnership Instrument, Baltic Sea Region Programme 2007-2013)
30 */
31 
32 #ifndef RACK_FILE_IO_GTIF
33 #define RACK_FILE_IO_GTIF
34 
35 //nclude <string>
36 
37 //nclude <drain/util/RegExp.h>
38 //nclude <drain/prog/CommandBank.h>
39 //nclude <drain/prog/CommandInstaller.h>
40 
41 // #include <drain/util/FileInfo.h>
42 #include <drain/image/FileGeoTIFF.h>
43 
44 //nclude "hi5/Hi5.h"
45 
46 #include "resources.h"
47 
48 namespace rack {
49 
50 
52 
53 public:
54 
55  inline
56  CmdGeoTiff() : drain::BasicCommand(__FUNCTION__, "GeoTIFF tile size. Deprecating?, use --outputConf tif:tile=<width>:<height>,compression=LZW") {
57  getParameters().link("tile", drain::image::FileTIFF::defaultTile.tuple());
58  getParameters().link("compression", compression="", drain::sprinter(compressionDict, "|").str());
59  // getParameters().link("tilewidth", drain::image::FileTIFF::defaultTile.width=256);
60 
61  //getParameters().link("tileheight", drain::image::FileTIFF::defaultTile.height=0);
62  };
63 
64  inline
65  CmdGeoTiff(const CmdGeoTiff & cmd) : drain::BasicCommand(cmd) {
66  getParameters().copyStruct(cmd.getParameters(), cmd, *this, drain::ReferenceMap::LINK); // static targets
67  }
68 
70  void exec() const;
71 
72  static
73  void write(RackContext & ctx, const drain::image::Image & src, const std::string & filename);
74 
75  // RackContext & ctx = getContext<RackContext>();
76  // void write(const drain::image::Image & src, const std::string & filename) const;
77 
78 
79 protected:
80  //drain::Frame2D<int> tile;
81 
82  std::string compression;
83 
84  static
85  const drain::image::FileTIFF::dict_t & compressionDict;
86 
87 };
88 
89 }
90 
91 
92 #endif
93 
94 // Rack
Simple implementation of Command: adds name , description and parameters .
Definition: Command.h:417
void copyStruct(const ReferenceMap &m, const T &src, T &dst, extLinkPolicy policy=RESERVE)
Experimental. Copies references and values of a structure to another.
Definition: ReferenceMap.h:399
@ LINK
Definition: ReferenceMap.h:384
Class for multi-channel digital images. Supports dynamic typing with base types (char,...
Definition: Image.h:184
Definition: fileio-geotiff.h:51
void exec() const
Checks arguments (currently compression only)
Definition: fileio-geotiff.cpp:48
Resources provided separately for each thread.
Definition: resources.h:67
Definition: DataSelector.cpp:44