Debian Codegraph @

pencil/include/layout/layout_feature.h

raw
1 /* File: layout_feature.h; Copyright and License: see below */
2
3 #ifndef LAYOUT_FEATURE_H
4 #define LAYOUT_FEATURE_H
5
6 /* public file for the doxygen documentation: */
7 /*!
8 * \file
9 * \brief Defines visibility, shape and location of a feature
10 */
11
12 #include "layout/layout_visible_classifier.h"
13 #include "geometry/geometry_direction.h"
14 #include "geometry/geometry_rectangle.h"
15 #include "geometry/geometry_point.h"
16 #include "entity/data_feature.h"
17
18 /*!
19 * \brief visibility, shape and location of a feature
20 */
21 struct layout_feature_struct {
22 geometry_rectangle_t symbol_box; /*!< In case the feature is a symbol, the label_box may be outside of symbol_box.*/
23 /*!< Otherwise it is the bounding box of the feature */
24 geometry_direction_t icon_direction; /*!< icon direction, a hint for drawing the icon of a feature, e.g. lifelines and required interfaces. */
25 geometry_rectangle_t label_box; /*!< bounding box of the label of the feature. For operations and properties, this is identical to the bounding box */
26 const data_feature_t *data; /*!< pointer to the data object of the feature */
27 layout_visible_classifier_t *classifier; /*!< pointer to the layout of the parent visible classifier */
28 };
29
30 typedef struct layout_feature_struct layout_feature_t;
31
32 /*!
33 * \brief initializes the layout_feature_t struct with a pointer to feature_data.
34 *
35 * \param this_ pointer to own object attributes
36 * \param feature_data pointer to data object which is layouted
37 * \param classifier pointer to layout of the parent classifier object
38 */
39 static inline void layout_feature_init ( layout_feature_t *this_,
40 const data_feature_t *feature_data,
41 layout_visible_classifier_t *classifier
42 );
43
44 /*!
45 * \brief destroys the layout_feature_t struct
46 *
47 * \param this_ pointer to own object attributes
48 */
49 static inline void layout_feature_destroy ( layout_feature_t *this_ );
50
51 /*!
52 * \brief checks if the feature data is valid
53 *
54 * \param this_ pointer to own object attributes
55 * \return true if (*this_).data points to valid data and is consistent with (*this_).classifier
56 */
57 static inline bool layout_feature_is_valid ( const layout_feature_t *this_ );
58
59 /*!
60 * \brief gets the bounding box of the feature
61 *
62 * \param this_ pointer to own object attributes
63 * \return pointer to geometry_rectangle_t.
64 */
65 static inline const geometry_rectangle_t *layout_feature_get_symbol_box_const ( const layout_feature_t *this_ );
66
67 /*!
68 * \brief gets the middle location of the feature's symbol
69 *
70 * \param this_ pointer to own object attributes
71 * \return point of middle of symbol_box.
72 */
73 static inline geometry_point_t layout_feature_get_symbol_middle ( const layout_feature_t *this_ );
74
75 /*!
76 * \brief sets the symbol_box of the feature
77 *
78 * \param this_ pointer to own object attributes
79 * \param feature_symbol_box coordinates of new bounding box
80 */
81 static inline void layout_feature_set_symbol_box ( layout_feature_t *this_, const geometry_rectangle_t *feature_symbol_box );
82
83 /*!
84 * \brief gets the icon direction of the layout feature
85 *
86 * \param this_ pointer to own object attributes
87 * \return icon direction of the feature
88 */
89 static inline geometry_direction_t layout_feature_get_icon_direction ( const layout_feature_t *this_ );
90
91 /*!
92 * \brief sets the icon direction of the layout feature
93 *
94 * \param this_ pointer to own object attributes
95 * \param direction new icon direction to set
96 */
97 static inline void layout_feature_set_icon_direction ( layout_feature_t *this_, geometry_direction_t direction );
98
99 /*!
100 * \brief gets the label bounds of the feature
101 *
102 * \param this_ pointer to own object attributes
103 * \return pointer to geometry_rectangle_t.
104 */
105 static inline const geometry_rectangle_t *layout_feature_get_label_box_const ( const layout_feature_t *this_ );
106
107 /*!
108 * \brief sets the label bounds of the feature
109 *
110 * \param this_ pointer to own object attributes
111 * \param label_box coordinates of new label bounds
112 */
113 static inline void layout_feature_set_label_box ( layout_feature_t *this_, const geometry_rectangle_t *label_box );
114
115 /*!
116 * \brief gets the data_feature_t object
117 *
118 * \param this_ pointer to own object attributes
119 * \return a pointer to the corresponding data_feature_t object
120 */
121 static inline const data_feature_t *layout_feature_get_data_const ( const layout_feature_t *this_ );
122
123 /*!
124 * \brief gets the layout_visible_classifier_t object
125 *
126 * \param this_ pointer to own object attributes
127 * \return a pointer to the parent layout_visible_classifier_t object
128 */
129 static inline layout_visible_classifier_t *layout_feature_get_classifier_ptr ( layout_feature_t *this_ );
130
131 /*!
132 * \brief gets the layout_visible_classifier_t object
133 *
134 * \param this_ pointer to own object attributes
135 * \return a pointer to the parent layout_visible_classifier_t object
136 */
137 static inline const layout_visible_classifier_t *layout_feature_get_classifier_const ( const layout_feature_t *this_ );
138
139 /*!
140 * \brief gets the row id of the feature
141 *
142 * This is a shortcut for data_feature_get_row_id( layout_feature_get_data_const ( X ) )
143 *
144 * \param this_ pointer to own object attributes
145 * \return id of the feature
146 */
147 static inline data_row_t layout_feature_get_feature_id ( const layout_feature_t *this_ );
148
149 #include "layout_feature.inl"
150
151 #endif /* LAYOUT_FEATURE_H */
152
153
154 /*
155 Copyright 2018-2026 Andreas Warnke
156
157 Licensed under the Apache License, Version 2.0 (the "License");
158 you may not use this file except in compliance with the License.
159 You may obtain a copy of the License at
160
161 http://www.apache.org/licenses/LICENSE-2.0
162
163 Unless required by applicable law or agreed to in writing, software
164 distributed under the License is distributed on an "AS IS" BASIS,
165 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
166 See the License for the specific language governing permissions and
167 limitations under the License.
168 */