cartesian-extract.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_CART_EXTRACT
33 #define RACK_CART_EXTRACT
34 
35 
36 #include "resources.h"
37 #include "composite.h"
38 
39 
40 namespace rack {
41 
42 class CartesianExtract : public Compositor {
43 
44 public:
45 
46  CartesianExtract() : Compositor(__FUNCTION__, "Extract (export) data from the internal accumulation array"){
47  getParameters().separator = ':'; // Consider Command help notif, if not comma (,) .
48  getParameters().link("channels", channels="DATA,WEIGHT", drain::sprinter(Composite::dict.getKeys(), drain::Command::cmdArgLayout).str()); // Accumulation layers to be extracted
49  getParameters().link("bbox", crop, "Optional cropping: ...:<LLx>,<LLy>,<URx>,<URy> or INPUT or OVERLAP");
50  };
51 
52  CartesianExtract(const CartesianExtract & cmd) : Compositor(__FUNCTION__, cmd.getDescription()){
53  getParameters().copyStruct(cmd.getParameters(), cmd, *this);
54  // getParameters().separator = cmd.getParameters().separator;
55  }
56 
57  virtual
58  void exec() const;
59 
60 protected:
61 
62  std::string channels;
63  std::string crop;
64 
65 };
66 
67 
69 
75 class CartesianSun : public drain::SimpleCommand<std::string> { //drain::BasicCommand {
76 
77 public:
78 
79  CartesianSun() : drain::SimpleCommand<std::string>(__FUNCTION__, "Cartesian sun shine field.", "timestamp", "200507271845")
80  {
81  //getParameters().link("timestamp", timestamp="200527071845");
82  //getParameters().link("quantity", odim.quantity="SUNSHINE");
83  }
84 
85  /*
86  CartesianSun() : drain::BasicCommand(__FUNCTION__,
87  "Sunshine to a Cartesian product.") //, extractCmd(extractCmd)
88  {
89  getParameters().link("timestamp", timestamp="200527071845");
90  //getParameters().link("quantity", odim.quantity="SUNSHINE");
91  }
92  */
93 
94  void exec() const;
95 
96  std::string timestamp;
97 
98 };
99 
100 
101 
102 } // rack::
103 
104 
105 
106 #endif
107 
108 // Rack
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
A single-parameter command.
Definition: Command.h:501
char separator
Default character used for splitting input and output. See setValues.
Definition: SmartMap.h:85
Definition: cartesian-extract.h:42
virtual void exec() const
Run the command with current parameter values.
Definition: cartesian-extract.cpp:45
Creates a single-radar Cartesian data set (2D data of both quantity and quality).
Definition: cartesian-extract.h:75
void exec() const
Run the command with current parameter values.
Definition: cartesian-extract.cpp:58
Definition: composite.h:58
Definition: DataSelector.cpp:44