OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::GUI::Materials Struct Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/ConfigWizard_private.hpp>

Collaboration diagram for Slic3r::GUI::Materials:

Public Member Functions

 Materials (Technology technology)
void push (const Preset *preset)
void add_printer (const Preset *preset)
void clear ()
bool containts (const Preset *preset) const
bool get_omnipresent (const Preset *preset)
const std::vector< const Preset * > get_presets_by_alias (const std::string name)
size_t get_printer_counter (const Preset *preset)
const std::string & appconfig_section () const
const std::string & get_type (const Preset *preset) const
const std::string & get_vendor (const Preset *preset) const
template<class F>
void filter_presets (const Preset *printer, const std::string &type, const std::string &vendor, F cb)

Static Public Member Functions

static const std::string & get_filament_type (const Preset *preset)
static const std::string & get_filament_vendor (const Preset *preset)
static const std::string & get_material_type (const Preset *preset)
static const std::string & get_material_vendor (const Preset *preset)

Public Attributes

Technology technology
std::vector< const Preset * > presets
std::vector< std::pair< std::string, size_t > > compatibility_counter
std::set< std::string > types
std::set< const Preset * > printers

Static Public Attributes

static const std::string UNKNOWN = L("(Unknown)")

Detailed Description

Constructor & Destructor Documentation

◆ Materials()

Slic3r::GUI::Materials::Materials ( Technology technology)
inline
Technology technology
Definition ConfigWizard_private.hpp:105

References technology.

Member Function Documentation

◆ add_printer()

void Slic3r::GUI::Materials::add_printer ( const Preset * preset)
1734{
1735 printers.insert(preset);
1736}
std::set< const Preset * > printers
Definition ConfigWizard_private.hpp:111

References printers.

◆ appconfig_section()

const std::string & Slic3r::GUI::Materials::appconfig_section ( ) const
1747{
1749}
static const std::string SECTION_FILAMENTS
Definition AppConfig.hpp:408
static const std::string SECTION_MATERIALS
Definition AppConfig.hpp:409
@ T_FFF
Definition ConfigWizard_private.hpp:69

References Slic3r::AppConfig::SECTION_FILAMENTS, Slic3r::AppConfig::SECTION_MATERIALS, Slic3r::GUI::T_FFF, and technology.

Referenced by Slic3r::GUI::ConfigWizard::priv::select_default_materials_for_printer_model(), and Slic3r::GUI::ConfigWizard::priv::select_default_materials_for_printer_models().

Here is the caller graph for this function:

◆ clear()

void Slic3r::GUI::Materials::clear ( )
1739{
1740 presets.clear();
1741 types.clear();
1742 printers.clear();
1743 compatibility_counter.clear();
1744}
std::set< std::string > types
Definition ConfigWizard_private.hpp:110
std::vector< const Preset * > presets
Definition ConfigWizard_private.hpp:107
std::vector< std::pair< std::string, size_t > > compatibility_counter
Definition ConfigWizard_private.hpp:109

References compatibility_counter, presets, printers, and types.

◆ containts()

bool Slic3r::GUI::Materials::containts ( const Preset * preset) const
inline
118 {
119 //return std::find(presets.begin(), presets.end(), preset) != presets.end();
120 return std::find_if(presets.begin(), presets.end(),
121 [preset](const Preset* element) { return element == preset; }) != presets.end();
122
123 }
@ Preset
Definition calib.hpp:39

References presets.

◆ filter_presets()

template<class F>
void Slic3r::GUI::Materials::filter_presets ( const Preset * printer,
const std::string & type,
const std::string & vendor,
F cb )
inline
152 {
153 for (auto preset : presets) {
154 const Preset& prst = *(preset);
155 const Preset& prntr = *printer;
156 if ((printer == nullptr || is_compatible_with_printer(PresetWithVendorProfile(prst, prst.vendor), PresetWithVendorProfile(prntr, prntr.vendor))) &&
157 (type.empty() || get_type(preset) == type) &&
158 (vendor.empty() || get_vendor(preset) == vendor)) {
159
160 cb(preset);
161 }
162 }
163 }
bool is_compatible_with_printer(const PresetWithVendorProfile &preset, const PresetWithVendorProfile &active_printer, const DynamicPrintConfig *extra_config)
Definition Preset.cpp:909
const std::string & get_vendor(const Preset *preset) const
Definition ConfigWizard.cpp:1756
const std::string & get_type(const Preset *preset) const
Definition ConfigWizard.cpp:1751

References Slic3r::F, get_type(), get_vendor(), Slic3r::is_compatible_with_printer(), presets, and Slic3r::Preset::vendor.

Here is the call graph for this function:

◆ get_filament_type()

const std::string & Slic3r::GUI::Materials::get_filament_type ( const Preset * preset)
static
1762{
1763 const auto *opt = preset->config.opt<ConfigOptionStrings>("filament_type");
1764 if (opt != nullptr && opt->values.size() > 0) {
1765 return opt->values[0];
1766 } else {
1767 return UNKNOWN;
1768 }
1769}
static const std::string UNKNOWN
Definition ConfigWizard_private.hpp:165

References Slic3r::Preset::config, Slic3r::DynamicConfig::opt(), and UNKNOWN.

Referenced by get_type(), and push().

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

◆ get_filament_vendor()

const std::string & Slic3r::GUI::Materials::get_filament_vendor ( const Preset * preset)
static
1773{
1774 const auto *opt = preset->config.opt<ConfigOptionStrings>("filament_vendor");
1775 if (opt != nullptr && opt->values.size() > 0) {
1776 return opt->values[0];
1777 } else {
1778 return UNKNOWN;
1779 }
1780}

References Slic3r::Preset::config, Slic3r::DynamicConfig::opt(), and UNKNOWN.

Referenced by get_vendor().

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

◆ get_material_type()

const std::string & Slic3r::GUI::Materials::get_material_type ( const Preset * preset)
static
1783{
1784 const auto *opt = preset->config.opt<ConfigOptionString>("material_type");
1785 if (opt != nullptr) {
1786 return opt->value;
1787 } else {
1788 return UNKNOWN;
1789 }
1790}
zaa_minimize_perimeter_height ConfigOptionString
Definition PrintConfig.hpp:1702

References Slic3r::Preset::config, Slic3r::DynamicConfig::opt(), and UNKNOWN.

Referenced by get_type(), and push().

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

◆ get_material_vendor()

const std::string & Slic3r::GUI::Materials::get_material_vendor ( const Preset * preset)
static
1793{
1794 const auto *opt = preset->config.opt<ConfigOptionString>("material_vendor");
1795 return opt != nullptr ? opt->value : UNKNOWN;
1796}

References Slic3r::Preset::config, Slic3r::DynamicConfig::opt(), and UNKNOWN.

Referenced by get_vendor().

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

◆ get_omnipresent()

bool Slic3r::GUI::Materials::get_omnipresent ( const Preset * preset)
inline
125 {
126 return get_printer_counter(preset) == printers.size();
127 }
size_t get_printer_counter(const Preset *preset)
Definition ConfigWizard_private.hpp:140

References get_printer_counter(), and printers.

Here is the call graph for this function:

◆ get_presets_by_alias()

const std::vector< const Preset * > Slic3r::GUI::Materials::get_presets_by_alias ( const std::string name)
inline
129 {
130 std::vector<const Preset*> ret_vec;
131 for (auto it = presets.begin(); it != presets.end(); ++it) {
132 if ((*it)->alias == name)
133 ret_vec.push_back((*it));
134 }
135 return ret_vec;
136 }

References presets.

◆ get_printer_counter()

size_t Slic3r::GUI::Materials::get_printer_counter ( const Preset * preset)
inline
140 {
141 for (auto it : compatibility_counter) {
142 if (it.first == preset->alias)
143 return it.second;
144 }
145 return 0;
146 }

References Slic3r::Preset::alias, and compatibility_counter.

Referenced by get_omnipresent().

Here is the caller graph for this function:

◆ get_type()

const std::string & Slic3r::GUI::Materials::get_type ( const Preset * preset) const
1752{
1753 return (technology & T_FFF) ? get_filament_type(preset) : get_material_type(preset);
1754}
static const std::string & get_material_type(const Preset *preset)
Definition ConfigWizard.cpp:1782
static const std::string & get_filament_type(const Preset *preset)
Definition ConfigWizard.cpp:1761

References get_filament_type(), get_material_type(), Slic3r::GUI::T_FFF, and technology.

Referenced by filter_presets().

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

◆ get_vendor()

const std::string & Slic3r::GUI::Materials::get_vendor ( const Preset * preset) const
1757{
1758 return (technology & T_FFF) ? get_filament_vendor(preset) : get_material_vendor(preset);
1759}
static const std::string & get_filament_vendor(const Preset *preset)
Definition ConfigWizard.cpp:1772
static const std::string & get_material_vendor(const Preset *preset)
Definition ConfigWizard.cpp:1792

References get_filament_vendor(), get_material_vendor(), Slic3r::GUI::T_FFF, and technology.

Referenced by filter_presets().

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

◆ push()

void Slic3r::GUI::Materials::push ( const Preset * preset)
1726{
1727 presets.emplace_back(preset);
1728 types.insert(technology & T_FFF
1731}

References get_filament_type(), get_material_type(), presets, Slic3r::GUI::T_FFF, technology, and types.

Here is the call graph for this function:

Member Data Documentation

◆ compatibility_counter

std::vector<std::pair<std::string, size_t> > Slic3r::GUI::Materials::compatibility_counter

Referenced by clear(), and get_printer_counter().

◆ presets

std::vector<const Preset*> Slic3r::GUI::Materials::presets

◆ printers

std::set<const Preset*> Slic3r::GUI::Materials::printers

Referenced by add_printer(), clear(), and get_omnipresent().

◆ technology

◆ types

std::set<std::string> Slic3r::GUI::Materials::types

Referenced by clear(), and push().

◆ UNKNOWN

const std::string Slic3r::GUI::Materials::UNKNOWN = L("(Unknown)")
static

The documentation for this struct was generated from the following files: