libdap Updated for version 3.21.1
libdap4 is an implementation of OPeNDAP's DAP protocol.
GridGeoConstraint.h
Go to the documentation of this file.
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 <set>
30#include <sstream>
31#include <string>
32
33#ifndef _geo_constraint_h
34#include "GeoConstraint.h"
35#endif
36
37namespace functions {
38
39// Defined in GeoConstraint; maybe move to util.cc/h?
40extern bool unit_or_name_match(set<string> units, set<string> names, const string &var_units, const string &var_name);
41
44
45class GridGeoConstraint : public GeoConstraint {
46
47private:
48 // Specific to a Grid
49 libdap::Grid *d_grid; //< Constrain this Grid (weak pointer)
50
51 libdap::Array *d_latitude; //< A (weak) pointer to the Grid's latitude map
52 libdap::Array *d_longitude; //< A (weak) pointer to the Grid's longitude map
53
54 bool build_lat_lon_maps();
55 bool build_lat_lon_maps(libdap::Array *lat, libdap::Array *lon);
56
57 bool lat_lon_dimensions_ok();
58
59 friend class GridGeoConstraintTest; // Unit tests
60
61public:
67
68 virtual ~GridGeoConstraint() {}
69
70 virtual void apply_constraint_to_data();
71
72 virtual libdap::Grid *get_constrained_grid() const { return d_grid; }
73};
74
75} // namespace functions
76
77#endif // _grid_geo_constraint_h
virtual libdap::Grid * get_constrained_grid() const
GridGeoConstraint(libdap::Grid *grid)
Initialize GeoConstraint with a Grid.
A multidimensional array of identical data types.
Definition Array.h:121
Holds the Grid data type.
Definition Grid.h:121
bool unit_or_name_match(set< string > units, set< string > names, const string &var_units, const string &var_name)