Loading...
Searching...
No Matches
composite.h
1/*
2
3MIT License
4
5Copyright (c) 2017 FMI Open Development / Markus Peura, first.last@fmi.fi
6
7Permission is hereby granted, free of charge, to any person obtaining a copy
8of this software and associated documentation files (the "Software"), to deal
9in the Software without restriction, including without limitation the rights
10to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11copies of the Software, and to permit persons to whom the Software is
12furnished to do so, subject to the following conditions:
13
14The above copyright notice and this permission notice shall be included in all
15copies or substantial portions of the Software.
16
17THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23SOFTWARE.
24
25*/
26/*
27Part of Rack development has been done in the BALTRAD projects part-financed
28by the European Union (European Regional Development Fund and European
29Neighbourhood Partnership Instrument, Baltic Sea Region Programme 2007-2013)
30*/
31
32#pragma once
33
34// SINCE 2017/06/30,
35/* cCreate = cAdd + cExtract dw
36 * cAdd adds current h5 (polar or cartesian).
37 */
38
39#ifndef RACK_COMPOSITING
40#define RACK_COMPOSITING
41
42
43//#include "data/Quantity.h"
44#include "data/ODIM.h"
45
46//#include <drain/prog/Command.h>
47#include <drain/prog/CommandInstaller.h>
48
49
50#include "resources.h"
51
52
53
54namespace rack {
55
56// Combines program resources and compositing functions.
57
59
60
61protected:
62
63 inline
64 Compositor(const std::string & name, const std::string & description) : drain::BasicCommand(name, description), weight(1.0) {
65 }
66
67 inline
68 Compositor(const Compositor & cmd) : drain::BasicCommand(cmd), weight(cmd.weight) {
69 }
70
71
72protected:
73
74 static
75 void prepareBBox(const Composite & composite, const drain::BBox & cropGeo, drain::Rectangle<int> & cropImage);
76
77 double applyTimeDecay(Composite & composite,double w, const ODIM & odim) const;
78
79 // Filter is applied by getH5(), so OR function of: RackContext::CARTESIAN, RackContext::POLAR, RackContext::LATEST
80
81 // drain::Flags::ivalue_t
82 //void add(Composite & composite, Hdf5Context::h5_role::ivalue_t inputFilter, bool updateSelector = true) const;
83 void add(Composite & composite, int inputFilter, bool updateSelector = true) const;
84 //void add(drain::Flags::value_t inputFilter, bool updateSelector = true) const;
85
86 void addPolar(Composite & composite, const Hi5Tree & src) const;
87 void addCartesian(Composite & composite, const Hi5Tree & src) const;
88 //void extract(Composite & composite, const std::string & channels, const drain::Rectangle<double> & bbox = {0,0,0,0}) const;
89 void extract(Composite & composite, const std::string & channels, const std::string & crop = "") const;
90
91 double weight;
92
93 // Composite & getCompositeOLD() const;
94
95};
96
97
98
99}
100
101
102
103#endif
104
105// Rack
Container for geographical extent spanned by lowerLeft(x,y) and upperRight(x,y). Assumes longitude=x ...
Definition BoundingBox.h:46
Simple implementation of Command: adds name , description and parameters .
Definition Command.h:424
Cartesian composite (mosaic) of data from several radars.
Definition Composite.h:102
Definition composite.h:58
void addPolar(Composite &composite, const Hi5Tree &src) const
Definition composite.cpp:232
void add(Composite &composite, int inputFilter, bool updateSelector=true) const
Definition composite.cpp:113
void extract(Composite &composite, const std::string &channels, const std::string &crop="") const
Definition composite.cpp:708
void addCartesian(Composite &composite, const Hi5Tree &src) const
Definition composite.cpp:512
ODIM metadata (quantity, gain, offset, undetect, nodata, date, time)
Definition ODIM.h:79
Definition DataSelector.cpp:44
Rectange defined through lower left and upper right coordinates.
Definition Rectangle.h:65