3 * Copyright (C) 1999 The gnomemm Development Team
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the Free
17 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #include <libgnomecanvasmm/point.h>
28 Point::Point(const ArtPoint& artpoint)
30 m_ArtPoint = artpoint;
33 Point::Point(gdouble x /* = 0.0 */, gdouble y /* = 0.0 */)
39 Point::Point(const Point& src)
44 Point& Point::operator=(const Point& src)
46 m_ArtPoint = src.m_ArtPoint;
54 gdouble Point::get_x() const
59 void Point::set_x(gdouble x)
64 gdouble Point::get_y() const
69 void Point::set_y(gdouble y)
74 Point Point::operator+(const Point& p2)
76 return Point(get_x() + p2.get_x(), get_y() + p2.get_y());
79 Point Point::operator-(const Point& p2)
81 return Point(get_x() - p2.get_x(), get_y() - p2.get_y());
84 Point const & Point::operator+=(const Point& other)
86 set_x(get_x() + other.get_x());
87 set_y(get_y() + other.get_y());
91 Point const & Point::operator-=(const Point& other)
93 set_x(get_x() - other.get_x());
94 set_y(get_y() - other.get_y());
98 ArtPoint* Point::gobj()
103 const ArtPoint* Point::gobj() const
114 std::ostream& operator<<(std::ostream& out, const Gnome::Art::Point& p)
116 return out << '(' << p.get_x() << ", " << p.get_y() << ')';