libdap++ Updated for version 3.8.2

GridGeoConstraint.h

Go to the documentation of this file.
00001 
00002 // -*- mode: c++; c-basic-offset:4 -*-
00003 
00004 // This file is part of libdap, A C++ implementation of the OPeNDAP Data
00005 // Access Protocol.
00006 
00007 // Copyright (c) 2006 OPeNDAP, Inc.
00008 // Author: James Gallagher <jgallagher@opendap.org>
00009 //
00010 // This library is free software; you can redistribute it and/or
00011 // modify it under the terms of the GNU Lesser General Public
00012 // License as published by the Free Software Foundation; either
00013 // version 2.1 of the License, or (at your option) any later version.
00014 //
00015 // This library is distributed in the hope that it will be useful,
00016 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018 // Lesser General Public License for more details.
00019 //
00020 // You should have received a copy of the GNU Lesser General Public
00021 // License along with this library; if not, write to the Free Software
00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00023 //
00024 // You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
00025 
00026 #ifndef _grid_geo_constraint_h
00027 #define _grid_geo_constraint_h 1
00028 
00029 #include <string>
00030 #include <sstream>
00031 #include <set>
00032 
00033 #ifndef _geo_constraint_h
00034 #include "GeoConstraint.h"
00035 #endif
00036 
00037 namespace libdap
00038 {
00039 
00040 // Defined in GeoConstraint; maybe move to util.cc/h?
00041 extern bool unit_or_name_match(set < string > units, set < string > names,
00042                                const string & var_units,
00043                                const string & var_name);
00044 
00048 class GridGeoConstraint : public GeoConstraint
00049 {
00050 
00051 private:
00052     // Specific to a Grid
00053     Grid *d_grid;               //< Constrain this Grid
00054 
00055     Array *d_latitude;          //< A pointer to the Grid's latitude map
00056     Array *d_longitude;         //< A pointer to the Grid's longitude map
00057 
00058     bool build_lat_lon_maps();
00059     bool build_lat_lon_maps(Array *lat, Array *lon);
00060 
00061     bool lat_lon_dimensions_ok();
00062 
00063     friend class GridGeoConstraintTest; // Unit tests
00064 
00065 public:
00068     GridGeoConstraint(Grid *grid);
00069     GridGeoConstraint(Grid *grid, Array *lat, Array *lon);
00071 
00072     virtual ~GridGeoConstraint()
00073     {}
00074 
00075     virtual void apply_constraint_to_data() ;
00076 
00077     virtual Grid *get_constrained_grid() const
00078     {
00079         return d_grid;
00080     }
00081 };
00082 
00083 } // namespace libdap
00084 
00085 #endif // _grid_geo_constraint_h
00086