示例#1
0
void DrawTrail(const Trail& tr, const Graph& g)
{
  if (tr.empty())
  {
    return;
  }

  int prev = tr[0];

  for (unsigned int i = 1; i < tr.size(); i++)
  {
    const GraphEdge& edge = g.GetEdge(tr[i], prev);
    prev = tr[i];
    DrawEdge(edge, g);
  }
}
示例#2
0
void doExport()
{
	Map *map = new Map(gDefaultMap);
	map->Scale(512, 512);
	msa = new MapSectorAbstraction(map, 8);
	msa->ToggleDrawAbstraction(1);
	Graph *g = msa->GetAbstractGraph(1);
	printf("g\n%d %d\n", g->GetNumNodes(), g->GetNumEdges());
	for (int x = 0; x < g->GetNumNodes(); x++)
	{
		node *n = g->GetNode(x);
		int x1, y1;
		msa->GetTileFromNode(n, x1, y1);
		printf("%d %d %d\n", x, x1, y1);
	}
	for (int x = 0; x < g->GetNumEdges(); x++)
	{
		edge *e = g->GetEdge(x);
		printf("%d %d\n", e->getFrom(), e->getTo());//, (int)(100.0*e->GetWeight())); // %d 0
	}
	exit(0);
}