CRaster.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
3 
4  This file is part of the TerraLib - a Framework for building GIS enabled
5  applications.
6 
7  TerraLib is free software: you can redistribute it and/or modify
8  it under the terms of the GNU Lesser General Public License as published by
9  the Free Software Foundation, either version 3 of the License,
10  or (at your option) any later version.
11 
12  TerraLib is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU Lesser General Public License for more details.
16 
17  You should have received a copy of the GNU Lesser General Public License
18  along with TerraLib. See COPYING. If not, write to
19  TerraLib Team at <terralib-team@terralib.org>.
20 */
21 
22 // TerraLib
23 #include "terralib/raster/Raster.h"
25 
26 #include "../CppTypes.h" // DO NOT CHANGE THE ORDER
27 #include "CRaster.h"
28 
29 // STL
30 #include <iostream>
31 #include <cassert>
32 extern "C" {
33 
34 TeRaster* TeOpenRaster(const char* path)
35 {
36  return te::rst::RasterFactory::open("URI", path);
37 }
38 
39 const char* TeRasterToString(const TeRaster* rst)
40 {
41  assert(rst);
42  char* str = new char[rst->toString().size() + 1];
43  strcpy(str, rst->toString().c_str());
44  return str;
45 }
46 
48 {
49  delete rst;
50 }
51 
52 const TeBand* TeRasterGetBand(const TeRaster* rst, int band)
53 {
54  assert(rst);
55  return rst->getBand(band);
56 }
57 }
unsigned int band
An abstract class for raster data strucutures.
struct TeBand_t TeBand
Definition: CTypes.h:60
This is the abstract factory for Rasters.
struct TeRaster_t TeRaster
Definition: CTypes.h:69
TeRaster * TeOpenRaster(const char *path)
Definition: CRaster.cpp:34
const char * TeRasterToString(const TeRaster *rst)
Definition: CRaster.cpp:39
void TeDestroyRaster(TeRaster *rst)
Definition: CRaster.cpp:47
const TeBand * TeRasterGetBand(const TeRaster *rst, int band)
Definition: CRaster.cpp:52
static Raster * open(const std::map< std::string, std::string > &rinfo, te::common::AccessPolicy p=te::common::RAccess)
It opens a raster with the given parameters and default raster driver.