FDM backend refactoring for const correctness, clarity ...

This commit is contained in:
Vojtech Bubnik 2021-05-06 15:08:57 +02:00
parent b5573f959b
commit dd72016159
5 changed files with 57 additions and 63 deletions

View file

@ -22,7 +22,6 @@ class LayerRegion
public:
Layer* layer() { return m_layer; }
const Layer* layer() const { return m_layer; }
PrintRegion& region() { return *m_region; }
const PrintRegion& region() const { return *m_region; }
// collection of surfaces generated by slicing the original geometry
@ -86,12 +85,12 @@ public:
protected:
friend class Layer;
LayerRegion(Layer *layer, PrintRegion *region) : m_layer(layer), m_region(region) {}
LayerRegion(Layer *layer, const PrintRegion *region) : m_layer(layer), m_region(region) {}
~LayerRegion() {}
private:
Layer *m_layer;
PrintRegion *m_region;
Layer *m_layer;
const PrintRegion *m_region;
};
@ -128,7 +127,7 @@ public:
size_t region_count() const { return m_regions.size(); }
const LayerRegion* get_region(int idx) const { return m_regions[idx]; }
LayerRegion* get_region(int idx) { return m_regions[idx]; }
LayerRegion* add_region(PrintRegion* print_region);
LayerRegion* add_region(const PrintRegion *print_region);
const LayerRegionPtrs& regions() const { return m_regions; }
// Test whether whether there are any slices assigned to this layer.
bool empty() const;