package com.knecon.fforesight.service.viewerdoc.layers;

import com.knecon.fforesight.service.viewerdoc.model.Visualizations;
import com.knecon.fforesight.service.viewerdoc.model.VisualizationsOnPage;

public abstract class AbstractLayerGroup implements LayerGroup {

    protected VisualizationsOnPage getOrCreateVisualizationsOnPage(int page, Visualizations visualizations) {

        if (visualizations.getVisualizationsOnPages().containsKey(page)) {
            return visualizations.getVisualizationsOnPages()
                    .get(page);
        }
        VisualizationsOnPage visualizationsOnPage = VisualizationsOnPage.builder().build();
        visualizations.getVisualizationsOnPages().put(page, visualizationsOnPage);
        return visualizationsOnPage;
    }

}
