blob: 0a404845e7fa8707ab802574c8a0a3d7cb5f7e39 [file] [log] [blame]
Zhenkai Zhu5c6ad572012-06-04 19:50:08 -07001#include "treelayout.h"
2
3void
4OneLevelTreeLayout::setOneLevelLayout(std::vector<Coordinate> &childNodesCo)
5{
6 if (childNodesCo.empty())
7 {
8 return;
9 }
10 double y = getLevelDistance();
11 double sd = getSiblingDistance();
12 int n = childNodesCo.size();
13 double x = - (n - 1) * sd / 2;
14 for (int i = 0; i < n; i++)
15 {
16 childNodesCo[i].x = x;
17 childNodesCo[i].y = y;
18 x += sd;
19 }
20}