Geo General  1
 All Classes Files Functions Variables Pages
GeoRaster.h
Go to the documentation of this file.
1 
2 
3 #ifndef ____GeoRaster__
4 #define ____GeoRaster__
5 
6 //std
7 #include <iostream>
8 #include <string>
9 #include <stdlib.h>
10 #include <fstream>
11 #include <math.h> // ceil/floor
12 
13 //gdal
14 #include "gdal_priv.h"
15 #include "cpl_conv.h" // for CPLMalloc()
16 #include <ogr_spatialref.h> //SRS
17 
18 //geogeneral
19 #include "GeoVector.h"
20 
21 
22 class GeoRaster {
23 
24  std::string rasterDriverName;
25 
26  public:
27  GDALDataset * rasterDataset;
28  std::string rasterName;
29  GDALDriver * rasterDriver;
31  GDALDataType dataType;
32  GDALRasterBand * rasterBand;
33  int bufferX;
34  int bufferY;
37  int offsetX;
38  int offsetY;
39  double resolutionX;
40  double resolutionY;
41  double originX;
42  double originY;
43  char * wkt;
44 
48  GeoRaster( std::string n_rasterName,
49  GDALDataType n_dataType,
50  int n_numBands,
51  int n_dimensionX,
52  int n_dimensionY,
53  double n_resolutionX,
54  double n_resolutionY,
55  double n_originX,
56  double n_originY,
57  char * n_wkt
58  );
59 
63  GeoRaster( std::string n_rasterName,
64  GDALDataType n_dataType,
65  int n_numBands
66  );
67 
71  GeoRaster( std::string n_rasterName );
72 
73  //destructor
74  ~GeoRaster();
75 
80  void getRasterDriver();
81 
85  void setBand (int n_band);
86 
87  /*
88  * get band into void * buffer
89  * datatype must be cast to correct type
90  */
91  void band2Buffer( void * buffer );
92 
96  void buffer2Band( void * buffer );
97 
104  void rasterizeVector( GeoVector * templateVector,
105  unsigned char value,
106  unsigned char * buffer);
107 };
108 
109 
110 
111 
112 //GENERAL RASTER FUNCTIONS
113 
119 void xy2offset ( int x,
120  int y,
121  int64_t &offset,
122  int dimensionX );
123 
124 
130 void offset2xy ( int &x,
131  int &y,
132  int64_t offset,
133  int dimensionX );
134 
135 
136 
140 void xy2geo ( int x,
141  int y,
142  GDALDataset * input,
143  long double &geoX,
144  long double &geoY );
148 void geo2xy ( int &x,
149  int &y,
150  GDALDataset * input,
151  long double geoX,
152  long double geoY );
153 
157 char * epsg2wkt( int epsg );
158 
168 void render16to8bit ( uint16_t * buffer,
169  size_t bufferLength,
170  unsigned char * buffer8,
171  double stretchCoeff);
172 
173 #endif /* defined(____GeoRaster__) */

Copyright 2014 Google Inc. All rights reserved.