| 1 |
/* File: draw_feature_symbol.h; Copyright and License: see below */ |
| 2 |
|
| 3 |
#ifndef DRAW_FEATURE_SYMBOL_H |
| 4 |
#define DRAW_FEATURE_SYMBOL_H |
| 5 |
|
| 6 |
/* public file for the doxygen documentation: */ |
| 7 |
/*! |
| 8 |
* \file |
| 9 |
* \brief Draws simple geometric objects like a lifeline with activity bar |
| 10 |
*/ |
| 11 |
|
| 12 |
#include "pencil_size.h" |
| 13 |
#include "geometry/geometry_rectangle.h" |
| 14 |
#include "entity/data_diagram_type.h" |
| 15 |
#include "entity/data_diagram.h" |
| 16 |
#include <cairo.h> |
| 17 |
#include <stdint.h> |
| 18 |
#include <stdbool.h> |
| 19 |
|
| 20 |
/*! |
| 21 |
* \brief attributes of the draw geometry functions |
| 22 |
* |
| 23 |
* \note This class is nearly stateless. |
| 24 |
* It may either be instantiated once and used many times or be instantiated per use. |
| 25 |
* Only all segments of the same lifeline are expected to be drawn in one backwards-directed sequence. |
| 26 |
*/ |
| 27 |
struct draw_feature_symbol_struct { |
| 28 |
uint32_t last_depth; /*!< This is the last depth of the execution order of the current lifeline */ |
| 29 |
double last_location; /*!< This is the last y coordinate of an execution order or the last x coordinate of a timeline */ |
| 30 |
}; |
| 31 |
|
| 32 |
typedef struct draw_feature_symbol_struct draw_feature_symbol_t; |
| 33 |
|
| 34 |
/*! |
| 35 |
* \brief initializes the draw_feature_symbol_t |
| 36 |
* |
| 37 |
* \param this_ pointer to own object attributes |
| 38 |
*/ |
| 39 |
void draw_feature_symbol_init( draw_feature_symbol_t *this_ ); |
| 40 |
|
| 41 |
/*! |
| 42 |
* \brief resets the draw_feature_symbol_t to start drawing a different lifeline |
| 43 |
* |
| 44 |
* \param this_ pointer to own object attributes |
| 45 |
*/ |
| 46 |
void draw_feature_symbol_reinit( draw_feature_symbol_t *this_ ); |
| 47 |
|
| 48 |
/*! |
| 49 |
* \brief destroys the draw_feature_symbol_t |
| 50 |
* |
| 51 |
* \param this_ pointer to own object attributes |
| 52 |
*/ |
| 53 |
void draw_feature_symbol_destroy( draw_feature_symbol_t *this_ ); |
| 54 |
|
| 55 |
/*! |
| 56 |
* \brief draws a section of a lifeline |
| 57 |
* |
| 58 |
* The lifeline may possibly show one or more execution specifications (activity bar). |
| 59 |
* |
| 60 |
* \param this_ pointer to own object attributes |
| 61 |
* \param bounds bounding rectangle of the lifeline |
| 62 |
* \param to_y upper end coordinate of the section to be drawn |
| 63 |
* \param depth depth of execution specifications on the section |
| 64 |
* \param pencil_size set of sizes and colors for drawing lines and text |
| 65 |
* \param cr a cairo drawing context |
| 66 |
*/ |
| 67 |
void draw_feature_symbol_draw_execution_spec ( draw_feature_symbol_t *this_, |
| 68 |
const geometry_rectangle_t *bounds, |
| 69 |
double to_y, |
| 70 |
uint32_t depth, |
| 71 |
const pencil_size_t *pencil_size, |
| 72 |
cairo_t *cr |
| 73 |
); |
| 74 |
|
| 75 |
/*! |
| 76 |
* \brief draws a section of a lifeline |
| 77 |
* |
| 78 |
* The lifeline may possibly show a timeline. |
| 79 |
* |
| 80 |
* \param this_ pointer to own object attributes |
| 81 |
* \param bounds bounding rectangle of the lifeline |
| 82 |
* \param to_x left end coordinate of the section to be drawn |
| 83 |
* \param active true if a timeline shall be shown |
| 84 |
* \param pencil_size set of sizes and colors for drawing lines and text |
| 85 |
* \param cr a cairo drawing context |
| 86 |
*/ |
| 87 |
void draw_feature_symbol_draw_timeline ( draw_feature_symbol_t *this_, |
| 88 |
const geometry_rectangle_t *bounds, |
| 89 |
double to_x, |
| 90 |
bool active, |
| 91 |
const pencil_size_t *pencil_size, |
| 92 |
cairo_t *cr |
| 93 |
); |
| 94 |
|
| 95 |
/*! |
| 96 |
* \brief draws a rectangular lifeline |
| 97 |
* |
| 98 |
* The lifeline may be used in interaction overview diagrams or in communication diagrams. |
| 99 |
* |
| 100 |
* \param this_ pointer to own object attributes |
| 101 |
* \param bounds bounding rectangle of the lifeline |
| 102 |
* \param highlighted true if a lifeline shall be shown in green |
| 103 |
* \param pencil_size set of sizes and colors for drawing lines and text |
| 104 |
* \param cr a cairo drawing context |
| 105 |
*/ |
| 106 |
void draw_feature_symbol_draw_life_rectangle ( const draw_feature_symbol_t *this_, |
| 107 |
const geometry_rectangle_t *bounds, |
| 108 |
bool highlighted, |
| 109 |
const pencil_size_t *pencil_size, |
| 110 |
cairo_t *cr |
| 111 |
); |
| 112 |
|
| 113 |
#endif /* DRAW_FEATURE_SYMBOL_H */ |
| 114 |
|
| 115 |
|
| 116 |
/* |
| 117 |
Copyright 2026-2026 Andreas Warnke |
| 118 |
|
| 119 |
Licensed under the Apache License, Version 2.0 (the "License"); |
| 120 |
you may not use this file except in compliance with the License. |
| 121 |
You may obtain a copy of the License at |
| 122 |
|
| 123 |
http://www.apache.org/licenses/LICENSE-2.0 |
| 124 |
|
| 125 |
Unless required by applicable law or agreed to in writing, software |
| 126 |
distributed under the License is distributed on an "AS IS" BASIS, |
| 127 |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 128 |
See the License for the specific language governing permissions and |
| 129 |
limitations under the License. |
| 130 |
*/ |