Go to the documentation of this file.00001
00013 #ifndef LGL_TERRAIN_DECOMPOSER_HPP
00014 #define LGL_TERRAIN_DECOMPOSER_HPP
00015
00016 #include <vector>
00017
00018 #include <lgl/Raster.hpp>
00019 #include <lgl/Decomp.hpp>
00020
00021 namespace jafar {
00022 namespace lgl {
00023
00027 template <
00028 typename T,
00029 class RasterT
00030 >
00031 class TDecomposer {
00032
00033 protected:
00034
00040 RasterT* raster;
00041
00046 Decomp* decomp;
00047
00048 public:
00049
00050 TDecomposer(RasterT* _raster);
00051
00052 virtual ~TDecomposer();
00053
00054 RasterT* getRaster() const;
00055 Decomp* getDecomp() const;
00056
00057
00058
00059
00060 virtual T getData(const RasterRect& rect)const=0;
00061 virtual T getData(const RasterCellIndex& cluster)const=0;
00062
00063
00064 virtual bool getClusterForCell(const RasterCellIndex& cell, RasterRect& cluster) const=0;
00065 virtual bool getClusterForCell(const RasterCellIndex& cell, RasterCellIndex& clusterRoot) const=0;
00066
00067
00068 virtual bool getAdjacentClusters( const RasterCellIndex& root_cell,
00069 Decomp::SIDE side,
00070 std::list<RasterCellIndex>& clusters)const=0;
00071
00072 };
00073
00074 template <typename T, class RasterT>
00075 TDecomposer<T,RasterT>::TDecomposer(RasterT* _raster):
00076 raster(_raster)
00077 {
00078 if (raster == NULL)
00079 return;
00080
00081
00082 decomp = new Decomp(raster);
00083
00084 }
00085
00086 template <typename T, class RasterT>
00087 TDecomposer<T,RasterT>::~TDecomposer() { }
00088
00089 template <typename T, class RasterT>
00090 RasterT* TDecomposer<T,RasterT>::getRaster() const {
00091 return raster;
00092 }
00093
00094
00095 template <typename T, class RasterT>
00096 Decomp* TDecomposer<T,RasterT>::getDecomp() const {
00097 return decomp;
00098 }
00099
00100
00101 }
00102 }
00103
00104 #endif // LGL_TERRAIN_DECOMPOSER_HPP