00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef GEOS_OP_OVERLAY_ELEVATIONMATRIX_H
00017 #define GEOS_OP_OVERLAY_ELEVATIONMATRIX_H
00018
00019 #include <vector>
00020 #include <string>
00021
00022 #include <geos/geom/CoordinateFilter.h>
00023 #include <geos/geom/Envelope.h>
00024 #include <geos/operation/overlay/ElevationMatrixCell.h>
00025
00026
00027 namespace geos {
00028 namespace geom {
00029 class Coordinate;
00030 class Geometry;
00031 }
00032 namespace operation {
00033 namespace overlay {
00034 class ElevationMatrixFilter;
00035 class ElevationMatrix;
00036 }
00037 }
00038 }
00039
00040 namespace geos {
00041 namespace operation {
00042 namespace overlay {
00043
00044
00045
00046
00047
00048
00049
00050
00051 class ElevationMatrixFilter: public geom::CoordinateFilter
00052 {
00053 public:
00054 ElevationMatrixFilter(ElevationMatrix &em);
00055 ~ElevationMatrixFilter();
00056 void filter_rw(geom::Coordinate *c) const;
00057 void filter_ro(const geom::Coordinate *c);
00058 private:
00059 ElevationMatrix &em;
00060 double avgElevation;
00061 };
00062
00063
00064
00065
00066 class ElevationMatrix {
00067 friend class ElevationMatrixFilter;
00068 public:
00069 ElevationMatrix(const geom::Envelope &extent, unsigned int rows,
00070 unsigned int cols);
00071 ~ElevationMatrix();
00072 void add(const geom::Geometry *geom);
00073 void elevate(geom::Geometry *geom) const;
00074
00075 double getAvgElevation() const;
00076 ElevationMatrixCell &getCell(const geom::Coordinate &c);
00077 const ElevationMatrixCell &getCell(const geom::Coordinate &c) const;
00078 std::string print() const;
00079 private:
00080 ElevationMatrixFilter filter;
00081 void add(const geom::Coordinate &c);
00082 geom::Envelope env;
00083 unsigned int cols;
00084 unsigned int rows;
00085 double cellwidth;
00086 double cellheight;
00087 mutable bool avgElevationComputed;
00088 mutable double avgElevation;
00089 std::vector<ElevationMatrixCell>cells;
00090 };
00091
00092
00093 }
00094 }
00095 }
00096
00097 #endif // ndef GEOS_OP_OVERLAY_ELEVATIONMATRIX_H
00098
00099
00100
00101
00102
00103
00104
00105