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 <shumate/shumate-data-source.h> 22 : : #include <shumate/shumate-map-source.h> 23 : : #include <shumate/shumate-vector-sprite-sheet.h> 24 : : 25 : : G_BEGIN_DECLS 26 : : 27 : : 28 : : #define SHUMATE_TYPE_VECTOR_RENDERER (shumate_vector_renderer_get_type()) 29 [ + - + - : 21 : G_DECLARE_FINAL_TYPE (ShumateVectorRenderer, shumate_vector_renderer, SHUMATE, VECTOR_RENDERER, ShumateMapSource) - + ] 30 : : 31 : : 32 : : gboolean shumate_vector_renderer_is_supported (void); 33 : : 34 : : 35 : : ShumateVectorRenderer *shumate_vector_renderer_new (const char *id, 36 : : const char *style_json, 37 : : GError **error); 38 : : 39 : : gboolean shumate_vector_renderer_set_sprite_sheet_data (ShumateVectorRenderer *self, 40 : : GdkPixbuf *sprites_pixbuf, 41 : : const char *sprites_json, 42 : : GError **error); 43 : : 44 : : ShumateVectorSpriteSheet *shumate_vector_renderer_get_sprite_sheet (ShumateVectorRenderer *self); 45 : : void shumate_vector_renderer_set_sprite_sheet (ShumateVectorRenderer *self, 46 : : ShumateVectorSpriteSheet *sprites); 47 : : 48 : : void shumate_vector_renderer_set_data_source (ShumateVectorRenderer *self, 49 : : const char *name, 50 : : ShumateDataSource *data_source); 51 : : 52 : : /** 53 : : * SHUMATE_STYLE_ERROR: 54 : : * 55 : : * Error domain for errors that may occur when parsing a map style. Errors in 56 : : * this domain will be from the [error@StyleError] enum. 57 : : */ 58 : : #define SHUMATE_STYLE_ERROR shumate_style_error_quark () 59 : : GQuark shumate_style_error_quark (void); 60 : : 61 : : /** 62 : : * ShumateStyleError: 63 : : * @SHUMATE_STYLE_ERROR_FAILED: An unspecified error occurred during the operation. 64 : : * @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). 65 : : * @SHUMATE_STYLE_ERROR_UNSUPPORTED_LAYER: An unsupported layer type was encountered. 66 : : * @SHUMATE_STYLE_ERROR_INVALID_EXPRESSION: An invalid or unrecognized expression was encountered. 67 : : * @SHUMATE_STYLE_ERROR_SUPPORT_OMITTED: Libshumate was compiled without vector tile support. 68 : : * @SHUMATE_STYLE_ERROR_UNSUPPORTED: An unsupported style spec feature was encountered. 69 : : * 70 : : * Error codes that occurs while parsing the style in [class@VectorRenderer]. 71 : : */ 72 : : typedef enum { 73 : : SHUMATE_STYLE_ERROR_FAILED, 74 : : SHUMATE_STYLE_ERROR_MALFORMED_STYLE, 75 : : SHUMATE_STYLE_ERROR_UNSUPPORTED_LAYER, 76 : : SHUMATE_STYLE_ERROR_INVALID_EXPRESSION, 77 : : SHUMATE_STYLE_ERROR_SUPPORT_OMITTED, 78 : : SHUMATE_STYLE_ERROR_UNSUPPORTED, 79 : : } ShumateStyleError; 80 : : 81 : : G_END_DECLS