bes  Updated for version 3.20.6
FONgTransform.h
1 // FONgTransform.h
2 
3 // This file is part of BES GDAL File Out Module
4 
5 // Copyright (c) 2012 OPeNDAP, Inc.
6 // Author: James Gallagher <jgallagher@opendap.org>
7 //
8 // This library is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU Lesser General Public
10 // License as published by the Free Software Foundation; either
11 // version 2.1 of the License, or (at your option) any later version.
12 //
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Lesser General Public License for more details.
17 //
18 // You should have received a copy of the GNU Lesser General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 //
22 // You can contact University Corporation for Atmospheric Research at
23 // 3080 Center Green Drive, Boulder, CO 80301
24 
25 #ifndef FONgTransfrom_h_
26 #define FONgTransfrom_h_ 1
27 
28 //#include <cstdlib>
29 
30 class GDALDataset;
32 class FONgGrid;
33 
41 class FONgTransform : public BESObj
42 {
43 public:
44  typedef enum { none, negative, positive } no_data_type_t;
45 
46 private:
47  GDALDataset *d_dest;
48 
49  libdap::DDS *d_dds;
50 
51  string d_localfile;
52 
53  vector<FONgGrid *> d_fong_vars;
54 
55  // used when there is more than one variable; this is possible
56  // when returning a GMLJP2 response but not a GeoTiff.
57  bool d_geo_transform_set;
58 
59  // Collect data here
60  double d_width, d_height, d_top, d_left, d_bottom, d_right;
61  double d_no_data;
62  no_data_type_t d_no_data_type;
63 
64  // Put GeoTransform info here
65  double d_gt[6];
66 
67  int d_num_bands;
68 
69 #if 0
70  void m_scale_data(double *data);
71 #endif
72 
73  bool effectively_two_D(FONgGrid *fbtp);
74 
75 public:
76  FONgTransform(libdap::DDS *dds, libdap::ConstraintEvaluator &evaluator, const string &localfile);
77  virtual ~FONgTransform();
78 
79  virtual void transform_to_geotiff();
80  virtual void transform_to_jpeg2000();
81 
82  bool is_geo_transform_set() { return d_geo_transform_set; }
83  void geo_transform_set(bool state) { d_geo_transform_set = state; }
84 
85  double no_data() { return d_no_data; }
86  void set_no_data(const string &nd) { d_no_data = strtod(nd.c_str(), NULL); }
87 
88  void set_no_data_type(no_data_type_t t) { d_no_data_type = t; }
89  no_data_type_t no_data_type() { return d_no_data_type; }
90 
91  int num_bands() { return d_num_bands; }
92  void set_num_bands(int n) { d_num_bands = n; }
93 
94  void push_var(FONgGrid *v) { d_fong_vars.push_back(v); }
95  int num_var() { return d_fong_vars.size(); }
96 
97  FONgGrid *var(int i) { return d_fong_vars.at(i); }
98 
99  // Image/band height and width in pixels
100  virtual void set_width(int width) { d_width = width; }
101  virtual void set_height(int height) { d_height = height; }
102 
103  virtual int width() { return d_width; }
104  virtual int height() { return d_height; }
105 
106  // The top-left corner of the top-left pixel
107  virtual void set_top(int top) { d_top = top; }
108  virtual void set_left(int left) { d_left = left; }
109 
110  virtual double top() { return d_top; }
111  virtual double left() { return d_left; }
112 
113  // The top-left corner of the top-left pixel
114  virtual void set_bottom(int top) { d_bottom = top; }
115  virtual void set_right(int left) { d_right = left; }
116 
117  virtual double bottom() { return d_bottom; }
118  virtual double right() { return d_right; }
119 
120  virtual double *geo_transform();
121 
122  virtual void dump(ostream &) const {}
123 };
124 
125 #endif // FONgTransfrom_h_
126 
FONgTransform::~FONgTransform
virtual ~FONgTransform()
Destructor.
Definition: FONgTransform.cc:79
FONgTransform::transform_to_geotiff
virtual void transform_to_geotiff()
Transforms the variables of the DataDDS to a GeoTiff file.
Definition: FONgTransform.cc:319
FONgTransform::geo_transform
virtual double * geo_transform()
Build the geotransform array needed by GDAL.
Definition: FONgTransform.cc:200
BESObj
top level BES object to house generic methods
Definition: BESObj.h:49
FONgGrid
A DAP Grid with file out netcdf information included.
Definition: FONgGrid.h:52
FONgTransform::transform_to_jpeg2000
virtual void transform_to_jpeg2000()
Transforms the variables of the DataDDS to a JPEG2000 file.
Definition: FONgTransform.cc:487
FONgTransform
Transformation object that converts an OPeNDAP DataDDS to a GeoTiff file.
Definition: FONgTransform.h:41
BESDataHandlerInterface
Structure storing information used by the BES to handle the request.
Definition: BESDataHandlerInterface.h:56
FONgTransform::FONgTransform
FONgTransform(libdap::DDS *dds, libdap::ConstraintEvaluator &evaluator, const string &localfile)
Constructor that creates transformation object from the specified DataDDS object to the specified fil...
Definition: FONgTransform.cc:65