OPeNDAP Hyrax Back End Server (BES)  Updated for version 3.8.3
GDALArray.cc
Go to the documentation of this file.
1 // This file is part of the GDAL OPeNDAP Adapter
2 
3 // Copyright (c) 2004 OPeNDAP, Inc.
4 // Author: Frank Warmerdam <warmerdam@pobox.com>
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 //
20 // You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
21 
22 #include "config.h"
23 //#define DODS_DEBUG 1
24 
25 #include <string>
26 
27 #include <BESDebug.h>
28 
29 #include <InternalErr.h>
30 #include <debug.h>
31 
32 #include "GDALTypes.h"
33 
34 using namespace libdap ;
35 
36 // From gdal_dds.cc
37 void read_data_array(GDALArray *array, GDALRasterBandH hBand, GDALDataType eBufType);
38 void read_map_array(Array *map, GDALRasterBandH hBand, string filename);
39 
40 /************************************************************************/
41 /* ==================================================================== */
42 /* GDALArray */
43 /* ==================================================================== */
44 /************************************************************************/
45 
46 void GDALArray::m_duplicate(const GDALArray &a)
47 {
48  filename = a.filename;
49  hBand = a.hBand;
50  eBufType = a.eBufType;
51 }
52 
53 BaseType *
55 {
56  return new GDALArray(*this);
57 }
58 
59 GDALArray::GDALArray(const string &n, BaseType *v) : Array(n, v), filename(""), hBand(0), eBufType(GDT_Unknown)
60 {
61  BESDEBUG("gdal", " Called GDALArray::GDALArray() 1" << endl);
62 }
63 
64 GDALArray::GDALArray(const string &name, BaseType *proto, const string &filenameIn, GDALRasterBandH hBandIn, GDALDataType eBufTypeIn) :
65  Array(name, proto), filename(filenameIn), hBand(hBandIn), eBufType(eBufTypeIn)
66 {
67  BESDEBUG("gdal", " Called GDALArray::GDALArray() 2" << endl);
68 }
69 
70 GDALArray::GDALArray(const GDALArray &src) : Array(src)
71 {
72  m_duplicate(src);
73 }
74 
76 {
77 }
78 
79 bool
81 {
82  BESDEBUG("gdal", "Entering GDALArray::read()" << endl);
83 
84  if (read_p())
85  return true;
86 
87  if (name() == "northing" || name() == "easting")
88  read_map_array(this, hBand, filename);
89  else
90  read_data_array(this, hBand, eBufType);
91 
92  set_read_p(true);
93 
94  return true;
95 }
void read_map_array(Array *map, GDALRasterBandH hBand, string filename)
virtual BaseType * ptr_duplicate()
Definition: GDALArray.cc:54
GDALArray(const string &n="", BaseType *v=0)
virtual ~GDALArray()
Definition: GDALArray.cc:75
static class NCMLUtil overview
virtual bool read()
Definition: GDALArray.cc:80
#define BESDEBUG(x, y)
macro used to send debug information to the debug stream
Definition: BESDebug.h:64
void read_data_array(GDALArray *array, GDALRasterBandH hBand, GDALDataType eBufType)
Read the data array of a DAP2 Grid.
Definition: gdal_dds.cc:191