Loading...
Searching...
No Matches
PolarSector.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#ifndef RADAR_POLAR_SECTOR_H
32#define RADAR_POLAR_SECTOR_H
33
34
35#include <sstream>
36
37#include <drain/util/BeanLike.h>
38#include <drain/util/Range.h>
39
40#include "data/PolarODIM.h"
41
42// // using namespace std;
43
44namespace rack {
45
46
48
49public:
50
51 PolarSector() : drain::BeanLike(__FUNCTION__) {
52 parameters.link("azm", azmRange.tuple(), "deg");
53 parameters.link("range", distanceRange.tuple(), "km");
54 parameters.link("ray", rayRange.tuple(), "index");
55 parameters.link("bin", binRange.tuple(), "index");
56 }
57
60
63
66
69
70 void reset();
71
73 inline
74 void setRange(int range, int range2 = 0){
75 if (range2 < range){
76 this->distanceRange.set(range2, range);
77 // this->range1 = range2;
78 // this->range2 = range;
79 }
80 else {
81 this->distanceRange.set(range, range2);
82 // this->range1 = range;
83 // this->range2 = range2;
84 }
85 };
86
88 inline
89 void setAzimuth(double azm, double azm2 = std::numeric_limits<double>::max()){
90
91 if (azm2 != std::numeric_limits<double>::max())
92 this->azmRange.set(azm, azm2);
93 else
94 this->azmRange.set(azm, azm);
95
96 };
97
98 inline
99 int getSafeRay(const PolarODIM & odim, int j){
100 j = j % odim.area.height;
101 if (j < 0)
102 j += odim.area.height;
103 return j;
104 }
105
107 void adjustIndices(const PolarODIM & odim);
108
110 void deriveWindow(const PolarODIM & srcOdim, int & ray1, int & bin1, int & ray2, int & bin2) const;
111
112};
113
114
115} // rack::
116
117
118#endif /*GEOMETRY_H_*/
119
120// Rack
Something which has a name, a description and possibly some parameters of varying type.
Definition BeanLike.h:60
Definition Range.h:52
Metadata structure for single-radar data (polar scans, volumes and products).
Definition PolarODIM.h:45
Definition PolarSector.h:47
void adjustIndices(const PolarODIM &odim)
Given scaling (ODIM nbins, rscale, nrays), convert azimuths and ranges to ray and bin indices.
Definition PolarSector.cpp:54
void deriveWindow(const PolarODIM &srcOdim, int &ray1, int &bin1, int &ray2, int &bin2) const
Given scaling (ODIM nbins, rscale, nrays), convert current azm and range data to ray and bin indices.
Definition PolarSector.cpp:107
void setRange(int range, int range2=0)
Sets range such that range1 < range2.
Definition PolarSector.h:74
drain::Range< double > distanceRange
Radial distance range [km].
Definition PolarSector.h:62
void setAzimuth(double azm, double azm2=std::numeric_limits< double >::max())
Sets azimuth(s)
Definition PolarSector.h:89
drain::Range< int > binRange
Radial distance range [index].
Definition PolarSector.h:68
drain::Range< double > azmRange
Azimuthal sector [deg].
Definition PolarSector.h:59
drain::Range< int > rayRange
Azimuthal [index].
Definition PolarSector.h:65
Definition DataSelector.cpp:44