/******************************************************************************  		
 * Company:         SINED GmbH 
 * Author:          Andriy Kurhanevych
 * Created:         12.02.2013
 * Last modified:   $Modtime: 01.03.13 23:45  $
 * Purpose:         Declaration of the PolylineLayer class
 ******************************************************************************/

#ifndef POLYGONLIBRARY_POLYLINELAYER_H
#define POLYGONLIBRARY_POLYLINELAYER_H

#include <vector>

namespace PolygonLibrary
{
	class Polyline;
	class Polygon;
	class PolylineEnumerator;
	class Topology;
	
	//////////////////////////////////////////////////////////////////////////
	/// A container of Polyline objects of a Topology.
	//////////////////////////////////////////////////////////////////////////
	class PolylineLayer
	{

	// ----------------------------- Interface ------------------------------
	public:
		
		// --- Attributes ---

		/// Returns pointer to the Topology this PolylineLayer belongs to. 
		Topology* Topology() const;

		/// Returns the count of Polylines in this PolylineLayer.
		unsigned int      PolylineCount() const;
	
		/// Creates an empty Polyline object and adds to this PolylineLayer. 
		/// Returns pointer to the created Polyline.
		Polyline* CreatePolyline();
		
		/// Creates and adds (to this PolylineLayer) Polyline objects that represent result of splitting 
		/// boundary of the specified polygon at vertices whose angles are equal to or greater than the specified value (in radians).
		/// @return    Collection of pointers to the created Polyline objects.
		/// @exception Exceptions::ArgumentException - if pPolygon is NULL or dSplitMinAngle is negative
		std::vector<Polyline*> CreatePolylines(const Polygon* pPolygon, double dSplitMinAngle);  
	
		/// Deletes the specified Polyline of this PolylineLayer.
		/// @exception Exceptions::ArgumentException - if the Polyline is not contained in this PolylineLayer
	   	void DeletePolyline(Polyline* pPolyline);

		
		// --- Operations ---
	
		/// Commits all changes made since last successful call of this method. 
		void AcceptChanges();
	
	// --------------------------- Implementation ------------------------------
	private:
		friend class TopologyImpl;

		PolylineLayer(PolygonLibrary::Topology* pTopology);
		~PolylineLayer();
		
		// disable copying and assignment
		PolylineLayer(const PolylineLayer&);
		PolylineLayer& operator=(const PolylineLayer&);
		
		// pointer to the implementation part
		const PolylineLayerImpl* impl() const; 
		PolylineLayerImpl*       impl();
		
		PolylineLayerImpl*       m_pimpl;
	};
}
#endif