00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef GEOS_GEOM_UTIL_LINEARCOMPONENTEXTRACTER_H
00018 #define GEOS_GEOM_UTIL_LINEARCOMPONENTEXTRACTER_H
00019
00020
00021 #include <geos/export.h>
00022 #include <vector>
00023
00024 #include <geos/geom/GeometryComponentFilter.h>
00025 #include <geos/geom/Geometry.h>
00026 #include <geos/geom/LineString.h>
00027
00028
00029 namespace geos {
00030 namespace geom {
00031 namespace util {
00032
00036 class GEOS_DLL LinearComponentExtracter: public GeometryComponentFilter {
00037
00038 private:
00039
00040 LineString::ConstVect &comps;
00041
00042 public:
00050 static void getLines(const Geometry &geom, std::vector<const LineString*> &ret)
00051 {
00052 LinearComponentExtracter lce(ret);
00053 geom.apply_ro(&lce);
00054 }
00055
00060 LinearComponentExtracter(std::vector<const LineString*> &newComps)
00061 :
00062 comps(newComps)
00063 {}
00064
00065 void filter_rw(Geometry *geom)
00066 {
00067 if ( const LineString *ls=dynamic_cast<const LineString *>(geom) )
00068 comps.push_back(ls);
00069 }
00070
00071 void filter_ro(const Geometry *geom)
00072 {
00073 if ( const LineString *ls=dynamic_cast<const LineString *>(geom) )
00074 comps.push_back(ls);
00075 }
00076
00077 };
00078
00079 }
00080 }
00081 }
00082
00083 #endif
00084
00085
00086
00087
00088
00089
00090