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 ElevationMatrixFilter(const ElevationMatrixFilter& other);
00070 ElevationMatrixFilter& operator=(const ElevationMatrixFilter& rhs);
00071 };
00072
00073
00074
00075
00076 class GEOS_DLL ElevationMatrix {
00077 friend class ElevationMatrixFilter;
00078 public:
00079 ElevationMatrix(const geom::Envelope &extent, unsigned int rows,
00080 unsigned int cols);
00081 ~ElevationMatrix();
00082 void add(const geom::Geometry *geom);
00083 void elevate(geom::Geometry *geom) const;
00084
00085 double getAvgElevation() const;
00086 ElevationMatrixCell &getCell(const geom::Coordinate &c);
00087 const ElevationMatrixCell &getCell(const geom::Coordinate &c) const;
00088 std::string print() const;
00089 private:
00090 ElevationMatrixFilter filter;
00091 void add(const geom::Coordinate &c);
00092 geom::Envelope env;
00093 unsigned int cols;
00094 unsigned int rows;
00095 double cellwidth;
00096 double cellheight;
00097 mutable bool avgElevationComputed;
00098 mutable double avgElevation;
00099 std::vector<ElevationMatrixCell>cells;
00100 };
00101
00102
00103 }
00104 }
00105 }
00106
00107 #endif // ndef GEOS_OP_OVERLAY_ELEVATIONMATRIX_H
00108
00109
00110
00111
00112
00113
00114
00115