GeoRasterValue.hpp
Go to the documentation of this file.
1 /*
2 
3  This file is part of OpenFLUID software
4  Copyright(c) 2007, INRA - Montpellier SupAgro
5 
6 
7  == GNU General Public License Usage ==
8 
9  OpenFLUID is free software: you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  (at your option) any later version.
13 
14  OpenFLUID is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with OpenFLUID. If not, see <http://www.gnu.org/licenses/>.
21 
22 
23  == Other Usage ==
24 
25  Other Usage means a use of OpenFLUID that is inconsistent with the GPL
26  license, and requires a written agreement between You and INRA.
27  Licensees for Other Usage of OpenFLUID may use this file in accordance
28  with the terms contained in the written agreement between You and INRA.
29 
30 */
31 
32 /**
33  @file GeoRasterValue.hpp
34 
35  @author Aline LIBRES <libres@supagro.inra.fr>
36  @author Jean-Christophe Fabre <jean-christophe.fabre@supagro.inra.fr>
37  */
38 
39 #ifndef __OPENFLUID_CORE_GEORASTERVALUE_HPP__
40 #define __OPENFLUID_CORE_GEORASTERVALUE_HPP__
41 
43 #include <openfluid/dllexport.hpp>
44 
45 #include "gdal_priv.h"
46 #include "cpl_conv.h" // for CPLMalloc()
47 
48 
49 namespace openfluid { namespace core {
50 
51 
52 /**
53  Container class for geospatial raster data represented by a GDAL dataset.
54 */
56 {
57 
58  protected:
59 
60  /**
61  The GDALDataset associated to this GeoRasterValue.
62  */
63  GDALDataset* mp_Data;
64 
65  /**
66  Open the GDALDataset of this GeoRasterValue.
67  @throw openfluid::base::FrameworkException if GDAL doesn't succeed to open the datasource.
68  */
69  void tryToOpenSource();
70 
71  public:
72 
73  /**
74  Creates a new value.
75  The <tt>FileName</tt> may be the name of a .jpeg, .tiff, .img or .asc file...
76  It doesn't open the associated GDAL dataset.
77  @param[in] FilePath The path of the file(s).
78  @param[in] FileName The name or the relative path of the file to open.
79  */
80  GeoRasterValue(const std::string& FilePath, const std::string& FileName);
81 
82  /**
83  Closes the opened GDAL dataset.
84  */
85  ~GeoRasterValue();
86 
87  /**
88  Returns the type of this GeoRasterValue.
89  @return An openfluid::core::UnstructuredValue::UnstructuredType.
90  */
92 
93  /**
94  Gets the associated opened GDAL dataset in read-only access.
95  If the dataset is not already opened, tries to open it first.
96  @return The opened GDAL dataset.
97  @throw openfluid::base::FrameworkException if GDAL doesn't succeed to open the dataset.
98  */
99  GDALDataset* data();
100 
101  /**
102  Returns the absolute Path of this GeoRasterValue.
103  */
104  std::string getAbsolutePath();
105 };
106 
107 
108 } } // namespaces
109 
110 
111 #endif /* __OPENFLUID_CORE_GEORASTERVALUE_HPP__ */
GDALDataset * mp_Data
Definition: GeoRasterValue.hpp:63
Definition: GeoRasterValue.hpp:55
Definition: ApplicationException.hpp:47
#define OPENFLUID_API
Definition: dllexport.hpp:87
UnstructuredType
Definition: UnstructuredValue.hpp:53
Definition: GeoValue.hpp:52