//Copyright (c) 2018 Ultimaker B.V.
//CuraEngine is released under the terms of the AGPLv3 or higher.

#ifndef LAYERPART_H
#define LAYERPART_H

/*
The layer-part creation step is the first step in creating actual useful data for 3D printing.
It takes the result of the Slice step, which is an unordered list of polygons, and makes groups of polygons,
each of these groups is called a "part", which sometimes are also known as "islands". These parts represent
isolated areas in the 2D layer with possible holes.

Creating "parts" is an important step, as all elements in a single part should be printed before going to another part.
And all every bit inside a single part can be printed without the nozzle leaving the boundary of this part.

It's also the first step that stores the result in the "data storage" so all other steps can access it.
*/

namespace cura52
{

	class Settings;
	class SliceLayer;
	class SliceMeshStorage;
	class SliceDataStorage;
	class SliceContext;

	struct SlicedLayer;
	class SlicedData;
	/*!
	 * \brief Split a layer into parts.
	 * \param settings The settings to get the settings from (whether to union or
	 * not).
	 * \param storageLayer Where to store the parts.
	 * \param layer The layer to split.
	 */
	void createLayerWithParts(const Settings& settings, SliceLayer& storageLayer, SlicedLayer* layer);

	/*!
	 * \brief Split all layers into parts.
	 * \param mesh The mesh of which to split the layers into parts.
	 * \param slicer The slicer to get the layers from.
	 */
	void createLayerParts(SliceContext* application, SliceMeshStorage& mesh, SlicedData* data);

	/*!
	 * \brief Move support mesh outlines from slicer data into the support
	 * storage.
	 *
	 * \param[out] storage Where to store the support areas.
	 * \param mesh_settings Where to get the settings from what kind of support
	 * mesh it is.
	 * \param slicer Where to get the outlines from.
	 * \return Whether the mesh is used up in support and no normal mesh
	 * processing is needed.
	 */
	void handleSupportModifierMesh(SliceDataStorage& storage, const Settings& mesh_settings, const SlicedData* data);
}//namespace cura52

#endif//LAYERPART_H
