| 1 |
/* File: layout_diagram.h; Copyright and License: see below */ |
| 2 |
|
| 3 |
#ifndef LAYOUT_DIAGRAM_H |
| 4 |
#define LAYOUT_DIAGRAM_H |
| 5 |
|
| 6 |
/* public file for the doxygen documentation: */ |
| 7 |
/*! |
| 8 |
* \file |
| 9 |
* \brief Defines dimensions of a diagram |
| 10 |
*/ |
| 11 |
|
| 12 |
#include "geometry/geometry_rectangle.h" |
| 13 |
#include "entity/data_diagram.h" |
| 14 |
|
| 15 |
/*! |
| 16 |
* \brief dimensions of a diagram |
| 17 |
*/ |
| 18 |
struct layout_diagram_struct { |
| 19 |
geometry_rectangle_t bounds; /*!< bounding box of the diagram */ |
| 20 |
geometry_rectangle_t draw_area; /*!< drawing rectangle of inner contents of the diagram */ |
| 21 |
geometry_rectangle_t label_box; /*!< bounding box of the label of the diagram (without border line) */ |
| 22 |
const data_diagram_t *data; /*!< pointer to the data object of the diagram */ |
| 23 |
}; |
| 24 |
|
| 25 |
typedef struct layout_diagram_struct layout_diagram_t; |
| 26 |
|
| 27 |
/*! |
| 28 |
* \brief initializes the layout_diagram_t struct with a pointer to diagram_data. |
| 29 |
* |
| 30 |
* \param this_ pointer to own object attributes |
| 31 |
* \param diagram_data pointer to data object which is layouted |
| 32 |
*/ |
| 33 |
static inline void layout_diagram_init ( layout_diagram_t *this_, const data_diagram_t *diagram_data ); |
| 34 |
|
| 35 |
/*! |
| 36 |
* \brief destroys the layout_diagram_t struct |
| 37 |
* |
| 38 |
* \param this_ pointer to own object attributes |
| 39 |
*/ |
| 40 |
static inline void layout_diagram_destroy ( layout_diagram_t *this_ ); |
| 41 |
|
| 42 |
/*! |
| 43 |
* \brief checks if the diagram data is valid |
| 44 |
* |
| 45 |
* \param this_ pointer to own object attributes |
| 46 |
* \return true if (*this_).data points to valid data |
| 47 |
*/ |
| 48 |
static inline bool layout_diagram_is_valid ( const layout_diagram_t *this_ ); |
| 49 |
|
| 50 |
/*! |
| 51 |
* \brief gets the bounding box of the diagram |
| 52 |
* |
| 53 |
* \param this_ pointer to own object attributes |
| 54 |
* \return pointer to geometry_rectangle_t. |
| 55 |
*/ |
| 56 |
static inline const geometry_rectangle_t *layout_diagram_get_bounds_const ( const layout_diagram_t *this_ ); |
| 57 |
|
| 58 |
/*! |
| 59 |
* \brief sets the bounding box of the diagram |
| 60 |
* |
| 61 |
* \param this_ pointer to own object attributes |
| 62 |
* \param diagram_bounds coordinates of new bounding box |
| 63 |
*/ |
| 64 |
static inline void layout_diagram_set_bounds ( layout_diagram_t *this_, const geometry_rectangle_t *diagram_bounds ); |
| 65 |
|
| 66 |
/*! |
| 67 |
* \brief gets the draw area of the diagram |
| 68 |
* |
| 69 |
* \param this_ pointer to own object attributes |
| 70 |
* \return pointer to geometry_rectangle_t. |
| 71 |
*/ |
| 72 |
static inline const geometry_rectangle_t *layout_diagram_get_draw_area_const ( const layout_diagram_t *this_ ); |
| 73 |
|
| 74 |
/*! |
| 75 |
* \brief sets the draw_area of the diagram |
| 76 |
* |
| 77 |
* \param this_ pointer to own object attributes |
| 78 |
* \param diagram_draw_area coordinates of new draw_area |
| 79 |
*/ |
| 80 |
static inline void layout_diagram_set_draw_area ( layout_diagram_t *this_, const geometry_rectangle_t *diagram_draw_area ); |
| 81 |
|
| 82 |
/*! |
| 83 |
* \brief gets the label bounds of the diagram |
| 84 |
* |
| 85 |
* \param this_ pointer to own object attributes |
| 86 |
* \return pointer to geometry_rectangle_t. |
| 87 |
*/ |
| 88 |
static inline const geometry_rectangle_t *layout_diagram_get_label_box_const ( const layout_diagram_t *this_ ); |
| 89 |
|
| 90 |
/*! |
| 91 |
* \brief sets the label bounds of the diagram |
| 92 |
* |
| 93 |
* \param this_ pointer to own object attributes |
| 94 |
* \param label_box coordinates of new label bounds |
| 95 |
*/ |
| 96 |
static inline void layout_diagram_set_label_box ( layout_diagram_t *this_, const geometry_rectangle_t *label_box ); |
| 97 |
|
| 98 |
/*! |
| 99 |
* \brief gets the data_diagram_t object |
| 100 |
* |
| 101 |
* \param this_ pointer to own object attributes |
| 102 |
* \return a pointer to the corresponding data_diagram_t object |
| 103 |
*/ |
| 104 |
static inline const data_diagram_t *layout_diagram_get_data_const ( const layout_diagram_t *this_ ); |
| 105 |
|
| 106 |
/*! |
| 107 |
* \brief gets the row id of the diagram |
| 108 |
* |
| 109 |
* This is a shortcut for data_diagram_get_row_id( layout_diagram_get_data_const ( X ) ) |
| 110 |
* |
| 111 |
* \param this_ pointer to own object attributes |
| 112 |
* \return id of the diagram |
| 113 |
*/ |
| 114 |
static inline data_row_t layout_diagram_get_diagram_id ( const layout_diagram_t *this_ ); |
| 115 |
|
| 116 |
#include "layout_diagram.inl" |
| 117 |
|
| 118 |
#endif /* LAYOUT_DIAGRAM_H */ |
| 119 |
|
| 120 |
|
| 121 |
/* |
| 122 |
Copyright 2018-2026 Andreas Warnke |
| 123 |
|
| 124 |
Licensed under the Apache License, Version 2.0 (the "License"); |
| 125 |
you may not use this file except in compliance with the License. |
| 126 |
You may obtain a copy of the License at |
| 127 |
|
| 128 |
http://www.apache.org/licenses/LICENSE-2.0 |
| 129 |
|
| 130 |
Unless required by applicable law or agreed to in writing, software |
| 131 |
distributed under the License is distributed on an "AS IS" BASIS, |
| 132 |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 133 |
See the License for the specific language governing permissions and |
| 134 |
limitations under the License. |
| 135 |
*/ |