Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
Slic3r::GUI::Materials Struct Reference

#include <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 &printer_name, 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 = "(Unknown)"
 

Detailed Description

Constructor & Destructor Documentation

◆ Materials()

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

Member Function Documentation

◆ add_printer()

void Slic3r::GUI::Materials::add_printer ( const Preset preset)
2238{
2239 printers.insert(preset);
2240}
std::set< const Preset * > printers
Definition ConfigWizard_private.hpp:322

References printers.

◆ appconfig_section()

const std::string & Slic3r::GUI::Materials::appconfig_section ( ) const
2251{
2253}
static const std::string SECTION_FILAMENTS
Definition AppConfig.hpp:171
static const std::string SECTION_MATERIALS
Definition AppConfig.hpp:172
@ T_FFF
Definition ConfigWizard_private.hpp:56

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(), Slic3r::GUI::ConfigWizard::priv::select_default_materials_for_printer_models(), Slic3r::GUI::PageMaterials::select_material(), and Slic3r::GUI::PageMaterials::update_lists().

+ Here is the caller graph for this function:

◆ clear()

void Slic3r::GUI::Materials::clear ( )
2243{
2244 presets.clear();
2245 types.clear();
2246 printers.clear();
2247 compatibility_counter.clear();
2248}
std::set< std::string > types
Definition ConfigWizard_private.hpp:321
std::vector< const Preset * > presets
Definition ConfigWizard_private.hpp:318
std::vector< std::pair< std::string, size_t > > compatibility_counter
Definition ConfigWizard_private.hpp:320

References compatibility_counter, presets, printers, and types.

◆ containts()

bool Slic3r::GUI::Materials::containts ( const Preset preset) const
inline
329 {
330 //return std::find(presets.begin(), presets.end(), preset) != presets.end();
331 return std::find_if(presets.begin(), presets.end(),
332 [preset](const Preset* element) { return element == preset; }) != presets.end();
333
334 }

References presets.

◆ filter_presets()

template<class F >
void Slic3r::GUI::Materials::filter_presets ( const Preset printer,
const std::string &  printer_name,
const std::string &  type,
const std::string &  vendor,
F  cb 
)
inline
363 {
364 for (auto preset : presets) {
365 const Preset& prst = *(preset);
366 const Preset& prntr = *printer;
367 if (((printer == nullptr && printer_name == PageMaterials::EMPTY) || (printer != nullptr && is_compatible_with_printer(PresetWithVendorProfile(prst, prst.vendor), PresetWithVendorProfile(prntr, prntr.vendor)))) &&
368 (type.empty() || get_type(preset) == type) &&
369 (vendor.empty() || get_vendor(preset) == vendor) &&
370 prst.vendor && !prst.vendor->templates_profile) {
371
372 cb(preset);
373 }
374 else if ((printer == nullptr && printer_name == PageMaterials::TEMPLATES) && prst.vendor && prst.vendor->templates_profile &&
375 (type.empty() || get_type(preset) == type) &&
376 (vendor.empty() || get_vendor(preset) == vendor)) {
377 cb(preset);
378 }
379 }
380 }
bool is_compatible_with_printer(const PresetWithVendorProfile &preset, const PresetWithVendorProfile &active_printer, const DynamicPrintConfig *extra_config)
Definition Preset.cpp:361
const std::string & get_vendor(const Preset *preset) const
Definition ConfigWizard.cpp:2260
const std::string & get_type(const Preset *preset) const
Definition ConfigWizard.cpp:2255
static const std::string EMPTY
Definition ConfigWizard_private.hpp:285
static const std::string TEMPLATES
Definition ConfigWizard_private.hpp:286

References Slic3r::GUI::PageMaterials::EMPTY, get_type(), get_vendor(), Slic3r::is_compatible_with_printer(), presets, Slic3r::GUI::PageMaterials::TEMPLATES, Slic3r::VendorProfile::templates_profile, and Slic3r::Preset::vendor.

Referenced by Slic3r::GUI::PageMaterials::update_lists().

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

◆ get_filament_type()

const std::string & Slic3r::GUI::Materials::get_filament_type ( const Preset preset)
static
2266{
2267 const auto *opt = preset->config.opt<ConfigOptionStrings>("filament_type");
2268 if (opt != nullptr && opt->values.size() > 0) {
2269 return opt->values[0];
2270 } else {
2271 return UNKNOWN;
2272 }
2273}
static const std::string UNKNOWN
Definition ConfigWizard_private.hpp:382

References Slic3r::Preset::config, Slic3r::ConfigBase::opt(), UNKNOWN, and Slic3r::ConfigOptionVector< T >::values.

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
2276{
2277 const auto *opt = preset->config.opt<ConfigOptionString>("filament_vendor");
2278 return opt != nullptr ? opt->value : UNKNOWN;
2279}

References Slic3r::Preset::config, Slic3r::ConfigBase::opt(), UNKNOWN, and Slic3r::ConfigOptionSingle< T >::value.

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
2282{
2283 const auto *opt = preset->config.opt<ConfigOptionString>("material_type");
2284 if (opt != nullptr) {
2285 return opt->value;
2286 } else {
2287 return UNKNOWN;
2288 }
2289}

References Slic3r::Preset::config, Slic3r::ConfigBase::opt(), UNKNOWN, and Slic3r::ConfigOptionSingle< T >::value.

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
2292{
2293 const auto *opt = preset->config.opt<ConfigOptionString>("material_vendor");
2294 return opt != nullptr ? opt->value : UNKNOWN;
2295}

References Slic3r::Preset::config, Slic3r::ConfigBase::opt(), UNKNOWN, and Slic3r::ConfigOptionSingle< T >::value.

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
336 {
337 return get_printer_counter(preset) == printers.size();
338 }
size_t get_printer_counter(const Preset *preset)
Definition ConfigWizard_private.hpp:351

References get_printer_counter(), and printers.

Referenced by Slic3r::GUI::PageMaterials::update_lists().

+ Here is the call graph for this function:
+ Here is the caller 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
340 {
341 std::vector<const Preset*> ret_vec;
342 for (auto it = presets.begin(); it != presets.end(); ++it) {
343 if ((*it)->alias == name)
344 ret_vec.push_back((*it));
345 }
346 return ret_vec;
347 }

References presets.

Referenced by Slic3r::GUI::PageMaterials::on_material_highlighted().

+ Here is the caller graph for this function:

◆ get_printer_counter()

size_t Slic3r::GUI::Materials::get_printer_counter ( const Preset preset)
inline
351 {
352 for (auto it : compatibility_counter) {
353 if (it.first == preset->alias)
354 return it.second;
355 }
356 return 0;
357 }

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
2256{
2257 return (technology & T_FFF) ? get_filament_type(preset) : get_material_type(preset);
2258}
static const std::string & get_material_type(const Preset *preset)
Definition ConfigWizard.cpp:2281
static const std::string & get_filament_type(const Preset *preset)
Definition ConfigWizard.cpp:2265

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

Referenced by filter_presets(), and Slic3r::GUI::PageMaterials::update_lists().

+ 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
2261{
2262 return (technology & T_FFF) ? get_filament_vendor(preset) : get_material_vendor(preset);
2263}
static const std::string & get_filament_vendor(const Preset *preset)
Definition ConfigWizard.cpp:2275
static const std::string & get_material_vendor(const Preset *preset)
Definition ConfigWizard.cpp:2291

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

Referenced by filter_presets(), and Slic3r::GUI::PageMaterials::update_lists().

+ 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)
2230{
2231 presets.emplace_back(preset);
2232 types.insert(technology & T_FFF
2234 : Materials::get_material_type(preset));
2235}
Materials(Technology technology)
Definition ConfigWizard_private.hpp:324

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

◆ technology

◆ types

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

Referenced by clear(), and push().

◆ UNKNOWN

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

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