| 1 |
/* File: layout_visible_classifier.h; Copyright and License: see below */ |
| 2 |
|
| 3 |
#ifndef LAYOUT_VISIBLE_CLASSIFIER_H |
| 4 |
#define LAYOUT_VISIBLE_CLASSIFIER_H |
| 5 |
|
| 6 |
/* public file for the doxygen documentation: */ |
| 7 |
/*! |
| 8 |
* \file |
| 9 |
* \brief Defines shape and location of a visible_classifier |
| 10 |
*/ |
| 11 |
|
| 12 |
#include "geometry/geometry_rectangle.h" |
| 13 |
#include "geometry/geometry_offset.h" |
| 14 |
#include "geometry/geometry_h_align.h" |
| 15 |
#include "geometry/geometry_v_align.h" |
| 16 |
#include "set/data_visible_classifier.h" |
| 17 |
|
| 18 |
/*! |
| 19 |
* \brief shape and location of a visible_classifier |
| 20 |
*/ |
| 21 |
struct layout_visible_classifier_struct { |
| 22 |
geometry_rectangle_t symbol_box; /*!< symbol_box of a classifier shape. */ |
| 23 |
/*!< Depending on the classifier type, this is the icon or the contour or both. */ |
| 24 |
/*!< The label_box may be outside of the symbol_box. */ |
| 25 |
/*!< symbol_box is stated in absolute coordinates. */ |
| 26 |
geometry_rectangle_t space; /*!< inner space of a classifier record where properties, operations */ |
| 27 |
/*!< or contained classifiers are drawn. space is stated in absolute coordinates. */ |
| 28 |
geometry_rectangle_t label_box; /*!< bounding box of the label of the visible classifier. */ |
| 29 |
/*!< label_box is stated in absolute coordinates. */ |
| 30 |
geometry_rectangle_t icon_box; /*!< bounding box of the main_type or stereotype icon of the visible classifier. */ |
| 31 |
/*!< The icon_box equals the symbol box of actor, fork, join, start, end, history, time,... */ |
| 32 |
/*!< icon_box is stated in absolute coordinates. */ |
| 33 |
geometry_h_align_t label_h_anchor; /*!< side of the label box that stays fix in case of expand */ |
| 34 |
geometry_v_align_t label_v_anchor; /*!< side of the label box that stays fix in case of expand */ |
| 35 |
geometry_rectangle_t envelope_box_cache; /*!< for caching the envelope_box, */ |
| 36 |
/*!< which is derived from the other three rectangles */ |
| 37 |
const data_visible_classifier_t *data; /*!< pointer to the data object of the visible classifier */ |
| 38 |
}; |
| 39 |
|
| 40 |
typedef struct layout_visible_classifier_struct layout_visible_classifier_t; |
| 41 |
|
| 42 |
/*! |
| 43 |
* \brief initializes the layout_visible_classifier_t struct with a pointer to the corresponding data_visible_classifier_t. |
| 44 |
* |
| 45 |
* \param this_ pointer to own object attributes |
| 46 |
* \param visible_classifier_data pointer to data object which is layouted |
| 47 |
*/ |
| 48 |
static inline void layout_visible_classifier_init ( layout_visible_classifier_t *this_, const data_visible_classifier_t *visible_classifier_data ); |
| 49 |
|
| 50 |
/*! |
| 51 |
* \brief copies a layout_visible_classifier_t struct to this uninitialized layout_visible_classifier_t struct |
| 52 |
* |
| 53 |
* \param this_ pointer to own object attributes |
| 54 |
* \param original pointer to original object attributes |
| 55 |
*/ |
| 56 |
static inline void layout_visible_classifier_copy ( layout_visible_classifier_t *this_, const layout_visible_classifier_t *original ); |
| 57 |
|
| 58 |
/*! |
| 59 |
* \brief moves a layout_visible_classifier_t struct to this uninitialized layout_visible_classifier_t struct |
| 60 |
* |
| 61 |
* \param this_ pointer to own object attributes |
| 62 |
* \param that pointer to original object attributes to be moved |
| 63 |
*/ |
| 64 |
static inline void layout_visible_classifier_move ( layout_visible_classifier_t *this_, layout_visible_classifier_t *that ); |
| 65 |
|
| 66 |
/*! |
| 67 |
* \brief copies a layout_visible_classifier_t struct to this already initialized layout_visible_classifier_t struct |
| 68 |
* |
| 69 |
* \param this_ pointer to own object attributes |
| 70 |
* \param original pointer to original object attributes |
| 71 |
*/ |
| 72 |
static inline void layout_visible_classifier_replace ( layout_visible_classifier_t *this_, const layout_visible_classifier_t *original ); |
| 73 |
|
| 74 |
/*! |
| 75 |
* \brief moves a layout_visible_classifier_t struct to this already initialized layout_visible_classifier_t struct |
| 76 |
* |
| 77 |
* \param this_ pointer to own object attributes |
| 78 |
* \param that pointer to original object attributes to be moved |
| 79 |
*/ |
| 80 |
static inline void layout_visible_classifier_replacemove ( layout_visible_classifier_t *this_, layout_visible_classifier_t *that ); |
| 81 |
|
| 82 |
/*! |
| 83 |
* \brief destroys the layout_visible_classifier_t struct |
| 84 |
* |
| 85 |
* \param this_ pointer to own object attributes |
| 86 |
*/ |
| 87 |
static inline void layout_visible_classifier_destroy ( layout_visible_classifier_t *this_ ); |
| 88 |
|
| 89 |
/*! |
| 90 |
* \brief checks if the layout_visible_classifier data is valid |
| 91 |
* |
| 92 |
* \param this_ pointer to own object attributes |
| 93 |
* \return true if (*this_).data points to valid data |
| 94 |
*/ |
| 95 |
static inline bool layout_visible_classifier_is_valid ( const layout_visible_classifier_t *this_ ); |
| 96 |
|
| 97 |
/*! |
| 98 |
* \brief gets the symbol_box of the classifier |
| 99 |
* |
| 100 |
* \param this_ pointer to own object attributes |
| 101 |
* \return pointer to geometry_rectangle_t |
| 102 |
*/ |
| 103 |
static inline const geometry_rectangle_t *layout_visible_classifier_get_symbol_box_const ( const layout_visible_classifier_t *this_ ); |
| 104 |
|
| 105 |
/*! |
| 106 |
* \brief sets the symbol_box of the classifier |
| 107 |
* |
| 108 |
* \param this_ pointer to own object attributes |
| 109 |
* \param symbol_box coordinates of new symbol_box |
| 110 |
*/ |
| 111 |
static inline void layout_visible_classifier_set_symbol_box ( layout_visible_classifier_t *this_, const geometry_rectangle_t *symbol_box ); |
| 112 |
|
| 113 |
/*! |
| 114 |
* \brief gets the inner space of the classifier |
| 115 |
* |
| 116 |
* \param this_ pointer to own object attributes |
| 117 |
* \return pointer to geometry_rectangle_t |
| 118 |
*/ |
| 119 |
static inline const geometry_rectangle_t *layout_visible_classifier_get_space_const ( const layout_visible_classifier_t *this_ ); |
| 120 |
|
| 121 |
/*! |
| 122 |
* \brief sets the inner space of the classifier |
| 123 |
* |
| 124 |
* \param this_ pointer to own object attributes |
| 125 |
* \param space coordinates of new space for contained classifiers and features |
| 126 |
*/ |
| 127 |
static inline void layout_visible_classifier_set_space ( layout_visible_classifier_t *this_, const geometry_rectangle_t *space ); |
| 128 |
|
| 129 |
/*! |
| 130 |
* \brief gets the label bounds of the classifier |
| 131 |
* |
| 132 |
* \param this_ pointer to own object attributes |
| 133 |
* \return pointer to geometry_rectangle_t |
| 134 |
*/ |
| 135 |
static inline const geometry_rectangle_t *layout_visible_classifier_get_label_box_const ( const layout_visible_classifier_t *this_ ); |
| 136 |
|
| 137 |
/*! |
| 138 |
* \brief sets the label bounds of the classifier |
| 139 |
* |
| 140 |
* \param this_ pointer to own object attributes |
| 141 |
* \param label_box coordinates of new label bounds |
| 142 |
*/ |
| 143 |
static inline void layout_visible_classifier_set_label_box ( layout_visible_classifier_t *this_, const geometry_rectangle_t *label_box ); |
| 144 |
|
| 145 |
/*! |
| 146 |
* \brief sets the alignment of the label text within the label box |
| 147 |
* |
| 148 |
* \param this_ pointer to own object attributes |
| 149 |
* \param label_h_anchor side of the label that stays fix in case of expand |
| 150 |
* \param label_v_anchor side of the label that stays fix in case of expand |
| 151 |
*/ |
| 152 |
static inline void layout_visible_classifier_set_label_anchor ( layout_visible_classifier_t *this_, |
| 153 |
geometry_h_align_t label_h_anchor, |
| 154 |
geometry_v_align_t label_v_anchor |
| 155 |
); |
| 156 |
|
| 157 |
/*! |
| 158 |
* \brief gets the icon bounds of the main type or the stereotype of the classifier |
| 159 |
* |
| 160 |
* \param this_ pointer to own object attributes |
| 161 |
* \return pointer to geometry_rectangle_t |
| 162 |
*/ |
| 163 |
static inline const geometry_rectangle_t *layout_visible_classifier_get_icon_box_const ( const layout_visible_classifier_t *this_ ); |
| 164 |
|
| 165 |
/*! |
| 166 |
* \brief sets the icon bounds of the main type or the stereotype of the classifier |
| 167 |
* |
| 168 |
* \param this_ pointer to own object attributes |
| 169 |
* \param icon_box coordinates of new icon bounds |
| 170 |
*/ |
| 171 |
static inline void layout_visible_classifier_set_icon_box ( layout_visible_classifier_t *this_, const geometry_rectangle_t *icon_box ); |
| 172 |
|
| 173 |
/*! |
| 174 |
* \brief calculates the envelope bounds of the classifier. |
| 175 |
* |
| 176 |
* The envelope contains the label and the symbol box and implicitly the (inner) space. |
| 177 |
* |
| 178 |
* \param this_ pointer to own object attributes |
| 179 |
* \return geometry_rectangle_t which is the envelope to label and symbol_box. |
| 180 |
*/ |
| 181 |
static inline geometry_rectangle_t layout_visible_classifier_get_envelope_box ( const layout_visible_classifier_t *this_ ); |
| 182 |
|
| 183 |
/*! |
| 184 |
* \brief gets the envelope of the classifier |
| 185 |
* |
| 186 |
* \param this_ pointer to own object attributes |
| 187 |
* \return pointer to geometry_rectangle_t. |
| 188 |
*/ |
| 189 |
static inline const geometry_rectangle_t *layout_visible_classifier_get_envelope_box_const ( const layout_visible_classifier_t *this_ ); |
| 190 |
|
| 191 |
/*! |
| 192 |
* \brief moves the layout_visible_classifier_t |
| 193 |
* |
| 194 |
* \param this_ pointer to own object attributes |
| 195 |
* \param offset difference by which to shift the layout_visible_classifier_t |
| 196 |
*/ |
| 197 |
static inline void layout_visible_classifier_shift ( layout_visible_classifier_t *this_, const geometry_offset_t *offset ); |
| 198 |
|
| 199 |
/*! |
| 200 |
* \brief gets the pointer to the data_visible_classifier_t object |
| 201 |
* |
| 202 |
* \param this_ pointer to own object attributes |
| 203 |
* \return a pointer to a data_visible_classifier_t object. |
| 204 |
*/ |
| 205 |
static inline const data_visible_classifier_t *layout_visible_classifier_get_data_const ( const layout_visible_classifier_t *this_ ); |
| 206 |
|
| 207 |
/*! |
| 208 |
* \brief gets the pointer to the const classifier |
| 209 |
* |
| 210 |
* \param this_ pointer to own object attributes |
| 211 |
* \return a pointer to a classifier. |
| 212 |
*/ |
| 213 |
static inline const data_classifier_t *layout_visible_classifier_get_classifier_const ( const layout_visible_classifier_t *this_ ); |
| 214 |
|
| 215 |
/*! |
| 216 |
* \brief gets the pointer to the const diagramelement |
| 217 |
* |
| 218 |
* \param this_ pointer to own object attributes |
| 219 |
* \return a pointer to a diagramelement. |
| 220 |
*/ |
| 221 |
static inline const data_diagramelement_t *layout_visible_classifier_get_diagramelement_const ( const layout_visible_classifier_t *this_ ); |
| 222 |
|
| 223 |
/*! |
| 224 |
* \brief gets the row id of the classifier |
| 225 |
* |
| 226 |
* This is a shortcut for data_classifier_get_row_id( data_visible_classifier_get_classifier_const ( (*this_).data ) ) |
| 227 |
* |
| 228 |
* \param this_ pointer to own object attributes |
| 229 |
* \return id of the classifier |
| 230 |
*/ |
| 231 |
static inline data_row_t layout_visible_classifier_get_classifier_id ( const layout_visible_classifier_t *this_ ); |
| 232 |
|
| 233 |
/*! |
| 234 |
* \brief gets the row id of the diagramelement |
| 235 |
* |
| 236 |
* This is a shortcut for data_diagramelement_get_row_id( data_visible_classifier_get_diagramelement_const ( (*this_).data ) ) |
| 237 |
* |
| 238 |
* \param this_ pointer to own object attributes |
| 239 |
* \return id of the diagramelement |
| 240 |
*/ |
| 241 |
static inline data_row_t layout_visible_classifier_get_diagramelement_id ( const layout_visible_classifier_t *this_ ); |
| 242 |
|
| 243 |
/*! |
| 244 |
* \brief checks if the ids of the associated diagramelements are identical |
| 245 |
* |
| 246 |
* This is a shortcut for layout_visible_classifier_get_diagramelement_id( this_ )==layout_visible_classifier_get_diagramelement_id( that ) |
| 247 |
* |
| 248 |
* \param this_ pointer to own object attributes |
| 249 |
* \param that pointer to others object attributes |
| 250 |
* \return true if ids of the associated diagramelements are identical |
| 251 |
*/ |
| 252 |
static inline bool layout_visible_classifier_is_equal_diagramelement_id ( const layout_visible_classifier_t *this_, |
| 253 |
const layout_visible_classifier_t *that |
| 254 |
); |
| 255 |
|
| 256 |
/*! |
| 257 |
* \brief calculates the envelope bounds of the classifier and stores it in envelope_box_cache. |
| 258 |
* |
| 259 |
* The envelope contains the label and the symbol box and the (inner) space. |
| 260 |
* |
| 261 |
* \param this_ pointer to own object attributes |
| 262 |
*/ |
| 263 |
static inline void layout_visible_classifier_private_update_envelope_box ( layout_visible_classifier_t *this_ ); |
| 264 |
|
| 265 |
#include "layout_visible_classifier.inl" |
| 266 |
|
| 267 |
#endif /* LAYOUT_VISIBLE_CLASSIFIER_H */ |
| 268 |
|
| 269 |
|
| 270 |
/* |
| 271 |
Copyright 2018-2026 Andreas Warnke |
| 272 |
|
| 273 |
Licensed under the Apache License, Version 2.0 (the "License"); |
| 274 |
you may not use this file except in compliance with the License. |
| 275 |
You may obtain a copy of the License at |
| 276 |
|
| 277 |
http://www.apache.org/licenses/LICENSE-2.0 |
| 278 |
|
| 279 |
Unless required by applicable law or agreed to in writing, software |
| 280 |
distributed under the License is distributed on an "AS IS" BASIS, |
| 281 |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 282 |
See the License for the specific language governing permissions and |
| 283 |
limitations under the License. |
| 284 |
*/ |