• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List

LinearComponentExtracter.h

00001 /**********************************************************************
00002  * $Id: LinearComponentExtracter.h 2772 2009-12-03 19:30:54Z 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_LINEARCOMPONENTEXTRACTER_H
00018 #define GEOS_GEOM_UTIL_LINEARCOMPONENTEXTRACTER_H
00019 
00020 
00021 #include <geos/export.h>
00022 #include <vector>
00023 
00024 #include <geos/geom/GeometryComponentFilter.h>
00025 #include <geos/geom/Geometry.h> // to be removed when we have the .inl
00026 #include <geos/geom/LineString.h> // to be removed when we have the .inl
00027 //#include <geos/platform.h>
00028 
00029 namespace geos {
00030 namespace geom { // geos.geom
00031 namespace util { // geos.geom.util
00032 
00036 class GEOS_DLL LinearComponentExtracter: public GeometryComponentFilter {
00037 
00038 private:
00039 
00040         LineString::ConstVect &comps;
00041 
00042     // Declare type as noncopyable
00043     LinearComponentExtracter(const LinearComponentExtracter& other);
00044     LinearComponentExtracter& operator=(const LinearComponentExtracter& rhs);
00045 
00046 public:
00054         static void getLines(const Geometry &geom, std::vector<const LineString*> &ret)
00055         {
00056                 LinearComponentExtracter lce(ret);
00057                 geom.apply_ro(&lce);
00058         }
00059 
00064         LinearComponentExtracter(std::vector<const LineString*> &newComps)
00065                 :
00066                 comps(newComps)
00067                 {}
00068 
00069         void filter_rw(Geometry *geom)
00070         {
00071 if ( const LineString *ls=dynamic_cast<const LineString *>(geom) )
00072                 comps.push_back(ls);
00073         }
00074 
00075         void filter_ro(const Geometry *geom)
00076         {
00077 if ( const LineString *ls=dynamic_cast<const LineString *>(geom) )
00078                 comps.push_back(ls);
00079         }
00080 
00081 };
00082 
00083 } // namespace geos.geom.util
00084 } // namespace geos.geom
00085 } // namespace geos
00086 
00087 #endif
00088 
00089 /**********************************************************************
00090  * $Log$
00091  * Revision 1.1  2006/03/09 16:46:49  strk
00092  * geos::geom namespace definition, first pass at headers split
00093  *
00094  **********************************************************************/

Generated on Thu Jul 22 2010 for GEOS by  doxygen 1.7.1