Example #1
0
void
MonotoneChainIndexer::getChainStartIndices(const CoordinateSequence* pts,
	vector<int> &startIndexList)
{
	// find the startpoint (and endpoints) of all monotone chains
	// in this edge
	int start=0;
	//vector<int>* startIndexList=new vector<int>();
	startIndexList.push_back(start);
	do {
		int last=findChainEnd(pts,start);
		startIndexList.push_back(last);
		start=last;
	} while(start<(int)pts->getSize()-1);
	// copy list to an array of ints, for efficiency
	//return startIndexList;
}
/**
 * Return an array containing lists of start/end indexes of the monotone chains
 * for the given list of coordinates.
 * The last entry in the array points to the end point of the point array,
 * for use as a sentinel.
 */
void
MonotoneChainBuilder::getChainStartIndices(const CoordinateSequence *pts,
                                           vector<int>& startIndexList)
{
	// find the startpoint (and endpoints) of all monotone chains
	// in this edge
	int start = 0;
	startIndexList.push_back(start);
    const std::size_t n = pts->getSize() - 1;
	do
    {
		int last = findChainEnd(pts, start);
		startIndexList.push_back(last);
		start = last;
	} while (static_cast<std::size_t>(start) < n);

}