Branch data Line data Source code
1 : : /* 2 : : * Copyright (C) 2021 James Westman <james@jwestman.net> 3 : : * 4 : : * This library is free software; you can redistribute it and/or 5 : : * modify it under the terms of the GNU Lesser General Public 6 : : * License as published by the Free Software Foundation; either 7 : : * version 2.1 of the License, or (at your option) any later version. 8 : : * 9 : : * This library is distributed in the hope that it will be useful, 10 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 : : * Lesser General Public License for more details. 13 : : * 14 : : * You should have received a copy of the GNU Lesser General Public 15 : : * License along with this library; if not, see <https://www.gnu.org/licenses/>. 16 : : */ 17 : : 18 : : 19 : : #pragma once 20 : : 21 : : #include <glib-object.h> 22 : : #include "shumate-vector-utils-private.h" 23 : : #include "shumate-vector-render-scope-private.h" 24 : : #include "../shumate-vector-sprite.h" 25 : : 26 : : 27 : : G_BEGIN_DECLS 28 : : 29 : : typedef enum { 30 : : SHUMATE_VECTOR_OVERLAP_NEVER, 31 : : SHUMATE_VECTOR_OVERLAP_ALWAYS, 32 : : SHUMATE_VECTOR_OVERLAP_COOPERATIVE, 33 : : } ShumateVectorOverlap; 34 : : 35 : : typedef enum { 36 : : SHUMATE_VECTOR_ALIGNMENT_AUTO, 37 : : SHUMATE_VECTOR_ALIGNMENT_MAP, 38 : : SHUMATE_VECTOR_ALIGNMENT_VIEWPORT, 39 : : SHUMATE_VECTOR_ALIGNMENT_VIEWPORT_GLYPH, 40 : : } ShumateVectorAlignment; 41 : : 42 : : typedef enum { 43 : : SHUMATE_VECTOR_PLACEMENT_POINT, 44 : : SHUMATE_VECTOR_PLACEMENT_LINE, 45 : : SHUMATE_VECTOR_PLACEMENT_LINE_CENTER, 46 : : } ShumateVectorPlacement; 47 : : 48 : : typedef enum { 49 : : SHUMATE_VECTOR_ANCHOR_CENTER, 50 : : SHUMATE_VECTOR_ANCHOR_TOP, 51 : : SHUMATE_VECTOR_ANCHOR_BOTTOM, 52 : : SHUMATE_VECTOR_ANCHOR_LEFT, 53 : : SHUMATE_VECTOR_ANCHOR_RIGHT, 54 : : SHUMATE_VECTOR_ANCHOR_TOP_LEFT, 55 : : SHUMATE_VECTOR_ANCHOR_TOP_RIGHT, 56 : : SHUMATE_VECTOR_ANCHOR_BOTTOM_LEFT, 57 : : SHUMATE_VECTOR_ANCHOR_BOTTOM_RIGHT, 58 : : } ShumateVectorAnchor; 59 : : 60 : : typedef struct { 61 : : char *layer; 62 : : char *source_layer; 63 : : char *feature_id; 64 : : 65 : : ShumateVectorAnchor icon_anchor; 66 : : ShumateVectorSprite *icon_image; 67 : : double icon_offset_x, icon_offset_y; 68 : : float icon_opacity; 69 : : float icon_rotate; /* in radians */ 70 : : float icon_size; 71 : : ShumateVectorAlignment icon_rotation_alignment; 72 : : 73 : : /* Array of ShumateVectorFormatPart */ 74 : : GPtrArray *formatted_text; 75 : : ShumateVectorAnchor text_anchor; 76 : : GdkRGBA text_color, icon_color; 77 : : double text_opacity; 78 : : double text_size; 79 : : double text_padding; 80 : : double text_letter_spacing; 81 : : char *text_font; 82 : : ShumateVectorAlignment text_rotation_alignment; 83 : : double text_offset_x, text_offset_y; 84 : : double icon_padding_top, icon_padding_right, icon_padding_bottom, icon_padding_left; 85 : : 86 : : ShumateVectorPlacement symbol_placement; 87 : : float symbol_spacing; 88 : : 89 : : ShumateVectorOverlap icon_overlap; 90 : : ShumateVectorOverlap text_overlap; 91 : : 92 : : int tile_x; 93 : : int tile_y; 94 : : int tile_zoom_level; 95 : : 96 : : int layer_idx; 97 : : double symbol_sort_key; 98 : : 99 : : char *cursor; 100 : : 101 : : GHashTable *tags; 102 : : 103 : : gboolean text_keep_upright : 1; 104 : : gboolean text_ignore_placement : 1; 105 : : gboolean text_optional : 1; 106 : : gboolean icon_ignore_placement : 1; 107 : : gboolean icon_optional : 1; 108 : : 109 : : /*< private >*/ 110 : : guint ref_count; 111 : : } ShumateVectorSymbolDetails; 112 : : 113 : : 114 : : ShumateVectorSymbolDetails *shumate_vector_symbol_details_ref (ShumateVectorSymbolDetails *details); 115 : : void shumate_vector_symbol_details_unref (ShumateVectorSymbolDetails *details); 116 : : 117 : : #define SHUMATE_TYPE_VECTOR_SYMBOL_INFO (shumate_vector_symbol_info_get_type ()) 118 : : 119 : : typedef struct _ShumateVectorSymbolInfo ShumateVectorSymbolInfo; 120 : : 121 : : struct _ShumateVectorSymbolInfo 122 : : { 123 : : ShumateVectorSymbolDetails *details; 124 : : 125 : : double x; 126 : : double y; 127 : : 128 : : ShumateVectorLineString *line; 129 : : ShumateVectorPoint line_size; 130 : : float line_length; 131 : : float line_position; 132 : : 133 : : /*< private >*/ 134 : : guint ref_count; 135 : : }; 136 : : 137 : : void shumate_vector_symbol_info_set_line_points (ShumateVectorSymbolInfo *self, 138 : : ShumateVectorLineString *linestring, 139 : : float position); 140 : : 141 : : GType shumate_vector_symbol_info_get_type (void) G_GNUC_CONST; 142 : : ShumateVectorSymbolInfo *shumate_vector_symbol_info_ref (ShumateVectorSymbolInfo *self); 143 : : void shumate_vector_symbol_info_unref (ShumateVectorSymbolInfo *self); 144 : : 145 : : 146 : : int shumate_vector_symbol_info_compare (ShumateVectorSymbolInfo *a, 147 : : ShumateVectorSymbolInfo *b); 148 : : 149 [ + - ]: 15 : G_DEFINE_AUTOPTR_CLEANUP_FUNC (ShumateVectorSymbolDetails, shumate_vector_symbol_details_unref) 150 : : G_DEFINE_AUTOPTR_CLEANUP_FUNC (ShumateVectorSymbolInfo, shumate_vector_symbol_info_unref) 151 : : 152 : : G_END_DECLS 153 : :