32 #ifndef HURRICANE_POLYGON_H
33 #define HURRICANE_POLYGON_H
35 #include "hurricane/Component.h"
36 #include "hurricane/Polygons.h"
48 static const uint32_t Above = (1<<0);
49 static const uint32_t YSteps = (1<<1);
50 static const uint32_t XSteps = (1<<2);
51 static const uint32_t XIncrease = (1<<3);
52 static const uint32_t YIncrease = (1<<4);
54 static const uint32_t
Vertical = (1<<6);
59 Edge (
Point origin,
Point extremity, uint32_t flags );
60 inline size_t getSize ()
const;
61 Point getPoint (
size_t i )
const;
62 inline bool isPositiveSlope ()
const;
63 inline bool isYIncrease ()
const;
64 inline bool isXIncrease ()
const;
65 inline bool isHV ()
const;
66 inline bool isXSteps ()
const;
67 inline bool isYSteps ()
const;
69 string _getTypeName ()
const;
70 string _getString ()
const;
71 Record* _getRecord ()
const;
75 vector<DbU::Unit> _steps;
79 class Points_Manhattan :
public PointHC {
85 virtual Point getElement ()
const;
86 virtual PointHL* getClone ()
const;
87 virtual bool isValid ()
const;
88 virtual void progress ();
89 virtual string _getString ()
const;
96 inline Points_Manhattan (
const Polygon* );
97 inline Points_Manhattan (
const Points_Manhattan& );
98 virtual PointHC* getClone ()
const;
99 virtual PointHL* getLocator ()
const;
100 virtual string _getString ()
const;
102 const Polygon* _polygon;
107 static float getSlope (
const Point&,
const Point& );
109 virtual bool isNonRectangle ()
const;
110 virtual bool isManhattanized ()
const;
113 inline const vector<Point>& getPoints ()
const;
114 inline const vector<Edge*>& getEdges ()
const;
115 virtual size_t getPointsSize ()
const;
116 virtual Point getPoint (
size_t )
const;
117 virtual Box getBoundingBox ()
const;
119 void getSubPolygons ( vector< vector<Point> >& )
const;
120 virtual const Layer* getLayer ()
const;
121 void setLayer (
const Layer* layer );
123 void setPoints (
const vector<Point>& );
124 static float getSign (
const vector<Point>&,
size_t );
125 float getSlope (
size_t i )
const;
126 void manhattanize ();
127 virtual Points getMContour ()
const;
128 virtual void _toJson ( JsonWriter* )
const;
129 static JsonObject* getJsonObject (
unsigned long flags );
130 virtual string _getTypeName ()
const;
131 virtual string _getString ()
const;
132 virtual Record* _getRecord ()
const;
138 std::vector<Point> _points;
139 std::vector<Edge*> _edges;
143 inline const vector<Polygon::Edge*>& Polygon::getEdges ()
const {
return _edges; }
144 inline const vector<Point>& Polygon::getPoints ()
const {
return _points; }
146 inline bool Polygon::Edge::isYIncrease ()
const {
return (_flags & Polygon::YIncrease); }
147 inline bool Polygon::Edge::isXIncrease ()
const {
return (_flags & Polygon::XIncrease); }
148 inline bool Polygon::Edge::isPositiveSlope ()
const {
return not ( (_flags & Polygon::XIncrease) xor (_flags & Polygon::YIncrease) ); }
149 inline bool Polygon::Edge::isHV ()
const {
return (_flags & (Polygon::Horizontal|Polygon::Vertical)); }
150 inline bool Polygon::Edge::isXSteps ()
const {
return (_flags & Polygon::XSteps); }
151 inline bool Polygon::Edge::isYSteps ()
const {
return (_flags & Polygon::YSteps); }
152 inline size_t Polygon::Edge::getSize ()
const {
if (isHV() or (_steps.size() < 2))
return 1;
return (_steps.size() - 1)*2; }
155 inline Polygon::Points_Manhattan::Locator::Locator (
const Locator &locator )
157 , _polygon(locator._polygon)
158 , _iEdge (locator._iEdge)
159 , _iPoint (locator._iPoint)
163 inline Polygon::Points_Manhattan::Points_Manhattan (
const Polygon* polygon )
169 inline Polygon::Points_Manhattan::Points_Manhattan (
const Points_Manhattan& other )
171 , _polygon(other._polygon)
175 class JsonPolygon :
public JsonComponent {
177 static void initialize ();
178 JsonPolygon (
unsigned long flags );
179 virtual string getTypeName ()
const;
180 virtual JsonPolygon* clone (
unsigned long )
const;
181 virtual void toData ( JsonStack& );
188 INSPECTOR_P_SUPPORT(Hurricane::Polygon::Edge);
BasicLayer description (API)
Definition: BasicLayer.h:44
Box description (API)
Definition: Box.h:31
Collection description (API)
Definition: Collection.h:39
Component description (API)
Definition: Component.h:42
std::int64_t Unit
Definition: DbU.h:67
Generic Collection auto-pointer.
Definition: Collection.h:235
Horizontal description (API)
Definition: Horizontal.h:36
Support for JSON export.
Definition: JsonObject.h:83
Layer description (API)
Definition: Layer.h:52
Locator description (API)
Definition: Locator.h:33
Net description (API)
Definition: Net.h:48
Point description (API)
Definition: Point.h:32
Polygon description (API)
Definition: Polygon.h:44
static Polygon * create(Net *, const Layer *, const std::vector< Point > &)
Component Super
Definition: Polygon.h:46
Vertical description (API)
Definition: Vertical.h:36
The namespace dedicated to Hurricane.
Definition: Generalities.dox:5