//  ************************************************************************************************
//
//  BornAgain: simulate and fit reflection and scattering
//
//! @file      GUI/View/Scene/OverlayStyle.cpp
//! @brief     Implements class GUI::Overlay.
//!
//! @homepage  http://www.bornagainproject.org
//! @license   GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2018
//! @authors   Scientific Computing Group at MLZ (see CITATION, AUTHORS)
//
//  ************************************************************************************************

#include "GUI/View/Scene/OverlayFactory.h"
#include "Base/Util/Assert.h"
#include "GUI/Model/Mask/MaskItems.h"
#include "GUI/Model/Mask/PointItem.h"
#include "GUI/View/Overlay/EllipseOverlay.h"
#include "GUI/View/Overlay/FullframeOverlay.h"
#include "GUI/View/Overlay/LineOverlays.h"
#include "GUI/View/Overlay/PolygonOverlay.h"
#include "GUI/View/Overlay/ROIOverlay.h"
#include "GUI/View/Overlay/VertexOverlay.h"

IOverlay* GUI::Overlay::createOverlay(OverlayItem* item, ColorMap* plot)
{
    if (auto* mask = dynamic_cast<RectangleItem*>(item))
        return new RectangleOverlay(mask, plot);

    if (auto* mask = dynamic_cast<PolygonItem*>(item))
        return new PolygonOverlay(mask, plot);

    if (auto* mask = dynamic_cast<PointItem*>(item))
        return new VertexOverlay(mask, plot);

    if (auto* mask = dynamic_cast<VerticalLineItem*>(item))
        return new VerticalLineOverlay(mask, plot);

    if (auto* mask = dynamic_cast<HorizontalLineItem*>(item))
        return new HorizontalLineOverlay(mask, plot);

    if (auto* mask = dynamic_cast<EllipseItem*>(item))
        return new EllipseOverlay(mask, plot);

    if (auto* mask = dynamic_cast<FullframeItem*>(item))
        return new FullframeOverlay(mask, plot);

    if (auto* mask = dynamic_cast<RegionOfInterestItem*>(item))
        return new ROIOverlay(mask, plot);

    ASSERT_NEVER;
}
