| 1 |
/* File: pencil_classifier_1d_layouter.h; Copyright and License: see below */ |
| 2 |
|
| 3 |
#ifndef PENCIL_CLASSIFIER_1D_LAYOUTER_H |
| 4 |
#define PENCIL_CLASSIFIER_1D_LAYOUTER_H |
| 5 |
|
| 6 |
/* public file for the doxygen documentation: */ |
| 7 |
/*! |
| 8 |
* \file |
| 9 |
* \brief Calculates positions of classifiers and features in a 1-dimensional diagram. |
| 10 |
* |
| 11 |
* Timing, Sequence and list diagrams are layouted 1-dimensional. |
| 12 |
*/ |
| 13 |
|
| 14 |
#include "pencil_classifier_composer.h" |
| 15 |
#include "pencil_size.h" |
| 16 |
#include "layout/layout_visible_set.h" |
| 17 |
#include "geometry/geometry_rectangle.h" |
| 18 |
#include "geometry/geometry_h_align.h" |
| 19 |
#include "geometry/geometry_v_align.h" |
| 20 |
#include "set/data_profile_part.h" |
| 21 |
#include "set/data_small_set.h" |
| 22 |
#include "set/data_visible_set.h" |
| 23 |
#include "entity/data_diagram.h" |
| 24 |
#include "entity/data_id.h" |
| 25 |
#include "data_rules.h" |
| 26 |
#include "u8list/universal_array_index_sorter.h" |
| 27 |
#include <cairo.h> |
| 28 |
#include <stdint.h> |
| 29 |
|
| 30 |
/*! |
| 31 |
* \brief attributes of the 1d-classifier layouter |
| 32 |
* |
| 33 |
* \note This class is stateless. Only the layout_data, pencil_size and profile objects are stateful. |
| 34 |
* It may either be instantiated once and used many times or be instantiated per use. |
| 35 |
*/ |
| 36 |
struct pencil_classifier_1d_layouter_struct { |
| 37 |
layout_visible_set_t *layout_data; /* pointer to external layout data */ |
| 38 |
const data_profile_part_t *profile; /*!< pointer to an external stereotype-image cache */ |
| 39 |
const pencil_size_t *pencil_size; /*!< pointer to an external pencil_size_t object, defining pen sizes, gap sizes, font sizes and colors */ |
| 40 |
const geometry_rectangle_t *diagram_draw_area; /*!< pointer to an external drawing rectangle containing inner contents of the diagram */ |
| 41 |
|
| 42 |
pencil_classifier_composer_t classifier_composer; /*!< own instance of a composer object to ask for display dimensions */ |
| 43 |
data_rules_t rules; /*!< own instance of modelling rules */ |
| 44 |
}; |
| 45 |
|
| 46 |
typedef struct pencil_classifier_1d_layouter_struct pencil_classifier_1d_layouter_t; |
| 47 |
|
| 48 |
/*! |
| 49 |
* \brief initializes the classifier layouter |
| 50 |
* |
| 51 |
* \param this_ pointer to own object attributes |
| 52 |
* \param layout_data pointer to the layout information to be used and modified |
| 53 |
* \param profile pointer to the profile-part that provides the stereotypes of the elements to be layouted |
| 54 |
* \param pencil_size pointer to the pencil_size_t object |
| 55 |
*/ |
| 56 |
void pencil_classifier_1d_layouter_init( pencil_classifier_1d_layouter_t *this_, |
| 57 |
layout_visible_set_t *layout_data, |
| 58 |
const data_profile_part_t *profile, |
| 59 |
const pencil_size_t *pencil_size |
| 60 |
); |
| 61 |
|
| 62 |
/*! |
| 63 |
* \brief destroys the layouter |
| 64 |
* |
| 65 |
* \param this_ pointer to own object attributes |
| 66 |
*/ |
| 67 |
void pencil_classifier_1d_layouter_destroy( pencil_classifier_1d_layouter_t *this_ ); |
| 68 |
|
| 69 |
/*! |
| 70 |
* \brief defines classifier bounds for list diagrams |
| 71 |
* |
| 72 |
* \param this_ pointer to own object attributes |
| 73 |
* \param font_layout pango layout object to determine the font metrics in the current cairo drawing context |
| 74 |
*/ |
| 75 |
void pencil_classifier_1d_layouter_layout_for_list( pencil_classifier_1d_layouter_t *this_, PangoLayout *font_layout ); |
| 76 |
|
| 77 |
/*! |
| 78 |
* \brief defines classifier bounds for sequence diagrams |
| 79 |
* |
| 80 |
* \param this_ pointer to own object attributes |
| 81 |
* \param font_layout pango layout object to determine the font metrics in the current cairo drawing context |
| 82 |
*/ |
| 83 |
void pencil_classifier_1d_layouter_layout_for_sequence( pencil_classifier_1d_layouter_t *this_, PangoLayout *font_layout ); |
| 84 |
|
| 85 |
/*! |
| 86 |
* \brief defines classifier bounds for timing diagrams |
| 87 |
* |
| 88 |
* \param this_ pointer to own object attributes |
| 89 |
* \param font_layout pango layout object to determine the font metrics in the current cairo drawing context |
| 90 |
*/ |
| 91 |
void pencil_classifier_1d_layouter_layout_for_timing( pencil_classifier_1d_layouter_t *this_, PangoLayout *font_layout ); |
| 92 |
|
| 93 |
/*! |
| 94 |
* \brief positions the already composed classifiers as equally-spaced horizontal list to a target rectangle |
| 95 |
* |
| 96 |
* \param this_ pointer to own object attributes |
| 97 |
* \param classifier_list an array sorter object |
| 98 |
* \param dest_rect an array sorter object |
| 99 |
* \param v_alignment GEOMETRY_V_ALIGN_TOP, GEOMETRY_V_ALIGN_CENTER or GEOMETRY_V_ALIGN_BOTTOM |
| 100 |
*/ |
| 101 |
void pencil_classifier_1d_layouter_private_layout_horizontal( const pencil_classifier_1d_layouter_t *this_, |
| 102 |
const universal_array_index_sorter_t *classifier_list, |
| 103 |
const geometry_rectangle_t *dest_rect, |
| 104 |
geometry_v_align_t v_alignment |
| 105 |
); |
| 106 |
|
| 107 |
/*! |
| 108 |
* \brief positions the already composed classifiers as equally-spaced vertical list to a target rectangle |
| 109 |
* |
| 110 |
* \param this_ pointer to own object attributes |
| 111 |
* \param classifier_list an array sorter object |
| 112 |
* \param dest_rect an array sorter object |
| 113 |
* \param h_alignment GEOMETRY_H_ALIGN_LEFT, GEOMETRY_H_ALIGN_CENTER or GEOMETRY_H_ALIGN_RIGHT |
| 114 |
*/ |
| 115 |
void pencil_classifier_1d_layouter_private_layout_vertical( const pencil_classifier_1d_layouter_t *this_, |
| 116 |
const universal_array_index_sorter_t *classifier_list, |
| 117 |
const geometry_rectangle_t *dest_rect, |
| 118 |
geometry_h_align_t h_alignment |
| 119 |
); |
| 120 |
|
| 121 |
/*! |
| 122 |
* \brief positions the already composed classifiers linear to list_order horizontally to a target rectangle |
| 123 |
* |
| 124 |
* \param this_ pointer to own object attributes |
| 125 |
* \param classifier_list an array sorter object |
| 126 |
* \param dest_rect an array sorter object |
| 127 |
* \param v_alignment GEOMETRY_V_ALIGN_TOP, GEOMETRY_V_ALIGN_CENTER or GEOMETRY_V_ALIGN_BOTTOM |
| 128 |
*/ |
| 129 |
void pencil_classifier_1d_layouter_private_linear_horizontal( const pencil_classifier_1d_layouter_t *this_, |
| 130 |
const universal_array_index_sorter_t *classifier_list, |
| 131 |
const geometry_rectangle_t *dest_rect, |
| 132 |
geometry_v_align_t v_alignment |
| 133 |
); |
| 134 |
|
| 135 |
/*! |
| 136 |
* \brief positions the already composed classifiers as linear to list_order vertically to a target rectangle |
| 137 |
* |
| 138 |
* \param this_ pointer to own object attributes |
| 139 |
* \param classifier_list an array sorter object |
| 140 |
* \param dest_rect an array sorter object |
| 141 |
* \param h_alignment GEOMETRY_H_ALIGN_LEFT, GEOMETRY_H_ALIGN_CENTER or GEOMETRY_H_ALIGN_RIGHT |
| 142 |
*/ |
| 143 |
void pencil_classifier_1d_layouter_private_linear_vertical( const pencil_classifier_1d_layouter_t *this_, |
| 144 |
const universal_array_index_sorter_t *classifier_list, |
| 145 |
const geometry_rectangle_t *dest_rect, |
| 146 |
geometry_h_align_t h_alignment |
| 147 |
); |
| 148 |
|
| 149 |
#endif /* PENCIL_CLASSIFIER_1D_LAYOUTER_H */ |
| 150 |
|
| 151 |
|
| 152 |
/* |
| 153 |
Copyright 2017-2026 Andreas Warnke |
| 154 |
|
| 155 |
Licensed under the Apache License, Version 2.0 (the "License"); |
| 156 |
you may not use this file except in compliance with the License. |
| 157 |
You may obtain a copy of the License at |
| 158 |
|
| 159 |
http://www.apache.org/licenses/LICENSE-2.0 |
| 160 |
|
| 161 |
Unless required by applicable law or agreed to in writing, software |
| 162 |
distributed under the License is distributed on an "AS IS" BASIS, |
| 163 |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 164 |
See the License for the specific language governing permissions and |
| 165 |
limitations under the License. |
| 166 |
*/ |