Project

General

Profile

Statistics
| Branch: | Revision:

root / src / layout / heapembedding.h @ 8aeaaccc

History | View | Annotate | Download (1.83 KB)

1 01873262 Georg Kunz
//=========================================================================
2
//  HEAPEMBEDDING.H - part of
3
//                  OMNeT++/OMNEST
4
//           Discrete System Simulation in C++
5
//
6
//  Author: Levente Meszaros
7
//
8
//=========================================================================
9
10
/*--------------------------------------------------------------*
11
  Copyright (C) 2006-2008 OpenSim Ltd.
12

13
  This file is distributed WITHOUT ANY WARRANTY. See the file
14
  `license' for details on this and other legal matters.
15
*--------------------------------------------------------------*/
16
17
#ifndef __HEAPEMBEDDING_H_
18
#define __HEAPEMBEDDING_H_
19
20
#include "vector"
21
#include "geometry.h"
22
#include "graphcomponent.h"
23
24
NAMESPACE_BEGIN
25
26
/**
27
 * This is a planar graph embedding for a connected graph component with spanning tree.
28
 *
29
 * Vertices are positioned in the component's spanning tree traversal order.
30
 * A list of availabe positions are kept during the embedding and vertices are positioned
31
 * to the best position with one of their side center point. The best position is the one
32
 * which minimizes the length of the edges to already positioned neighbours.
33
 * When a vertex is positioned its side center points are added to the list of availabe points.
34
 *
35
 * The resulting embedding will not have overlapping vertices.
36
 */
37
class HeapEmbedding
38
{
39
    public:
40
        /**
41
         * Minimum distance between vertices
42
         */
43
        double vertexSpacing;
44
45
    private:
46
        /**
47
         * A connected graph component which must have a spanning tree.
48
         */
49
        GraphComponent *graphComponent;
50
51
    public:
52
        HeapEmbedding(GraphComponent *graphComponent, double vertexSpacing);
53
        void embed();
54
55
    private:
56
        void pushPtUnlessRcsContains(std::vector<Pt>& pts, const std::vector<Rc>& circles, const Pt& pt);
57
};
58
59
NAMESPACE_END
60
61
62
#endif
63