### Profile

Statistics
| Branch: | Revision:

## root / src / layout / startreeembedding.h @ 8aeaaccc

1 2 3 01873262 Georg Kunz ```//========================================================================= ``` ```// STARTREEEMBEDDING.H - part of ``` ```// OMNeT++/OMNEST ``` ```// Discrete System Simulation in C++ ``` ```// ``` ```// Author: Levente Meszaros ``` ```// ``` ```//========================================================================= ``` ```/*--------------------------------------------------------------* ``` ``` Copyright (C) 2006-2008 OpenSim Ltd. ``` ``` ``` ``` This file is distributed WITHOUT ANY WARRANTY. See the file ``` ``` `license' for details on this and other legal matters. ``` ```*--------------------------------------------------------------*/ ``` ```#ifndef __STARTREEEMBEDDING_H_ ``` ```#define __STARTREEEMBEDDING_H_ ``` ```#include "vector" ``` ```#include "geometry.h" ``` ```#include "graphcomponent.h" ``` ```NAMESPACE_BEGIN ``` ```/** ``` ``` * This is a planar graph embedding for a connected graph component with spanning tree. ``` ``` * ``` ``` * Vertices are positioned recursively accoring to the spanning tree as follows. ``` ``` * The parent vertex is positioned in the center and its sub trees are positioned around it. ``` ``` * The parent vertex and each subtree is modelled with a circle and the circles ``` ``` * are positioned on the plane by putting one circle next to two already positioned ones. ``` ``` * The best circle position for a child subtree circle is the one which minimizes the distance ``` ``` * from the parent circle. When all child subtrees are positioned the parent tree is wrapped ``` ``` * by the smallest radius circle. ``` ``` * ``` ``` * The second pass rotates the subtree circles in place to move the weight point of the subtree ``` ``` * opposite to the parent. ``` ``` * ``` ``` * The resulting embedding will not have overlapping vertices. ``` ``` */ ``` ```class StarTreeEmbedding ``` ```{ ``` ``` public: ``` ``` /** ``` ``` * Minimum distance between vertices ``` ``` */ ``` ``` double vertexSpacing; ``` ``` private: ``` ``` /** ``` ``` * A connected graph component which must have a spanning tree. ``` ``` */ ``` ``` GraphComponent *graphComponent; ``` ``` public: ``` ``` StarTreeEmbedding(GraphComponent *graphComponent, double vertexSpacing); ``` ``` void embed(); ``` ``` private: ``` ``` /** ``` ``` * Calculates center coordinates relative to parents. ``` ``` */ ``` ``` void calculateCenter(); ``` ``` void calculateCenterRecursive(Vertex *vertex); ``` ``` /** ``` ``` * Rotate the child subtrees to have the weight point opposite to the parent. ``` ``` */ ``` ``` void rotateCenter(); ``` ``` void rotateCenterRecursive(Vertex *vertex); ``` ``` /** ``` ``` * Calculates absolute positions. ``` ``` */ ``` ``` void calculatePosition(); ``` ``` void calculatePositionRecursive(Vertex *vertex, Pt pt); ``` ```}; ``` ```NAMESPACE_END ``` `#endif`