From b9a119320adc00aed9f9168282942ba8ee5c0b8f Mon Sep 17 00:00:00 2001 From: Christophe Alexandre Date: Fri, 4 Jan 2008 15:28:35 +0000 Subject: [PATCH] beginning new convention for methods --- hurricane/src/hurricane/Box.cpp | 380 ++- hurricane/src/hurricane/Box.h | 98 +- hurricane/src/hurricane/Cell.cpp | 392 +-- hurricane/src/hurricane/CellCollections.cpp | 14 +- hurricane/src/hurricane/Component.cpp | 6 +- hurricane/src/hurricane/Contact.cpp | 8 +- hurricane/src/hurricane/DRCError.cpp | 4 +- hurricane/src/hurricane/Horizontal.cpp | 4 +- hurricane/src/hurricane/HyperNet.cpp | 6 +- hurricane/src/hurricane/Instance.cpp | 580 ++-- hurricane/src/hurricane/Net.cpp | 692 ++--- hurricane/src/hurricane/Net.h | 4 +- hurricane/src/hurricane/Pad.cpp | 102 +- hurricane/src/hurricane/Point.cpp | 56 +- hurricane/src/hurricane/Point.h | 43 +- hurricane/src/hurricane/QuadTree.cpp | 826 +++--- hurricane/src/hurricane/Reference.cpp | 6 +- hurricane/src/hurricane/Region.cpp | 2784 +++++++++---------- hurricane/src/hurricane/RoutingPad.cpp | 138 +- hurricane/src/hurricane/Rubber.cpp | 66 +- hurricane/src/hurricane/Transformation.cpp | 16 +- hurricane/src/hurricane/Vertical.cpp | 4 +- 22 files changed, 3112 insertions(+), 3117 deletions(-) diff --git a/hurricane/src/hurricane/Box.cpp b/hurricane/src/hurricane/Box.cpp index 61809066..7b759ebc 100644 --- a/hurricane/src/hurricane/Box.cpp +++ b/hurricane/src/hurricane/Box.cpp @@ -18,327 +18,321 @@ namespace Hurricane { Box::Box() // ******* -: _xMin(1), - _yMin(1), - _xMax(-1), - _yMax(-1) -{ -} + : _xMin(1), + _yMin(1), + _xMax(-1), + _yMax(-1) +{} Box::Box(const Unit& x, const Unit& y) // *********************************** -: _xMin(x), - _yMin(y), - _xMax(x), - _yMax(y) -{ -} + : _xMin(x), + _yMin(y), + _xMax(x), + _yMax(y) +{} Box::Box(const Point& point) // ************************* -: _xMin(point.GetX()), - _yMin(point.GetY()), - _xMax(point.GetX()), - _yMax(point.GetY()) -{ -} + : _xMin(point.getX()), + _yMin(point.getY()), + _xMax(point.getX()), + _yMax(point.getY()) +{} Box::Box(const Unit& x1, const Unit& y1, const Unit& x2, const Unit& y2) // ********************************************************************* -: _xMin(min(x1, x2)), - _yMin(min(y1, y2)), - _xMax(max(x1, x2)), - _yMax(max(y1, y2)) -{ -} + : _xMin(min(x1, x2)), + _yMin(min(y1, y2)), + _xMax(max(x1, x2)), + _yMax(max(y1, y2)) +{} Box::Box(const Point& point1, const Point& point2) // *********************************************** -: _xMin(min(point1.GetX(), point2.GetX())), - _yMin(min(point1.GetY(), point2.GetY())), - _xMax(max(point1.GetX(), point2.GetX())), - _yMax(max(point1.GetY(), point2.GetY())) -{ -} + : _xMin(min(point1.getX(), point2.getX())), + _yMin(min(point1.getY(), point2.getY())), + _xMax(max(point1.getX(), point2.getX())), + _yMax(max(point1.getY(), point2.getY())) +{} Box::Box(const Box& box) // ********************* -: _xMin(box._xMin), - _yMin(box._yMin), - _xMax(box._xMax), - _yMax(box._yMax) -{ -} + : _xMin(box._xMin), + _yMin(box._yMin), + _xMax(box._xMax), + _yMax(box._yMax) +{} Box& Box::operator=(const Box& box) // ******************************** { - _xMin = box._xMin; - _yMin = box._yMin; - _xMax = box._xMax; - _yMax = box._yMax; - return *this; + _xMin = box._xMin; + _yMin = box._yMin; + _xMax = box._xMax; + _yMax = box._yMax; + return *this; } bool Box::operator==(const Box& box) const // *************************************** { - return (!IsEmpty() && - !box.IsEmpty() && - (_xMin == box._xMin) && - (_yMin == box._yMin) && - (_xMax == box._xMax) && - (_yMax == box._yMax)); + return (!isEmpty() && + !box.isEmpty() && + (_xMin == box._xMin) && + (_yMin == box._yMin) && + (_xMax == box._xMax) && + (_yMax == box._yMax)); } bool Box::operator!=(const Box& box) const // *************************************** { - return (IsEmpty() || - box.IsEmpty() || - (_xMin != box._xMin) || - (_yMin != box._yMin) || - (_xMax != box._xMax) || - (_yMax != box._yMax)); + return (isEmpty() || + box.isEmpty() || + (_xMin != box._xMin) || + (_yMin != box._yMin) || + (_xMax != box._xMax) || + (_yMax != box._yMax)); } -Box Box::GetUnion(const Box& box) const +Box Box::getUnion(const Box& box) const // ************************************ { - if (IsEmpty() && box.IsEmpty()) return Box(); - return Box(min(_xMin, box._xMin), - min(_yMin, box._yMin), - max(_xMax, box._xMax), - max(_yMax, box._yMax)); + if (isEmpty() && box.isEmpty()) return Box(); + return Box(min(_xMin, box._xMin), + min(_yMin, box._yMin), + max(_xMax, box._xMax), + max(_yMax, box._yMax)); } -Box Box::GetIntersection(const Box& box) const +Box Box::getIntersection(const Box& box) const // ******************************************* { - if (!Intersect(box)) return Box(); - return Box(max(_xMin, box._xMin), - max(_yMin, box._yMin), - min(_xMax, box._xMax), - min(_yMax, box._yMax)); + if (!intersect(box)) return Box(); + return Box(max(_xMin, box._xMin), + max(_yMin, box._yMin), + min(_xMax, box._xMax), + min(_yMax, box._yMax)); } -Unit Box::ManhattanDistance(const Point& pt) const +Unit Box::manhattanDistance(const Point& pt) const // *********************************************** { - Unit dist = 0; - if (IsEmpty()) - throw Error("Can't compute distance to an empty Box"); - if (pt.GetX() < _xMin) dist = _xMin - pt.GetX(); - else if (pt.GetX() > _xMax) dist = pt.GetX() - _xMax; - // else dist = 0; - if (pt.GetY() < _yMin) dist += _yMin - pt.GetY(); - else if (pt.GetY() > _yMax) dist += pt.GetY() - _yMax; - // else dist += 0; - return dist; + Unit dist = 0; + if (isEmpty()) + throw Error("Can't compute distance to an empty Box"); + if (pt.getX() < _xMin) dist = _xMin - pt.getX(); + else if (pt.getX() > _xMax) dist = pt.getX() - _xMax; + // else dist = 0; + if (pt.getY() < _yMin) dist += _yMin - pt.getY(); + else if (pt.getY() > _yMax) dist += pt.getY() - _yMax; + // else dist += 0; + return dist; } -Unit Box::ManhattanDistance(const Box& box) const +Unit Box::manhattanDistance(const Box& box) const // ********************************************** { - if (IsEmpty() || box.IsEmpty()) - throw Error("Can't compute distance to an empty Box"); - Unit dx, dy; - if ((dx=box.GetXMin() - _xMax) < 0) - if ((dx=_xMin-box.GetXMax()) < 0) dx=0; - if ((dy=box.GetYMin() - _yMax) < 0) - if ((dy=_yMin-box.GetYMax()) < 0) dy=0; - return dx+dy; + if (isEmpty() || box.isEmpty()) + throw Error("Can't compute distance to an empty Box"); + Unit dx, dy; + if ((dx=box.getXMin() - _xMax) < 0) + if ((dx=_xMin-box.getXMax()) < 0) dx=0; + if ((dy=box.getYMin() - _yMax) < 0) + if ((dy=_yMin-box.getYMax()) < 0) dy=0; + return dx+dy; } -bool Box::IsEmpty() const +bool Box::isEmpty() const // ********************** { - return ((_xMax < _xMin) || (_yMax < _yMin)); + return ((_xMax < _xMin) || (_yMax < _yMin)); } -bool Box::IsFlat() const +bool Box::isFlat() const // ********************* { - return (!IsEmpty() && - (((_xMin == _xMax) && (_yMin < _yMax)) || - ((_xMin < _xMax) && (_yMin == _yMax)))); + return (!isEmpty() && + (((_xMin == _xMax) && (_yMin < _yMax)) || + ((_xMin < _xMax) && (_yMin == _yMax)))); } -bool Box::IsPonctual() const +bool Box::isPonctual() const // ************************* { - return (!IsEmpty() && (_xMax == _xMin) && (_yMax == _yMin)); + return (!isEmpty() && (_xMax == _xMin) && (_yMax == _yMin)); } -bool Box::Contains(const Unit& x, const Unit& y) const +bool Box::contains(const Unit& x, const Unit& y) const // *************************************************** { - return (!IsEmpty() && - (_xMin <= x) && - (_yMin <= y) && - (x <= _xMax) && - (y <= _yMax)); + return (!isEmpty() && + (_xMin <= x) && + (_yMin <= y) && + (x <= _xMax) && + (y <= _yMax)); } -bool Box::Contains(const Point& point) const +bool Box::contains(const Point& point) const // ***************************************** { - return Contains(point.GetX(), point.GetY()); + return contains(point.getX(), point.getY()); } -bool Box::Contains(const Box& box) const +bool Box::contains(const Box& box) const // ************************************* { - return (!IsEmpty() && - !box.IsEmpty() && - (_xMin <= box._xMin) && - (box._xMax <= _xMax) && - (_yMin <= box._yMin) && - (box._yMax <= _yMax)); + return (!isEmpty() && + !box.isEmpty() && + (_xMin <= box._xMin) && + (box._xMax <= _xMax) && + (_yMin <= box._yMin) && + (box._yMax <= _yMax)); } -bool Box::Intersect(const Box& box) const +bool Box::intersect(const Box& box) const // ************************************** { - return (!IsEmpty() && - !box.IsEmpty() && - !((_xMax < box._xMin) || - (box._xMax < _xMin) || - (_yMax < box._yMin) || - (box._yMax < _yMin))); + return (!isEmpty() && + !box.isEmpty() && + !((_xMax < box._xMin) || + (box._xMax < _xMin) || + (_yMax < box._yMin) || + (box._yMax < _yMin))); } -bool Box::IsConstrainedBy(const Box& box) const +bool Box::isConstrainedBy(const Box& box) const // ******************************************** { - return (!IsEmpty() && - !box.IsEmpty() && - ((_xMin == box.GetXMin()) || - (_yMin == box.GetYMin()) || - (_xMax == box.GetXMax()) || - (_yMax == box.GetYMax()))); + return (!isEmpty() && + !box.isEmpty() && + ((_xMin == box.getXMin()) || + (_yMin == box.getYMin()) || + (_xMax == box.getXMax()) || + (_yMax == box.getYMax()))); } -Box& Box::MakeEmpty() +Box& Box::makeEmpty() // ****************** { - _xMin = 1; - _yMin = 1; - _xMax = -1; - _yMax = -1; - return *this; + _xMin = 1; + _yMin = 1; + _xMax = -1; + _yMax = -1; + return *this; } -Box& Box::Inflate(const Unit& d) +Box& Box::inflate(const Unit& d) // ***************************** { - return Inflate(d, d, d, d); + return inflate(d, d, d, d); } -Box& Box::Inflate(const Unit& dx, const Unit& dy) +Box& Box::inflate(const Unit& dx, const Unit& dy) // ********************************************** { - return Inflate(dx, dy, dx, dy); + return inflate(dx, dy, dx, dy); } -Box& Box::Inflate(const Unit& dxMin, const Unit& dyMin, const Unit& dxMax, const Unit& dyMax) +Box& Box::inflate(const Unit& dxMin, const Unit& dyMin, const Unit& dxMax, const Unit& dyMax) // ****************************************************************************************** { - if (!IsEmpty()) { - _xMin -= dxMin; - _yMin -= dyMin; - _xMax += dxMax; - _yMax += dyMax; - } - return *this; + if (!isEmpty()) { + _xMin -= dxMin; + _yMin -= dyMin; + _xMax += dxMax; + _yMax += dyMax; + } + return *this; } -Box& Box::ShrinkByFactor(double factor) +Box& Box::shrinkByFactor(double factor) // ************************************** { - assert((0 <= factor) && (factor <= 1)); - Unit dx=GetUnit(0.5*(1- factor) * (GetValue(_xMax) - GetValue(_xMin))); - Unit dy=GetUnit(0.5*(1- factor) * (GetValue(_yMax) - GetValue(_yMin))); - return Inflate(-dx, -dy); + assert((0 <= factor) && (factor <= 1)); + Unit dx=GetUnit(0.5*(1- factor) * (GetValue(_xMax) - GetValue(_xMin))); + Unit dy=GetUnit(0.5*(1- factor) * (GetValue(_yMax) - GetValue(_yMin))); + return inflate(-dx, -dy); } -Box& Box::Merge(const Unit& x, const Unit& y) +Box& Box::merge(const Unit& x, const Unit& y) // ****************************************** { - if (IsEmpty()) { - _xMin = x; - _yMin = y; - _xMax = x; - _yMax = y; - } - else { - _xMin = min(_xMin, x); - _yMin = min(_yMin, y); - _xMax = max(_xMax, x); - _yMax = max(_yMax, y); - } - return *this; + if (isEmpty()) { + _xMin = x; + _yMin = y; + _xMax = x; + _yMax = y; + } + else { + _xMin = min(_xMin, x); + _yMin = min(_yMin, y); + _xMax = max(_xMax, x); + _yMax = max(_yMax, y); + } + return *this; } -Box& Box::Merge(const Point& point) +Box& Box::merge(const Point& point) // ******************************** { - return Merge(point.GetX(), point.GetY()); + return merge(point.getX(), point.getY()); } -Box& Box::Merge(const Unit& x1, const Unit& y1, const Unit& x2, const Unit& y2) +Box& Box::merge(const Unit& x1, const Unit& y1, const Unit& x2, const Unit& y2) // **************************************************************************** { - Merge(x1, y1); - Merge(x2, y2); - return *this; + merge(x1, y1); + merge(x2, y2); + return *this; } -Box& Box::Merge(const Box& box) +Box& Box::merge(const Box& box) // **************************** { - if (!box.IsEmpty()) { - Merge(box.GetXMin(), box.GetYMin()); - Merge(box.GetXMax(), box.GetYMax()); - } - return *this; + if (!box.isEmpty()) { + merge(box.getXMin(), box.getYMin()); + merge(box.getXMax(), box.getYMax()); + } + return *this; } -Box& Box::Translate(const Unit& dx, const Unit& dy) +Box& Box::translate(const Unit& dx, const Unit& dy) // ************************************************ { - if (!IsEmpty()) { - _xMin += dx; - _yMin += dy; - _xMax += dx; - _yMax += dy; - } - return *this; + if (!isEmpty()) { + _xMin += dx; + _yMin += dy; + _xMax += dx; + _yMax += dy; + } + return *this; } string Box::_GetString() const // *************************** { - if (IsEmpty()) - return "<" + _TName("Box") + " empty>"; - else - return "<" + _TName("Box") + " " + - GetValueString(_xMin) + " " + GetValueString(_yMin) + " " + - GetValueString(_xMax) + " " + GetValueString(_yMax) + - ">"; + if (isEmpty()) + return "<" + _TName("Box") + " empty>"; + else + return "<" + _TName("Box") + " " + + GetValueString(_xMin) + " " + GetValueString(_yMin) + " " + + GetValueString(_xMax) + " " + GetValueString(_yMax) + + ">"; } Record* Box::_GetRecord() const // ********************** { - if (IsEmpty()) return NULL; + if (isEmpty()) return NULL; - Record* record = new Record(GetString(this)); - record->Add(GetSlot("XMin", &_xMin)); - record->Add(GetSlot("YMin", &_yMin)); - record->Add(GetSlot("XMax", &_xMax)); - record->Add(GetSlot("YMax", &_yMax)); - return record; + Record* record = new Record(GetString(this)); + record->Add(GetSlot("XMin", &_xMin)); + record->Add(GetSlot("YMin", &_yMin)); + record->Add(GetSlot("XMax", &_xMax)); + record->Add(GetSlot("YMax", &_yMax)); + return record; } diff --git a/hurricane/src/hurricane/Box.h b/hurricane/src/hurricane/Box.h index 0d281c2b..abc7d272 100644 --- a/hurricane/src/hurricane/Box.h +++ b/hurricane/src/hurricane/Box.h @@ -24,92 +24,94 @@ class Box { // Attributes // ********** - private: Unit _xMin; - private: Unit _yMin; - private: Unit _xMax; - private: Unit _yMax; + + private: Unit _xMin; + private: Unit _yMin; + private: Unit _xMax; + private: Unit _yMax; // constructors // ************ - public: Box(); + public: Box(); - public: Box(const Unit& x, const Unit& y); - public: Box(const Point& point); - public: Box(const Unit& x1, const Unit& y1, const Unit& x2, const Unit& y2); - public: Box(const Point& point1, const Point& point2); + public: Box(const Unit& x, const Unit& y); + public: Box(const Point& point); + public: Box(const Unit& x1, const Unit& y1, const Unit& x2, const Unit& y2); + public: Box(const Point& point1, const Point& point2); - public: Box(const Box& box); + public: Box(const Box& box); // Operators // ********* - public: Box& operator=(const Box& box); + public: Box& operator=(const Box& box); - public: bool operator==(const Box& box) const; - public: bool operator!=(const Box& box) const; + public: bool operator==(const Box& box) const; + public: bool operator!=(const Box& box) const; // Accessors // ********* - public: const Unit& GetXMin() const {return _xMin;}; - public: const Unit& GetYMin() const {return _yMin;}; - public: const Unit& GetXMax() const {return _xMax;}; - public: const Unit& GetYMax() const {return _yMax;}; + public: const Unit& getXMin() const {return _xMin;}; + public: const Unit& getYMin() const {return _yMin;}; + public: const Unit& getXMax() const {return _xMax;}; + public: const Unit& getYMax() const {return _yMax;}; - public: Unit GetXCenter() const {return ((_xMin + _xMax) / 2);}; - public: Unit GetYCenter() const {return ((_yMin + _yMax) / 2);}; - public: Point GetCenter() const {return Point(GetXCenter(), GetYCenter());}; + public: Unit getXCenter() const {return ((_xMin + _xMax) / 2);}; + public: Unit getYCenter() const {return ((_yMin + _yMax) / 2);}; + public: Point getCenter() const {return Point(getXCenter(), getYCenter());}; - public: Unit GetWidth() const {return (_xMax - _xMin);}; - public: Unit GetHalfWidth() const {return (GetWidth() / 2);}; - public: Unit GetHeight() const {return (_yMax - _yMin);}; - public: Unit GetHalfHeight() const {return (GetHeight() / 2);}; + public: Unit getWidth() const {return (_xMax - _xMin);}; + public: Unit getHalfWidth() const {return (getWidth() / 2);}; + public: Unit getHeight() const {return (_yMax - _yMin);}; + public: Unit getHalfHeight() const {return (getHeight() / 2);}; - public: Box GetUnion(const Box& box) const; + public: Box getUnion(const Box& box) const; - public: Box GetIntersection(const Box& box) const; - public: Unit ManhattanDistance(const Point& pt) const; - public: Unit ManhattanDistance(const Box& box) const; + public: Box getIntersection(const Box& box) const; + public: Unit manhattanDistance(const Point& pt) const; + public: Unit manhattanDistance(const Box& box) const; // Predicates // ********** - public: bool IsEmpty() const; - public: bool IsFlat() const; - public: bool IsPonctual() const; + public: bool isEmpty() const; + public: bool isFlat() const; + public: bool isPonctual() const; - public: bool Contains(const Unit& x, const Unit& y) const; - public: bool Contains(const Point& point) const; - public: bool Contains(const Box& box) const; + public: bool contains(const Unit& x, const Unit& y) const; + public: bool contains(const Point& point) const; + public: bool contains(const Box& box) const; - public: bool Intersect(const Box& box) const; + public: bool intersect(const Box& box) const; - public: bool IsConstrainedBy(const Box& box) const; + public: bool isConstrainedBy(const Box& box) const; // Updators // ******** - public: Box& MakeEmpty(); + public: Box& makeEmpty(); - public: Box& Inflate(const Unit& d); - public: Box& Inflate(const Unit& dx, const Unit& dy); - public: Box& Inflate(const Unit& dxMin, const Unit& dyMin, const Unit& dxMax, const Unit& dyMax); - public: Box& ShrinkByFactor(double factor); // 0 <= factor <= 1 + public: Box& inflate(const Unit& d); + public: Box& inflate(const Unit& dx, const Unit& dy); + public: Box& inflate(const Unit& dxMin, const Unit& dyMin, const Unit& dxMax, const Unit& dyMax); + public: Box& shrinkByFactor(double factor); // 0 <= factor <= 1 - public: Box& Merge(const Unit& x, const Unit& y); - public: Box& Merge(const Point& point); - public: Box& Merge(const Unit& x1, const Unit& y1, const Unit& x2, const Unit& y2); - public: Box& Merge(const Box& box); + public: Box& merge(const Unit& x, const Unit& y); + public: Box& merge(const Point& point); + public: Box& merge(const Unit& x1, const Unit& y1, const Unit& x2, const Unit& y2); + public: Box& merge(const Box& box); - public: Box& Translate(const Unit& dx, const Unit& dy); + public: Box& translate(const Unit& dx, const Unit& dy); // Others // ****** + public: string _GetTypeName() const { return _TName("Box"); }; - public: string _GetString() const; - public: Record* _GetRecord() const; + public: string _GetString() const; + public: Record* _GetRecord() const; }; diff --git a/hurricane/src/hurricane/Cell.cpp b/hurricane/src/hurricane/Cell.cpp index a73e1b80..2382ceee 100644 --- a/hurricane/src/hurricane/Cell.cpp +++ b/hurricane/src/hurricane/Cell.cpp @@ -27,58 +27,58 @@ namespace Hurricane { Cell::Cell(Library* library, const Name& name) // ******************************************* -: Inherit(), - _library(library), - _name(name), - _instanceMap(), - _quadTree(), - _slaveInstanceSet(), - _netMap(), - _sliceMap(), - _markerSet(), - //_viewSet(), - _abutmentBox(), - _boundingBox(), - _isTerminal(true), - _isPad(false), - _nextOfLibraryCellMap(NULL), - _nextOfSymbolCellSet(NULL), +: Inherit(), + _library(library), + _name(name), + _instanceMap(), + _quadTree(), + _slaveInstanceSet(), + _netMap(), + _sliceMap(), + _markerSet(), + //_viewSet(), + _abutmentBox(), + _boundingBox(), + _isTerminal(true), + _isPad(false), + _nextOfLibraryCellMap(NULL), + _nextOfSymbolCellSet(NULL), _slaveEntityMap() { - if (!_library) - throw Error("Can't create " + _TName("Cell") + " : null library"); + if (!_library) + throw Error("Can't create " + _TName("Cell") + " : null library"); - if (name.IsEmpty()) - throw Error("Can't create " + _TName("Cell") + " : empty name"); + if (name.IsEmpty()) + throw Error("Can't create " + _TName("Cell") + " : empty name"); - if (_library->GetCell(_name)) - throw Error("Can't create " + _TName("Cell") + " : already exists"); + if (_library->GetCell(_name)) + throw Error("Can't create " + _TName("Cell") + " : already exists"); } Cell* Cell::Create(Library* library, const Name& name) // *************************************************** { - Cell* cell = new Cell(library, name); + Cell* cell = new Cell(library, name); - cell->_PostCreate(); + cell->_PostCreate(); - return cell; + return cell; } Box Cell::GetBoundingBox() const // ***************************** { - if (_boundingBox.IsEmpty()) { - Box& boundingBox = (Box&)_boundingBox; - boundingBox = _abutmentBox; - boundingBox.Merge(_quadTree.GetBoundingBox()); - for_each_slice(slice, GetSlices()) { - boundingBox.Merge(slice->GetBoundingBox()); - end_for; - } - } - - return _boundingBox; + if (_boundingBox.isEmpty()) { + Box& boundingBox = (Box&)_boundingBox; + boundingBox = _abutmentBox; + boundingBox.merge(_quadTree.GetBoundingBox()); + for_each_slice(slice, GetSlices()) { + boundingBox.merge(slice->GetBoundingBox()); + end_for; + } + } + + return _boundingBox; } bool Cell::IsLeaf() const @@ -90,41 +90,41 @@ bool Cell::IsLeaf() const bool Cell::IsCalledBy(Cell* cell) const // ************************************ { - for_each_instance(instance, cell->GetInstances()) { - Cell* masterCell = instance->GetMasterCell(); - if (masterCell == this) return true; - if (IsCalledBy(masterCell)) return true; - end_for; - } - return false; + for_each_instance(instance, cell->GetInstances()) { + Cell* masterCell = instance->GetMasterCell(); + if (masterCell == this) return true; + if (IsCalledBy(masterCell)) return true; + end_for; + } + return false; } void Cell::SetName(const Name& name) // ********************************* { - if (name != _name) { - if (name.IsEmpty()) - throw Error("Can't change " + _TName("Cell") + " name : empty name"); + if (name != _name) { + if (name.IsEmpty()) + throw Error("Can't change " + _TName("Cell") + " name : empty name"); - if (_library->GetCell(name)) - throw Error("Can't change " + _TName("Cell") + " name : already exists"); + if (_library->GetCell(name)) + throw Error("Can't change " + _TName("Cell") + " name : already exists"); - _library->_GetCellMap()._Remove(this); - _name = name; - _library->_GetCellMap()._Insert(this); - } + _library->_GetCellMap()._Remove(this); + _name = name; + _library->_GetCellMap()._Insert(this); + } } void Cell::SetAbutmentBox(const Box& abutmentBox) // ********************************************** { - if (abutmentBox != _abutmentBox) { - if (!_abutmentBox.IsEmpty() && - (abutmentBox.IsEmpty() || !abutmentBox.Contains(_abutmentBox))) - _Unfit(_abutmentBox); - _abutmentBox = abutmentBox; - _Fit(_abutmentBox); - } + if (abutmentBox != _abutmentBox) { + if (!_abutmentBox.isEmpty() && + (abutmentBox.isEmpty() || !abutmentBox.contains(_abutmentBox))) + _Unfit(_abutmentBox); + _abutmentBox = abutmentBox; + _Fit(_abutmentBox); + } } void Cell::FlattenNets(bool buildRings) @@ -199,102 +199,102 @@ void Cell::FlattenNets(bool buildRings) void Cell::Materialize() // ********************* { - for_each_instance(instance, GetInstances()) instance->Materialize(); end_for; - for_each_net(net, GetNets()) net->Materialize(); end_for; - for_each_marker(marker, GetMarkers()) marker->Materialize(); end_for; + for_each_instance(instance, GetInstances()) instance->Materialize(); end_for; + for_each_net(net, GetNets()) net->Materialize(); end_for; + for_each_marker(marker, GetMarkers()) marker->Materialize(); end_for; } void Cell::Unmaterialize() // *********************** { - for_each_instance(instance, GetInstances()) instance->Unmaterialize(); end_for; - for_each_net(net, GetNets()) net->Unmaterialize(); end_for; - for_each_marker(marker, GetMarkers()) marker->Unmaterialize(); end_for; + for_each_instance(instance, GetInstances()) instance->Unmaterialize(); end_for; + for_each_net(net, GetNets()) net->Unmaterialize(); end_for; + for_each_marker(marker, GetMarkers()) marker->Unmaterialize(); end_for; } void Cell::_PostCreate() // ********************* { - _library->_GetCellMap()._Insert(this); + _library->_GetCellMap()._Insert(this); - Inherit::_PostCreate(); + Inherit::_PostCreate(); } void Cell::_PreDelete() // ******************** { - Inherit::_PreDelete(); + Inherit::_PreDelete(); while(_slaveEntityMap.size()) { _slaveEntityMap.begin()->second->Delete(); } - //for_each_view(view, GetViews()) view->SetCell(NULL); end_for; - for_each_marker(marker, GetMarkers()) marker->Delete(); end_for; - for_each_instance(slaveInstance, GetSlaveInstances()) slaveInstance->Delete(); end_for; - for_each_instance(instance, GetInstances()) instance->Delete(); end_for; - for_each_net(net, GetNets()) net->Delete(); end_for; - for_each_slice(slice, GetSlices()) slice->_Delete(); end_for; + //for_each_view(view, GetViews()) view->SetCell(NULL); end_for; + for_each_marker(marker, GetMarkers()) marker->Delete(); end_for; + for_each_instance(slaveInstance, GetSlaveInstances()) slaveInstance->Delete(); end_for; + for_each_instance(instance, GetInstances()) instance->Delete(); end_for; + for_each_net(net, GetNets()) net->Delete(); end_for; + for_each_slice(slice, GetSlices()) slice->_Delete(); end_for; - _library->_GetCellMap()._Remove(this); + _library->_GetCellMap()._Remove(this); } string Cell::_GetString() const // **************************** { - string s = Inherit::_GetString(); - s.insert(s.length() - 1, " " + GetString(_name)); - return s; + string s = Inherit::_GetString(); + s.insert(s.length() - 1, " " + GetString(_name)); + return s; } Record* Cell::_GetRecord() const // *********************** { - Record* record = Inherit::_GetRecord(); - if (record) { - record->Add(GetSlot("Library", _library)); - record->Add(GetSlot("Name", &_name)); - record->Add(GetSlot("Instances", &_instanceMap)); - record->Add(GetSlot("QuadTree", &_quadTree)); - record->Add(GetSlot("SlaveInstances", &_slaveInstanceSet)); - record->Add(GetSlot("Nets", &_netMap)); - record->Add(GetSlot("Pins", &_pinMap)); - record->Add(GetSlot("Slices", &_sliceMap)); - record->Add(GetSlot("Markers", &_markerSet)); - //record->Add(GetSlot("Views", &_viewSet)); - record->Add(GetSlot("AbutmentBox", &_abutmentBox)); - record->Add(GetSlot("BoundingBox", &_boundingBox)); - record->Add(GetSlot("IsTerminal", &_isTerminal)); - record->Add(GetSlot("IsFlattenLeaf", &_isFlattenLeaf)); - //record->Add(GetSlot("Symbol", _symbol)); - } - return record; + Record* record = Inherit::_GetRecord(); + if (record) { + record->Add(GetSlot("Library", _library)); + record->Add(GetSlot("Name", &_name)); + record->Add(GetSlot("Instances", &_instanceMap)); + record->Add(GetSlot("QuadTree", &_quadTree)); + record->Add(GetSlot("SlaveInstances", &_slaveInstanceSet)); + record->Add(GetSlot("Nets", &_netMap)); + record->Add(GetSlot("Pins", &_pinMap)); + record->Add(GetSlot("Slices", &_sliceMap)); + record->Add(GetSlot("Markers", &_markerSet)); + //record->Add(GetSlot("Views", &_viewSet)); + record->Add(GetSlot("AbutmentBox", &_abutmentBox)); + record->Add(GetSlot("BoundingBox", &_boundingBox)); + record->Add(GetSlot("IsTerminal", &_isTerminal)); + record->Add(GetSlot("IsFlattenLeaf", &_isFlattenLeaf)); + //record->Add(GetSlot("Symbol", _symbol)); + } + return record; } void Cell::_Fit(const Box& box) // **************************** { - if (box.IsEmpty()) return; - if (_boundingBox.IsEmpty()) return; - if (_boundingBox.Contains(box)) return; - _boundingBox.Merge(box); - for_each_instance(instance, GetSlaveInstances()) { - instance->GetCell()->_Fit(instance->GetTransformation().GetBox(box)); - end_for; - } + if (box.isEmpty()) return; + if (_boundingBox.isEmpty()) return; + if (_boundingBox.contains(box)) return; + _boundingBox.merge(box); + for_each_instance(instance, GetSlaveInstances()) { + instance->GetCell()->_Fit(instance->GetTransformation().GetBox(box)); + end_for; + } } void Cell::_Unfit(const Box& box) // ****************************** { - if (box.IsEmpty()) return; - if (_boundingBox.IsEmpty()) return; - if (!_boundingBox.IsConstrainedBy(box)) return; - _boundingBox.MakeEmpty(); - for_each_instance(instance, GetSlaveInstances()) { - instance->GetCell()->_Unfit(instance->GetTransformation().GetBox(box)); - end_for; - } + if (box.isEmpty()) return; + if (_boundingBox.isEmpty()) return; + if (!_boundingBox.isConstrainedBy(box)) return; + _boundingBox.makeEmpty(); + for_each_instance(instance, GetSlaveInstances()) { + instance->GetCell()->_Unfit(instance->GetTransformation().GetBox(box)); + end_for; + } } void Cell::_AddSlaveEntity(Entity* entity, Entity* slaveEntity) @@ -339,52 +339,52 @@ void Cell::_GetSlaveEntities(Entity* entity, SlaveEntityMap::iterator& begin, Sl //// ************************************* //{ // return true; -// //if (view->GetCell() == this) return true; +// //if (view->GetCell() == this) return true; // -// //if (is_a(view)) return true; +// //if (is_a(view)) return true; // -// //return (1 < (double)view->GetScreenSize(_boundingBox.GetHeight())); -//// return (100 < ((double)view->GetScreenSize(_boundingBox.GetWidth()) * -//// (double)view->GetScreenSize(_boundingBox.GetHeight()))); +// //return (1 < (double)view->GetScreenSize(_boundingBox.GetHeight())); +//// return (100 < ((double)view->GetScreenSize(_boundingBox.GetWidth()) * +//// (double)view->GetScreenSize(_boundingBox.GetHeight()))); //} // //bool Cell::_ContentIsDrawable(View* view) const //// ******************************************** //{ -// if (IsTerminal()) return false; +// if (IsTerminal()) return false; // // return true; // -// //if (view->GetCell() == this) return true; +// //if (view->GetCell() == this) return true; // -// //if (is_a(view)) return false; +// //if (is_a(view)) return false; // -// //return (40 < (double)view->GetScreenSize(_boundingBox.GetHeight())); -//// return (400 < ((double)view->GetScreenSize(_boundingBox.GetWidth()) * -//// (double)view->GetScreenSize(_boundingBox.GetHeight()))); +// //return (40 < (double)view->GetScreenSize(_boundingBox.GetHeight())); +//// return (400 < ((double)view->GetScreenSize(_boundingBox.GetWidth()) * +//// (double)view->GetScreenSize(_boundingBox.GetHeight()))); //} // //void Cell::_DrawPhantoms(View* view, const Box& updateArea, const Transformation& transformation) //// ********************************************************************************************** //{ -//// if (_IsDrawable(view)) { // To avoid irregular display of instances phantoms -//// if (!_ContentIsDrawable(view)) -//// view->FillRectangle(transformation.GetBox(GetAbutmentBox())); -//// else { +//// if (_IsDrawable(view)) { // To avoid irregular display of instances phantoms +//// if (!_ContentIsDrawable(view)) +//// view->FillRectangle(transformation.GetBox(GetAbutmentBox())); +//// else { //// for_each_instance(instance, GetInstancesUnder(updateArea)) { //// instance->_DrawPhantoms(view, updateArea, transformation); //// end_for; //// } -//// } -//// } +//// } +//// } //} // //void Cell::_DrawBoundaries(View* view, const Box& updateArea, const Transformation& transformation) //// ************************************************************************************************ //{ // // if (_IsDrawable(view)) { // To avoid irregular display of instances phantoms -// // view->DrawRectangle(transformation.GetBox(GetAbutmentBox())); -// // if (_ContentIsDrawable(view)) { +// // view->DrawRectangle(transformation.GetBox(GetAbutmentBox())); +// // if (_ContentIsDrawable(view)) { // // for_each_instance(instance, GetInstancesUnder(updateArea)) { // // instance->_DrawBoundaries(view, updateArea, transformation); // // end_for; @@ -396,70 +396,70 @@ void Cell::_GetSlaveEntities(Entity* entity, SlaveEntityMap::iterator& begin, Sl //void Cell::_DrawContent(View* view, BasicLayer* basicLayer, const Box& updateArea, const Transformation& transformation) //// **************************************************************************************************** //{ -//// if (_IsDrawable(view)) { -//// if (_ContentIsDrawable(view)) { -//// view->CheckForDisplayInterruption(); +//// if (_IsDrawable(view)) { +//// if (_ContentIsDrawable(view)) { +//// view->CheckForDisplayInterruption(); //// for_each_instance(instance, GetInstancesUnder(updateArea)) { //// instance->_Draw(view, basicLayer, updateArea, transformation); //// end_for; //// } -//// for_each_slice(slice, GetSlices()) { -//// slice->_Draw(view, basicLayer, updateArea, transformation); -//// end_for; -//// } -//// } -//// } +//// for_each_slice(slice, GetSlices()) { +//// slice->_Draw(view, basicLayer, updateArea, transformation); +//// end_for; +//// } +//// } +//// } //} // //void Cell::_DrawRubbers(View* view, const Box& updateArea, const Transformation& transformation) //// ********************************************************************************************* //{ -//// if (_IsDrawable(view)) { -//// if (_ContentIsDrawable(view)) { +//// if (_IsDrawable(view)) { +//// if (_ContentIsDrawable(view)) { //// for_each_instance(instance, GetInstancesUnder(updateArea)) { //// instance->_DrawRubbers(view, updateArea, transformation); //// end_for; //// } -//// for_each_rubber(rubber, GetRubbersUnder(updateArea)) { -//// rubber->_Draw(view, NULL, updateArea, transformation); -//// end_for; -//// } -//// } -//// } +//// for_each_rubber(rubber, GetRubbersUnder(updateArea)) { +//// rubber->_Draw(view, NULL, updateArea, transformation); +//// end_for; +//// } +//// } +//// } //} // //void Cell::_DrawMarkers(View* view, const Box& updateArea, const Transformation& transformation) //// ********************************************************************************************* //{ -//// if (_IsDrawable(view)) { -//// if (_ContentIsDrawable(view)) { +//// if (_IsDrawable(view)) { +//// if (_ContentIsDrawable(view)) { //// for_each_instance(instance, GetInstancesUnder(updateArea)) { //// instance->_DrawMarkers(view, updateArea, transformation); //// end_for; //// } -//// for_each_marker(marker, GetMarkersUnder(updateArea)) { -//// marker->_Draw(view, NULL, updateArea, transformation); -//// end_for; -//// } -//// } -//// } +//// for_each_marker(marker, GetMarkersUnder(updateArea)) { +//// marker->_Draw(view, NULL, updateArea, transformation); +//// end_for; +//// } +//// } +//// } //} // //void Cell::_DrawDisplaySlots(View* view, const Box& area, const Box& updateArea, const Transformation& transformation) //// ******************************************************************************************************************** //{ -//// if (_IsDrawable(view)) { -//// if (_ContentIsDrawable(view)) { +//// if (_IsDrawable(view)) { +//// if (_ContentIsDrawable(view)) { //// for_each_instance(instance, GetInstancesUnder(updateArea)) { //// instance->_DrawDisplaySlots(view, area, updateArea, transformation); //// end_for; //// } -//// for_each_display_slot(displaySlot, GetDisplaySlots(this)) { -//// view->_DrawDisplaySlot(displaySlot, area, updateArea, transformation); -//// end_for; +//// for_each_display_slot(displaySlot, GetDisplaySlots(this)) { +//// view->_DrawDisplaySlot(displaySlot, area, updateArea, transformation); +//// end_for; //// } -//// } -//// } +//// } +//// } //} // // **************************************************************************************************** @@ -468,32 +468,32 @@ void Cell::_GetSlaveEntities(Entity* entity, SlaveEntityMap::iterator& begin, Sl Cell::InstanceMap::InstanceMap() // ***************************** -: Inherit() +: Inherit() { } Name Cell::InstanceMap::_GetKey(Instance* instance) const // ****************************************************** { - return instance->GetName(); + return instance->GetName(); } unsigned Cell::InstanceMap::_GetHashValue(Name name) const // ******************************************************* { - return ( (unsigned int)( (unsigned long)name._GetSharedName() ) ) / 8; + return ( (unsigned int)( (unsigned long)name._GetSharedName() ) ) / 8; } Instance* Cell::InstanceMap::_GetNextElement(Instance* instance) const // ******************************************************************* { - return instance->_GetNextOfCellInstanceMap(); + return instance->_GetNextOfCellInstanceMap(); } void Cell::InstanceMap::_SetNextElement(Instance* instance, Instance* nextInstance) const // ************************************************************************************** { - instance->_SetNextOfCellInstanceMap(nextInstance); + instance->_SetNextOfCellInstanceMap(nextInstance); } @@ -504,26 +504,26 @@ void Cell::InstanceMap::_SetNextElement(Instance* instance, Instance* nextInstan Cell::SlaveInstanceSet::SlaveInstanceSet() // *************************************** -: Inherit() +: Inherit() { } unsigned Cell::SlaveInstanceSet::_GetHashValue(Instance* slaveInstance) const // ************************************************************************** { - return ( (unsigned int)( (unsigned long)slaveInstance ) ) / 8; + return ( (unsigned int)( (unsigned long)slaveInstance ) ) / 8; } Instance* Cell::SlaveInstanceSet::_GetNextElement(Instance* slaveInstance) const // ***************************************************************************** { - return slaveInstance->_GetNextOfCellSlaveInstanceSet(); + return slaveInstance->_GetNextOfCellSlaveInstanceSet(); } void Cell::SlaveInstanceSet::_SetNextElement(Instance* slaveInstance, Instance* nextSlaveInstance) const // **************************************************************************************************** { - slaveInstance->_SetNextOfCellSlaveInstanceSet(nextSlaveInstance); + slaveInstance->_SetNextOfCellSlaveInstanceSet(nextSlaveInstance); } @@ -534,32 +534,32 @@ void Cell::SlaveInstanceSet::_SetNextElement(Instance* slaveInstance, Instance* Cell::NetMap::NetMap() // ******************* -: Inherit() +: Inherit() { } Name Cell::NetMap::_GetKey(Net* net) const // *************************************** { - return net->GetName(); + return net->GetName(); } unsigned Cell::NetMap::_GetHashValue(Name name) const // ************************************************** { - return ( (unsigned int)( (unsigned long)name._GetSharedName() ) ) / 8; + return ( (unsigned int)( (unsigned long)name._GetSharedName() ) ) / 8; } Net* Cell::NetMap::_GetNextElement(Net* net) const // *********************************************** { - return net->_GetNextOfCellNetMap(); + return net->_GetNextOfCellNetMap(); } void Cell::NetMap::_SetNextElement(Net* net, Net* nextNet) const // ************************************************************* { - net->_SetNextOfCellNetMap(nextNet); + net->_SetNextOfCellNetMap(nextNet); } @@ -569,32 +569,32 @@ void Cell::NetMap::_SetNextElement(Net* net, Net* nextNet) const Cell::PinMap::PinMap() // ******************* -: Inherit() +: Inherit() { } Name Cell::PinMap::_GetKey(Pin* pin) const // *************************************** { - return pin->GetName(); + return pin->GetName(); } unsigned Cell::PinMap::_GetHashValue(Name name) const // ************************************************** { - return ( (unsigned int)( (unsigned long)name._GetSharedName() ) ) / 8; + return ( (unsigned int)( (unsigned long)name._GetSharedName() ) ) / 8; } Pin* Cell::PinMap::_GetNextElement(Pin* pin) const // *********************************************** { - return pin->_GetNextOfCellPinMap(); + return pin->_GetNextOfCellPinMap(); } void Cell::PinMap::_SetNextElement(Pin* pin, Pin* nextPin) const // ************************************************************* { - pin->_SetNextOfCellPinMap(nextPin); + pin->_SetNextOfCellPinMap(nextPin); } @@ -604,32 +604,32 @@ void Cell::PinMap::_SetNextElement(Pin* pin, Pin* nextPin) const Cell::SliceMap::SliceMap() // *********************** -: Inherit() +: Inherit() { } const Layer* Cell::SliceMap::_GetKey(Slice* slice) const // ***************************************************** { - return slice->GetLayer(); + return slice->GetLayer(); } unsigned Cell::SliceMap::_GetHashValue(const Layer* layer) const // ************************************************************* { - return ( (unsigned int)( (unsigned long)layer ) ) / 8; + return ( (unsigned int)( (unsigned long)layer ) ) / 8; } Slice* Cell::SliceMap::_GetNextElement(Slice* slice) const // ******************************************************* { - return slice->_GetNextOfCellSliceMap(); + return slice->_GetNextOfCellSliceMap(); } void Cell::SliceMap::_SetNextElement(Slice* slice, Slice* nextSlice) const // *********************************************************************** { - slice->_SetNextOfCellSliceMap(nextSlice); + slice->_SetNextOfCellSliceMap(nextSlice); }; @@ -640,26 +640,26 @@ void Cell::SliceMap::_SetNextElement(Slice* slice, Slice* nextSlice) const Cell::MarkerSet::MarkerSet() // ************************* -: Inherit() +: Inherit() { } unsigned Cell::MarkerSet::_GetHashValue(Marker* marker) const // ********************************************************** { - return ( (unsigned int)( (unsigned long)marker ) ) / 8; + return ( (unsigned int)( (unsigned long)marker ) ) / 8; } Marker* Cell::MarkerSet::_GetNextElement(Marker* marker) const // *********************************************************** { - return marker->_GetNextOfCellMarkerSet(); + return marker->_GetNextOfCellMarkerSet(); } void Cell::MarkerSet::_SetNextElement(Marker* marker, Marker* nextMarker) const // **************************************************************************** { - marker->_SetNextOfCellMarkerSet(nextMarker); + marker->_SetNextOfCellMarkerSet(nextMarker); } @@ -670,26 +670,26 @@ void Cell::MarkerSet::_SetNextElement(Marker* marker, Marker* nextMarker) const // //Cell::ViewSet::ViewSet() //// ********************* -//: Inherit() +//: Inherit() //{ //} // //unsigned Cell::ViewSet::_GetHashValue(View* view) const //// **************************************************** //{ -// return ( (unsigned int)( (unsigned long)view ) ) / 8; +// return ( (unsigned int)( (unsigned long)view ) ) / 8; //} // //View* Cell::ViewSet::_GetNextElement(View* view) const //// *************************************************** //{ -// return view->_GetNextOfCellViewSet(); +// return view->_GetNextOfCellViewSet(); //} // //void Cell::ViewSet::_SetNextElement(View* view, View* nextView) const //// ****************************************************************** //{ -// view->_SetNextOfCellViewSet(nextView); +// view->_SetNextOfCellViewSet(nextView); //} // // diff --git a/hurricane/src/hurricane/CellCollections.cpp b/hurricane/src/hurricane/CellCollections.cpp index 8cd812a4..4e88d2f5 100644 --- a/hurricane/src/hurricane/CellCollections.cpp +++ b/hurricane/src/hurricane/CellCollections.cpp @@ -1272,14 +1272,14 @@ Rubbers Cell::GetRubbers() const Rubbers Cell::GetRubbersUnder(const Box& area) const // ************************************************* { - // return (area.IsEmpty()) ? Rubbers() : _quadTree.GetGosUnder(area).GetSubSet(); + // return (area.isEmpty()) ? Rubbers() : _quadTree.GetGosUnder(area).GetSubSet(); return SubTypeCollection(_quadTree.GetGosUnder(area)); } Markers Cell::GetMarkersUnder(const Box& area) const // ************************************************* { - // return (area.IsEmpty()) ? Markers() : _quadTree.GetGosUnder(area).GetSubSet(); + // return (area.isEmpty()) ? Markers() : _quadTree.GetGosUnder(area).GetSubSet(); return SubTypeCollection(_quadTree.GetGosUnder(area)); } @@ -1793,7 +1793,7 @@ Cell_ComponentsUnder::Locator::Locator(const Cell* cell, const Box& area, const _componentLocator(), _component(NULL) { - if (_cell && !_area.IsEmpty()) { + if (_cell && !_area.isEmpty()) { _sliceLocator = _cell->GetSlices(_mask).GetLocator(); while (!_component && _sliceLocator.IsValid()) { Slice* slice = _sliceLocator.GetElement(); @@ -2260,7 +2260,7 @@ Cell_OccurrencesUnder::Locator::Locator(const Cell* cell, const Box& area, unsig _instanceLocator(), _occurrenceLocator() { - if (_cell && !_area.IsEmpty()) { + if (_cell && !_area.isEmpty()) { _componentLocator = _cell->GetComponentsUnder(_area).GetLocator(); if (_componentLocator.IsValid()) _state = 1; @@ -2718,7 +2718,7 @@ Cell_LeafInstanceOccurrencesUnder::Locator::Locator(const Cell* cell, const Box& _nonLeafInstanceLocator(), _occurrenceLocator() { - if (_cell && !_area.IsEmpty()) { + if (_cell && !_area.isEmpty()) { _leafInstanceLocator = _cell->GetLeafInstancesUnder(_area).GetLocator(); if (_leafInstanceLocator.IsValid()) _state = 1; @@ -3127,7 +3127,7 @@ Cell_TerminalInstanceOccurrencesUnder::Locator::Locator(const Cell* cell, const _nonTerminalInstanceLocator(), _occurrenceLocator() { - if (_cell && !_area.IsEmpty()) { + if (_cell && !_area.isEmpty()) { _terminalInstanceLocator = _cell->GetTerminalInstancesUnder(_area).GetLocator(); if (_terminalInstanceLocator.IsValid()) _state = 1; @@ -3574,7 +3574,7 @@ Cell_ComponentOccurrencesUnder::Locator::Locator(const Cell* cell, const Box& ar _instanceLocator(), _occurrenceLocator() { - if (_cell && !_area.IsEmpty() && (_mask != 0)) { + if (_cell && !_area.isEmpty() && (_mask != 0)) { _componentLocator = _cell->GetComponentsUnder(_area, _mask).GetLocator(); if (_componentLocator.IsValid()) _state = 1; diff --git a/hurricane/src/hurricane/Component.cpp b/hurricane/src/hurricane/Component.cpp index a6f7bca0..4563da90 100644 --- a/hurricane/src/hurricane/Component.cpp +++ b/hurricane/src/hurricane/Component.cpp @@ -53,7 +53,7 @@ class Component_IsUnderFilter : public Filter { public: virtual bool Accept(Component* component) const // **************************************************** { - return _area.Intersect(component->GetBoundingBox()); + return _area.intersect(component->GetBoundingBox()); }; public: virtual string _GetString() const @@ -490,7 +490,7 @@ void Component::_SetRubber(Rubber* rubber) // Box area(point); // area.Inflate(aperture); // for_each_basic_layer(basicLayer, GetLayer()->GetBasicLayers()) { -// if (view->IsVisible(basicLayer) && GetBoundingBox(basicLayer).Intersect(area)) +// if (view->IsVisible(basicLayer) && GetBoundingBox(basicLayer).intersect(area)) // return true; // end_for; // } @@ -933,7 +933,7 @@ double GetArea ( Component* component ) { Box bb = component->GetBoundingBox (); - return GetValue(bb.GetWidth()) * GetValue(bb.GetHeight()); + return GetValue(bb.getWidth()) * GetValue(bb.getHeight()); } diff --git a/hurricane/src/hurricane/Contact.cpp b/hurricane/src/hurricane/Contact.cpp index 187ffe27..6e39ba11 100644 --- a/hurricane/src/hurricane/Contact.cpp +++ b/hurricane/src/hurricane/Contact.cpp @@ -172,7 +172,7 @@ Point Contact::GetPosition() const // ******************************* { Component* anchor = GetAnchor(); - return (!anchor) ? Point(_dx, _dy) : anchor->GetPosition().Translate(_dx, _dy); + return (!anchor) ? Point(_dx, _dy) : anchor->GetPosition().translate(_dx, _dy); } Box Contact::GetBoundingBox() const @@ -180,7 +180,7 @@ Box Contact::GetBoundingBox() const { Unit size = _GetSize(); - return Box(GetPosition()).Inflate(GetHalfWidth() + size, GetHalfHeight() + size); + return Box(GetPosition()).inflate(GetHalfWidth() + size, GetHalfHeight() + size); } Box Contact::GetBoundingBox(BasicLayer* basicLayer) const @@ -190,7 +190,7 @@ Box Contact::GetBoundingBox(BasicLayer* basicLayer) const Unit size = _GetSize(basicLayer); - return Box(GetPosition()).Inflate(GetHalfWidth() + size, GetHalfHeight() + size); + return Box(GetPosition()).inflate(GetHalfWidth() + size, GetHalfHeight() + size); } Component* Contact::GetAnchor() const @@ -275,7 +275,7 @@ void Contact::SetPosition(const Unit& x, const Unit& y) void Contact::SetPosition(const Point& position) // ********************************************* { - SetPosition(position.GetX(), position.GetY()); + SetPosition(position.getX(), position.getY()); } void Contact::SetDx(const Unit& dx) diff --git a/hurricane/src/hurricane/DRCError.cpp b/hurricane/src/hurricane/DRCError.cpp index 9129ec11..5ecaf4ba 100644 --- a/hurricane/src/hurricane/DRCError.cpp +++ b/hurricane/src/hurricane/DRCError.cpp @@ -26,7 +26,7 @@ DRCError::DRCError(Cell* cell, const Name& name, const Box& boundingBox) if (_name.IsEmpty()) throw Error("Can't create " + _TName("DRCError") + " : empty name"); - if (_boundingBox.IsEmpty()) + if (_boundingBox.isEmpty()) throw Error("Can't create " + _TName("DRCError") + " : empty bounding box"); } @@ -45,7 +45,7 @@ void DRCError::Translate(const Unit& dx, const Unit& dy) { if ((dx != 0) || (dy != 0)) { Invalidate(false); - _boundingBox.Translate(dx, dy); + _boundingBox.translate(dx, dy); } } diff --git a/hurricane/src/hurricane/Horizontal.cpp b/hurricane/src/hurricane/Horizontal.cpp index 6618f054..375b256c 100644 --- a/hurricane/src/hurricane/Horizontal.cpp +++ b/hurricane/src/hurricane/Horizontal.cpp @@ -64,7 +64,7 @@ Box Horizontal::GetBoundingBox() const Unit size = GetHalfWidth() + _GetSize(); Unit extention = _GetExtention(); - return Box(GetSourceX(), _y, GetTargetX(), _y).Inflate(extention, size); + return Box(GetSourceX(), _y, GetTargetX(), _y).inflate(extention, size); } Box Horizontal::GetBoundingBox(BasicLayer* basicLayer) const @@ -75,7 +75,7 @@ Box Horizontal::GetBoundingBox(BasicLayer* basicLayer) const Unit size = GetHalfWidth() + _GetSize(basicLayer); Unit extention = _GetExtention(basicLayer); - return Box(GetSourceX(), _y, GetTargetX(), _y).Inflate(extention, size); + return Box(GetSourceX(), _y, GetTargetX(), _y).inflate(extention, size); } Unit Horizontal::GetSourceX() const diff --git a/hurricane/src/hurricane/HyperNet.cpp b/hurricane/src/hurricane/HyperNet.cpp index 31d9d012..15bae92c 100644 --- a/hurricane/src/hurricane/HyperNet.cpp +++ b/hurricane/src/hurricane/HyperNet.cpp @@ -511,7 +511,7 @@ static bool IsConnex(const Occurrence& componentOccurrence1, const Occurrence& c for_each_basic_layer(basicLayer2, layer2->GetBasicLayers()) { if (basicLayer1->GetExtractMask() & basicLayer2->GetExtractMask()) { Box box2 = transformation2.GetBox(component2->GetBoundingBox(basicLayer2)); - if (box1.Intersect(box2)) return true; + if (box1.intersect(box2)) return true; } end_for; } @@ -766,7 +766,7 @@ void HyperNet_NetOccurrencesUnder::Locator::Progress() for_each_component(component, net->GetComponents()) { Occurrence occurrence = Occurrence(component, path); Box area = occurrence.GetBoundingBox(); - if (! area.Intersect (_area)) { + if (! area.intersect (_area)) { // Outside useful area } else if (is_a(component)) { // Will be processed below @@ -774,7 +774,7 @@ void HyperNet_NetOccurrencesUnder::Locator::Progress() // Don't go through the Rubbers (go only trough connecting layers) } else { //if (_allowInterruption && !((i++) % 200)) gtk_check_for_interruption(); - Box under = area.GetIntersection (_area); + Box under = area.getIntersection (_area); for_each_occurrence(occurrence2, cell->GetOccurrencesUnder(under)) { if (is_a(occurrence2.GetEntity())) { Component* component2 = (Component*)occurrence2.GetEntity(); diff --git a/hurricane/src/hurricane/Instance.cpp b/hurricane/src/hurricane/Instance.cpp index 29f983b9..1cb6d831 100644 --- a/hurricane/src/hurricane/Instance.cpp +++ b/hurricane/src/hurricane/Instance.cpp @@ -23,129 +23,129 @@ namespace Hurricane { class Instance_IsUnderFilter : public Filter { // **************************************************** - public: Box _area; + public: Box _area; - public: Instance_IsUnderFilter(const Box& area) - // ******************************************** - : _area(area) - { - }; + public: Instance_IsUnderFilter(const Box& area) + // ******************************************** + : _area(area) + { + }; - public: Instance_IsUnderFilter(const Instance_IsUnderFilter& filter) - // ***************************************************************** - : _area(filter._area) - { - }; + public: Instance_IsUnderFilter(const Instance_IsUnderFilter& filter) + // ***************************************************************** + : _area(filter._area) + { + }; - public: Instance_IsUnderFilter& operator=(const Instance_IsUnderFilter& filter) - // **************************************************************************** - { - _area = filter._area; - return *this; - }; + public: Instance_IsUnderFilter& operator=(const Instance_IsUnderFilter& filter) + // **************************************************************************** + { + _area = filter._area; + return *this; + }; - public: virtual Filter* GetClone() const - // ************************************************ - { - return new Instance_IsUnderFilter(*this); - }; + public: virtual Filter* GetClone() const + // ************************************************ + { + return new Instance_IsUnderFilter(*this); + }; - public: virtual bool Accept(Instance* instance) const - // ************************************************** - { - return _area.Intersect(instance->GetBoundingBox()); - }; + public: virtual bool Accept(Instance* instance) const + // ************************************************** + { + return _area.intersect(instance->GetBoundingBox()); + }; - public: virtual string _GetString() const - // ************************************** - { - return "<" + _TName("Instance::IsUnderFilter") + " " + GetString(_area) + ">"; - }; + public: virtual string _GetString() const + // ************************************** + { + return "<" + _TName("Instance::IsUnderFilter") + " " + GetString(_area) + ">"; + }; }; class Instance_IsTerminalFilter : public Filter { // ******************************************************* - public: Instance_IsTerminalFilter() {}; + public: Instance_IsTerminalFilter() {}; - public: Instance_IsTerminalFilter(const Instance_IsTerminalFilter& filter) {}; + public: Instance_IsTerminalFilter(const Instance_IsTerminalFilter& filter) {}; - public: Instance_IsTerminalFilter& operator=(const Instance_IsTerminalFilter& filter) {return *this;}; + public: Instance_IsTerminalFilter& operator=(const Instance_IsTerminalFilter& filter) {return *this;}; - public: virtual Filter* GetClone() const {return new Instance_IsTerminalFilter(*this);}; + public: virtual Filter* GetClone() const {return new Instance_IsTerminalFilter(*this);}; - public: virtual bool Accept(Instance* instance) const {return instance->IsTerminal();}; + public: virtual bool Accept(Instance* instance) const {return instance->IsTerminal();}; - public: virtual string _GetString() const {return "<" + _TName("Instance::IsTerminalFilter") + ">";}; + public: virtual string _GetString() const {return "<" + _TName("Instance::IsTerminalFilter") + ">";}; }; class Instance_IsLeafFilter : public Filter { // ******************************************************* - public: Instance_IsLeafFilter() {}; + public: Instance_IsLeafFilter() {}; - public: Instance_IsLeafFilter(const Instance_IsLeafFilter& filter) {}; + public: Instance_IsLeafFilter(const Instance_IsLeafFilter& filter) {}; - public: Instance_IsLeafFilter& operator=(const Instance_IsLeafFilter& filter) {return *this;}; + public: Instance_IsLeafFilter& operator=(const Instance_IsLeafFilter& filter) {return *this;}; - public: virtual Filter* GetClone() const {return new Instance_IsLeafFilter(*this);}; + public: virtual Filter* GetClone() const {return new Instance_IsLeafFilter(*this);}; - public: virtual bool Accept(Instance* instance) const {return instance->IsLeaf();}; + public: virtual bool Accept(Instance* instance) const {return instance->IsLeaf();}; - public: virtual string _GetString() const {return "<" + _TName("Instance::IsLeafFilter") + ">";}; + public: virtual string _GetString() const {return "<" + _TName("Instance::IsLeafFilter") + ">";}; }; class Instance_IsUnplacedFilter : public Filter { // ******************************************************* - public: Instance_IsUnplacedFilter() {}; + public: Instance_IsUnplacedFilter() {}; - public: Instance_IsUnplacedFilter(const Instance_IsUnplacedFilter& filter) {}; + public: Instance_IsUnplacedFilter(const Instance_IsUnplacedFilter& filter) {}; - public: Instance_IsUnplacedFilter& operator=(const Instance_IsUnplacedFilter& filter) {return *this;}; + public: Instance_IsUnplacedFilter& operator=(const Instance_IsUnplacedFilter& filter) {return *this;}; - public: virtual Filter* GetClone() const {return new Instance_IsUnplacedFilter(*this);}; + public: virtual Filter* GetClone() const {return new Instance_IsUnplacedFilter(*this);}; - public: virtual bool Accept(Instance* instance) const {return instance->IsUnplaced();}; + public: virtual bool Accept(Instance* instance) const {return instance->IsUnplaced();}; - public: virtual string _GetString() const {return "<" + _TName("Net::IsUnplacedFilter>");}; + public: virtual string _GetString() const {return "<" + _TName("Net::IsUnplacedFilter>");}; }; class Instance_IsPlacedFilter : public Filter { // ***************************************************** - public: Instance_IsPlacedFilter() {}; + public: Instance_IsPlacedFilter() {}; - public: Instance_IsPlacedFilter(const Instance_IsPlacedFilter& filter) {}; + public: Instance_IsPlacedFilter(const Instance_IsPlacedFilter& filter) {}; - public: Instance_IsPlacedFilter& operator=(const Instance_IsPlacedFilter& filter) {return *this;}; + public: Instance_IsPlacedFilter& operator=(const Instance_IsPlacedFilter& filter) {return *this;}; - public: virtual Filter* GetClone() const {return new Instance_IsPlacedFilter(*this);}; + public: virtual Filter* GetClone() const {return new Instance_IsPlacedFilter(*this);}; - public: virtual bool Accept(Instance* instance) const {return instance->IsPlaced();}; + public: virtual bool Accept(Instance* instance) const {return instance->IsPlaced();}; - public: virtual string _GetString() const {return "<" + _TName("Net::IsPlacedFilter>");}; + public: virtual string _GetString() const {return "<" + _TName("Net::IsPlacedFilter>");}; }; class Instance_IsFixedFilter : public Filter { // ***************************************************** - public: Instance_IsFixedFilter() {}; + public: Instance_IsFixedFilter() {}; - public: Instance_IsFixedFilter(const Instance_IsFixedFilter& filter) {}; + public: Instance_IsFixedFilter(const Instance_IsFixedFilter& filter) {}; - public: Instance_IsFixedFilter& operator=(const Instance_IsFixedFilter& filter) {return *this;}; + public: Instance_IsFixedFilter& operator=(const Instance_IsFixedFilter& filter) {return *this;}; - public: virtual Filter* GetClone() const {return new Instance_IsFixedFilter(*this);}; + public: virtual Filter* GetClone() const {return new Instance_IsFixedFilter(*this);}; - public: virtual bool Accept(Instance* instance) const {return instance->IsFixed();}; + public: virtual bool Accept(Instance* instance) const {return instance->IsFixed();}; - public: virtual string _GetString() const {return "<" + _TName("Net::IsFixedFilter>");}; + public: virtual string _GetString() const {return "<" + _TName("Net::IsFixedFilter>");}; }; @@ -155,53 +155,53 @@ class Instance_IsFixedFilter : public Filter { Instance::Instance(Cell* cell, const Name& name, Cell* masterCell, const Transformation& transformation, const PlacementStatus& placementstatus, bool secureFlag) // **************************************************************************************************** -: Inherit(), - _cell(cell), - _name(name), - _masterCell(masterCell), - _transformation(transformation), - _placementStatus(placementstatus), - _plugMap(), - _sharedPathMap(), - _nextOfCellInstanceMap(NULL), - _nextOfCellSlaveInstanceSet(NULL) +: Inherit(), + _cell(cell), + _name(name), + _masterCell(masterCell), + _transformation(transformation), + _placementStatus(placementstatus), + _plugMap(), + _sharedPathMap(), + _nextOfCellInstanceMap(NULL), + _nextOfCellSlaveInstanceSet(NULL) { - if (!_cell) - throw Error("Can't create " + _TName("Instance") + " : null cell"); + if (!_cell) + throw Error("Can't create " + _TName("Instance") + " : null cell"); - if (name.IsEmpty()) - throw Error("Can't create " + _TName("Instance") + " : empty name"); + if (name.IsEmpty()) + throw Error("Can't create " + _TName("Instance") + " : empty name"); - if (_cell->GetInstance(_name)) - throw Error("Can't create " + _TName("Instance") + " : already exists"); + if (_cell->GetInstance(_name)) + throw Error("Can't create " + _TName("Instance") + " : already exists"); - if (!_masterCell) - throw Error("Can't create " + _TName("Instance") + " : null master cell"); + if (!_masterCell) + throw Error("Can't create " + _TName("Instance") + " : null master cell"); - if (secureFlag && _cell->IsCalledBy(_masterCell)) - throw Error("Can't create " + _TName("Instance") + " : cyclic construction"); + if (secureFlag && _cell->IsCalledBy(_masterCell)) + throw Error("Can't create " + _TName("Instance") + " : cyclic construction"); } Instance* Instance::Create(Cell* cell, const Name& name, Cell* masterCell, bool secureFlag) // **************************************************************************************** { - Instance* instance = - new Instance(cell, name, masterCell, Transformation(), PlacementStatus(), secureFlag); + Instance* instance = + new Instance(cell, name, masterCell, Transformation(), PlacementStatus(), secureFlag); - instance->_PostCreate(); + instance->_PostCreate(); - return instance; + return instance; } Instance* Instance::Create(Cell* cell, const Name& name, Cell* masterCell, const Transformation& transformation, const PlacementStatus& placementstatus, bool secureFlag) // **************************************************************************************************** { - Instance* instance = - new Instance(cell, name, masterCell, transformation, placementstatus, secureFlag); + Instance* instance = + new Instance(cell, name, masterCell, transformation, placementstatus, secureFlag); - instance->_PostCreate(); + instance->_PostCreate(); - return instance; + return instance; } Box Instance::GetBoundingBox() const @@ -213,19 +213,19 @@ Box Instance::GetBoundingBox() const Plugs Instance::GetConnectedPlugs() const // ************************************** { - return GetPlugs().GetSubSet(Plug::GetIsConnectedFilter()); + return GetPlugs().GetSubSet(Plug::GetIsConnectedFilter()); } Plugs Instance::GetUnconnectedPlugs() const // **************************************** { - return GetPlugs().GetSubSet(Plug::GetIsUnconnectedFilter()); + return GetPlugs().GetSubSet(Plug::GetIsUnconnectedFilter()); } Path Instance::GetPath(const Path& tailPath) const // *********************************************** { - return Path((Instance*)this, tailPath); + return Path((Instance*)this, tailPath); } Box Instance::GetAbutmentBox() const @@ -237,31 +237,31 @@ Box Instance::GetAbutmentBox() const bool Instance::IsTerminal() const // ****************************** { - return GetMasterCell()->IsTerminal(); + return GetMasterCell()->IsTerminal(); } bool Instance::IsLeaf() const // ************************** { - return GetMasterCell()->IsLeaf(); + return GetMasterCell()->IsLeaf(); } InstanceFilter Instance::GetIsUnderFilter(const Box& area) // ******************************************************* { - return Instance_IsUnderFilter(area); + return Instance_IsUnderFilter(area); } InstanceFilter Instance::GetIsTerminalFilter() // ******************************************* { - return Instance_IsTerminalFilter(); + return Instance_IsTerminalFilter(); } InstanceFilter Instance::GetIsLeafFilter() // ******************************************* { - return Instance_IsLeafFilter(); + return Instance_IsLeafFilter(); } InstanceFilter Instance::GetIsUnplacedFilter() @@ -291,287 +291,287 @@ InstanceFilter Instance::GetIsNotUnplacedFilter() void Instance::Materialize() // ************************* { - if (!IsMaterialized()) { - Box boundingBox = GetBoundingBox(); - if (!boundingBox.IsEmpty()) { - QuadTree* quadTree = _cell->_GetQuadTree(); - quadTree->Insert(this); - _cell->_Fit(quadTree->GetBoundingBox()); - } - } + if (!IsMaterialized()) { + Box boundingBox = GetBoundingBox(); + if (!boundingBox.isEmpty()) { + QuadTree* quadTree = _cell->_GetQuadTree(); + quadTree->Insert(this); + _cell->_Fit(quadTree->GetBoundingBox()); + } + } } void Instance::Unmaterialize() // *************************** { - if (IsMaterialized()) { - _cell->_Unfit(GetBoundingBox()); - _cell->_GetQuadTree()->Remove(this); - } + if (IsMaterialized()) { + _cell->_Unfit(GetBoundingBox()); + _cell->_GetQuadTree()->Remove(this); + } } void Instance::Invalidate(bool propagateFlag) // ****************************************** { - Inherit::Invalidate(false); + Inherit::Invalidate(false); - if (propagateFlag) { - for_each_plug(plug, GetConnectedPlugs()) { - plug->Invalidate(true); - end_for; - } - } + if (propagateFlag) { + for_each_plug(plug, GetConnectedPlugs()) { + plug->Invalidate(true); + end_for; + } + } } void Instance::Translate(const Unit& dx, const Unit& dy) // ***************************************************** { - if ((dx != 0) || (dy !=0)) { - Point translation = _transformation.GetTranslation(); - Unit x = translation.GetX() + dx; - Unit y = translation.GetY() + dy; - Transformation::Orientation orientation = _transformation.GetOrientation(); - SetTransformation(Transformation(x, y, orientation)); - } + if ((dx != 0) || (dy !=0)) { + Point translation = _transformation.GetTranslation(); + Unit x = translation.getX() + dx; + Unit y = translation.getY() + dy; + Transformation::Orientation orientation = _transformation.GetOrientation(); + SetTransformation(Transformation(x, y, orientation)); + } } void Instance::SetName(const Name& name) // ************************************* { - if (name != _name) { - if (name.IsEmpty()) - throw Error("Can't change instance name : empty name"); + if (name != _name) { + if (name.IsEmpty()) + throw Error("Can't change instance name : empty name"); - if (_cell->GetInstance(name)) - throw Error("Can't change instance name : already exists"); + if (_cell->GetInstance(name)) + throw Error("Can't change instance name : already exists"); - _cell->_GetInstanceMap()._Remove(this); - _name = name; - _cell->_GetInstanceMap()._Insert(this); - } + _cell->_GetInstanceMap()._Remove(this); + _name = name; + _cell->_GetInstanceMap()._Insert(this); + } } void Instance::SetTransformation(const Transformation& transformation) // ******************************************************************* { - if (transformation != _transformation) { - Invalidate(true); - _transformation = transformation; - } + if (transformation != _transformation) { + Invalidate(true); + _transformation = transformation; + } } void Instance::SetPlacementStatus(const PlacementStatus& placementstatus) // ********************************************************************** { -// if (placementstatus != _placementStatus) { -// Invalidate(true); +// if (placementstatus != _placementStatus) { +// Invalidate(true); _placementStatus = placementstatus; -// } +// } } void Instance::SetMasterCell(Cell* masterCell, bool secureFlag) // ************************************************************ { - if (masterCell != _masterCell) { + if (masterCell != _masterCell) { - if (!masterCell) - throw Error("Can't set master : null master cell"); + if (!masterCell) + throw Error("Can't set master : null master cell"); - if (secureFlag && _cell->IsCalledBy(masterCell)) - throw Error("Can't set master : cyclic construction"); + if (secureFlag && _cell->IsCalledBy(masterCell)) + throw Error("Can't set master : cyclic construction"); - list connectedPlugList; - list masterNetList; - for_each_plug(plug, GetConnectedPlugs()) { - Net* masterNet = masterCell->GetNet(plug->GetMasterNet()->GetName()); - if (!masterNet || !masterNet->IsExternal()) - throw Error("Can't set master (bad master net matching)"); - connectedPlugList.push_back(plug); - masterNetList.push_back(masterNet); - end_for; - } + list connectedPlugList; + list masterNetList; + for_each_plug(plug, GetConnectedPlugs()) { + Net* masterNet = masterCell->GetNet(plug->GetMasterNet()->GetName()); + if (!masterNet || !masterNet->IsExternal()) + throw Error("Can't set master (bad master net matching)"); + connectedPlugList.push_back(plug); + masterNetList.push_back(masterNet); + end_for; + } - for_each_shared_path(sharedPath, _GetSharedPathes()) { - if (!sharedPath->GetTailSharedPath()) - // if the tail is empty the SharedPath isn't impacted by the change - delete sharedPath; - end_for; - } + for_each_shared_path(sharedPath, _GetSharedPathes()) { + if (!sharedPath->GetTailSharedPath()) + // if the tail is empty the SharedPath isn't impacted by the change + delete sharedPath; + end_for; + } - Invalidate(true); + Invalidate(true); - for_each_plug(plug, GetUnconnectedPlugs()) { - plug->_Delete(); - end_for; - } + for_each_plug(plug, GetUnconnectedPlugs()) { + plug->_Delete(); + end_for; + } - while (!connectedPlugList.empty() && !masterNetList.empty()) { - Plug* plug = connectedPlugList.front(); - Net* masterNet = masterNetList.front(); - _plugMap._Remove(plug); - plug->_SetMasterNet(masterNet); - _plugMap._Insert(plug); - connectedPlugList.pop_front(); - masterNetList.pop_front(); - } + while (!connectedPlugList.empty() && !masterNetList.empty()) { + Plug* plug = connectedPlugList.front(); + Net* masterNet = masterNetList.front(); + _plugMap._Remove(plug); + plug->_SetMasterNet(masterNet); + _plugMap._Insert(plug); + connectedPlugList.pop_front(); + masterNetList.pop_front(); + } - _masterCell->_GetSlaveInstanceSet()._Remove(this); - _masterCell = masterCell; - _masterCell->_GetSlaveInstanceSet()._Insert(this); + _masterCell->_GetSlaveInstanceSet()._Remove(this); + _masterCell = masterCell; + _masterCell->_GetSlaveInstanceSet()._Insert(this); - for_each_net(externalNet, _masterCell->GetExternalNets()) { - if (!GetPlug(externalNet)) Plug::_Create(this, externalNet); - end_for; - } - } + for_each_net(externalNet, _masterCell->GetExternalNets()) { + if (!GetPlug(externalNet)) Plug::_Create(this, externalNet); + end_for; + } + } } void Instance::_PostCreate() // ************************* { - _cell->_GetInstanceMap()._Insert(this); - _masterCell->_GetSlaveInstanceSet()._Insert(this); + _cell->_GetInstanceMap()._Insert(this); + _masterCell->_GetSlaveInstanceSet()._Insert(this); - for_each_net(externalNet, _masterCell->GetExternalNets()) { - Plug::_Create(this, externalNet); - end_for; - } + for_each_net(externalNet, _masterCell->GetExternalNets()) { + Plug::_Create(this, externalNet); + end_for; + } - Inherit::_PostCreate(); + Inherit::_PostCreate(); } void Instance::_PreDelete() // ************************ { - for_each_shared_path(sharedPath, _GetSharedPathes()) delete sharedPath; end_for; + for_each_shared_path(sharedPath, _GetSharedPathes()) delete sharedPath; end_for; - Inherit::_PreDelete(); + Inherit::_PreDelete(); - for_each_plug(plug, GetPlugs()) plug->_Delete(); end_for; + for_each_plug(plug, GetPlugs()) plug->_Delete(); end_for; - _masterCell->_GetSlaveInstanceSet()._Remove(this); - _cell->_GetInstanceMap()._Remove(this); + _masterCell->_GetSlaveInstanceSet()._Remove(this); + _cell->_GetInstanceMap()._Remove(this); } string Instance::_GetString() const // ******************************** { - string s = Inherit::_GetString(); - s.insert(s.length() - 1, " " + GetString(_name)); - s.insert(s.length() - 1, " " + GetString(_masterCell->GetName())); - return s; + string s = Inherit::_GetString(); + s.insert(s.length() - 1, " " + GetString(_name)); + s.insert(s.length() - 1, " " + GetString(_masterCell->GetName())); + return s; } Record* Instance::_GetRecord() const // *************************** { - Record* record = Inherit::_GetRecord(); - if (record) { - record->Add(GetSlot("Cell", _cell)); - record->Add(GetSlot("Name", &_name)); - record->Add(GetSlot("MasterCell", _masterCell)); - record->Add(GetSlot("Transformation", &_transformation)); - record->Add(GetSlot("PlacementStatus", _placementStatus)); - record->Add(GetSlot("XCenter", GetValue(GetAbutmentBox().GetXCenter()))); - record->Add(GetSlot("YCenter", GetValue(GetAbutmentBox().GetYCenter()))); - record->Add(GetSlot("Plugs", &_plugMap)); - record->Add(GetSlot("SharedPathes", &_sharedPathMap)); - } - return record; + Record* record = Inherit::_GetRecord(); + if (record) { + record->Add(GetSlot("Cell", _cell)); + record->Add(GetSlot("Name", &_name)); + record->Add(GetSlot("MasterCell", _masterCell)); + record->Add(GetSlot("Transformation", &_transformation)); + record->Add(GetSlot("PlacementStatus", _placementStatus)); + record->Add(GetSlot("XCenter", GetValue(GetAbutmentBox().getXCenter()))); + record->Add(GetSlot("YCenter", GetValue(GetAbutmentBox().getYCenter()))); + record->Add(GetSlot("Plugs", &_plugMap)); + record->Add(GetSlot("SharedPathes", &_sharedPathMap)); + } + return record; } //void Instance::_DrawPhantoms(View* view, const Box& updateArea, const Transformation& transformation) //// ************************************************************************************************** //{ -// Symbol* symbol = _masterCell->GetSymbol(); -// if (!symbol) { -// Box masterArea = updateArea; -// Transformation masterTransformation = _transformation; -// _transformation.GetInvert().ApplyOn(masterArea); -// transformation.ApplyOn(masterTransformation); -// _masterCell->_DrawPhantoms(view, masterArea, masterTransformation); -// } +// Symbol* symbol = _masterCell->GetSymbol(); +// if (!symbol) { +// Box masterArea = updateArea; +// Transformation masterTransformation = _transformation; +// _transformation.GetInvert().ApplyOn(masterArea); +// transformation.ApplyOn(masterTransformation); +// _masterCell->_DrawPhantoms(view, masterArea, masterTransformation); +// } //} // //void Instance::_DrawBoundaries(View* view, const Box& updateArea, const Transformation& transformation) //// **************************************************************************************************** //{ -// Box masterArea = updateArea; -// Transformation masterTransformation = _transformation; -// _transformation.GetInvert().ApplyOn(masterArea); -// transformation.ApplyOn(masterTransformation); -// Symbol* symbol = _masterCell->GetSymbol(); -// if (!symbol) -// _masterCell->_DrawBoundaries(view, masterArea, masterTransformation); -// else -// _masterCell->GetSymbol()->_Draw(view, masterArea, masterTransformation); +// Box masterArea = updateArea; +// Transformation masterTransformation = _transformation; +// _transformation.GetInvert().ApplyOn(masterArea); +// transformation.ApplyOn(masterTransformation); +// Symbol* symbol = _masterCell->GetSymbol(); +// if (!symbol) +// _masterCell->_DrawBoundaries(view, masterArea, masterTransformation); +// else +// _masterCell->GetSymbol()->_Draw(view, masterArea, masterTransformation); //} // //void Instance::_DrawRubbers(View* view, const Box& updateArea, const Transformation& transformation) //// ************************************************************************************************* //{ -// Box masterArea = updateArea; -// Transformation masterTransformation = _transformation; -// _transformation.GetInvert().ApplyOn(masterArea); -// transformation.ApplyOn(masterTransformation); -// _masterCell->_DrawRubbers(view, masterArea, masterTransformation); +// Box masterArea = updateArea; +// Transformation masterTransformation = _transformation; +// _transformation.GetInvert().ApplyOn(masterArea); +// transformation.ApplyOn(masterTransformation); +// _masterCell->_DrawRubbers(view, masterArea, masterTransformation); //} // //void Instance::_DrawMarkers(View* view, const Box& updateArea, const Transformation& transformation) //// ************************************************************************************************* //{ -// Box masterArea = updateArea; -// Transformation masterTransformation = _transformation; -// _transformation.GetInvert().ApplyOn(masterArea); -// transformation.ApplyOn(masterTransformation); -// _masterCell->_DrawMarkers(view, masterArea, masterTransformation); +// Box masterArea = updateArea; +// Transformation masterTransformation = _transformation; +// _transformation.GetInvert().ApplyOn(masterArea); +// transformation.ApplyOn(masterTransformation); +// _masterCell->_DrawMarkers(view, masterArea, masterTransformation); //} // //void Instance::_DrawDisplaySlots(View* view, const Box& area, const Box& updateArea, const Transformation& transformation) //// *********************************************************************************************************************** //{ -// Box masterArea = updateArea; -// Transformation masterTransformation = _transformation; -// _transformation.GetInvert().ApplyOn(masterArea); -// transformation.ApplyOn(masterTransformation); -// _masterCell->_DrawDisplaySlots(view, area, masterArea, masterTransformation); +// Box masterArea = updateArea; +// Transformation masterTransformation = _transformation; +// _transformation.GetInvert().ApplyOn(masterArea); +// transformation.ApplyOn(masterTransformation); +// _masterCell->_DrawDisplaySlots(view, area, masterArea, masterTransformation); //} // //bool Instance::_IsInterceptedBy(View* view, const Point& point, const Unit& aperture) const //// **************************************************************************************** //{ -// Symbol* symbol = _masterCell->GetSymbol(); -// if (!symbol) -// return (view->PhantomsAreVisible() || view->BoundariesAreVisible()) && -// GetAbutmentBox().Intersect(Box(point).Inflate(aperture)); -// else { -// Point masterPoint = point; -// _transformation.GetInvert().ApplyOn(masterPoint); -// return (view->BoundariesAreVisible() && symbol->_IsInterceptedBy(view, masterPoint, aperture)); -// } +// Symbol* symbol = _masterCell->GetSymbol(); +// if (!symbol) +// return (view->PhantomsAreVisible() || view->BoundariesAreVisible()) && +// GetAbutmentBox().intersect(Box(point).Inflate(aperture)); +// else { +// Point masterPoint = point; +// _transformation.GetInvert().ApplyOn(masterPoint); +// return (view->BoundariesAreVisible() && symbol->_IsInterceptedBy(view, masterPoint, aperture)); +// } //} // //void Instance::_Draw(View* view, BasicLayer* basicLayer, const Box& updateArea, const Transformation& transformation) //// **************************************************************************************************** //{ -// Symbol* symbol = _masterCell->GetSymbol(); -// if (!symbol) { -// Box masterArea = updateArea; -// Transformation masterTransformation = _transformation; -// _transformation.GetInvert().ApplyOn(masterArea); -// transformation.ApplyOn(masterTransformation); -// _masterCell->_DrawContent(view, basicLayer, masterArea, masterTransformation); -// } +// Symbol* symbol = _masterCell->GetSymbol(); +// if (!symbol) { +// Box masterArea = updateArea; +// Transformation masterTransformation = _transformation; +// _transformation.GetInvert().ApplyOn(masterArea); +// transformation.ApplyOn(masterTransformation); +// _masterCell->_DrawContent(view, basicLayer, masterArea, masterTransformation); +// } //} // //void Instance::_Highlight(View* view, const Box& updateArea, const Transformation& transformation) //// *********************************************************************************************** //{ -// Symbol* symbol = _masterCell->GetSymbol(); -// if (!symbol) { -// Box abutmentBox = transformation.GetBox(GetAbutmentBox()); -// view->FillRectangle(abutmentBox); -// view->DrawRectangle(abutmentBox); +// Symbol* symbol = _masterCell->GetSymbol(); +// if (!symbol) { +// Box abutmentBox = transformation.GetBox(GetAbutmentBox()); +// view->FillRectangle(abutmentBox); +// view->DrawRectangle(abutmentBox); // // if ( view->GetScale() > 1 ) // { @@ -583,14 +583,14 @@ Record* Instance::_GetRecord() const // view->DrawString ( text, abutmentBox.GetXMin(), abutmentBox.GetYMax() ); // } // } -// } -// else { -// Box masterArea = updateArea; -// Transformation masterTransformation = _transformation; -// _transformation.GetInvert().ApplyOn(masterArea); -// transformation.ApplyOn(masterTransformation); -// symbol->_Highlight(view, masterArea, masterTransformation); -// } +// } +// else { +// Box masterArea = updateArea; +// Transformation masterTransformation = _transformation; +// _transformation.GetInvert().ApplyOn(masterArea); +// transformation.ApplyOn(masterTransformation); +// symbol->_Highlight(view, masterArea, masterTransformation); +// } //} // @@ -600,32 +600,32 @@ Record* Instance::_GetRecord() const Instance::PlugMap::PlugMap() // ************************* -: Inherit() +: Inherit() { } const Net* Instance::PlugMap::_GetKey(Plug* plug) const // **************************************************** { - return plug->GetMasterNet(); + return plug->GetMasterNet(); } unsigned Instance::PlugMap::_GetHashValue(const Net* masterNet) const // ****************************************************************** { - return ( (unsigned int)( (unsigned long)masterNet ) ) / 8; + return ( (unsigned int)( (unsigned long)masterNet ) ) / 8; } Plug* Instance::PlugMap::_GetNextElement(Plug* plug) const // ******************************************************* { - return plug->_GetNextOfInstancePlugMap(); + return plug->_GetNextOfInstancePlugMap(); } void Instance::PlugMap::_SetNextElement(Plug* plug, Plug* nextPlug) const // ********************************************************************** { - plug->_SetNextOfInstancePlugMap(nextPlug); + plug->_SetNextOfInstancePlugMap(nextPlug); } @@ -636,32 +636,32 @@ void Instance::PlugMap::_SetNextElement(Plug* plug, Plug* nextPlug) const Instance::SharedPathMap::SharedPathMap() // ************************************* -: Inherit() +: Inherit() { } const SharedPath* Instance::SharedPathMap::_GetKey(SharedPath* sharedPath) const // ***************************************************************************** { - return sharedPath->GetTailSharedPath(); + return sharedPath->GetTailSharedPath(); } unsigned Instance::SharedPathMap::_GetHashValue(const SharedPath* tailSharedPath) const // ************************************************************************************ { - return ( (unsigned int)( (unsigned long)tailSharedPath ) ) / 8; + return ( (unsigned int)( (unsigned long)tailSharedPath ) ) / 8; } SharedPath* Instance::SharedPathMap::_GetNextElement(SharedPath* sharedPath) const // ******************************************************************************* { - return sharedPath->_GetNextOfInstanceSharedPathMap(); + return sharedPath->_GetNextOfInstanceSharedPathMap(); } void Instance::SharedPathMap::_SetNextElement(SharedPath* sharedPath, SharedPath* nextSharedPath) const // **************************************************************************************************** { - sharedPath->_SetNextOfInstanceSharedPathMap(nextSharedPath); + sharedPath->_SetNextOfInstanceSharedPathMap(nextSharedPath); }; // **************************************************************************************************** @@ -670,13 +670,13 @@ void Instance::SharedPathMap::_SetNextElement(SharedPath* sharedPath, SharedPath Instance::PlacementStatus::PlacementStatus(const Code& code) // ********************************************************* -: _code(code) +: _code(code) { } Instance::PlacementStatus::PlacementStatus(const PlacementStatus& placementstatus) // ******************************************************************************* -: _code(placementstatus._code) +: _code(placementstatus._code) { } @@ -684,7 +684,7 @@ Instance::PlacementStatus& Instance::PlacementStatus::operator=(const PlacementS // **************************************************************************************************** { _code = placementstatus._code; - return *this; + return *this; } string Instance::PlacementStatus::_GetString() const @@ -696,9 +696,9 @@ string Instance::PlacementStatus::_GetString() const Record* Instance::PlacementStatus::_GetRecord() const // ******************************************** { - Record* record = new Record(GetString(this)); - record->Add(GetSlot("Code", &_code)); - return record; + Record* record = new Record(GetString(this)); + record->Add(GetSlot("Code", &_code)); + return record; } } // End of Hurricane namespace. diff --git a/hurricane/src/hurricane/Net.cpp b/hurricane/src/hurricane/Net.cpp index 03de58ab..7ade15b5 100644 --- a/hurricane/src/hurricane/Net.cpp +++ b/hurricane/src/hurricane/Net.cpp @@ -29,136 +29,136 @@ namespace Hurricane { class Net_IsCellNetFilter : public Filter { // ******************************************* - public: Net_IsCellNetFilter() {}; + public: Net_IsCellNetFilter() {}; - public: Net_IsCellNetFilter(const Net_IsCellNetFilter& filter) {}; + public: Net_IsCellNetFilter(const Net_IsCellNetFilter& filter) {}; - public: Net_IsCellNetFilter& operator=(const Net_IsCellNetFilter& filter) {return *this;}; + public: Net_IsCellNetFilter& operator=(const Net_IsCellNetFilter& filter) {return *this;}; - public: virtual Filter* GetClone() const {return new Net_IsCellNetFilter(*this);}; + public: virtual Filter* GetClone() const {return new Net_IsCellNetFilter(*this);}; - public: virtual bool Accept(Net* net) const {return !net->IsDeepNet();}; + public: virtual bool Accept(Net* net) const {return !net->IsDeepNet();}; - public: virtual string _GetString() const {return "<" + _TName("Net::IsCellNetFilter>");}; + public: virtual string _GetString() const {return "<" + _TName("Net::IsCellNetFilter>");}; }; class Net_IsDeepNetFilter : public Filter { // ******************************************* - public: Net_IsDeepNetFilter() {}; + public: Net_IsDeepNetFilter() {}; - public: Net_IsDeepNetFilter(const Net_IsDeepNetFilter& filter) {}; + public: Net_IsDeepNetFilter(const Net_IsDeepNetFilter& filter) {}; - public: Net_IsDeepNetFilter& operator=(const Net_IsDeepNetFilter& filter) {return *this;}; + public: Net_IsDeepNetFilter& operator=(const Net_IsDeepNetFilter& filter) {return *this;}; - public: virtual Filter* GetClone() const {return new Net_IsDeepNetFilter(*this);}; + public: virtual Filter* GetClone() const {return new Net_IsDeepNetFilter(*this);}; - public: virtual bool Accept(Net* net) const {return net->IsDeepNet();}; + public: virtual bool Accept(Net* net) const {return net->IsDeepNet();}; - public: virtual string _GetString() const {return "<" + _TName("Net::IsDeepNetFilter>");}; + public: virtual string _GetString() const {return "<" + _TName("Net::IsDeepNetFilter>");}; }; class Net_IsGlobalFilter : public Filter { // ******************************************* - public: Net_IsGlobalFilter() {}; + public: Net_IsGlobalFilter() {}; - public: Net_IsGlobalFilter(const Net_IsGlobalFilter& filter) {}; + public: Net_IsGlobalFilter(const Net_IsGlobalFilter& filter) {}; - public: Net_IsGlobalFilter& operator=(const Net_IsGlobalFilter& filter) {return *this;}; + public: Net_IsGlobalFilter& operator=(const Net_IsGlobalFilter& filter) {return *this;}; - public: virtual Filter* GetClone() const {return new Net_IsGlobalFilter(*this);}; + public: virtual Filter* GetClone() const {return new Net_IsGlobalFilter(*this);}; - public: virtual bool Accept(Net* net) const {return net->IsGlobal();}; + public: virtual bool Accept(Net* net) const {return net->IsGlobal();}; - public: virtual string _GetString() const {return "<" + _TName("Net::IsGlobalFilter>");}; + public: virtual string _GetString() const {return "<" + _TName("Net::IsGlobalFilter>");}; }; class Net_IsExternalFilter : public Filter { // ********************************************* - public: Net_IsExternalFilter() {}; + public: Net_IsExternalFilter() {}; - public: Net_IsExternalFilter(const Net_IsExternalFilter& filter) {}; + public: Net_IsExternalFilter(const Net_IsExternalFilter& filter) {}; - public: Net_IsExternalFilter& operator=(const Net_IsExternalFilter& filter) {return *this;}; + public: Net_IsExternalFilter& operator=(const Net_IsExternalFilter& filter) {return *this;}; - public: virtual Filter* GetClone() const {return new Net_IsExternalFilter(*this);}; + public: virtual Filter* GetClone() const {return new Net_IsExternalFilter(*this);}; - public: virtual bool Accept(Net* net) const {return net->IsExternal();}; + public: virtual bool Accept(Net* net) const {return net->IsExternal();}; - public: virtual string _GetString() const {return "<" + _TName("Net::IsExternalFilter>");}; + public: virtual string _GetString() const {return "<" + _TName("Net::IsExternalFilter>");}; }; class Net_IsClockFilter : public Filter { // ****************************************** - public: Net_IsClockFilter() {}; + public: Net_IsClockFilter() {}; - public: Net_IsClockFilter(const Net_IsClockFilter& filter) {}; + public: Net_IsClockFilter(const Net_IsClockFilter& filter) {}; - public: Net_IsClockFilter& operator=(const Net_IsClockFilter& filter) {return *this;}; + public: Net_IsClockFilter& operator=(const Net_IsClockFilter& filter) {return *this;}; - public: virtual Filter* GetClone() const {return new Net_IsClockFilter(*this);}; + public: virtual Filter* GetClone() const {return new Net_IsClockFilter(*this);}; - public: virtual bool Accept(Net* net) const {return net->IsClock();}; + public: virtual bool Accept(Net* net) const {return net->IsClock();}; - public: virtual string _GetString() const {return "<" + _TName("Net::IsClockFilter>");}; + public: virtual string _GetString() const {return "<" + _TName("Net::IsClockFilter>");}; }; class Net_IsSupplyFilter : public Filter { // ******************************************* - public: Net_IsSupplyFilter() {}; + public: Net_IsSupplyFilter() {}; - public: Net_IsSupplyFilter(const Net_IsSupplyFilter& filter) {}; + public: Net_IsSupplyFilter(const Net_IsSupplyFilter& filter) {}; - public: Net_IsSupplyFilter& operator=(const Net_IsSupplyFilter& filter) {return *this;}; + public: Net_IsSupplyFilter& operator=(const Net_IsSupplyFilter& filter) {return *this;}; - public: virtual Filter* GetClone() const {return new Net_IsSupplyFilter(*this);}; + public: virtual Filter* GetClone() const {return new Net_IsSupplyFilter(*this);}; - public: virtual bool Accept(Net* net) const {return net->IsSupply();}; + public: virtual bool Accept(Net* net) const {return net->IsSupply();}; - public: virtual string _GetString() const {return "<" + _TName("Net::IsSupplyFilter>");}; + public: virtual string _GetString() const {return "<" + _TName("Net::IsSupplyFilter>");}; }; class Net_IsPowerFilter : public Filter { // ******************************************* - public: Net_IsPowerFilter() {}; + public: Net_IsPowerFilter() {}; - public: Net_IsPowerFilter(const Net_IsPowerFilter& filter) {}; + public: Net_IsPowerFilter(const Net_IsPowerFilter& filter) {}; - public: Net_IsPowerFilter& operator=(const Net_IsPowerFilter& filter) {return *this;}; + public: Net_IsPowerFilter& operator=(const Net_IsPowerFilter& filter) {return *this;}; - public: virtual Filter* GetClone() const {return new Net_IsPowerFilter(*this);}; + public: virtual Filter* GetClone() const {return new Net_IsPowerFilter(*this);}; - public: virtual bool Accept(Net* net) const {return net->IsPower();}; + public: virtual bool Accept(Net* net) const {return net->IsPower();}; - public: virtual string _GetString() const {return "<" + _TName("Net::IsPowerFilter>");}; + public: virtual string _GetString() const {return "<" + _TName("Net::IsPowerFilter>");}; }; class Net_IsGroundFilter : public Filter { // ******************************************* - public: Net_IsGroundFilter() {}; + public: Net_IsGroundFilter() {}; - public: Net_IsGroundFilter(const Net_IsGroundFilter& filter) {}; + public: Net_IsGroundFilter(const Net_IsGroundFilter& filter) {}; - public: Net_IsGroundFilter& operator=(const Net_IsGroundFilter& filter) {return *this;}; + public: Net_IsGroundFilter& operator=(const Net_IsGroundFilter& filter) {return *this;}; - public: virtual Filter* GetClone() const {return new Net_IsGroundFilter(*this);}; + public: virtual Filter* GetClone() const {return new Net_IsGroundFilter(*this);}; - public: virtual bool Accept(Net* net) const {return net->IsGround();}; + public: virtual bool Accept(Net* net) const {return net->IsGround();}; - public: virtual string _GetString() const {return "<" + _TName("Net::IsGroundFilter>");}; + public: virtual string _GetString() const {return "<" + _TName("Net::IsGroundFilter>");}; }; @@ -174,59 +174,59 @@ class Net_SlavePlugs : public Collection { // Types // ***** - public: typedef Collection Inherit; + public: typedef Collection Inherit; - public: class Locator : public Hurricane::Locator { - // ***************************************************** + public: class Locator : public Hurricane::Locator { + // ***************************************************** - public: typedef Hurricane::Locator Inherit; + public: typedef Hurricane::Locator Inherit; - private: const Net* _net; - private: Plug* _plug; - private: InstanceLocator _instanceLocator; + private: const Net* _net; + private: Plug* _plug; + private: InstanceLocator _instanceLocator; - public: Locator(const Net* net = NULL); - public: Locator(const Locator& locator); + public: Locator(const Net* net = NULL); + public: Locator(const Locator& locator); - public: Locator& operator=(const Locator& locator); + public: Locator& operator=(const Locator& locator); - public: virtual Plug* GetElement() const; - public: virtual Hurricane::Locator* GetClone() const; + public: virtual Plug* GetElement() const; + public: virtual Hurricane::Locator* GetClone() const; - public: virtual bool IsValid() const; + public: virtual bool IsValid() const; - public: virtual void Progress(); + public: virtual void Progress(); - public: virtual string _GetString() const; + public: virtual string _GetString() const; - }; + }; // Attributes // ********** - private: const Net* _net; + private: const Net* _net; // Constructors // ************ - public: Net_SlavePlugs(const Net* net = NULL); - public: Net_SlavePlugs(const Net_SlavePlugs& slavePlugs); + public: Net_SlavePlugs(const Net* net = NULL); + public: Net_SlavePlugs(const Net_SlavePlugs& slavePlugs); // Operators // ********* - public: Net_SlavePlugs& operator=(const Net_SlavePlugs& slavePlugs); + public: Net_SlavePlugs& operator=(const Net_SlavePlugs& slavePlugs); // Accessors // ********* - public: virtual Collection* GetClone() const; - public: virtual Hurricane::Locator* GetLocator() const; + public: virtual Collection* GetClone() const; + public: virtual Hurricane::Locator* GetLocator() const; // Others // ****** - public: virtual string _GetString() const; + public: virtual string _GetString() const; }; @@ -238,425 +238,425 @@ class Net_SlavePlugs : public Collection { Net::Net(Cell* cell, const Name& name) // *********************************** -: Inherit(), - _cell(cell), - _name(name), - _arity(1), - _isGlobal(false), - _isExternal(false), - _type(), - _direction(), - _position(0, 0), - _componentSet(), - _rubberSet(), - _nextOfCellNetMap(NULL) +: Inherit(), + _cell(cell), + _name(name), + _arity(1), + _isGlobal(false), + _isExternal(false), + _type(), + _direction(), + _position(0, 0), + _componentSet(), + _rubberSet(), + _nextOfCellNetMap(NULL) { - if (!_cell) - throw Error("Can't create " + _TName("Net") + " : null cell"); + if (!_cell) + throw Error("Can't create " + _TName("Net") + " : null cell"); - if (name.IsEmpty()) - throw Error("Can't create " + _TName("Net") + " : empty name"); + if (name.IsEmpty()) + throw Error("Can't create " + _TName("Net") + " : empty name"); - if (_cell->GetNet(_name)) - throw Error("Can't create " + _TName("Net") + " : already exists"); + if (_cell->GetNet(_name)) + throw Error("Can't create " + _TName("Net") + " : already exists"); } Net* Net::Create(Cell* cell, const Name& name) // ******************************************* { - Net* net = new Net(cell, name); + Net* net = new Net(cell, name); - net->_PostCreate(); + net->_PostCreate(); - return net; + return net; } Box Net::GetBoundingBox() const // **************************** { - Box boundingBox; - for_each_component(component, GetComponents()) { - boundingBox.Merge(component->GetBoundingBox()); - end_for; - } - return boundingBox; + Box boundingBox; + for_each_component(component, GetComponents()) { + boundingBox.merge(component->GetBoundingBox()); + end_for; + } + return boundingBox; } RoutingPads Net::GetRoutingPads() const // ************************ { - // return GetComponents().GetSubSet(); - return SubTypeCollection(GetComponents()); + // return GetComponents().GetSubSet(); + return SubTypeCollection(GetComponents()); } Plugs Net::GetPlugs() const // ************************ { - // return GetComponents().GetSubSet(); - return SubTypeCollection(GetComponents()); + // return GetComponents().GetSubSet(); + return SubTypeCollection(GetComponents()); } Pins Net::GetPins() const // ********************** { - // return GetComponents().GetSubSet(); - return SubTypeCollection(GetComponents()); + // return GetComponents().GetSubSet(); + return SubTypeCollection(GetComponents()); } Contacts Net::GetContacts() const // ****************************** { - // return GetComponents().GetSubSet(); - return SubTypeCollection(GetComponents()); + // return GetComponents().GetSubSet(); + return SubTypeCollection(GetComponents()); } Segments Net::GetSegments() const // ****************************** { - // return GetComponents().GetSubSet(); - return SubTypeCollection(GetComponents()); + // return GetComponents().GetSubSet(); + return SubTypeCollection(GetComponents()); } Verticals Net::GetVerticals() const // ******************************** { - // return GetComponents().GetSubSet(); - return SubTypeCollection(GetComponents()); + // return GetComponents().GetSubSet(); + return SubTypeCollection(GetComponents()); } Horizontals Net::GetHorizontals() const // ************************************ { - // return GetComponents().GetSubSet(); - return SubTypeCollection(GetComponents()); + // return GetComponents().GetSubSet(); + return SubTypeCollection(GetComponents()); } Pads Net::GetPads() const // ********************** { - // return GetComponents().GetSubSet(); - return SubTypeCollection(GetComponents()); + // return GetComponents().GetSubSet(); + return SubTypeCollection(GetComponents()); } Plugs Net::GetSlavePlugs() const // ***************************** { - return Net_SlavePlugs(this); + return Net_SlavePlugs(this); } Plugs Net::GetConnectedSlavePlugs() const // ************************************** { - return GetSlavePlugs().GetSubSet(Plug::GetIsConnectedFilter()); + return GetSlavePlugs().GetSubSet(Plug::GetIsConnectedFilter()); } Plugs Net::GetUnconnectedSlavePlugs() const // **************************************** { - return GetSlavePlugs().GetSubSet(Plug::GetIsUnconnectedFilter()); + return GetSlavePlugs().GetSubSet(Plug::GetIsUnconnectedFilter()); } NetFilter Net::GetIsCellNetFilter() // ******************************* { - return Net_IsCellNetFilter(); + return Net_IsCellNetFilter(); } NetFilter Net::GetIsDeepNetFilter() // ******************************* { - return Net_IsDeepNetFilter(); + return Net_IsDeepNetFilter(); } NetFilter Net::GetIsGlobalFilter() // ******************************* { - return Net_IsGlobalFilter(); + return Net_IsGlobalFilter(); } NetFilter Net::GetIsExternalFilter() // ********************************* { - return Net_IsExternalFilter(); + return Net_IsExternalFilter(); } NetFilter Net::GetIsInternalFilter() // ********************************* { - return !Net_IsExternalFilter(); + return !Net_IsExternalFilter(); } NetFilter Net::GetIsClockFilter() // ****************************** { - return Net_IsClockFilter(); + return Net_IsClockFilter(); } NetFilter Net::GetIsSupplyFilter() // ******************************* { - return Net_IsSupplyFilter(); + return Net_IsSupplyFilter(); } NetFilter Net::GetIsPowerFilter() // ******************************* { - return Net_IsPowerFilter(); + return Net_IsPowerFilter(); } NetFilter Net::GetIsGroundFilter() // ******************************* { - return Net_IsGroundFilter(); + return Net_IsGroundFilter(); } void Net::SetName(const Name& name) // ******************************** { - if (name != _name) { - if (name.IsEmpty()) - throw Error("Can't change net name : empty name"); + if (name != _name) { + if (name.IsEmpty()) + throw Error("Can't change net name : empty name"); - if (_cell->GetNet(name)) - throw Error("Can't change net name : already exists"); + if (_cell->GetNet(name)) + throw Error("Can't change net name : already exists"); - _cell->_GetNetMap()._Remove(this); - _name = name; - _cell->_GetNetMap()._Insert(this); - } + _cell->_GetNetMap()._Remove(this); + _name = name; + _cell->_GetNetMap()._Insert(this); + } } void Net::SetArity(const Arity& arity) // *********************************** { - _arity = arity; + _arity = arity; } void Net::SetGlobal(bool isGlobal) // ******************************* { - _isGlobal = isGlobal; + _isGlobal = isGlobal; } void Net::SetExternal(bool isExternal) // *********************************** { - if (isExternal != _isExternal) { - if (!isExternal) { - if (!GetConnectedSlavePlugs().IsEmpty()) - throw Error("Can't set internal : has connected slave plugs"); - _direction = Direction::UNDEFINED; - } - _isExternal = isExternal; - if (_isExternal) { - OpenUpdateSession(); - SetPosition(Point(0, 0)); - for_each_instance(instance, _cell->GetSlaveInstances()) { - Plug::_Create(instance, this); - end_for; - } - CloseUpdateSession(); - } - } + if (isExternal != _isExternal) { + if (!isExternal) { + if (!GetConnectedSlavePlugs().IsEmpty()) + throw Error("Can't set internal : has connected slave plugs"); + _direction = Direction::UNDEFINED; + } + _isExternal = isExternal; + if (_isExternal) { + OpenUpdateSession(); + SetPosition(Point(0, 0)); + for_each_instance(instance, _cell->GetSlaveInstances()) { + Plug::_Create(instance, this); + end_for; + } + CloseUpdateSession(); + } + } } void Net::SetType(const Type& type) // ******************************** { - _type = type; + _type = type; } void Net::SetPosition(const Point& position) // ***************************************** { - if (_position != position) { - for_each_plug(plug, GetSlavePlugs()) { - plug->Invalidate(true); - end_for; - } - _position = position; - } + if (_position != position) { + for_each_plug(plug, GetSlavePlugs()) { + plug->Invalidate(true); + end_for; + } + _position = position; + } } void Net::SetDirection(const Direction& direction) // *********************************************** { - _direction = direction; + _direction = direction; } void Net::Materialize() // ******************** { - for_each_component(component, GetComponents()) { - component->Materialize(); - end_for; - } - for_each_rubber(rubber, GetRubbers()) { - rubber->Materialize(); - end_for; - } + for_each_component(component, GetComponents()) { + component->Materialize(); + end_for; + } + for_each_rubber(rubber, GetRubbers()) { + rubber->Materialize(); + end_for; + } } void Net::Unmaterialize() // ********************** { - for_each_rubber(rubber, GetRubbers()) { - rubber->Unmaterialize(); - end_for; - } - for_each_component(component, GetComponents()) { - component->Unmaterialize(); - end_for; - } + for_each_rubber(rubber, GetRubbers()) { + rubber->Unmaterialize(); + end_for; + } + for_each_component(component, GetComponents()) { + component->Unmaterialize(); + end_for; + } } static void MergeNets(Net* net1, Net* net2) // **************************************** { - assert(net1); - assert(net2); + assert(net1); + assert(net2); - if (net2->GetName()[0] != '~') { - if ((net1->GetName()[0] == '~') || - (net2->IsGlobal() && !net1->IsGlobal()) || - (net2->IsExternal() && !net1->IsExternal())) { - Net* tmpNet = net1; - net1 = net2; - net2 = tmpNet; - } - } + if (net2->GetName()[0] != '~') { + if ((net1->GetName()[0] == '~') || + (net2->IsGlobal() && !net1->IsGlobal()) || + (net2->IsExternal() && !net1->IsExternal())) { + Net* tmpNet = net1; + net1 = net2; + net2 = tmpNet; + } + } - if (net2->IsExternal() && !net1->IsExternal()) { - Net* tmpNet = net1; - net1 = net2; - net2 = tmpNet; - } + if (net2->IsExternal() && !net1->IsExternal()) { + Net* tmpNet = net1; + net1 = net2; + net2 = tmpNet; + } - net1->Merge(net2); + net1->Merge(net2); } void Net::Merge(Net* net) // ********************** { - if (!net) - throw Error("Can't merge net : null net"); + if (!net) + throw Error("Can't merge net : null net"); - if (net == this) - throw Error("Can't merge net : itself"); + if (net == this) + throw Error("Can't merge net : itself"); - if (net->GetCell() != _cell) - throw Error("Can't merge net : incompatible net"); + if (net->GetCell() != _cell) + throw Error("Can't merge net : incompatible net"); - if (!IsExternal() && net->IsExternal() && !net->GetConnectedSlavePlugs().IsEmpty()) - throw Error("Can't merge net : incompatible net"); + if (!IsExternal() && net->IsExternal() && !net->GetConnectedSlavePlugs().IsEmpty()) + throw Error("Can't merge net : incompatible net"); - for_each_rubber(rubber, net->GetRubbers()) rubber->_SetNet(this); end_for; - for_each_component(component, net->GetComponents()) component->_SetNet(this); end_for; + for_each_rubber(rubber, net->GetRubbers()) rubber->_SetNet(this); end_for; + for_each_component(component, net->GetComponents()) component->_SetNet(this); end_for; - if (IsExternal() && net->IsExternal()) { - for_each_plug(plug, net->GetConnectedSlavePlugs()) { - Plug* mainPlug = plug->GetInstance()->GetPlug(this); - if (mainPlug->IsConnected() && (mainPlug->GetNet() != plug->GetNet())) - MergeNets(mainPlug->GetNet(), plug->GetNet()); - end_for; - } - for_each_plug(plug, net->GetConnectedSlavePlugs()) { - Plug* mainPlug = plug->GetInstance()->GetPlug(this); - if (!mainPlug->IsConnected()) mainPlug->SetNet(plug->GetNet()); - Hook* masterHook = plug->GetBodyHook(); - Hook* nextMasterHook = masterHook->GetNextMasterHook(); - if (nextMasterHook != masterHook) { - masterHook->Detach(); - mainPlug->GetBodyHook()->Merge(nextMasterHook); - } - Hooks slaveHooks = masterHook->GetSlaveHooks(); - while (!slaveHooks.IsEmpty()) { - Hook* slaveHook = slaveHooks.GetFirst(); - slaveHook->Detach(); - slaveHook->Attach(mainPlug->GetBodyHook()); - } - plug->_Delete(); - end_for; - } - } + if (IsExternal() && net->IsExternal()) { + for_each_plug(plug, net->GetConnectedSlavePlugs()) { + Plug* mainPlug = plug->GetInstance()->GetPlug(this); + if (mainPlug->IsConnected() && (mainPlug->GetNet() != plug->GetNet())) + MergeNets(mainPlug->GetNet(), plug->GetNet()); + end_for; + } + for_each_plug(plug, net->GetConnectedSlavePlugs()) { + Plug* mainPlug = plug->GetInstance()->GetPlug(this); + if (!mainPlug->IsConnected()) mainPlug->SetNet(plug->GetNet()); + Hook* masterHook = plug->GetBodyHook(); + Hook* nextMasterHook = masterHook->GetNextMasterHook(); + if (nextMasterHook != masterHook) { + masterHook->Detach(); + mainPlug->GetBodyHook()->Merge(nextMasterHook); + } + Hooks slaveHooks = masterHook->GetSlaveHooks(); + while (!slaveHooks.IsEmpty()) { + Hook* slaveHook = slaveHooks.GetFirst(); + slaveHook->Detach(); + slaveHook->Attach(mainPlug->GetBodyHook()); + } + plug->_Delete(); + end_for; + } + } - net->Delete(); + net->Delete(); } void Net::_PostCreate() // ******************** { - _cell->_GetNetMap()._Insert(this); + _cell->_GetNetMap()._Insert(this); - if (_isExternal) { - for_each_instance(instance, _cell->GetSlaveInstances()) { - Plug::_Create(instance, this); - end_for; - } - } + if (_isExternal) { + for_each_instance(instance, _cell->GetSlaveInstances()) { + Plug::_Create(instance, this); + end_for; + } + } - Inherit::_PostCreate(); + Inherit::_PostCreate(); } void Net::_PreDelete() // ******************* { - Inherit::_PreDelete(); + Inherit::_PreDelete(); - for_each_plug(slavePlug, GetSlavePlugs()) slavePlug->_Delete(); end_for; + for_each_plug(slavePlug, GetSlavePlugs()) slavePlug->_Delete(); end_for; - Unmaterialize(); + Unmaterialize(); - for_each_rubber(rubber, GetRubbers()) rubber->_Delete(); end_for; + for_each_rubber(rubber, GetRubbers()) rubber->_Delete(); end_for; - for_each_component(component, GetComponents()) { - for_each_hook(hook, component->GetHooks()) { + for_each_component(component, GetComponents()) { + for_each_hook(hook, component->GetHooks()) { // 15 05 2006 xtof : detach all hooks in rings when // a net deletion occurs, can't see why master hooks were not detached. - //if (!hook->IsMaster()) hook->Detach(); - hook->Detach(); - end_for; - } - end_for; - } + //if (!hook->IsMaster()) hook->Detach(); + hook->Detach(); + end_for; + } + end_for; + } - for_each_component(component, GetComponents()) { - if (!is_a(component)) - component->Delete(); - else - ((Plug*)component)->SetNet(NULL); - end_for; - } + for_each_component(component, GetComponents()) { + if (!is_a(component)) + component->Delete(); + else + ((Plug*)component)->SetNet(NULL); + end_for; + } - _cell->_GetNetMap()._Remove(this); + _cell->_GetNetMap()._Remove(this); } string Net::_GetString() const // *************************** { - string s = Inherit::_GetString(); - s.insert(s.length() - 1, " " + GetString(_name)); - return s; + string s = Inherit::_GetString(); + s.insert(s.length() - 1, " " + GetString(_name)); + return s; } Record* Net::_GetRecord() const // ********************** { - Record* record = Inherit::_GetRecord(); - if (record) { - record->Add(GetSlot("Cell", _cell)); - record->Add(GetSlot("Name", &_name)); - record->Add(GetSlot("Arity", &_arity)); - record->Add(GetSlot("Global", &_isGlobal)); - record->Add(GetSlot("External", &_isExternal)); - record->Add(GetSlot("Type", _type)); - record->Add(GetSlot("Direction", _direction)); - record->Add(GetSlot("Position", &_position)); - record->Add(GetSlot("Components", &_componentSet)); - record->Add(GetSlot("Rubbers", &_rubberSet)); - record->Add(GetSlot("External", &_isExternal)); - } - return record; + Record* record = Inherit::_GetRecord(); + if (record) { + record->Add(GetSlot("Cell", _cell)); + record->Add(GetSlot("Name", &_name)); + record->Add(GetSlot("Arity", &_arity)); + record->Add(GetSlot("Global", &_isGlobal)); + record->Add(GetSlot("External", &_isExternal)); + record->Add(GetSlot("Type", _type)); + record->Add(GetSlot("Direction", _direction)); + record->Add(GetSlot("Position", &_position)); + record->Add(GetSlot("Components", &_componentSet)); + record->Add(GetSlot("Rubbers", &_rubberSet)); + record->Add(GetSlot("External", &_isExternal)); + } + return record; } // **************************************************************************************************** @@ -665,21 +665,21 @@ Record* Net::_GetRecord() const Net::Type::Type(const Code& code) // ****************************** -: _code(code) +: _code(code) { } Net::Type::Type(const Type& type) // ****************************** -: _code(type._code) +: _code(type._code) { } Net::Type& Net::Type::operator=(const Type& type) // ********************************************** { - _code = type._code; - return *this; + _code = type._code; + return *this; } string Net::Type::_GetString() const @@ -691,9 +691,9 @@ string Net::Type::_GetString() const Record* Net::Type::_GetRecord() const // **************************** { - Record* record = new Record(GetString(this)); - record->Add(GetSlot("Code", &_code)); - return record; + Record* record = new Record(GetString(this)); + record->Add(GetSlot("Code", &_code)); + return record; } @@ -704,21 +704,21 @@ Record* Net::Type::_GetRecord() const Net::Direction::Direction(const Code& code) // **************************************** -: _code(code) +: _code(code) { } Net::Direction::Direction(const Direction& direction) // ************************************************** -: _code(direction._code) +: _code(direction._code) { } Net::Direction& Net::Direction::operator=(const Direction& direction) // ****************************************************************** { - _code = direction._code; - return *this; + _code = direction._code; + return *this; } string Net::Direction::_GetString() const @@ -730,9 +730,9 @@ string Net::Direction::_GetString() const Record* Net::Direction::_GetRecord() const // ********************************* { - Record* record = new Record(GetString(this)); - record->Add(GetSlot("Code", &_code)); - return record; + Record* record = new Record(GetString(this)); + record->Add(GetSlot("Code", &_code)); + return record; } @@ -743,26 +743,26 @@ Record* Net::Direction::_GetRecord() const Net::ComponentSet::ComponentSet() // ****************************** -: Inherit() +: Inherit() { } unsigned Net::ComponentSet::_GetHashValue(Component* component) const // ****************************************************************** { - return ( (unsigned int)( (unsigned long)component ) ) / 8; + return ( (unsigned int)( (unsigned long)component ) ) / 8; } Component* Net::ComponentSet::_GetNextElement(Component* component) const // ********************************************************************** { - return component->_GetNextOfNetComponentSet(); + return component->_GetNextOfNetComponentSet(); } void Net::ComponentSet::_SetNextElement(Component* component, Component* nextComponent) const // ****************************************************************************************** { - component->_SetNextOfNetComponentSet(nextComponent); + component->_SetNextOfNetComponentSet(nextComponent); } @@ -773,26 +773,26 @@ void Net::ComponentSet::_SetNextElement(Component* component, Component* nextCom Net::RubberSet::RubberSet() // ************************ -: Inherit() +: Inherit() { } unsigned Net::RubberSet::_GetHashValue(Rubber* rubber) const // ********************************************************* { - return ( (unsigned int)( (unsigned long)rubber ) ) / 8; + return ( (unsigned int)( (unsigned long)rubber ) ) / 8; } Rubber* Net::RubberSet::_GetNextElement(Rubber* rubber) const // ********************************************************** { - return rubber->_GetNextOfNetRubberSet(); + return rubber->_GetNextOfNetRubberSet(); } void Net::RubberSet::_SetNextElement(Rubber* rubber, Rubber* nextRubber) const // *************************************************************************** { - rubber->_SetNextOfNetRubberSet(nextRubber); + rubber->_SetNextOfNetRubberSet(nextRubber); } @@ -803,44 +803,44 @@ void Net::RubberSet::_SetNextElement(Rubber* rubber, Rubber* nextRubber) const Net_SlavePlugs::Net_SlavePlugs(const Net* net) // ******************************************* -: Inherit(), - _net(net) +: Inherit(), + _net(net) { } Net_SlavePlugs::Net_SlavePlugs(const Net_SlavePlugs& slavePlugs) // ************************************************************* -: Inherit(), - _net(slavePlugs._net) +: Inherit(), + _net(slavePlugs._net) { } Net_SlavePlugs& Net_SlavePlugs::operator=(const Net_SlavePlugs& slavePlugs) // ************************************************************************ { - _net = slavePlugs._net; - return *this; + _net = slavePlugs._net; + return *this; } Collection* Net_SlavePlugs::GetClone() const // ************************************************ { - return new Net_SlavePlugs(*this); + return new Net_SlavePlugs(*this); } Locator* Net_SlavePlugs::GetLocator() const // *********************************************** { - return new Locator(_net); + return new Locator(_net); } string Net_SlavePlugs::_GetString() const // ************************************** { - string s = "<" + _TName("Net::SlavePlugs"); - if (_net) s += " " + GetString(_net); - s += ">"; - return s; + string s = "<" + _TName("Net::SlavePlugs"); + if (_net) s += " " + GetString(_net); + s += ">"; + return s; } @@ -851,75 +851,75 @@ string Net_SlavePlugs::_GetString() const Net_SlavePlugs::Locator::Locator(const Net* net) // ********************************************* -: Inherit(), - _net(net), - _plug(NULL), - _instanceLocator() +: Inherit(), + _net(net), + _plug(NULL), + _instanceLocator() { - if (_net) { - _instanceLocator = _net->GetCell()->GetSlaveInstances().GetLocator(); - while (!_plug && _instanceLocator.IsValid()) { - _plug = _instanceLocator.GetElement()->GetPlug(_net); - _instanceLocator.Progress(); - } - } + if (_net) { + _instanceLocator = _net->GetCell()->GetSlaveInstances().GetLocator(); + while (!_plug && _instanceLocator.IsValid()) { + _plug = _instanceLocator.GetElement()->GetPlug(_net); + _instanceLocator.Progress(); + } + } } Net_SlavePlugs::Locator::Locator(const Locator& locator) // ***************************************************** -: Inherit(), - _net(locator._net), - _plug(locator._plug), - _instanceLocator(locator._instanceLocator) +: Inherit(), + _net(locator._net), + _plug(locator._plug), + _instanceLocator(locator._instanceLocator) { } Net_SlavePlugs::Locator& Net_SlavePlugs::Locator::operator=(const Locator& locator) // ******************************************************************************** { - _net = locator._net; - _plug = locator._plug; - _instanceLocator = locator._instanceLocator; - return *this; + _net = locator._net; + _plug = locator._plug; + _instanceLocator = locator._instanceLocator; + return *this; } Plug* Net_SlavePlugs::Locator::GetElement() const // ********************************************** { - return _plug; + return _plug; } Locator* Net_SlavePlugs::Locator::GetClone() const // ****************************************************** { - return new Locator(*this); + return new Locator(*this); } bool Net_SlavePlugs::Locator::IsValid() const // ****************************************** { - return (_plug != NULL); + return (_plug != NULL); } void Net_SlavePlugs::Locator::Progress() // ************************************* { - if (IsValid()) { - _plug = NULL; - while (!_plug && _instanceLocator.IsValid()) { - _plug = _instanceLocator.GetElement()->GetPlug(_net); - _instanceLocator.Progress(); - } - } + if (IsValid()) { + _plug = NULL; + while (!_plug && _instanceLocator.IsValid()) { + _plug = _instanceLocator.GetElement()->GetPlug(_net); + _instanceLocator.Progress(); + } + } } string Net_SlavePlugs::Locator::_GetString() const // *********************************************** { - string s = "<" + _TName("Net::SlavePlugs::Locator"); - if (_net) s += " " + GetString(_net); - s += ">"; - return s; + string s = "<" + _TName("Net::SlavePlugs::Locator"); + if (_net) s += " " + GetString(_net); + s += ">"; + return s; } } // End of Hurricane namespace. diff --git a/hurricane/src/hurricane/Net.h b/hurricane/src/hurricane/Net.h index 7b2c98ab..2ae75f4f 100644 --- a/hurricane/src/hurricane/Net.h +++ b/hurricane/src/hurricane/Net.h @@ -143,8 +143,8 @@ class Net : public Entity { public: const Type& GetType() const {return _type;}; public: const Direction& GetDirection() const {return _direction;}; public: const Point& GetPosition() const {return _position;}; - public: const Unit& GetX() const {return _position.GetX();}; - public: const Unit& GetY() const {return _position.GetY();}; + public: const Unit& GetX() const {return _position.getX();}; + public: const Unit& GetY() const {return _position.getY();}; public: Components GetComponents() const {return _componentSet.GetElements();}; public: Rubbers GetRubbers() const {return _rubberSet.GetElements();}; public: RoutingPads GetRoutingPads() const; diff --git a/hurricane/src/hurricane/Pad.cpp b/hurricane/src/hurricane/Pad.cpp index 4fd99f48..d28d8140 100644 --- a/hurricane/src/hurricane/Pad.cpp +++ b/hurricane/src/hurricane/Pad.cpp @@ -22,122 +22,122 @@ namespace Hurricane { Pad::Pad(Net* net, Layer* layer, const Box& boundingBox) // ***************************************************** : Inherit(net), - _layer(layer), - _boundingBox(boundingBox) + _layer(layer), + _boundingBox(boundingBox) { - if (!_layer) - throw Error("Can't create " + _TName("Pad") + " : null layer"); + if (!_layer) + throw Error("Can't create " + _TName("Pad") + " : null layer"); - if (_boundingBox.IsEmpty()) - throw Error("Can't create " + _TName("Pad") + " : empty bounding box"); + if (_boundingBox.isEmpty()) + throw Error("Can't create " + _TName("Pad") + " : empty bounding box"); } Pad* Pad::Create(Net* net, Layer* layer, const Box& boundingBox) // ************************************************************* { - Pad* pad = new Pad(net, layer, boundingBox); + Pad* pad = new Pad(net, layer, boundingBox); - pad->_PostCreate(); + pad->_PostCreate(); - return pad; + return pad; } Unit Pad::GetX() const // ******************* { - return 0; + return 0; } Unit Pad::GetY() const // ******************* { - return 0; + return 0; } Box Pad::GetBoundingBox() const // **************************** { - Box boundingBox = _boundingBox; + Box boundingBox = _boundingBox; - if (is_a(_layer)) - boundingBox.Inflate(((CompositeLayer*)_layer)->GetMaximalPadSize()); + if (is_a(_layer)) + boundingBox.inflate(((CompositeLayer*)_layer)->GetMaximalPadSize()); - return boundingBox; + return boundingBox; } Box Pad::GetBoundingBox(BasicLayer* basicLayer) const // ************************************************** { - if (!_layer->Contains(basicLayer)) return Box(); + if (!_layer->Contains(basicLayer)) return Box(); - Box boundingBox = _boundingBox; + Box boundingBox = _boundingBox; - if (is_a(_layer)) - boundingBox.Inflate(((CompositeLayer*)_layer)->GetPadSize(basicLayer)); + if (is_a(_layer)) + boundingBox.inflate(((CompositeLayer*)_layer)->GetPadSize(basicLayer)); - return boundingBox; + return boundingBox; } void Pad::Translate(const Unit& dx, const Unit& dy) // ************************************************ { - if ((dx != 0) || (dy != 0)) { - Invalidate(true); - _boundingBox.Translate(dx, dy); - } + if ((dx != 0) || (dy != 0)) { + Invalidate(true); + _boundingBox.translate(dx, dy); + } } void Pad::SetBoundingBox(const Box& boundingBox) // ********************************************* { - if (_boundingBox.IsEmpty()) - throw Error("Can't set bounding box : empty bounding box"); + if (_boundingBox.isEmpty()) + throw Error("Can't set bounding box : empty bounding box"); - if (boundingBox != _boundingBox) { - Invalidate(true); - _boundingBox = boundingBox; - } + if (boundingBox != _boundingBox) { + Invalidate(true); + _boundingBox = boundingBox; + } } string Pad::_GetString() const // *************************** { - string s = Inherit::_GetString(); - s.insert(s.length() - 1, " " + GetString(_layer->GetName())); - s.insert(s.length() - 1, " " + GetString(_boundingBox)); - return s; + string s = Inherit::_GetString(); + s.insert(s.length() - 1, " " + GetString(_layer->GetName())); + s.insert(s.length() - 1, " " + GetString(_boundingBox)); + return s; } Record* Pad::_GetRecord() const // ********************** { - Record* record = Inherit::_GetRecord(); - if (record) { - record->Add(GetSlot("Layer", _layer)); - record->Add(GetSlot("BoundingBox", &_boundingBox)); - } - return record; + Record* record = Inherit::_GetRecord(); + if (record) { + record->Add(GetSlot("Layer", _layer)); + record->Add(GetSlot("BoundingBox", &_boundingBox)); + } + return record; } //void Pad::_Draw(View* view, BasicLayer* basicLayer, const Box& updateArea, const Transformation& transformation) //// **************************************************************************************************** //{ -// Unit width = _boundingBox.GetWidth(); -// Unit height = _boundingBox.GetHeight(); -// if (1 < view->GetScreenSize(max(width, height))) { -// basicLayer->_Fill(view, transformation.GetBox(GetBoundingBox(basicLayer))); -// view->DrawRectangle(transformation.GetBox(GetBoundingBox(basicLayer))); // PROVISOIREMENT -// } +// Unit width = _boundingBox.GetWidth(); +// Unit height = _boundingBox.GetHeight(); +// if (1 < view->GetScreenSize(max(width, height))) { +// basicLayer->_Fill(view, transformation.GetBox(GetBoundingBox(basicLayer))); +// view->DrawRectangle(transformation.GetBox(GetBoundingBox(basicLayer))); // PROVISOIREMENT +// } //} // //void Pad::_Highlight(View* view, const Box& updateArea, const Transformation& transformation) //// ****************************************************************************************** //{ -// for_each_basic_layer(basicLayer, GetLayer()->GetBasicLayers()) { -// basicLayer->_Fill(view, transformation.GetBox(GetBoundingBox(basicLayer))); -// view->DrawRectangle(transformation.GetBox(GetBoundingBox(basicLayer))); // PROVISOIREMENT -// end_for; -// } +// for_each_basic_layer(basicLayer, GetLayer()->GetBasicLayers()) { +// basicLayer->_Fill(view, transformation.GetBox(GetBoundingBox(basicLayer))); +// view->DrawRectangle(transformation.GetBox(GetBoundingBox(basicLayer))); // PROVISOIREMENT +// end_for; +// } //} // diff --git a/hurricane/src/hurricane/Point.cpp b/hurricane/src/hurricane/Point.cpp index c78532ca..d5aec09c 100644 --- a/hurricane/src/hurricane/Point.cpp +++ b/hurricane/src/hurricane/Point.cpp @@ -17,94 +17,94 @@ namespace Hurricane { Point::Point() // *********** -: _x(0), - _y(0) +: _x(0), + _y(0) { } Point::Point(const Unit& x, const Unit& y) // *************************************** -: _x(x), - _y(y) +: _x(x), + _y(y) { } Point::Point(const Point& point) // ***************************** -: _x(point._x), - _y(point._y) +: _x(point._x), + _y(point._y) { } Point& Point::operator=(const Point& point) // **************************************** { - _x = point._x; - _y = point._y; - return *this; + _x = point._x; + _y = point._y; + return *this; } bool Point::operator==(const Point& point) const // ********************************************* { - return ((_x == point._x) && (_y == point._y)); + return ((_x == point._x) && (_y == point._y)); } bool Point::operator!=(const Point& point) const // ********************************************* { - return ((_x != point._x) || (_y != point._y)); + return ((_x != point._x) || (_y != point._y)); } Point Point::operator+(const Point& point) const // ********************************************* { - return Point(_x+point._x,_y+point._y); + return Point(_x+point._x,_y+point._y); } Point Point::operator-(const Point& point) const // ********************************************* { - return Point(_x-point._x,_y-point._y); + return Point(_x-point._x,_y-point._y); } Point& Point::operator+=(const Point &point) // ***************************************** { - _x += point._x; - _y += point._y; - return *this; + _x += point._x; + _y += point._y; + return *this; } Point& Point::operator-=(const Point &point) // ***************************************** { - _x -= point._x; - _y -= point._y; - return *this; + _x -= point._x; + _y -= point._y; + return *this; } -Point& Point::Translate(const Unit& dx, const Unit& dy) +Point& Point::translate(const Unit& dx, const Unit& dy) // **************************************************** { - _x += dx; - _y += dy; - return *this; + _x += dx; + _y += dy; + return *this; } string Point::_GetString() const // ***************************** { - return "<" + _TName("Point") + " " + GetValueString(_x) + " " + GetValueString(_y) + ">"; + return "<" + _TName("Point") + " " + GetValueString(_x) + " " + GetValueString(_y) + ">"; } Record* Point::_GetRecord() const // ****************************** { - Record* record = new Record(GetString(this)); - record->Add(GetSlot("X", &_x)); - record->Add(GetSlot("Y", &_y)); - return record; + Record* record = new Record(GetString(this)); + record->Add(GetSlot("X", &_x)); + record->Add(GetSlot("Y", &_y)); + return record; } diff --git a/hurricane/src/hurricane/Point.h b/hurricane/src/hurricane/Point.h index d0460b1e..83619324 100644 --- a/hurricane/src/hurricane/Point.h +++ b/hurricane/src/hurricane/Point.h @@ -24,53 +24,52 @@ class Point { // Attributes // ********** - private: Unit _x; - private: Unit _y; + private: Unit _x; + private: Unit _y; // Constructors // ************ - public: Point(); + public: Point(); - public: Point(const Unit& x, const Unit& y); + public: Point(const Unit& x, const Unit& y); - public: Point(const Point& point); + public: Point(const Point& point); // Operators // ********* - public: Point& operator=(const Point& point); + public: Point& operator=(const Point& point); - public: bool operator==(const Point& point) const; - public: bool operator!=(const Point& point) const; + public: bool operator==(const Point& point) const; + public: bool operator!=(const Point& point) const; - public: Point operator+(const Point& point) const; - public: Point operator-(const Point& point) const; - public: Point& operator+=(const Point& point); - public: Point& operator-=(const Point& point); + public: Point operator+(const Point& point) const; + public: Point operator-(const Point& point) const; + public: Point& operator+=(const Point& point); + public: Point& operator-=(const Point& point); // Accessors // ********* - public: const Unit& GetX() const {return _x;}; - public: const Unit& GetY() const {return _y;}; - - public: Unit ManhattanDistance(const Point pt) const - {return abs(_x - pt.GetX()) + abs(_y - pt.GetY());}; + public: const Unit& getX() const {return _x;}; + public: const Unit& getY() const {return _y;}; + public: Unit manhattanDistance(const Point pt) const + { return abs(_x - pt.getX()) + abs(_y - pt.getY()); } // Updators // ******** - public: void SetX(const Unit& x) {_x = x;}; - public: void SetY(const Unit& y) {_y = y;}; - public: Point& Translate(const Unit& dx, const Unit& dy); + public: void setX(const Unit& x) {_x = x;}; + public: void setY(const Unit& y) {_y = y;}; + public: Point& translate(const Unit& dx, const Unit& dy); // Others // ****** public: string _GetTypeName() const { return _TName("Point"); }; - public: string _GetString() const; - public: Record* _GetRecord() const; + public: string _GetString() const; + public: Record* _GetRecord() const; }; diff --git a/hurricane/src/hurricane/QuadTree.cpp b/hurricane/src/hurricane/QuadTree.cpp index 05d72588..a65fc2a5 100644 --- a/hurricane/src/hurricane/QuadTree.cpp +++ b/hurricane/src/hurricane/QuadTree.cpp @@ -31,59 +31,59 @@ class QuadTree_Gos : public Collection { // Types // ***** - public: typedef Collection Inherit; + public: typedef Collection Inherit; - public: class Locator : public Hurricane::Locator { - // *************************************************** + public: class Locator : public Hurricane::Locator { + // *************************************************** - public: typedef Hurricane::Locator Inherit; + public: typedef Hurricane::Locator Inherit; - private: const QuadTree* _quadTree; - private: QuadTree* _currentQuadTree; - private: GoLocator _goLocator; + private: const QuadTree* _quadTree; + private: QuadTree* _currentQuadTree; + private: GoLocator _goLocator; - public: Locator(const QuadTree* quadTree = NULL); - public: Locator(const Locator& locator); + public: Locator(const QuadTree* quadTree = NULL); + public: Locator(const Locator& locator); - public: Locator& operator=(const Locator& locator); + public: Locator& operator=(const Locator& locator); - public: virtual Go* GetElement() const; - public: virtual Hurricane::Locator* GetClone() const; + public: virtual Go* GetElement() const; + public: virtual Hurricane::Locator* GetClone() const; - public: virtual bool IsValid() const; + public: virtual bool IsValid() const; - public: virtual void Progress(); + public: virtual void Progress(); - public: virtual string _GetString() const; + public: virtual string _GetString() const; - }; + }; // Attributes // ********** - private: const QuadTree* _quadTree; + private: const QuadTree* _quadTree; // Constructors // ************ - public: QuadTree_Gos(const QuadTree* quadTree = NULL); - public: QuadTree_Gos(const QuadTree_Gos& gos); + public: QuadTree_Gos(const QuadTree* quadTree = NULL); + public: QuadTree_Gos(const QuadTree_Gos& gos); // Operators // ********* - public: QuadTree_Gos& operator=(const QuadTree_Gos& gos); + public: QuadTree_Gos& operator=(const QuadTree_Gos& gos); // Accessors // ********* - public: virtual Collection* GetClone() const; - public: virtual Hurricane::Locator* GetLocator() const; + public: virtual Collection* GetClone() const; + public: virtual Hurricane::Locator* GetLocator() const; // Others // ****** - public: virtual string _GetString() const; + public: virtual string _GetString() const; }; @@ -99,63 +99,63 @@ class QuadTree_GosUnder : public Collection { // Types // ***** - public: typedef Collection Inherit; + public: typedef Collection Inherit; - public: class Locator : public Hurricane::Locator { - // *************************************************** + public: class Locator : public Hurricane::Locator { + // *************************************************** - public: typedef Hurricane::Locator Inherit; + public: typedef Hurricane::Locator Inherit; - private: const QuadTree* _quadTree; - private: Box _area; - private: QuadTree* _currentQuadTree; - private: GoLocator _goLocator; + private: const QuadTree* _quadTree; + private: Box _area; + private: QuadTree* _currentQuadTree; + private: GoLocator _goLocator; - public: Locator(); - public: Locator(const QuadTree* quadTree, const Box& area); - public: Locator(const Locator& locator); + public: Locator(); + public: Locator(const QuadTree* quadTree, const Box& area); + public: Locator(const Locator& locator); - public: Locator& operator=(const Locator& locator); + public: Locator& operator=(const Locator& locator); - public: virtual Go* GetElement() const; - public: virtual Hurricane::Locator* GetClone() const; + public: virtual Go* GetElement() const; + public: virtual Hurricane::Locator* GetClone() const; - public: virtual bool IsValid() const; + public: virtual bool IsValid() const; - public: virtual void Progress(); + public: virtual void Progress(); - public: virtual string _GetString() const; + public: virtual string _GetString() const; - }; + }; // Attributes // ********** - private: const QuadTree* _quadTree; - private: Box _area; + private: const QuadTree* _quadTree; + private: Box _area; // Constructors // ************ - public: QuadTree_GosUnder(); - public: QuadTree_GosUnder(const QuadTree* quadTree, const Box& area); - public: QuadTree_GosUnder(const QuadTree_GosUnder& gos); + public: QuadTree_GosUnder(); + public: QuadTree_GosUnder(const QuadTree* quadTree, const Box& area); + public: QuadTree_GosUnder(const QuadTree_GosUnder& gos); // Operators // ********* - public: QuadTree_GosUnder& operator=(const QuadTree_GosUnder& gos); + public: QuadTree_GosUnder& operator=(const QuadTree_GosUnder& gos); // Accessors // ********* - public: virtual Collection* GetClone() const; - public: virtual Hurricane::Locator* GetLocator() const; + public: virtual Collection* GetClone() const; + public: virtual Hurricane::Locator* GetLocator() const; // Others // ****** - public: virtual string _GetString() const; + public: virtual string _GetString() const; }; @@ -167,336 +167,336 @@ class QuadTree_GosUnder : public Collection { QuadTree::QuadTree() // ***************** -: _parent(NULL), - _x(0), - _y(0), - _boundingBox(), - _size(0), - _goSet(), - _ulChild(NULL), - _urChild(NULL), - _llChild(NULL), - _lrChild(NULL) +: _parent(NULL), + _x(0), + _y(0), + _boundingBox(), + _size(0), + _goSet(), + _ulChild(NULL), + _urChild(NULL), + _llChild(NULL), + _lrChild(NULL) { } QuadTree::QuadTree(QuadTree* parent) // ********************************* -: _parent(parent), - _x(0), - _y(0), - _boundingBox(), - _size(0), - _goSet(), - _ulChild(NULL), - _urChild(NULL), - _llChild(NULL), - _lrChild(NULL) +: _parent(parent), + _x(0), + _y(0), + _boundingBox(), + _size(0), + _goSet(), + _ulChild(NULL), + _urChild(NULL), + _llChild(NULL), + _lrChild(NULL) { } QuadTree::~QuadTree() // ****************** { - if (_ulChild) delete _ulChild; - if (_urChild) delete _urChild; - if (_llChild) delete _llChild; - if (_lrChild) delete _lrChild; + if (_ulChild) delete _ulChild; + if (_urChild) delete _urChild; + if (_llChild) delete _llChild; + if (_lrChild) delete _lrChild; } const Box& QuadTree::GetBoundingBox() const // **************************************** { - if (_boundingBox.IsEmpty()) { - Box& boundingBox = ((QuadTree*)this)->_boundingBox; - if (_ulChild) boundingBox.Merge(_ulChild->GetBoundingBox()); - if (_urChild) boundingBox.Merge(_urChild->GetBoundingBox()); - if (_llChild) boundingBox.Merge(_llChild->GetBoundingBox()); - if (_lrChild) boundingBox.Merge(_lrChild->GetBoundingBox()); - for_each_go(go, _goSet.GetElements()) { - boundingBox.Merge(go->GetBoundingBox()); - end_for; - } - } - return _boundingBox; + if (_boundingBox.isEmpty()) { + Box& boundingBox = ((QuadTree*)this)->_boundingBox; + if (_ulChild) boundingBox.merge(_ulChild->GetBoundingBox()); + if (_urChild) boundingBox.merge(_urChild->GetBoundingBox()); + if (_llChild) boundingBox.merge(_llChild->GetBoundingBox()); + if (_lrChild) boundingBox.merge(_lrChild->GetBoundingBox()); + for_each_go(go, _goSet.GetElements()) { + boundingBox.merge(go->GetBoundingBox()); + end_for; + } + } + return _boundingBox; } Gos QuadTree::GetGos() const // ************************* { - return QuadTree_Gos(this); + return QuadTree_Gos(this); } Gos QuadTree::GetGosUnder(const Box& area) const // ********************************************* { - return QuadTree_GosUnder(this, area); + return QuadTree_GosUnder(this, area); } void QuadTree::Insert(Go* go) // ************************** { - if (!go) - throw Error("Can't insert go : null go"); + if (!go) + throw Error("Can't insert go : null go"); - if (!go->IsMaterialized()) { - Box boundingBox = go->GetBoundingBox(); - QuadTree* child = _GetDeepestChild(boundingBox); - child->_goSet._Insert(go); - go->_quadTree = child; - QuadTree* parent = child; - while (parent) { - parent->_size++; - if (parent->IsEmpty() || !parent->_boundingBox.IsEmpty()) - parent->_boundingBox.Merge(boundingBox); - parent = parent->_parent; - } - if (QUAD_TREE_EXPLODE_THRESHOLD <= child->_size) - child->_Explode(); - } + if (!go->IsMaterialized()) { + Box boundingBox = go->GetBoundingBox(); + QuadTree* child = _GetDeepestChild(boundingBox); + child->_goSet._Insert(go); + go->_quadTree = child; + QuadTree* parent = child; + while (parent) { + parent->_size++; + if (parent->IsEmpty() || !parent->_boundingBox.isEmpty()) + parent->_boundingBox.merge(boundingBox); + parent = parent->_parent; + } + if (QUAD_TREE_EXPLODE_THRESHOLD <= child->_size) + child->_Explode(); + } } void QuadTree::Remove(Go* go) // ************************** { - if (!go) - throw Error("Can't remove go : null go"); + if (!go) + throw Error("Can't remove go : null go"); - if (go->IsMaterialized()) { - Box boundingBox = go->GetBoundingBox(); - QuadTree* child = go->_quadTree; - child->_goSet._Remove(go); - go->_quadTree = NULL; - QuadTree* parent = child; - while (parent) { - parent->_size--; - if (parent->_boundingBox.IsConstrainedBy(boundingBox)) - parent->_boundingBox = Box(); - parent = parent->_parent; - } - parent = child; - while (parent) { - if (!(parent->_size <= QUAD_TREE_IMPLODE_THRESHOLD)) - break; - parent->_Implode(); - parent = parent->_parent; - } - } + if (go->IsMaterialized()) { + Box boundingBox = go->GetBoundingBox(); + QuadTree* child = go->_quadTree; + child->_goSet._Remove(go); + go->_quadTree = NULL; + QuadTree* parent = child; + while (parent) { + parent->_size--; + if (parent->_boundingBox.isConstrainedBy(boundingBox)) + parent->_boundingBox = Box(); + parent = parent->_parent; + } + parent = child; + while (parent) { + if (!(parent->_size <= QUAD_TREE_IMPLODE_THRESHOLD)) + break; + parent->_Implode(); + parent = parent->_parent; + } + } } string QuadTree::_GetString() const // ******************************** { - string s = "<" + _TName("QuadTree"); - if (!_size) - s += " empty"; - else - s += " " + GetString(_size); - s += ">"; - return s; + string s = "<" + _TName("QuadTree"); + if (!_size) + s += " empty"; + else + s += " " + GetString(_size); + s += ">"; + return s; } Record* QuadTree::_GetRecord() const // *************************** { - Record* record = NULL; - if (_size) { - record = new Record(GetString(this)); - record->Add(GetSlot("Parent", _parent)); - record->Add(GetSlot("X", &_x)); - record->Add(GetSlot("Y", &_y)); - record->Add(GetSlot("BoundingBox", &_boundingBox)); - record->Add(GetSlot("Size", &_size)); - record->Add(GetSlot("Gos", &_goSet)); - record->Add(GetSlot("ULChild", _ulChild)); - record->Add(GetSlot("URChild", _urChild)); - record->Add(GetSlot("LLChild", _llChild)); - record->Add(GetSlot("LRChild", _lrChild)); - } - return record; + Record* record = NULL; + if (_size) { + record = new Record(GetString(this)); + record->Add(GetSlot("Parent", _parent)); + record->Add(GetSlot("X", &_x)); + record->Add(GetSlot("Y", &_y)); + record->Add(GetSlot("BoundingBox", &_boundingBox)); + record->Add(GetSlot("Size", &_size)); + record->Add(GetSlot("Gos", &_goSet)); + record->Add(GetSlot("ULChild", _ulChild)); + record->Add(GetSlot("URChild", _urChild)); + record->Add(GetSlot("LLChild", _llChild)); + record->Add(GetSlot("LRChild", _lrChild)); + } + return record; } QuadTree* QuadTree::_GetDeepestChild(const Box& box) // ************************************************ { - if (_HasBeenExploded()) { - if (box.GetXMax() < _x) { - if (box.GetYMax() < _y) - return _llChild->_GetDeepestChild(box); - if (_y < box.GetYMin()) - return _ulChild->_GetDeepestChild(box); - } - if (_x < box.GetXMin()) { - if (box.GetYMax() < _y) - return _lrChild->_GetDeepestChild(box); - if (_y < box.GetYMin()) - return _urChild->_GetDeepestChild(box); - } - } - return this; + if (_HasBeenExploded()) { + if (box.getXMax() < _x) { + if (box.getYMax() < _y) + return _llChild->_GetDeepestChild(box); + if (_y < box.getYMin()) + return _ulChild->_GetDeepestChild(box); + } + if (_x < box.getXMin()) { + if (box.getYMax() < _y) + return _lrChild->_GetDeepestChild(box); + if (_y < box.getYMin()) + return _urChild->_GetDeepestChild(box); + } + } + return this; } QuadTree* QuadTree::_GetFirstQuadTree() const // ****************************************** { - if (!_goSet.IsEmpty()) return (QuadTree*)this; - QuadTree* quadTree = NULL; - if (_HasBeenExploded()) { - if (!quadTree) quadTree = _ulChild->_GetFirstQuadTree(); - if (!quadTree) quadTree = _urChild->_GetFirstQuadTree(); - if (!quadTree) quadTree = _llChild->_GetFirstQuadTree(); - if (!quadTree) quadTree = _lrChild->_GetFirstQuadTree(); - } - return quadTree; + if (!_goSet.IsEmpty()) return (QuadTree*)this; + QuadTree* quadTree = NULL; + if (_HasBeenExploded()) { + if (!quadTree) quadTree = _ulChild->_GetFirstQuadTree(); + if (!quadTree) quadTree = _urChild->_GetFirstQuadTree(); + if (!quadTree) quadTree = _llChild->_GetFirstQuadTree(); + if (!quadTree) quadTree = _lrChild->_GetFirstQuadTree(); + } + return quadTree; } QuadTree* QuadTree::_GetFirstQuadTree(const Box& area) const // ********************************************************* { - if (GetBoundingBox().Intersect(area)) { - if (!_goSet.IsEmpty()) return (QuadTree*)this; - QuadTree* quadTree = NULL; - if (_HasBeenExploded()) { - if (!quadTree) quadTree = _ulChild->_GetFirstQuadTree(area); - if (!quadTree) quadTree = _urChild->_GetFirstQuadTree(area); - if (!quadTree) quadTree = _llChild->_GetFirstQuadTree(area); - if (!quadTree) quadTree = _lrChild->_GetFirstQuadTree(area); - } - return quadTree; - } - return NULL; + if (GetBoundingBox().intersect(area)) { + if (!_goSet.IsEmpty()) return (QuadTree*)this; + QuadTree* quadTree = NULL; + if (_HasBeenExploded()) { + if (!quadTree) quadTree = _ulChild->_GetFirstQuadTree(area); + if (!quadTree) quadTree = _urChild->_GetFirstQuadTree(area); + if (!quadTree) quadTree = _llChild->_GetFirstQuadTree(area); + if (!quadTree) quadTree = _lrChild->_GetFirstQuadTree(area); + } + return quadTree; + } + return NULL; } QuadTree* QuadTree::_GetNextQuadTree() // *********************************** { - QuadTree* nextQuadTree = NULL; - if (_HasBeenExploded()) { - if (!nextQuadTree) nextQuadTree = _ulChild->_GetFirstQuadTree(); - if (!nextQuadTree) nextQuadTree = _urChild->_GetFirstQuadTree(); - if (!nextQuadTree) nextQuadTree = _llChild->_GetFirstQuadTree(); - if (!nextQuadTree) nextQuadTree = _lrChild->_GetFirstQuadTree(); - } - QuadTree* quadTree = this; - while (!nextQuadTree && quadTree->_parent) { - if (quadTree->_parent->_llChild == quadTree) - nextQuadTree = quadTree->_parent->_lrChild->_GetFirstQuadTree(); - else if (quadTree->_parent->_urChild == quadTree) { - nextQuadTree = quadTree->_parent->_llChild->_GetFirstQuadTree(); - if (!nextQuadTree) - nextQuadTree = quadTree->_parent->_lrChild->_GetFirstQuadTree(); - } - else if (quadTree->_parent->_ulChild == quadTree) { - nextQuadTree = quadTree->_parent->_urChild->_GetFirstQuadTree(); - if (!nextQuadTree) - nextQuadTree = quadTree->_parent->_llChild->_GetFirstQuadTree(); - if (!nextQuadTree) - nextQuadTree = quadTree->_parent->_lrChild->_GetFirstQuadTree(); - } - quadTree = quadTree->_parent; - } - return nextQuadTree; + QuadTree* nextQuadTree = NULL; + if (_HasBeenExploded()) { + if (!nextQuadTree) nextQuadTree = _ulChild->_GetFirstQuadTree(); + if (!nextQuadTree) nextQuadTree = _urChild->_GetFirstQuadTree(); + if (!nextQuadTree) nextQuadTree = _llChild->_GetFirstQuadTree(); + if (!nextQuadTree) nextQuadTree = _lrChild->_GetFirstQuadTree(); + } + QuadTree* quadTree = this; + while (!nextQuadTree && quadTree->_parent) { + if (quadTree->_parent->_llChild == quadTree) + nextQuadTree = quadTree->_parent->_lrChild->_GetFirstQuadTree(); + else if (quadTree->_parent->_urChild == quadTree) { + nextQuadTree = quadTree->_parent->_llChild->_GetFirstQuadTree(); + if (!nextQuadTree) + nextQuadTree = quadTree->_parent->_lrChild->_GetFirstQuadTree(); + } + else if (quadTree->_parent->_ulChild == quadTree) { + nextQuadTree = quadTree->_parent->_urChild->_GetFirstQuadTree(); + if (!nextQuadTree) + nextQuadTree = quadTree->_parent->_llChild->_GetFirstQuadTree(); + if (!nextQuadTree) + nextQuadTree = quadTree->_parent->_lrChild->_GetFirstQuadTree(); + } + quadTree = quadTree->_parent; + } + return nextQuadTree; } QuadTree* QuadTree::_GetNextQuadTree(const Box& area) // ************************************************** { - QuadTree* nextQuadTree = NULL; - if (_HasBeenExploded()) { - if (!nextQuadTree) nextQuadTree = _ulChild->_GetFirstQuadTree(area); - if (!nextQuadTree) nextQuadTree = _urChild->_GetFirstQuadTree(area); - if (!nextQuadTree) nextQuadTree = _llChild->_GetFirstQuadTree(area); - if (!nextQuadTree) nextQuadTree = _lrChild->_GetFirstQuadTree(area); - } - QuadTree* quadTree = this; - while (!nextQuadTree && quadTree->_parent) { - if (quadTree->_parent->_llChild == quadTree) - nextQuadTree = quadTree->_parent->_lrChild->_GetFirstQuadTree(area); - else if (quadTree->_parent->_urChild == quadTree) { - nextQuadTree = quadTree->_parent->_llChild->_GetFirstQuadTree(area); - if (!nextQuadTree) - nextQuadTree = quadTree->_parent->_lrChild->_GetFirstQuadTree(area); - } - else if (quadTree->_parent->_ulChild == quadTree) { - nextQuadTree = quadTree->_parent->_urChild->_GetFirstQuadTree(area); - if (!nextQuadTree) - nextQuadTree = quadTree->_parent->_llChild->_GetFirstQuadTree(area); - if (!nextQuadTree) - nextQuadTree = quadTree->_parent->_lrChild->_GetFirstQuadTree(area); - } - quadTree = quadTree->_parent; - } - return nextQuadTree; + QuadTree* nextQuadTree = NULL; + if (_HasBeenExploded()) { + if (!nextQuadTree) nextQuadTree = _ulChild->_GetFirstQuadTree(area); + if (!nextQuadTree) nextQuadTree = _urChild->_GetFirstQuadTree(area); + if (!nextQuadTree) nextQuadTree = _llChild->_GetFirstQuadTree(area); + if (!nextQuadTree) nextQuadTree = _lrChild->_GetFirstQuadTree(area); + } + QuadTree* quadTree = this; + while (!nextQuadTree && quadTree->_parent) { + if (quadTree->_parent->_llChild == quadTree) + nextQuadTree = quadTree->_parent->_lrChild->_GetFirstQuadTree(area); + else if (quadTree->_parent->_urChild == quadTree) { + nextQuadTree = quadTree->_parent->_llChild->_GetFirstQuadTree(area); + if (!nextQuadTree) + nextQuadTree = quadTree->_parent->_lrChild->_GetFirstQuadTree(area); + } + else if (quadTree->_parent->_ulChild == quadTree) { + nextQuadTree = quadTree->_parent->_urChild->_GetFirstQuadTree(area); + if (!nextQuadTree) + nextQuadTree = quadTree->_parent->_llChild->_GetFirstQuadTree(area); + if (!nextQuadTree) + nextQuadTree = quadTree->_parent->_lrChild->_GetFirstQuadTree(area); + } + quadTree = quadTree->_parent; + } + return nextQuadTree; } void QuadTree::_Explode() // ********************** { - if (!_HasBeenExploded()) { - _x = GetBoundingBox().GetXCenter(); - _y = GetBoundingBox().GetYCenter(); - _ulChild = new QuadTree(this); - _urChild = new QuadTree(this); - _llChild = new QuadTree(this); - _lrChild = new QuadTree(this); - set goSet; - for_each_go(go, _goSet.GetElements()) { - _goSet._Remove(go); - go->_quadTree = NULL; - goSet.insert(go); - end_for; - } - for_each_go(go, GetCollection(goSet)) { - QuadTree* child = _GetDeepestChild(go->GetBoundingBox()); - child->_goSet._Insert(go); - go->_quadTree = child; - if (child != this) child->_size++; - end_for; - } - } + if (!_HasBeenExploded()) { + _x = GetBoundingBox().getXCenter(); + _y = GetBoundingBox().getYCenter(); + _ulChild = new QuadTree(this); + _urChild = new QuadTree(this); + _llChild = new QuadTree(this); + _lrChild = new QuadTree(this); + set goSet; + for_each_go(go, _goSet.GetElements()) { + _goSet._Remove(go); + go->_quadTree = NULL; + goSet.insert(go); + end_for; + } + for_each_go(go, GetCollection(goSet)) { + QuadTree* child = _GetDeepestChild(go->GetBoundingBox()); + child->_goSet._Insert(go); + go->_quadTree = child; + if (child != this) child->_size++; + end_for; + } + } } void QuadTree::_Implode() // ********************** { - if (_HasBeenExploded()) { - if (_ulChild->_HasBeenExploded()) _ulChild->_Implode(); - for_each_go(go, _ulChild->_goSet.GetElements()) { - _ulChild->_goSet._Remove(go); - _goSet._Insert(go); - go->_quadTree = this; - end_for; - } - delete _ulChild; - _ulChild = NULL; - if (_urChild->_HasBeenExploded()) _urChild->_Implode(); - for_each_go(go, _urChild->_goSet.GetElements()) { - _urChild->_goSet._Remove(go); - _goSet._Insert(go); - go->_quadTree = this; - end_for; - } - delete _urChild; - _urChild = NULL; - if (_llChild->_HasBeenExploded()) _llChild->_Implode(); - for_each_go(go, _llChild->_goSet.GetElements()) { - _llChild->_goSet._Remove(go); - _goSet._Insert(go); - go->_quadTree = this; - end_for; - } - delete _llChild; - _llChild = NULL; - if (_lrChild->_HasBeenExploded()) _lrChild->_Implode(); - for_each_go(go, _lrChild->_goSet.GetElements()) { - _lrChild->_goSet._Remove(go); - _goSet._Insert(go); - go->_quadTree = this; - end_for; - } - delete _lrChild; - _lrChild = NULL; - } + if (_HasBeenExploded()) { + if (_ulChild->_HasBeenExploded()) _ulChild->_Implode(); + for_each_go(go, _ulChild->_goSet.GetElements()) { + _ulChild->_goSet._Remove(go); + _goSet._Insert(go); + go->_quadTree = this; + end_for; + } + delete _ulChild; + _ulChild = NULL; + if (_urChild->_HasBeenExploded()) _urChild->_Implode(); + for_each_go(go, _urChild->_goSet.GetElements()) { + _urChild->_goSet._Remove(go); + _goSet._Insert(go); + go->_quadTree = this; + end_for; + } + delete _urChild; + _urChild = NULL; + if (_llChild->_HasBeenExploded()) _llChild->_Implode(); + for_each_go(go, _llChild->_goSet.GetElements()) { + _llChild->_goSet._Remove(go); + _goSet._Insert(go); + go->_quadTree = this; + end_for; + } + delete _llChild; + _llChild = NULL; + if (_lrChild->_HasBeenExploded()) _lrChild->_Implode(); + for_each_go(go, _lrChild->_goSet.GetElements()) { + _lrChild->_goSet._Remove(go); + _goSet._Insert(go); + go->_quadTree = this; + end_for; + } + delete _lrChild; + _lrChild = NULL; + } } @@ -507,26 +507,26 @@ void QuadTree::_Implode() QuadTree::GoSet::GoSet() // ********************* -: Inherit() +: Inherit() { } unsigned QuadTree::GoSet::_GetHashValue(Go* go) const // ************************************************** { - return ( (unsigned int)( (unsigned long)go ) ) / 8; + return ( (unsigned int)( (unsigned long)go ) ) / 8; } Go* QuadTree::GoSet::_GetNextElement(Go* go) const // *********************************************** { - return go->_GetNextOfQuadTreeGoSet(); + return go->_GetNextOfQuadTreeGoSet(); } void QuadTree::GoSet::_SetNextElement(Go* go, Go* nextGo) const // ************************************************************ { - go->_SetNextOfQuadTreeGoSet(nextGo); + go->_SetNextOfQuadTreeGoSet(nextGo); } @@ -537,44 +537,44 @@ void QuadTree::GoSet::_SetNextElement(Go* go, Go* nextGo) const QuadTree_Gos::QuadTree_Gos(const QuadTree* quadTree) // ************************************************* -: Inherit(), - _quadTree(quadTree) +: Inherit(), + _quadTree(quadTree) { } QuadTree_Gos::QuadTree_Gos(const QuadTree_Gos& gos) // ************************************************ -: Inherit(), - _quadTree(gos._quadTree) +: Inherit(), + _quadTree(gos._quadTree) { } QuadTree_Gos& QuadTree_Gos::operator=(const QuadTree_Gos& gos) // *********************************************************** { - _quadTree = gos._quadTree; - return *this; + _quadTree = gos._quadTree; + return *this; } Collection* QuadTree_Gos::GetClone() const // ******************************************** { - return new QuadTree_Gos(*this); + return new QuadTree_Gos(*this); } Locator* QuadTree_Gos::GetLocator() const // ******************************************* { - return new Locator(_quadTree); + return new Locator(_quadTree); } string QuadTree_Gos::_GetString() const // ************************************ { - string s = "<" + _TName("QuadTree::Gos"); - if (_quadTree) s += " " + GetString(_quadTree); - s += ">"; - return s; + string s = "<" + _TName("QuadTree::Gos"); + if (_quadTree) s += " " + GetString(_quadTree); + s += ">"; + return s; } @@ -585,74 +585,74 @@ string QuadTree_Gos::_GetString() const QuadTree_Gos::Locator::Locator(const QuadTree* quadTree) // ***************************************************** -: Inherit(), - _quadTree(quadTree), - _currentQuadTree(NULL), - _goLocator() +: Inherit(), + _quadTree(quadTree), + _currentQuadTree(NULL), + _goLocator() { - if (_quadTree) { - _currentQuadTree = _quadTree->_GetFirstQuadTree(); - if (_currentQuadTree) - _goLocator = _currentQuadTree->_GetGoSet().GetElements().GetLocator(); - } + if (_quadTree) { + _currentQuadTree = _quadTree->_GetFirstQuadTree(); + if (_currentQuadTree) + _goLocator = _currentQuadTree->_GetGoSet().GetElements().GetLocator(); + } } QuadTree_Gos::Locator::Locator(const Locator& locator) // *************************************************** -: Inherit(), - _quadTree(locator._quadTree), - _currentQuadTree(locator._currentQuadTree), - _goLocator(locator._goLocator) +: Inherit(), + _quadTree(locator._quadTree), + _currentQuadTree(locator._currentQuadTree), + _goLocator(locator._goLocator) { } QuadTree_Gos::Locator& QuadTree_Gos::Locator::operator=(const Locator& locator) // **************************************************************************** { - _quadTree = locator._quadTree; - _currentQuadTree = locator._currentQuadTree; - _goLocator = locator._goLocator; - return *this; + _quadTree = locator._quadTree; + _currentQuadTree = locator._currentQuadTree; + _goLocator = locator._goLocator; + return *this; } Go* QuadTree_Gos::Locator::GetElement() const // ****************************************** { - return _goLocator.GetElement(); + return _goLocator.GetElement(); } Locator* QuadTree_Gos::Locator::GetClone() const // ************************************************** { - return new Locator(*this); + return new Locator(*this); } bool QuadTree_Gos::Locator::IsValid() const // **************************************** { - return _goLocator.IsValid(); + return _goLocator.IsValid(); } void QuadTree_Gos::Locator::Progress() // *********************************** { - if (IsValid()) { - _goLocator.Progress(); - if (!_goLocator.IsValid()) { - _currentQuadTree = _currentQuadTree->_GetNextQuadTree(); - if (_currentQuadTree) - _goLocator = _currentQuadTree->_GetGoSet().GetElements().GetLocator(); - } - } + if (IsValid()) { + _goLocator.Progress(); + if (!_goLocator.IsValid()) { + _currentQuadTree = _currentQuadTree->_GetNextQuadTree(); + if (_currentQuadTree) + _goLocator = _currentQuadTree->_GetGoSet().GetElements().GetLocator(); + } + } } string QuadTree_Gos::Locator::_GetString() const // ********************************************* { - string s = "<" + _TName("QuadTree::Gos::Locator"); - if (_quadTree) s += " " + GetString(_quadTree); - s += ">"; - return s; + string s = "<" + _TName("QuadTree::Gos::Locator"); + if (_quadTree) s += " " + GetString(_quadTree); + s += ">"; + return s; } @@ -663,58 +663,58 @@ string QuadTree_Gos::Locator::_GetString() const QuadTree_GosUnder::QuadTree_GosUnder() // *********************************** -: Inherit(), - _quadTree(NULL), - _area() +: Inherit(), + _quadTree(NULL), + _area() { } QuadTree_GosUnder::QuadTree_GosUnder(const QuadTree* quadTree, const Box& area) // **************************************************************************** -: Inherit(), - _quadTree(quadTree), - _area(area) +: Inherit(), + _quadTree(quadTree), + _area(area) { } QuadTree_GosUnder::QuadTree_GosUnder(const QuadTree_GosUnder& gos) // *************************************************************** -: Inherit(), - _quadTree(gos._quadTree), - _area(gos._area) +: Inherit(), + _quadTree(gos._quadTree), + _area(gos._area) { } QuadTree_GosUnder& QuadTree_GosUnder::operator=(const QuadTree_GosUnder& gos) // ************************************************************************** { - _quadTree = gos._quadTree; - _area = gos._area; - return *this; + _quadTree = gos._quadTree; + _area = gos._area; + return *this; } Collection* QuadTree_GosUnder::GetClone() const // ************************************************* { - return new QuadTree_GosUnder(*this); + return new QuadTree_GosUnder(*this); } Locator* QuadTree_GosUnder::GetLocator() const // ************************************************ { - return new Locator(_quadTree, _area); + return new Locator(_quadTree, _area); } string QuadTree_GosUnder::_GetString() const // ***************************************** { - string s = "<" + _TName("QuadTree::GosUnder"); - if (_quadTree) { - s += " " + GetString(_quadTree); - s += " " + GetString(_area); - } - s += ">"; - return s; + string s = "<" + _TName("QuadTree::GosUnder"); + if (_quadTree) { + s += " " + GetString(_quadTree); + s += " " + GetString(_area); + } + s += ">"; + return s; } @@ -725,94 +725,94 @@ string QuadTree_GosUnder::_GetString() const QuadTree_GosUnder::Locator::Locator() // ********************************** -: Inherit(), - _quadTree(NULL), - _area(), - _currentQuadTree(NULL), - _goLocator() +: Inherit(), + _quadTree(NULL), + _area(), + _currentQuadTree(NULL), + _goLocator() { } QuadTree_GosUnder::Locator::Locator(const QuadTree* quadTree, const Box& area) // *************************************************************************** -: Inherit(), - _quadTree(quadTree), - _area(area), - _currentQuadTree(NULL), - _goLocator() +: Inherit(), + _quadTree(quadTree), + _area(area), + _currentQuadTree(NULL), + _goLocator() { - if (_quadTree && !_area.IsEmpty()) { - _currentQuadTree = _quadTree->_GetFirstQuadTree(_area); - if (_currentQuadTree) { - _goLocator = _currentQuadTree->_GetGoSet().GetElements().GetLocator(); - if (!GetElement()->GetBoundingBox().Intersect(_area)) Progress(); - } - } + if (_quadTree && !_area.isEmpty()) { + _currentQuadTree = _quadTree->_GetFirstQuadTree(_area); + if (_currentQuadTree) { + _goLocator = _currentQuadTree->_GetGoSet().GetElements().GetLocator(); + if (!GetElement()->GetBoundingBox().intersect(_area)) Progress(); + } + } } QuadTree_GosUnder::Locator::Locator(const Locator& locator) // ******************************************************** -: Inherit(), - _quadTree(locator._quadTree), - _area(locator._area), - _currentQuadTree(locator._currentQuadTree), - _goLocator(locator._goLocator) +: Inherit(), + _quadTree(locator._quadTree), + _area(locator._area), + _currentQuadTree(locator._currentQuadTree), + _goLocator(locator._goLocator) { } QuadTree_GosUnder::Locator& QuadTree_GosUnder::Locator::operator=(const Locator& locator) // ************************************************************************************** { - _quadTree = locator._quadTree; - _area = locator._area; - _currentQuadTree = locator._currentQuadTree; - _goLocator = locator._goLocator; - return *this; + _quadTree = locator._quadTree; + _area = locator._area; + _currentQuadTree = locator._currentQuadTree; + _goLocator = locator._goLocator; + return *this; } Go* QuadTree_GosUnder::Locator::GetElement() const // *********************************************** { - return _goLocator.GetElement(); + return _goLocator.GetElement(); } Locator* QuadTree_GosUnder::Locator::GetClone() const // ******************************************************* { - return new Locator(*this); + return new Locator(*this); } bool QuadTree_GosUnder::Locator::IsValid() const // ********************************************* { - return _goLocator.IsValid(); + return _goLocator.IsValid(); } void QuadTree_GosUnder::Locator::Progress() // **************************************** { - if (IsValid()) { - do { - _goLocator.Progress(); - if (!_goLocator.IsValid()) { - _currentQuadTree = _currentQuadTree->_GetNextQuadTree(_area); - if (_currentQuadTree) - _goLocator = _currentQuadTree->_GetGoSet().GetElements().GetLocator(); - } - } while (IsValid() && !GetElement()->GetBoundingBox().Intersect(_area)); - } + if (IsValid()) { + do { + _goLocator.Progress(); + if (!_goLocator.IsValid()) { + _currentQuadTree = _currentQuadTree->_GetNextQuadTree(_area); + if (_currentQuadTree) + _goLocator = _currentQuadTree->_GetGoSet().GetElements().GetLocator(); + } + } while (IsValid() && !GetElement()->GetBoundingBox().intersect(_area)); + } } string QuadTree_GosUnder::Locator::_GetString() const // ************************************************** { - string s = "<" + _TName("QuadTree::GosUnder::Locator"); - if (_quadTree) { - s += " " + GetString(_quadTree); - s += " " + GetString(_area); - } - s += ">"; - return s; + string s = "<" + _TName("QuadTree::GosUnder::Locator"); + if (_quadTree) { + s += " " + GetString(_quadTree); + s += " " + GetString(_area); + } + s += ">"; + return s; } diff --git a/hurricane/src/hurricane/Reference.cpp b/hurricane/src/hurricane/Reference.cpp index 228a4049..bd1a4d98 100644 --- a/hurricane/src/hurricane/Reference.cpp +++ b/hurricane/src/hurricane/Reference.cpp @@ -49,13 +49,13 @@ Reference* Reference::Create(Cell* cell, const Name& name, Unit x, Unit y) Reference* Reference::Create(Cell* cell, const Name& name, const Point& point) // *************************************************************************** { - return Create(cell,name,point.GetX(),point.GetY()); + return Create(cell,name,point.getX(),point.getY()); } Box Reference::GetBoundingBox() const // *********************************** { - return Box(_point).Inflate(_extend); + return Box(_point).inflate(_extend); } void Reference::Translate(const Unit& dx, const Unit& dy) @@ -63,7 +63,7 @@ void Reference::Translate(const Unit& dx, const Unit& dy) { if ((dx != 0) || (dy != 0)) { Invalidate(false); - _point.Translate(dx, dy); + _point.translate(dx, dy); } } diff --git a/hurricane/src/hurricane/Region.cpp b/hurricane/src/hurricane/Region.cpp index d9bd812a..a0053df9 100644 --- a/hurricane/src/hurricane/Region.cpp +++ b/hurricane/src/hurricane/Region.cpp @@ -20,8 +20,8 @@ void DblSupply_Stop(const Region& region, const string msg, const Box selBox, co #endif #if DEBUG_REGION // Calling sequence - string msg = "Region::GetIntersection avant Groove"; - DblSupply_Stop(region, msg, box, -10); + string msg = "Region::GetIntersection avant Groove"; + DblSupply_Stop(region, msg, box, -10); #endif @@ -31,122 +31,122 @@ void DblSupply_Stop(const Region& region, const string msg, const Box selBox, co class Region_Tile { // ************** - + // Types // ***** - - public: class IsVoidFilter : public Filter { - // ***************************************************** + + public: class IsVoidFilter : public Filter { + // ***************************************************** - public: IsVoidFilter(); + public: IsVoidFilter(); - public: IsVoidFilter(const IsVoidFilter& filter); + public: IsVoidFilter(const IsVoidFilter& filter); - public: IsVoidFilter& operator=(const IsVoidFilter& filter); + public: IsVoidFilter& operator=(const IsVoidFilter& filter); - public: virtual Filter* GetClone() const; + public: virtual Filter* GetClone() const; - public: virtual bool Accept(Region_Tile* tile) const; + public: virtual bool Accept(Region_Tile* tile) const; - public: virtual string _GetString() const; + public: virtual string _GetString() const; - }; + }; // Attributes // ********** - - public: Box _boundingBox; - public: bool _isVoid; - public: Region_Tile* _leftTile; - public: Region_Tile* _bottomTile; - public: Region_Tile* _topTile; - public: Region_Tile* _rightTile; + + public: Box _boundingBox; + public: bool _isVoid; + public: Region_Tile* _leftTile; + public: Region_Tile* _bottomTile; + public: Region_Tile* _topTile; + public: Region_Tile* _rightTile; // Constructors // ************ - public: Region_Tile(const Box& boundingBox, bool isVoid = false); + public: Region_Tile(const Box& boundingBox, bool isVoid = false); - private: Region_Tile(const Region_Tile& tile); // not implemented to forbid copy + private: Region_Tile(const Region_Tile& tile); // not implemented to forbid copy // Destructor // ********** - public: ~Region_Tile(); + public: ~Region_Tile(); // Operators // ********* - private: Region_Tile& operator=(const Region_Tile& tile); // not implemented to forbid assignment + private: Region_Tile& operator=(const Region_Tile& tile); // not implemented to forbid assignment // Accessors // ********* - public: const Box& GetBoundingBox() const {return _boundingBox;}; + public: const Box& GetBoundingBox() const {return _boundingBox;}; - public: const Unit& GetXMin() const {return _boundingBox.GetXMin();}; - public: const Unit& GetYMin() const {return _boundingBox.GetYMin();}; - public: const Unit& GetXMax() const {return _boundingBox.GetXMax();}; - public: const Unit& GetYMax() const {return _boundingBox.GetYMax();}; + public: const Unit& GetXMin() const {return _boundingBox.getXMin();}; + public: const Unit& GetYMin() const {return _boundingBox.getYMin();}; + public: const Unit& GetXMax() const {return _boundingBox.getXMax();}; + public: const Unit& GetYMax() const {return _boundingBox.getYMax();}; - public: Region_Tile* GetTileAt(const Point& point) const; - public: Region_Tile* GetNonVoidTileAt(const Point& point) const; + public: Region_Tile* GetTileAt(const Point& point) const; + public: Region_Tile* GetNonVoidTileAt(const Point& point) const; - public: Region_Tile* GetLeftTile(const Unit& y) const; - public: Region_Tile* GetBottomTile(const Unit& x) const; - public: Region_Tile* GetTopTile(const Unit& x) const; - public: Region_Tile* GetRightTile(const Unit& y) const; + public: Region_Tile* GetLeftTile(const Unit& y) const; + public: Region_Tile* GetBottomTile(const Unit& x) const; + public: Region_Tile* GetTopTile(const Unit& x) const; + public: Region_Tile* GetRightTile(const Unit& y) const; // Filters // ******* - public: static GenericFilter GetIsVoidFilter(); + public: static GenericFilter GetIsVoidFilter(); // Predicates // ********** - public: bool IsVoid() const {return _isVoid;}; - public: bool Contains(const Point& point) const; + public: bool IsVoid() const {return _isVoid;}; + public: bool contains(const Point& point) const; // Updators // ******** - public: void SplitVertical(Region* region, const Unit& x); - public: void SplitHorizontal(Region* region, const Unit& y); - public: bool MergeLeftTile(Region* region); - public: bool MergeBottomTile(Region* region); - public: bool MergeTopTile(Region* region); - public: bool MergeRightTile(Region* region); - public: void MergeNeighbours(Region* region); - public: void CleanNeighbours(Region* region); - public: bool VerticalEnhancement(Region* region); - public: bool HorizontalEnhancement(Region* region); + public: void SplitVertical(Region* region, const Unit& x); + public: void SplitHorizontal(Region* region, const Unit& y); + public: bool MergeLeftTile(Region* region); + public: bool MergeBottomTile(Region* region); + public: bool MergeTopTile(Region* region); + public: bool MergeRightTile(Region* region); + public: void MergeNeighbours(Region* region); + public: void CleanNeighbours(Region* region); + public: bool VerticalEnhancement(Region* region); + public: bool HorizontalEnhancement(Region* region); // Others // ****** public: string _GetTypeName() const { return _TName("Region_Tile"); }; - public: string _GetString() const; - public: Record* _GetRecord() const; + public: string _GetString() const; + public: Record* _GetRecord() const; - private: bool _IsTopFull() const; - private: bool _IsBottomFull() const; - private: bool _IsLeftFull() const; - private: bool _IsRightFull() const; - private: Unit _TopSplitAtVerticalSize (Region* region); - private: Unit _BottomSplitAtVerticalSize (Region* region); - private: Unit _LeftSplitAtHorizontalSize (Region* region); - private: Unit _RightSplitAtHorizontalSize (Region* region); - private: bool _TopSplitAtHorizontalSize (Region* region, const Unit height); - private: bool _BottomSplitAtHorizontalSize (Region* region, const Unit height); - private: bool _LeftSplitAtVerticalSize (Region* region, const Unit width); - private: bool _RightSplitAtVerticalSize (Region* region, const Unit width); + private: bool _IsTopFull() const; + private: bool _IsBottomFull() const; + private: bool _IsLeftFull() const; + private: bool _IsRightFull() const; + private: Unit _TopSplitAtVerticalSize (Region* region); + private: Unit _BottomSplitAtVerticalSize (Region* region); + private: Unit _LeftSplitAtHorizontalSize (Region* region); + private: Unit _RightSplitAtHorizontalSize (Region* region); + private: bool _TopSplitAtHorizontalSize (Region* region, const Unit height); + private: bool _BottomSplitAtHorizontalSize (Region* region, const Unit height); + private: bool _LeftSplitAtVerticalSize (Region* region, const Unit width); + private: bool _RightSplitAtVerticalSize (Region* region, const Unit width); - public: Interval _GetTopNeighbour () const; - public: Interval _GetBottomNeighbour () const; - public: Interval _GetLeftNeighbour () const; - public: Interval _GetRightNeighbour () const; -}; // class Region_Tile + public: Interval _GetTopNeighbour () const; + public: Interval _GetBottomNeighbour () const; + public: Interval _GetLeftNeighbour () const; + public: Interval _GetRightNeighbour () const; +}; // class Region_Tile @@ -156,15 +156,15 @@ class Region_Tile { Region_Tile::Region_Tile(const Box& boundingBox, bool isVoid) // ********************************************************** -: _boundingBox(boundingBox), - _isVoid(isVoid), - _leftTile(NULL), - _bottomTile(NULL), - _topTile(NULL), - _rightTile(NULL) +: _boundingBox(boundingBox), + _isVoid(isVoid), + _leftTile(NULL), + _bottomTile(NULL), + _topTile(NULL), + _rightTile(NULL) { - if (boundingBox.IsEmpty()) - throw Error("Can't create " + _TName("Region::Tile") + " : empty bounding box"); + if (boundingBox.isEmpty()) + throw Error("Can't create " + _TName("Region::Tile") + " : empty bounding box"); } Region_Tile::~Region_Tile() @@ -172,394 +172,394 @@ Region_Tile::~Region_Tile() { } -bool Region_Tile::Contains(const Point& point) const +bool Region_Tile::contains(const Point& point) const // ************************************************* { - return ((GetXMin() <= point.GetX()) && - (GetYMin() <= point.GetY()) && - ((point.GetX() < GetXMax()) || (!_rightTile && (point.GetX() == GetXMax()))) && - ((point.GetY() < GetYMax()) || (!_topTile && (point.GetY() == GetYMax())))); + return ((GetXMin() <= point.getX()) && + (GetYMin() <= point.getY()) && + ((point.getX() < GetXMax()) || (!_rightTile && (point.getX() == GetXMax()))) && + ((point.getY() < GetYMax()) || (!_topTile && (point.getY() == GetYMax())))); } Region_Tile* Region_Tile::GetTileAt(const Point& point) const // ********************************************************** { - if (Contains(point)) return (Region_Tile*)this; + if (contains(point)) return (Region_Tile*)this; - if (_topTile && (GetYMax() <= point.GetY())) return _topTile->GetTileAt(point); + if (_topTile && (GetYMax() <= point.getY())) return _topTile->GetTileAt(point); - if (_leftTile && (point.GetX() < GetXMin())) return _leftTile->GetTileAt(point); + if (_leftTile && (point.getX() < GetXMin())) return _leftTile->GetTileAt(point); - return NULL; + return NULL; } Region_Tile* Region_Tile::GetNonVoidTileAt(const Point& point) const // ***************************************************************** { - if (Contains(point)) { - if (!_isVoid) return (Region_Tile*)this; - if ((GetXMin() < point.GetX()) && (GetYMin() < point.GetY())) return NULL; - } + if (contains(point)) { + if (!_isVoid) return (Region_Tile*)this; + if ((GetXMin() < point.getX()) && (GetYMin() < point.getY())) return NULL; + } - if (_topTile && (GetYMax() <= point.GetY())) return _topTile->GetNonVoidTileAt(point); + if (_topTile && (GetYMax() <= point.getY())) return _topTile->GetNonVoidTileAt(point); - if (_leftTile && (point.GetX() <= GetXMin())) return _leftTile->GetNonVoidTileAt(point); + if (_leftTile && (point.getX() <= GetXMin())) return _leftTile->GetNonVoidTileAt(point); - return NULL; + return NULL; } Region_Tile* Region_Tile::GetLeftTile(const Unit& y) const // ******************************************************* { - Region_Tile* tile = _leftTile; - while (tile && (tile->GetYMax() <= y)) tile = tile->_topTile; - return tile; + Region_Tile* tile = _leftTile; + while (tile && (tile->GetYMax() <= y)) tile = tile->_topTile; + return tile; } Region_Tile* Region_Tile::GetBottomTile(const Unit& x) const // ********************************************************* { - Region_Tile* tile = _bottomTile; - while (tile && (tile->GetXMax() <= x)) tile = tile->_rightTile; - return tile; + Region_Tile* tile = _bottomTile; + while (tile && (tile->GetXMax() <= x)) tile = tile->_rightTile; + return tile; } Region_Tile* Region_Tile::GetTopTile(const Unit& x) const // ****************************************************** { - Region_Tile* tile = _topTile; - while (tile && (x < tile->GetXMin())) tile = tile->_leftTile; - return tile; + Region_Tile* tile = _topTile; + while (tile && (x < tile->GetXMin())) tile = tile->_leftTile; + return tile; } Region_Tile* Region_Tile::GetRightTile(const Unit& y) const // ******************************************************** { - Region_Tile* tile = _rightTile; - while (tile && (y < tile->GetYMin())) tile = tile->_bottomTile; - return tile; + Region_Tile* tile = _rightTile; + while (tile && (y < tile->GetYMin())) tile = tile->_bottomTile; + return tile; } GenericFilter Region_Tile::GetIsVoidFilter() // ******************************************************* { - return Region_Tile::IsVoidFilter(); + return Region_Tile::IsVoidFilter(); } void Region_Tile::SplitVertical(Region* region, const Unit& x) // *********************************************************** { - if ((GetXMin() < x) && (x < GetXMax())) { - Region_Tile* newTile = new Region_Tile(Box(x, GetYMin(), GetXMax(), GetYMax()), IsVoid()); + if ((GetXMin() < x) && (x < GetXMax())) { + Region_Tile* newTile = new Region_Tile(Box(x, GetYMin(), GetXMax(), GetYMax()), IsVoid()); - newTile->_leftTile = this; - newTile->_rightTile = _rightTile; - if (_rightTile) { - Region_Tile* tile = _rightTile; - while (tile && (tile->_leftTile == this)) { - tile->_leftTile = newTile; - tile = tile->_bottomTile; - } - } - _rightTile = newTile; + newTile->_leftTile = this; + newTile->_rightTile = _rightTile; + if (_rightTile) { + Region_Tile* tile = _rightTile; + while (tile && (tile->_leftTile == this)) { + tile->_leftTile = newTile; + tile = tile->_bottomTile; + } + } + _rightTile = newTile; - Region_Tile* tile = _bottomTile; - while (tile && (tile->_topTile == this)) { - if (x < tile->GetXMax()) tile->_topTile = newTile; - tile = tile->_rightTile; - } - if (_bottomTile) { - newTile->_bottomTile = _bottomTile; - while (newTile->_bottomTile->GetXMax() <= newTile->GetXMin()) - newTile->_bottomTile = newTile->_bottomTile->_rightTile; - } + Region_Tile* tile = _bottomTile; + while (tile && (tile->_topTile == this)) { + if (x < tile->GetXMax()) tile->_topTile = newTile; + tile = tile->_rightTile; + } + if (_bottomTile) { + newTile->_bottomTile = _bottomTile; + while (newTile->_bottomTile->GetXMax() <= newTile->GetXMin()) + newTile->_bottomTile = newTile->_bottomTile->_rightTile; + } - newTile->_topTile = _topTile; - while (_topTile && (_topTile->_bottomTile == this)) { - if (_topTile->GetXMin() < x) break; - _topTile->_bottomTile = newTile; - _topTile = _topTile->_leftTile; - } + newTile->_topTile = _topTile; + while (_topTile && (_topTile->_bottomTile == this)) { + if (_topTile->GetXMin() < x) break; + _topTile->_bottomTile = newTile; + _topTile = _topTile->_leftTile; + } - _boundingBox = Box(GetXMin(), GetYMin(), x, GetYMax()); + _boundingBox = Box(GetXMin(), GetYMin(), x, GetYMax()); - if (region->_GetBottomRightTile() == this) region->_SetBottomRightTile(newTile); - } + if (region->_GetBottomRightTile() == this) region->_SetBottomRightTile(newTile); + } } void Region_Tile::SplitHorizontal(Region* region, const Unit& y) // ************************************************************* { - if ((GetYMin() < y) && (y < GetYMax())) { - Region_Tile* newTile = new Region_Tile(Box(GetXMin(), y, GetXMax(), GetYMax()), IsVoid()); + if ((GetYMin() < y) && (y < GetYMax())) { + Region_Tile* newTile = new Region_Tile(Box(GetXMin(), y, GetXMax(), GetYMax()), IsVoid()); - newTile->_bottomTile = this; - newTile->_topTile = _topTile; - if (_topTile) { - Region_Tile* tile = _topTile; - while (tile && (tile->_bottomTile == this)) { - tile->_bottomTile = newTile; - tile = tile->_leftTile; - } - } - _topTile = newTile; + newTile->_bottomTile = this; + newTile->_topTile = _topTile; + if (_topTile) { + Region_Tile* tile = _topTile; + while (tile && (tile->_bottomTile == this)) { + tile->_bottomTile = newTile; + tile = tile->_leftTile; + } + } + _topTile = newTile; - Region_Tile* tile = _leftTile; - while (tile && (tile->_rightTile == this)) { - if (y < tile->GetYMax()) tile->_rightTile = newTile; - tile = tile->_topTile; - } - if (_leftTile) { - newTile->_leftTile = _leftTile; - while (newTile->_leftTile->GetYMax() <= newTile->GetYMin()) - newTile->_leftTile = newTile->_leftTile->_topTile; - } + Region_Tile* tile = _leftTile; + while (tile && (tile->_rightTile == this)) { + if (y < tile->GetYMax()) tile->_rightTile = newTile; + tile = tile->_topTile; + } + if (_leftTile) { + newTile->_leftTile = _leftTile; + while (newTile->_leftTile->GetYMax() <= newTile->GetYMin()) + newTile->_leftTile = newTile->_leftTile->_topTile; + } - newTile->_rightTile = _rightTile; - while (_rightTile && (_rightTile->_leftTile == this)) { - if (_rightTile->GetYMin() < y) break; - _rightTile->_leftTile = newTile; - _rightTile = _rightTile->_bottomTile; - } + newTile->_rightTile = _rightTile; + while (_rightTile && (_rightTile->_leftTile == this)) { + if (_rightTile->GetYMin() < y) break; + _rightTile->_leftTile = newTile; + _rightTile = _rightTile->_bottomTile; + } - _boundingBox = Box(GetXMin(), GetYMin(), GetXMax(), y); + _boundingBox = Box(GetXMin(), GetYMin(), GetXMax(), y); - if (region->_GetTopLeftTile() == this) region->_SetTopLeftTile(newTile); - } + if (region->_GetTopLeftTile() == this) region->_SetTopLeftTile(newTile); + } } bool Region_Tile::MergeLeftTile(Region* region) // ******************************************** { - Region_Tile* uselessTile = _leftTile; + Region_Tile* uselessTile = _leftTile; - if (!uselessTile) return false; - if (uselessTile->_rightTile != this) return false; - if (uselessTile->_isVoid != _isVoid) return false; - if (uselessTile->GetXMax() != GetXMin()) return false; - if (uselessTile->GetYMin() != GetYMin()) return false; - if (uselessTile->GetYMax() != GetYMax()) return false; + if (!uselessTile) return false; + if (uselessTile->_rightTile != this) return false; + if (uselessTile->_isVoid != _isVoid) return false; + if (uselessTile->GetXMax() != GetXMin()) return false; + if (uselessTile->GetYMin() != GetYMin()) return false; + if (uselessTile->GetYMax() != GetYMax()) return false; - Region_Tile* tile = uselessTile->_topTile; - while (tile && (tile->_bottomTile == uselessTile)) { - tile->_bottomTile = this; - tile = tile->_leftTile; - } + Region_Tile* tile = uselessTile->_topTile; + while (tile && (tile->_bottomTile == uselessTile)) { + tile->_bottomTile = this; + tile = tile->_leftTile; + } - tile = uselessTile->_bottomTile; - while (tile && (tile->_topTile == uselessTile)) { - tile->_topTile = this; - tile = tile->_rightTile; - } + tile = uselessTile->_bottomTile; + while (tile && (tile->_topTile == uselessTile)) { + tile->_topTile = this; + tile = tile->_rightTile; + } - tile = uselessTile->_leftTile; - while (tile && (tile->_rightTile == uselessTile)) { - tile->_rightTile = this; - tile = tile->_topTile; - } + tile = uselessTile->_leftTile; + while (tile && (tile->_rightTile == uselessTile)) { + tile->_rightTile = this; + tile = tile->_topTile; + } - _leftTile = uselessTile->_leftTile; - _bottomTile = uselessTile->_bottomTile; + _leftTile = uselessTile->_leftTile; + _bottomTile = uselessTile->_bottomTile; - _boundingBox.Merge(uselessTile->_boundingBox); + _boundingBox.merge(uselessTile->_boundingBox); - if (region->_GetTopLeftTile() == uselessTile) region->_SetTopLeftTile(this); + if (region->_GetTopLeftTile() == uselessTile) region->_SetTopLeftTile(this); - delete uselessTile; + delete uselessTile; - return true; + return true; } bool Region_Tile::MergeBottomTile(Region* region) // ********************************************** { - Region_Tile* uselessTile = _bottomTile; + Region_Tile* uselessTile = _bottomTile; - if (!uselessTile) return false; - if (uselessTile->_topTile != this) return false; - if (uselessTile->_isVoid != _isVoid) return false; - if (uselessTile->GetYMax() != GetYMin()) return false; - if (uselessTile->GetXMin() != GetXMin()) return false; - if (uselessTile->GetXMax() != GetXMax()) return false; + if (!uselessTile) return false; + if (uselessTile->_topTile != this) return false; + if (uselessTile->_isVoid != _isVoid) return false; + if (uselessTile->GetYMax() != GetYMin()) return false; + if (uselessTile->GetXMin() != GetXMin()) return false; + if (uselessTile->GetXMax() != GetXMax()) return false; - Region_Tile* tile = uselessTile->_rightTile; - while (tile && (tile->_leftTile == uselessTile)) { - tile->_leftTile = this; - tile = tile->_bottomTile; - } + Region_Tile* tile = uselessTile->_rightTile; + while (tile && (tile->_leftTile == uselessTile)) { + tile->_leftTile = this; + tile = tile->_bottomTile; + } - tile = uselessTile->_leftTile; - while (tile && (tile->_rightTile == uselessTile)) { - tile->_rightTile = this; - tile = tile->_topTile; - } + tile = uselessTile->_leftTile; + while (tile && (tile->_rightTile == uselessTile)) { + tile->_rightTile = this; + tile = tile->_topTile; + } - tile = uselessTile->_bottomTile; - while (tile && (tile->_topTile == uselessTile)) { - tile->_topTile = this; - tile = tile->_rightTile; - } + tile = uselessTile->_bottomTile; + while (tile && (tile->_topTile == uselessTile)) { + tile->_topTile = this; + tile = tile->_rightTile; + } - _leftTile = uselessTile->_leftTile; - _bottomTile = uselessTile->_bottomTile; + _leftTile = uselessTile->_leftTile; + _bottomTile = uselessTile->_bottomTile; - _boundingBox.Merge(uselessTile->_boundingBox); + _boundingBox.merge(uselessTile->_boundingBox); - if (region->_GetBottomRightTile() == uselessTile) region->_SetBottomRightTile(this); + if (region->_GetBottomRightTile() == uselessTile) region->_SetBottomRightTile(this); - delete uselessTile; + delete uselessTile; - return true; + return true; } bool Region_Tile::MergeTopTile(Region* region) // ******************************************* { - Region_Tile* uselessTile = _topTile; + Region_Tile* uselessTile = _topTile; - if (!uselessTile) return false; - if (uselessTile->_bottomTile != this) return false; - if (uselessTile->_isVoid != _isVoid) return false; - if (uselessTile->GetYMin() != GetYMax()) return false; - if (uselessTile->GetXMin() != GetXMin()) return false; - if (uselessTile->GetXMax() != GetXMax()) return false; + if (!uselessTile) return false; + if (uselessTile->_bottomTile != this) return false; + if (uselessTile->_isVoid != _isVoid) return false; + if (uselessTile->GetYMin() != GetYMax()) return false; + if (uselessTile->GetXMin() != GetXMin()) return false; + if (uselessTile->GetXMax() != GetXMax()) return false; - Region_Tile* tile = uselessTile->_rightTile; - while (tile && (tile->_leftTile == uselessTile)) { - tile->_leftTile = this; - tile = tile->_bottomTile; - } + Region_Tile* tile = uselessTile->_rightTile; + while (tile && (tile->_leftTile == uselessTile)) { + tile->_leftTile = this; + tile = tile->_bottomTile; + } - tile = uselessTile->_leftTile; - while (tile && (tile->_rightTile == uselessTile)) { - tile->_rightTile = this; - tile = tile->_topTile; - } + tile = uselessTile->_leftTile; + while (tile && (tile->_rightTile == uselessTile)) { + tile->_rightTile = this; + tile = tile->_topTile; + } - tile = uselessTile->_topTile; - while (tile && (tile->_bottomTile == uselessTile)) { - tile->_bottomTile = this; - tile = tile->_leftTile; - } + tile = uselessTile->_topTile; + while (tile && (tile->_bottomTile == uselessTile)) { + tile->_bottomTile = this; + tile = tile->_leftTile; + } - _topTile = uselessTile->_topTile; - _rightTile = uselessTile->_rightTile; + _topTile = uselessTile->_topTile; + _rightTile = uselessTile->_rightTile; - _boundingBox.Merge(uselessTile->_boundingBox); + _boundingBox.merge(uselessTile->_boundingBox); - if (region->_GetTopLeftTile() == uselessTile) region->_SetTopLeftTile(this); + if (region->_GetTopLeftTile() == uselessTile) region->_SetTopLeftTile(this); - delete uselessTile; + delete uselessTile; - return true; + return true; } bool Region_Tile::MergeRightTile(Region* region) // ********************************************* { - Region_Tile* uselessTile = _rightTile; + Region_Tile* uselessTile = _rightTile; - if (!uselessTile) return false; - if (uselessTile->_leftTile != this) return false; - if (uselessTile->_isVoid != _isVoid) return false; - if (uselessTile->GetXMin() != GetXMax()) return false; - if (uselessTile->GetYMin() != GetYMin()) return false; - if (uselessTile->GetYMax() != GetYMax()) return false; + if (!uselessTile) return false; + if (uselessTile->_leftTile != this) return false; + if (uselessTile->_isVoid != _isVoid) return false; + if (uselessTile->GetXMin() != GetXMax()) return false; + if (uselessTile->GetYMin() != GetYMin()) return false; + if (uselessTile->GetYMax() != GetYMax()) return false; - Region_Tile* tile = uselessTile->_topTile; - while (tile && (tile->_bottomTile == uselessTile)) { - tile->_bottomTile = this; - tile = tile->_leftTile; - } + Region_Tile* tile = uselessTile->_topTile; + while (tile && (tile->_bottomTile == uselessTile)) { + tile->_bottomTile = this; + tile = tile->_leftTile; + } - tile = uselessTile->_bottomTile; - while (tile && (tile->_topTile == uselessTile)) { - tile->_topTile = this; - tile = tile->_rightTile; - } + tile = uselessTile->_bottomTile; + while (tile && (tile->_topTile == uselessTile)) { + tile->_topTile = this; + tile = tile->_rightTile; + } - tile = uselessTile->_rightTile; - while (tile && (tile->_leftTile == uselessTile)) { - tile->_leftTile = this; - tile = tile->_bottomTile; - } + tile = uselessTile->_rightTile; + while (tile && (tile->_leftTile == uselessTile)) { + tile->_leftTile = this; + tile = tile->_bottomTile; + } - _topTile = uselessTile->_topTile; - _rightTile = uselessTile->_rightTile; + _topTile = uselessTile->_topTile; + _rightTile = uselessTile->_rightTile; - _boundingBox.Merge(uselessTile->_boundingBox); + _boundingBox.merge(uselessTile->_boundingBox); - if (region->_GetBottomRightTile() == uselessTile) region->_SetBottomRightTile(this); + if (region->_GetBottomRightTile() == uselessTile) region->_SetBottomRightTile(this); - delete uselessTile; + delete uselessTile; - return true; + return true; } void Region_Tile::MergeNeighbours(Region* region) // ********************************************** { - while (MergeLeftTile(region) || MergeTopTile(region) || - MergeBottomTile(region) || MergeRightTile(region)) { - } + while (MergeLeftTile(region) || MergeTopTile(region) || + MergeBottomTile(region) || MergeRightTile(region)) { + } } void Region_Tile::CleanNeighbours(Region* region) // ********************************************** { - Region_Tile* tile = NULL; + Region_Tile* tile = NULL; - set tileSet; + set tileSet; - tile = _leftTile; - while (tile && (tile->GetYMin() <= GetYMax())) { - tileSet.insert(tile); - tile = tile->_topTile; - } + tile = _leftTile; + while (tile && (tile->GetYMin() <= GetYMax())) { + tileSet.insert(tile); + tile = tile->_topTile; + } - tile = _topTile; - while (tile && (GetXMin() <= tile->GetXMax())) { - tileSet.insert(tile); - tile = tile->_leftTile; - } + tile = _topTile; + while (tile && (GetXMin() <= tile->GetXMax())) { + tileSet.insert(tile); + tile = tile->_leftTile; + } - tile = _bottomTile; - while (tile && (tile->GetXMin() <= GetXMax())) { - tileSet.insert(tile); - tile = tile->_rightTile; - } + tile = _bottomTile; + while (tile && (tile->GetXMin() <= GetXMax())) { + tileSet.insert(tile); + tile = tile->_rightTile; + } - tile = _rightTile; - while (tile && (GetYMin() <= tile->GetYMax())) { - tileSet.insert(tile); - tile = tile->_bottomTile; - } + tile = _rightTile; + while (tile && (GetYMin() <= tile->GetYMax())) { + tileSet.insert(tile); + tile = tile->_bottomTile; + } - while (!tileSet.empty()) { - tile = *tileSet.begin(); - while (true) { - Region_Tile* leftTile = tile->_leftTile; - if ((leftTile == this) || !tile->MergeLeftTile(region)) break; - tileSet.erase(leftTile); - } - while (true) { - Region_Tile* topTile = tile->_topTile; - if ((topTile == this) || !tile->MergeTopTile(region)) break; - tileSet.erase(topTile); - } - while (true) { - Region_Tile* bottomTile = tile->_bottomTile; - if ((bottomTile == this) || !tile->MergeBottomTile(region)) break; - tileSet.erase(bottomTile); - } - while (true) { - Region_Tile* rightTile = tile->_rightTile; - if ((rightTile == this) || !tile->MergeRightTile(region)) break; - tileSet.erase(rightTile); - } - tileSet.erase(tile); - } -}; // Region_Tile::CleanNeighbours + while (!tileSet.empty()) { + tile = *tileSet.begin(); + while (true) { + Region_Tile* leftTile = tile->_leftTile; + if ((leftTile == this) || !tile->MergeLeftTile(region)) break; + tileSet.erase(leftTile); + } + while (true) { + Region_Tile* topTile = tile->_topTile; + if ((topTile == this) || !tile->MergeTopTile(region)) break; + tileSet.erase(topTile); + } + while (true) { + Region_Tile* bottomTile = tile->_bottomTile; + if ((bottomTile == this) || !tile->MergeBottomTile(region)) break; + tileSet.erase(bottomTile); + } + while (true) { + Region_Tile* rightTile = tile->_rightTile; + if ((rightTile == this) || !tile->MergeRightTile(region)) break; + tileSet.erase(rightTile); + } + tileSet.erase(tile); + } +}; // Region_Tile::CleanNeighbours bool @@ -569,12 +569,12 @@ Region_Tile::_IsTopFull() const { Region_Tile* upTile = _topTile; while (upTile && upTile->_isVoid == _isVoid && - upTile->GetXMin() > GetXMin()) { + upTile->GetXMin() > GetXMin()) { upTile = upTile->_leftTile; } return (upTile && upTile->_isVoid == _isVoid && upTile->GetXMin() <= GetXMin()); -}; // Region_Tile::_IsTopFull +}; // Region_Tile::_IsTopFull bool Region_Tile::_IsBottomFull() const @@ -583,12 +583,12 @@ Region_Tile::_IsBottomFull() const { Region_Tile* downTile = _bottomTile; while (downTile && downTile->_isVoid == _isVoid && - downTile->GetXMax() < GetXMax()) { + downTile->GetXMax() < GetXMax()) { downTile = downTile->_rightTile; } return (downTile && downTile->_isVoid == _isVoid && downTile->GetXMax() >= GetXMax()); -}; // Region_Tile::_IsBottomFull +}; // Region_Tile::_IsBottomFull bool Region_Tile::_IsLeftFull() const @@ -597,12 +597,12 @@ Region_Tile::_IsLeftFull() const { Region_Tile* leftTile = _leftTile; while (leftTile && leftTile->_isVoid == _isVoid && - leftTile->GetYMax() < GetYMax()) { + leftTile->GetYMax() < GetYMax()) { leftTile = leftTile->_topTile; } return (leftTile && leftTile->_isVoid == _isVoid && leftTile->GetYMax() >= GetYMax()); -}; // Region_Tile::_IsLeftFull +}; // Region_Tile::_IsLeftFull bool Region_Tile::_IsRightFull() const @@ -611,12 +611,12 @@ Region_Tile::_IsRightFull() const { Region_Tile* rightTile = _rightTile; while (rightTile && rightTile->_isVoid == _isVoid && - rightTile->GetYMin() > GetYMin()) { + rightTile->GetYMin() > GetYMin()) { rightTile = rightTile->_bottomTile; } return (rightTile && rightTile->_isVoid == _isVoid && rightTile->GetYMin() <= GetYMin()); -}; // Region_Tile::_IsRightFull +}; // Region_Tile::_IsRightFull Unit Region_Tile::_TopSplitAtVerticalSize (Region* region) @@ -643,7 +643,7 @@ Region_Tile::_TopSplitAtVerticalSize (Region* region) upTile->SplitVertical (region, GetXMin()); } return height; -}; // Region_Tile::_TopSplitAtVerticalSize +}; // Region_Tile::_TopSplitAtVerticalSize Unit Region_Tile::_BottomSplitAtVerticalSize (Region* region) @@ -670,7 +670,7 @@ Region_Tile::_BottomSplitAtVerticalSize (Region* region) downTile->SplitVertical (region, GetXMax()); } return height; -}; // Region_Tile::_BottomSplitAtVerticalSize +}; // Region_Tile::_BottomSplitAtVerticalSize Unit @@ -698,7 +698,7 @@ Region_Tile::_LeftSplitAtHorizontalSize (Region* region) leftTile->SplitHorizontal (region, GetYMax()); } return width; -}; // Region_Tile::_LeftSplitAtHorizontalSize +}; // Region_Tile::_LeftSplitAtHorizontalSize Unit @@ -726,7 +726,7 @@ Region_Tile::_RightSplitAtHorizontalSize (Region* region) rightTile->SplitHorizontal (region, GetYMin()); } return width; -}; // Region_Tile::_RightSplitAtHorizontalSize +}; // Region_Tile::_RightSplitAtHorizontalSize bool @@ -751,7 +751,7 @@ Region_Tile::_TopSplitAtHorizontalSize (Region* region, const Unit height) upTile = upTile->_leftTile; } return modif; -}; // Region_Tile::_TopSplitAtHorizontalSize +}; // Region_Tile::_TopSplitAtHorizontalSize bool @@ -776,7 +776,7 @@ Region_Tile::_BottomSplitAtHorizontalSize (Region* region, const Unit height) downTile = downTile->_rightTile; } return modif; -}; // Region_Tile::_BottomSplitAtHorizontalSize +}; // Region_Tile::_BottomSplitAtHorizontalSize bool Region_Tile::_LeftSplitAtVerticalSize (Region* region, const Unit width) @@ -800,7 +800,7 @@ Region_Tile::_LeftSplitAtVerticalSize (Region* region, const Unit width) leftTile = leftTile->_topTile; } return modif; -}; // Region_Tile::_LeftSplitAtVerticalSize +}; // Region_Tile::_LeftSplitAtVerticalSize bool @@ -825,7 +825,7 @@ Region_Tile::_RightSplitAtVerticalSize (Region* region, const Unit width) rightTile = rightTile->_bottomTile; } return modif; -}; // Region_Tile::_RightSplitAtVerticalSize +}; // Region_Tile::_RightSplitAtVerticalSize Interval @@ -842,7 +842,7 @@ Region_Tile::_GetTopNeighbour () const topTile = topTile->_leftTile; } return result.GetIntersection (Interval (GetXMin(), GetXMax())); -}; // Region_Tile::_GetTopNeighbour +}; // Region_Tile::_GetTopNeighbour Interval Region_Tile::_GetBottomNeighbour () const @@ -858,7 +858,7 @@ Region_Tile::_GetBottomNeighbour () const bottomTile = bottomTile->_rightTile; } return result.GetIntersection (Interval (GetXMin(), GetXMax())); -}; // Region_Tile::_GetBottomNeighbour +}; // Region_Tile::_GetBottomNeighbour Interval Region_Tile::_GetLeftNeighbour () const @@ -874,7 +874,7 @@ Region_Tile::_GetLeftNeighbour () const leftTile = leftTile->_topTile; } return result.GetIntersection (Interval (GetYMin(), GetYMax())); -}; // Region_Tile::_GetLeftNeighbour +}; // Region_Tile::_GetLeftNeighbour Interval Region_Tile::_GetRightNeighbour () const @@ -890,7 +890,7 @@ Region_Tile::_GetRightNeighbour () const rightTile = rightTile->_bottomTile; } return result.GetIntersection (Interval (GetYMin(), GetYMax())); -}; // Region_Tile::_GetRightNeighbour +}; // Region_Tile::_GetRightNeighbour bool Region_Tile::VerticalEnhancement(Region* region) @@ -909,7 +909,7 @@ Region_Tile::VerticalEnhancement(Region* region) modif = MergeBottomTile (region) || modif; } return modif; -}; // Region_Tile::VerticalEnhancement +}; // Region_Tile::VerticalEnhancement bool Region_Tile::HorizontalEnhancement(Region* region) @@ -928,31 +928,31 @@ Region_Tile::HorizontalEnhancement(Region* region) modif = MergeRightTile (region) || modif; } return modif; -}; // Region_Tile::HorizontalEnhancement +}; // Region_Tile::HorizontalEnhancement string Region_Tile::_GetString() const // *********************************** { - string s = "<" + _TName("Region::Tile") + ">"; - s.insert(s.length() - 1, " " + GetString(_boundingBox)); - if (_isVoid) s.insert(s.length() - 1, " VOID"); - return s; -}; // ion_Tile::_Get + string s = "<" + _TName("Region::Tile") + ">"; + s.insert(s.length() - 1, " " + GetString(_boundingBox)); + if (_isVoid) s.insert(s.length() - 1, " VOID"); + return s; +}; // ion_Tile::_Get Record* Region_Tile::_GetRecord() const // ****************************** { - Record* record = new Record(GetString(this)); - if (record) { - record->Add(GetSlot("BoundingBox", &_boundingBox)); - record->Add(GetSlot("IsVoid", &_isVoid)); - record->Add(GetSlot("LeftTile", _leftTile)); - record->Add(GetSlot("BottomTile", _bottomTile)); - record->Add(GetSlot("TopTile", _topTile)); - record->Add(GetSlot("RightTile", _rightTile)); - } - return record; + Record* record = new Record(GetString(this)); + if (record) { + record->Add(GetSlot("BoundingBox", &_boundingBox)); + record->Add(GetSlot("IsVoid", &_isVoid)); + record->Add(GetSlot("LeftTile", _leftTile)); + record->Add(GetSlot("BottomTile", _bottomTile)); + record->Add(GetSlot("TopTile", _topTile)); + record->Add(GetSlot("RightTile", _rightTile)); + } + return record; } @@ -974,25 +974,25 @@ Region_Tile::IsVoidFilter::IsVoidFilter(const Region_Tile::IsVoidFilter& filter) Region_Tile::IsVoidFilter& Region_Tile::IsVoidFilter::operator=(const IsVoidFilter& filter) // **************************************************************************************** { - return *this; + return *this; } Filter* Region_Tile::IsVoidFilter::GetClone() const // ************************************************************** { - return new Region_Tile::IsVoidFilter(*this); + return new Region_Tile::IsVoidFilter(*this); } bool Region_Tile::IsVoidFilter::Accept(Region_Tile* tile) const // ************************************************************ { - return tile->IsVoid(); + return tile->IsVoid(); } string Region_Tile::IsVoidFilter::_GetString() const // ************************************************* { - return "<" + _TName("RegionTile::IsVoidFilter") + ">"; + return "<" + _TName("RegionTile::IsVoidFilter") + ">"; } @@ -1007,58 +1007,58 @@ class Region_Tiles : public Collection { // Types // ***** - public: typedef Collection Inherit; + public: typedef Collection Inherit; - public: class Locator : public Hurricane::Locator { - // ************************************************************ + public: class Locator : public Hurricane::Locator { + // ************************************************************ - public: typedef Hurricane::Locator Inherit; + public: typedef Hurricane::Locator Inherit; - private: const Region* _region; - private: stack _tileStack; + private: const Region* _region; + private: stack _tileStack; - public: Locator(const Region* region = NULL); - public: Locator(const Locator& locator); + public: Locator(const Region* region = NULL); + public: Locator(const Locator& locator); - public: Locator& operator=(const Locator& locator); + public: Locator& operator=(const Locator& locator); - public: virtual Region_Tile* GetElement() const; - public: virtual Hurricane::Locator* GetClone() const; + public: virtual Region_Tile* GetElement() const; + public: virtual Hurricane::Locator* GetClone() const; - public: virtual bool IsValid() const; + public: virtual bool IsValid() const; - public: virtual void Progress(); + public: virtual void Progress(); - public: virtual string _GetString() const; + public: virtual string _GetString() const; - }; + }; // Attributes // ********** - private: const Region* _region; + private: const Region* _region; // Constructors // ************ - public: Region_Tiles(const Region* region = NULL); - public: Region_Tiles(const Region_Tiles& Tiles); + public: Region_Tiles(const Region* region = NULL); + public: Region_Tiles(const Region_Tiles& Tiles); // Operators // ********* - public: Region_Tiles& operator=(const Region_Tiles& Tiles); + public: Region_Tiles& operator=(const Region_Tiles& Tiles); // Accessors // ********* - public: virtual Collection* GetClone() const; - public: virtual Hurricane::Locator* GetLocator() const; + public: virtual Collection* GetClone() const; + public: virtual Hurricane::Locator* GetLocator() const; // Others // ****** - public: virtual string _GetString() const; + public: virtual string _GetString() const; }; @@ -1070,44 +1070,44 @@ class Region_Tiles : public Collection { Region_Tiles::Region_Tiles(const Region* region) // ********************************************* -: Inherit(), - _region(region) +: Inherit(), + _region(region) { } Region_Tiles::Region_Tiles(const Region_Tiles& tiles) // ************************************************** -: Inherit(), - _region(tiles._region) +: Inherit(), + _region(tiles._region) { } Region_Tiles& Region_Tiles::operator=(const Region_Tiles& tiles) // ************************************************************* { - _region = tiles._region; - return *this; + _region = tiles._region; + return *this; } Collection* Region_Tiles::GetClone() const // ***************************************************** { - return new Region_Tiles(*this); + return new Region_Tiles(*this); } Locator* Region_Tiles::GetLocator() const // **************************************************** { - return new Locator(_region); + return new Locator(_region); } string Region_Tiles::_GetString() const // ************************************ { - string s = "<" + _TName("Region::Tiles"); - if (_region) s += " " + GetString(_region); - s += ">"; - return s; + string s = "<" + _TName("Region::Tiles"); + if (_region) s += " " + GetString(_region); + s += ">"; + return s; } @@ -1118,76 +1118,76 @@ string Region_Tiles::_GetString() const Region_Tiles::Locator::Locator(const Region* region) // ************************************************* -: Inherit(), - _region(region), - _tileStack() +: Inherit(), + _region(region), + _tileStack() { - if (_region) { - Region_Tile* tile = _region->_GetBottomRightTile(); - while (tile) { - _tileStack.push(tile); - tile = tile->_leftTile; - } - } + if (_region) { + Region_Tile* tile = _region->_GetBottomRightTile(); + while (tile) { + _tileStack.push(tile); + tile = tile->_leftTile; + } + } } Region_Tiles::Locator::Locator(const Locator& locator) // *************************************************** -: Inherit(), - _region(locator._region), - _tileStack(locator._tileStack) +: Inherit(), + _region(locator._region), + _tileStack(locator._tileStack) { } Region_Tiles::Locator& Region_Tiles::Locator::operator=(const Locator& locator) // **************************************************************************** { - _region = locator._region; - _tileStack = locator._tileStack; - return *this; + _region = locator._region; + _tileStack = locator._tileStack; + return *this; } Region_Tile* Region_Tiles::Locator::GetElement() const // *************************************************** { - return (!_tileStack.empty()) ? _tileStack.top() : NULL; + return (!_tileStack.empty()) ? _tileStack.top() : NULL; } Locator* Region_Tiles::Locator::GetClone() const // *********************************************************** { - return new Locator(*this); + return new Locator(*this); } bool Region_Tiles::Locator::IsValid() const // *************************************** { - return !_tileStack.empty(); + return !_tileStack.empty(); } void Region_Tiles::Locator::Progress() // ********************************** { - if (!_tileStack.empty()) { - Region_Tile* tile = _tileStack.top(); - _tileStack.pop(); - Unit xMin = tile->GetXMin(); - Unit xMax = tile->GetXMax(); - Region_Tile* topTile = tile->_topTile; - while (topTile && (xMin < topTile->GetXMax())) { - if (topTile->GetXMax() <= xMax) _tileStack.push(topTile); - topTile = topTile->_leftTile; - } - } + if (!_tileStack.empty()) { + Region_Tile* tile = _tileStack.top(); + _tileStack.pop(); + Unit xMin = tile->GetXMin(); + Unit xMax = tile->GetXMax(); + Region_Tile* topTile = tile->_topTile; + while (topTile && (xMin < topTile->GetXMax())) { + if (topTile->GetXMax() <= xMax) _tileStack.push(topTile); + topTile = topTile->_leftTile; + } + } } string Region_Tiles::Locator::_GetString() const // ********************************************* { - string s = "<" + _TName("Region::Tiles::Locator"); - if (_region) s += " " + GetString(_region); - s += ">"; - return s; + string s = "<" + _TName("Region::Tiles::Locator"); + if (_region) s += " " + GetString(_region); + s += ">"; + return s; } @@ -1202,65 +1202,65 @@ class Region_TilesUnder : public Collection { // Types // ***** - public: typedef Collection Inherit; + public: typedef Collection Inherit; - public: class Locator : public Hurricane::Locator { - // ************************************************************ + public: class Locator : public Hurricane::Locator { + // ************************************************************ - public: typedef Hurricane::Locator Inherit; + public: typedef Hurricane::Locator Inherit; - private: const Region* _region; - private: Box _area; - private: Region_Tile* _startTile; - private: stack _tileStack; - private: set _tileSet; // to check never stack 2 times the same tile + private: const Region* _region; + private: Box _area; + private: Region_Tile* _startTile; + private: stack _tileStack; + private: set _tileSet; // to check never stack 2 times the same tile - public: Locator(); - public: Locator(const Region* region, const Box& area, Region_Tile* startTile = NULL); - public: Locator(const Locator& locator); + public: Locator(); + public: Locator(const Region* region, const Box& area, Region_Tile* startTile = NULL); + public: Locator(const Locator& locator); - public: Locator& operator=(const Locator& locator); + public: Locator& operator=(const Locator& locator); - public: virtual Region_Tile* GetElement() const; - public: virtual Hurricane::Locator* GetClone() const; + public: virtual Region_Tile* GetElement() const; + public: virtual Hurricane::Locator* GetClone() const; - public: virtual bool IsValid() const; + public: virtual bool IsValid() const; - public: virtual void Progress(); + public: virtual void Progress(); - public: virtual string _GetString() const; + public: virtual string _GetString() const; - }; + }; // Attributes // ********** - private: const Region* _region; - private: Box _area; - private: Region_Tile* _startTile; + private: const Region* _region; + private: Box _area; + private: Region_Tile* _startTile; // Constructors // ************ - public: Region_TilesUnder(); - public: Region_TilesUnder(const Region* region, const Box& area, Region_Tile* startTile = NULL); - public: Region_TilesUnder(const Region_TilesUnder& Tiles); + public: Region_TilesUnder(); + public: Region_TilesUnder(const Region* region, const Box& area, Region_Tile* startTile = NULL); + public: Region_TilesUnder(const Region_TilesUnder& Tiles); // Operators // ********* - public: Region_TilesUnder& operator=(const Region_TilesUnder& Tiles); + public: Region_TilesUnder& operator=(const Region_TilesUnder& Tiles); // Accessors // ********* - public: virtual Collection* GetClone() const; - public: virtual Hurricane::Locator* GetLocator() const; + public: virtual Collection* GetClone() const; + public: virtual Hurricane::Locator* GetLocator() const; // Others // ****** - public: virtual string _GetString() const; + public: virtual string _GetString() const; }; @@ -1272,63 +1272,63 @@ class Region_TilesUnder : public Collection { Region_TilesUnder::Region_TilesUnder() // *********************************** -: Inherit(), - _region(NULL), - _area(), - _startTile(NULL) +: Inherit(), + _region(NULL), + _area(), + _startTile(NULL) { } Region_TilesUnder::Region_TilesUnder(const Region* region, const Box& area, Region_Tile* startTile) // ************************************************************************************************ -: Inherit(), - _region(region), - _startTile(startTile) +: Inherit(), + _region(region), + _startTile(startTile) { - _area = area.GetIntersection(region->GetBoundingBox()); + _area = area.getIntersection(region->GetBoundingBox()); } Region_TilesUnder::Region_TilesUnder(const Region_TilesUnder& tiles) // ***************************************************************** -: Inherit(), - _region(tiles._region), - _area(tiles._area), - _startTile(tiles._startTile) +: Inherit(), + _region(tiles._region), + _area(tiles._area), + _startTile(tiles._startTile) { } Region_TilesUnder& Region_TilesUnder::operator=(const Region_TilesUnder& tiles) // **************************************************************************** { - _region = tiles._region; - _area = tiles._area; - _startTile = tiles._startTile; - return *this; + _region = tiles._region; + _area = tiles._area; + _startTile = tiles._startTile; + return *this; } Collection* Region_TilesUnder::GetClone() const // ********************************************************** { - return new Region_TilesUnder(*this); + return new Region_TilesUnder(*this); } Locator* Region_TilesUnder::GetLocator() const // ********************************************************* { - return new Locator(_region, _area, _startTile); + return new Locator(_region, _area, _startTile); } string Region_TilesUnder::_GetString() const // ***************************************** { - string s = "<" + _TName("Region::TilesUnder"); - if (_region) { - s += " " + GetString(_region); - s += " " + GetString(_area); - s += " " + GetString(_startTile); - } - s += ">"; - return s; + string s = "<" + _TName("Region::TilesUnder"); + if (_region) { + s += " " + GetString(_region); + s += " " + GetString(_area); + s += " " + GetString(_startTile); + } + s += ">"; + return s; } @@ -1339,109 +1339,109 @@ string Region_TilesUnder::_GetString() const Region_TilesUnder::Locator::Locator() // ********************************** -: Inherit(), - _region(NULL), - _area(), - _startTile(NULL), - _tileStack() +: Inherit(), + _region(NULL), + _area(), + _startTile(NULL), + _tileStack() { } Region_TilesUnder::Locator::Locator(const Region* region, const Box& area, Region_Tile* startTile) // *********************************************************************************************** -: Inherit(), - _region(region), - _area(area), - _startTile(startTile), - _tileStack() +: Inherit(), + _region(region), + _area(area), + _startTile(startTile), + _tileStack() { - if (_region && !_area.IsEmpty()) { - Region_Tile* tile = _region->_GetTileAt(Point(_area.GetXMax(), _area.GetYMin()), _startTile); - while (tile && (_area.GetXMin() < tile->GetXMax())) { - while (tile && (tile->GetYMax() <= _area.GetYMin())) tile = tile->_topTile; - if (tile) { - if (_tileSet.find(tile) == _tileSet.end()) { - _tileSet.insert(tile); - _tileStack.push(tile); - } - tile = tile->_leftTile; - } - } - } + if (_region && !_area.isEmpty()) { + Region_Tile* tile = _region->_GetTileAt(Point(_area.getXMax(), _area.getYMin()), _startTile); + while (tile && (_area.getXMin() < tile->GetXMax())) { + while (tile && (tile->GetYMax() <= _area.getYMin())) tile = tile->_topTile; + if (tile) { + if (_tileSet.find(tile) == _tileSet.end()) { + _tileSet.insert(tile); + _tileStack.push(tile); + } + tile = tile->_leftTile; + } + } + } } Region_TilesUnder::Locator::Locator(const Locator& locator) // ******************************************************** -: Inherit(), - _region(locator._region), - _area(locator._area), - _startTile(locator._startTile), - _tileStack(locator._tileStack) +: Inherit(), + _region(locator._region), + _area(locator._area), + _startTile(locator._startTile), + _tileStack(locator._tileStack) { } Region_TilesUnder::Locator& Region_TilesUnder::Locator::operator=(const Locator& locator) // ************************************************************************************** { - _region = locator._region; - _area = locator._area; - _startTile = locator._startTile; - _tileStack = locator._tileStack; - return *this; + _region = locator._region; + _area = locator._area; + _startTile = locator._startTile; + _tileStack = locator._tileStack; + return *this; } Region_Tile* Region_TilesUnder::Locator::GetElement() const // ******************************************************** { - return (!_tileStack.empty()) ? _tileStack.top() : NULL; + return (!_tileStack.empty()) ? _tileStack.top() : NULL; } Locator* Region_TilesUnder::Locator::GetClone() const // **************************************************************** { - return new Locator(*this); + return new Locator(*this); } bool Region_TilesUnder::Locator::IsValid() const // ********************************************* { - return !_tileStack.empty(); + return !_tileStack.empty(); } void Region_TilesUnder::Locator::Progress() // **************************************** { - if (!_tileStack.empty()) { - Region_Tile* tile = _tileStack.top(); - _tileStack.pop(); - Unit xMin = max(tile->GetXMin(), _area.GetXMin()); - Unit xMax = tile->GetXMax(); - Region_Tile* topTile = tile->_topTile; - while (topTile && (xMin < topTile->GetXMax())) { - if ((topTile->GetXMin() <= _area.GetXMax()) && - (topTile->GetYMin() <= _area.GetYMax()) && - (min(topTile->GetXMax(), _area.GetXMax()) <= xMax)) { - if (_tileSet.find(topTile) == _tileSet.end()) { - _tileSet.insert(topTile); - _tileStack.push(topTile); - } - } - topTile = topTile->_leftTile; - } - } + if (!_tileStack.empty()) { + Region_Tile* tile = _tileStack.top(); + _tileStack.pop(); + Unit xMin = max(tile->GetXMin(), _area.getXMin()); + Unit xMax = tile->GetXMax(); + Region_Tile* topTile = tile->_topTile; + while (topTile && (xMin < topTile->GetXMax())) { + if ((topTile->GetXMin() <= _area.getXMax()) && + (topTile->GetYMin() <= _area.getYMax()) && + (min(topTile->GetXMax(), _area.getXMax()) <= xMax)) { + if (_tileSet.find(topTile) == _tileSet.end()) { + _tileSet.insert(topTile); + _tileStack.push(topTile); + } + } + topTile = topTile->_leftTile; + } + } } string Region_TilesUnder::Locator::_GetString() const // ************************************************** { - string s = "<" + _TName("Region::TilesUnder::Locator"); - if (_region) { - s += " " + GetString(_region); - s += " " + GetString(_area); - s += " " + GetString(_startTile); - } - s += ">"; - return s; + string s = "<" + _TName("Region::TilesUnder::Locator"); + if (_region) { + s += " " + GetString(_region); + s += " " + GetString(_area); + s += " " + GetString(_startTile); + } + s += ">"; + return s; } @@ -1456,62 +1456,62 @@ class Region_BoxesUnder : public Collection { // Types // ***** - public: typedef Collection Inherit; + public: typedef Collection Inherit; - public: class Locator : public Hurricane::Locator { - // *************************************************** + public: class Locator : public Hurricane::Locator { + // *************************************************** - public: typedef Hurricane::Locator Inherit; + public: typedef Hurricane::Locator Inherit; - private: const Region* _region; - private: Box _area; - private: GenericLocator _tileLocator; + private: const Region* _region; + private: Box _area; + private: GenericLocator _tileLocator; - public: Locator(); - public: Locator(const Region* region, const Box& area = Box()); - public: Locator(const Locator& locator); + public: Locator(); + public: Locator(const Region* region, const Box& area = Box()); + public: Locator(const Locator& locator); - public: Locator& operator=(const Locator& locator); + public: Locator& operator=(const Locator& locator); - public: virtual Box GetElement() const; - public: virtual Hurricane::Locator* GetClone() const; + public: virtual Box GetElement() const; + public: virtual Hurricane::Locator* GetClone() const; - public: virtual bool IsValid() const; + public: virtual bool IsValid() const; - public: virtual void Progress(); + public: virtual void Progress(); - public: virtual string _GetString() const; + public: virtual string _GetString() const; - }; + }; // Attributes // ********** - private: const Region* _region; - private: Box _area; + private: const Region* _region; + private: Box _area; // Constructors // ************ - public: Region_BoxesUnder(); - public: Region_BoxesUnder(const Region* region, const Box& area = Box()); - public: Region_BoxesUnder(const Region_BoxesUnder& boxes); + public: Region_BoxesUnder(); + public: Region_BoxesUnder(const Region* region, const Box& area = Box()); + public: Region_BoxesUnder(const Region_BoxesUnder& boxes); // Operators // ********* - public: Region_BoxesUnder& operator=(const Region_BoxesUnder& boxes); + public: Region_BoxesUnder& operator=(const Region_BoxesUnder& boxes); // Accessors // ********* - public: virtual Collection* GetClone() const; - public: virtual Hurricane::Locator* GetLocator() const; + public: virtual Collection* GetClone() const; + public: virtual Hurricane::Locator* GetLocator() const; // Others // ****** - public: virtual string _GetString() const; + public: virtual string _GetString() const; }; @@ -1523,58 +1523,58 @@ class Region_BoxesUnder : public Collection { Region_BoxesUnder::Region_BoxesUnder() // *********************************** -: Inherit(), - _region(NULL), - _area() +: Inherit(), + _region(NULL), + _area() { } Region_BoxesUnder::Region_BoxesUnder(const Region* region, const Box& area) // ************************************************************************ -: Inherit(), - _region(region), - _area(area) +: Inherit(), + _region(region), + _area(area) { } Region_BoxesUnder::Region_BoxesUnder(const Region_BoxesUnder& boxes) // ***************************************************************** -: Inherit(), - _region(boxes._region), - _area(boxes._area) +: Inherit(), + _region(boxes._region), + _area(boxes._area) { } Region_BoxesUnder& Region_BoxesUnder::operator=(const Region_BoxesUnder& boxes) // **************************************************************************** { - _region = boxes._region; - _area = boxes._area; - return *this; + _region = boxes._region; + _area = boxes._area; + return *this; } Collection* Region_BoxesUnder::GetClone() const // ************************************************* { - return new Region_BoxesUnder(*this); + return new Region_BoxesUnder(*this); } Locator* Region_BoxesUnder::GetLocator() const // ************************************************ { - return new Locator(_region, _area); + return new Locator(_region, _area); } string Region_BoxesUnder::_GetString() const // ***************************************** { - string s = "<" + _TName("Region::BoxesUnder"); - if (_region) { - s += " " + GetString(_region); - s += " " + GetString(_area); - } - s += ">"; - return s; + string s = "<" + _TName("Region::BoxesUnder"); + if (_region) { + s += " " + GetString(_region); + s += " " + GetString(_area); + } + s += ">"; + return s; } @@ -1585,80 +1585,80 @@ string Region_BoxesUnder::_GetString() const Region_BoxesUnder::Locator::Locator() // ********************************** -: Inherit(), - _region(NULL), - _area(), - _tileLocator() +: Inherit(), + _region(NULL), + _area(), + _tileLocator() { } Region_BoxesUnder::Locator::Locator(const Region* region, const Box& area) // *********************************************************************** -: Inherit(), - _region(region), - _area(area), - _tileLocator() +: Inherit(), + _region(region), + _area(area), + _tileLocator() { - if (_region) { - _tileLocator = - (_area.IsEmpty()) ? - _region->_GetTiles().GetSubSet(!Region_Tile::GetIsVoidFilter()).GetLocator() : - _region->_GetTilesUnder(_area).GetSubSet(!Region_Tile::GetIsVoidFilter()).GetLocator(); - } + if (_region) { + _tileLocator = + (_area.isEmpty()) ? + _region->_GetTiles().GetSubSet(!Region_Tile::GetIsVoidFilter()).GetLocator() : + _region->_GetTilesUnder(_area).GetSubSet(!Region_Tile::GetIsVoidFilter()).GetLocator(); + } } Region_BoxesUnder::Locator::Locator(const Locator& locator) // ******************************************************** -: Inherit(), - _region(locator._region), - _area(locator._area), - _tileLocator(locator._tileLocator) +: Inherit(), + _region(locator._region), + _area(locator._area), + _tileLocator(locator._tileLocator) { } Region_BoxesUnder::Locator& Region_BoxesUnder::Locator::operator=(const Locator& locator) // ************************************************************************************** { - _region = locator._region; - _area = locator._area; - _tileLocator = locator._tileLocator; - return *this; + _region = locator._region; + _area = locator._area; + _tileLocator = locator._tileLocator; + return *this; } Box Region_BoxesUnder::Locator::GetElement() const // *********************************************** { - return (_tileLocator.IsValid()) ? _tileLocator.GetElement()->GetBoundingBox() : Box(); + return (_tileLocator.IsValid()) ? _tileLocator.GetElement()->GetBoundingBox() : Box(); } Locator* Region_BoxesUnder::Locator::GetClone() const // ******************************************************* { - return new Locator(*this); + return new Locator(*this); } bool Region_BoxesUnder::Locator::IsValid() const // ******************************************** { - return _tileLocator.IsValid(); + return _tileLocator.IsValid(); } void Region_BoxesUnder::Locator::Progress() // **************************************** { - _tileLocator.Progress(); + _tileLocator.Progress(); } string Region_BoxesUnder::Locator::_GetString() const // ************************************************** { - string s = "<" + _TName("Region::BoxesUnder::Locator"); - if (_region) { - s += " " + GetString(_region); - s += " " + GetString(_area); - } - s += ">"; - return s; + string s = "<" + _TName("Region::BoxesUnder::Locator"); + if (_region) { + s += " " + GetString(_region); + s += " " + GetString(_area); + } + s += ">"; + return s; } @@ -1673,62 +1673,62 @@ class Region_VoidBoxesUnder : public Collection { // Types // ***** - public: typedef Collection Inherit; + public: typedef Collection Inherit; - public: class Locator : public Hurricane::Locator { - // *************************************************** + public: class Locator : public Hurricane::Locator { + // *************************************************** - public: typedef Hurricane::Locator Inherit; + public: typedef Hurricane::Locator Inherit; - private: const Region* _region; - private: Box _area; - private: GenericLocator _tileLocator; + private: const Region* _region; + private: Box _area; + private: GenericLocator _tileLocator; - public: Locator(); - public: Locator(const Region* region, const Box& area = Box()); - public: Locator(const Locator& locator); + public: Locator(); + public: Locator(const Region* region, const Box& area = Box()); + public: Locator(const Locator& locator); - public: Locator& operator=(const Locator& locator); + public: Locator& operator=(const Locator& locator); - public: virtual Box GetElement() const; - public: virtual Hurricane::Locator* GetClone() const; + public: virtual Box GetElement() const; + public: virtual Hurricane::Locator* GetClone() const; - public: virtual bool IsValid() const; + public: virtual bool IsValid() const; - public: virtual void Progress(); + public: virtual void Progress(); - public: virtual string _GetString() const; + public: virtual string _GetString() const; - }; + }; // Attributes // ********** - private: const Region* _region; - private: Box _area; + private: const Region* _region; + private: Box _area; // Constructors // ************ - public: Region_VoidBoxesUnder(); - public: Region_VoidBoxesUnder(const Region* region, const Box& area = Box()); - public: Region_VoidBoxesUnder(const Region_VoidBoxesUnder& boxes); + public: Region_VoidBoxesUnder(); + public: Region_VoidBoxesUnder(const Region* region, const Box& area = Box()); + public: Region_VoidBoxesUnder(const Region_VoidBoxesUnder& boxes); // Operators // ********* - public: Region_VoidBoxesUnder& operator=(const Region_VoidBoxesUnder& boxes); + public: Region_VoidBoxesUnder& operator=(const Region_VoidBoxesUnder& boxes); // Accessors // ********* - public: virtual Collection* GetClone() const; - public: virtual Hurricane::Locator* GetLocator() const; + public: virtual Collection* GetClone() const; + public: virtual Hurricane::Locator* GetLocator() const; // Others // ****** - public: virtual string _GetString() const; + public: virtual string _GetString() const; }; @@ -1740,58 +1740,58 @@ class Region_VoidBoxesUnder : public Collection { Region_VoidBoxesUnder::Region_VoidBoxesUnder() // ******************************************* -: Inherit(), - _region(NULL), - _area() +: Inherit(), + _region(NULL), + _area() { } Region_VoidBoxesUnder::Region_VoidBoxesUnder(const Region* region, const Box& area) // ******************************************************************************** -: Inherit(), - _region(region), - _area(area) +: Inherit(), + _region(region), + _area(area) { } Region_VoidBoxesUnder::Region_VoidBoxesUnder(const Region_VoidBoxesUnder& boxes) // ***************************************************************************** -: Inherit(), - _region(boxes._region), - _area(boxes._area) +: Inherit(), + _region(boxes._region), + _area(boxes._area) { } Region_VoidBoxesUnder& Region_VoidBoxesUnder::operator=(const Region_VoidBoxesUnder& boxes) // **************************************************************************************** { - _region = boxes._region; - _area = boxes._area; - return *this; + _region = boxes._region; + _area = boxes._area; + return *this; } Collection* Region_VoidBoxesUnder::GetClone() const // ***************************************************** { - return new Region_VoidBoxesUnder(*this); + return new Region_VoidBoxesUnder(*this); } Locator* Region_VoidBoxesUnder::GetLocator() const // **************************************************** { - return new Locator(_region, _area); + return new Locator(_region, _area); } string Region_VoidBoxesUnder::_GetString() const // ********************************************* { - string s = "<" + _TName("Region::VoidBoxesUnder"); - if (_region) { - s += " " + GetString(_region); - s += " " + GetString(_area); - } - s += ">"; - return s; + string s = "<" + _TName("Region::VoidBoxesUnder"); + if (_region) { + s += " " + GetString(_region); + s += " " + GetString(_area); + } + s += ">"; + return s; } @@ -1802,80 +1802,80 @@ string Region_VoidBoxesUnder::_GetString() const Region_VoidBoxesUnder::Locator::Locator() // ************************************** -: Inherit(), - _region(NULL), - _area(), - _tileLocator() +: Inherit(), + _region(NULL), + _area(), + _tileLocator() { } Region_VoidBoxesUnder::Locator::Locator(const Region* region, const Box& area) // *************************************************************************** -: Inherit(), - _region(region), - _area(area), - _tileLocator() +: Inherit(), + _region(region), + _area(area), + _tileLocator() { - if (_region) { - _tileLocator = - (_area.IsEmpty()) ? - _region->_GetTiles().GetSubSet(Region_Tile::GetIsVoidFilter()).GetLocator() : - _region->_GetTilesUnder(_area).GetSubSet(Region_Tile::GetIsVoidFilter()).GetLocator(); - } + if (_region) { + _tileLocator = + (_area.isEmpty()) ? + _region->_GetTiles().GetSubSet(Region_Tile::GetIsVoidFilter()).GetLocator() : + _region->_GetTilesUnder(_area).GetSubSet(Region_Tile::GetIsVoidFilter()).GetLocator(); + } } Region_VoidBoxesUnder::Locator::Locator(const Locator& locator) // ************************************************************ -: Inherit(), - _region(locator._region), - _area(locator._area), - _tileLocator(locator._tileLocator) +: Inherit(), + _region(locator._region), + _area(locator._area), + _tileLocator(locator._tileLocator) { } Region_VoidBoxesUnder::Locator& Region_VoidBoxesUnder::Locator::operator=(const Locator& locator) // ********************************************************************************************** { - _region = locator._region; - _area = locator._area; - _tileLocator = locator._tileLocator; - return *this; + _region = locator._region; + _area = locator._area; + _tileLocator = locator._tileLocator; + return *this; } Box Region_VoidBoxesUnder::Locator::GetElement() const // *************************************************** { - return (_tileLocator.IsValid()) ? _tileLocator.GetElement()->GetBoundingBox() : Box(); + return (_tileLocator.IsValid()) ? _tileLocator.GetElement()->GetBoundingBox() : Box(); } Locator* Region_VoidBoxesUnder::Locator::GetClone() const // *********************************************************** { - return new Locator(*this); + return new Locator(*this); } bool Region_VoidBoxesUnder::Locator::IsValid() const // ************************************************* { - return _tileLocator.IsValid(); + return _tileLocator.IsValid(); } void Region_VoidBoxesUnder::Locator::Progress() // ******************************************** { - _tileLocator.Progress(); + _tileLocator.Progress(); } string Region_VoidBoxesUnder::Locator::_GetString() const // ****************************************************** { - string s = "<" + _TName("Region::VoidBoxesUnder::Locator"); - if (_region) { - s += " " + GetString(_region); - s += " " + GetString(_area); - } - s += ">"; - return s; + string s = "<" + _TName("Region::VoidBoxesUnder::Locator"); + if (_region) { + s += " " + GetString(_region); + s += " " + GetString(_area); + } + s += ">"; + return s; } @@ -1890,59 +1890,59 @@ class Region_Intervals : public Collection { // Types // ***** - public: typedef Collection Inherit; + public: typedef Collection Inherit; - public: class Locator : public Hurricane::Locator { - // ******************************************************** + public: class Locator : public Hurricane::Locator { + // ******************************************************** - public: typedef Hurricane::Locator Inherit; + public: typedef Hurricane::Locator Inherit; - private: const Region::SwapLine* _swapLine; - private: Region::Tile* _lowerTile; - private: Region::Tile* _upperTile; + private: const Region::SwapLine* _swapLine; + private: Region::Tile* _lowerTile; + private: Region::Tile* _upperTile; - public: Locator(const Region::SwapLine* swapLine = NULL); - public: Locator(const Locator& locator); + public: Locator(const Region::SwapLine* swapLine = NULL); + public: Locator(const Locator& locator); - public: Locator& operator=(const Locator& locator); + public: Locator& operator=(const Locator& locator); - public: virtual Interval GetElement() const; - public: virtual Hurricane::Locator* GetClone() const; + public: virtual Interval GetElement() const; + public: virtual Hurricane::Locator* GetClone() const; - public: virtual bool IsValid() const; + public: virtual bool IsValid() const; - public: virtual void Progress(); + public: virtual void Progress(); - public: virtual string _GetString() const; + public: virtual string _GetString() const; - }; + }; // Attributes // ********** - private: const Region::SwapLine* _swapLine; + private: const Region::SwapLine* _swapLine; // Constructors // ************ - public: Region_Intervals(const Region::SwapLine* swapLine = NULL); - public: Region_Intervals(const Region_Intervals& intervals); + public: Region_Intervals(const Region::SwapLine* swapLine = NULL); + public: Region_Intervals(const Region_Intervals& intervals); // Operators // ********* - public: Region_Intervals& operator=(const Region_Intervals& intervals); + public: Region_Intervals& operator=(const Region_Intervals& intervals); // Accessors // ********* - public: virtual Collection* GetClone() const; - public: virtual Hurricane::Locator* GetLocator() const; + public: virtual Collection* GetClone() const; + public: virtual Hurricane::Locator* GetLocator() const; // Others // ****** - public: virtual string _GetString() const; + public: virtual string _GetString() const; }; @@ -1954,44 +1954,44 @@ class Region_Intervals : public Collection { Region_Intervals::Region_Intervals(const Region::SwapLine* swapLine) // ***************************************************************** -: Inherit(), - _swapLine(swapLine) +: Inherit(), + _swapLine(swapLine) { } Region_Intervals::Region_Intervals(const Region_Intervals& intervals) // ****************************************************************** -: Inherit(), - _swapLine(intervals._swapLine) +: Inherit(), + _swapLine(intervals._swapLine) { } Region_Intervals& Region_Intervals::operator=(const Region_Intervals& intervals) // ***************************************************************************** { - _swapLine = intervals._swapLine; - return *this; + _swapLine = intervals._swapLine; + return *this; } Collection* Region_Intervals::GetClone() const // ***************************************************** { - return new Region_Intervals(*this); + return new Region_Intervals(*this); } Locator* Region_Intervals::GetLocator() const // **************************************************** { - return new Locator(_swapLine); + return new Locator(_swapLine); } string Region_Intervals::_GetString() const // **************************************** { - string s = "<" + _TName("Region::SwapLine::Intervals"); - if (_swapLine) s += " " + GetString(_swapLine); - s += ">"; - return s; + string s = "<" + _TName("Region::SwapLine::Intervals"); + if (_swapLine) s += " " + GetString(_swapLine); + s += ">"; + return s; } @@ -2002,153 +2002,153 @@ string Region_Intervals::_GetString() const Region_Intervals::Locator::Locator(const Region::SwapLine* swapLine) // ***************************************************************** -: Inherit(), - _swapLine(swapLine), - _lowerTile(NULL), - _upperTile(NULL) +: Inherit(), + _swapLine(swapLine), + _lowerTile(NULL), + _upperTile(NULL) { - if (_swapLine) { - switch (_swapLine->GetType()) { - case Region::SwapLine::Type::VERTICAL : { - Unit x = _swapLine->GetPosition(); - Unit yMax = _swapLine->GetExtention().GetVMax(); - _lowerTile = _swapLine->_GetBaseTile(); - while (_lowerTile && _lowerTile->IsVoid()) - _lowerTile = _lowerTile->GetTopTile(x); - if (_lowerTile && (yMax < _lowerTile->GetYMin())) _lowerTile = NULL; - if (_lowerTile) { - Region::Tile* tile = _lowerTile; - while (tile && !tile->IsVoid()) { - _upperTile = tile; - tile = tile->GetTopTile(x); - if (tile && (yMax < tile->GetYMin())) tile = NULL; - } - } - break; - } - case Region::SwapLine::Type::HORIZONTAL : { - Unit y = _swapLine->GetPosition(); - Unit xMax = _swapLine->GetExtention().GetVMax(); - _lowerTile = _swapLine->_GetBaseTile(); - while (_lowerTile && _lowerTile->IsVoid()) - _lowerTile = _lowerTile->GetRightTile(y); - if (_lowerTile && (xMax < _lowerTile->GetXMin())) _lowerTile = NULL; - if (_lowerTile) { - Region::Tile* tile = _lowerTile; - while (tile && !tile->IsVoid()) { - _upperTile = tile; - tile = tile->GetRightTile(y); - if (tile && (xMax < tile->GetXMin())) tile = NULL; - } - } - break; - } - } - } + if (_swapLine) { + switch (_swapLine->GetType()) { + case Region::SwapLine::Type::VERTICAL : { + Unit x = _swapLine->GetPosition(); + Unit yMax = _swapLine->GetExtention().GetVMax(); + _lowerTile = _swapLine->_GetBaseTile(); + while (_lowerTile && _lowerTile->IsVoid()) + _lowerTile = _lowerTile->GetTopTile(x); + if (_lowerTile && (yMax < _lowerTile->GetYMin())) _lowerTile = NULL; + if (_lowerTile) { + Region::Tile* tile = _lowerTile; + while (tile && !tile->IsVoid()) { + _upperTile = tile; + tile = tile->GetTopTile(x); + if (tile && (yMax < tile->GetYMin())) tile = NULL; + } + } + break; + } + case Region::SwapLine::Type::HORIZONTAL : { + Unit y = _swapLine->GetPosition(); + Unit xMax = _swapLine->GetExtention().GetVMax(); + _lowerTile = _swapLine->_GetBaseTile(); + while (_lowerTile && _lowerTile->IsVoid()) + _lowerTile = _lowerTile->GetRightTile(y); + if (_lowerTile && (xMax < _lowerTile->GetXMin())) _lowerTile = NULL; + if (_lowerTile) { + Region::Tile* tile = _lowerTile; + while (tile && !tile->IsVoid()) { + _upperTile = tile; + tile = tile->GetRightTile(y); + if (tile && (xMax < tile->GetXMin())) tile = NULL; + } + } + break; + } + } + } } Region_Intervals::Locator::Locator(const Locator& locator) // ******************************************************* -: Inherit(), - _swapLine(locator._swapLine), - _lowerTile(locator._lowerTile), - _upperTile(locator._upperTile) +: Inherit(), + _swapLine(locator._swapLine), + _lowerTile(locator._lowerTile), + _upperTile(locator._upperTile) { } Region_Intervals::Locator& Region_Intervals::Locator::operator=(const Locator& locator) // ************************************************************************************ { - _swapLine = locator._swapLine; - _lowerTile = locator._lowerTile; - _upperTile = locator._upperTile; - return *this; + _swapLine = locator._swapLine; + _lowerTile = locator._lowerTile; + _upperTile = locator._upperTile; + return *this; } Interval Region_Intervals::Locator::GetElement() const // *************************************************** { - if (!IsValid()) return Interval(); + if (!IsValid()) return Interval(); - Interval interval; - switch (_swapLine->GetType()) { - case Region::SwapLine::Type::VERTICAL : { - interval = Interval(_lowerTile->GetYMin(), _upperTile->GetYMax()); - break; - } - case Region::SwapLine::Type::HORIZONTAL : { - interval = Interval(_lowerTile->GetXMin(), _upperTile->GetXMax()); - break; - } - } + Interval interval; + switch (_swapLine->GetType()) { + case Region::SwapLine::Type::VERTICAL : { + interval = Interval(_lowerTile->GetYMin(), _upperTile->GetYMax()); + break; + } + case Region::SwapLine::Type::HORIZONTAL : { + interval = Interval(_lowerTile->GetXMin(), _upperTile->GetXMax()); + break; + } + } - return interval.GetIntersection(_swapLine->GetExtention()); + return interval.GetIntersection(_swapLine->GetExtention()); } Locator* Region_Intervals::Locator::GetClone() const // *********************************************************** { - return new Locator(*this); + return new Locator(*this); } bool Region_Intervals::Locator::IsValid() const // ******************************************** { - return (_lowerTile && _upperTile); + return (_lowerTile && _upperTile); } void Region_Intervals::Locator::Progress() // *************************************** { - if (IsValid()) { - switch (_swapLine->GetType()) { - case Region::SwapLine::Type::VERTICAL : { - Unit x = _swapLine->GetPosition(); - Unit yMax = _swapLine->GetExtention().GetVMax(); - _lowerTile = _upperTile->GetTopTile(x); - while (_lowerTile && _lowerTile->IsVoid()) - _lowerTile = _lowerTile->GetTopTile(x); - if (_lowerTile && (yMax < _lowerTile->GetYMin())) _lowerTile = NULL; - _upperTile = NULL; - if (_lowerTile) { - Region::Tile* tile = _lowerTile; - while (tile && !tile->IsVoid()) { - _upperTile = tile; - tile = tile->GetTopTile(x); - if (tile && (yMax < tile->GetYMin())) tile = NULL; - } - } - break; - } - case Region::SwapLine::Type::HORIZONTAL : { - Unit y = _swapLine->GetPosition(); - Unit xMax = _swapLine->GetExtention().GetVMax(); - _lowerTile = _upperTile->GetRightTile(y); - while (_lowerTile && _lowerTile->IsVoid()) - _lowerTile = _lowerTile->GetRightTile(y); - if (_lowerTile && (xMax < _lowerTile->GetXMin())) _lowerTile = NULL; - _upperTile = NULL; - if (_lowerTile) { - Region::Tile* tile = _lowerTile; - while (tile && !tile->IsVoid()) { - _upperTile = tile; - tile = tile->GetRightTile(y); - if (tile && (xMax < tile->GetXMin())) tile = NULL; - } - } - break; - } - } - } + if (IsValid()) { + switch (_swapLine->GetType()) { + case Region::SwapLine::Type::VERTICAL : { + Unit x = _swapLine->GetPosition(); + Unit yMax = _swapLine->GetExtention().GetVMax(); + _lowerTile = _upperTile->GetTopTile(x); + while (_lowerTile && _lowerTile->IsVoid()) + _lowerTile = _lowerTile->GetTopTile(x); + if (_lowerTile && (yMax < _lowerTile->GetYMin())) _lowerTile = NULL; + _upperTile = NULL; + if (_lowerTile) { + Region::Tile* tile = _lowerTile; + while (tile && !tile->IsVoid()) { + _upperTile = tile; + tile = tile->GetTopTile(x); + if (tile && (yMax < tile->GetYMin())) tile = NULL; + } + } + break; + } + case Region::SwapLine::Type::HORIZONTAL : { + Unit y = _swapLine->GetPosition(); + Unit xMax = _swapLine->GetExtention().GetVMax(); + _lowerTile = _upperTile->GetRightTile(y); + while (_lowerTile && _lowerTile->IsVoid()) + _lowerTile = _lowerTile->GetRightTile(y); + if (_lowerTile && (xMax < _lowerTile->GetXMin())) _lowerTile = NULL; + _upperTile = NULL; + if (_lowerTile) { + Region::Tile* tile = _lowerTile; + while (tile && !tile->IsVoid()) { + _upperTile = tile; + tile = tile->GetRightTile(y); + if (tile && (xMax < tile->GetXMin())) tile = NULL; + } + } + break; + } + } + } } string Region_Intervals::Locator::_GetString() const // ************************************************* { - string s = "<" + _TName("Region::SwapLine::Intervals::Locator"); - if (_swapLine) s += " " + GetString(_swapLine); - s += ">"; - return s; + string s = "<" + _TName("Region::SwapLine::Intervals::Locator"); + if (_swapLine) s += " " + GetString(_swapLine); + s += ">"; + return s; } @@ -2159,39 +2159,39 @@ string Region_Intervals::Locator::_GetString() const Region::SwapLine::Type::Type(const Code& code) // ******************************************* -: _code(code) +: _code(code) { } Region::SwapLine::Type::Type(const Type& type) // ******************************************* -: _code(type._code) +: _code(type._code) { } Region::SwapLine::Type& Region::SwapLine::Type::operator=(const Type& type) // ************************************************************************ { - _code = type._code; - return *this; + _code = type._code; + return *this; } string Region::SwapLine::Type::_GetString() const // ********************************************** { - switch (_code) { - case VERTICAL : return "VERTICAL"; - case HORIZONTAL : return "HORIZONTAL"; - } - return "ABNORMAL"; + switch (_code) { + case VERTICAL : return "VERTICAL"; + case HORIZONTAL : return "HORIZONTAL"; + } + return "ABNORMAL"; } Record* Region::SwapLine::Type::_GetRecord() const // ***************************************** { - Record* record = new Record(GetString(this)); - record->Add ( GetSlot ( "Code", ((unsigned int*)((void*)&_code)) ) ); - return record; + Record* record = new Record(GetString(this)); + record->Add ( GetSlot ( "Code", ((unsigned int*)((void*)&_code)) ) ); + return record; } @@ -2202,77 +2202,77 @@ Record* Region::SwapLine::Type::_GetRecord() const Region::SwapLine::SwapLine() // ************************* -: _region(NULL), - _type(), - _position(), - _extention(), - _baseTile(NULL) +: _region(NULL), + _type(), + _position(), + _extention(), + _baseTile(NULL) { } Region::SwapLine::SwapLine(Region* region, const Type& type, const Interval& extention) // ************************************************************************************ -: _region(region), - _type(type), - _position(), - _extention(extention), - _baseTile(NULL) +: _region(region), + _type(type), + _position(), + _extention(extention), + _baseTile(NULL) { - if (!_region) - throw Error("Can't create " + _TName("Region::SwapLine") + " : null region"); + if (!_region) + throw Error("Can't create " + _TName("Region::SwapLine") + " : null region"); - if (!_region->IsEmpty()) { - switch (_type) { - case Type::VERTICAL : { - _position = _region->GetXMin(); - if (_extention.IsEmpty()) _extention = Interval(_region->GetYMin(), _region->GetYMax()); - _baseTile = _region->_GetTileAt(Point(_position, _extention.GetVMin())); - break; - } - case Type::HORIZONTAL : { - _position = _region->GetYMin(); - if (_extention.IsEmpty()) _extention = Interval(_region->GetXMin(), _region->GetXMax()); - _baseTile = _region->_GetTileAt(Point(_extention.GetVMin(), _position)); - break; - } - } - } + if (!_region->IsEmpty()) { + switch (_type) { + case Type::VERTICAL : { + _position = _region->GetXMin(); + if (_extention.IsEmpty()) _extention = Interval(_region->GetYMin(), _region->GetYMax()); + _baseTile = _region->_GetTileAt(Point(_position, _extention.GetVMin())); + break; + } + case Type::HORIZONTAL : { + _position = _region->GetYMin(); + if (_extention.IsEmpty()) _extention = Interval(_region->GetXMin(), _region->GetXMax()); + _baseTile = _region->_GetTileAt(Point(_extention.GetVMin(), _position)); + break; + } + } + } } Region::SwapLine::SwapLine(Region* region, const Type& type, const Unit& position, const Interval& extention) // **************************************************************************************************** -: _region(region), - _type(type), - _position(position), - _extention(extention), - _baseTile(NULL) +: _region(region), + _type(type), + _position(position), + _extention(extention), + _baseTile(NULL) { - if (!_region) - throw Error("Can't create " + _TName("Region::SwapLine") + " : null region"); + if (!_region) + throw Error("Can't create " + _TName("Region::SwapLine") + " : null region"); - if (!_region->IsEmpty()) { - switch (_type) { - case Type::VERTICAL : { - if (_extention.IsEmpty()) _extention = Interval(_region->GetYMin(), _region->GetYMax()); - _baseTile = _region->_GetTileAt(Point(_position, _extention.GetVMin())); - break; - } - case Type::HORIZONTAL : { - if (_extention.IsEmpty()) _extention = Interval(_region->GetXMin(), _region->GetXMax()); - _baseTile = _region->_GetTileAt(Point(_extention.GetVMin(), _position)); - break; - } - } - } + if (!_region->IsEmpty()) { + switch (_type) { + case Type::VERTICAL : { + if (_extention.IsEmpty()) _extention = Interval(_region->GetYMin(), _region->GetYMax()); + _baseTile = _region->_GetTileAt(Point(_position, _extention.GetVMin())); + break; + } + case Type::HORIZONTAL : { + if (_extention.IsEmpty()) _extention = Interval(_region->GetXMin(), _region->GetXMax()); + _baseTile = _region->_GetTileAt(Point(_extention.GetVMin(), _position)); + break; + } + } + } } Region::SwapLine::SwapLine(const SwapLine& swapLine) // ************************************************* -: _region(swapLine._region), - _type(swapLine._type), - _position(swapLine._position), - _extention(swapLine._extention), - _baseTile(swapLine._baseTile) +: _region(swapLine._region), + _type(swapLine._type), + _position(swapLine._position), + _extention(swapLine._extention), + _baseTile(swapLine._baseTile) { } @@ -2284,138 +2284,138 @@ Region::SwapLine::~SwapLine() Region::SwapLine& Region::SwapLine::operator=(const SwapLine& swapLine) // ******************************************************************** { - _region = swapLine._region; - _type = swapLine._type; - _position = swapLine._position; - _extention = swapLine._extention; - _baseTile = swapLine._baseTile; - return *this; + _region = swapLine._region; + _type = swapLine._type; + _position = swapLine._position; + _extention = swapLine._extention; + _baseTile = swapLine._baseTile; + return *this; } Intervals Region::SwapLine::GetIntervals() const // ********************************************* { - return Region_Intervals(this); + return Region_Intervals(this); } void Region::SwapLine::Progress(int n) - // *************************** + // *************************** { - if (IsValid() && n) { - if (0 < n) { - switch (_type) { - case Type::VERTICAL : { - while (n--) { - Unit yMin = GetExtention().GetVMin(); - Unit yMax = GetExtention().GetVMax(); - Unit x = _region->GetXMax() + 1; - Region::Tile* tile = _baseTile; - while (tile) { - if (_position < tile->GetXMax()) - x = min(tile->GetXMax(), x); - else { - assert(tile->GetXMax() == _position); - Region::Tile* rightTile = tile->_rightTile; - while (rightTile && (yMax < rightTile->GetYMin())) - rightTile = rightTile->_bottomTile; - while (rightTile && (yMin < rightTile->GetYMax())) { - x = min(rightTile->GetXMax(), x); - rightTile = rightTile->_bottomTile; - } - } - tile = tile->GetTopTile(_position); - if (tile && (yMax < tile->GetYMin())) tile = NULL; - } - _position = x; - while (_baseTile && (_baseTile->GetXMax() <= x)) - _baseTile = _baseTile->GetRightTile(yMin); - } - break; - } - case Type::HORIZONTAL : { - while (n--) { - Unit xMin = GetExtention().GetVMin(); - Unit xMax = GetExtention().GetVMax(); - Unit y = _region->GetYMax() + 1; - Region::Tile* tile = _baseTile; - while (tile) { - if (_position < tile->GetYMax()) - y = min(tile->GetYMax(), y); - else { - assert(tile->GetYMax() == _position); - Region::Tile* topTile = tile->_topTile; - while (topTile && (xMax < topTile->GetXMin())) - topTile = topTile->_leftTile; - while (topTile && (xMin < topTile->GetXMax())) { - y = min(topTile->GetYMax(), y); - topTile = topTile->_leftTile; - } - } - tile = tile->GetRightTile(_position); - if (tile && (xMax < tile->GetXMin())) tile = NULL; - } - _position = y; - while (_baseTile && (_baseTile->GetYMax() <= y)) - _baseTile = _baseTile->GetTopTile(xMin); - } - break; - } - } - } - else { - throw Error("SORRY, NOT IMPLEMENTED TODAY !"); - } - } + if (IsValid() && n) { + if (0 < n) { + switch (_type) { + case Type::VERTICAL : { + while (n--) { + Unit yMin = GetExtention().GetVMin(); + Unit yMax = GetExtention().GetVMax(); + Unit x = _region->GetXMax() + 1; + Region::Tile* tile = _baseTile; + while (tile) { + if (_position < tile->GetXMax()) + x = min(tile->GetXMax(), x); + else { + assert(tile->GetXMax() == _position); + Region::Tile* rightTile = tile->_rightTile; + while (rightTile && (yMax < rightTile->GetYMin())) + rightTile = rightTile->_bottomTile; + while (rightTile && (yMin < rightTile->GetYMax())) { + x = min(rightTile->GetXMax(), x); + rightTile = rightTile->_bottomTile; + } + } + tile = tile->GetTopTile(_position); + if (tile && (yMax < tile->GetYMin())) tile = NULL; + } + _position = x; + while (_baseTile && (_baseTile->GetXMax() <= x)) + _baseTile = _baseTile->GetRightTile(yMin); + } + break; + } + case Type::HORIZONTAL : { + while (n--) { + Unit xMin = GetExtention().GetVMin(); + Unit xMax = GetExtention().GetVMax(); + Unit y = _region->GetYMax() + 1; + Region::Tile* tile = _baseTile; + while (tile) { + if (_position < tile->GetYMax()) + y = min(tile->GetYMax(), y); + else { + assert(tile->GetYMax() == _position); + Region::Tile* topTile = tile->_topTile; + while (topTile && (xMax < topTile->GetXMin())) + topTile = topTile->_leftTile; + while (topTile && (xMin < topTile->GetXMax())) { + y = min(topTile->GetYMax(), y); + topTile = topTile->_leftTile; + } + } + tile = tile->GetRightTile(_position); + if (tile && (xMax < tile->GetXMin())) tile = NULL; + } + _position = y; + while (_baseTile && (_baseTile->GetYMax() <= y)) + _baseTile = _baseTile->GetTopTile(xMin); + } + break; + } + } + } + else { + throw Error("SORRY, NOT IMPLEMENTED TODAY !"); + } + } } void Region::SwapLine::Translate(const Unit& quantity) // *************************************************** { - if (quantity) SetPosition(GetPosition() + quantity); + if (quantity) SetPosition(GetPosition() + quantity); } void Region::SwapLine::SetPosition(const Unit& position) // ***************************************************** { - if (position != _position) { - _position = position; - switch (_type) { - case Type::VERTICAL : { - _baseTile = _region->_GetTileAt(Point(_position, _extention.GetVMin())); - break; - } - case Type::HORIZONTAL : { - _baseTile = _region->_GetTileAt(Point(_extention.GetVMin(), _position)); - break; - } - } - } + if (position != _position) { + _position = position; + switch (_type) { + case Type::VERTICAL : { + _baseTile = _region->_GetTileAt(Point(_position, _extention.GetVMin())); + break; + } + case Type::HORIZONTAL : { + _baseTile = _region->_GetTileAt(Point(_extention.GetVMin(), _position)); + break; + } + } + } } string Region::SwapLine::_GetString() const // **************************************** { - string s = "<" + _GetTypeName() + ">"; - if (IsValid()) { - s.insert(s.length() - 1, " " + GetString(_type)); - s.insert(s.length() - 1, " " + GetString(_position)); - s.insert(s.length() - 1, " " + GetString(_extention)); - } - return s; + string s = "<" + _GetTypeName() + ">"; + if (IsValid()) { + s.insert(s.length() - 1, " " + GetString(_type)); + s.insert(s.length() - 1, " " + GetString(_position)); + s.insert(s.length() - 1, " " + GetString(_extention)); + } + return s; } Record* Region::SwapLine::_GetRecord() const // *********************************** { - Record* record = new Record(GetString(this)); - if (record) { - record->Add(GetSlot("Region", _region)); - record->Add(GetSlot("Type", &_type)); - record->Add(GetSlot("Position", &_position)); - record->Add(GetSlot("Extention", &_extention)); - record->Add(GetSlot("BaseTile", _baseTile)); - } - return record; + Record* record = new Record(GetString(this)); + if (record) { + record->Add(GetSlot("Region", _region)); + record->Add(GetSlot("Type", &_type)); + record->Add(GetSlot("Position", &_position)); + record->Add(GetSlot("Extention", &_extention)); + record->Add(GetSlot("BaseTile", _baseTile)); + } + return record; } @@ -2426,580 +2426,580 @@ Record* Region::SwapLine::_GetRecord() const Region::Region() // ************* -: _bottomRightTile(NULL), - _topLeftTile(NULL) +: _bottomRightTile(NULL), + _topLeftTile(NULL) { } Region::Region(const Box& box, bool isVoid) // **************************************** { - _bottomRightTile = new Tile(box, isVoid); - _topLeftTile = _bottomRightTile; + _bottomRightTile = new Tile(box, isVoid); + _topLeftTile = _bottomRightTile; } Region::Region(const Region& region) // ********************************* { - // keep trace (as void tile) of the initial bounding box - Box initialBoundingBox = region.GetBoundingBox(); - if (! initialBoundingBox.IsEmpty()) { - _bottomRightTile = new Tile(region.GetBoundingBox(), true); - _topLeftTile = _bottomRightTile; - for_each_box(box, region.GetBoxes()) { - Fill(box); - end_for; - } - } + // keep trace (as void tile) of the initial bounding box + Box initialBoundingBox = region.GetBoundingBox(); + if (! initialBoundingBox.isEmpty()) { + _bottomRightTile = new Tile(region.GetBoundingBox(), true); + _topLeftTile = _bottomRightTile; + for_each_box(box, region.GetBoxes()) { + Fill(box); + end_for; + } + } } Region::~Region() // ************** { - Clear(); + Clear(); } Region& Region::operator=(const Region& region) // ******************************************** { - Clear(); - // keep trace (as void tile) of the initial bounding box - Box initialBoundingBox = region.GetBoundingBox(); - if (! initialBoundingBox.IsEmpty()) { - _bottomRightTile = new Tile (initialBoundingBox, true); - _topLeftTile = _bottomRightTile; - for_each_box(box, region.GetBoxes()) { - Fill(box); - end_for; - } - } - return *this; + Clear(); + // keep trace (as void tile) of the initial bounding box + Box initialBoundingBox = region.GetBoundingBox(); + if (! initialBoundingBox.isEmpty()) { + _bottomRightTile = new Tile (initialBoundingBox, true); + _topLeftTile = _bottomRightTile; + for_each_box(box, region.GetBoxes()) { + Fill(box); + end_for; + } + } + return *this; } Box Region::GetBoundingBox() const // ******************************* { - Box boundingBox; - if (_bottomRightTile) boundingBox = _bottomRightTile->GetBoundingBox(); - if (_topLeftTile) boundingBox.Merge(_topLeftTile->GetBoundingBox()); - return boundingBox; + Box boundingBox; + if (_bottomRightTile) boundingBox = _bottomRightTile->GetBoundingBox(); + if (_topLeftTile) boundingBox.merge(_topLeftTile->GetBoundingBox()); + return boundingBox; } Unit Region::GetXMin() const // ************************* { - return (_topLeftTile) ? _topLeftTile->GetXMin() : Unit(); + return (_topLeftTile) ? _topLeftTile->GetXMin() : Unit(); } Unit Region::GetYMin() const // ************************* { - return (_bottomRightTile) ? _bottomRightTile->GetYMin() : Unit(); + return (_bottomRightTile) ? _bottomRightTile->GetYMin() : Unit(); } Unit Region::GetXMax() const // ************************* { - return (_bottomRightTile) ? _bottomRightTile->GetXMax() : Unit(); + return (_bottomRightTile) ? _bottomRightTile->GetXMax() : Unit(); } Unit Region::GetYMax() const // ************************* { - return (_topLeftTile) ? _topLeftTile->GetYMax() : Unit(); + return (_topLeftTile) ? _topLeftTile->GetYMax() : Unit(); } Boxes Region::GetBoxes() const // *************************** { - return Region_BoxesUnder(this); + return Region_BoxesUnder(this); } Boxes Region::GetBoxesUnder(const Box& area) const // *********************************************** { - return Region_BoxesUnder(this, area); + return Region_BoxesUnder(this, area); } Boxes Region::GetVoidBoxes() const // ******************************* { - return Region_VoidBoxesUnder(this); + return Region_VoidBoxesUnder(this); } Boxes Region::GetVoidBoxesUnder(const Box& area) const // *************************************************** { - return Region_VoidBoxesUnder(this, area); + return Region_VoidBoxesUnder(this, area); } Region::SwapLine Region::GetVerticalSwapLine(const Interval& extention) const // ************************************************************************** { - return SwapLine((Region*)this, Region::SwapLine::Type::VERTICAL, extention); + return SwapLine((Region*)this, Region::SwapLine::Type::VERTICAL, extention); } Region::SwapLine Region::GetVerticalSwapLine(const Unit& x, const Interval& extention) const // ***************************************************************************************** { - return SwapLine((Region*)this, Region::SwapLine::Type::VERTICAL, x, extention); + return SwapLine((Region*)this, Region::SwapLine::Type::VERTICAL, x, extention); } Region::SwapLine Region::GetHorizontalSwapLine(const Interval& extention) const // **************************************************************************** { - return SwapLine((Region*)this, Region::SwapLine::Type::HORIZONTAL, extention); + return SwapLine((Region*)this, Region::SwapLine::Type::HORIZONTAL, extention); } Region::SwapLine Region::GetHorizontalSwapLine(const Unit& y, const Interval& extention) const // ******************************************************************************************* { - return SwapLine((Region*)this, Region::SwapLine::Type::HORIZONTAL, y, extention); + return SwapLine((Region*)this, Region::SwapLine::Type::HORIZONTAL, y, extention); } bool Region::IsEmpty() const // ************************* { - return Region_Tiles(this).GetSubSet(!Tile::GetIsVoidFilter()).IsEmpty(); + return Region_Tiles(this).GetSubSet(!Tile::GetIsVoidFilter()).IsEmpty(); } bool Region::Contains(const Point& point) const // ******************************************** { - return GetBoundingBox().Contains(point) && _GetNonVoidTileAt(point); + return GetBoundingBox().contains(point) && _GetNonVoidTileAt(point); } bool Region::Contains(const Box& box) const // **************************************** { - if (box.IsPonctual()) return Contains(box.GetCenter()); - return GetBoundingBox().Contains(box) && - Region_TilesUnder (this, Box(box).Inflate(-1)) - .GetSubSet(Tile::GetIsVoidFilter()).IsEmpty(); + if (box.isPonctual()) return Contains(box.getCenter()); + return GetBoundingBox().contains(box) && + Region_TilesUnder (this, Box(box).inflate(-1)) + .GetSubSet(Tile::GetIsVoidFilter()).IsEmpty(); } bool Region::Contains(const Region& region) const // ********************************************** { - for_each_box(box, region.GetBoxesUnder(GetBoundingBox())) { - if (!Contains(box)) return false; - end_for; - } - return true; + for_each_box(box, region.GetBoxesUnder(GetBoundingBox())) { + if (!Contains(box)) return false; + end_for; + } + return true; } -#if 0 // pas encore teste +#if 0 // pas encore teste bool Region::Intersect(const Box& box) const // ***************************************** { - if (box.IsPonctual()) return Contains(box.GetCenter()); - if (! GetBoundingBox().Intersect(box)) return false; - if (! Region_TilesUnder (this, Box(box).Inflate(1)) - .GetSubSet(! Tile::GetIsVoidFilter()).IsEmpty()) return true; - return false; + if (box.isPonctual()) return contains(box.getCenter()); + if (! GetBoundingBox().Intersect(box)) return false; + if (! Region_TilesUnder (this, Box(box).inflate(1)) + .GetSubSet(! Tile::GetIsVoidFilter()).IsEmpty()) return true; + return false; } bool Region::Intersect(const Region& region) const // *********************************************** { - for_each_box(box, region.GetBoxesUnder(GetBoundingBox())) { - if (Intersect(box)) return true; - end_for; - } - return false; + for_each_box(box, region.GetBoxesUnder(GetBoundingBox())) { + if (Intersect(box)) return true; + end_for; + } + return false; } #endif Region& Region::Clear() // ******************** { - stack tileStack; + stack tileStack; - Tile* tile = _bottomRightTile; - while (tile) { - tileStack.push(tile); - tile = tile->_leftTile; - } - // AD (11Aug03) to avoid delete Tiles in the while loop, because - // topTile->_leftTile may have been already deleted - vector accumulate; + Tile* tile = _bottomRightTile; + while (tile) { + tileStack.push(tile); + tile = tile->_leftTile; + } + // AD (11Aug03) to avoid delete Tiles in the while loop, because + // topTile->_leftTile may have been already deleted + vector accumulate; - while (!tileStack.empty()) { - tile = tileStack.top(); - tileStack.pop(); - Unit xMin = tile->GetXMin(); - Unit xMax = tile->GetXMax(); + while (!tileStack.empty()) { + tile = tileStack.top(); + tileStack.pop(); + Unit xMin = tile->GetXMin(); + Unit xMax = tile->GetXMax(); - Tile* topTile = tile->_topTile; - while (topTile && (xMin < topTile->GetXMax())) { - if (topTile->GetXMax() <= xMax) tileStack.push(topTile); - topTile = topTile->_leftTile; - } - accumulate.push_back (tile); - //delete tile; - } - for_each_object (Tile*, t, GetCollection (accumulate)) { - delete t; - end_for; - } - _bottomRightTile = NULL; - _topLeftTile = NULL; + Tile* topTile = tile->_topTile; + while (topTile && (xMin < topTile->GetXMax())) { + if (topTile->GetXMax() <= xMax) tileStack.push(topTile); + topTile = topTile->_leftTile; + } + accumulate.push_back (tile); + //delete tile; + } + for_each_object (Tile*, t, GetCollection (accumulate)) { + delete t; + end_for; + } + _bottomRightTile = NULL; + _topLeftTile = NULL; - return *this; + return *this; } Region& Region::Fill(const Box& box) // ********************************* { - if (box.IsEmpty() || !box.GetWidth() || !box.GetHeight()) return *this; + if (box.isEmpty() || !box.getWidth() || !box.getHeight()) return *this; - if (!_bottomRightTile) { - _bottomRightTile = new Tile(box); - _topLeftTile = _bottomRightTile; - return *this; - } + if (!_bottomRightTile) { + _bottomRightTile = new Tile(box); + _topLeftTile = _bottomRightTile; + return *this; + } - if (!GetBoundingBox().Contains(box)) - _Update(box, false); - else { - Tile* startTile = _GetStartTile(_GetTileAt(Point(box.GetXMax(), box.GetYMin()))); - GenericCollection tiles = _GetTilesUnder(Box(box).Inflate(0, 0, -1, -1), startTile); - if (!tiles.GetSubSet(Tile::GetIsVoidFilter()).IsEmpty()) _Update(box, false, startTile); - } + if (!GetBoundingBox().contains(box)) + _Update(box, false); + else { + Tile* startTile = _GetStartTile(_GetTileAt(Point(box.getXMax(), box.getYMin()))); + GenericCollection tiles = _GetTilesUnder(Box(box).inflate(0, 0, -1, -1), startTile); + if (!tiles.GetSubSet(Tile::GetIsVoidFilter()).IsEmpty()) _Update(box, false, startTile); + } - return *this; + return *this; } Region& Region::Fill(const Region& region) // *************************************** { - for_each_box(box, region.GetBoxes()) { - Fill(box); - end_for; - } - return *this; + for_each_box(box, region.GetBoxes()) { + Fill(box); + end_for; + } + return *this; } Region& Region::GetUnion (const Region& region) // ******************************************** { - return Fill(region); + return Fill(region); } Region& Region::Groove(const Box& box) // *********************************** { - if (!_bottomRightTile) return *this; + if (!_bottomRightTile) return *this; - Box correctedBox = GetBoundingBox().GetIntersection(box); + Box correctedBox = GetBoundingBox().getIntersection(box); - if (correctedBox.IsEmpty() || !correctedBox.GetWidth() || !correctedBox.GetHeight()) return *this; + if (correctedBox.isEmpty() || !correctedBox.getWidth() || !correctedBox.getHeight()) return *this; - Tile* startTile = _GetStartTile(_GetTileAt(Point(correctedBox.GetXMax(), correctedBox.GetYMin()))); - GenericCollection tiles = _GetTilesUnder(Box(correctedBox).Inflate(0, 0, -1, -1), startTile); - if (!tiles.GetSubSet(!Tile::GetIsVoidFilter()).IsEmpty()) _Update(box, true, startTile); + Tile* startTile = _GetStartTile(_GetTileAt(Point(correctedBox.getXMax(), correctedBox.getYMin()))); + GenericCollection tiles = _GetTilesUnder(Box(correctedBox).inflate(0, 0, -1, -1), startTile); + if (!tiles.GetSubSet(!Tile::GetIsVoidFilter()).IsEmpty()) _Update(box, true, startTile); - return *this; + return *this; } Region& Region::Groove(const Region& region) // ***************************************** { - Box boundingBox = GetBoundingBox(); - for_each_box(box, region.GetBoxesUnder(boundingBox)) { - Groove(box); - end_for; - } - return *this; + Box boundingBox = GetBoundingBox(); + for_each_box(box, region.GetBoxesUnder(boundingBox)) { + Groove(box); + end_for; + } + return *this; } Region& Region::GetIntersection (const Region& region) // *************************************************** { - Box boundingBox = GetBoundingBox(); - for_each_box (box, region.GetVoidBoxesUnder (boundingBox)) { - //for_each_box (box, region.GetVoidBoxes ()) { - //if (! boundingBox.Intersect (box)) continue; - Groove (box); - end_for; - } - return *this; + Box boundingBox = GetBoundingBox(); + for_each_box (box, region.GetVoidBoxesUnder (boundingBox)) { + //for_each_box (box, region.GetVoidBoxes ()) { + //if (! boundingBox.Intersect (box)) continue; + Groove (box); + end_for; + } + return *this; } Region& Region::Inflate(const Unit& quantity) // ****************************************** { - if (!IsEmpty()) { - if (0 < quantity) { - list boxList; - for_each_object(Tile*, tile, Region_Tiles(this).GetSubSet(!Tile::GetIsVoidFilter())) { - boxList.push_back(tile->GetBoundingBox()); - end_for; - } - for_each_box(box, GetCollection(boxList)) { - Fill(box.Inflate(quantity)); - end_for; - } - } - else if (quantity < 0) { - _GrowthToFit(GetBoundingBox().Inflate(GetUnit(1))); - list boxList; - for_each_object(Tile*, tile, Region_Tiles(this).GetSubSet(Tile::GetIsVoidFilter())) { - boxList.push_back(tile->GetBoundingBox()); - end_for; - } - for_each_box(box, GetCollection(boxList)) { - Groove(box.Inflate(-quantity)); - end_for; - } - } - } + if (!IsEmpty()) { + if (0 < quantity) { + list boxList; + for_each_object(Tile*, tile, Region_Tiles(this).GetSubSet(!Tile::GetIsVoidFilter())) { + boxList.push_back(tile->GetBoundingBox()); + end_for; + } + for_each_box(box, GetCollection(boxList)) { + Fill(box.inflate(quantity)); + end_for; + } + } + else if (quantity < 0) { + _GrowthToFit(GetBoundingBox().inflate(GetUnit(1))); + list boxList; + for_each_object(Tile*, tile, Region_Tiles(this).GetSubSet(Tile::GetIsVoidFilter())) { + boxList.push_back(tile->GetBoundingBox()); + end_for; + } + for_each_box(box, GetCollection(boxList)) { + Groove(box.inflate(-quantity)); + end_for; + } + } + } - return *this; + return *this; } Region& Region::Translate(const Unit& dx, const Unit& dy) // ****************************************************** { - if ((dx != 0) || (dy != 0)) { - set tileSet; - _GetTiles().Fill(tileSet); - for_each_object(Tile*, tile, GetCollection(tileSet)) { - tile->_boundingBox.Translate(dx, dy); - end_for; - } - } - return *this; + if ((dx != 0) || (dy != 0)) { + set tileSet; + _GetTiles().Fill(tileSet); + for_each_object(Tile*, tile, GetCollection(tileSet)) { + tile->_boundingBox.translate(dx, dy); + end_for; + } + } + return *this; } string Region::_GetString() const // ****************************** { - string s = "<" + _GetTypeName() + ">"; - return s; + string s = "<" + _GetTypeName() + ">"; + return s; } Record* Region::_GetRecord() const // ************************* { - Record* record = new Record(GetString(this)); - if (record) { - record->Add(GetSlot("BottomRightTile", _bottomRightTile)); - record->Add(GetSlot("TopLeftTile", _topLeftTile)); - } - return record; + Record* record = new Record(GetString(this)); + if (record) { + record->Add(GetSlot("BottomRightTile", _bottomRightTile)); + record->Add(GetSlot("TopLeftTile", _topLeftTile)); + } + return record; } Region_Tile* Region::_GetTileAt(const Point& point, Tile* startTile) const // *********************************************************************** { - if (!GetBoundingBox().Contains(point)) return NULL; + if (!GetBoundingBox().contains(point)) return NULL; - return (startTile) ? startTile->GetTileAt(point) : _bottomRightTile->GetTileAt(point); + return (startTile) ? startTile->GetTileAt(point) : _bottomRightTile->GetTileAt(point); } Region_Tile* Region::_GetNonVoidTileAt(const Point& point, Tile* startTile) const // ****************************************************************************** { - if (!GetBoundingBox().Contains(point)) return NULL; + if (!GetBoundingBox().contains(point)) return NULL; - return (startTile) ? startTile->GetNonVoidTileAt(point) : _bottomRightTile->GetNonVoidTileAt(point); + return (startTile) ? startTile->GetNonVoidTileAt(point) : _bottomRightTile->GetNonVoidTileAt(point); } Region_Tile* Region::_GetStartTile(Tile* tile) const // ************************************************* { - Tile* startTile = NULL; + Tile* startTile = NULL; - if (tile) { - if (!startTile && tile->_rightTile) { - Unit y = tile->GetYMin(); - startTile = tile->_rightTile; - while (startTile && (y <= startTile->GetYMax())) startTile = startTile->_bottomTile; - } - if (!startTile && tile->_bottomTile) { - Unit x = tile->GetXMax(); - startTile = tile->_bottomTile; - while (startTile && (startTile->GetXMin() <= x)) startTile = startTile->_rightTile; - } - } + if (tile) { + if (!startTile && tile->_rightTile) { + Unit y = tile->GetYMin(); + startTile = tile->_rightTile; + while (startTile && (y <= startTile->GetYMax())) startTile = startTile->_bottomTile; + } + if (!startTile && tile->_bottomTile) { + Unit x = tile->GetXMax(); + startTile = tile->_bottomTile; + while (startTile && (startTile->GetXMin() <= x)) startTile = startTile->_rightTile; + } + } - return startTile; + return startTile; } GenericCollection Region::_GetTiles() const // ****************************************************** { - return Region_Tiles(this); + return Region_Tiles(this); } GenericCollection Region::_GetTilesUnder(const Box& area, Tile* startTile) const // ******************************************************************************************* { - return Region_TilesUnder(this, area, startTile); + return Region_TilesUnder(this, area, startTile); } void Region::_Split(const Box& box) // ******************************** { - if (GetBoundingBox().Intersect(box)) { + if (GetBoundingBox().intersect(box)) { - Tile* startTile = _GetStartTile(_GetTileAt(Point(box.GetXMax(), box.GetYMin()))); + Tile* startTile = _GetStartTile(_GetTileAt(Point(box.getXMax(), box.getYMin()))); - list tileList; - Box line = Box(box.GetXMin(), box.GetYMin(), box.GetXMax() - 1, box.GetYMin()); - _GetTilesUnder(line, startTile).Fill(tileList); - for_each_object(Tile*, tile, GetCollection(tileList)) { - tile->SplitHorizontal(this, box.GetYMin()); - end_for; - } + list tileList; + Box line = Box(box.getXMin(), box.getYMin(), box.getXMax() - 1, box.getYMin()); + _GetTilesUnder(line, startTile).Fill(tileList); + for_each_object(Tile*, tile, GetCollection(tileList)) { + tile->SplitHorizontal(this, box.getYMin()); + end_for; + } - tileList.clear(); - line = Box(box.GetXMin(), box.GetYMax(), box.GetXMax() - 1, box.GetYMax()); - _GetTilesUnder(line, startTile).Fill(tileList); - for_each_object(Tile*, tile, GetCollection(tileList)) { - tile->SplitHorizontal(this, box.GetYMax()); - end_for; - } + tileList.clear(); + line = Box(box.getXMin(), box.getYMax(), box.getXMax() - 1, box.getYMax()); + _GetTilesUnder(line, startTile).Fill(tileList); + for_each_object(Tile*, tile, GetCollection(tileList)) { + tile->SplitHorizontal(this, box.getYMax()); + end_for; + } - tileList.clear(); - line = Box(box.GetXMin(), box.GetYMin(), box.GetXMin(), box.GetYMax() - 1); - _GetTilesUnder(line, startTile).Fill(tileList); - for_each_object(Tile*, tile, GetCollection(tileList)) { - tile->SplitVertical(this, box.GetXMin()); - end_for; - } + tileList.clear(); + line = Box(box.getXMin(), box.getYMin(), box.getXMin(), box.getYMax() - 1); + _GetTilesUnder(line, startTile).Fill(tileList); + for_each_object(Tile*, tile, GetCollection(tileList)) { + tile->SplitVertical(this, box.getXMin()); + end_for; + } - tileList.clear(); - line = Box(box.GetXMax(), box.GetYMin(), box.GetXMax(), box.GetYMax() - 1); - _GetTilesUnder(line, startTile).Fill(tileList); - for_each_object(Tile*, tile, GetCollection(tileList)) { - tile->SplitVertical(this, box.GetXMax()); - end_for; - } - } + tileList.clear(); + line = Box(box.getXMax(), box.getYMin(), box.getXMax(), box.getYMax() - 1); + _GetTilesUnder(line, startTile).Fill(tileList); + for_each_object(Tile*, tile, GetCollection(tileList)) { + tile->SplitVertical(this, box.getXMax()); + end_for; + } + } } void Region::_GrowthToFit(const Box& box) // ************************************** { - if (box.IsEmpty()) return; + if (box.isEmpty()) return; - if (!_bottomRightTile) { - _bottomRightTile = new Tile(box, true); - _topLeftTile = _bottomRightTile; - return; - } + if (!_bottomRightTile) { + _bottomRightTile = new Tile(box, true); + _topLeftTile = _bottomRightTile; + return; + } - if (GetBoundingBox().Contains(box)) return; + if (GetBoundingBox().contains(box)) return; - if (box.GetYMin() < GetYMin()) { - Tile* newTile = new Tile(Box(GetXMin(), box.GetYMin(), GetXMax(), GetYMin()), true); - Tile* tile = _bottomRightTile; - while (tile) { - tile->_bottomTile = newTile; - tile = tile->_leftTile; - } - newTile->_topTile = _bottomRightTile; - _bottomRightTile = newTile; - } + if (box.getYMin() < GetYMin()) { + Tile* newTile = new Tile(Box(GetXMin(), box.getYMin(), GetXMax(), GetYMin()), true); + Tile* tile = _bottomRightTile; + while (tile) { + tile->_bottomTile = newTile; + tile = tile->_leftTile; + } + newTile->_topTile = _bottomRightTile; + _bottomRightTile = newTile; + } - if (GetYMax() < box.GetYMax()) { - Tile* newTile = new Tile(Box(GetXMin(), GetYMax(), GetXMax(), box.GetYMax()), true); - Tile* tile = _topLeftTile; - while (tile) { - tile->_topTile = newTile; - tile = tile->_rightTile; - } - newTile->_bottomTile = _topLeftTile; - _topLeftTile = newTile; - } + if (GetYMax() < box.getYMax()) { + Tile* newTile = new Tile(Box(GetXMin(), GetYMax(), GetXMax(), box.getYMax()), true); + Tile* tile = _topLeftTile; + while (tile) { + tile->_topTile = newTile; + tile = tile->_rightTile; + } + newTile->_bottomTile = _topLeftTile; + _topLeftTile = newTile; + } - if (box.GetXMin() < GetXMin()) { - Tile* newTile = new Tile(Box(box.GetXMin(), GetYMin(), GetXMin(), GetYMax()), true); - Tile* tile = _topLeftTile; - while (tile) { - tile->_leftTile = newTile; - tile = tile->_bottomTile; - } - newTile->_rightTile = _topLeftTile; - _topLeftTile = newTile; - } + if (box.getXMin() < GetXMin()) { + Tile* newTile = new Tile(Box(box.getXMin(), GetYMin(), GetXMin(), GetYMax()), true); + Tile* tile = _topLeftTile; + while (tile) { + tile->_leftTile = newTile; + tile = tile->_bottomTile; + } + newTile->_rightTile = _topLeftTile; + _topLeftTile = newTile; + } - if (GetXMax() < box.GetXMax()) { - Tile* newTile = new Tile(Box(GetXMax(), GetYMin(), box.GetXMax(), GetYMax()), true); - Tile* tile = _bottomRightTile; - while (tile) { - tile->_rightTile = newTile; - tile = tile->_topTile; - } - newTile->_leftTile = _bottomRightTile; - _bottomRightTile = newTile; - } + if (GetXMax() < box.getXMax()) { + Tile* newTile = new Tile(Box(GetXMax(), GetYMin(), box.getXMax(), GetYMax()), true); + Tile* tile = _bottomRightTile; + while (tile) { + tile->_rightTile = newTile; + tile = tile->_topTile; + } + newTile->_leftTile = _bottomRightTile; + _bottomRightTile = newTile; + } } void Region::_Update(const Box& box, bool isVoid, Tile* startTile) // ************************************************************** { - if (box.IsEmpty() || !_bottomRightTile || !box.GetWidth() || !box.GetHeight()) return; + if (box.isEmpty() || !_bottomRightTile || !box.getWidth() || !box.getHeight()) return; - if (!GetBoundingBox().Contains(box)) _GrowthToFit(box); + if (!GetBoundingBox().contains(box)) _GrowthToFit(box); - _Split(box); + _Split(box); - Tile* newTile = new Tile(box, isVoid); + Tile* newTile = new Tile(box, isVoid); - list tileList; - _GetTilesUnder(Box(box).Inflate(0, 0, -1, -1), startTile).Fill(tileList); - for_each_object(Tile*, tile, GetCollection(tileList)) { - if (_topLeftTile == tile) _topLeftTile = newTile; - if (_bottomRightTile == tile) _bottomRightTile = newTile; - if (tile->GetXMin() == box.GetXMin()) { - if (tile->GetYMin() == box.GetYMin()) { - newTile->_leftTile = tile->_leftTile; - newTile->_bottomTile = tile->_bottomTile; - } - Tile* leftTile = tile->_leftTile; - while (leftTile && (leftTile->_rightTile == tile)) { - leftTile->_rightTile = newTile; - leftTile = leftTile->_topTile; - } - } - if (tile->GetYMin() == box.GetYMin()) { - Tile* bottomTile = tile->_bottomTile; - while (bottomTile && (bottomTile->_topTile == tile)) { - bottomTile->_topTile = newTile; - bottomTile = bottomTile->_rightTile; - } - } - if (tile->GetYMax() == box.GetYMax()) { - if (tile->GetXMax() == box.GetXMax()) { - newTile->_topTile = tile->_topTile; - newTile->_rightTile = tile->_rightTile; - } - Tile* topTile = tile->_topTile; - while (topTile && (topTile->_bottomTile == tile)) { - topTile->_bottomTile = newTile; - topTile = topTile->_leftTile; - } - } - if (tile->GetXMax() == box.GetXMax()) { - Tile* rightTile = tile->_rightTile; - while (rightTile && (rightTile->_leftTile == tile)) { - rightTile->_leftTile = newTile; - rightTile = rightTile->_bottomTile; - } - } - end_for; - } - for_each_object(Tile*, tile, GetCollection(tileList)) { - delete tile; - end_for; - } + list tileList; + _GetTilesUnder(Box(box).inflate(0, 0, -1, -1), startTile).Fill(tileList); + for_each_object(Tile*, tile, GetCollection(tileList)) { + if (_topLeftTile == tile) _topLeftTile = newTile; + if (_bottomRightTile == tile) _bottomRightTile = newTile; + if (tile->GetXMin() == box.getXMin()) { + if (tile->GetYMin() == box.getYMin()) { + newTile->_leftTile = tile->_leftTile; + newTile->_bottomTile = tile->_bottomTile; + } + Tile* leftTile = tile->_leftTile; + while (leftTile && (leftTile->_rightTile == tile)) { + leftTile->_rightTile = newTile; + leftTile = leftTile->_topTile; + } + } + if (tile->GetYMin() == box.getYMin()) { + Tile* bottomTile = tile->_bottomTile; + while (bottomTile && (bottomTile->_topTile == tile)) { + bottomTile->_topTile = newTile; + bottomTile = bottomTile->_rightTile; + } + } + if (tile->GetYMax() == box.getYMax()) { + if (tile->GetXMax() == box.getXMax()) { + newTile->_topTile = tile->_topTile; + newTile->_rightTile = tile->_rightTile; + } + Tile* topTile = tile->_topTile; + while (topTile && (topTile->_bottomTile == tile)) { + topTile->_bottomTile = newTile; + topTile = topTile->_leftTile; + } + } + if (tile->GetXMax() == box.getXMax()) { + Tile* rightTile = tile->_rightTile; + while (rightTile && (rightTile->_leftTile == tile)) { + rightTile->_leftTile = newTile; + rightTile = rightTile->_bottomTile; + } + } + end_for; + } + for_each_object(Tile*, tile, GetCollection(tileList)) { + delete tile; + end_for; + } - newTile->CleanNeighbours(this); - newTile->MergeNeighbours(this); -}; // Region::_Update + newTile->CleanNeighbours(this); + newTile->MergeNeighbours(this); +}; // Region::_Update bool Region::VerticalEnhancement() @@ -3013,18 +3013,18 @@ Region::VerticalEnhancement() Box maxBox = Box(); double area = minArea; for_each_box (box, GetBoxes()) { - if (! box.IsEmpty()) { - double a = 1. * box.GetWidth() * box.GetHeight(); - if (area < a) { - area = a; - maxBox = box; - } + if (! box.isEmpty()) { + double a = 1. * box.getWidth() * box.getHeight(); + if (area < a) { + area = a; + maxBox = box; + } } end_for; } - if (maxBox.IsEmpty()) break; - Tile* tile = _GetTileAt (maxBox.GetCenter()); - if (maxBox.GetWidth() >= GetUnit(2)) { + if (maxBox.isEmpty()) break; + Tile* tile = _GetTileAt (maxBox.getCenter()); + if (maxBox.getWidth() >= GetUnit(2)) { modif = tile->VerticalEnhancement (this); } result.Fill (tile->GetBoundingBox()); @@ -3032,7 +3032,7 @@ Region::VerticalEnhancement() } while (! IsEmpty()); Fill (result); return modif; -}; // Region::VerticalEnhancement +}; // Region::VerticalEnhancement bool @@ -3040,11 +3040,11 @@ Region::VerticalEnhancement(Point point) // *************************************** // Amelioration de la tuile contenant point { - bool modif = false; - Tile* tile = _GetTileAt (point); - if (tile) modif = tile->VerticalEnhancement (this); - return modif; -}; // Region::VerticalEnhancement + bool modif = false; + Tile* tile = _GetTileAt (point); + if (tile) modif = tile->VerticalEnhancement (this); + return modif; +}; // Region::VerticalEnhancement bool @@ -3059,18 +3059,18 @@ Region::HorizontalEnhancement() Box maxBox = Box(); double area = minArea; for_each_box (box, GetBoxes()) { - if (! box.IsEmpty()) { - double a = 1. * box.GetWidth() * box.GetHeight(); - if (area < a) { - area = a; - maxBox = box; - } + if (! box.isEmpty()) { + double a = 1. * box.getWidth() * box.getHeight(); + if (area < a) { + area = a; + maxBox = box; + } } end_for; } - if (maxBox.IsEmpty()) break; - Tile* tile = _GetTileAt (maxBox.GetCenter()); - if (maxBox.GetWidth() >= GetUnit(2)) { + if (maxBox.isEmpty()) break; + Tile* tile = _GetTileAt (maxBox.getCenter()); + if (maxBox.getWidth() >= GetUnit(2)) { modif = tile->HorizontalEnhancement (this); } result.Fill (tile->GetBoundingBox()); @@ -3078,18 +3078,18 @@ Region::HorizontalEnhancement() } while (! IsEmpty()); Fill (result); return modif; -}; // Region::HorizontalEnhancement +}; // Region::HorizontalEnhancement bool Region::HorizontalEnhancement(Point point) // *************************************** // Amelioration de la tuile contenant point { - bool modif = false; - Tile* tile = _GetTileAt (point); + bool modif = false; + Tile* tile = _GetTileAt (point); if (tile) modif = tile->HorizontalEnhancement (this); - return modif; -}; // Region::HorizontalEnhancement + return modif; +}; // Region::HorizontalEnhancement Interval @@ -3099,12 +3099,12 @@ Region::TopBottomFacing (const Box box) const // dessus et dessous de box { Interval result = Interval(); - if (box.IsEmpty()) return result; - Tile* tile = _GetTileAt (box.GetCenter()); + if (box.isEmpty()) return result; + Tile* tile = _GetTileAt (box.getCenter()); Interval it1 = tile->_GetTopNeighbour (); Interval it2 = tile->_GetBottomNeighbour (); return it1.GetIntersection (it2); -}; // Region::TopBottomFacing +}; // Region::TopBottomFacing Interval Region::LeftRightFacing (const Box box) const @@ -3113,12 +3113,12 @@ Region::LeftRightFacing (const Box box) const // a gauche et droite de box { Interval result = Interval(); - if (box.IsEmpty()) return result; - Tile* tile = _GetTileAt (box.GetCenter()); + if (box.isEmpty()) return result; + Tile* tile = _GetTileAt (box.getCenter()); Interval it1 = tile->_GetLeftNeighbour (); Interval it2 = tile->_GetRightNeighbour (); return it1.GetIntersection (it2); -}; // Region::LeftRightFacing +}; // Region::LeftRightFacing diff --git a/hurricane/src/hurricane/RoutingPad.cpp b/hurricane/src/hurricane/RoutingPad.cpp index 4446df83..6805ad87 100644 --- a/hurricane/src/hurricane/RoutingPad.cpp +++ b/hurricane/src/hurricane/RoutingPad.cpp @@ -30,9 +30,9 @@ namespace Hurricane { RoutingPad::RoutingPad(Net* net, const Point& p, Occurrence occurrence ) // ********************************************************************************** : Inherit(net), - _x(p.GetX()), - _y(p.GetY()), - _occurrence(occurrence) + _x(p.getX()), + _y(p.getY()), + _occurrence(occurrence) { } @@ -40,18 +40,18 @@ RoutingPad::RoutingPad(Net* net, const Point& p, Occurrence occurrence ) RoutingPad* RoutingPad::Create(Net* net, Occurrence occurrence) // *********************************************************** { - if (!net) - throw Error ("Can't create RoutingPad : NULL net"); - if (!occurrence.IsValid()) - throw Error ("Can't create RoutingPag : Invalid occurrence"); + if (!net) + throw Error ("Can't create RoutingPad : NULL net"); + if (!occurrence.IsValid()) + throw Error ("Can't create RoutingPag : Invalid occurrence"); //TODO Gerer une contruction avec un composant externe, mais ce n'est pas prioritaire - Plug* plug = NULL; + Plug* plug = NULL; Pin* pin = NULL; Contact* contact = NULL; Point position; - if ( (plug = dynamic_cast(occurrence.GetEntity()) ) ) { + if ( (plug = dynamic_cast(occurrence.GetEntity()) ) ) { position = occurrence.GetPath().GetTransformation().GetPoint( plug->GetPosition() ); } else if ( (pin = dynamic_cast(occurrence.GetEntity()) ) ) { position = occurrence.GetPath().GetTransformation().GetPoint( pin->GetPosition() ); @@ -62,11 +62,11 @@ RoutingPad* RoutingPad::Create(Net* net, Occurrence occurrence) if ( !plug && !pin && !contact ) throw Error ("Can't create RoutingPad : plug or pin occurrence *required*"); - RoutingPad* routingPad = new RoutingPad(net, position, occurrence); + RoutingPad* routingPad = new RoutingPad(net, position, occurrence); - routingPad->_PostCreate(); + routingPad->_PostCreate(); - return routingPad; + return routingPad; } void RoutingPad::_PostCreate() @@ -81,13 +81,13 @@ void RoutingPad::_PostCreate() Unit RoutingPad::GetX() const // *********************** { - return _x; + return _x; } Unit RoutingPad::GetY() const // *********************** { - return _y; + return _y; } Box RoutingPad::GetBoundingBox() const @@ -143,25 +143,25 @@ Point RoutingPad::GetTargetPosition() const Unit RoutingPad::GetSourceX() const // ******************************** { - return GetSourcePosition().GetX(); + return GetSourcePosition().getX(); } Unit RoutingPad::GetSourceY() const // ******************************** { - return GetSourcePosition().GetY(); + return GetSourcePosition().getY(); } Unit RoutingPad::GetTargetX() const // ******************************** { - return GetTargetPosition().GetX(); + return GetTargetPosition().getX(); } Unit RoutingPad::GetTargetY() const // ******************************** { - return GetTargetPosition().GetY(); + return GetTargetPosition().getY(); } Point RoutingPad::GetCenter() const @@ -178,43 +178,43 @@ Point RoutingPad::GetCenter() const void RoutingPad::Translate(const Unit& dx, const Unit& dy) // **************************************************** { - if ((dx != 0) || (dy != 0)) { - Invalidate(true); - _x += dx; - _y += dy; - } + if ((dx != 0) || (dy != 0)) { + Invalidate(true); + _x += dx; + _y += dy; + } } void RoutingPad::SetX(const Unit& x) // ****************************** { - SetPosition(x, GetY()); + SetPosition(x, GetY()); } void RoutingPad::SetY(const Unit& y) // ****************************** { - SetPosition(GetX(), y); + SetPosition(GetX(), y); } void RoutingPad::SetPosition(const Unit& x, const Unit& y) // **************************************************** { - SetOffset(x, y); + SetOffset(x, y); } void RoutingPad::SetPosition(const Point& position) // ********************************************* { - SetPosition(position.GetX(), position.GetY()); + SetPosition(position.getX(), position.getY()); } void RoutingPad::SetOffset(const Unit& x, const Unit& y) // **************************************************** { - Invalidate(true); - _x = x; - _y = y; + Invalidate(true); + _x = x; + _y = y; } void RoutingPad::_PreDelete() @@ -235,24 +235,24 @@ void RoutingPad::_PreDelete() string RoutingPad::_GetString() const // ******************************* { - string s = Inherit::_GetString(); - s.insert(s.length() - 1, " [" + GetValueString(GetX())); - s.insert(s.length() - 1, " " + GetValueString(GetY())); - s.insert(s.length() - 1, "] "); + string s = Inherit::_GetString(); + s.insert(s.length() - 1, " [" + GetValueString(GetX())); + s.insert(s.length() - 1, " " + GetValueString(GetY())); + s.insert(s.length() - 1, "] "); s.insert(s.length() - 1, GetString(_occurrence)); - return s; + return s; } Record* RoutingPad::_GetRecord() const // ************************** { - Record* record = Inherit::_GetRecord(); - if (record) { - record->Add(GetSlot("X", &_x)); - record->Add(GetSlot("Y", &_y)); + Record* record = Inherit::_GetRecord(); + if (record) { + record->Add(GetSlot("X", &_x)); + record->Add(GetSlot("Y", &_y)); record->Add(GetSlot("Occurrence",_occurrence)); - } - return record; + } + return record; } Component* RoutingPad::_GetEntityAsComponent () const @@ -276,19 +276,19 @@ Segment* RoutingPad::_GetEntityAsSegment () const //bool RoutingPad::_IsInterceptedBy(View* view, const Point& point, const Unit& aperture) const //// ****************************************************************************************** //{ -// Layer* layer = GetLayer(); +// Layer* layer = GetLayer(); // Box boundingBox ( GetBoundingBox() ); -// Box area ( point ); +// Box area ( point ); // -// area.Inflate ( aperture ); +// area.Inflate ( aperture ); // -// for_each_basic_layer(basicLayer, layer->GetBasicLayers()) { -// if (view->IsVisible(basicLayer)) -// if (boundingBox.Intersect(area)) return true; -// end_for; -// } +// for_each_basic_layer(basicLayer, layer->GetBasicLayers()) { +// if (view->IsVisible(basicLayer)) +// if (boundingBox.Intersect(area)) return true; +// end_for; +// } // -// return false; +// return false; //} // // @@ -334,11 +334,11 @@ void RoutingPad::SetExternalComponent(Component* component) Horizontal* horizontal = dynamic_cast(component); if ( horizontal ) { SetX ( 0 ); - SetY ( position.GetY() ); + SetY ( position.getY() ); } else { Vertical* vertical = dynamic_cast(component); if ( vertical ) { - SetX ( position.GetX() ); + SetX ( position.getX() ); SetY ( 0 ); } else SetPosition ( position ); @@ -387,40 +387,40 @@ void RoutingPad::RestorePlugOccurrence() RoutingPad::Builder::Builder(const string& token) // ******************************************* -: Inherit(token), - _layer(NULL), - _x(0), - _y(0), - _width(0), - _height(0) +: Inherit(token), + _layer(NULL), + _x(0), + _y(0), + _width(0), + _height(0) { } void RoutingPad::Builder::Scan(InputFile& inputFile, char*& arguments) // **************************************************************** { - Inherit::Scan(inputFile, arguments); + Inherit::Scan(inputFile, arguments); - unsigned layerId; - unsigned n; + unsigned layerId; + unsigned n; - if (r != 6) - throw Error("Can't create RoutingPad : syntax error"); + if (r != 6) + throw Error("Can't create RoutingPad : syntax error"); - arguments = &arguments[n]; + arguments = &arguments[n]; - DBo* dbo = inputFile.GetDBo(layerId); - if (!dbo || !is_a(dbo)) - throw Error("Can't create RoutingPad : bad layer"); + DBo* dbo = inputFile.GetDBo(layerId); + if (!dbo || !is_a(dbo)) + throw Error("Can't create RoutingPad : bad layer"); - _layer = (Layer*)dbo; + _layer = (Layer*)dbo; } DBo* RoutingPad::Builder::CreateDBo() // ******************************* { - return RoutingPad::Create(GetNet(), GetLayer(), GetX(), GetY(), GetWidth(), GetHeight()); + return RoutingPad::Create(GetNet(), GetLayer(), getX(), getY(), GetWidth(), GetHeight()); } RoutingPad::Builder ROUTINGPAD_BUILDER("RP"); diff --git a/hurricane/src/hurricane/Rubber.cpp b/hurricane/src/hurricane/Rubber.cpp index a9976266..0b185c49 100644 --- a/hurricane/src/hurricane/Rubber.cpp +++ b/hurricane/src/hurricane/Rubber.cpp @@ -56,7 +56,7 @@ Cell* Rubber::GetCell() const Point Rubber::GetCenter() const // **************************** { - return GetBoundingBox().GetCenter(); + return GetBoundingBox().getCenter(); } Point Rubber::GetBarycenter() const @@ -66,9 +66,9 @@ Point Rubber::GetBarycenter() const Unit x = 0; Unit y = 0; for_each_hook(hook, GetHooks()) { - Point position = hook->GetComponent()->GetBoundingBox().GetCenter(); - x += position.GetX() / n; - y += position.GetY() / n; + Point position = hook->GetComponent()->GetBoundingBox().getCenter(); + x += position.getX() / n; + y += position.getY() / n; end_for; } return Point(x,y); @@ -77,13 +77,13 @@ Point Rubber::GetBarycenter() const Box Rubber::GetBoundingBox() const // ******************************* { - if (_boundingBox.IsEmpty()) + if (_boundingBox.isEmpty()) { Rubber* rubber = const_cast(this); Box& boundingBox = rubber->_boundingBox; for_each_hook(hook, GetHooks()) { - Point position = hook->GetComponent()->GetBoundingBox().GetCenter(); - boundingBox.Merge(position); + Point position = hook->GetComponent()->GetBoundingBox().getCenter(); + boundingBox.merge(position); end_for; } } @@ -245,14 +245,14 @@ void Rubber::Invalidate(bool propagateFlag) // **************************************** { Inherit::Invalidate(false); - _boundingBox.MakeEmpty(); + _boundingBox.makeEmpty(); } //bool Rubber::_IsInterceptedBy(View* view, const Point& point, const Unit& aperture) const //// ************************************************************************************** //{ -// double x = GetValue(point.GetX()); -// double y = GetValue(point.GetY()); +// double x = GetValue(point.getX()); +// double y = GetValue(point.getY()); // double a = GetValue(aperture); // Point origin; // @@ -277,12 +277,12 @@ void Rubber::Invalidate(bool propagateFlag) // default: // throw Error("Unknown RubberDisplayType"); // } -// double xo = GetValue(origin.GetX()); -// double yo = GetValue(origin.GetY()); +// double xo = GetValue(origin.getX()); +// double yo = GetValue(origin.getY()); // for_each_hook(hook, GetHooks()) { -// Point extremity = extremity = hook->GetComponent()->GetBoundingBox().GetCenter(); -// double xe = GetValue(extremity.GetX()); -// double ye = GetValue(extremity.GetY()); +// Point extremity = extremity = hook->GetComponent()->GetBoundingBox().getCenter(); +// double xe = GetValue(extremity.getX()); +// double ye = GetValue(extremity.getY()); // double xp = xo; // double yp = yo; // if (xo != xe) xp = (((xe - xo) / (ye - yo)) * (y - yo)) + xo; @@ -307,7 +307,7 @@ void Rubber::Invalidate(bool propagateFlag) // { // center = transformation.GetPoint(GetCenter()); // for_each_hook(hook, GetHooks()) { -// Point position = hook->GetComponent()->GetBoundingBox().GetCenter(); +// Point position = hook->GetComponent()->GetBoundingBox().getCenter(); // view->DrawLine(center, transformation.GetPoint(position)); // end_for; // } @@ -317,7 +317,7 @@ void Rubber::Invalidate(bool propagateFlag) // { // center = transformation.GetPoint(GetBarycenter()); // for_each_hook(hook, GetHooks()) { -// Point position = hook->GetComponent()->GetBoundingBox().GetCenter(); +// Point position = hook->GetComponent()->GetBoundingBox().getCenter(); // view->DrawLine(center, transformation.GetPoint(position)); // end_for; // } @@ -327,8 +327,8 @@ void Rubber::Invalidate(bool propagateFlag) // { // center = transformation.GetPoint(GetBarycenter()); // for_each_hook(hook, GetHooks()) { -// Point position = hook->GetComponent()->GetBoundingBox().GetCenter(); -// Point crosspoint (position.GetX(), center.GetY()); +// Point position = hook->GetComponent()->GetBoundingBox().getCenter(); +// Point crosspoint (position.getX(), center.getY()); // view->DrawLine(position, crosspoint); // view->DrawLine(crosspoint, center); // end_for; @@ -344,7 +344,7 @@ void Rubber::Invalidate(bool propagateFlag) // typedef struct pcmp_s { bool operator() (const Point& p1, const Point& p2) const { - return (p1.GetX() < p2.GetX()) || ( (p1.GetX() == p2.GetX()) && (p1.GetY() < p2.GetY()) ); + return (p1.getX() < p2.getX()) || ( (p1.getX() == p2.getX()) && (p1.getY() < p2.getY()) ); } } pcmp_t; @@ -359,7 +359,7 @@ typedef struct pcmp_s { // { // center = transformation.GetPoint(GetCenter()); // for_each_hook(hook, GetHooks()) { -// Point position = hook->GetComponent()->GetBoundingBox().GetCenter(); +// Point position = hook->GetComponent()->GetBoundingBox().getCenter(); // view->DrawLine(center, transformation.GetPoint(position)); // end_for; // } @@ -369,7 +369,7 @@ typedef struct pcmp_s { // { // center = transformation.GetPoint(GetBarycenter()); // for_each_hook(hook, GetHooks()) { -// Point position = hook->GetComponent()->GetBoundingBox().GetCenter(); +// Point position = hook->GetComponent()->GetBoundingBox().getCenter(); // view->DrawLine(center, transformation.GetPoint(position)); // end_for; // } @@ -380,13 +380,13 @@ typedef struct pcmp_s { // set pset; // for_each_hook (hook, GetHooks()) // { -// Point position = hook->GetComponent()->GetBoundingBox().GetCenter(); +// Point position = hook->GetComponent()->GetBoundingBox().getCenter(); // pset.insert (position); // end_for; // } // center = transformation.GetPoint(GetBarycenter()); -// Unit lastXup = center.GetX(); -// Unit lastXlo = center.GetX(); +// Unit lastXup = center.getX(); +// Unit lastXlo = center.getX(); // for ( // set::iterator pit = pset.begin(); // pit != pset.end(); @@ -394,29 +394,29 @@ typedef struct pcmp_s { // ) // { // Point position (*pit); -// Point crosspoint (position.GetX(), center.GetY()); +// Point crosspoint (position.getX(), center.getY()); // Point connxpoint (center); -// if (position.GetY() > center.GetY()) +// if (position.getY() > center.getY()) // { // // en haut -// if ( (position.GetX() - lastXup) < (position.GetY() - center.GetY()) ) +// if ( (position.getX() - lastXup) < (position.getY() - center.getY()) ) // { // crosspoint.SetX (lastXup); -// crosspoint.SetY (position.GetY()); +// crosspoint.SetY (position.getY()); // connxpoint.SetX (lastXup); // } // else -// lastXup = position.GetX(); +// lastXup = position.getX(); // } else { // // en bas -// if ( (position.GetX() - lastXlo) < (center.GetY() - position.GetY()) ) +// if ( (position.getX() - lastXlo) < (center.getY() - position.getY()) ) // { // crosspoint.SetX (lastXlo); -// crosspoint.SetY (position.GetY()); +// crosspoint.SetY (position.getY()); // connxpoint.SetX (lastXlo); // } // else -// lastXlo = position.GetX(); +// lastXlo = position.getX(); // } // // diff --git a/hurricane/src/hurricane/Transformation.cpp b/hurricane/src/hurricane/Transformation.cpp index ccc66f04..8a23b9f7 100644 --- a/hurricane/src/hurricane/Transformation.cpp +++ b/hurricane/src/hurricane/Transformation.cpp @@ -61,8 +61,8 @@ Transformation::Transformation(const Unit& tx, const Unit& ty, const Orientation Transformation::Transformation(const Point& translation, const Orientation& orientation) // ************************************************************************************* -: _tx(translation.GetX()), - _ty(translation.GetY()), +: _tx(translation.getX()), + _ty(translation.getY()), _orientation(orientation) { } @@ -115,13 +115,13 @@ Unit Transformation::GetY(const Unit& x, const Unit& y) const Unit Transformation::GetX(const Point& point) const // ************************************************ { - return GetX(point.GetX(), point.GetY()); + return GetX(point.getX(), point.getY()); } Unit Transformation::GetY(const Point& point) const // ************************************************ { - return GetY(point.GetX(), point.GetY()); + return GetY(point.getX(), point.getY()); } Unit Transformation::GetDx(const Unit& dx, const Unit& dy) const @@ -145,7 +145,7 @@ Point Transformation::GetPoint(const Unit& x, const Unit& y) const Point Transformation::GetPoint(const Point& point) const // ***************************************************** { - return GetPoint(point.GetX(), point.GetY()); + return GetPoint(point.getX(), point.getY()); } Box Transformation::GetBox(const Unit& x1, const Unit& y1, const Unit& x2, const Unit& y2) const @@ -157,14 +157,14 @@ Box Transformation::GetBox(const Unit& x1, const Unit& y1, const Unit& x2, const Box Transformation::GetBox(const Point& point1, const Point& point2) const // *********************************************************************** { - return GetBox(point1.GetX(), point1.GetY(), point2.GetX(), point2.GetY()); + return GetBox(point1.getX(), point1.getY(), point2.getX(), point2.getY()); } Box Transformation::GetBox(const Box& box) const // ********************************************* { - if (box.IsEmpty()) return box; - return GetBox(box.GetXMin(), box.GetYMin(), box.GetXMax(), box.GetYMax()); + if (box.isEmpty()) return box; + return GetBox(box.getXMin(), box.getYMin(), box.getXMax(), box.getYMax()); } Transformation Transformation::GetTransformation(const Transformation& transformation) const diff --git a/hurricane/src/hurricane/Vertical.cpp b/hurricane/src/hurricane/Vertical.cpp index bbfa5d84..88edb6f7 100644 --- a/hurricane/src/hurricane/Vertical.cpp +++ b/hurricane/src/hurricane/Vertical.cpp @@ -64,7 +64,7 @@ Box Vertical::GetBoundingBox() const Unit size = GetHalfWidth() + _GetSize(); Unit extention = _GetExtention(); - return Box(_x, GetSourceY(), _x, GetTargetY()).Inflate(size, extention); + return Box(_x, GetSourceY(), _x, GetTargetY()).inflate(size, extention); } Box Vertical::GetBoundingBox(BasicLayer* basicLayer) const @@ -75,7 +75,7 @@ Box Vertical::GetBoundingBox(BasicLayer* basicLayer) const Unit size = GetHalfWidth() + _GetSize(basicLayer); Unit extention = _GetExtention(basicLayer); - return Box(_x, GetSourceY(), _x, GetTargetY()).Inflate(size, extention); + return Box(_x, GetSourceY(), _x, GetTargetY()).inflate(size, extention); } Unit Vertical::GetSourceY() const