GDS-Render v1.2.1
layer-settings.c File Reference

Implementation of the LayerSettings class. More...

#include <gds-render/layer/layer-settings.h>
#include <stdlib.h>
Include dependency graph for layer-settings.c:

Go to the source code of this file.

Data Structures

struct  _LayerSettings
 

Functions

static void layer_settings_init (LayerSettings *self)
 
static void layer_info_delete_with_name (struct layer_info *const info)
 
static void layer_settings_dispose (GObject *obj)
 
static void layer_settings_class_init (LayerSettingsClass *klass)
 
static struct layer_infolayer_info_copy (const struct layer_info *const info)
 Copy layer_info struct. More...
 
LayerSettings * layer_settings_new ()
 New LayerSettings object. More...
 
int layer_settings_append_layer_info (LayerSettings *settings, struct layer_info *info)
 layer_settings_append_layer_info More...
 
void layer_settings_clear (LayerSettings *settings)
 Clear all layers in this settings object. More...
 
int layer_settings_remove_layer (LayerSettings *settings, int layer)
 Remove a specific layer number from the layer settings. More...
 
GList * layer_settings_get_layer_info_list (LayerSettings *settings)
 Get a GList with layer_info structs. More...
 
static void layer_settings_gen_csv_line (GString *string, struct layer_info *linfo)
 Generate a layer mapping CSV line for a given layer_info struct. More...
 
int layer_settings_to_csv (LayerSettings *settings, const char *path)
 Write layer settings to a CSV file. More...
 
static int layer_settings_load_csv_line_from_stream (GDataInputStream *stream, struct layer_info *linfo)
 Load a line from stream and parse try to parse it as layer information. More...
 
int layer_settings_load_from_csv (LayerSettings *settings, const char *path)
 Load new layer Settings from CSV. More...
 

Detailed Description

Implementation of the LayerSettings class.

Author
Mario Hüttel mario.nosp@m..hue.nosp@m.ttel@.nosp@m.gmx..nosp@m.net

Definition in file layer-settings.c.

Function Documentation

◆ layer_info_copy()

static struct layer_info * layer_info_copy ( const struct layer_info *const  info)
static

Copy layer_info struct.

This function copies a layer info struct.

Note
Be aware, that it does not only copy the pointer to the layer name, but instead duplicates the string.
Parameters
infoInfo to copy
Returns
new layer_info struct

Definition at line 86 of file layer-settings.c.

Here is the caller graph for this function:

◆ layer_info_delete_with_name()

static void layer_info_delete_with_name ( struct layer_info *const  info)
static

Definition at line 42 of file layer-settings.c.

Here is the caller graph for this function:

◆ layer_settings_append_layer_info()

int layer_settings_append_layer_info ( LayerSettings *  settings,
struct layer_info info 
)

layer_settings_append_layer_info

Parameters
settingsLayerSettings object.
infoInfo to append
Returns
Error code. 0 if successful
Note
info is copied internally. You can free this struct afterwards.

Definition at line 111 of file layer-settings.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ layer_settings_class_init()

static void layer_settings_class_init ( LayerSettingsClass *  klass)
static

Definition at line 66 of file layer-settings.c.

Here is the call graph for this function:

◆ layer_settings_clear()

void layer_settings_clear ( LayerSettings *  settings)

Clear all layers in this settings object.

Parameters
settingsLayerSettings object

Definition at line 128 of file layer-settings.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ layer_settings_dispose()

static void layer_settings_dispose ( GObject *  obj)
static

Definition at line 52 of file layer-settings.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ layer_settings_gen_csv_line()

static void layer_settings_gen_csv_line ( GString *  string,
struct layer_info linfo 
)
static

Generate a layer mapping CSV line for a given layer_info struct.

Parameters
stringBuffer to write to
linfoLayer information

Definition at line 177 of file layer-settings.c.

Here is the caller graph for this function:

◆ layer_settings_get_layer_info_list()

GList * layer_settings_get_layer_info_list ( LayerSettings *  settings)

Get a GList with layer_info structs.

This function returns a GList with all layer_info structs in rendering order (bottom to top) that shall be rendered.

Parameters
settingsLayerSettings object
Returns
GList with struct layer_info elements.

Definition at line 166 of file layer-settings.c.

Here is the caller graph for this function:

◆ layer_settings_init()

static void layer_settings_init ( LayerSettings *  self)
static

Definition at line 37 of file layer-settings.c.

◆ layer_settings_load_csv_line_from_stream()

static int layer_settings_load_csv_line_from_stream ( GDataInputStream *  stream,
struct layer_info linfo 
)
static

Load a line from stream and parse try to parse it as layer information.

Parameters
streamInput data stream
linfoLayer info struct to fill
Returns
1 if malformatted line, 0 if parsing was successful and parameters are valid, -1 if file end

Definition at line 247 of file layer-settings.c.

Here is the caller graph for this function:

◆ layer_settings_load_from_csv()

int layer_settings_load_from_csv ( LayerSettings *  settings,
const char *  path 
)

Load new layer Settings from CSV.

This function loads the layer information from a CSV file. All data inside the settings is cleared beforehand.

Parameters
settingsSettings to write to.
pathCSV file path
Returns
0 if successful

Definition at line 310 of file layer-settings.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ layer_settings_new()

LayerSettings * layer_settings_new ( )

New LayerSettings object.

Returns
New object

Definition at line 106 of file layer-settings.c.

Here is the caller graph for this function:

◆ layer_settings_remove_layer()

int layer_settings_remove_layer ( LayerSettings *  settings,
int  layer 
)

Remove a specific layer number from the layer settings.

Parameters
settingsLayerSettings object
layerLayer number
Returns
Error code. 0 if successful

Definition at line 137 of file layer-settings.c.

Here is the call graph for this function:

◆ layer_settings_to_csv()

int layer_settings_to_csv ( LayerSettings *  settings,
const char *  path 
)

Write layer settings to a CSV file.

This function writes the layer settings to a CSV file according to the layer mapping specification (Layer Mapping File Specification)

Parameters
settingsLayerSettings object
pathOutput path for CSV file.
Returns
0 if successful

Definition at line 196 of file layer-settings.c.

Here is the call graph for this function:
Here is the caller graph for this function: