Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

PointExtracter.h

00001 /**********************************************************************
00002  * $Id: PointExtracter.h 2556 2009-06-06 22:22:28Z strk $
00003  *
00004  * GEOS - Geometry Engine Open Source
00005  * http://geos.refractions.net
00006  *
00007  * Copyright (C) 2001-2002 Vivid Solutions Inc.
00008  * Copyright (C) 2006 Refractions Research Inc.
00009  *
00010  * This is free software; you can redistribute and/or modify it under
00011  * the terms of the GNU Lesser General Public Licence as published
00012  * by the Free Software Foundation. 
00013  * See the COPYING file for more information.
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 { // geos.geom
00028 namespace util { // geos.geom.util
00029 
00033 class GEOS_DLL PointExtracter: public GeometryFilter {
00034 
00035 private:
00036         Point::ConstVect& comps;
00037 
00038 public:
00045         static void getPoints(const Geometry &geom, Point::ConstVect &ret)
00046         {
00047                 PointExtracter pe(ret);
00048                 geom.apply_ro(&pe);
00049         }
00050 
00055         PointExtracter(Point::ConstVect& newComps)
00056                 :
00057                 comps(newComps)
00058                 {}
00059 
00060         void filter_rw(Geometry *geom)
00061         {
00062 if ( const Point *p=dynamic_cast<const Point *>(geom) )
00063                 comps.push_back(p);
00064         }
00065 
00066         void filter_ro(const Geometry *geom)
00067         {
00068 if ( const Point *p=dynamic_cast<const Point *>(geom) )
00069                 comps.push_back(p);
00070         }
00071 
00072 };
00073 
00074 } // namespace geos.geom.util
00075 } // namespace geos.geom
00076 } // namespace geos
00077 
00078 #endif
00079 
00080 /**********************************************************************
00081  * $Log$
00082  * Revision 1.1  2006/03/09 16:46:49  strk
00083  * geos::geom namespace definition, first pass at headers split
00084  *
00085  **********************************************************************/

Generated on Thu Jun 11 06:17:01 2009 for GEOS by  doxygen 1.4.4