Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
Slic3r::SLAArchiveReader Class Referenceabstract

#include <src/libslic3r/Format/SLAArchiveReader.hpp>

+ Inheritance diagram for Slic3r::SLAArchiveReader:

Public Member Functions

virtual ~SLAArchiveReader ()=default
 
virtual ConfigSubstitutions read (std::vector< ExPolygons > &slices, DynamicPrintConfig &profile)=0
 
virtual ConfigSubstitutions read (DynamicPrintConfig &profile)=0
 

Static Public Member Functions

static std::unique_ptr< SLAArchiveReadercreate (const std::string &fname, const std::string &format_id, SLAImportQuality quality=SLAImportQuality::Balanced, const ProgrFn &progr=[](int) { return false;})
 

Detailed Description

Constructor & Destructor Documentation

◆ ~SLAArchiveReader()

virtual Slic3r::SLAArchiveReader::~SLAArchiveReader ( )
virtualdefault

Member Function Documentation

◆ create()

std::unique_ptr< SLAArchiveReader > Slic3r::SLAArchiveReader::create ( const std::string &  fname,
const std::string &  format_id,
SLAImportQuality  quality = SLAImportQuality::Balanced,
const ProgrFn progr = [](int) { return false; } 
)
static
23{
24 // Create an instance of SLAArchiveReader using the registered archive
25 // reader implementations.
26 // If format_id is specified and valid, that archive format will be
27 // preferred. When format_id is emtpy, the file extension is compared
28 // with the advertised extensions of registered readers and the first
29 // match will be used.
30
31 std::string ext = boost::filesystem::path(fname).extension().string();
32 boost::algorithm::to_lower(ext);
33
34 std::unique_ptr<SLAArchiveReader> ret;
35
36 auto registry = registered_sla_archives();
37
38 auto arch_from = registry.begin();
39 auto arch_to = registry.end();
40
41 auto arch_it = registry.find(ArchiveEntry{format_id.c_str()});
42 if (arch_it != registry.end()) {
43 arch_from = arch_it;
44 arch_to = arch_it;
45 }
46
47 if (!ext.empty()) {
48 if (ext.front() == '.')
49 ext.erase(ext.begin());
50
51 for (auto it = arch_from; !ret && it != arch_to; ++it) {
52 const auto &entry = *it;
53 if (entry.rdfactoryfn) {
54 auto extensions = get_extensions(entry);
55 for (const std::string& supportedext : extensions) {
56 if (ext == supportedext) {
57 ret = entry.rdfactoryfn(fname, quality, progr);
58 break;
59 }
60 }
61 }
62 }
63 }
64
65 return ret;
66}
const std::set< ArchiveEntry > & registered_sla_archives()
Definition SLAArchiveFormatRegistry.cpp:95
std::vector< std::string > get_extensions(const ArchiveEntry &entry)
Definition SLAArchiveFormatRegistry.cpp:100

References Slic3r::get_extensions(), and Slic3r::registered_sla_archives().

Referenced by Slic3r::import_sla_archive(), and Slic3r::import_sla_archive().

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

◆ read() [1/2]

virtual ConfigSubstitutions Slic3r::SLAArchiveReader::read ( DynamicPrintConfig profile)
pure virtual

◆ read() [2/2]

virtual ConfigSubstitutions Slic3r::SLAArchiveReader::read ( std::vector< ExPolygons > &  slices,
DynamicPrintConfig profile 
)
pure virtual

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