Debian Codegraph @

pencil/include/draw/draw_classifier_contour.h

raw
1 /* File: draw_classifier_contour.h; Copyright and License: see below */
2
3 #ifndef DRAW_CLASSIFIER_CONTOUR_H
4 #define DRAW_CLASSIFIER_CONTOUR_H
5
6 /* public file for the doxygen documentation: */
7 /*!
8 * \file
9 * \brief Draws simple geometric objects like 2d boxes, 3d boxes, ovals, rounded-corner-boxes
10 */
11
12 #include "pencil_size.h"
13 #include "geometry/geometry_h_align.h"
14 #include "geometry/geometry_v_align.h"
15 #include "geometry/geometry_rectangle.h"
16 #include "entity/data_classifier_type.h"
17 #include <cairo.h>
18 #include <stdint.h>
19
20 /*!
21 * \brief attributes of the draw geometry functions
22 *
23 * \note This class is stateless.
24 * It may either be instantiated once and used many times or be instantiated per use.
25 */
26 struct draw_classifier_contour_struct {
27 int dummy; /*!< This object is a collection of stateless drawing functions */
28 };
29
30 typedef struct draw_classifier_contour_struct draw_classifier_contour_t;
31
32 /*!
33 * \brief initializes the draw_classifier_contour_t
34 *
35 * \param this_ pointer to own object attributes
36 */
37 static inline void draw_classifier_contour_init( draw_classifier_contour_t *this_ );
38
39 /*!
40 * \brief destroys the draw_classifier_contour_t
41 *
42 * \param this_ pointer to own object attributes
43 */
44 static inline void draw_classifier_contour_destroy( draw_classifier_contour_t *this_ );
45
46 /*!
47 * \brief returns true if the classifier is drawn as outer contour with label, icon and children inside
48 *
49 * The following classifier types have no contour: (use-case:) actor, (activity:) start, end, fork, join, timeout, history, image
50 *
51 * \param this_ pointer to own object attributes
52 * \param classifier_type type of the classifier to draw
53 * \return true if the classifier has an outer contour
54 */
55 static inline bool draw_classifier_contour_has_contour ( const draw_classifier_contour_t *this_, data_classifier_type_t classifier_type );
56
57 /*!
58 * \brief determines the dimensions of the inner area (label and space) of the classifier-shape.
59 *
60 * based on the outer_bounds, the inner area is calculated.
61 * In case of a fixed-sized symbol, the label-and-space area without icon is returned.
62 *
63 * \param this_ pointer to own object attributes
64 * \param classifier_type type of the classifier to layout
65 * \param outer_bounds outer bounding rectangle for the classifier
66 * \param pencil_size set of sizes and colors for drawing lines and text
67 * \return inner area. empty rectangle if outer_bounds too small.
68 */
69 geometry_rectangle_t draw_classifier_contour_calc_inner_area ( const draw_classifier_contour_t *this_,
70 data_classifier_type_t classifier_type,
71 const geometry_rectangle_t *outer_bounds,
72 const pencil_size_t *pencil_size
73 );
74
75 /*!
76 * \brief determines the outer bounding dimensions of the classifier-shape.
77 *
78 * based on the inner_area (label and space), the outer bounds is calculated.
79 *
80 * \param this_ pointer to own object attributes
81 * \param classifier_type type of the classifier to layout
82 * \param inner_area inner_area (label and space) that is needed for the classifier
83 * \param pencil_size set of sizes and colors for drawing lines and text
84 * \return outer bounds.
85 */
86 geometry_rectangle_t draw_classifier_contour_calc_outer_bounds ( const draw_classifier_contour_t *this_,
87 data_classifier_type_t classifier_type,
88 const geometry_rectangle_t *inner_area,
89 const pencil_size_t *pencil_size
90 );
91
92 /*!
93 * \brief draws a rectangle shape into the outer bounds rect
94 *
95 * \param this_ pointer to own object attributes
96 * \param outer_bounds outer bounding rectangle of the shape, the rectangle has a distance of gap to the outer bounds
97 * \param pencil_size set of sizes and colors for drawing lines and text
98 * \param cr a cairo drawing context
99 */
100 static inline void draw_classifier_contour_draw_rect ( const draw_classifier_contour_t *this_,
101 const geometry_rectangle_t *outer_bounds,
102 const pencil_size_t *pencil_size,
103 cairo_t *cr
104 );
105
106 /*!
107 * \brief draws a rounded-corner-rectangle shape into the outer bounds rect
108 *
109 * \param this_ pointer to own object attributes
110 * \param outer_bounds outer bounding rectangle of the shape, the rectangle has a distance of gap to the outer bounds
111 * \param dashed_line true if the line shall be dashed
112 * \param pencil_size set of sizes and colors for drawing lines and text
113 * \param cr a cairo drawing context
114 */
115 void draw_classifier_contour_draw_rounded_rect ( const draw_classifier_contour_t *this_,
116 const geometry_rectangle_t *outer_bounds,
117 bool dashed_line,
118 const pencil_size_t *pencil_size,
119 cairo_t *cr
120 );
121
122 /*!
123 * \brief draws a cornerless shape of 4 non-touching edges into the outer bounds rect
124 *
125 * This is suitable when rendering types of future classifiers that are not known to this old program version.
126 *
127 * \param this_ pointer to own object attributes
128 * \param outer_bounds outer bounding rectangle of the shape, the rectangle has a distance of gap to the outer bounds
129 * \param pencil_size set of sizes and colors for drawing lines and text
130 * \param cr a cairo drawing context
131 */
132 static inline void draw_classifier_contour_draw_cornerless ( const draw_classifier_contour_t *this_,
133 const geometry_rectangle_t *outer_bounds,
134 const pencil_size_t *pencil_size,
135 cairo_t *cr
136 );
137
138 /*!
139 * \brief draws an ellipse shape into the outer bounds rect
140 *
141 * \param this_ pointer to own object attributes
142 * \param outer_bounds outer bounding rectangle of the shape, the ellipse has a distance of gap to the outer bounds
143 * \param pencil_size set of sizes and colors for drawing lines and text
144 * \param cr a cairo drawing context
145 */
146 void draw_classifier_contour_draw_ellipse ( const draw_classifier_contour_t *this_,
147 const geometry_rectangle_t *outer_bounds,
148 const pencil_size_t *pencil_size,
149 cairo_t *cr
150 );
151
152 /*!
153 * \brief draws a rhombus shape into the outer bounds rect
154 *
155 * \param this_ pointer to own object attributes
156 * \param outer_bounds outer bounding rectangle of the shape, the rhombus has a distance of gap to the outer bounds
157 * \param pencil_size set of sizes and colors for drawing lines and text
158 * \param cr a cairo drawing context
159 */
160 void draw_classifier_contour_draw_rhombus ( const draw_classifier_contour_t *this_,
161 const geometry_rectangle_t *outer_bounds,
162 const pencil_size_t *pencil_size,
163 cairo_t *cr
164 );
165
166 /*!
167 * \brief draws an 3d_box shape into the outer bounds rect
168 *
169 * \param this_ pointer to own object attributes
170 * \param outer_bounds outer bounding rectangle of the shape, the 3d_box has a distance of gap to the outer bounds
171 * \param pencil_size set of sizes and colors for drawing lines and text
172 * \param cr a cairo drawing context
173 */
174 void draw_classifier_contour_draw_3d_box ( const draw_classifier_contour_t *this_,
175 const geometry_rectangle_t *outer_bounds,
176 const pencil_size_t *pencil_size,
177 cairo_t *cr
178 );
179
180 /*!
181 * \brief draws an accept_event shape into the outer bounds rect
182 *
183 * \param this_ pointer to own object attributes
184 * \param outer_bounds outer bounding rectangle of the shape, the accept_event has a distance of gap to the outer bounds
185 * \param pencil_size set of sizes and colors for drawing lines and text
186 * \param cr a cairo drawing context
187 */
188 void draw_classifier_contour_draw_accept_event ( const draw_classifier_contour_t *this_,
189 const geometry_rectangle_t *outer_bounds,
190 const pencil_size_t *pencil_size,
191 cairo_t *cr
192 );
193
194 /*!
195 * \brief draws a send_signal shape into the outer bounds rect
196 *
197 * \param this_ pointer to own object attributes
198 * \param outer_bounds outer bounding rectangle of the shape, the send_signal has a distance of gap to the outer bounds
199 * \param pencil_size set of sizes and colors for drawing lines and text
200 * \param cr a cairo drawing context
201 */
202 void draw_classifier_contour_draw_send_signal ( const draw_classifier_contour_t *this_,
203 const geometry_rectangle_t *outer_bounds,
204 const pencil_size_t *pencil_size,
205 cairo_t *cr
206 );
207
208 /*!
209 * \brief draws a package shape into the outer bounds rect
210 *
211 * \param this_ pointer to own object attributes
212 * \param outer_bounds outer bounding rectangle of the shape, the package has a distance of gap to the outer bounds
213 * \param label_box rectangle of the label text
214 * \param pencil_size set of sizes and colors for drawing lines and text
215 * \param cr a cairo drawing context
216 */
217 void draw_classifier_contour_draw_package ( const draw_classifier_contour_t *this_,
218 const geometry_rectangle_t *outer_bounds,
219 const geometry_rectangle_t *label_box,
220 const pencil_size_t *pencil_size,
221 cairo_t *cr
222 );
223
224 /*!
225 * \brief draws a diagram shape into the outer bounds rect
226 *
227 * \param this_ pointer to own object attributes
228 * \param outer_bounds outer bounding rectangle of the shape, the diagram has a distance of gap to the outer bounds
229 * \param pencil_size set of sizes and colors for drawing lines and text
230 * \param cr a cairo drawing context
231 */
232 void draw_classifier_contour_draw_diagram_ref ( const draw_classifier_contour_t *this_,
233 const geometry_rectangle_t *outer_bounds,
234 const pencil_size_t *pencil_size,
235 cairo_t *cr
236 );
237
238 /*!
239 * \brief draws a comment shape into the outer bounds rect
240 *
241 * \param this_ pointer to own object attributes
242 * \param outer_bounds outer bounding rectangle of the shape, the comment has a distance of gap to the outer bounds
243 * \param pencil_size set of sizes and colors for drawing lines and text
244 * \param cr a cairo drawing context
245 */
246 void draw_classifier_contour_draw_comment ( const draw_classifier_contour_t *this_,
247 const geometry_rectangle_t *outer_bounds,
248 const pencil_size_t *pencil_size,
249 cairo_t *cr
250 );
251
252 /*!
253 * \brief draws a horizontal line to e.g. split compartments of feature-groups
254 *
255 * \param this_ pointer to own object attributes
256 * \param classifier_type type of the classifier for which to draw a compartment line
257 * \param outer_bounds outer bounding rectangle of the shape, the line has a distance of gap to the outer bounds
258 * \param y_coordinate coordinate where to draw the line
259 * \param pencil_size set of sizes and colors for drawing lines and text
260 * \param cr a cairo drawing context
261 */
262 void draw_classifier_contour_draw_compartment_line ( const draw_classifier_contour_t *this_,
263 data_classifier_type_t classifier_type,
264 const geometry_rectangle_t *outer_bounds,
265 double y_coordinate,
266 const pencil_size_t *pencil_size,
267 cairo_t *cr
268 );
269
270 #include "draw_classifier_contour.inl"
271
272 #endif /* DRAW_CLASSIFIER_CONTOUR_H */
273
274
275 /*
276 Copyright 2019-2026 Andreas Warnke
277
278 Licensed under the Apache License, Version 2.0 (the "License");
279 you may not use this file except in compliance with the License.
280 You may obtain a copy of the License at
281
282 http://www.apache.org/licenses/LICENSE-2.0
283
284 Unless required by applicable law or agreed to in writing, software
285 distributed under the License is distributed on an "AS IS" BASIS,
286 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
287 See the License for the specific language governing permissions and
288 limitations under the License.
289 */