blob: c1fecf304c71c48aefe31810fb4bfc9de9b2c02b [file] [log] [blame]
Yingdi Yu7989eb22013-10-31 17:38:22 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
2/*
3 * Copyright (c) 2013, Regents of the University of California
4 * Yingdi Yu
5 *
6 * BSD license, See the LICENSE file for more information
7 *
8 * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
9 * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
10 */
11
Zhenkai Zhu5c6ad572012-06-04 19:50:08 -070012#include "treelayout.h"
13
14void
15OneLevelTreeLayout::setOneLevelLayout(std::vector<Coordinate> &childNodesCo)
16{
17 if (childNodesCo.empty())
18 {
19 return;
20 }
21 double y = getLevelDistance();
22 double sd = getSiblingDistance();
23 int n = childNodesCo.size();
24 double x = - (n - 1) * sd / 2;
25 for (int i = 0; i < n; i++)
26 {
27 childNodesCo[i].x = x;
28 childNodesCo[i].y = y;
29 x += sd;
30 }
31}