GEOS: PointExtracter.h Source File

- Main Page
- Namespaces
- Classes
- Files
- Related Pages

# PointExtracter.h

    00001 /**********************************************************************
    00002  * $Id: PointExtracter.h 1820 2006-09-06 16:54:23Z mloskot $
    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/geom/GeometryFilter.h>
    00021 #include <geos/geom/Point.h>
    00022 #include <geos/platform.h>
    00023 #include <vector>
    00024
    00025 namespace geos {
    00026 namespace geom { // geos.geom
    00027 namespace util { // geos.geom.util
    00028
    00032 class PointExtracter: public GeometryFilter {
    00033
    00034 private:
    00035         Point::ConstVect& comps;
    00036
    00037 public:
    00044         static void getPoints(const Geometry &geom, Point::ConstVect &ret)
    00045         {
    00046                 PointExtracter pe(ret);
    00047                 geom.apply_ro(&pe);
    00048         }
    00049
    00054         PointExtracter(Point::ConstVect& newComps)
    00055                 :
    00056                 comps(newComps)
    00057                 {}
    00058
    00059         void filter_rw(Geometry *geom)
    00060         {
    00061 if ( const Point *p=dynamic_cast<const Point *>(geom) )
    00062                 comps.push_back(p);
    00063         }
    00064
    00065         void filter_ro(const Geometry *geom)
    00066         {
    00067 if ( const Point *p=dynamic_cast<const Point *>(geom) )
    00068                 comps.push_back(p);
    00069         }
    00070
    00071 };
    00072
    00073 } // namespace geos.geom.util
    00074 } // namespace geos.geom
    00075 } // namespace geos
    00076
    00077 #endif
    00078
    00079 /**********************************************************************
    00080  * $Log$
    00081  * Revision 1.1  2006/03/09 16:46:49  strk
    00082  * geos::geom namespace definition, first pass at headers split
    00083  *
    00084  **********************************************************************/