Ejemplo n.º 1
0
void DotGraphInput::edge(idSet &src, edgeSet &edges)
{
	idSet dst;
	Attributes attr;
	Vertex *v;
	Edge *e;

	nextToken();

	switch (_token) {
		case ID:
			v = addVertex(_id);
			setVertexAttributes(v, _nodeAttributes);
			dst.insert(_id);
			nodeId();
			break;
		case SUBGRAPH:
		case LBRC:
			subgraph(dst);
			break;
		default:
			error();
			return;
	}

	for (idSet::iterator i = src.begin(); i != src.end(); i++) {
		for (idSet::iterator j = dst.begin(); j != dst.end(); j++) {
			if (*i == *j) {
				error();
				return;
			}
			e = addEdge(*i, *j);
			setEdgeAttributes(e, _edgeAttributes);
			edges.insert(e);
		}
	}

	if (_token == EDGEOP)
		edge(dst, edges);
	if (_token == LBRK)
		attributeList(attr);

	for (edgeSet::iterator i = edges.begin(); i != edges.end(); i++)
		setEdgeAttributes(*i, attr);
}
Ejemplo n.º 2
0
void Delaunay::HandleEdge(const vertex * p0, const vertex * p1, edgeSet& edges)
{
	const vertex * pV0(NULL);
	const vertex * pV1(NULL);

	if (* p0 < * p1)
	{
		pV0 = p0;
		pV1 = p1;
	}
	else
	{
		pV0 = p1;
		pV1 = p0;
	}

	// Insert a normalized edge. If it's already in edges, insertion will fail,
	// thus leaving only unique edges.
	edges.insert(edge(pV0, pV1));
}