| 1 |
/* File: pencil_diagram_maker.inl; Copyright and License: see below */ |
| 2 |
|
| 3 |
#include "pencil_diagram_maker.h" |
| 4 |
#include "u8/u8_trace.h" |
| 5 |
#include <assert.h> |
| 6 |
|
| 7 |
static inline void pencil_diagram_maker_init( pencil_diagram_maker_t *this_, |
| 8 |
const data_visible_set_t *input_data, |
| 9 |
const data_profile_part_t *profile ) |
| 10 |
{ |
| 11 |
U8_TRACE_BEGIN(); |
| 12 |
assert( NULL != input_data ); |
| 13 |
assert( NULL != profile ); |
| 14 |
|
| 15 |
pencil_diagram_painter_init( &((*this_).diagram_painter) ); |
| 16 |
pencil_classifier_painter_init( &((*this_).classifier_painter) ); |
| 17 |
pencil_relationship_painter_init( &((*this_).relationship_painter) ); |
| 18 |
pencil_feature_painter_init( &((*this_).feature_painter) ); |
| 19 |
|
| 20 |
(*this_).input_data = input_data; |
| 21 |
(*this_).profile = profile; |
| 22 |
pencil_layouter_init( &((*this_).layouter), input_data, profile ); |
| 23 |
|
| 24 |
U8_TRACE_END(); |
| 25 |
} |
| 26 |
|
| 27 |
static inline void pencil_diagram_maker_reinit( pencil_diagram_maker_t *this_, |
| 28 |
const data_visible_set_t *input_data, |
| 29 |
const data_profile_part_t *profile ) |
| 30 |
{ |
| 31 |
U8_TRACE_BEGIN(); |
| 32 |
assert( NULL != input_data ); |
| 33 |
assert( NULL != profile ); |
| 34 |
|
| 35 |
(*this_).input_data = input_data; |
| 36 |
(*this_).profile = profile; |
| 37 |
pencil_layouter_reinit( &((*this_).layouter), input_data, profile ); |
| 38 |
|
| 39 |
U8_TRACE_END(); |
| 40 |
} |
| 41 |
|
| 42 |
static inline void pencil_diagram_maker_destroy( pencil_diagram_maker_t *this_ ) |
| 43 |
{ |
| 44 |
U8_TRACE_BEGIN(); |
| 45 |
|
| 46 |
pencil_diagram_painter_destroy( &((*this_).diagram_painter) ); |
| 47 |
pencil_classifier_painter_destroy( &((*this_).classifier_painter) ); |
| 48 |
pencil_relationship_painter_destroy( &((*this_).relationship_painter) ); |
| 49 |
pencil_feature_painter_destroy( &((*this_).feature_painter) ); |
| 50 |
|
| 51 |
pencil_layouter_destroy( &((*this_).layouter) ); |
| 52 |
(*this_).input_data = NULL; |
| 53 |
|
| 54 |
U8_TRACE_END(); |
| 55 |
} |
| 56 |
|
| 57 |
static inline void pencil_diagram_maker_define_grid( pencil_diagram_maker_t *this_, |
| 58 |
geometry_rectangle_t diagram_bounds, |
| 59 |
cairo_t *cr ) |
| 60 |
{ |
| 61 |
U8_TRACE_BEGIN(); |
| 62 |
|
| 63 |
PangoLayout *font_layout; |
| 64 |
font_layout = pango_cairo_create_layout (cr); |
| 65 |
|
| 66 |
pencil_layouter_prepare ( &((*this_).layouter) ); |
| 67 |
pencil_layouter_define_grid ( &((*this_).layouter), diagram_bounds, font_layout ); |
| 68 |
|
| 69 |
g_object_unref (font_layout); |
| 70 |
|
| 71 |
U8_TRACE_END(); |
| 72 |
} |
| 73 |
|
| 74 |
static inline const geometry_grid_t *pencil_diagram_maker_get_grid_const ( const pencil_diagram_maker_t *this_ ) |
| 75 |
{ |
| 76 |
return pencil_layouter_get_grid_const( &((*this_).layouter) ); |
| 77 |
} |
| 78 |
|
| 79 |
static inline void pencil_diagram_maker_layout_elements( pencil_diagram_maker_t *this_, |
| 80 |
data_stat_t *io_layout_stat, |
| 81 |
cairo_t *cr ) |
| 82 |
{ |
| 83 |
U8_TRACE_BEGIN(); |
| 84 |
assert( cr != NULL ); |
| 85 |
|
| 86 |
/* trace input data: */ |
| 87 |
const data_id_t diag_id = data_diagram_get_data_id( data_visible_set_get_diagram_const( (*this_).input_data ) ); |
| 88 |
data_id_trace( &diag_id ); |
| 89 |
data_profile_part_trace( (*this_).profile ); |
| 90 |
|
| 91 |
PangoLayout *font_layout; |
| 92 |
font_layout = pango_cairo_create_layout (cr); |
| 93 |
|
| 94 |
pencil_layouter_layout_elements ( &((*this_).layouter), font_layout ); |
| 95 |
if ( io_layout_stat != NULL ) |
| 96 |
{ |
| 97 |
layout_visible_set_get_statistics( pencil_layouter_get_layout_data_const( &((*this_).layouter) ), io_layout_stat ); |
| 98 |
} |
| 99 |
|
| 100 |
g_object_unref (font_layout); |
| 101 |
|
| 102 |
U8_TRACE_END(); |
| 103 |
} |
| 104 |
|
| 105 |
static inline const layout_visible_set_t *pencil_diagram_maker_get_layout_data_const( const pencil_diagram_maker_t *this_ ) |
| 106 |
{ |
| 107 |
return pencil_layouter_get_layout_data_const( &((*this_).layouter) ); |
| 108 |
} |
| 109 |
|
| 110 |
|
| 111 |
/* |
| 112 |
Copyright 2016-2026 Andreas Warnke |
| 113 |
|
| 114 |
Licensed under the Apache License, Version 2.0 (the "License"); |
| 115 |
you may not use this file except in compliance with the License. |
| 116 |
You may obtain a copy of the License at |
| 117 |
|
| 118 |
http://www.apache.org/licenses/LICENSE-2.0 |
| 119 |
|
| 120 |
Unless required by applicable law or agreed to in writing, software |
| 121 |
distributed under the License is distributed on an "AS IS" BASIS, |
| 122 |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 123 |
See the License for the specific language governing permissions and |
| 124 |
limitations under the License. |
| 125 |
*/ |