GEOS  3.3.3
ComponentCoordinateExtracter.h
1 /**********************************************************************
2  * $Id: ComponentCoordinateExtracter.h 2772 2009-12-03 19:30:54Z mloskot $
3  *
4  * GEOS - Geometry Engine Open Source
5  * http://geos.refractions.net
6  *
7  * Copyright (C) 2001-2002 Vivid Solutions Inc.
8  * Copyright (C) 2006 Refractions Research Inc.
9  *
10  * This is free software; you can redistribute and/or modify it under
11  * the terms of the GNU Lesser General Public Licence as published
12  * by the Free Software Foundation.
13  * See the COPYING file for more information.
14  *
15  **********************************************************************/
16 
17 #ifndef GEOS_GEOM_UTIL_COMPONENTCOORDINATEEXTRACTER_H
18 #define GEOS_GEOM_UTIL_COMPONENTCOORDINATEEXTRACTER_H
19 
20 #include <vector>
21 
22 #include <geos/geom/GeometryComponentFilter.h>
23 #include <geos/geom/Geometry.h> // to be removed when we have the .inl
24 #include <geos/geom/Coordinate.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/geom/Point.h> // to be removed when we have the .inl
27 //#include <geos/platform.h>
28 
29 namespace geos {
30 namespace geom { // geos::geom
31 namespace util { // geos::geom::util
32 
40 {
41 public:
49  static void getCoordinates(const Geometry &geom, std::vector<const Coordinate*> &ret)
50  {
52  geom.apply_ro(&cce);
53  }
54 
59  ComponentCoordinateExtracter( std::vector<const Coordinate*> &newComps)
60  :
61  comps(newComps)
62  {}
63 
64  void filter_rw( Geometry * geom)
65  {
69  comps.push_back( geom->getCoordinate() );
70  //if ( typeid( *geom ) == typeid( LineString )
71  // || typeid( *geom ) == typeid( Point ) )
72  //if ( const Coordinate *ls=dynamic_cast<const Coordinate *>(geom) )
73  // comps.push_back(ls);
74  }
75 
76  void filter_ro( const Geometry * geom)
77  {
78  //if ( typeid( *geom ) == typeid( LineString )
79  // || typeid( *geom ) == typeid( Point ) )
83  comps.push_back( geom->getCoordinate() );
84  //if ( const Coordinate *ls=dynamic_cast<const Coordinate *>(geom) )
85  // comps.push_back(ls);
86  }
87 
88 private:
89 
90  Coordinate::ConstVect &comps;
91 
92  // Declare type as noncopyable
95 };
96 
97 } // namespace geos.geom.util
98 } // namespace geos.geom
99 } // namespace geos
100 
101 #endif //GEOS_GEOM_UTIL_COMPONENTCOORDINATEEXTRACTER_H
102 
103 /**********************************************************************
104  * $Log$
105  *
106  **********************************************************************/