1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
/**********************************************************************
* $Id: ShortCircuitedGeometryVisitor.cpp 1820 2006-09-06 16:54:23Z mloskot $
*
* GEOS - Geometry Engine Open Source
* http://geos.refractions.net
*
* Copyright (C) 2006 Refractions Research Inc.
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU Lesser General Public Licence as published
* by the Free Software Foundation.
* See the COPYING file for more information.
*
**********************************************************************
*
* Last port: geom/util/ShortCircuitedGeometryVisitor.java rev. 1.1 (JTS-1.7)
*
**********************************************************************/
#include <geos/geom/util/ShortCircuitedGeometryVisitor.h>
#include <geos/geom/Geometry.h>
#include <geos/geom/GeometryCollection.h>
using namespace geos::geom;
namespace geos {
namespace geom { // geos.geom
namespace util { // geos.geom.util
void
ShortCircuitedGeometryVisitor::applyTo(const Geometry &geom)
{
for (unsigned int i=0, n=geom.getNumGeometries(); i<n; ++i)
{
const Geometry *element = geom.getGeometryN(i);
if (dynamic_cast<const GeometryCollection*>(element))
{
applyTo(*element);
}
else
{
// calls the abstract virtual
visit(*element);
if (isDone()) done = true;
}
if ( done ) return;
}
}
} // namespace geos.geom.util
} // namespace geos.geom
} // namespace geos
|