degate  0.1.2
Point.h
Go to the documentation of this file.
00001 /* -*-c++-*-
00002 
00003  This file is part of the IC reverse engineering tool degate.
00004 
00005  Copyright 2008, 2009, 2010 by Martin Schobert
00006 
00007  Degate is free software: you can redistribute it and/or modify
00008  it under the terms of the GNU General Public License as published by
00009  the Free Software Foundation, either version 3 of the License, or
00010  any later version.
00011 
00012  Degate is distributed in the hope that it will be useful,
00013  but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  GNU General Public License for more details.
00016 
00017  You should have received a copy of the GNU General Public License
00018  along with degate. If not, see <http://www.gnu.org/licenses/>.
00019 
00020 */
00021 
00022 #ifndef __POINT_H__
00023 #define __POINT_H__
00024 
00025 #include "Shape.h"
00026 
00027 namespace degate {
00028 
00029   class Point {
00030 
00031   private:
00032     int x, y;
00033 
00034   public:
00035 
00036     Point();
00037     Point(int x, int y);
00038 
00039     bool operator==(const Point& other) const;
00040     bool operator!=(const Point& other) const;
00041 
00042     int get_x() const;
00043     int get_y() const;
00044 
00045     void set_x(int x);
00046     void set_y(int y);
00047 
00048     void shift_x(int delta_x);
00049     void shift_y(int delta_y);
00050 
00051     /**
00052      * Calculate the distance to another point.
00053      */
00054     unsigned int get_distance(Point const& p) const;
00055 
00056 
00057     std::string to_string() const;
00058   };
00059 
00060   typedef std::shared_ptr<Point> Point_shptr;
00061 }
00062 
00063 #endif