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 <geos/geom/CoordinateFilter.h>
00026 #include <geos/geom/Envelope.h>
00027 #include <geos/operation/overlay/ElevationMatrixCell.h>
00028
00029 #include <vector>
00030 #include <string>
00031
00032 #ifdef _MSC_VER
00033 #pragma warning(push)
00034 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
00035 #endif
00036
00037
00038 namespace geos {
00039 namespace geom {
00040 class Coordinate;
00041 class Geometry;
00042 }
00043 namespace operation {
00044 namespace overlay {
00045 class ElevationMatrixFilter;
00046 class ElevationMatrix;
00047 }
00048 }
00049 }
00050
00051 namespace geos {
00052 namespace operation {
00053 namespace overlay {
00054
00055
00056
00057
00058
00059
00060
00061
00062 class GEOS_DLL ElevationMatrixFilter: public geom::CoordinateFilter
00063 {
00064 public:
00065 ElevationMatrixFilter(ElevationMatrix &em);
00066 ~ElevationMatrixFilter();
00067 void filter_rw(geom::Coordinate *c) const;
00068 void filter_ro(const geom::Coordinate *c);
00069 private:
00070 ElevationMatrix &em;
00071 double avgElevation;
00072
00073
00074 ElevationMatrixFilter(const ElevationMatrixFilter& other);
00075 ElevationMatrixFilter& operator=(const ElevationMatrixFilter& rhs);
00076 };
00077
00078
00079
00080
00081 class GEOS_DLL ElevationMatrix {
00082 friend class ElevationMatrixFilter;
00083 public:
00084 ElevationMatrix(const geom::Envelope &extent, unsigned int rows,
00085 unsigned int cols);
00086 ~ElevationMatrix();
00087 void add(const geom::Geometry *geom);
00088 void elevate(geom::Geometry *geom) const;
00089
00090 double getAvgElevation() const;
00091 ElevationMatrixCell &getCell(const geom::Coordinate &c);
00092 const ElevationMatrixCell &getCell(const geom::Coordinate &c) const;
00093 std::string print() const;
00094 private:
00095 ElevationMatrixFilter filter;
00096 void add(const geom::Coordinate &c);
00097 geom::Envelope env;
00098 unsigned int cols;
00099 unsigned int rows;
00100 double cellwidth;
00101 double cellheight;
00102 mutable bool avgElevationComputed;
00103 mutable double avgElevation;
00104 std::vector<ElevationMatrixCell>cells;
00105 };
00106
00107 }
00108 }
00109 }
00110
00111 #ifdef _MSC_VER
00112 #pragma warning(pop)
00113 #endif
00114
00115 #endif // ndef GEOS_OP_OVERLAY_ELEVATIONMATRIX_H
00116
00117
00118
00119
00120
00121
00122
00123