GEOS  3.4.2
LinearComponentExtracter.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2001-2002 Vivid Solutions Inc.
7  * Copyright (C) 2006 Refractions Research Inc.
8  *
9  * This is free software; you can redistribute and/or modify it under
10  * the terms of the GNU Lesser General Public Licence as published
11  * by the Free Software Foundation.
12  * See the COPYING file for more information.
13  *
14  **********************************************************************/
15 
16 #ifndef GEOS_GEOM_UTIL_LINEARCOMPONENTEXTRACTER_H
17 #define GEOS_GEOM_UTIL_LINEARCOMPONENTEXTRACTER_H
18 
19 
20 #include <geos/export.h>
21 #include <vector>
22 
23 #include <geos/geom/GeometryComponentFilter.h>
24 #include <geos/geom/Geometry.h> // to be removed when we have the .inl
25 #include <geos/geom/LineString.h> // to be removed when we have the .inl
26 //#include <geos/platform.h>
27 
28 namespace geos {
29 namespace geom { // geos.geom
30 namespace util { // geos.geom.util
31 
36 
37 private:
38 
39  LineString::ConstVect &comps;
40 
41  // Declare type as noncopyable
44 
45 public:
53  static void getLines(const Geometry &geom, std::vector<const LineString*> &ret)
54  {
55  LinearComponentExtracter lce(ret);
56  geom.apply_ro(&lce);
57  }
58 
63  LinearComponentExtracter(std::vector<const LineString*> &newComps)
64  :
65  comps(newComps)
66  {}
67 
68  void filter_rw(Geometry *geom)
69  {
70 if ( const LineString *ls=dynamic_cast<const LineString *>(geom) )
71  comps.push_back(ls);
72  }
73 
74  void filter_ro(const Geometry *geom)
75  {
76 if ( const LineString *ls=dynamic_cast<const LineString *>(geom) )
77  comps.push_back(ls);
78  }
79 
80 };
81 
82 } // namespace geos.geom.util
83 } // namespace geos.geom
84 } // namespace geos
85 
86 #endif
LinearComponentExtracter(std::vector< const LineString * > &newComps)
Definition: LinearComponentExtracter.h:63
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:167
void filter_rw(Geometry *geom)
Definition: LinearComponentExtracter.h:68
Definition: LinearComponentExtracter.h:35
Definition: LineString.h:70
std::vector< const LineString * > ConstVect
A vector of const LineString pointers.
Definition: LineString.h:77
static void getLines(const Geometry &geom, std::vector< const LineString * > &ret)
Definition: LinearComponentExtracter.h:53
Definition: GeometryComponentFilter.h:43