libdap  Updated for version 3.20.6
libdap4 is an implementation of OPeNDAP's DAP protocol.
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 
37 namespace functions
38 {
39 
40 // Defined in GeoConstraint; maybe move to util.cc/h?
41 extern bool unit_or_name_match(set < string > units, set < string > names,
42  const string & var_units,
43  const string & var_name);
44 
49 {
50 
51 private:
52  // Specific to a Grid
53  libdap::Grid *d_grid; //< Constrain this Grid (weak pointer)
54 
55  libdap::Array *d_latitude; //< A (weak) pointer to the Grid's latitude map
56  libdap::Array *d_longitude; //< A (weak) 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 
65 public:
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 
GridGeoConstraint(libdap::Grid *grid)
Initialize GeoConstraint with a Grid.
Holds the Grid data type.
Definition: Grid.h:122
A multidimensional array of identical data types.
Definition: Array.h:112