[geos-commits] r3358 - trunk/src/noding
svn_geos at osgeo.org
svn_geos at osgeo.org
Thu May 12 03:21:23 EDT 2011
Author: strk
Date: 2011-05-12 00:21:23 -0700 (Thu, 12 May 2011)
New Revision: 3358
Modified:
trunk/src/noding/MCIndexSegmentSetMutualIntersector.cpp
Log:
Reserve vector space, use ::size_type for vector indices.
Modified: trunk/src/noding/MCIndexSegmentSetMutualIntersector.cpp
===================================================================
--- trunk/src/noding/MCIndexSegmentSetMutualIntersector.cpp 2011-05-12 07:18:07 UTC (rev 3357)
+++ trunk/src/noding/MCIndexSegmentSetMutualIntersector.cpp 2011-05-12 07:21:23 UTC (rev 3358)
@@ -32,18 +32,18 @@
namespace geos {
namespace noding { // geos::noding
-//
-// private:
-//
+/*private*/
void
MCIndexSegmentSetMutualIntersector::addToIndex(SegmentString* segStr)
{
- std::vector<MonotoneChain*> segChains;
+ MonoChains segChains;
MonotoneChainBuilder::getChains(segStr->getCoordinates(),
segStr, segChains);
- for (std::size_t i = 0, n = segChains.size(); i < n; i++)
+ MonoChains::size_type n = segChains.size();
+ chainStore.reserve(chainStore.size() + n);
+ for (MonoChains::size_type i = 0; i < n; i++)
{
MonotoneChain * mc = segChains[i];
mc->setId(indexCounter++);
@@ -52,6 +52,7 @@
}
}
+/*private*/
void
MCIndexSegmentSetMutualIntersector::intersectChains()
{
@@ -84,7 +85,9 @@
MonotoneChainBuilder::getChains(segStr->getCoordinates(),
segStr, segChains);
- for (MonoChains::size_type i = 0, ni = segChains.size(); i < ni; i++)
+ MonoChains::size_type n = segChains.size();
+ monoChains.reserve(monoChains.size() + n);
+ for (MonoChains::size_type i = 0; i < n; i++)
{
MonotoneChain* mc = segChains[i];
mc->setId( processCounter++ );
@@ -92,10 +95,7 @@
}
}
-//
-// public:
-//
-
+/* public */
MCIndexSegmentSetMutualIntersector::MCIndexSegmentSetMutualIntersector()
: monoChains(),
index(new geos::index::strtree::STRtree()),
@@ -105,23 +105,23 @@
{
}
+/* public */
MCIndexSegmentSetMutualIntersector::~MCIndexSegmentSetMutualIntersector()
{
delete index;
- for (MonoChains::iterator it = chainStore.begin(), end = chainStore.end();
- it != end; ++it)
- {
- delete *it;
+ MonoChains::iterator i, e;
+
+ for (i = chainStore.begin(), e = chainStore.end(); i != e; ++i) {
+ delete *i;
}
- for (MonoChains::iterator i = monoChains.begin(), e = monoChains.end();
- i != e; i++)
- {
+ for (i = monoChains.begin(), e = monoChains.end(); i != e; i++) {
delete *i;
}
}
+/* public */
void
MCIndexSegmentSetMutualIntersector::setBaseSegments(SegmentString::ConstVect* segStrings)
{
@@ -149,7 +149,7 @@
}
monoChains.clear();
- for (std::size_t i = 0, n = segStrings->size(); i < n; i++)
+ for (SegmentString::ConstVect::size_type i = 0, n = segStrings->size(); i < n; i++)
{
SegmentString * seg = (SegmentString *)((*segStrings)[i]);
addToMonoChains( seg);
@@ -158,6 +158,7 @@
}
+/* public */
void
MCIndexSegmentSetMutualIntersector::SegmentOverlapAction::overlap(
MonotoneChain& mc1, size_t start1, MonotoneChain& mc2, size_t start2)
@@ -171,7 +172,3 @@
} // geos::noding
} // geos
-/**********************************************************************
- * $Log$
- *
- **********************************************************************/
More information about the geos-commits
mailing list