Exemplo n.º 1
0
bool operator==(Polyline const& lhs, Polyline const& rhs)
{
	if (lhs.getNumberOfPoints() != rhs.getNumberOfPoints())
		return false;

	const size_t n(lhs.getNumberOfPoints());
	for (size_t k(0); k < n; k++)
	{
		if (lhs.getPointID(k) != rhs.getPointID(k))
			return false;
	}

	return true;
}
Exemplo n.º 2
0
Polyline::Polyline(const Polyline& ply) : GeoObject(), _ply_pnts(ply._ply_pnts)
{
	for (size_t k(0); k < ply.getNumberOfPoints(); ++k)
		_ply_pnt_ids.push_back(ply.getPointID(k));

	if (ply.getNumberOfPoints() > 0)
		for (size_t k(0); k < ply.getNumberOfPoints(); ++k)
			_length.push_back(ply.getLength(k));
}
Exemplo n.º 3
0
bool containsEdge(const Polyline& ply, size_t id0, size_t id1)
{
	if (id0 == id1)
	{
		std::cerr << "no valid edge id0 == id1 == " << id0 << "\n";
		return false;
	}
	if (id0 > id1)
		BASELIB::swap(id0, id1);
	const size_t n(ply.getNumberOfPoints() - 1);
	for (size_t k(0); k < n; k++)
	{
		size_t ply_pnt0(ply.getPointID(k));
		size_t ply_pnt1(ply.getPointID(k + 1));
		if (ply_pnt0 > ply_pnt1)
			BASELIB::swap(ply_pnt0, ply_pnt1);
		if (ply_pnt0 == id0 && ply_pnt1 == id1)
			return true;
	}
	return false;
}