Graphviz 16.1.0~dev.20260902.0144
Loading...
Searching...
No Matches
xlabels.h
Go to the documentation of this file.
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 v2.0
5 * which accompanies this distribution, and is available at
6 * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.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
17extern "C" {
18#endif
19
20#include <geom.h>
21#include "types.h"
22
23typedef struct {
24 pointf sz; /* Size of label (input) */
25 pointf pos; /* Position of lower-left corner of label (output) */
27 bool set;
28} xlabel_t;
29
30typedef struct {
31 pointf pos; /* Position of lower-left corner of object */
32 pointf sz; /* Size of object; may be zero for a point */
33 xlabel_t *lbl; /* Label attached to object, or NULL */
34} object_t;
35
36typedef struct {
37 boxf bb; /* Bounding box of all objects */
38 bool force;
40
41int placeLabels(object_t *objs, size_t n_objs, const 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
74typedef struct {
75 Dtlink_t link;
76 int key;
77 Leaf_t d;
78} HDict_t;
79
80typedef struct XLabels_s {
81 object_t *objs;
82 size_t n_objs;
83
84 Dt_t *hdx; // splay tree keyed with hilbert spatial codes
85 RTree_t *spdx; // rtree
86
87} XLabels_t;
88
89#endif /* XLABEL_INT */
90
91#ifdef __cplusplus
92}
93#endif
container data types API
geometric types and macros (e.g. points and boxes)
Definition index.h:55
Definition index.h:65
Definition geom.h:41
Definition cdt.h:98
bool force
if true, all labels must be placed
Definition xlabels.h:38
xlabel_t * lbl
Definition xlabels.h:33
pointf pos
Definition xlabels.h:31
pointf sz
Definition xlabels.h:32
textlabel_t * lbl
pointer to label in the graph
Definition xlabels.h:26
bool set
true if the position has been set (input/output)
Definition xlabels.h:27
pointf sz
Definition xlabels.h:24
pointf pos
Definition xlabels.h:25
graphs, nodes and edges info: Agraphinfo_t, Agnodeinfo_t and Agedgeinfo_t
int placeLabels(object_t *objs, size_t n_objs, const label_params_t *params)
Definition xlabels.c:541