bes Updated for version 3.20.13
GridGeoConstraint.h
1
2// -*- mode: c++; c-basic-offset:4 -*-
3
4// This file is part of libdap, A C++ implementation of the OPeNDAP Data
5// Access Protocol.
6
7// Copyright (c) 2006 OPeNDAP, Inc.
8// Author: James Gallagher <jgallagher@opendap.org>
9//
10// This library is free software; you can redistribute it and/or
11// modify it under the terms of the GNU Lesser General Public
12// License as published by the Free Software Foundation; either
13// version 2.1 of the License, or (at your option) any later version.
14//
15// This library is distributed in the hope that it will be useful,
16// but WITHOUT ANY WARRANTY; without even the implied warranty of
17// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18// Lesser General Public License for more details.
19//
20// You should have received a copy of the GNU Lesser General Public
21// License along with this library; if not, write to the Free Software
22// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23//
24// You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
25
26#ifndef _grid_geo_constraint_h
27#define _grid_geo_constraint_h 1
28
29#include <string>
30#include <sstream>
31#include <set>
32
33#ifndef _geo_constraint_h
34#include "GeoConstraint.h"
35#endif
36
37namespace functions
38{
39
40// Defined in GeoConstraint; maybe move to util.cc/h?
41extern bool unit_or_name_match(set < string > units, set < string > names,
42 const string & var_units,
43 const string & var_name);
44
49{
50
51private:
52 // Specific to a Grid
53 libdap::Grid *d_grid; //< Constrain this Grid
54
55 libdap::Array *d_latitude; //< A pointer to the Grid's latitude map
56 libdap::Array *d_longitude; //< A pointer to the Grid's longitude map
57
58 bool build_lat_lon_maps();
59 bool build_lat_lon_maps(libdap::Array *lat, libdap::Array *lon);
60
61 bool lat_lon_dimensions_ok();
62
63 friend class GridGeoConstraintTest; // Unit tests
64
65public:
68 GridGeoConstraint(libdap::Grid *grid);
69 GridGeoConstraint(libdap::Grid *grid, libdap::Array *lat, libdap::Array *lon);
71
72 virtual ~GridGeoConstraint()
73 {}
74
75 virtual void apply_constraint_to_data() ;
76
77 virtual libdap::Grid *get_constrained_grid() const
78 {
79 return d_grid;
80 }
81};
82
83} // namespace libdap
84
85#endif // _grid_geo_constraint_h
86