Debian Codegraph @

lib/label/xlabels.h

raw
1 /*************************************************************************
2 * Copyright (c) 2011 AT&T Intellectual Property
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * https://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors: Details at https://graphviz.org
9 *************************************************************************/
10
11 #pragma once
12
13 #include <stdbool.h>
14 #include <stddef.h>
15
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19
20 #include <geom.h>
21
22 typedef 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
29 typedef 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
35 typedef struct {
36 boxf bb; /* Bounding box of all objects */
37 bool force; ///< if true, all labels must be placed
38 } label_params_t;
39
40 int placeLabels(object_t *objs, size_t n_objs, xlabel_t *lbls, size_t n_lbls,
41 label_params_t *params);
42
43 #ifdef XLABEL_INT
44 #include <label/index.h>
45 #include <cdt.h>
46
47 #ifndef XLXDENOM
48 #define XLXDENOM 8
49 #endif /*XLXDENOM*/
50 #ifndef XLYDENOM
51 #define XLYDENOM 2
52 #endif /*XLYDENOM*/
53 #define XLNBR 9
54 // indexes of neighbors in certain arrays
55 // the node of interest is usually in node 4
56 // 6 7 8
57 // 3 4 5
58 // 0 1 2
59 #define XLPXPY 0
60 #define XLCXPY 1
61 #define XLNXPY 2
62 #define XLPXCY 3
63 #define XLCXCY 4
64 #define XLNXCY 5
65 #define XLPXNY 6
66 #define XLCXNY 7
67 #define XLNXNY 8
68 typedef struct best_p_s {
69 int n;
70 double area;
71 pointf pos;
72 } BestPos_t;
73
74 typedef struct obyh {
75 Dtlink_t link;
76 int key;
77 Leaf_t d;
78 } HDict_t;
79
80 typedef struct XLabels_s {
81 object_t *objs;
82 size_t n_objs;
83 xlabel_t *lbls;
84 size_t n_lbls;
85 label_params_t *params;
86
87 Dt_t *hdx; // splay tree keyed with hilbert spatial codes
88 RTree_t *spdx; // rtree
89
90 } XLabels_t;
91
92 #endif /* XLABEL_INT */
93
94 #ifdef __cplusplus
95 }
96 #endif