OPeNDAP Hyrax Back End Server (BES)  Updated for version 3.8.3
FONgTransform.h
Go to the documentation of this file.
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 FONgBaseType;
31 class GDALDataset;
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 #if 0
51  libdap::ConstraintEvaluator &d_evaluator;
52 #endif
53  string d_localfile;
54 
55  vector<FONgBaseType *> d_fong_vars;
56 
57  // used when there is more than one variable; this is possible
58  // when returning a GMLJP2 response but not a GeoTiff.
59  bool d_geo_transform_set;
60 
61  // Collect data here
62  double d_width, d_height, d_top, d_left, d_bottom, d_right;
63  double d_no_data;
64  no_data_type_t d_no_data_type;
65 
66  // Put GeoTransform info here
67  double d_gt[6];
68 
69  int d_num_bands;
70 
71 #if 0
72  int d_size_x;
73  int d_size_y;
74 #endif
75 
76  void m_scale_data(double *data);
77  bool effectively_two_D(FONgBaseType *fbtp);
78 
79 public:
80  FONgTransform(libdap::DDS *dds, libdap::ConstraintEvaluator &evaluator, const string &localfile);
81  virtual ~FONgTransform();
82 
83  virtual void transform_to_geotiff();
84  virtual void transform_to_jpeg2000();
85 
86  bool is_geo_transform_set() { return d_geo_transform_set; }
87  void geo_transform_set(bool state) { d_geo_transform_set = state; }
88 
89  double no_data() { return d_no_data; }
90  void set_no_data(const string &nd) { d_no_data = strtod(nd.c_str(), NULL); }
91 
92  void set_no_data_type(no_data_type_t t) { d_no_data_type = t; }
93  no_data_type_t no_data_type() { return d_no_data_type; }
94 
95  int num_bands() { return d_num_bands; }
96  void set_num_bands(int n) { d_num_bands = n; }
97 
98  void push_var(FONgBaseType *v) { d_fong_vars.push_back(v); }
99  int num_var() { return d_fong_vars.size(); }
100 
101  FONgBaseType *var(int i) { return d_fong_vars.at(i); }
102 
103  // Image/band height and width in pixels
104  virtual void set_width(int width) { d_width = width; }
105  virtual void set_height(int height) { d_height = height; }
106 
107  virtual int width() { return d_width; }
108  virtual int height() { return d_height; }
109 
110  // The top-left corner of the top-left pixel
111  virtual void set_top(int top) { d_top = top; }
112  virtual void set_left(int left) { d_left = left; }
113 
114  virtual double top() { return d_top; }
115  virtual double left() { return d_left; }
116 
117  // The top-left corner of the top-left pixel
118  virtual void set_bottom(int top) { d_bottom = top; }
119  virtual void set_right(int left) { d_right = left; }
120 
121  virtual double bottom() { return d_bottom; }
122  virtual double right() { return d_right; }
123 
124  virtual double *geo_transform();
125 
126  virtual void dump(ostream &) const {}
127 };
128 
129 #endif // FONgTransfrom_h_
130 
virtual void set_top(int top)
virtual int height()
virtual void set_left(int left)
virtual void transform_to_geotiff()
Transforms the variables of the DataDDS to a GeoTiff file.
void set_num_bands(int n)
Definition: FONgTransform.h:96
virtual void set_bottom(int top)
bool is_geo_transform_set()
Definition: FONgTransform.h:86
virtual void set_height(int height)
virtual ~FONgTransform()
Destructor.
void push_var(FONgBaseType *v)
Definition: FONgTransform.h:98
virtual void set_width(int width)
virtual double * geo_transform()
Build the geotransform array needed by GDAL.
virtual double right()
FONgTransform(libdap::DDS *dds, libdap::ConstraintEvaluator &evaluator, const string &localfile)
Constructor that creates transformation object from the specified DataDDS object to the specified fil...
Base object for bes objects.
Definition: BESObj.h:52
virtual int width()
virtual double top()
virtual void set_right(int left)
#define NULL
Definition: wcsUtil.h:65
void geo_transform_set(bool state)
Definition: FONgTransform.h:87
virtual double left()
FONgBaseType * var(int i)
void set_no_data_type(no_data_type_t t)
Definition: FONgTransform.h:92
A DAP BaseType with file out gdal information included.
Definition: FONgBaseType.h:38
Structure storing information used by the BES to handle the request.
virtual void dump(ostream &) const
virtual double bottom()
double no_data()
Definition: FONgTransform.h:89
no_data_type_t no_data_type()
Definition: FONgTransform.h:93
Transformation object that converts an OPeNDAP DataDDS to a GeoTiff file.
Definition: FONgTransform.h:41
void set_no_data(const string &nd)
Definition: FONgTransform.h:90
virtual void transform_to_jpeg2000()
Transforms the variables of the DataDDS to a JPEG2000 file.