Debian Codegraph @

pencil/include/layout/layout_relationship.h

raw
1 /* File: layout_relationship.h; Copyright and License: see below */
2
3 #ifndef LAYOUT_RELATIONSHIP_H
4 #define LAYOUT_RELATIONSHIP_H
5
6 /* public file for the doxygen documentation: */
7 /*!
8 * \file
9 * \brief Defines visibility, shape and location of a relationship
10 */
11
12 #include "layout/layout_visible_classifier.h"
13 #include "layout/layout_feature.h"
14 #include "filter/pencil_visibility.h"
15 #include "geometry/geometry_connector.h"
16 #include "entity/data_relationship.h"
17
18 /*!
19 * \brief visibility, shape and location of a relationship
20 */
21 struct layout_relationship_struct {
22 pencil_visibility_t visible; /*!< defines if the relationship is visible */
23 geometry_connector_t shape; /*!< shape of relationship records */
24 geometry_rectangle_t label_box; /*!< bounding box of the label of the relationship. */
25 const data_relationship_t *data; /*!< pointer to the data object of the relationship */
26 layout_visible_classifier_t *from_classifier; /*!< pointer to the layout of the source visible classifier */
27 layout_visible_classifier_t *to_classifier; /*!< pointer to the layout of the destination visible classifier */
28 layout_feature_t *from_feature; /*!< pointer to the layout of the source feature, NULL if none */
29 layout_feature_t *to_feature; /*!< pointer to the layout of the destination feature, NULL if none */
30 };
31
32 typedef struct layout_relationship_struct layout_relationship_t;
33
34 /*!
35 * \brief initializes the layout_relationship_t struct with a pointer to data_relationship_t.
36 *
37 * \param this_ pointer to own object attributes
38 * \param relationship_data pointer to data object which is layouted
39 * \param from_classifier pointer to layout of the source classifier object
40 * \param to_classifier pointer to layout of the destination classifier object
41 * \param from_feature pointer to layout of the source feature object or NULL if not originating from a feature
42 * \param to_feature pointer to layout of the destination feature object or NULL if not directed to a feature
43 */
44 static inline void layout_relationship_init ( layout_relationship_t *this_,
45 const data_relationship_t *relationship_data,
46 layout_visible_classifier_t *from_classifier,
47 layout_visible_classifier_t *to_classifier,
48 layout_feature_t *from_feature,
49 layout_feature_t *to_feature
50 );
51
52 /*!
53 * \brief destroys the layout_relationship_t struct
54 *
55 * \param this_ pointer to own object attributes
56 */
57 static inline void layout_relationship_destroy ( layout_relationship_t *this_ );
58
59 /*!
60 * \brief checks if the relationship data is valid
61 *
62 * \param this_ pointer to own object attributes
63 * \return true if (*this_).data points to valid data and is consistent with (*this_).from_classifier,
64 * (*this_).to_classifier, (*this_).from_feature, (*this_).to_feature
65 */
66 static inline bool layout_relationship_is_valid ( const layout_relationship_t *this_ );
67
68 /*!
69 * \brief gets the visibility of the relationship
70 *
71 * \param this_ pointer to own object attributes
72 * \return visibility of the relationship layout.
73 */
74 static inline pencil_visibility_t layout_relationship_get_visibility ( const layout_relationship_t *this_ );
75
76 /*!
77 * \brief sets the visibility of the relationship
78 *
79 * \param this_ pointer to own object attributes
80 * \param visible visibility of the relationship layout.
81 */
82 static inline void layout_relationship_set_visibility ( layout_relationship_t *this_, pencil_visibility_t visible );
83
84 /*!
85 * \brief gets the shape of the relationship
86 *
87 * \param this_ pointer to own object attributes
88 * \return pointer to geometry_rectangle_t.
89 */
90 static inline const geometry_connector_t *layout_relationship_get_shape_const ( const layout_relationship_t *this_ );
91
92 /*!
93 * \brief sets the shape of the relationship
94 *
95 * \param this_ pointer to own object attributes
96 * \param shape new shape of this relationship
97 */
98 static inline void layout_relationship_set_shape ( layout_relationship_t *this_, const geometry_connector_t *shape );
99
100 /*!
101 * \brief gets the middle location of the relationship
102 *
103 * \param this_ pointer to own object attributes
104 * \return point of middle of connector.
105 */
106 static inline geometry_point_t layout_relationship_get_middle ( const layout_relationship_t *this_ );
107
108 /*!
109 * \brief gets the label bounds of the relationship
110 *
111 * \param this_ pointer to own object attributes
112 * \return pointer to geometry_rectangle_t.
113 */
114 static inline const geometry_rectangle_t *layout_relationship_get_label_box_const ( const layout_relationship_t *this_ );
115
116 /*!
117 * \brief sets the label bounds of the relationship
118 *
119 * \param this_ pointer to own object attributes
120 * \param label_box coordinates of new label bounds
121 */
122 static inline void layout_relationship_set_label_box ( layout_relationship_t *this_, const geometry_rectangle_t *label_box );
123
124 /*!
125 * \brief gets the data_relationship_t object
126 *
127 * \param this_ pointer to own object attributes
128 * \return a pointer to a data_relationship_t object.
129 */
130 static inline const data_relationship_t *layout_relationship_get_data_const ( const layout_relationship_t *this_ );
131
132 /*!
133 * \brief gets the source layout_visible_classifier_t object
134 *
135 * \param this_ pointer to own object attributes
136 * \return a pointer to the source layout_visible_classifier_t object.
137 */
138 static inline layout_visible_classifier_t *layout_relationship_get_from_classifier_ptr ( const layout_relationship_t *this_ );
139
140 /*!
141 * \brief gets the destination layout_visible_classifier_t object
142 *
143 * \param this_ pointer to own object attributes
144 * \return a pointer to the destination layout_visible_classifier_t object.
145 */
146 static inline layout_visible_classifier_t *layout_relationship_get_to_classifier_ptr ( const layout_relationship_t *this_ );
147
148 /*!
149 * \brief gets the source layout_feature_t object
150 *
151 * \param this_ pointer to own object attributes
152 * \return a pointer to the source layout_feature_t object or NULL if the relationship does not originate from a feature
153 */
154 static inline layout_feature_t *layout_relationship_get_from_feature_ptr ( const layout_relationship_t *this_ );
155
156 /*!
157 * \brief gets the destination layout_feature_t object
158 *
159 * \param this_ pointer to own object attributes
160 * \return a pointer to the destination layout_feature_t object, or NULL if the relationship does not point to a feature
161 */
162 static inline layout_feature_t *layout_relationship_get_to_feature_ptr ( const layout_relationship_t *this_ );
163
164 /*!
165 * \brief gets the row id of the relationship
166 *
167 * This is a shortcut for data_relationship_get_row_id( layout_relationship_get_data_const ( X ) )
168 *
169 * \param this_ pointer to own object attributes
170 * \return id of the relationship
171 */
172 static inline data_row_t layout_relationship_get_relationship_id ( const layout_relationship_t *this_ );
173
174 /*!
175 * \brief gets the symbol_box of the source object, the feature or the classifier
176 *
177 * \param this_ pointer to own object attributes
178 * \return pointer to const geometry_rectangle_t.
179 */
180 static inline const geometry_rectangle_t *layout_relationship_get_from_box_const ( const layout_relationship_t *this_ );
181
182 /*!
183 * \brief gets the symbol_box of the destination object, the feature or the classifier
184 *
185 * \param this_ pointer to own object attributes
186 * \return pointer to const geometry_rectangle_t.
187 */
188 static inline const geometry_rectangle_t *layout_relationship_get_to_box_const ( const layout_relationship_t *this_ );
189
190
191 #include "layout_relationship.inl"
192
193 #endif /* LAYOUT_RELATIONSHIP_H */
194
195
196 /*
197 Copyright 2018-2026 Andreas Warnke
198
199 Licensed under the Apache License, Version 2.0 (the "License");
200 you may not use this file except in compliance with the License.
201 You may obtain a copy of the License at
202
203 http://www.apache.org/licenses/LICENSE-2.0
204
205 Unless required by applicable law or agreed to in writing, software
206 distributed under the License is distributed on an "AS IS" BASIS,
207 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
208 See the License for the specific language governing permissions and
209 limitations under the License.
210 */