cleaning again
This commit is contained in:
parent
488504c872
commit
b647b87b18
|
@ -210,7 +210,7 @@ void Contact::translate(const Unit& dx, const Unit& dy)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Contact::SetLayer(Layer* layer)
|
void Contact::setLayer(Layer* layer)
|
||||||
// *********************************
|
// *********************************
|
||||||
{
|
{
|
||||||
if (!layer)
|
if (!layer)
|
||||||
|
@ -222,7 +222,7 @@ void Contact::SetLayer(Layer* layer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Contact::SetWidth(const Unit& width)
|
void Contact::setWidth(const Unit& width)
|
||||||
// **************************************
|
// **************************************
|
||||||
{
|
{
|
||||||
if (width != _width) {
|
if (width != _width) {
|
||||||
|
@ -231,7 +231,7 @@ void Contact::SetWidth(const Unit& width)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Contact::SetHeight(const Unit& height)
|
void Contact::setHeight(const Unit& height)
|
||||||
// ****************************************
|
// ****************************************
|
||||||
{
|
{
|
||||||
if (height != _height) {
|
if (height != _height) {
|
||||||
|
@ -240,7 +240,7 @@ void Contact::SetHeight(const Unit& height)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Contact::SetSizes(const Unit& width, const Unit& height)
|
void Contact::setSizes(const Unit& width, const Unit& height)
|
||||||
// **********************************************************
|
// **********************************************************
|
||||||
{
|
{
|
||||||
if ((width != _width) || (height != _height)) {
|
if ((width != _width) || (height != _height)) {
|
||||||
|
@ -250,47 +250,47 @@ void Contact::SetSizes(const Unit& width, const Unit& height)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Contact::SetX(const Unit& x)
|
void Contact::setX(const Unit& x)
|
||||||
// ******************************
|
// ******************************
|
||||||
{
|
{
|
||||||
SetPosition(x, getY());
|
setPosition(x, getY());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Contact::SetY(const Unit& y)
|
void Contact::setY(const Unit& y)
|
||||||
// ******************************
|
// ******************************
|
||||||
{
|
{
|
||||||
SetPosition(getX(), y);
|
setPosition(getX(), y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Contact::SetPosition(const Unit& x, const Unit& y)
|
void Contact::setPosition(const Unit& x, const Unit& y)
|
||||||
// ****************************************************
|
// ****************************************************
|
||||||
{
|
{
|
||||||
Component* anchor = getAnchor();
|
Component* anchor = getAnchor();
|
||||||
if (!anchor)
|
if (!anchor)
|
||||||
SetOffset(x, y);
|
setOffset(x, y);
|
||||||
else
|
else
|
||||||
SetOffset(x - anchor->getX(), y - anchor->getY());
|
setOffset(x - anchor->getX(), y - anchor->getY());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Contact::SetPosition(const Point& position)
|
void Contact::setPosition(const Point& position)
|
||||||
// *********************************************
|
// *********************************************
|
||||||
{
|
{
|
||||||
SetPosition(position.getX(), position.getY());
|
setPosition(position.getX(), position.getY());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Contact::SetDx(const Unit& dx)
|
void Contact::setDx(const Unit& dx)
|
||||||
// ********************************
|
// ********************************
|
||||||
{
|
{
|
||||||
SetOffset(dx, _dy);
|
setOffset(dx, _dy);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Contact::SetDy(const Unit& dy)
|
void Contact::setDy(const Unit& dy)
|
||||||
// ********************************
|
// ********************************
|
||||||
{
|
{
|
||||||
SetOffset(_dx, dy);
|
setOffset(_dx, dy);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Contact::SetOffset(const Unit& dx, const Unit& dy)
|
void Contact::setOffset(const Unit& dx, const Unit& dy)
|
||||||
// ****************************************************
|
// ****************************************************
|
||||||
{
|
{
|
||||||
if ((dx != _dx) || (dy != _dy)) {
|
if ((dx != _dx) || (dy != _dy)) {
|
||||||
|
|
|
@ -86,17 +86,17 @@ class Contact : public Component {
|
||||||
|
|
||||||
public: virtual void translate(const Unit& dx, const Unit& dy);
|
public: virtual void translate(const Unit& dx, const Unit& dy);
|
||||||
|
|
||||||
public: void SetLayer(Layer* layer);
|
public: void setLayer(Layer* layer);
|
||||||
public: void SetWidth(const Unit& width);
|
public: void setWidth(const Unit& width);
|
||||||
public: void SetHeight(const Unit& height);
|
public: void setHeight(const Unit& height);
|
||||||
public: void SetSizes(const Unit& width, const Unit& height);
|
public: void setSizes(const Unit& width, const Unit& height);
|
||||||
public: void SetX(const Unit& x);
|
public: void setX(const Unit& x);
|
||||||
public: void SetY(const Unit& y);
|
public: void setY(const Unit& y);
|
||||||
public: void SetPosition(const Unit& x, const Unit& y);
|
public: void setPosition(const Unit& x, const Unit& y);
|
||||||
public: void SetPosition(const Point& position);
|
public: void setPosition(const Point& position);
|
||||||
public: void SetDx(const Unit& dx);
|
public: void setDx(const Unit& dx);
|
||||||
public: void SetDy(const Unit& dy);
|
public: void setDy(const Unit& dy);
|
||||||
public: void SetOffset(const Unit& dx, const Unit& dy);
|
public: void setOffset(const Unit& dx, const Unit& dy);
|
||||||
|
|
||||||
// Others
|
// Others
|
||||||
// ******
|
// ******
|
||||||
|
|
|
@ -52,7 +52,7 @@ class Error : public Exception {
|
||||||
// Modifiers
|
// Modifiers
|
||||||
// *********
|
// *********
|
||||||
|
|
||||||
public: void SetReason ( const string& reason ) { _reason = reason; };
|
public: void setReason ( const string& reason ) { _reason = reason; };
|
||||||
|
|
||||||
// Others
|
// Others
|
||||||
// ******
|
// ******
|
||||||
|
|
|
@ -40,7 +40,7 @@ class Exception : public NestedSlotAdapter {
|
||||||
// Accessors
|
// Accessors
|
||||||
// *********
|
// *********
|
||||||
|
|
||||||
public: string What() const { return _getString(); };
|
public: string what() const { return _getString(); };
|
||||||
|
|
||||||
// Others
|
// Others
|
||||||
// ******
|
// ******
|
||||||
|
|
|
@ -113,7 +113,7 @@ void Horizontal::translate(const Unit& dx, const Unit& dy)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Horizontal::SetY(const Unit& y)
|
void Horizontal::setY(const Unit& y)
|
||||||
// *********************************
|
// *********************************
|
||||||
{
|
{
|
||||||
if (y != _y) {
|
if (y != _y) {
|
||||||
|
@ -122,7 +122,7 @@ void Horizontal::SetY(const Unit& y)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Horizontal::SetDxSource(const Unit& dxSource)
|
void Horizontal::setDxSource(const Unit& dxSource)
|
||||||
// ***********************************************
|
// ***********************************************
|
||||||
{
|
{
|
||||||
if (dxSource != _dxSource) {
|
if (dxSource != _dxSource) {
|
||||||
|
@ -131,7 +131,7 @@ void Horizontal::SetDxSource(const Unit& dxSource)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Horizontal::SetDxTarget(const Unit& dxTarget)
|
void Horizontal::setDxTarget(const Unit& dxTarget)
|
||||||
// ***********************************************
|
// ***********************************************
|
||||||
{
|
{
|
||||||
if (dxTarget != _dxTarget) {
|
if (dxTarget != _dxTarget) {
|
||||||
|
|
|
@ -61,9 +61,9 @@ class Horizontal : public Segment {
|
||||||
|
|
||||||
public: virtual void translate(const Unit& dx, const Unit& dy);
|
public: virtual void translate(const Unit& dx, const Unit& dy);
|
||||||
|
|
||||||
public: void SetY(const Unit& y);
|
public: void setY(const Unit& y);
|
||||||
public: void SetDxSource(const Unit& dxSource);
|
public: void setDxSource(const Unit& dxSource);
|
||||||
public: void SetDxTarget(const Unit& dxSource);
|
public: void setDxTarget(const Unit& dxSource);
|
||||||
public: void translate(const Unit& dy);
|
public: void translate(const Unit& dy);
|
||||||
|
|
||||||
// Others
|
// Others
|
||||||
|
|
|
@ -57,82 +57,82 @@ Interval& Interval::operator=(const Interval& interval)
|
||||||
bool Interval::operator==(const Interval& interval) const
|
bool Interval::operator==(const Interval& interval) const
|
||||||
// ******************************************************
|
// ******************************************************
|
||||||
{
|
{
|
||||||
return !IsEmpty() && !interval.IsEmpty() && (_vMin == interval._vMin) && (_vMax == interval._vMax);
|
return !isEmpty() && !interval.isEmpty() && (_vMin == interval._vMin) && (_vMax == interval._vMax);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Interval::operator!=(const Interval& interval) const
|
bool Interval::operator!=(const Interval& interval) const
|
||||||
// ******************************************************
|
// ******************************************************
|
||||||
{
|
{
|
||||||
return IsEmpty() || interval.IsEmpty() || (_vMin != interval._vMin) || (_vMax != interval._vMax);
|
return isEmpty() || interval.isEmpty() || (_vMin != interval._vMin) || (_vMax != interval._vMax);
|
||||||
}
|
}
|
||||||
|
|
||||||
Interval Interval::getUnion(const Interval& interval) const
|
Interval Interval::getUnion(const Interval& interval) const
|
||||||
// ********************************************************
|
// ********************************************************
|
||||||
{
|
{
|
||||||
if (IsEmpty() && interval.IsEmpty()) return Interval();
|
if (isEmpty() && interval.isEmpty()) return Interval();
|
||||||
return Interval(min(_vMin, interval._vMin), max(_vMax, interval._vMax));
|
return Interval(min(_vMin, interval._vMin), max(_vMax, interval._vMax));
|
||||||
}
|
}
|
||||||
|
|
||||||
Interval Interval::getIntersection(const Interval& interval) const
|
Interval Interval::getIntersection(const Interval& interval) const
|
||||||
// ***************************************************************
|
// ***************************************************************
|
||||||
{
|
{
|
||||||
if (!Intersect(interval)) return Interval();
|
if (!intersect(interval)) return Interval();
|
||||||
return Interval(max(_vMin, interval._vMin), min(_vMax, interval._vMax));
|
return Interval(max(_vMin, interval._vMin), min(_vMax, interval._vMax));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Interval::IsEmpty() const
|
bool Interval::isEmpty() const
|
||||||
// ***************************
|
// ***************************
|
||||||
{
|
{
|
||||||
return (_vMax < _vMin);
|
return (_vMax < _vMin);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Interval::IsPonctual() const
|
bool Interval::isPonctual() const
|
||||||
// ******************************
|
// ******************************
|
||||||
{
|
{
|
||||||
return (_vMax == _vMin);
|
return (_vMax == _vMin);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Interval::Contains(const Unit& v) const
|
bool Interval::contains(const Unit& v) const
|
||||||
// *****************************************
|
// *****************************************
|
||||||
{
|
{
|
||||||
return !IsEmpty() && (_vMin <= v) && (v <= _vMax);
|
return !isEmpty() && (_vMin <= v) && (v <= _vMax);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Interval::Contains(const Interval& interval) const
|
bool Interval::contains(const Interval& interval) const
|
||||||
// ****************************************************
|
// ****************************************************
|
||||||
{
|
{
|
||||||
return !IsEmpty() && !interval.IsEmpty() && (_vMin <= interval._vMin) && (interval._vMax <= _vMax);
|
return !isEmpty() && !interval.isEmpty() && (_vMin <= interval._vMin) && (interval._vMax <= _vMax);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Interval::Intersect(const Interval& interval) const
|
bool Interval::intersect(const Interval& interval) const
|
||||||
// *****************************************************
|
// *****************************************************
|
||||||
{
|
{
|
||||||
return !IsEmpty() && !interval.IsEmpty() && !((_vMax < interval._vMin) || (interval._vMax < _vMin));
|
return !isEmpty() && !interval.isEmpty() && !((_vMax < interval._vMin) || (interval._vMax < _vMin));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Interval::Inferior(const Interval& interval, bool strict) const
|
bool Interval::inferior(const Interval& interval, bool strict) const
|
||||||
// *****************************************************************
|
// *****************************************************************
|
||||||
{
|
{
|
||||||
if (_vMax < interval._vMin) return true;
|
if (_vMax < interval._vMin) return true;
|
||||||
return !strict && (_vMax == interval._vMin);
|
return !strict && (_vMax == interval._vMin);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Interval::Superior(const Interval& interval, bool strict) const
|
bool Interval::superior(const Interval& interval, bool strict) const
|
||||||
// *****************************************************************
|
// *****************************************************************
|
||||||
{
|
{
|
||||||
if (_vMin > interval._vMax) return true;
|
if (_vMin > interval._vMax) return true;
|
||||||
return !strict && (_vMin == interval._vMax);
|
return !strict && (_vMin == interval._vMax);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Interval::IsConstrainedBy(const Interval& interval) const
|
bool Interval::isConstrainedBy(const Interval& interval) const
|
||||||
// ***********************************************************
|
// ***********************************************************
|
||||||
{
|
{
|
||||||
return (!IsEmpty() &&
|
return (!isEmpty() &&
|
||||||
!interval.IsEmpty() &&
|
!interval.isEmpty() &&
|
||||||
((_vMin == interval.getVMin()) || (_vMax == interval.getVMax())));
|
((_vMin == interval.getVMin()) || (_vMax == interval.getVMax())));
|
||||||
}
|
}
|
||||||
|
|
||||||
Interval& Interval::MakeEmpty()
|
Interval& Interval::makeEmpty()
|
||||||
// ****************************
|
// ****************************
|
||||||
{
|
{
|
||||||
_vMin = 1;
|
_vMin = 1;
|
||||||
|
@ -140,16 +140,16 @@ Interval& Interval::MakeEmpty()
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
Interval& Interval::Inflate(const Unit& dv)
|
Interval& Interval::inflate(const Unit& dv)
|
||||||
// ****************************************
|
// ****************************************
|
||||||
{
|
{
|
||||||
return Inflate(dv, dv);
|
return inflate(dv, dv);
|
||||||
}
|
}
|
||||||
|
|
||||||
Interval& Interval::Inflate(const Unit& dvMin, const Unit& dvMax)
|
Interval& Interval::inflate(const Unit& dvMin, const Unit& dvMax)
|
||||||
// **************************************************************
|
// **************************************************************
|
||||||
{
|
{
|
||||||
if (!IsEmpty()) {
|
if (!isEmpty()) {
|
||||||
_vMin -= dvMin;
|
_vMin -= dvMin;
|
||||||
_vMax += dvMax;
|
_vMax += dvMax;
|
||||||
}
|
}
|
||||||
|
@ -159,7 +159,7 @@ Interval& Interval::Inflate(const Unit& dvMin, const Unit& dvMax)
|
||||||
Interval& Interval::merge(const Unit& v)
|
Interval& Interval::merge(const Unit& v)
|
||||||
// *************************************
|
// *************************************
|
||||||
{
|
{
|
||||||
if (IsEmpty()) {
|
if (isEmpty()) {
|
||||||
_vMin = v;
|
_vMin = v;
|
||||||
_vMax = v;
|
_vMax = v;
|
||||||
}
|
}
|
||||||
|
@ -173,23 +173,23 @@ Interval& Interval::merge(const Unit& v)
|
||||||
Interval& Interval::merge(const Interval& interval)
|
Interval& Interval::merge(const Interval& interval)
|
||||||
// ************************************************
|
// ************************************************
|
||||||
{
|
{
|
||||||
if (!interval.IsEmpty()) {
|
if (!interval.isEmpty()) {
|
||||||
_vMin = min(_vMin, interval._vMin);
|
_vMin = min(_vMin, interval._vMin);
|
||||||
_vMax = max(_vMax, interval._vMax);
|
_vMax = max(_vMax, interval._vMax);
|
||||||
}
|
}
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
Interval& Interval::Intersection(const Unit& vMin, const Unit& vMax)
|
Interval& Interval::intersection(const Unit& vMin, const Unit& vMax)
|
||||||
// *****************************************************************
|
// *****************************************************************
|
||||||
{
|
{
|
||||||
return Intersection(Interval(vMin,vMax));
|
return intersection(Interval(vMin,vMax));
|
||||||
}
|
}
|
||||||
|
|
||||||
Interval& Interval::Intersection(const Interval& interval)
|
Interval& Interval::intersection(const Interval& interval)
|
||||||
// *******************************************************
|
// *******************************************************
|
||||||
{
|
{
|
||||||
if (!Intersect(interval)) MakeEmpty();
|
if (!intersect(interval)) makeEmpty();
|
||||||
else {
|
else {
|
||||||
_vMin = max(_vMin, interval._vMin);
|
_vMin = max(_vMin, interval._vMin);
|
||||||
_vMax = min(_vMax, interval._vMax);
|
_vMax = min(_vMax, interval._vMax);
|
||||||
|
@ -201,7 +201,7 @@ Interval& Interval::Intersection(const Interval& interval)
|
||||||
Interval& Interval::translate(const Unit& dv)
|
Interval& Interval::translate(const Unit& dv)
|
||||||
// ******************************************
|
// ******************************************
|
||||||
{
|
{
|
||||||
if (!IsEmpty()) {
|
if (!isEmpty()) {
|
||||||
_vMin += dv;
|
_vMin += dv;
|
||||||
_vMax += dv;
|
_vMax += dv;
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,25 +58,25 @@ class Interval {
|
||||||
// Predicates
|
// Predicates
|
||||||
// **********
|
// **********
|
||||||
|
|
||||||
public: bool IsEmpty() const;
|
public: bool isEmpty() const;
|
||||||
public: bool IsPonctual() const;
|
public: bool isPonctual() const;
|
||||||
public: bool Contains(const Unit& v) const;
|
public: bool contains(const Unit& v) const;
|
||||||
public: bool Contains(const Interval& interval) const;
|
public: bool contains(const Interval& interval) const;
|
||||||
public: bool Intersect(const Interval& interval) const;
|
public: bool intersect(const Interval& interval) const;
|
||||||
public: bool Inferior(const Interval& interval, bool strict=true) const;
|
public: bool inferior(const Interval& interval, bool strict=true) const;
|
||||||
public: bool Superior(const Interval& interval, bool strict=true) const;
|
public: bool superior(const Interval& interval, bool strict=true) const;
|
||||||
public: bool IsConstrainedBy(const Interval& interval) const;
|
public: bool isConstrainedBy(const Interval& interval) const;
|
||||||
|
|
||||||
// Updators
|
// Updators
|
||||||
// ********
|
// ********
|
||||||
|
|
||||||
public: Interval& MakeEmpty();
|
public: Interval& makeEmpty();
|
||||||
public: Interval& Inflate(const Unit& dv);
|
public: Interval& inflate(const Unit& dv);
|
||||||
public: Interval& Inflate(const Unit& dvMin, const Unit& dvMax);
|
public: Interval& inflate(const Unit& dvMin, const Unit& dvMax);
|
||||||
public: Interval& merge(const Unit& v);
|
public: Interval& merge(const Unit& v);
|
||||||
public: Interval& merge(const Interval& interval);
|
public: Interval& merge(const Interval& interval);
|
||||||
public: Interval& Intersection(const Unit& vMin, const Unit& vMax);
|
public: Interval& intersection(const Unit& vMin, const Unit& vMax);
|
||||||
public: Interval& Intersection(const Interval& interval);
|
public: Interval& intersection(const Interval& interval);
|
||||||
public: Interval& translate(const Unit& dv);
|
public: Interval& translate(const Unit& dv);
|
||||||
|
|
||||||
// Others
|
// Others
|
||||||
|
|
|
@ -105,14 +105,14 @@ class Region_Tile {
|
||||||
// Predicates
|
// Predicates
|
||||||
// **********
|
// **********
|
||||||
|
|
||||||
public: bool IsVoid() const {return _isVoid;};
|
public: bool isVoid() const {return _isVoid;};
|
||||||
public: bool contains(const Point& point) const;
|
public: bool contains(const Point& point) const;
|
||||||
|
|
||||||
// Updators
|
// Updators
|
||||||
// ********
|
// ********
|
||||||
|
|
||||||
public: void SplitVertical(Region* region, const Unit& x);
|
public: void splitVertical(Region* region, const Unit& x);
|
||||||
public: void SplitHorizontal(Region* region, const Unit& y);
|
public: void splitHorizontal(Region* region, const Unit& y);
|
||||||
public: bool mergeLeftTile(Region* region);
|
public: bool mergeLeftTile(Region* region);
|
||||||
public: bool mergeBottomTile(Region* region);
|
public: bool mergeBottomTile(Region* region);
|
||||||
public: bool mergeTopTile(Region* region);
|
public: bool mergeTopTile(Region* region);
|
||||||
|
@ -246,11 +246,11 @@ GenericFilter<Region_Tile*> Region_Tile::getIsVoidFilter()
|
||||||
return Region_Tile::IsVoidFilter();
|
return Region_Tile::IsVoidFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Region_Tile::SplitVertical(Region* region, const Unit& x)
|
void Region_Tile::splitVertical(Region* region, const Unit& x)
|
||||||
// ***********************************************************
|
// ***********************************************************
|
||||||
{
|
{
|
||||||
if ((getXMin() < x) && (x < getXMax())) {
|
if ((getXMin() < x) && (x < getXMax())) {
|
||||||
Region_Tile* newTile = new Region_Tile(Box(x, getYMin(), getXMax(), getYMax()), IsVoid());
|
Region_Tile* newTile = new Region_Tile(Box(x, getYMin(), getXMax(), getYMax()), isVoid());
|
||||||
|
|
||||||
newTile->_leftTile = this;
|
newTile->_leftTile = this;
|
||||||
newTile->_rightTile = _rightTile;
|
newTile->_rightTile = _rightTile;
|
||||||
|
@ -287,11 +287,11 @@ void Region_Tile::SplitVertical(Region* region, const Unit& x)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Region_Tile::SplitHorizontal(Region* region, const Unit& y)
|
void Region_Tile::splitHorizontal(Region* region, const Unit& y)
|
||||||
// *************************************************************
|
// *************************************************************
|
||||||
{
|
{
|
||||||
if ((getYMin() < y) && (y < getYMax())) {
|
if ((getYMin() < y) && (y < getYMax())) {
|
||||||
Region_Tile* newTile = new Region_Tile(Box(getXMin(), y, getXMax(), getYMax()), IsVoid());
|
Region_Tile* newTile = new Region_Tile(Box(getXMin(), y, getXMax(), getYMax()), isVoid());
|
||||||
|
|
||||||
newTile->_bottomTile = this;
|
newTile->_bottomTile = this;
|
||||||
newTile->_topTile = _topTile;
|
newTile->_topTile = _topTile;
|
||||||
|
@ -628,7 +628,7 @@ Region_Tile::_TopSplitAtVerticalSize (Region* region)
|
||||||
Region_Tile* upTile = _topTile;
|
Region_Tile* upTile = _topTile;
|
||||||
Unit height = upTile->getYMax() - getYMax();
|
Unit height = upTile->getYMax() - getYMax();
|
||||||
if (upTile && upTile->getXMax() != getXMax()) {
|
if (upTile && upTile->getXMax() != getXMax()) {
|
||||||
upTile->SplitVertical (region, getXMax());
|
upTile->splitVertical (region, getXMax());
|
||||||
upTile = _topTile;
|
upTile = _topTile;
|
||||||
}
|
}
|
||||||
Unit ht;
|
Unit ht;
|
||||||
|
@ -640,7 +640,7 @@ Region_Tile::_TopSplitAtVerticalSize (Region* region)
|
||||||
ht = upTile->getYMax() - getYMax();
|
ht = upTile->getYMax() - getYMax();
|
||||||
if (height > ht) height = ht;
|
if (height > ht) height = ht;
|
||||||
if (upTile && upTile->getXMin() != getXMin()) {
|
if (upTile && upTile->getXMin() != getXMin()) {
|
||||||
upTile->SplitVertical (region, getXMin());
|
upTile->splitVertical (region, getXMin());
|
||||||
}
|
}
|
||||||
return height;
|
return height;
|
||||||
}; // Region_Tile::_TopSplitAtVerticalSize
|
}; // Region_Tile::_TopSplitAtVerticalSize
|
||||||
|
@ -655,7 +655,7 @@ Region_Tile::_BottomSplitAtVerticalSize (Region* region)
|
||||||
Region_Tile* downTile = _bottomTile;
|
Region_Tile* downTile = _bottomTile;
|
||||||
Unit height = getYMin() - downTile->getYMin();
|
Unit height = getYMin() - downTile->getYMin();
|
||||||
if (downTile && downTile->getXMin() != getXMin()) {
|
if (downTile && downTile->getXMin() != getXMin()) {
|
||||||
downTile->SplitVertical (region, getXMin());
|
downTile->splitVertical (region, getXMin());
|
||||||
downTile = _bottomTile;
|
downTile = _bottomTile;
|
||||||
}
|
}
|
||||||
Unit ht;
|
Unit ht;
|
||||||
|
@ -667,7 +667,7 @@ Region_Tile::_BottomSplitAtVerticalSize (Region* region)
|
||||||
ht = getYMin() - downTile->getYMin();
|
ht = getYMin() - downTile->getYMin();
|
||||||
if (height > ht) height = ht;
|
if (height > ht) height = ht;
|
||||||
if (downTile && downTile->getXMax() != getXMax()) {
|
if (downTile && downTile->getXMax() != getXMax()) {
|
||||||
downTile->SplitVertical (region, getXMax());
|
downTile->splitVertical (region, getXMax());
|
||||||
}
|
}
|
||||||
return height;
|
return height;
|
||||||
}; // Region_Tile::_BottomSplitAtVerticalSize
|
}; // Region_Tile::_BottomSplitAtVerticalSize
|
||||||
|
@ -683,7 +683,7 @@ Region_Tile::_LeftSplitAtHorizontalSize (Region* region)
|
||||||
Region_Tile* leftTile = _leftTile;
|
Region_Tile* leftTile = _leftTile;
|
||||||
Unit width = getXMin() - leftTile->getXMin();
|
Unit width = getXMin() - leftTile->getXMin();
|
||||||
if (leftTile && leftTile->getYMin() != getYMin()) {
|
if (leftTile && leftTile->getYMin() != getYMin()) {
|
||||||
leftTile->SplitHorizontal (region, getYMin());
|
leftTile->splitHorizontal (region, getYMin());
|
||||||
leftTile = _leftTile;
|
leftTile = _leftTile;
|
||||||
}
|
}
|
||||||
Unit wt;
|
Unit wt;
|
||||||
|
@ -695,7 +695,7 @@ Region_Tile::_LeftSplitAtHorizontalSize (Region* region)
|
||||||
wt = getXMin() - leftTile->getXMin();
|
wt = getXMin() - leftTile->getXMin();
|
||||||
if (width > wt) width = wt;
|
if (width > wt) width = wt;
|
||||||
if (leftTile && leftTile->getYMax() != getYMax()) {
|
if (leftTile && leftTile->getYMax() != getYMax()) {
|
||||||
leftTile->SplitHorizontal (region, getYMax());
|
leftTile->splitHorizontal (region, getYMax());
|
||||||
}
|
}
|
||||||
return width;
|
return width;
|
||||||
}; // Region_Tile::_LeftSplitAtHorizontalSize
|
}; // Region_Tile::_LeftSplitAtHorizontalSize
|
||||||
|
@ -711,7 +711,7 @@ Region_Tile::_RightSplitAtHorizontalSize (Region* region)
|
||||||
Region_Tile* rightTile = _rightTile;
|
Region_Tile* rightTile = _rightTile;
|
||||||
Unit width = rightTile->getXMax() - getXMax();
|
Unit width = rightTile->getXMax() - getXMax();
|
||||||
if (rightTile && rightTile->getYMax() != getYMax()) {
|
if (rightTile && rightTile->getYMax() != getYMax()) {
|
||||||
rightTile->SplitHorizontal (region, getYMax());
|
rightTile->splitHorizontal (region, getYMax());
|
||||||
rightTile = _rightTile;
|
rightTile = _rightTile;
|
||||||
}
|
}
|
||||||
Unit wt;
|
Unit wt;
|
||||||
|
@ -723,7 +723,7 @@ Region_Tile::_RightSplitAtHorizontalSize (Region* region)
|
||||||
wt = rightTile->getXMax() - getXMax();
|
wt = rightTile->getXMax() - getXMax();
|
||||||
if (width > wt) width = wt;
|
if (width > wt) width = wt;
|
||||||
if (rightTile && rightTile->getYMin() != getYMin()) {
|
if (rightTile && rightTile->getYMin() != getYMin()) {
|
||||||
rightTile->SplitHorizontal (region, getYMin());
|
rightTile->splitHorizontal (region, getYMin());
|
||||||
}
|
}
|
||||||
return width;
|
return width;
|
||||||
}; // Region_Tile::_RightSplitAtHorizontalSize
|
}; // Region_Tile::_RightSplitAtHorizontalSize
|
||||||
|
@ -740,7 +740,7 @@ Region_Tile::_TopSplitAtHorizontalSize (Region* region, const Unit height)
|
||||||
|
|
||||||
while (upTile && upTile->getXMin() >= getXMin()) {
|
while (upTile && upTile->getXMin() >= getXMin()) {
|
||||||
if (upTile->getYMax() - getYMax() > height) {
|
if (upTile->getYMax() - getYMax() > height) {
|
||||||
upTile->SplitHorizontal (region, getYMax() + height);
|
upTile->splitHorizontal (region, getYMax() + height);
|
||||||
if (upTile->_bottomTile != this) upTile = upTile->_bottomTile;
|
if (upTile->_bottomTile != this) upTile = upTile->_bottomTile;
|
||||||
modif = true;
|
modif = true;
|
||||||
}
|
}
|
||||||
|
@ -765,7 +765,7 @@ Region_Tile::_BottomSplitAtHorizontalSize (Region* region, const Unit height)
|
||||||
|
|
||||||
while (downTile && downTile->getXMax() <= getXMax()) {
|
while (downTile && downTile->getXMax() <= getXMax()) {
|
||||||
if (getYMin() - downTile->getYMin() > height) {
|
if (getYMin() - downTile->getYMin() > height) {
|
||||||
downTile->SplitHorizontal (region, getYMin() - height);
|
downTile->splitHorizontal (region, getYMin() - height);
|
||||||
modif = true;
|
modif = true;
|
||||||
if (downTile->_topTile != this) downTile = downTile->_topTile;
|
if (downTile->_topTile != this) downTile = downTile->_topTile;
|
||||||
}
|
}
|
||||||
|
@ -789,7 +789,7 @@ Region_Tile::_LeftSplitAtVerticalSize (Region* region, const Unit width)
|
||||||
|
|
||||||
while (leftTile && leftTile->getYMax() <= getYMax()) {
|
while (leftTile && leftTile->getYMax() <= getYMax()) {
|
||||||
if (getXMin() - leftTile->getXMin() > width) {
|
if (getXMin() - leftTile->getXMin() > width) {
|
||||||
leftTile->SplitVertical (region, getXMin() - width);
|
leftTile->splitVertical (region, getXMin() - width);
|
||||||
modif = true;
|
modif = true;
|
||||||
if (leftTile->_rightTile != this) leftTile = leftTile->_rightTile;
|
if (leftTile->_rightTile != this) leftTile = leftTile->_rightTile;
|
||||||
}
|
}
|
||||||
|
@ -814,7 +814,7 @@ Region_Tile::_RightSplitAtVerticalSize (Region* region, const Unit width)
|
||||||
|
|
||||||
while (rightTile && rightTile->getYMin() >= getYMin()) {
|
while (rightTile && rightTile->getYMin() >= getYMin()) {
|
||||||
if (rightTile->getXMax() - getXMax() > width) {
|
if (rightTile->getXMax() - getXMax() > width) {
|
||||||
rightTile->SplitVertical (region, getXMax() + width);
|
rightTile->splitVertical (region, getXMax() + width);
|
||||||
modif = true;
|
modif = true;
|
||||||
if (rightTile->_leftTile != this) rightTile = rightTile->_leftTile;
|
if (rightTile->_leftTile != this) rightTile = rightTile->_leftTile;
|
||||||
}
|
}
|
||||||
|
@ -986,7 +986,7 @@ Filter<Region_Tile*>* Region_Tile::IsVoidFilter::getClone() const
|
||||||
bool Region_Tile::IsVoidFilter::accept(Region_Tile* tile) const
|
bool Region_Tile::IsVoidFilter::accept(Region_Tile* tile) const
|
||||||
// ************************************************************
|
// ************************************************************
|
||||||
{
|
{
|
||||||
return tile->IsVoid();
|
return tile->isVoid();
|
||||||
}
|
}
|
||||||
|
|
||||||
string Region_Tile::IsVoidFilter::_getString() const
|
string Region_Tile::IsVoidFilter::_getString() const
|
||||||
|
@ -2013,12 +2013,12 @@ Region_Intervals::Locator::Locator(const Region::SwapLine* swapLine)
|
||||||
Unit x = _swapLine->getPosition();
|
Unit x = _swapLine->getPosition();
|
||||||
Unit yMax = _swapLine->getExtention().getVMax();
|
Unit yMax = _swapLine->getExtention().getVMax();
|
||||||
_lowerTile = _swapLine->_getBaseTile();
|
_lowerTile = _swapLine->_getBaseTile();
|
||||||
while (_lowerTile && _lowerTile->IsVoid())
|
while (_lowerTile && _lowerTile->isVoid())
|
||||||
_lowerTile = _lowerTile->getTopTile(x);
|
_lowerTile = _lowerTile->getTopTile(x);
|
||||||
if (_lowerTile && (yMax < _lowerTile->getYMin())) _lowerTile = NULL;
|
if (_lowerTile && (yMax < _lowerTile->getYMin())) _lowerTile = NULL;
|
||||||
if (_lowerTile) {
|
if (_lowerTile) {
|
||||||
Region::Tile* tile = _lowerTile;
|
Region::Tile* tile = _lowerTile;
|
||||||
while (tile && !tile->IsVoid()) {
|
while (tile && !tile->isVoid()) {
|
||||||
_upperTile = tile;
|
_upperTile = tile;
|
||||||
tile = tile->getTopTile(x);
|
tile = tile->getTopTile(x);
|
||||||
if (tile && (yMax < tile->getYMin())) tile = NULL;
|
if (tile && (yMax < tile->getYMin())) tile = NULL;
|
||||||
|
@ -2030,12 +2030,12 @@ Region_Intervals::Locator::Locator(const Region::SwapLine* swapLine)
|
||||||
Unit y = _swapLine->getPosition();
|
Unit y = _swapLine->getPosition();
|
||||||
Unit xMax = _swapLine->getExtention().getVMax();
|
Unit xMax = _swapLine->getExtention().getVMax();
|
||||||
_lowerTile = _swapLine->_getBaseTile();
|
_lowerTile = _swapLine->_getBaseTile();
|
||||||
while (_lowerTile && _lowerTile->IsVoid())
|
while (_lowerTile && _lowerTile->isVoid())
|
||||||
_lowerTile = _lowerTile->getRightTile(y);
|
_lowerTile = _lowerTile->getRightTile(y);
|
||||||
if (_lowerTile && (xMax < _lowerTile->getXMin())) _lowerTile = NULL;
|
if (_lowerTile && (xMax < _lowerTile->getXMin())) _lowerTile = NULL;
|
||||||
if (_lowerTile) {
|
if (_lowerTile) {
|
||||||
Region::Tile* tile = _lowerTile;
|
Region::Tile* tile = _lowerTile;
|
||||||
while (tile && !tile->IsVoid()) {
|
while (tile && !tile->isVoid()) {
|
||||||
_upperTile = tile;
|
_upperTile = tile;
|
||||||
tile = tile->getRightTile(y);
|
tile = tile->getRightTile(y);
|
||||||
if (tile && (xMax < tile->getXMin())) tile = NULL;
|
if (tile && (xMax < tile->getXMin())) tile = NULL;
|
||||||
|
@ -2106,13 +2106,13 @@ void Region_Intervals::Locator::progress()
|
||||||
Unit x = _swapLine->getPosition();
|
Unit x = _swapLine->getPosition();
|
||||||
Unit yMax = _swapLine->getExtention().getVMax();
|
Unit yMax = _swapLine->getExtention().getVMax();
|
||||||
_lowerTile = _upperTile->getTopTile(x);
|
_lowerTile = _upperTile->getTopTile(x);
|
||||||
while (_lowerTile && _lowerTile->IsVoid())
|
while (_lowerTile && _lowerTile->isVoid())
|
||||||
_lowerTile = _lowerTile->getTopTile(x);
|
_lowerTile = _lowerTile->getTopTile(x);
|
||||||
if (_lowerTile && (yMax < _lowerTile->getYMin())) _lowerTile = NULL;
|
if (_lowerTile && (yMax < _lowerTile->getYMin())) _lowerTile = NULL;
|
||||||
_upperTile = NULL;
|
_upperTile = NULL;
|
||||||
if (_lowerTile) {
|
if (_lowerTile) {
|
||||||
Region::Tile* tile = _lowerTile;
|
Region::Tile* tile = _lowerTile;
|
||||||
while (tile && !tile->IsVoid()) {
|
while (tile && !tile->isVoid()) {
|
||||||
_upperTile = tile;
|
_upperTile = tile;
|
||||||
tile = tile->getTopTile(x);
|
tile = tile->getTopTile(x);
|
||||||
if (tile && (yMax < tile->getYMin())) tile = NULL;
|
if (tile && (yMax < tile->getYMin())) tile = NULL;
|
||||||
|
@ -2124,13 +2124,13 @@ void Region_Intervals::Locator::progress()
|
||||||
Unit y = _swapLine->getPosition();
|
Unit y = _swapLine->getPosition();
|
||||||
Unit xMax = _swapLine->getExtention().getVMax();
|
Unit xMax = _swapLine->getExtention().getVMax();
|
||||||
_lowerTile = _upperTile->getRightTile(y);
|
_lowerTile = _upperTile->getRightTile(y);
|
||||||
while (_lowerTile && _lowerTile->IsVoid())
|
while (_lowerTile && _lowerTile->isVoid())
|
||||||
_lowerTile = _lowerTile->getRightTile(y);
|
_lowerTile = _lowerTile->getRightTile(y);
|
||||||
if (_lowerTile && (xMax < _lowerTile->getXMin())) _lowerTile = NULL;
|
if (_lowerTile && (xMax < _lowerTile->getXMin())) _lowerTile = NULL;
|
||||||
_upperTile = NULL;
|
_upperTile = NULL;
|
||||||
if (_lowerTile) {
|
if (_lowerTile) {
|
||||||
Region::Tile* tile = _lowerTile;
|
Region::Tile* tile = _lowerTile;
|
||||||
while (tile && !tile->IsVoid()) {
|
while (tile && !tile->isVoid()) {
|
||||||
_upperTile = tile;
|
_upperTile = tile;
|
||||||
tile = tile->getRightTile(y);
|
tile = tile->getRightTile(y);
|
||||||
if (tile && (xMax < tile->getXMin())) tile = NULL;
|
if (tile && (xMax < tile->getXMin())) tile = NULL;
|
||||||
|
@ -2221,17 +2221,17 @@ Region::SwapLine::SwapLine(Region* region, const Type& type, const Interval& ext
|
||||||
if (!_region)
|
if (!_region)
|
||||||
throw Error("Can't create " + _TName("Region::SwapLine") + " : null region");
|
throw Error("Can't create " + _TName("Region::SwapLine") + " : null region");
|
||||||
|
|
||||||
if (!_region->IsEmpty()) {
|
if (!_region->isEmpty()) {
|
||||||
switch (_type) {
|
switch (_type) {
|
||||||
case Type::VERTICAL : {
|
case Type::VERTICAL : {
|
||||||
_position = _region->getXMin();
|
_position = _region->getXMin();
|
||||||
if (_extention.IsEmpty()) _extention = Interval(_region->getYMin(), _region->getYMax());
|
if (_extention.isEmpty()) _extention = Interval(_region->getYMin(), _region->getYMax());
|
||||||
_baseTile = _region->_getTileAt(Point(_position, _extention.getVMin()));
|
_baseTile = _region->_getTileAt(Point(_position, _extention.getVMin()));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Type::HORIZONTAL : {
|
case Type::HORIZONTAL : {
|
||||||
_position = _region->getYMin();
|
_position = _region->getYMin();
|
||||||
if (_extention.IsEmpty()) _extention = Interval(_region->getXMin(), _region->getXMax());
|
if (_extention.isEmpty()) _extention = Interval(_region->getXMin(), _region->getXMax());
|
||||||
_baseTile = _region->_getTileAt(Point(_extention.getVMin(), _position));
|
_baseTile = _region->_getTileAt(Point(_extention.getVMin(), _position));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2250,15 +2250,15 @@ Region::SwapLine::SwapLine(Region* region, const Type& type, const Unit& positio
|
||||||
if (!_region)
|
if (!_region)
|
||||||
throw Error("Can't create " + _TName("Region::SwapLine") + " : null region");
|
throw Error("Can't create " + _TName("Region::SwapLine") + " : null region");
|
||||||
|
|
||||||
if (!_region->IsEmpty()) {
|
if (!_region->isEmpty()) {
|
||||||
switch (_type) {
|
switch (_type) {
|
||||||
case Type::VERTICAL : {
|
case Type::VERTICAL : {
|
||||||
if (_extention.IsEmpty()) _extention = Interval(_region->getYMin(), _region->getYMax());
|
if (_extention.isEmpty()) _extention = Interval(_region->getYMin(), _region->getYMax());
|
||||||
_baseTile = _region->_getTileAt(Point(_position, _extention.getVMin()));
|
_baseTile = _region->_getTileAt(Point(_position, _extention.getVMin()));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Type::HORIZONTAL : {
|
case Type::HORIZONTAL : {
|
||||||
if (_extention.IsEmpty()) _extention = Interval(_region->getXMin(), _region->getXMax());
|
if (_extention.isEmpty()) _extention = Interval(_region->getXMin(), _region->getXMax());
|
||||||
_baseTile = _region->_getTileAt(Point(_extention.getVMin(), _position));
|
_baseTile = _region->_getTileAt(Point(_extention.getVMin(), _position));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2371,10 +2371,10 @@ void Region::SwapLine::progress(int n)
|
||||||
void Region::SwapLine::translate(const Unit& quantity)
|
void Region::SwapLine::translate(const Unit& quantity)
|
||||||
// ***************************************************
|
// ***************************************************
|
||||||
{
|
{
|
||||||
if (quantity) SetPosition(getPosition() + quantity);
|
if (quantity) setPosition(getPosition() + quantity);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Region::SwapLine::SetPosition(const Unit& position)
|
void Region::SwapLine::setPosition(const Unit& position)
|
||||||
// *****************************************************
|
// *****************************************************
|
||||||
{
|
{
|
||||||
if (position != _position) {
|
if (position != _position) {
|
||||||
|
@ -2456,13 +2456,13 @@ Region::Region(const Region& region)
|
||||||
Region::~Region()
|
Region::~Region()
|
||||||
// **************
|
// **************
|
||||||
{
|
{
|
||||||
Clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
Region& Region::operator=(const Region& region)
|
Region& Region::operator=(const Region& region)
|
||||||
// ********************************************
|
// ********************************************
|
||||||
{
|
{
|
||||||
Clear();
|
clear();
|
||||||
// keep trace (as void tile) of the initial bounding box
|
// keep trace (as void tile) of the initial bounding box
|
||||||
Box initialBoundingBox = region.getBoundingBox();
|
Box initialBoundingBox = region.getBoundingBox();
|
||||||
if (! initialBoundingBox.isEmpty()) {
|
if (! initialBoundingBox.isEmpty()) {
|
||||||
|
@ -2557,32 +2557,32 @@ Region::SwapLine Region::getHorizontalSwapLine(const Unit& y, const Interval& ex
|
||||||
return SwapLine((Region*)this, Region::SwapLine::Type::HORIZONTAL, y, extention);
|
return SwapLine((Region*)this, Region::SwapLine::Type::HORIZONTAL, y, extention);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Region::IsEmpty() const
|
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
|
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
|
bool Region::contains(const Box& box) const
|
||||||
// ****************************************
|
// ****************************************
|
||||||
{
|
{
|
||||||
if (box.isPonctual()) return Contains(box.getCenter());
|
if (box.isPonctual()) return contains(box.getCenter());
|
||||||
return getBoundingBox().contains(box) &&
|
return getBoundingBox().contains(box) &&
|
||||||
Region_TilesUnder (this, Box(box).inflate(-1))
|
Region_TilesUnder (this, Box(box).inflate(-1))
|
||||||
.getSubSet(Tile::getIsVoidFilter()).IsEmpty();
|
.getSubSet(Tile::getIsVoidFilter()).IsEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Region::Contains(const Region& region) const
|
bool Region::contains(const Region& region) const
|
||||||
// **********************************************
|
// **********************************************
|
||||||
{
|
{
|
||||||
for_each_box(box, region.getBoxesUnder(getBoundingBox())) {
|
for_each_box(box, region.getBoxesUnder(getBoundingBox())) {
|
||||||
if (!Contains(box)) return false;
|
if (!contains(box)) return false;
|
||||||
end_for;
|
end_for;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -2595,7 +2595,7 @@ bool Region::Intersect(const Box& box) const
|
||||||
if (box.isPonctual()) return contains(box.getCenter());
|
if (box.isPonctual()) return contains(box.getCenter());
|
||||||
if (! getBoundingBox().Intersect(box)) return false;
|
if (! getBoundingBox().Intersect(box)) return false;
|
||||||
if (! Region_TilesUnder (this, Box(box).inflate(1))
|
if (! Region_TilesUnder (this, Box(box).inflate(1))
|
||||||
.getSubSet(! Tile::getIsVoidFilter()).IsEmpty()) return true;
|
.getSubSet(! Tile::getIsVoidFilter()).isEmpty()) return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2610,7 +2610,7 @@ bool Region::Intersect(const Region& region) const
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Region& Region::Clear()
|
Region& Region::clear()
|
||||||
// ********************
|
// ********************
|
||||||
{
|
{
|
||||||
stack<Tile*> tileStack;
|
stack<Tile*> tileStack;
|
||||||
|
@ -2660,11 +2660,11 @@ Region& Region::fill(const Box& box)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!getBoundingBox().contains(box))
|
if (!getBoundingBox().contains(box))
|
||||||
_Update(box, false);
|
_update(box, false);
|
||||||
else {
|
else {
|
||||||
Tile* startTile = _getStartTile(_getTileAt(Point(box.getXMax(), box.getYMin())));
|
Tile* startTile = _getStartTile(_getTileAt(Point(box.getXMax(), box.getYMin())));
|
||||||
GenericCollection<Tile*> tiles = _getTilesUnder(Box(box).inflate(0, 0, -1, -1), startTile);
|
GenericCollection<Tile*> tiles = _getTilesUnder(Box(box).inflate(0, 0, -1, -1), startTile);
|
||||||
if (!tiles.getSubSet(Tile::getIsVoidFilter()).IsEmpty()) _Update(box, false, startTile);
|
if (!tiles.getSubSet(Tile::getIsVoidFilter()).IsEmpty()) _update(box, false, startTile);
|
||||||
}
|
}
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
|
@ -2686,7 +2686,7 @@ Region& Region::getUnion (const Region& region)
|
||||||
return fill(region);
|
return fill(region);
|
||||||
}
|
}
|
||||||
|
|
||||||
Region& Region::Groove(const Box& box)
|
Region& Region::groove(const Box& box)
|
||||||
// ***********************************
|
// ***********************************
|
||||||
{
|
{
|
||||||
if (!_bottomRightTile) return *this;
|
if (!_bottomRightTile) return *this;
|
||||||
|
@ -2697,17 +2697,17 @@ Region& Region::Groove(const Box& box)
|
||||||
|
|
||||||
Tile* startTile = _getStartTile(_getTileAt(Point(correctedBox.getXMax(), correctedBox.getYMin())));
|
Tile* startTile = _getStartTile(_getTileAt(Point(correctedBox.getXMax(), correctedBox.getYMin())));
|
||||||
GenericCollection<Tile*> tiles = _getTilesUnder(Box(correctedBox).inflate(0, 0, -1, -1), startTile);
|
GenericCollection<Tile*> tiles = _getTilesUnder(Box(correctedBox).inflate(0, 0, -1, -1), startTile);
|
||||||
if (!tiles.getSubSet(!Tile::getIsVoidFilter()).IsEmpty()) _Update(box, true, startTile);
|
if (!tiles.getSubSet(!Tile::getIsVoidFilter()).IsEmpty()) _update(box, true, startTile);
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
Region& Region::Groove(const Region& region)
|
Region& Region::groove(const Region& region)
|
||||||
// *****************************************
|
// *****************************************
|
||||||
{
|
{
|
||||||
Box boundingBox = getBoundingBox();
|
Box boundingBox = getBoundingBox();
|
||||||
for_each_box(box, region.getBoxesUnder(boundingBox)) {
|
for_each_box(box, region.getBoxesUnder(boundingBox)) {
|
||||||
Groove(box);
|
groove(box);
|
||||||
end_for;
|
end_for;
|
||||||
}
|
}
|
||||||
return *this;
|
return *this;
|
||||||
|
@ -2720,7 +2720,7 @@ Region& Region::getIntersection (const Region& region)
|
||||||
for_each_box (box, region.getVoidBoxesUnder (boundingBox)) {
|
for_each_box (box, region.getVoidBoxesUnder (boundingBox)) {
|
||||||
//for_each_box (box, region.getVoidBoxes ()) {
|
//for_each_box (box, region.getVoidBoxes ()) {
|
||||||
//if (! boundingBox.Intersect (box)) continue;
|
//if (! boundingBox.Intersect (box)) continue;
|
||||||
Groove (box);
|
groove (box);
|
||||||
end_for;
|
end_for;
|
||||||
}
|
}
|
||||||
return *this;
|
return *this;
|
||||||
|
@ -2729,7 +2729,7 @@ Region& Region::getIntersection (const Region& region)
|
||||||
Region& Region::Inflate(const Unit& quantity)
|
Region& Region::Inflate(const Unit& quantity)
|
||||||
// ******************************************
|
// ******************************************
|
||||||
{
|
{
|
||||||
if (!IsEmpty()) {
|
if (!isEmpty()) {
|
||||||
if (0 < quantity) {
|
if (0 < quantity) {
|
||||||
list<Box> boxList;
|
list<Box> boxList;
|
||||||
for_each_object(Tile*, tile, Region_Tiles(this).getSubSet(!Tile::getIsVoidFilter())) {
|
for_each_object(Tile*, tile, Region_Tiles(this).getSubSet(!Tile::getIsVoidFilter())) {
|
||||||
|
@ -2742,14 +2742,14 @@ Region& Region::Inflate(const Unit& quantity)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (quantity < 0) {
|
else if (quantity < 0) {
|
||||||
_GrowthToFit(getBoundingBox().inflate(getUnit(1)));
|
_growthToFit(getBoundingBox().inflate(getUnit(1)));
|
||||||
list<Box> boxList;
|
list<Box> boxList;
|
||||||
for_each_object(Tile*, tile, Region_Tiles(this).getSubSet(Tile::getIsVoidFilter())) {
|
for_each_object(Tile*, tile, Region_Tiles(this).getSubSet(Tile::getIsVoidFilter())) {
|
||||||
boxList.push_back(tile->getBoundingBox());
|
boxList.push_back(tile->getBoundingBox());
|
||||||
end_for;
|
end_for;
|
||||||
}
|
}
|
||||||
for_each_box(box, getCollection(boxList)) {
|
for_each_box(box, getCollection(boxList)) {
|
||||||
Groove(box.inflate(-quantity));
|
groove(box.inflate(-quantity));
|
||||||
end_for;
|
end_for;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2839,7 +2839,7 @@ GenericCollection<Region_Tile*> Region::_getTilesUnder(const Box& area, Tile* st
|
||||||
return Region_TilesUnder(this, area, startTile);
|
return Region_TilesUnder(this, area, startTile);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Region::_Split(const Box& box)
|
void Region::_split(const Box& box)
|
||||||
// ********************************
|
// ********************************
|
||||||
{
|
{
|
||||||
if (getBoundingBox().intersect(box)) {
|
if (getBoundingBox().intersect(box)) {
|
||||||
|
@ -2850,7 +2850,7 @@ void Region::_Split(const Box& box)
|
||||||
Box line = Box(box.getXMin(), box.getYMin(), box.getXMax() - 1, box.getYMin());
|
Box line = Box(box.getXMin(), box.getYMin(), box.getXMax() - 1, box.getYMin());
|
||||||
_getTilesUnder(line, startTile).fill(tileList);
|
_getTilesUnder(line, startTile).fill(tileList);
|
||||||
for_each_object(Tile*, tile, getCollection(tileList)) {
|
for_each_object(Tile*, tile, getCollection(tileList)) {
|
||||||
tile->SplitHorizontal(this, box.getYMin());
|
tile->splitHorizontal(this, box.getYMin());
|
||||||
end_for;
|
end_for;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2858,7 +2858,7 @@ void Region::_Split(const Box& box)
|
||||||
line = Box(box.getXMin(), box.getYMax(), box.getXMax() - 1, box.getYMax());
|
line = Box(box.getXMin(), box.getYMax(), box.getXMax() - 1, box.getYMax());
|
||||||
_getTilesUnder(line, startTile).fill(tileList);
|
_getTilesUnder(line, startTile).fill(tileList);
|
||||||
for_each_object(Tile*, tile, getCollection(tileList)) {
|
for_each_object(Tile*, tile, getCollection(tileList)) {
|
||||||
tile->SplitHorizontal(this, box.getYMax());
|
tile->splitHorizontal(this, box.getYMax());
|
||||||
end_for;
|
end_for;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2866,7 +2866,7 @@ void Region::_Split(const Box& box)
|
||||||
line = Box(box.getXMin(), box.getYMin(), box.getXMin(), box.getYMax() - 1);
|
line = Box(box.getXMin(), box.getYMin(), box.getXMin(), box.getYMax() - 1);
|
||||||
_getTilesUnder(line, startTile).fill(tileList);
|
_getTilesUnder(line, startTile).fill(tileList);
|
||||||
for_each_object(Tile*, tile, getCollection(tileList)) {
|
for_each_object(Tile*, tile, getCollection(tileList)) {
|
||||||
tile->SplitVertical(this, box.getXMin());
|
tile->splitVertical(this, box.getXMin());
|
||||||
end_for;
|
end_for;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2874,13 +2874,13 @@ void Region::_Split(const Box& box)
|
||||||
line = Box(box.getXMax(), box.getYMin(), box.getXMax(), box.getYMax() - 1);
|
line = Box(box.getXMax(), box.getYMin(), box.getXMax(), box.getYMax() - 1);
|
||||||
_getTilesUnder(line, startTile).fill(tileList);
|
_getTilesUnder(line, startTile).fill(tileList);
|
||||||
for_each_object(Tile*, tile, getCollection(tileList)) {
|
for_each_object(Tile*, tile, getCollection(tileList)) {
|
||||||
tile->SplitVertical(this, box.getXMax());
|
tile->splitVertical(this, box.getXMax());
|
||||||
end_for;
|
end_for;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Region::_GrowthToFit(const Box& box)
|
void Region::_growthToFit(const Box& box)
|
||||||
// **************************************
|
// **************************************
|
||||||
{
|
{
|
||||||
if (box.isEmpty()) return;
|
if (box.isEmpty()) return;
|
||||||
|
@ -2938,14 +2938,14 @@ void Region::_GrowthToFit(const Box& box)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Region::_Update(const Box& box, bool isVoid, Tile* startTile)
|
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);
|
||||||
|
|
||||||
|
@ -2999,10 +2999,10 @@ void Region::_Update(const Box& box, bool isVoid, Tile* startTile)
|
||||||
|
|
||||||
newTile->CleanNeighbours(this);
|
newTile->CleanNeighbours(this);
|
||||||
newTile->mergeNeighbours(this);
|
newTile->mergeNeighbours(this);
|
||||||
}; // Region::_Update
|
}; // Region::_update
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Region::VerticalEnhancement()
|
Region::verticalEnhancement()
|
||||||
// **************************
|
// **************************
|
||||||
{
|
{
|
||||||
bool modif = false;
|
bool modif = false;
|
||||||
|
@ -3028,15 +3028,15 @@ Region::VerticalEnhancement()
|
||||||
modif = tile->VerticalEnhancement (this);
|
modif = tile->VerticalEnhancement (this);
|
||||||
}
|
}
|
||||||
result.fill (tile->getBoundingBox());
|
result.fill (tile->getBoundingBox());
|
||||||
Groove (tile->getBoundingBox());
|
groove (tile->getBoundingBox());
|
||||||
} while (! IsEmpty());
|
} while (! isEmpty());
|
||||||
fill (result);
|
fill (result);
|
||||||
return modif;
|
return modif;
|
||||||
}; // Region::VerticalEnhancement
|
}; // Region::VerticalEnhancement
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Region::VerticalEnhancement(Point point)
|
Region::verticalEnhancement(Point point)
|
||||||
// ***************************************
|
// ***************************************
|
||||||
// Amelioration de la tuile contenant point
|
// Amelioration de la tuile contenant point
|
||||||
{
|
{
|
||||||
|
@ -3048,7 +3048,7 @@ Region::VerticalEnhancement(Point point)
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Region::HorizontalEnhancement()
|
Region::horizontalEnhancement()
|
||||||
// ****************************
|
// ****************************
|
||||||
{
|
{
|
||||||
bool modif = false;
|
bool modif = false;
|
||||||
|
@ -3074,14 +3074,14 @@ Region::HorizontalEnhancement()
|
||||||
modif = tile->HorizontalEnhancement (this);
|
modif = tile->HorizontalEnhancement (this);
|
||||||
}
|
}
|
||||||
result.fill (tile->getBoundingBox());
|
result.fill (tile->getBoundingBox());
|
||||||
Groove (tile->getBoundingBox());
|
groove (tile->getBoundingBox());
|
||||||
} while (! IsEmpty());
|
} while (! isEmpty());
|
||||||
fill (result);
|
fill (result);
|
||||||
return modif;
|
return modif;
|
||||||
}; // Region::HorizontalEnhancement
|
};
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Region::HorizontalEnhancement(Point point)
|
Region::horizontalEnhancement(Point point)
|
||||||
// ***************************************
|
// ***************************************
|
||||||
// Amelioration de la tuile contenant point
|
// Amelioration de la tuile contenant point
|
||||||
{
|
{
|
||||||
|
@ -3093,7 +3093,7 @@ Region::HorizontalEnhancement(Point point)
|
||||||
|
|
||||||
|
|
||||||
Interval
|
Interval
|
||||||
Region::TopBottomFacing (const Box box) const
|
Region::topBottomFacing (const Box box) const
|
||||||
// **********************************************
|
// **********************************************
|
||||||
// Retourne le merge des intervales en vis a vis entre les boites
|
// Retourne le merge des intervales en vis a vis entre les boites
|
||||||
// dessus et dessous de box
|
// dessus et dessous de box
|
||||||
|
@ -3107,7 +3107,7 @@ Region::TopBottomFacing (const Box box) const
|
||||||
}; // Region::TopBottomFacing
|
}; // Region::TopBottomFacing
|
||||||
|
|
||||||
Interval
|
Interval
|
||||||
Region::LeftRightFacing (const Box box) const
|
Region::leftRightFacing (const Box box) const
|
||||||
// **********************************************
|
// **********************************************
|
||||||
// Retourne le merge des intervales en vis a vis entre les boites
|
// Retourne le merge des intervales en vis a vis entre les boites
|
||||||
// a gauche et droite de box
|
// a gauche et droite de box
|
||||||
|
|
|
@ -100,7 +100,7 @@ class Region {
|
||||||
|
|
||||||
public: void progress(int n = 1);
|
public: void progress(int n = 1);
|
||||||
public: void translate(const Unit& quantity);
|
public: void translate(const Unit& quantity);
|
||||||
public: void SetPosition(const Unit& position);
|
public: void setPosition(const Unit& position);
|
||||||
|
|
||||||
// Others
|
// Others
|
||||||
// ******
|
// ******
|
||||||
|
@ -160,11 +160,11 @@ class Region {
|
||||||
// Predicates
|
// Predicates
|
||||||
// **********
|
// **********
|
||||||
|
|
||||||
public: bool IsEmpty() const;
|
public: bool isEmpty() const;
|
||||||
|
|
||||||
public: bool Contains(const Point& point) const;
|
public: bool contains(const Point& point) const;
|
||||||
public: bool Contains(const Box& box) const;
|
public: bool contains(const Box& box) const;
|
||||||
public: bool Contains(const Region& region) const;
|
public: bool contains(const Region& region) const;
|
||||||
#if 0 // pas encore teste
|
#if 0 // pas encore teste
|
||||||
public: bool Intersect(const Box& box) const;
|
public: bool Intersect(const Box& box) const;
|
||||||
public: bool Intersect(const Region& region) const;
|
public: bool Intersect(const Region& region) const;
|
||||||
|
@ -173,25 +173,25 @@ class Region {
|
||||||
// Updators
|
// Updators
|
||||||
// ********
|
// ********
|
||||||
|
|
||||||
public: Region& Clear();
|
public: Region& clear();
|
||||||
|
|
||||||
public: Region& fill(const Box& box);
|
public: Region& fill(const Box& box);
|
||||||
public: Region& fill(const Region& region);
|
public: Region& fill(const Region& region);
|
||||||
public: Region& getUnion(const Region& region);
|
public: Region& getUnion(const Region& region);
|
||||||
|
|
||||||
public: Region& Groove(const Box& box);
|
public: Region& groove(const Box& box);
|
||||||
public: Region& Groove(const Region& region);
|
public: Region& groove(const Region& region);
|
||||||
public: Region& getIntersection(const Region& region);
|
public: Region& getIntersection(const Region& region);
|
||||||
|
|
||||||
public: Region& Inflate(const Unit& quantity);
|
public: Region& Inflate(const Unit& quantity);
|
||||||
public: Region& translate(const Unit& dx, const Unit& dy);
|
public: Region& translate(const Unit& dx, const Unit& dy);
|
||||||
|
|
||||||
public: bool VerticalEnhancement();
|
public: bool verticalEnhancement();
|
||||||
public: bool VerticalEnhancement(Point point);
|
public: bool verticalEnhancement(Point point);
|
||||||
public: bool HorizontalEnhancement();
|
public: bool horizontalEnhancement();
|
||||||
public: bool HorizontalEnhancement(Point point);
|
public: bool horizontalEnhancement(Point point);
|
||||||
public: Interval TopBottomFacing (const Box box) const;
|
public: Interval topBottomFacing (const Box box) const;
|
||||||
public: Interval LeftRightFacing (const Box box) const;
|
public: Interval leftRightFacing (const Box box) const;
|
||||||
|
|
||||||
// Others
|
// Others
|
||||||
// ******
|
// ******
|
||||||
|
@ -210,9 +210,9 @@ class Region {
|
||||||
|
|
||||||
public: void _setBottomRightTile(Tile* bottomRightTile) {_bottomRightTile = bottomRightTile;};
|
public: void _setBottomRightTile(Tile* bottomRightTile) {_bottomRightTile = bottomRightTile;};
|
||||||
public: void _setTopLeftTile(Tile* topLeftTile) {_topLeftTile = topLeftTile;};
|
public: void _setTopLeftTile(Tile* topLeftTile) {_topLeftTile = topLeftTile;};
|
||||||
public: void _Split(const Box& box);
|
public: void _split(const Box& box);
|
||||||
public: void _GrowthToFit(const Box& box);
|
public: void _growthToFit(const Box& box);
|
||||||
public: void _Update(const Box& box, bool isVoid, Tile* startTile = NULL);
|
public: void _update(const Box& box, bool isVoid, Tile* startTile = NULL);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -241,7 +241,7 @@ Point Segment::getTargetPosition() const
|
||||||
return Point(getTargetX(), getTargetY());
|
return Point(getTargetX(), getTargetY());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Segment::SetLayer(Layer* layer)
|
void Segment::setLayer(Layer* layer)
|
||||||
// *********************************
|
// *********************************
|
||||||
{
|
{
|
||||||
if (!layer)
|
if (!layer)
|
||||||
|
@ -253,7 +253,7 @@ void Segment::SetLayer(Layer* layer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Segment::SetWidth(const Unit& width)
|
void Segment::setWidth(const Unit& width)
|
||||||
// **************************************
|
// **************************************
|
||||||
{
|
{
|
||||||
if (width != _width) {
|
if (width != _width) {
|
||||||
|
@ -262,7 +262,7 @@ void Segment::SetWidth(const Unit& width)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Segment::Invert()
|
void Segment::invert()
|
||||||
// *******************
|
// *******************
|
||||||
{
|
{
|
||||||
Component* source = getSource();
|
Component* source = getSource();
|
||||||
|
|
|
@ -100,9 +100,9 @@ class Segment : public Component {
|
||||||
// Updators
|
// Updators
|
||||||
// ********
|
// ********
|
||||||
|
|
||||||
public: void SetLayer(Layer* layer);
|
public: void setLayer(Layer* layer);
|
||||||
public: void SetWidth(const Unit& width);
|
public: void setWidth(const Unit& width);
|
||||||
public: void Invert();
|
public: void invert();
|
||||||
|
|
||||||
// Others
|
// Others
|
||||||
// ******
|
// ******
|
||||||
|
|
|
@ -113,7 +113,7 @@ void Vertical::translate(const Unit& dx, const Unit& dy)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Vertical::SetX(const Unit& x)
|
void Vertical::setX(const Unit& x)
|
||||||
// *******************************
|
// *******************************
|
||||||
{
|
{
|
||||||
if (x != _x) {
|
if (x != _x) {
|
||||||
|
@ -122,7 +122,7 @@ void Vertical::SetX(const Unit& x)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Vertical::SetDySource(const Unit& dySource)
|
void Vertical::setDySource(const Unit& dySource)
|
||||||
// *********************************************
|
// *********************************************
|
||||||
{
|
{
|
||||||
if (dySource != _dySource) {
|
if (dySource != _dySource) {
|
||||||
|
@ -131,7 +131,7 @@ void Vertical::SetDySource(const Unit& dySource)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Vertical::SetDyTarget(const Unit& dyTarget)
|
void Vertical::setDyTarget(const Unit& dyTarget)
|
||||||
// *********************************************
|
// *********************************************
|
||||||
{
|
{
|
||||||
if (dyTarget != _dyTarget) {
|
if (dyTarget != _dyTarget) {
|
||||||
|
|
|
@ -61,9 +61,9 @@ class Vertical : public Segment {
|
||||||
|
|
||||||
public: virtual void translate(const Unit& dx, const Unit& dy);
|
public: virtual void translate(const Unit& dx, const Unit& dy);
|
||||||
|
|
||||||
public: void SetX(const Unit& x);
|
public: void setX(const Unit& x);
|
||||||
public: void SetDySource(const Unit& dySource);
|
public: void setDySource(const Unit& dySource);
|
||||||
public: void SetDyTarget(const Unit& dyTarget);
|
public: void setDyTarget(const Unit& dyTarget);
|
||||||
public: void translate(const Unit& dx);
|
public: void translate(const Unit& dx);
|
||||||
|
|
||||||
// Others
|
// Others
|
||||||
|
|
Loading…
Reference in New Issue