Loading...
Searching...
No Matches
cartesian-bbox.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#ifndef RACK_CART_BBOX
35#define RACK_CART_BBOX
36
37
38
39// #include <drain/prog/CommandRegistry.h>
40// #include <drain/prog/CommandInstaller.h>
41#include "resources.h"
42
43
44
45namespace rack {
46
47
48
50
51public:
52
53 CartesianBBox() : drain::BasicCommand(__FUNCTION__, "Bounding box of the Cartesian product.") {
54 getParameters().link("llLon", bbox.lowerLeft.x = 0.0, "deg|m");
55 getParameters().link("llLat", bbox.lowerLeft.y = 0.0, "deg|m");
56 getParameters().link("urLon", bbox.upperRight.x = 0.0, "deg|m");
57 getParameters().link("urLat", bbox.upperRight.y = 0.0, "deg|m");
58 };
59
61 getParameters().copyStruct(cmd.getParameters(), cmd, *this);
62 }
63
64 void exec() const;
65
66
67private:
68
70 // bool isMetric(double x, double limit){ -> GeoFrame
71
72};
73
74
76
77public:
78
79 CartesianBBoxReset() : drain::BasicCommand(__FUNCTION__, "Resets the bounding box (to be set again according to the next radar data).") {};
80
81 inline
82 void exec() const {
83 //RackResources & resources = getResources();
84 //resources.bbox.set(0,0,0,0);
85 //resources.composite.setBoundingBoxD(0,0,0,0);
87 ctx.composite.setBoundingBox(0,0,0,0);
88 };
89
90};
91//static RackLetAdapter<CartesianBBoxReset> cBBoxReset("cBBoxReset");
92
98class CartesianBBoxTest : public drain::BasicCommand { // public drain::SimpleCommand<int> { //
99
100public:
101
102 //mutable bool overlap;
103
104 /*
105 CartesianBBoxTest() : drain::SimpleCommand<int>(__FUNCTION__, "Tests whether the radar range is inside the composite.",
106 "mode", 0, "If no overlap, sets INPUT_ERROR flag, else resets. If also mode>1, exit with return value <mode>." ) {
107 };*/
108
109 CartesianBBoxTest() : drain::BasicCommand(__FUNCTION__, "Tests whether the radar range is inside the composite."){
110 getParameters().link("mode", mode);
111 }
113 getParameters().copyStruct(cmd.getParameters(), cmd, *this);
114 }
115
116 /*
117 virtual
118 inline
119 void run(const std::string & params = ""){
120 SimpleCommand<int>::run(params);
121 value = static_cast<int>(overlap);
122 }
123 */
124 mutable
125 int mode;
126
127 void exec() const;
128
129};
130
131
133
134public:
135
137
138 CartesianBBoxTile() : drain::BasicCommand(__FUNCTION__, "Redefines bbox and compositing array size for several radars, applying original projection and resolution. See --cSize, --cBBox, --cProj.") {
139 getParameters().link("llLon", bbox.lowerLeft.x = 0.0, "deg");
140 getParameters().link("llLat", bbox.lowerLeft.y = 0.0, "deg");
141 getParameters().link("urLon", bbox.upperRight.x = 0.0, "deg");
142 getParameters().link("urLat", bbox.upperRight.y = 0.0, "deg");
143 }
144
146 getParameters().copyStruct(cmd.getParameters(), cmd, *this);
147 }
148
149 void exec() const;
150
151};
152
153
154} // rack::
155
156
157
158#endif
159
160// Rack
Simple implementation of Command: adds name , description and parameters .
Definition Command.h:461
virtual const drain::ReferenceMap & getParameters() const
Returns the command parameters.
Definition Command.h:396
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:412
Definition cartesian-bbox.h:75
void exec() const
Run the command with current parameter values.
Definition cartesian-bbox.h:82
Definition cartesian-bbox.h:98
void exec() const
Run the command with current parameter values.
Definition cartesian-bbox.cpp:64
Definition cartesian-bbox.h:132
void exec() const
Run the command with current parameter values.
Definition cartesian-bbox.cpp:188
Definition cartesian-bbox.h:49
void exec() const
Run the command with current parameter values.
Definition cartesian-bbox.cpp:55
A map of radar data, indexed by quantity code (DBZH, VRAD, etc).
Definition Data.h:1293
Resources provided separately for each thread.
Definition resources.h:70
Definition AltitudeOp.cpp:42
Rectange defined through lower left and upper right coordinates.
Definition Rectangle.h:65