GEOS  3.4.2
ComponentCoordinateExtracter.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_COMPONENTCOORDINATEEXTRACTER_H
17 #define GEOS_GEOM_UTIL_COMPONENTCOORDINATEEXTRACTER_H
18 
19 #include <vector>
20 
21 #include <geos/geom/GeometryComponentFilter.h>
22 #include <geos/geom/Geometry.h> // to be removed when we have the .inl
23 #include <geos/geom/Coordinate.h> // to be removed when we have the .inl
24 #include <geos/geom/LineString.h> // to be removed when we have the .inl
25 #include <geos/geom/Point.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 
39 {
40 public:
48  static void getCoordinates(const Geometry &geom, std::vector<const Coordinate*> &ret)
49  {
51  geom.apply_ro(&cce);
52  }
53 
58  ComponentCoordinateExtracter( std::vector<const Coordinate*> &newComps)
59  :
60  comps(newComps)
61  {}
62 
63  void filter_rw( Geometry * geom)
64  {
68  comps.push_back( geom->getCoordinate() );
69  //if ( typeid( *geom ) == typeid( LineString )
70  // || typeid( *geom ) == typeid( Point ) )
71  //if ( const Coordinate *ls=dynamic_cast<const Coordinate *>(geom) )
72  // comps.push_back(ls);
73  }
74 
75  void filter_ro( const Geometry * geom)
76  {
77  //if ( typeid( *geom ) == typeid( LineString )
78  // || typeid( *geom ) == typeid( Point ) )
82  comps.push_back( geom->getCoordinate() );
83  //if ( const Coordinate *ls=dynamic_cast<const Coordinate *>(geom) )
84  // comps.push_back(ls);
85  }
86 
87 private:
88 
89  Coordinate::ConstVect &comps;
90 
91  // Declare type as noncopyable
94 };
95 
96 } // namespace geos.geom.util
97 } // namespace geos.geom
98 } // namespace geos
99 
100 #endif //GEOS_GEOM_UTIL_COMPONENTCOORDINATEEXTRACTER_H