Zhenkai Zhu | 5c6ad57 | 2012-06-04 19:50:08 -0700 | [diff] [blame] | 1 | #include "treelayout.h" |
2 | |||||
3 | void | ||||
4 | OneLevelTreeLayout::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 | } |