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