Skip to content
Snippets Groups Projects
MaterialEditorUtils.h 2.15 KiB
Newer Older
  • Learn to ignore specific revisions
  • //  ************************************************************************************************
    
    Pospelov, Gennady's avatar
    Pospelov, Gennady committed
    //
    
    //  BornAgain: simulate and fit reflection and scattering
    
    Pospelov, Gennady's avatar
    Pospelov, Gennady committed
    //
    
    t.knopff's avatar
    t.knopff committed
    //! @file      GUI/Views/MaterialEditor/MaterialItemUtils.h
    
    //! @brief     Defines class MaterialItemUtils
    
    Pospelov, Gennady's avatar
    Pospelov, Gennady committed
    //!
    
    //! @homepage  http://www.bornagainproject.org
    
    Pospelov, Gennady's avatar
    Pospelov, Gennady committed
    //! @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)
    
    Pospelov, Gennady's avatar
    Pospelov, Gennady committed
    //
    
    //  ************************************************************************************************
    
    Pospelov, Gennady's avatar
    Pospelov, Gennady committed
    
    
    t.knopff's avatar
    t.knopff committed
    #ifndef BORNAGAIN_GUI_VIEWS_MATERIALEDITOR_MATERIALITEMUTILS_H
    #define BORNAGAIN_GUI_VIEWS_MATERIALEDITOR_MATERIALITEMUTILS_H
    
    #include "GUI/Models/ExternalProperty.h"
    
    t.knopff's avatar
    t.knopff committed
    #include "GUI/Models/MaterialItem.h"
    
    #include <QColor>
    #include <QString>
    #include <memory>
    
    class Material;
    
    namespace MaterialItemUtils {
    
    QColor suggestMaterialColor(const QString& name);
    ExternalProperty defaultMaterialProperty();
    
    std::unique_ptr<Material> createDomainMaterial(const ExternalProperty& material_property);
    std::unique_ptr<Material> createDomainMaterial(const ExternalProperty& material_property,
                                                   const MaterialItemContainer& container);
    MaterialItem* findMaterial(const ExternalProperty& material_property);
    
    QString materialTag(const SessionItem& item);
    QStringList materialRelatedModelTypes();
    
    
    //! Constructs material property corresponding to given material.
    
    ExternalProperty materialProperty(const MaterialItem& materialItem);
    
    //! Constructs color property from given color.
    
    ExternalProperty colorProperty(const QColor& color);
    
    //! Calls material selector dialog.
    
    ExternalProperty selectMaterialProperty(const ExternalProperty& previous = ExternalProperty());
    
    
    //! Calls color selector dialog.
    
    ExternalProperty selectColorProperty(const ExternalProperty& previous = ExternalProperty());
    
    //! Gather material property items from a given item
    
    QVector<SessionItem*> materialPropertyItems(SessionItem* item);
    
    Pospelov, Gennady's avatar
    Pospelov, Gennady committed
    } // namespace MaterialItemUtils
    
    t.knopff's avatar
    t.knopff committed
    #endif // BORNAGAIN_GUI_VIEWS_MATERIALEDITOR_MATERIALITEMUTILS_H