Refactoring: moved Slic3r::STL and Slic3r::AMF to Slic3r::Format::*

This commit is contained in:
Alessandro Ranellucci 2012-02-25 17:35:25 +01:00
parent 2a86932cfe
commit 959230b099
9 changed files with 18 additions and 18 deletions

View file

@ -1,4 +1,4 @@
package Slic3r::AMF;
package Slic3r::Format::AMF;
use Moo;
use Slic3r::Geometry qw(X Y Z);
@ -8,7 +8,7 @@ sub read_file {
my $self = shift;
my ($file) = @_;
eval "require Slic3r::AMF::Parser; 1"
eval "require Slic3r::Format::AMF::Parser; 1"
or die "AMF parsing requires XML::SAX::ExpatXS\n";
open my $fh, '<', $file or die "Failed to open $file\n";
@ -17,7 +17,7 @@ sub read_file {
my $materials = {};
my $meshes_by_material = {};
XML::SAX::ExpatXS
->new(Handler => Slic3r::AMF::Parser->new(
->new(Handler => Slic3r::Format::AMF::Parser->new(
_vertices => $vertices,
_materials => $materials,
_meshes_by_material => $meshes_by_material,

View file

@ -1,4 +1,4 @@
package Slic3r::AMF::Parser;
package Slic3r::Format::AMF::Parser;
use strict;
use warnings;

View file

@ -1,4 +1,4 @@
package Slic3r::STL;
package Slic3r::Format::STL;
use Moo;
use Slic3r::Geometry qw(X Y Z triangle_normal);

View file

@ -27,11 +27,11 @@ sub go {
$self->status_cb->(10, "Processing triangulated mesh");
my $print;
if ($self->input_file =~ /\.stl$/i) {
my $mesh = Slic3r::STL->read_file($self->input_file);
my $mesh = Slic3r::Format::STL->read_file($self->input_file);
$mesh->check_manifoldness;
$print = Slic3r::Print->new_from_mesh($mesh);
} elsif ( $self->input_file =~ /\.amf(\.xml)?$/i) {
my ($materials, $meshes_by_material) = Slic3r::AMF->read_file($self->input_file);
my ($materials, $meshes_by_material) = Slic3r::Format::AMF->read_file($self->input_file);
$_->check_manifoldness for values %$meshes_by_material;
$print = Slic3r::Print->new_from_mesh($meshes_by_material->{_} || +(values %$meshes_by_material)[0]);
} else {