Debian Codegraph @

pencil/include/pencil_rel_label_layouter.h

raw
1 /* File: pencil_rel_label_layouter.h; Copyright and License: see below */
2
3 #ifndef PENCIL_REL_LABEL_LAYOUTER_H
4 #define PENCIL_REL_LABEL_LAYOUTER_H
5
6 /* public file for the doxygen documentation: */
7 /*!
8 * \file
9 * \brief Calculates the label positions of relationships in a diagram
10 */
11
12 #include "pencil_size.h"
13 #include "layout/layout_visible_set.h"
14 #include "pencil_floating_label_layouter.h"
15 #include "draw/draw_relationship_label.h"
16 #include "geometry/geometry_rectangle.h"
17 #include "set/data_profile_part.h"
18 #include "set/data_small_set.h"
19 #include "set/data_visible_set.h"
20 #include "entity/data_diagram.h"
21 #include "entity/data_id.h"
22 #include "u8list/universal_array_index_sorter.h"
23 #include <cairo.h>
24 #include <stdint.h>
25
26 /*!
27 * \brief attributes of the relationship-label layouter
28 *
29 * \note The layout_data, pencil_size and profile objects are stateful.
30 * pencil_rel_label_layouter_t may either be instantiated once and re-used many times (call re-inint in between)
31 * or be instantiated per use.
32 */
33 struct pencil_rel_label_layouter_struct {
34 layout_visible_set_t *layout_data; /* pointer to an instance of layout data */
35 const data_profile_part_t *profile; /*!< pointer to an external stereotype-image cache */
36 const pencil_size_t *pencil_size; /*!< pointer to an instance of a pencil_size_t object, defining pen sizes, gap sizes, font sizes and colors */
37
38 draw_relationship_label_t draw_relationship_label; /*!< collection of draw label functions */
39 pencil_floating_label_layouter_t label_floater; /*!< collection of layout label functions */
40 };
41
42 typedef struct pencil_rel_label_layouter_struct pencil_rel_label_layouter_t;
43
44 /*!
45 * \brief initializes the relationship-label layouter
46 *
47 * \param this_ pointer to own object attributes
48 * \param layout_data pointer to the layout information to be used and modified
49 * \param profile pointer to the profile-part that provides the stereotypes of the elements to be layouted
50 * \param pencil_size pointer to the pencil_size_t object
51 */
52 void pencil_rel_label_layouter_init( pencil_rel_label_layouter_t *this_,
53 layout_visible_set_t *layout_data,
54 const data_profile_part_t *profile,
55 const pencil_size_t *pencil_size
56 );
57
58 /*!
59 * \brief re-initializes the relationship-label layouter to layout new/other input_data
60 *
61 * \param this_ pointer to own object attributes
62 * \param layout_data pointer to the layout information to be used and modified
63 * \param profile pointer to the profile-part that provides the stereotypes of the elements to be layouted
64 * \param pencil_size pointer to the pencil_size_t object
65 */
66 void pencil_rel_label_layouter_reinit( pencil_rel_label_layouter_t *this_,
67 layout_visible_set_t *layout_data,
68 const data_profile_part_t *profile,
69 const pencil_size_t *pencil_size
70 );
71
72 /*!
73 * \brief destroys the relationship-label layouter
74 *
75 * \param this_ pointer to own object attributes
76 */
77 void pencil_rel_label_layouter_destroy( pencil_rel_label_layouter_t *this_ );
78
79 /*!
80 * \brief determines the rectangels of the relationship-labels
81 *
82 * \param this_ pointer to own object attributes
83 * \param font_layout structure to layout fonts
84 */
85 void pencil_rel_label_layouter_do_layout ( pencil_rel_label_layouter_t *this_, PangoLayout *font_layout );
86
87 /*!
88 * \brief determine order by which to layout relationship-labels
89 *
90 * Relationships that are not visible are ignored. Therefore out_sorted may contain fewer relationships than (*this_).layout_data.
91 *
92 * \param this_ pointer to own object attributes
93 * \param out_sorted sorting order by which to layout relationship-labels; must not be NULL, shall be initialized to empty.
94 */
95 void pencil_rel_label_layouter_private_propose_processing_order ( pencil_rel_label_layouter_t *this_, universal_array_index_sorter_t *out_sorted );
96
97 /*!
98 * \brief propose multiple solutions to layout one relationship-label
99 *
100 * \param this_ pointer to own object attributes
101 * \param current_relation relationship for which to propose solutions
102 * \param font_layout structure to layout fonts
103 * \param solutions_max maximum number (array size) of solutions to propose
104 * \param out_solutions array of solutions
105 * \param out_solutions_count number of proposed solutions; 1 <= out_solutions_count < solutions_max
106 */
107 void pencil_rel_label_layouter_private_propose_solutions ( pencil_rel_label_layouter_t *this_,
108 layout_relationship_t *current_relation,
109 PangoLayout *font_layout,
110 uint32_t solutions_max,
111 geometry_rectangle_t out_solutions[],
112 uint32_t *out_solutions_count
113 );
114
115 #endif /* PENCIL_REL_LABEL_LAYOUTER_H */
116
117
118 /*
119 Copyright 2019-2026 Andreas Warnke
120
121 Licensed under the Apache License, Version 2.0 (the "License");
122 you may not use this file except in compliance with the License.
123 You may obtain a copy of the License at
124
125 http://www.apache.org/licenses/LICENSE-2.0
126
127 Unless required by applicable law or agreed to in writing, software
128 distributed under the License is distributed on an "AS IS" BASIS,
129 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
130 See the License for the specific language governing permissions and
131 limitations under the License.
132 */