/**
* Path Manager
* @version: 01-29-2005
* @author Joseph 'Pcjoe' Florencio
*/
#ifndef FXPATHMANAGER_H
#define FXPATHMANAGER_H

#include "fxpathsegment.h"

class CPathManager
{
public:
	// Constructor & Destructor
	CPathManager();
	CPathManager(int id);
	CPathManager(CFXEvent *pEvent, TiXmlElement *pElement);
	~CPathManager();

	// Get Length
	float getLength( void );

	// Add to list
	void addToList( CPathSegment *pSeg );

	// Get Current (latest) Segment
	CPathSegment *getCurrentSegment( void );

	// Add Linear Path
	CLinearPath *addLinearPath( CFXDataPoint dp1, CFXDataPoint dp2 );
	CLinearPath *addLinearPath( void );
	// Add Linear Point (only if current segment is linear)
	void addLinearPoint( CFXDataPoint dp1 );

	// Add Bezier Path
	CBezierPath *addBezierPath( CFXDataPoint a, CFXDataPoint b, CFXDataPoint c, CFXDataPoint d );
	CBezierPath *addBezierPath( void );
	// Add Bezier Points (only if current segment is bezier)
	void addBezierPoints( CFXDataPoint a, CFXDataPoint b );
	
	// Move points by specified vector
	void movePoints( vec3_t move );

	// Rotate points by a specified angle
	void rotatePoints( vec3_t angle );

	// Get point at distance on path
	vec3_t getPointAtDistance( float flDist );

	// Get closest point to ray
	CFXDataPoint *getClosestPointToRay( vec3_t vecRay );

	// Calculate Length ( bezier )
	void calculateLength( void );

	// Render Path
	void RenderPath( void );

	// Write XML
	virtual TiXmlElement *writeXML( void );

	// read XML
	virtual void readXML( TiXmlElement *pElement );

	// Accessors
	int getID( void ) { return m_iID; }
	void setID( int id ) { m_iID = id; }

	// Name
	void setName( std::string strName ) { m_strName = strName; }
	std::string getName( void ) { return m_strName; }

	// FX Event
	void setFXEvent( CFXEvent *pEvent ) { m_pEvent = pEvent; }
	CFXEvent *getFXEvent( void ) { return m_pEvent; }
//private:
	std::list<CPathSegment*>	m_PathSegments;
	CFXEvent	*m_pEvent;
	std::string	m_strName;
	int	m_iID;
};

#endif