Issue #19: Add LayerSettings Class

* Remove Command line and GUI rendering code
* Add LayerSettings Class with all options
* Prepare to remove mapping parser. Is now integrated in LayerSettings
* Adopt all renderers to check if the supplied layer_info struct has to be rendered.

Further todos:
* Implement correct command line parsing.
* Implement Layerselector and GUI to use new LayerSettings class
This commit is contained in:
2019-06-21 21:41:31 +02:00
parent f5bc8de86e
commit 3ffd63115f
13 changed files with 678 additions and 161 deletions

View File

@@ -240,7 +240,7 @@ static int cairo_renderer_render_cell_to_vector_file(struct gds_cell *cell, GLis
/* Create recording surface for each layer */
for (info_list = layer_infos; info_list != NULL; info_list = g_list_next(info_list)) {
linfo = (struct layer_info *)info_list->data;
if (linfo->layer < MAX_LAYERS) {
if (linfo->layer < MAX_LAYERS && linfo->render) {
lay = &(layers[(unsigned int)linfo->layer]);
lay->linfo = linfo;
lay->rec = cairo_recording_surface_create(CAIRO_CONTENT_COLOR_ALPHA,
@@ -266,6 +266,9 @@ static int cairo_renderer_render_cell_to_vector_file(struct gds_cell *cell, GLis
continue;
}
if (!linfo->render)
continue;
/* Print size */
cairo_recording_surface_ink_extents(layers[linfo->layer].rec, &rec_x0, &rec_y0,
&rec_width, &rec_height);
@@ -309,6 +312,9 @@ static int cairo_renderer_render_cell_to_vector_file(struct gds_cell *cell, GLis
continue;
}
if (!linfo->render)
continue;
if (pdf_file && pdf_cr) {
cairo_set_source_surface(pdf_cr, layers[linfo->layer].rec, -xmin, -ymin);
cairo_paint_with_alpha(pdf_cr, linfo->color.alpha);
@@ -363,17 +369,25 @@ static void cairo_renderer_init(CairoRenderer *self)
static int cairo_renderer_render_output(GdsOutputRenderer *renderer,
struct gds_cell *cell,
GList *layer_infos,
const char *output_file,
double scale)
{
CairoRenderer *c_renderer = GDS_RENDER_CAIRO_RENDERER(renderer);
const char *pdf_file = NULL;
const char *svg_file = NULL;
LayerSettings *settings;
GList *layer_infos = NULL;
const char *output_file;
if (!c_renderer)
return -2000;
output_file = gds_output_renderer_get_output_file(renderer);
settings = gds_output_renderer_get_layer_settings(renderer);
/* Set layer info list. In case of failure it remains NULL */
if (settings)
layer_infos = layer_settings_get_layer_info_list(settings);
if (c_renderer->svg == TRUE)
svg_file = output_file;
else