| 1 |
/* File: pencil_classifier_painter.h; Copyright and License: see below */ |
| 2 |
|
| 3 |
#ifndef PENCIL_CLASSIFIER_PAINTER_H |
| 4 |
#define PENCIL_CLASSIFIER_PAINTER_H |
| 5 |
|
| 6 |
/* public file for the doxygen documentation: */ |
| 7 |
/*! |
| 8 |
* \file |
| 9 |
* \brief Renders a classifier by composing it of draw_graphics, draw_classifier_icon and draw_classifier_label commands |
| 10 |
*/ |
| 11 |
|
| 12 |
#include "pencil_marker.h" |
| 13 |
#include "pencil_size.h" |
| 14 |
#include "pencil_feature_painter.h" |
| 15 |
#include "layout/layout_visible_set.h" |
| 16 |
#include "layout/layout_visible_classifier.h" |
| 17 |
#include "draw/draw_classifier_icon.h" |
| 18 |
#include "draw/draw_classifier_label.h" |
| 19 |
#include "draw/draw_classifier_contour.h" |
| 20 |
#include "draw/draw_stereotype_icon.h" |
| 21 |
#include "geometry/geometry_rectangle.h" |
| 22 |
#include "geometry/geometry_dimensions.h" |
| 23 |
#include "geometry/geometry_h_align.h" |
| 24 |
#include "geometry/geometry_v_align.h" |
| 25 |
#include "entity/data_diagram.h" |
| 26 |
#include "set/data_small_set.h" |
| 27 |
#include "set/data_profile_part.h" |
| 28 |
#include "set/data_visible_set.h" |
| 29 |
#include "entity/data_id.h" |
| 30 |
#include "data_rules.h" |
| 31 |
#include <cairo.h> |
| 32 |
#include <stdint.h> |
| 33 |
|
| 34 |
/*! |
| 35 |
* \brief attributes of the classifier painter |
| 36 |
* |
| 37 |
* \note This class is stateless. |
| 38 |
* It may either be instantiated once and used many times or be instantiated per use. |
| 39 |
*/ |
| 40 |
struct pencil_classifier_painter_struct { |
| 41 |
pencil_marker_t marker; /*!< own instance of a marker */ |
| 42 |
draw_classifier_icon_t draw_classifier_icon; /*!< collection of draw symbol/icon functions */ |
| 43 |
draw_classifier_label_t draw_classifier_label; /*!< collection of draw label functions */ |
| 44 |
draw_classifier_contour_t draw_classifier_contour; /*!< collection of draw contour functions */ |
| 45 |
draw_stereotype_icon_t draw_stereotype_icon; /*!< collection of draw functions for custom stereotype images */ |
| 46 |
}; |
| 47 |
|
| 48 |
typedef struct pencil_classifier_painter_struct pencil_classifier_painter_t; |
| 49 |
|
| 50 |
/*! |
| 51 |
* \brief initializes the painter |
| 52 |
* |
| 53 |
* \param this_ pointer to own object attributes |
| 54 |
*/ |
| 55 |
void pencil_classifier_painter_init( pencil_classifier_painter_t *this_ ); |
| 56 |
|
| 57 |
/*! |
| 58 |
* \brief destroys the painter |
| 59 |
* |
| 60 |
* \param this_ pointer to own object attributes |
| 61 |
*/ |
| 62 |
void pencil_classifier_painter_destroy( pencil_classifier_painter_t *this_ ); |
| 63 |
|
| 64 |
/*! |
| 65 |
* \brief draws the chosen classifier contents into the diagram_bounds area of the cairo drawing context |
| 66 |
* |
| 67 |
* \param this_ pointer to own object attributes |
| 68 |
* \param layouted_classifier pointer to the layout-information and data to be drawn |
| 69 |
* \param mark_focused true if the object is to be marked as "focused" |
| 70 |
* \param mark_highlighted true if the object is to be marked as "highlighted" |
| 71 |
* \param mark_selected true if the object is to be marked as "selected" |
| 72 |
* \param layout_data pointer to the diagrams layout-information needed to calculate the feature compartments |
| 73 |
* \param profile pointer to the profile-part that provides the stereotypes of the elements to be drawn |
| 74 |
* \param pencil_size set of sizes and colors for drawing lines and text |
| 75 |
* \param font_layout structure to layout fonts |
| 76 |
* \param cr a cairo drawing context |
| 77 |
*/ |
| 78 |
void pencil_classifier_painter_draw ( pencil_classifier_painter_t *this_, |
| 79 |
const layout_visible_classifier_t *layouted_classifier, |
| 80 |
data_id_t mark_focused, |
| 81 |
data_id_t mark_highlighted, |
| 82 |
const data_small_set_t *mark_selected, |
| 83 |
const layout_visible_set_t *layout_data, |
| 84 |
const data_profile_part_t *profile, |
| 85 |
const pencil_size_t *pencil_size, |
| 86 |
PangoLayout *font_layout, |
| 87 |
cairo_t *cr |
| 88 |
); |
| 89 |
|
| 90 |
/*! |
| 91 |
* \brief draws feature compartments of the given classifier into the classifier_space area |
| 92 |
* |
| 93 |
* \param this_ pointer to own object attributes |
| 94 |
* \param layouted_classifier pointer to the classifiers layout-information and data to be drawn |
| 95 |
* \param layout_data pointer to the diagrams layout-information needed to calculate the feature compartments |
| 96 |
* \param pencil_size set of sizes and colors for drawing lines and text |
| 97 |
* \param cr a cairo drawing context |
| 98 |
*/ |
| 99 |
void pencil_classifier_painter_private_draw_feature_compartments ( const pencil_classifier_painter_t *this_, |
| 100 |
const layout_visible_classifier_t *layouted_classifier, |
| 101 |
const layout_visible_set_t *layout_data, |
| 102 |
const pencil_size_t *pencil_size, |
| 103 |
cairo_t *cr |
| 104 |
); |
| 105 |
|
| 106 |
#endif /* PENCIL_CLASSIFIER_PAINTER_H */ |
| 107 |
|
| 108 |
|
| 109 |
/* |
| 110 |
Copyright 2016-2026 Andreas Warnke |
| 111 |
|
| 112 |
Licensed under the Apache License, Version 2.0 (the "License"); |
| 113 |
you may not use this file except in compliance with the License. |
| 114 |
You may obtain a copy of the License at |
| 115 |
|
| 116 |
http://www.apache.org/licenses/LICENSE-2.0 |
| 117 |
|
| 118 |
Unless required by applicable law or agreed to in writing, software |
| 119 |
distributed under the License is distributed on an "AS IS" BASIS, |
| 120 |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 121 |
See the License for the specific language governing permissions and |
| 122 |
limitations under the License. |
| 123 |
*/ |