Ported PrintObject::total_layer_count() to XS

This commit is contained in:
Alessandro Ranellucci 2014-11-30 22:01:46 +01:00
parent c7f5753a28
commit eb23990d6d
4 changed files with 15 additions and 12 deletions

View File

@ -32,14 +32,6 @@ sub support_layers {
return [ map $self->get_support_layer($_), 0..($self->support_layer_count - 1) ];
}
# this is the *total* layer count (including support layers)
# this value is not supposed to be compared with $layer->id
# since they have different semantics
sub total_layer_count {
my $self = shift;
return $self->layer_count + $self->support_layer_count;
}
# this should be idempotent
sub slice {
my $self = shift;

View File

@ -114,13 +114,14 @@ class PrintObject
// adds region_id, too, if necessary
void add_region_volume(int region_id, int volume_id);
size_t layer_count();
size_t total_layer_count() const;
size_t layer_count() const;
void clear_layers();
Layer* get_layer(int idx);
Layer* add_layer(int id, coordf_t height, coordf_t print_z, coordf_t slice_z);
void delete_layer(int idx);
size_t support_layer_count();
size_t support_layer_count() const;
void clear_support_layers();
SupportLayer* get_support_layer(int idx);
SupportLayer* add_support_layer(int id, coordf_t height, coordf_t print_z, coordf_t slice_z);

View File

@ -131,8 +131,17 @@ PrintObject::add_region_volume(int region_id, int volume_id)
region_volumes[region_id].push_back(volume_id);
}
/* This is the *total* layer count (including support layers)
this value is not supposed to be compared with Layer::id
since they have different semantics */
size_t
PrintObject::layer_count()
PrintObject::total_layer_count() const
{
return this->layer_count() + this->support_layer_count();
}
size_t
PrintObject::layer_count() const
{
return this->layers.size();
}
@ -167,7 +176,7 @@ PrintObject::delete_layer(int idx)
}
size_t
PrintObject::support_layer_count()
PrintObject::support_layer_count() const
{
return this->support_layers.size();
}

View File

@ -88,6 +88,7 @@ _constant()
void set_layer_height_ranges(t_layer_height_ranges layer_height_ranges)
%code%{ THIS->layer_height_ranges = layer_height_ranges; %};
size_t total_layer_count();
size_t layer_count();
void clear_layers();
Ref<Layer> get_layer(int idx);