/***************************************************************************
 *                          Zanoza Modeler v2.x                            *
 *      This is unpublished propietary source code of Zanoza Software.     *
 *      The copyright notice does not evidence any actual or intended      *
 *                    publication of such source code.                     *
 *                                                                         *
 *                   Copyright (c) 2002 Zanoza Software.                   *
 *                                                                         *
 *                        All rights reserved.                             *
 ***************************************************************************
 *--------------------------------------------------------------------------
 * @author:   Oleg M.
 *--------------------------------------------------------------------------
 * @purpose:  ZModeler's native 2d point
 *--------------------------------------------------------------------------
 * @histroy: 08.03.2003. Created
 */
#ifndef zpoint_h_included
#define zpoint_h_included

#ifndef zsequence_h_included
# include "zsequence.h"
#endif

//------------------------------------------------------
//  ZPoint - ZModeler's native Point
//------------------------------------------------------
class DLL_LINKAGE ZPoint
{
public:
  ZPoint();
  ZPoint(long const x, long const y);
  ZPoint(const ZPoint& point);
  ~ZPoint();
  ZPoint(const POINT& pt);
  operator LPPOINT() const;
  operator const POINT() const;

public:
  //
  // assign operators
  //
  ZPoint& operator = (const POINT& point);
  ZPoint& operator = (const ZPoint& point);
  ZPoint& operator += (const ZPoint& point);
  ZPoint& operator -= (const ZPoint& point);
  ZPoint& operator *= (const float v);
  ZPoint& operator /= (const float v);

public:
  //
  // compare operators
  //
  bool operator != (const ZPoint& point) const;
  bool operator == (const ZPoint& point) const;
  bool operator <  (const ZPoint& point) const { return lengthF2() < point.lengthF2(); }
  float operator * (const ZPoint& point) const;//dot product
  const ZPoint  operator + (const ZPoint& pt) const;
  const ZPoint  operator - (const ZPoint& pt) const;

public:
  //
  // friend operators
  //
  friend DLL_LINKAGE ZPoint operator * (const float f, const ZPoint& pt);
  friend DLL_LINKAGE ZPoint operator * (const ZPoint& pt, const float f);
  friend DLL_LINKAGE ZPoint operator / (const ZPoint& pt, const float f);

  long  distance( const ZPoint& p) const;
  float distanceF( const ZPoint& p) const;
  long  length() const;
  float lengthF() const;
  long  length2() const;
  float lengthF2() const;

  long x(void) const;
  void x(long _x);
  long y(void) const;
  void y(long _y);

private:
  POINT  m_Point;
};

typedef ZSequence<ZPoint>  ZPointSeq;


#endif //zpoint_h_included

