GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 2 / 0 / 2
Functions: 100.0% 1 / 0 / 1
Branches: 50.0% 9 / 0 / 18

shumate/shumate-vector-renderer.h
Line Branch Exec Source
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 <shumate/shumate-data-source.h>
22 #include <shumate/shumate-map-source.h>
23 #include <shumate/shumate-vector-sprite-sheet.h>
24 #include <shumate/shumate-vector-value.h>
25 #include <shumate/shumate-version.h>
26
27 G_BEGIN_DECLS
28
29
30 #define SHUMATE_TYPE_VECTOR_RENDERER (shumate_vector_renderer_get_type())
31
9/18
None:
✓ Branch 9 → 10 taken 2 times.
✗ Branch 9 → 11 not taken.
✓ Branch 11 → 12 taken 2 times.
✗ Branch 11 → 13 not taken.
✓ Branch 27 → 28 taken 2 times.
✗ Branch 27 → 29 not taken.
✓ Branch 29 → 30 taken 2 times.
✗ Branch 29 → 31 not taken.
✓ Branch 35 → 36 taken 2 times.
✗ Branch 35 → 37 not taken.
✓ Branch 37 → 38 taken 2 times.
✗ Branch 37 → 39 not taken.
SHUMATE_IS_VECTOR_RENDERER:
✓ Branch 3 → 4 taken 20 times.
✗ Branch 3 → 7 not taken.
✓ Branch 4 → 5 taken 20 times.
✗ Branch 4 → 6 not taken.
✗ Branch 5 → 6 not taken.
✓ Branch 5 → 7 taken 20 times.
26 G_DECLARE_FINAL_TYPE (ShumateVectorRenderer, shumate_vector_renderer, SHUMATE, VECTOR_RENDERER, ShumateMapSource)
32
33
34 gboolean shumate_vector_renderer_is_supported (void);
35
36
37 ShumateVectorRenderer *shumate_vector_renderer_new (const char *id,
38 const char *style_json,
39 GError **error);
40
41 gboolean shumate_vector_renderer_set_sprite_sheet_data (ShumateVectorRenderer *self,
42 GdkPixbuf *sprites_pixbuf,
43 const char *sprites_json,
44 GError **error);
45
46 SHUMATE_AVAILABLE_IN_1_1
47 ShumateVectorSpriteSheet *shumate_vector_renderer_get_sprite_sheet (ShumateVectorRenderer *self);
48 SHUMATE_AVAILABLE_IN_1_1
49 void shumate_vector_renderer_set_sprite_sheet (ShumateVectorRenderer *self,
50 ShumateVectorSpriteSheet *sprites);
51 SHUMATE_AVAILABLE_IN_1_2
52 void shumate_vector_renderer_set_data_source (ShumateVectorRenderer *self,
53 const char *name,
54 ShumateDataSource *data_source);
55
56 SHUMATE_AVAILABLE_IN_1_6
57 void shumate_vector_renderer_set_global_state (ShumateVectorRenderer *self,
58 const char *key,
59 ShumateVectorValue *value);
60 SHUMATE_AVAILABLE_IN_1_6
61 ShumateVectorValue *shumate_vector_renderer_get_global_state (ShumateVectorRenderer *self,
62 const char *key);
63 SHUMATE_AVAILABLE_IN_1_6
64 void shumate_vector_renderer_reset_global_state (ShumateVectorRenderer *self,
65 const char *key);
66
67 /**
68 * SHUMATE_STYLE_ERROR:
69 *
70 * Error domain for errors that may occur when parsing a map style. Errors in
71 * this domain will be from the [error@StyleError] enum.
72 */
73 #define SHUMATE_STYLE_ERROR shumate_style_error_quark ()
74 GQuark shumate_style_error_quark (void);
75
76 /**
77 * ShumateStyleError:
78 * @SHUMATE_STYLE_ERROR_FAILED: An unspecified error occurred during the operation.
79 * @SHUMATE_STYLE_ERROR_MALFORMED_STYLE: A JSON node in the style has the wrong type (e.g. an object where there should be an array).
80 * @SHUMATE_STYLE_ERROR_UNSUPPORTED_LAYER: An unsupported layer type was encountered.
81 * @SHUMATE_STYLE_ERROR_INVALID_EXPRESSION: An invalid or unrecognized expression was encountered.
82 * @SHUMATE_STYLE_ERROR_SUPPORT_OMITTED: Libshumate was compiled without vector tile support. As of 1.6, vector tile support is always enabled and this error never occurs.
83 * @SHUMATE_STYLE_ERROR_UNSUPPORTED: An unsupported style spec feature was encountered.
84 *
85 * Error codes that occurs while parsing the style in [class@VectorRenderer].
86 */
87 typedef enum {
88 SHUMATE_STYLE_ERROR_FAILED,
89 SHUMATE_STYLE_ERROR_MALFORMED_STYLE,
90 SHUMATE_STYLE_ERROR_UNSUPPORTED_LAYER,
91 SHUMATE_STYLE_ERROR_INVALID_EXPRESSION,
92 SHUMATE_STYLE_ERROR_SUPPORT_OMITTED,
93 SHUMATE_STYLE_ERROR_UNSUPPORTED,
94 } ShumateStyleError;
95
96 G_END_DECLS
97