~ubuntu-branches/ubuntu/lucid/graphviz/lucid-updates

« back to all changes in this revision

Viewing changes to lib/topfish/hierarchy.h

  • Committer: Bazaar Package Importer
  • Author(s): Bryce Harrington
  • Date: 2008-06-19 20:23:23 UTC
  • mfrom: (1.2.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20080619202323-ls23h96ntj9ny94m
Tags: 2.18-1ubuntu1
* Merge from debian unstable, remaining changes:
  - Build depend on liblualib50-dev instead of liblua5.1-0-dev.
  - Drop libttf-dev (libttf-dev is in universe) (LP: #174749).
  - Replace gs-common with ghostscript.
  - Build-depend on python-dev instead of python2.4-dev or python2.5-dev.
  - Mention the correct python version for the python bindings in the
    package description.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* vim:set shiftwidth=4 ts=8: */
 
2
 
 
3
/**********************************************************
 
4
*      This software is part of the graphviz package      *
 
5
*                http://www.graphviz.org/                 *
 
6
*                                                         *
 
7
*            Copyright (c) 1994-2004 AT&T Corp.           *
 
8
*                and is licensed under the                *
 
9
*            Common Public License, Version 1.0           *
 
10
*                      by AT&T Corp.                      *
 
11
*                                                         *
 
12
*        Information and Software Systems Research        *
 
13
*              AT&T Research, Florham Park NJ             *
 
14
**********************************************************/
 
15
 
 
16
#ifndef _HIERARCHY_H_
 
17
#define _HIERARCHY_H_
 
18
 
 
19
#include "defs.h"
 
20
 
 
21
typedef enum {Polar,  Rectilinear, NoRescale} RescaleType;
 
22
 
 
23
typedef struct _ex_vtx_data {
 
24
        int nedges;
 
25
        int *edges;
 
26
        int size;
 
27
        int active_level;
 
28
        int globalIndex;
 
29
 
 
30
        // "logical" coordinates of node (result of algorithm):
 
31
        float x_coord;
 
32
        float y_coord;
 
33
 
 
34
        // coordinates of node after making local layout:
 
35
        float local_x_coord; 
 
36
        float local_y_coord;
 
37
 
 
38
        // actual coordinates of (active) node in drawing area  
 
39
        float physical_x_coord;
 
40
        float physical_y_coord; 
 
41
 
 
42
        // for animation
 
43
        int old_active_level;
 
44
        int new_active_level;
 
45
        float old_physical_x_coord;
 
46
        float old_physical_y_coord;
 
47
        float new_physical_x_coord;
 
48
        float new_physical_y_coord;
 
49
} ex_vtx_data;
 
50
 
 
51
 
 
52
typedef struct _Hierarchy {
 
53
        int nlevels;
 
54
        vtx_data ** graphs;
 
55
        ex_vtx_data ** geom_graphs;
 
56
        int * nvtxs;
 
57
        int * nedges;
 
58
        int ** v2cv;
 
59
        int ** cv2v;
 
60
        int maxNodeIndex;
 
61
} Hierarchy;
 
62
 
 
63
void release(Hierarchy*);
 
64
Hierarchy* create_hierarchy(vtx_data * graph, int nvtxs, int nedges, 
 
65
    ex_vtx_data* geom_graph, int ngeom_edges, int min_nvtxs);
 
66
        
 
67
void set_active_levels(Hierarchy*, int*, int);
 
68
void set_horizontal_active_level(Hierarchy* hierarchy, int cur_level);                                  
 
69
double find_closest_active_node(Hierarchy*, double x, double y, int*);
 
70
int find_leftmost_descendant(Hierarchy*, int node, int level, int min_level);
 
71
 
 
72
int extract_active_logical_coords(Hierarchy * hierarchy, int node, int level, 
 
73
    double *x_coords, double *y_coords, int counter);
 
74
int set_active_physical_coords(Hierarchy *, int node, int level,
 
75
    double *x_coords, double *y_coords, int counter);
 
76
 
 
77
// For animation
 
78
int extract_new_active_logical_coords(Hierarchy *, int node, int level, 
 
79
    double *x_coords, double *y_coords, int counter);
 
80
int set_new_active_physical_coords(Hierarchy * hierarchy, int node, int level,
 
81
    double *x_coords, double *y_coords, int counter);
 
82
void derive_old_new_active_physical_coords(Hierarchy *, int, int , 
 
83
    double new_x, double new_y, double old_x, double old_y);
 
84
int count_active_nodes(Hierarchy *);
 
85
 
 
86
// creating a geometric graph:
 
87
int init_ex_graph(vtx_data * graph1, vtx_data * graph2, int n,
 
88
   double *x_coords, double *y_coords, ex_vtx_data ** gp);
 
89
 
 
90
vtx_data *delaunay_triangulation(double *x, double *y, int n);
 
91
 
 
92
vtx_data *UG_graph(double *x, double *y, int n, int accurate_computation);
 
93
 
 
94
// layout distortion:
 
95
void rescale_layout(double *x_coords, double *y_coords,
 
96
    int n, int interval, int ClientWidth, int ClientHeight,
 
97
    int margin);
 
98
 
 
99
void rescale_layout_polar(double * x_coords, double * y_coords, 
 
100
    double * x_foci, double * y_foci, int num_foci,
 
101
    int n, int interval, int ClientWidth, int ClientHeight, int margin);
 
102
 
 
103
void find_physical_coords(Hierarchy*, int, int, double *x, double *y);
 
104
void find_new_physical_coords(Hierarchy*, int, int, double *x, double *y);
 
105
void find_old_physical_coords(Hierarchy*, int, int, double *x, double *y);
 
106
int find_active_ancestor(Hierarchy*, int, int, int*);
 
107
int locateByIndex(Hierarchy*, int, int*, int*);
 
108
int findGlobalIndexesOfActiveNeighbors(Hierarchy*, int, int**);
 
109
 
 
110
void freeGraph(vtx_data * graph);
 
111
 
 
112
#endif