/******************************************************************************  		
 * Company:         SINED GmbH 
 * Author:          Andriy Kurhanevych, Maksim Kulagin
 * Created:         4.10.2004
 * Last modified:   $Modtime: 14.02.13 14:30 $
 * Purpose:         Declaration of the Node class 
 ******************************************************************************/

#pragma once 
#ifndef POLYGONLIBRARY_NODE_H
#define POLYGONLIBRARY_NODE_H

namespace PolygonLibrary
{
	class Point;
	class Topology;

	//////////////////////////////////////////////////////////////////////////
	/// A Node represents a vertex of geometry/geometries, 
	/// is referenced by geometric objects of the Topology the Node belongs to, 
	/// and there is no other Node with the same coordinates in the Topology.   
	/// 
	/// The node coordinates have a fixed precision that is a part of solving 
	/// the robustness problem caused by the finite precision of the calculating 
	/// intersections between edges (problem of extraneous and missing intersections). 
	//////////////////////////////////////////////////////////////////////////
	class Node
	{				
	
	// ------------------------------ Interface -------------------------------
	public:
			
		/// Returns the coordinates of the node
		Point Location() const;
		
		/// Returns the x-coordinate of the node
		double X() const;

		/// Returns the y-coordinate of the node
		double Y() const;

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

		/// Indicates if this Node represents the same point as the specified Node. 
		bool operator == (const Node& node) const; 
				
		// --- disable construction, destruction, copying, assignment ---
	private:
		Node();
		~Node();
		// in order to ensure the data consistency (not more than one Node at a location)
		Node(const Node&);
		Node& operator=(const Node&);
		
	// ---------------------------- Implementation -------------------------------	
	private:
		friend class NodeImpl;
		friend class NodeSet;
		friend class PolylineImpl;
		friend class TopologyImpl;
		friend class PolygonOperationsImpl;

		const NodeImpl* impl() const; 
		NodeImpl*       impl(); 
	};
}

#endif




















