⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 segmentintersectiontester.cpp

📁 在Linux下做的QuadTree的程序
💻 CPP
字号:
/********************************************************************** * $Id: SegmentIntersectionTester.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: operation/predicate/SegmentIntersectionTester.java rev. 1.6 * (JTS-1.7) * **********************************************************************/#include <geos/operation/predicate/SegmentIntersectionTester.h>#include <geos/geom/LineString.h>#include <geos/geom/CoordinateSequence.h>#include <geos/algorithm/LineIntersector.h>using namespace geos::geom;namespace geos {namespace operation {namespace predicate {boolSegmentIntersectionTester::hasIntersectionWithLineStrings(	const CoordinateSequence &seq,	const LineString::ConstVect& lines){	for (size_t i=0, n=lines.size(); i<n; ++i )	{		const LineString *line = lines[i];		hasIntersection(seq, *(line->getCoordinatesRO()));		if (hasIntersectionVar) break;	}	return hasIntersectionVar;}boolSegmentIntersectionTester::hasIntersection(	const CoordinateSequence &seq0, const CoordinateSequence &seq1){	for (unsigned i=1, ni=seq0.getSize(); i<ni; ++i)	{		const Coordinate &pt00 = seq0.getAt(i - 1);		const Coordinate &pt01 = seq0.getAt(i);		for (unsigned j=1, nj=seq1.getSize(); j<nj; ++j)		{			const Coordinate &pt10 = seq1.getAt(j-1);			const Coordinate &pt11 = seq1.getAt(j); 			li.LineIntersector::computeIntersection(pt00, pt01,				pt10, pt11);			if (li.hasIntersection())			{				hasIntersectionVar = true;				goto out_of_loop;			}		}	}	out_of_loop:	return hasIntersectionVar;}} // namespace predicate} // namespace operation} // namespace geos

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -