degate  0.1.2
AbstractShape.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 __ABSTRACTSHAPE_H__
00023 #define __ABSTRACTSHAPE_H__
00024 
00025 #include <BoundingBox.h>
00026 #include <ColoredObject.h>
00027 
00028 namespace degate {
00029 
00030   /**
00031    * Represents an abstract shape.
00032    */
00033   class AbstractShape {
00034 
00035 
00036   public:
00037 
00038 
00039     /**
00040      * Check in the Point with coordinates x and y is within the area of the shape.
00041      */
00042 
00043     virtual bool in_shape(int x, int y, int max_distance = 0) const = 0;
00044 
00045 
00046     /**
00047      * Check if this shape is in the bounding box.
00048      * Note: it is somhow unclear if this 'in' means complete within or if an intersection is sufficient.
00049      */
00050 
00051     virtual bool in_bounding_box(BoundingBox const& bbox) const = 0;
00052 
00053     /**
00054      * Get the bounding box.
00055      */
00056 
00057     virtual BoundingBox const& get_bounding_box() const = 0;
00058 
00059     /**
00060      * Shift the shape vertically.
00061      * Note: If you store this shape in a QuadTree, you have to manage the changes in your QuadTree by yourself.
00062      */
00063 
00064     virtual void shift_x(int delta_x) = 0;
00065 
00066     /**
00067      * Shift the shape horizontally.
00068      * Note: If you store this shape in a QuadTree, you have to manage the changes in your QuadTree by yourself.
00069      */
00070 
00071     virtual void shift_y(int delta_y) = 0;
00072 
00073 
00074   };
00075 
00076 }
00077 
00078 #endif