1/* vim:set shiftwidth=4 ts=8: */
2
3/*************************************************************************
4 * Copyright (c) 2011 AT&T Intellectual Property
5 * All rights reserved. This program and the accompanying materials
6 * are made available under the terms of the Eclipse Public License v1.0
7 * which accompanies this distribution, and is available at
8 * http://www.eclipse.org/legal/epl-v10.html
9 *
10 * Contributors: See CVS logs. Details at http://www.graphviz.org/
11 *************************************************************************/
12
13#ifndef XLABELS_H
14#define XLABELS_H
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
20#include <geom.h>
21
22typedef struct {
23 pointf sz; /* Size of label (input) */
24 pointf pos; /* Position of lower-left corner of label (output) */
25 void *lbl; /* Pointer to label in the graph */
26 unsigned char set; /* True if the position has been set (input/output) */
27} xlabel_t;
28
29typedef struct {
30 pointf pos; /* Position of lower-left corner of object */
31 pointf sz; /* Size of object; may be zero for a point */
32 xlabel_t *lbl; /* Label attached to object, or NULL */
33} object_t;
34
35typedef struct {
36 boxf bb; /* Bounding box of all objects */
37 unsigned char force; /* If true, all labels must be placed */
38} label_params_t;
39
40int placeLabels(object_t * objs, int n_objs,
41 xlabel_t * lbls, int n_lbls, label_params_t * params);
42
43#ifdef XLABEL_INT
44#include <index.h>
45#include <logic.h>
46#include <cdt.h>
47
48#ifndef XLNDSCALE
49#define XLNDSCALE 72.0
50#endif /*XLNDSCALE*/
51#ifndef XLNBR
52#define XLNBR 9
53#endif /*XLNBR*/
54#ifndef XLXDENOM
55#define XLXDENOM 8
56#endif /*XLXDENOM*/
57#ifndef XLYDENOM
58#define XLYDENOM 2
59#endif /*XLYDENOM*/
60#define XLNBR 9
61#define XLCNR 4
62#define XLNDSCALE 72.0
63#define XLODCR -1
64// indexes of neighbors in certain arrays
65// the node of interest is usually in node 4
66// 6 7 8
67// 3 4 5
68// 0 1 2
69#define XLPXPY 0
70#define XLCXPY 1
71#define XLNXPY 2
72#define XLPXCY 3
73#define XLCXCY 4
74#define XLNXCY 5
75#define XLPXNY 6
76#define XLCXNY 7
77#define XLNXNY 8
78 typedef struct best_p_s {
79 int n;
80 double area;
81 pointf pos;
82} BestPos_t;
83
84typedef struct obyh {
85 Dtlink_t link;
86 int key;
87 Leaf_t d;
88} HDict_t;
89
90typedef struct XLabels_s {
91 object_t *objs;
92 int n_objs;
93 xlabel_t *lbls;
94 int n_lbls;
95 label_params_t *params;
96
97 Dt_t *hdx; // splay tree keyed with hilbert spatial codes
98 RTree_t *spdx; // rtree
99
100} XLabels_t;
101
102#endif /* XLABEL_INT */
103
104#ifdef __cplusplus
105}
106#endif
107
108#endif /*XLABELS_H */
109