OPeNDAP Hyrax Back End Server (BES)  Updated for version 3.8.3
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 <string>
30 #include <sstream>
31 #include <set>
32 
33 #ifndef _geo_constraint_h
34 #include "GeoConstraint.h"
35 #endif
36 
37 namespace libdap
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  Grid *d_grid; //< Constrain this Grid
54 
55  Array *d_latitude; //< A pointer to the Grid's latitude map
56  Array *d_longitude; //< A pointer to the Grid's longitude map
57 
58  bool build_lat_lon_maps();
59  bool build_lat_lon_maps(Array *lat, Array *lon);
60 
61  bool lat_lon_dimensions_ok();
62 
63  friend class GridGeoConstraintTest; // Unit tests
64 
65 public:
68  GridGeoConstraint(Grid *grid);
69  GridGeoConstraint(Grid *grid, Array *lat, Array *lon);
71 
73  {}
74 
75  virtual void apply_constraint_to_data() ;
76 
77  virtual Grid *get_constrained_grid() const
78  {
79  return d_grid;
80  }
81 };
82 
83 } // namespace libdap
84 
85 #endif // _grid_geo_constraint_h
86 
bool unit_or_name_match(set< string > units, set< string > names, const string &var_units, const string &var_name)
Look in the containers which hold the units attributes and variable name prefixes which are considere...
virtual Grid * get_constrained_grid() const
GridGeoConstraint(Grid *grid)
Initialize GeoConstraint with a Grid.
Geographical constraint applied to a grid.
Encapsulate the logic needed to handle geographical constraints when they are applied to DAP Grid (an...
Definition: GeoConstraint.h:95
virtual void apply_constraint_to_data()
Once the bounding box is set use this method to apply the constraint.