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

PreparedLineStringIntersects.h

00001 /**********************************************************************
00002  * $Id: PreparedLineStringIntersects.h 2418 2009-04-29 08:15:21Z strk $
00003  *
00004  * GEOS - Geometry Engine Open Source
00005  * http://geos.refractions.net
00006  *
00007  * Copyright (C) 2006 Refractions Research Inc.
00008  *
00009  * This is free software; you can redistribute and/or modify it under
00010  * the terms of the GNU Lesser General Public Licence as published
00011  * by the Free Software Foundation. 
00012  * See the COPYING file for more information.
00013  *
00014  *
00015  **********************************************************************
00016  *
00017  * Last port: geom/prep/PreparedLineStringIntersects.java rev 1.2 (JTS-1.10)
00018  *
00019  **********************************************************************/
00020 
00021 #ifndef GEOS_GEOM_PREP_PREPAREDLINESTRINGINTERSECTS_H
00022 #define GEOS_GEOM_PREP_PREPAREDLINESTRINGINTERSECTS_H
00023 
00024 #include <geos/geom/prep/PreparedLineString.h>
00025 #include <geos/algorithm/PointLocator.h> 
00026 #include <geos/geom/util/ComponentCoordinateExtracter.h> 
00027 #include <geos/geom/Coordinate.h> 
00028 #include <geos/noding/SegmentStringUtil.h>
00029 
00030 using namespace geos::algorithm;
00031 using namespace geos::geom::util;
00032 
00033 namespace geos {
00034 namespace geom { // geos::geom
00035 namespace prep { // geos::geom::prep
00036 
00048 class PreparedLineStringIntersects
00049 {
00050 private:
00051 protected:
00052         PreparedLineString & prepLine;
00053         //PreparedLineString * prepLine;
00054 
00063         bool isAnyTestPointInTarget(const geom::Geometry * testGeom) const;
00064         //{
00065         //      /**
00066         //       * This could be optimized by using the segment index on the lineal target.
00067         //       * However, it seems like the L/P case would be pretty rare in practice.
00068         //       */
00069         //      PointLocator * locator = new PointLocator();
00070 
00071         //      geom::Coordinate::ConstVect coords;
00072         //      ComponentCoordinateExtracter::getCoordinates( *testGeom, coords);
00073 
00074         //      for (size_t i=0, n=coords.size(); i<n; i++)
00075         //      {
00076         //              geom::Coordinate c = *(coords[i]);
00077         //              if ( locator->intersects( c, &(prepLine->getGeometry()) ))
00078         //                      return true;
00079         //      }
00080         //      return false;
00081         //}
00082 
00083 
00084 public:
00085 
00094         static bool intersects(  PreparedLineString & prep, const geom::Geometry * geom ) 
00095         {
00096                 PreparedLineStringIntersects * op = new PreparedLineStringIntersects( prep);
00097                 return op->intersects( geom);
00098         }
00099 
00103         PreparedLineStringIntersects(PreparedLineString & prep) 
00104                 : prepLine( prep)
00105         { }
00106 
00113         bool intersects(const geom::Geometry * g) const;
00114 
00115 };
00116 
00117 
00118 
00119 } // namespace geos::geom::prep
00120 } // namespace geos::geom
00121 } // namespace geos
00122 
00123 #endif // GEOS_GEOM_PREP_PREPAREDLINESTRINGINTERSECTS_H
00124 /**********************************************************************
00125  * $Log$
00126  **********************************************************************/
00127 

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