# Hurricane VLSI Database

Box.h
1 // ****************************************************************************************************
2 // File: ./hurricane/Box.h
3 // Authors: R. Escassut
4 // Copyright (c) BULL S.A. 2000-2018, All Rights Reserved
5 //
6 // This file is part of Hurricane.
7 //
8 // Hurricane is free software: you can redistribute it and/or modify it under the terms of the GNU
9 // Lesser General Public License as published by the Free Software Foundation, either version 3 of the
10 // License, or (at your option) any later version.
11 //
12 // Hurricane is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
13 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU
14 // General Public License for more details.
15 //
16 // You should have received a copy of the Lesser GNU General Public License along with Hurricane. If
17 // not, see <http://www.gnu.org/licenses/>.
18 // ****************************************************************************************************
19
20 #ifndef HURRICANE_BOX
21 #define HURRICANE_BOX
22
23 #include "hurricane/Point.h"
24
25 namespace Hurricane {
26
27 // ****************************************************************************************************
28 // Box declaration
29 // ****************************************************************************************************
30
31 class Box {
32 // ******
33
34 // Attributes
35 // **********
36
37 private: DbU::Unit _xMin;
38 private: DbU::Unit _yMin;
39 private: DbU::Unit _xMax;
40 private: DbU::Unit _yMax;
41
42 // constructors
43 // ************
44
45 public: Box();
46
47 public: Box(const DbU::Unit& x, const DbU::Unit& y);
48 public: Box(const Point& point);
49 public: Box(const DbU::Unit& x1, const DbU::Unit& y1, const DbU::Unit& x2, const DbU::Unit& y2);
50 public: Box(const Point& point1, const Point& point2);
51
52 public: Box(const Box& box);
53
54 // Operators
55 // *********
56
57 public: Box& operator=(const Box& box);
58
59 public: bool operator==(const Box& box) const;
60 public: bool operator!=(const Box& box) const;
61
62 // Accessors
63 // *********
64
65 public: const DbU::Unit& getXMin() const {return _xMin;};
66 public: const DbU::Unit& getYMin() const {return _yMin;};
67 public: const DbU::Unit& getXMax() const {return _xMax;};
68 public: const DbU::Unit& getYMax() const {return _yMax;};
69
70 public: DbU::Unit getXCenter() const {return ((_xMin + _xMax) / 2);};
71 public: DbU::Unit getYCenter() const {return ((_yMin + _yMax) / 2);};
72 public: Point getCenter() const {return Point(getXCenter(), getYCenter());};
73 public: Point getCornerBL() const { return Point(_xMin,_yMin); }
74 public: Point getCornerTL() const { return Point(_xMin,_yMax); }
75 public: Point getCornerTR() const { return Point(_xMax,_yMax); }
76 public: Point getCornerBR() const { return Point(_xMax,_yMin); }
77
78 public: DbU::Unit getWidth() const {return (_xMax - _xMin);};
79 public: DbU::Unit getHalfWidth() const {return (getWidth() / 2);};
80 public: DbU::Unit getHeight() const {return (_yMax - _yMin);};
81 public: DbU::Unit getHalfHeight() const {return (getHeight() / 2);};
82
83 public: Box getUnion(const Box& box) const;
84
85 public: Box getIntersection(const Box& box) const;
86 public: DbU::Unit manhattanDistance(const Point& pt) const;
87 public: DbU::Unit manhattanDistance(const Box& box) const;
88
89 // Predicates
90 // **********
91
92 public: bool isEmpty() const;
93 public: bool isFlat() const;
94 public: bool isPonctual() const;
95
96 public: bool contains(const DbU::Unit& x, const DbU::Unit& y) const;
97 public: bool contains(const Point& point) const;
98 public: bool contains(const Box& box) const;
99
100 public: bool intersect(const Box& box) const;
101
102 public: bool isConstrainedBy(const Box& box) const;
103
104 // Updators
105 // ********
106
107 public: Box& makeEmpty();
108
109 public: Box& inflate(const DbU::Unit& d);
110 public: Box& inflate(const DbU::Unit& dx, const DbU::Unit& dy);
111 public: Box& inflate(const DbU::Unit& dxMin, const DbU::Unit& dyMin, const DbU::Unit& dxMax, const DbU::Unit& dyMax);
112 public: Box getInflated(const DbU::Unit& d) const;
113 public: Box& shrinkByFactor(double factor); // 0 <= factor <= 1
114
115 public: Box& merge(const DbU::Unit& x, const DbU::Unit& y);
116 public: Box& merge(const Point& point);
117 public: Box& merge(const DbU::Unit& x1, const DbU::Unit& y1, const DbU::Unit& x2, const DbU::Unit& y2);
118 public: Box& merge(const Box& box);
119
120 public: Box& translate(const DbU::Unit& dx, const DbU::Unit& dy);
121
122 // Others
123 // ******
124
125
126 public: string _getTypeName() const { return _TName("Box"); };
127 public: string _getString() const;
128 public: Record* _getRecord() const;
129 public: void toJson(JsonWriter*) const;
130
131 };
132
133
134 class JsonBox : public JsonObject {
135 // ********************************
136
137 public: static void initialize();
138 public: JsonBox(unsigned long);
139 public: virtual string getTypeName() const;
140 public: virtual JsonBox* clone(unsigned long) const;
141 public: virtual void toData(JsonStack&);
142 };
143
144
145 } // End of Hurricane namespace.
146
147
148 INSPECTOR_PV_SUPPORT(Hurricane::Box);
149
150
151 #endif // HURRICANE_BOX
152
153
154 // ****************************************************************************************************
155 // Copyright (c) BULL S.A. 2000-2018, All Rights Reserved
156 // ****************************************************************************************************
Hurricane::Box::getXMax
const DbU::Unit & getXMax() const
Definition: Box.h:67
Hurricane::Box::getYMax
const DbU::Unit & getYMax() const
Definition: Box.h:68
Hurricane::Box::contains
bool contains(const DbU::Unit &x, const DbU::Unit &y) const
Hurricane::Box::Box
Box()
Hurricane::Box::getXCenter
DbU::Unit getXCenter() const
Definition: Box.h:70
Hurricane::DbU::Unit
std::int64_t Unit
Definition: DbU.h:70
Hurricane::Box::getYCenter
DbU::Unit getYCenter() const
Definition: Box.h:71
Hurricane::Point
Point description (API)
Definition: Point.h:32
Hurricane::Box::isPonctual
bool isPonctual() const
Hurricane::Box::inflate
Box & inflate(const DbU::Unit &d)
Hurricane::Box::getXMin
const DbU::Unit & getXMin() const
Definition: Box.h:65
Hurricane::Box::operator=
Box & operator=(const Box &box)
Hurricane::Box::isConstrainedBy
bool isConstrainedBy(const Box &box) const
Hurricane::Box::getIntersection
Box getIntersection(const Box &box) const
Hurricane::Box::getHalfWidth
DbU::Unit getHalfWidth() const
Definition: Box.h:79
Hurricane::Box::makeEmpty
Box & makeEmpty()
Hurricane::Box::getCenter
Point getCenter() const
Definition: Box.h:72
Hurricane::Box
Box description (API)
Definition: Box.h:31
Hurricane::Box::getWidth
DbU::Unit getWidth() const
Definition: Box.h:78
Hurricane::Box::getHalfHeight
DbU::Unit getHalfHeight() const
Definition: Box.h:81
Hurricane::Box::translate
Box & translate(const DbU::Unit &dx, const DbU::Unit &dy)
Hurricane::Box::intersect
bool intersect(const Box &box) const
Hurricane::Box::getHeight
DbU::Unit getHeight() const
Definition: Box.h:80
Hurricane::Box::merge
Box & merge(const DbU::Unit &x, const DbU::Unit &y)
Hurricane::Box::operator==
bool operator==(const Box &box) const
Hurricane
The namespace dedicated to Hurricane.
Definition: Generalities.dox:5
Hurricane::Box::operator!=
bool operator!=(const Box &box) const
Hurricane::Box::isFlat
bool isFlat() const
Hurricane::Box::getYMin
const DbU::Unit & getYMin() const
Definition: Box.h:66
Hurricane::Box::isEmpty
bool isEmpty() const
Hurricane::Box::getUnion
Box getUnion(const Box &box) const

Generated by doxygen 1.8.14 on Sun Mar 8 2020 | Return to top of page

Hurricane VLSI Database | Copyright © 2000-2016 Bull S.A. All rights reserved