src
main
cartesian-plot.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
#pragma once
33
34
#ifndef RACK_CART_PLOT
35
#define RACK_CART_PLOT
36
37
38
39
//#include <drain/prog/CommandRegistry.h>
40
#include <drain/prog/CommandInstaller.h>
41
#include "resources.h"
42
43
44
45
namespace
rack
{
46
47
/*
48
class CartesianQuantity : public drain::BasicCommand {
49
50
public:
51
52
CartesianQuantity() : drain::BasicCommand(__FUNCTION__, "Set quantity of the composite.") {
53
getParameters().link("quantity", getResources().composite.odim.quantity);
54
// Consider resources.composite.dataSelector.quantity ?
55
}
56
57
inline
58
void exec() const {
59
60
drain::Logger mout(__FILE__, __FUNCTION__);
61
RackResources & resources = getResources();
62
//RackContext & ctx = getContext();
63
RackResources::baseCtx().targetEncoding = "quantity=" + resources.composite.odim.quantity;
64
mout.deprecating("use --encoding " , RackResources::baseCtx().targetEncoding , " instead" );
65
// = "quantity=" + resources.composite.odim.quantity;
66
67
};
68
69
};
70
*/
71
72
class
CartesianPlot
:
public
drain::BasicCommand
{
73
74
public
:
75
76
double
lon;
77
double
lat;
78
double
x;
79
double
w;
80
81
inline
82
CartesianPlot
() :
drain::BasicCommand
(__FUNCTION__,
"Add a single data point."
){
83
getParameters().link(
"lon"
, lon = 0.0,
"longitude"
);
84
getParameters().link(
"lat"
, lat = 0.0,
"latitude"
);
85
getParameters().link(
"x"
, x = 0.0,
"value"
);
86
getParameters().link(
"w"
, w = 1.0,
"weight"
);
87
};
88
89
inline
90
void
exec
()
const
{
91
// consider CompositingModule::initComposite();
92
RackContext
& ctx = getContext<RackContext>();
93
ctx.
composite
.
allocate
();
// TODO conditional
94
ctx.
composite
.addUnprojected(lon, lat, x, w);
95
};
96
97
};
98
99
100
101
class
CartesianPlotFile
:
public
drain::SimpleCommand
<std::string> {
102
103
public
:
104
105
CartesianPlotFile
() :
drain::SimpleCommand<>
(__FUNCTION__,
"Plot file containing rows '<lat> <lon> <value> [weight] (skipped...)'."
,
106
"file"
,
""
,
"filename"
){
107
};
108
109
void
exec
()
const
;
110
};
111
112
113
class
CartesianSpread
:
public
drain::BasicCommand
{
114
115
public
:
116
117
double
horz;
118
double
vert;
119
int
loops;
120
121
CartesianSpread
() :
drain::BasicCommand
(__FUNCTION__,
"Set Spread of the compositing array. OBSOLETE. Use --iDistanceTransformFill(Exp) instead"
){
// Does not allocate memory."){
122
getParameters().link(
"horz"
, horz = 10,
"pixels"
);
123
getParameters().link(
"vert"
, vert = 0,
"pixels"
);
124
getParameters().link(
"loops"
, loops = 0,
"N"
);
125
};
126
127
void
exec
()
const
;
128
};
129
130
131
132
133
134
}
// rack::
135
136
137
138
#endif
139
140
// Rack
drain::BasicCommand
Simple implementation of Command: adds name , description and parameters .
Definition:
Command.h:417
drain::SimpleCommand
A single-parameter command.
Definition:
Command.h:501
drain::image::AccumulatorGeo::allocate
virtual void allocate()
This should be called after setGeometry, unless the projection is used as a frame.
Definition:
AccumulatorGeo.h:63
rack::CartesianPlotFile
Definition:
cartesian-plot.h:101
rack::CartesianPlotFile::exec
void exec() const
Run the command with current parameter values.
Definition:
cartesian-plot.cpp:52
rack::CartesianPlot
Definition:
cartesian-plot.h:72
rack::CartesianPlot::exec
void exec() const
Run the command with current parameter values.
Definition:
cartesian-plot.h:90
rack::CartesianSpread
Definition:
cartesian-plot.h:113
rack::CartesianSpread::exec
void exec() const
Run the command with current parameter values.
Definition:
cartesian-plot.cpp:104
rack::RackContext
Resources provided separately for each thread.
Definition:
resources.h:67
rack::RackContext::composite
Composite composite
TODO: inherit from ProductBase.
Definition:
resources.h:119
rack
Definition:
DataSelector.cpp:44
Generated by
1.9.1