00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef GEOS_GEOM_UTIL_POINTEXTRACTER_H
00018 #define GEOS_GEOM_UTIL_POINTEXTRACTER_H
00019
00020 #include <geos/export.h>
00021 #include <geos/geom/GeometryFilter.h>
00022 #include <geos/geom/Point.h>
00023 #include <geos/platform.h>
00024 #include <vector>
00025
00026 namespace geos {
00027 namespace geom {
00028 namespace util {
00029
00033 class GEOS_DLL PointExtracter: public GeometryFilter {
00034
00035 public:
00042 static void getPoints(const Geometry &geom, Point::ConstVect &ret)
00043 {
00044 PointExtracter pe(ret);
00045 geom.apply_ro(&pe);
00046 }
00047
00052 PointExtracter(Point::ConstVect& newComps)
00053 :
00054 comps(newComps)
00055 {}
00056
00057 void filter_rw(Geometry *geom)
00058 {
00059 if ( const Point *p=dynamic_cast<const Point *>(geom) )
00060 comps.push_back(p);
00061 }
00062
00063 void filter_ro(const Geometry *geom)
00064 {
00065 if ( const Point *p=dynamic_cast<const Point *>(geom) )
00066 comps.push_back(p);
00067 }
00068
00069 private:
00070
00071 Point::ConstVect& comps;
00072
00073
00074 PointExtracter(const PointExtracter& other);
00075 PointExtracter& operator=(const PointExtracter& rhs);
00076 };
00077
00078 }
00079 }
00080 }
00081
00082 #endif
00083
00084
00085
00086
00087
00088
00089