new conventions
This commit is contained in:
parent
7134556b5e
commit
611d368c9c
|
@ -8,36 +8,36 @@
|
||||||
using namespace H;
|
using namespace H;
|
||||||
|
|
||||||
inline void BoxToRectangle(const Box& box, QRectF& rec) {
|
inline void BoxToRectangle(const Box& box, QRectF& rec) {
|
||||||
double xmin = GetValue(box.getXMin());
|
double xmin = GetValue(box.getXMin());
|
||||||
double xmax = GetValue(box.getXMax());
|
double xmax = GetValue(box.getXMax());
|
||||||
double ymin = GetValue(box.getYMin());
|
double ymin = GetValue(box.getYMin());
|
||||||
double ymax = GetValue(box.getYMax());
|
double ymax = GetValue(box.getYMax());
|
||||||
rec.setCoords(xmin, ymin, xmax, ymax);
|
rec.setCoords(xmin, ymin, xmax, ymax);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void HurricanePositionToQtPosition(const Transformation& transformation, QTransform& transform, QPoint& position) {
|
inline void HurricanePositionToQtPosition(const Transformation& transformation, QTransform& transform, QPoint& position) {
|
||||||
double tx = GetValue(transformation.GetTx());
|
double tx = GetValue(transformation.getTx());
|
||||||
double ty = GetValue(transformation.GetTy());
|
double ty = GetValue(transformation.getTy());
|
||||||
|
|
||||||
position.setX((int)tx);
|
position.setX((int)tx);
|
||||||
position.setY((int)ty);
|
position.setY((int)ty);
|
||||||
|
|
||||||
switch (transformation.GetOrientation()) {
|
switch (transformation.GetOrientation()) {
|
||||||
case Transformation::Orientation::ID:
|
case Transformation::Orientation::ID:
|
||||||
transform.setMatrix(1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0);
|
transform.setMatrix(1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0);
|
||||||
break;
|
break;
|
||||||
case Transformation::Orientation::MX:
|
case Transformation::Orientation::MX:
|
||||||
transform.setMatrix(-1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0);
|
transform.setMatrix(-1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0);
|
||||||
break;
|
break;
|
||||||
case Transformation::Orientation::MY:
|
case Transformation::Orientation::MY:
|
||||||
transform.setMatrix(1.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 0.0, 1.0);
|
transform.setMatrix(1.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 0.0, 1.0);
|
||||||
break;
|
break;
|
||||||
case Transformation::Orientation::R2:
|
case Transformation::Orientation::R2:
|
||||||
transform.setMatrix(-1.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 0.0, 1.0);
|
transform.setMatrix(-1.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 0.0, 1.0);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -279,7 +279,7 @@ void Cell::_Fit(const Box& box)
|
||||||
if (_boundingBox.contains(box)) return;
|
if (_boundingBox.contains(box)) return;
|
||||||
_boundingBox.merge(box);
|
_boundingBox.merge(box);
|
||||||
for_each_instance(instance, GetSlaveInstances()) {
|
for_each_instance(instance, GetSlaveInstances()) {
|
||||||
instance->GetCell()->_Fit(instance->GetTransformation().GetBox(box));
|
instance->GetCell()->_Fit(instance->GetTransformation().getBox(box));
|
||||||
end_for;
|
end_for;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -292,7 +292,7 @@ void Cell::_Unfit(const Box& box)
|
||||||
if (!_boundingBox.isConstrainedBy(box)) return;
|
if (!_boundingBox.isConstrainedBy(box)) return;
|
||||||
_boundingBox.makeEmpty();
|
_boundingBox.makeEmpty();
|
||||||
for_each_instance(instance, GetSlaveInstances()) {
|
for_each_instance(instance, GetSlaveInstances()) {
|
||||||
instance->GetCell()->_Unfit(instance->GetTransformation().GetBox(box));
|
instance->GetCell()->_Unfit(instance->GetTransformation().getBox(box));
|
||||||
end_for;
|
end_for;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2407,7 +2407,7 @@ void Cell_OccurrencesUnder::Locator::Progress()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Box masterArea = _area;
|
Box masterArea = _area;
|
||||||
instance->GetTransformation().GetInvert().ApplyOn(masterArea);
|
instance->GetTransformation().getInvert().applyOn(masterArea);
|
||||||
Cell* masterCell = instance->GetMasterCell();
|
Cell* masterCell = instance->GetMasterCell();
|
||||||
_occurrenceLocator =
|
_occurrenceLocator =
|
||||||
masterCell->GetOccurrencesUnder(masterArea, _searchDepth - 1).GetLocator();
|
masterCell->GetOccurrencesUnder(masterArea, _searchDepth - 1).GetLocator();
|
||||||
|
@ -2728,7 +2728,7 @@ Cell_LeafInstanceOccurrencesUnder::Locator::Locator(const Cell* cell, const Box&
|
||||||
Instance* instance = _nonLeafInstanceLocator.GetElement();
|
Instance* instance = _nonLeafInstanceLocator.GetElement();
|
||||||
Cell* masterCell = instance->GetMasterCell();
|
Cell* masterCell = instance->GetMasterCell();
|
||||||
Box masterArea = _area;
|
Box masterArea = _area;
|
||||||
instance->GetTransformation().GetInvert().ApplyOn(masterArea);
|
instance->GetTransformation().getInvert().applyOn(masterArea);
|
||||||
_occurrenceLocator =
|
_occurrenceLocator =
|
||||||
masterCell->GetLeafInstanceOccurrencesUnder(masterArea).GetLocator();
|
masterCell->GetLeafInstanceOccurrencesUnder(masterArea).GetLocator();
|
||||||
if (_occurrenceLocator.IsValid())
|
if (_occurrenceLocator.IsValid())
|
||||||
|
@ -2807,7 +2807,7 @@ void Cell_LeafInstanceOccurrencesUnder::Locator::Progress()
|
||||||
Instance* instance = _nonLeafInstanceLocator.GetElement();
|
Instance* instance = _nonLeafInstanceLocator.GetElement();
|
||||||
Cell* masterCell = instance->GetMasterCell();
|
Cell* masterCell = instance->GetMasterCell();
|
||||||
Box masterArea = _area;
|
Box masterArea = _area;
|
||||||
instance->GetTransformation().GetInvert().ApplyOn(masterArea);
|
instance->GetTransformation().getInvert().applyOn(masterArea);
|
||||||
_occurrenceLocator =
|
_occurrenceLocator =
|
||||||
masterCell->GetLeafInstanceOccurrencesUnder(masterArea).GetLocator();
|
masterCell->GetLeafInstanceOccurrencesUnder(masterArea).GetLocator();
|
||||||
if (_occurrenceLocator.IsValid())
|
if (_occurrenceLocator.IsValid())
|
||||||
|
@ -2827,7 +2827,7 @@ void Cell_LeafInstanceOccurrencesUnder::Locator::Progress()
|
||||||
Instance* instance = _nonLeafInstanceLocator.GetElement();
|
Instance* instance = _nonLeafInstanceLocator.GetElement();
|
||||||
Cell* masterCell = instance->GetMasterCell();
|
Cell* masterCell = instance->GetMasterCell();
|
||||||
Box masterArea = _area;
|
Box masterArea = _area;
|
||||||
instance->GetTransformation().GetInvert().ApplyOn(masterArea);
|
instance->GetTransformation().getInvert().applyOn(masterArea);
|
||||||
_occurrenceLocator =
|
_occurrenceLocator =
|
||||||
masterCell->GetLeafInstanceOccurrencesUnder(masterArea).GetLocator();
|
masterCell->GetLeafInstanceOccurrencesUnder(masterArea).GetLocator();
|
||||||
if (_occurrenceLocator.IsValid())
|
if (_occurrenceLocator.IsValid())
|
||||||
|
@ -3137,7 +3137,7 @@ Cell_TerminalInstanceOccurrencesUnder::Locator::Locator(const Cell* cell, const
|
||||||
Instance* instance = _nonTerminalInstanceLocator.GetElement();
|
Instance* instance = _nonTerminalInstanceLocator.GetElement();
|
||||||
Cell* masterCell = instance->GetMasterCell();
|
Cell* masterCell = instance->GetMasterCell();
|
||||||
Box masterArea = _area;
|
Box masterArea = _area;
|
||||||
instance->GetTransformation().GetInvert().ApplyOn(masterArea);
|
instance->GetTransformation().getInvert().applyOn(masterArea);
|
||||||
_occurrenceLocator =
|
_occurrenceLocator =
|
||||||
masterCell->GetTerminalInstanceOccurrencesUnder(masterArea).GetLocator();
|
masterCell->GetTerminalInstanceOccurrencesUnder(masterArea).GetLocator();
|
||||||
if (_occurrenceLocator.IsValid())
|
if (_occurrenceLocator.IsValid())
|
||||||
|
@ -3216,7 +3216,7 @@ void Cell_TerminalInstanceOccurrencesUnder::Locator::Progress()
|
||||||
Instance* instance = _nonTerminalInstanceLocator.GetElement();
|
Instance* instance = _nonTerminalInstanceLocator.GetElement();
|
||||||
Cell* masterCell = instance->GetMasterCell();
|
Cell* masterCell = instance->GetMasterCell();
|
||||||
Box masterArea = _area;
|
Box masterArea = _area;
|
||||||
instance->GetTransformation().GetInvert().ApplyOn(masterArea);
|
instance->GetTransformation().getInvert().applyOn(masterArea);
|
||||||
_occurrenceLocator =
|
_occurrenceLocator =
|
||||||
masterCell->GetTerminalInstanceOccurrencesUnder(masterArea).GetLocator();
|
masterCell->GetTerminalInstanceOccurrencesUnder(masterArea).GetLocator();
|
||||||
if (_occurrenceLocator.IsValid())
|
if (_occurrenceLocator.IsValid())
|
||||||
|
@ -3236,7 +3236,7 @@ void Cell_TerminalInstanceOccurrencesUnder::Locator::Progress()
|
||||||
Instance* instance = _nonTerminalInstanceLocator.GetElement();
|
Instance* instance = _nonTerminalInstanceLocator.GetElement();
|
||||||
Cell* masterCell = instance->GetMasterCell();
|
Cell* masterCell = instance->GetMasterCell();
|
||||||
Box masterArea = _area;
|
Box masterArea = _area;
|
||||||
instance->GetTransformation().GetInvert().ApplyOn(masterArea);
|
instance->GetTransformation().getInvert().applyOn(masterArea);
|
||||||
_occurrenceLocator =
|
_occurrenceLocator =
|
||||||
masterCell->GetTerminalInstanceOccurrencesUnder(masterArea).GetLocator();
|
masterCell->GetTerminalInstanceOccurrencesUnder(masterArea).GetLocator();
|
||||||
if (_occurrenceLocator.IsValid())
|
if (_occurrenceLocator.IsValid())
|
||||||
|
@ -3584,7 +3584,7 @@ Cell_ComponentOccurrencesUnder::Locator::Locator(const Cell* cell, const Box& ar
|
||||||
Instance* instance = _instanceLocator.GetElement();
|
Instance* instance = _instanceLocator.GetElement();
|
||||||
Cell* masterCell = instance->GetMasterCell();
|
Cell* masterCell = instance->GetMasterCell();
|
||||||
Box masterArea = _area;
|
Box masterArea = _area;
|
||||||
instance->GetTransformation().GetInvert().ApplyOn(masterArea);
|
instance->GetTransformation().getInvert().applyOn(masterArea);
|
||||||
_occurrenceLocator =
|
_occurrenceLocator =
|
||||||
masterCell->GetComponentOccurrencesUnder(masterArea, _mask).GetLocator();
|
masterCell->GetComponentOccurrencesUnder(masterArea, _mask).GetLocator();
|
||||||
if (_occurrenceLocator.IsValid())
|
if (_occurrenceLocator.IsValid())
|
||||||
|
@ -3665,7 +3665,7 @@ void Cell_ComponentOccurrencesUnder::Locator::Progress()
|
||||||
Instance* instance = _instanceLocator.GetElement();
|
Instance* instance = _instanceLocator.GetElement();
|
||||||
Cell* masterCell = instance->GetMasterCell();
|
Cell* masterCell = instance->GetMasterCell();
|
||||||
Box masterArea = _area;
|
Box masterArea = _area;
|
||||||
instance->GetTransformation().GetInvert().ApplyOn(masterArea);
|
instance->GetTransformation().getInvert().applyOn(masterArea);
|
||||||
_occurrenceLocator =
|
_occurrenceLocator =
|
||||||
masterCell->GetComponentOccurrencesUnder(masterArea, _mask).GetLocator();
|
masterCell->GetComponentOccurrencesUnder(masterArea, _mask).GetLocator();
|
||||||
if (_occurrenceLocator.IsValid())
|
if (_occurrenceLocator.IsValid())
|
||||||
|
@ -3685,7 +3685,7 @@ void Cell_ComponentOccurrencesUnder::Locator::Progress()
|
||||||
Instance* instance = _instanceLocator.GetElement();
|
Instance* instance = _instanceLocator.GetElement();
|
||||||
Cell* masterCell = instance->GetMasterCell();
|
Cell* masterCell = instance->GetMasterCell();
|
||||||
Box masterArea = _area;
|
Box masterArea = _area;
|
||||||
instance->GetTransformation().GetInvert().ApplyOn(masterArea);
|
instance->GetTransformation().getInvert().applyOn(masterArea);
|
||||||
_occurrenceLocator =
|
_occurrenceLocator =
|
||||||
masterCell->GetComponentOccurrencesUnder(masterArea, _mask).GetLocator();
|
masterCell->GetComponentOccurrencesUnder(masterArea, _mask).GetLocator();
|
||||||
if (_occurrenceLocator.IsValid())
|
if (_occurrenceLocator.IsValid())
|
||||||
|
|
|
@ -507,10 +507,10 @@ static bool IsConnex(const Occurrence& componentOccurrence1, const Occurrence& c
|
||||||
Transformation transformation1 = componentOccurrence1.GetPath().GetTransformation();
|
Transformation transformation1 = componentOccurrence1.GetPath().GetTransformation();
|
||||||
Transformation transformation2 = componentOccurrence2.GetPath().GetTransformation();
|
Transformation transformation2 = componentOccurrence2.GetPath().GetTransformation();
|
||||||
for_each_basic_layer(basicLayer1, layer1->GetBasicLayers()) {
|
for_each_basic_layer(basicLayer1, layer1->GetBasicLayers()) {
|
||||||
Box box1 = transformation1.GetBox(component1->GetBoundingBox(basicLayer1));
|
Box box1 = transformation1.getBox(component1->GetBoundingBox(basicLayer1));
|
||||||
for_each_basic_layer(basicLayer2, layer2->GetBasicLayers()) {
|
for_each_basic_layer(basicLayer2, layer2->GetBasicLayers()) {
|
||||||
if (basicLayer1->GetExtractMask() & basicLayer2->GetExtractMask()) {
|
if (basicLayer1->GetExtractMask() & basicLayer2->GetExtractMask()) {
|
||||||
Box box2 = transformation2.GetBox(component2->GetBoundingBox(basicLayer2));
|
Box box2 = transformation2.getBox(component2->GetBoundingBox(basicLayer2));
|
||||||
if (box1.intersect(box2)) return true;
|
if (box1.intersect(box2)) return true;
|
||||||
}
|
}
|
||||||
end_for;
|
end_for;
|
||||||
|
|
|
@ -207,7 +207,7 @@ Instance* Instance::Create(Cell* cell, const Name& name, Cell* masterCell, const
|
||||||
Box Instance::GetBoundingBox() const
|
Box Instance::GetBoundingBox() const
|
||||||
// *********************************
|
// *********************************
|
||||||
{
|
{
|
||||||
return _transformation.GetBox(_masterCell->GetBoundingBox());
|
return _transformation.getBox(_masterCell->GetBoundingBox());
|
||||||
}
|
}
|
||||||
|
|
||||||
Plugs Instance::GetConnectedPlugs() const
|
Plugs Instance::GetConnectedPlugs() const
|
||||||
|
@ -231,7 +231,7 @@ Path Instance::GetPath(const Path& tailPath) const
|
||||||
Box Instance::GetAbutmentBox() const
|
Box Instance::GetAbutmentBox() const
|
||||||
// *********************************
|
// *********************************
|
||||||
{
|
{
|
||||||
return _transformation.GetBox(_masterCell->GetAbutmentBox());
|
return _transformation.getBox(_masterCell->GetAbutmentBox());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Instance::IsTerminal() const
|
bool Instance::IsTerminal() const
|
||||||
|
@ -327,7 +327,7 @@ void Instance::Translate(const Unit& dx, const Unit& dy)
|
||||||
// *****************************************************
|
// *****************************************************
|
||||||
{
|
{
|
||||||
if ((dx != 0) || (dy !=0)) {
|
if ((dx != 0) || (dy !=0)) {
|
||||||
Point translation = _transformation.GetTranslation();
|
Point translation = _transformation.getTranslation();
|
||||||
Unit x = translation.getX() + dx;
|
Unit x = translation.getX() + dx;
|
||||||
Unit y = translation.getY() + dy;
|
Unit y = translation.getY() + dy;
|
||||||
Transformation::Orientation orientation = _transformation.GetOrientation();
|
Transformation::Orientation orientation = _transformation.GetOrientation();
|
||||||
|
|
|
@ -118,7 +118,7 @@ Box Occurrence::GetBoundingBox() const
|
||||||
{
|
{
|
||||||
if (!_entity) return Box();
|
if (!_entity) return Box();
|
||||||
if (!_sharedPath) return _entity->GetBoundingBox();
|
if (!_sharedPath) return _entity->GetBoundingBox();
|
||||||
return _sharedPath->GetTransformation().GetBox(_entity->GetBoundingBox());
|
return _sharedPath->GetTransformation().getBox(_entity->GetBoundingBox());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Occurrence::HasProperty() const
|
bool Occurrence::HasProperty() const
|
||||||
|
|
|
@ -21,17 +21,17 @@ namespace Hurricane {
|
||||||
class Plug_IsConnectedFilter : public Filter<Plug*> {
|
class Plug_IsConnectedFilter : public Filter<Plug*> {
|
||||||
// ************************************************
|
// ************************************************
|
||||||
|
|
||||||
public: Plug_IsConnectedFilter() {};
|
public: Plug_IsConnectedFilter() {};
|
||||||
|
|
||||||
public: Plug_IsConnectedFilter(const Plug_IsConnectedFilter& filter) {};
|
public: Plug_IsConnectedFilter(const Plug_IsConnectedFilter& filter) {};
|
||||||
|
|
||||||
public: Plug_IsConnectedFilter& operator=(const Plug_IsConnectedFilter& filter) {return *this;};
|
public: Plug_IsConnectedFilter& operator=(const Plug_IsConnectedFilter& filter) {return *this;};
|
||||||
|
|
||||||
public: virtual Filter<Plug*>* GetClone() const {return new Plug_IsConnectedFilter(*this);};
|
public: virtual Filter<Plug*>* GetClone() const {return new Plug_IsConnectedFilter(*this);};
|
||||||
|
|
||||||
public: virtual bool Accept(Plug* plug) const {return plug->IsConnected();};
|
public: virtual bool Accept(Plug* plug) const {return plug->IsConnected();};
|
||||||
|
|
||||||
public: virtual string _GetString() const {return "<" + _TName("Plug::IsConnectedFilter>");};
|
public: virtual string _GetString() const {return "<" + _TName("Plug::IsConnectedFilter>");};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -43,79 +43,79 @@ class Plug_IsConnectedFilter : public Filter<Plug*> {
|
||||||
|
|
||||||
Plug::Plug(Instance* instance, Net* masterNet)
|
Plug::Plug(Instance* instance, Net* masterNet)
|
||||||
// *******************************************
|
// *******************************************
|
||||||
: Inherit(NULL, true),
|
: Inherit(NULL, true),
|
||||||
_instance(instance),
|
_instance(instance),
|
||||||
_masterNet(masterNet),
|
_masterNet(masterNet),
|
||||||
_nextOfInstancePlugMap(NULL)
|
_nextOfInstancePlugMap(NULL)
|
||||||
{
|
{
|
||||||
if (!_instance)
|
if (!_instance)
|
||||||
throw Error("Can't create " + _TName("Plug") + " : null instance");
|
throw Error("Can't create " + _TName("Plug") + " : null instance");
|
||||||
|
|
||||||
if (!_masterNet)
|
if (!_masterNet)
|
||||||
throw Error("Can't create " + _TName("Plug") + " : null master net");
|
throw Error("Can't create " + _TName("Plug") + " : null master net");
|
||||||
|
|
||||||
if (_masterNet->GetCell() != _instance->GetMasterCell())
|
if (_masterNet->GetCell() != _instance->GetMasterCell())
|
||||||
throw Error("Can't create " + _TName("Plug") + " : incompatible master net");
|
throw Error("Can't create " + _TName("Plug") + " : incompatible master net");
|
||||||
|
|
||||||
if (!_masterNet->IsExternal())
|
if (!_masterNet->IsExternal())
|
||||||
throw Error("Can't create " + _TName("Plug") + " : not an external master net");
|
throw Error("Can't create " + _TName("Plug") + " : not an external master net");
|
||||||
|
|
||||||
if (_instance->GetPlug(_masterNet))
|
if (_instance->GetPlug(_masterNet))
|
||||||
throw Error("Can't create " + _TName("Plug") + " : already exists");
|
throw Error("Can't create " + _TName("Plug") + " : already exists");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Plug::Delete()
|
void Plug::Delete()
|
||||||
// ****************
|
// ****************
|
||||||
{
|
{
|
||||||
throw Error("Abnormal deletion of " + _TName("Plug"));
|
throw Error("Abnormal deletion of " + _TName("Plug"));
|
||||||
}
|
}
|
||||||
|
|
||||||
Cell* Plug::GetCell() const
|
Cell* Plug::GetCell() const
|
||||||
// ************************
|
// ************************
|
||||||
{
|
{
|
||||||
return _instance->GetCell();
|
return _instance->GetCell();
|
||||||
}
|
}
|
||||||
|
|
||||||
Unit Plug::GetX() const
|
Unit Plug::GetX() const
|
||||||
// ********************
|
// ********************
|
||||||
{
|
{
|
||||||
return _instance->GetTransformation().GetX(_masterNet->GetPosition());
|
return _instance->GetTransformation().getX(_masterNet->GetPosition());
|
||||||
}
|
}
|
||||||
|
|
||||||
Unit Plug::GetY() const
|
Unit Plug::GetY() const
|
||||||
// ********************
|
// ********************
|
||||||
{
|
{
|
||||||
return _instance->GetTransformation().GetY(_masterNet->GetPosition());
|
return _instance->GetTransformation().getY(_masterNet->GetPosition());
|
||||||
}
|
}
|
||||||
|
|
||||||
Point Plug::GetPosition() const
|
Point Plug::GetPosition() const
|
||||||
// ****************************
|
// ****************************
|
||||||
{
|
{
|
||||||
return _instance->GetTransformation().GetPoint(_masterNet->GetPosition());
|
return _instance->GetTransformation().getPoint(_masterNet->GetPosition());
|
||||||
}
|
}
|
||||||
|
|
||||||
Box Plug::GetBoundingBox() const
|
Box Plug::GetBoundingBox() const
|
||||||
// *****************************
|
// *****************************
|
||||||
{
|
{
|
||||||
return _instance->GetTransformation().GetBox(_masterNet->GetPosition());
|
return _instance->GetTransformation().getBox(_masterNet->GetPosition());
|
||||||
}
|
}
|
||||||
|
|
||||||
Box Plug::GetBoundingBox(BasicLayer* basicLayer) const
|
Box Plug::GetBoundingBox(BasicLayer* basicLayer) const
|
||||||
// ***************************************************
|
// ***************************************************
|
||||||
{
|
{
|
||||||
return Box();
|
return Box();
|
||||||
}
|
}
|
||||||
|
|
||||||
PlugFilter Plug::GetIsConnectedFilter()
|
PlugFilter Plug::GetIsConnectedFilter()
|
||||||
// ************************************
|
// ************************************
|
||||||
{
|
{
|
||||||
return Plug_IsConnectedFilter();
|
return Plug_IsConnectedFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
PlugFilter Plug::GetIsUnconnectedFilter()
|
PlugFilter Plug::GetIsUnconnectedFilter()
|
||||||
// **************************************
|
// **************************************
|
||||||
{
|
{
|
||||||
return !Plug_IsConnectedFilter();
|
return !Plug_IsConnectedFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Plug::Materialize()
|
void Plug::Materialize()
|
||||||
|
@ -131,42 +131,42 @@ void Plug::Unmaterialize()
|
||||||
void Plug::SetNet(Net* net)
|
void Plug::SetNet(Net* net)
|
||||||
// ************************
|
// ************************
|
||||||
{
|
{
|
||||||
if (net != GetNet()) {
|
if (net != GetNet()) {
|
||||||
|
|
||||||
if (net && (GetCell() != net->GetCell()))
|
if (net && (GetCell() != net->GetCell()))
|
||||||
throw Error("Can't change net of plug : net : " + GetString(net) + "does not belong to the cell : " + GetString(GetCell()));
|
throw Error("Can't change net of plug : net : " + GetString(net) + "does not belong to the cell : " + GetString(GetCell()));
|
||||||
|
|
||||||
if (!GetBodyHook()->GetSlaveHooks().IsEmpty())
|
if (!GetBodyHook()->GetSlaveHooks().IsEmpty())
|
||||||
throw Error("Can't change net of plug : not empty slave hooks");
|
throw Error("Can't change net of plug : not empty slave hooks");
|
||||||
|
|
||||||
_SetNet(net);
|
_SetNet(net);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Plug* Plug::_Create(Instance* instance, Net* masterNet)
|
Plug* Plug::_Create(Instance* instance, Net* masterNet)
|
||||||
// ****************************************************
|
// ****************************************************
|
||||||
{
|
{
|
||||||
Plug* plug = new Plug(instance, masterNet);
|
Plug* plug = new Plug(instance, masterNet);
|
||||||
|
|
||||||
plug->_PostCreate();
|
plug->_PostCreate();
|
||||||
|
|
||||||
return plug;
|
return plug;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Plug::_PostCreate()
|
void Plug::_PostCreate()
|
||||||
// *********************
|
// *********************
|
||||||
{
|
{
|
||||||
_instance->_GetPlugMap()._Insert(this);
|
_instance->_GetPlugMap()._Insert(this);
|
||||||
|
|
||||||
Inherit::_PostCreate();
|
Inherit::_PostCreate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Plug::_Delete()
|
void Plug::_Delete()
|
||||||
// *****************
|
// *****************
|
||||||
{
|
{
|
||||||
_PreDelete();
|
_PreDelete();
|
||||||
|
|
||||||
delete this;
|
delete this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Plug::_PreDelete()
|
void Plug::_PreDelete()
|
||||||
|
@ -175,9 +175,9 @@ void Plug::_PreDelete()
|
||||||
// trace << "entering Plug::_PreDelete: " << this << endl;
|
// trace << "entering Plug::_PreDelete: " << this << endl;
|
||||||
// trace_in();
|
// trace_in();
|
||||||
|
|
||||||
Inherit::_PreDelete();
|
Inherit::_PreDelete();
|
||||||
|
|
||||||
_instance->_GetPlugMap()._Remove(this);
|
_instance->_GetPlugMap()._Remove(this);
|
||||||
|
|
||||||
// trace << "exiting Plug::_PreDelete:" << endl;
|
// trace << "exiting Plug::_PreDelete:" << endl;
|
||||||
// trace_out();
|
// trace_out();
|
||||||
|
@ -186,20 +186,20 @@ void Plug::_PreDelete()
|
||||||
string Plug::_GetString() const
|
string Plug::_GetString() const
|
||||||
// ****************************
|
// ****************************
|
||||||
{
|
{
|
||||||
string s = Inherit::_GetString();
|
string s = Inherit::_GetString();
|
||||||
s.insert(s.length() - 1, " " + GetName());
|
s.insert(s.length() - 1, " " + GetName());
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
Record* Plug::_GetRecord() const
|
Record* Plug::_GetRecord() const
|
||||||
// ***********************
|
// ***********************
|
||||||
{
|
{
|
||||||
Record* record = Inherit::_GetRecord();
|
Record* record = Inherit::_GetRecord();
|
||||||
if (record) {
|
if (record) {
|
||||||
record->Add(GetSlot("Instance", _instance));
|
record->Add(GetSlot("Instance", _instance));
|
||||||
record->Add(GetSlot("MasterNet", _masterNet));
|
record->Add(GetSlot("MasterNet", _masterNet));
|
||||||
}
|
}
|
||||||
return record;
|
return record;
|
||||||
}
|
}
|
||||||
|
|
||||||
string Plug::GetName() const
|
string Plug::GetName() const
|
||||||
|
|
|
@ -52,11 +52,11 @@ RoutingPad* RoutingPad::Create(Net* net, Occurrence occurrence)
|
||||||
Point position;
|
Point position;
|
||||||
|
|
||||||
if ( (plug = dynamic_cast<Plug*>(occurrence.GetEntity()) ) ) {
|
if ( (plug = dynamic_cast<Plug*>(occurrence.GetEntity()) ) ) {
|
||||||
position = occurrence.GetPath().GetTransformation().GetPoint( plug->GetPosition() );
|
position = occurrence.GetPath().GetTransformation().getPoint( plug->GetPosition() );
|
||||||
} else if ( (pin = dynamic_cast<Pin*>(occurrence.GetEntity()) ) ) {
|
} else if ( (pin = dynamic_cast<Pin*>(occurrence.GetEntity()) ) ) {
|
||||||
position = occurrence.GetPath().GetTransformation().GetPoint( pin->GetPosition() );
|
position = occurrence.GetPath().GetTransformation().getPoint( pin->GetPosition() );
|
||||||
} else if ( (contact = dynamic_cast<Contact*>(occurrence.GetEntity()) ) ) {
|
} else if ( (contact = dynamic_cast<Contact*>(occurrence.GetEntity()) ) ) {
|
||||||
position = occurrence.GetPath().GetTransformation().GetPoint( contact->GetPosition() );
|
position = occurrence.GetPath().GetTransformation().getPoint( contact->GetPosition() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !plug && !pin && !contact )
|
if ( !plug && !pin && !contact )
|
||||||
|
@ -95,7 +95,7 @@ Box RoutingPad::GetBoundingBox() const
|
||||||
{
|
{
|
||||||
Component* component = _GetEntityAsComponent();
|
Component* component = _GetEntityAsComponent();
|
||||||
if ( component ) {
|
if ( component ) {
|
||||||
return _occurrence.GetPath().GetTransformation().GetBox ( component->GetBoundingBox() );
|
return _occurrence.GetPath().GetTransformation().getBox ( component->GetBoundingBox() );
|
||||||
}
|
}
|
||||||
|
|
||||||
return Box(GetPosition());
|
return Box(GetPosition());
|
||||||
|
@ -106,7 +106,7 @@ Box RoutingPad::GetBoundingBox(BasicLayer* basicLayer) const
|
||||||
{
|
{
|
||||||
Component* component = _GetEntityAsComponent();
|
Component* component = _GetEntityAsComponent();
|
||||||
if ( component )
|
if ( component )
|
||||||
return _occurrence.GetPath().GetTransformation().GetBox ( component->GetBoundingBox(basicLayer) );
|
return _occurrence.GetPath().GetTransformation().getBox ( component->GetBoundingBox(basicLayer) );
|
||||||
|
|
||||||
return Box(GetPosition());
|
return Box(GetPosition());
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ Point RoutingPad::GetSourcePosition() const
|
||||||
{
|
{
|
||||||
Segment* segment = _GetEntityAsSegment();
|
Segment* segment = _GetEntityAsSegment();
|
||||||
if ( segment )
|
if ( segment )
|
||||||
return _occurrence.GetPath().GetTransformation().GetPoint ( segment->GetSourcePosition() );
|
return _occurrence.GetPath().GetTransformation().getPoint ( segment->GetSourcePosition() );
|
||||||
|
|
||||||
return GetPosition();
|
return GetPosition();
|
||||||
}
|
}
|
||||||
|
@ -135,7 +135,7 @@ Point RoutingPad::GetTargetPosition() const
|
||||||
{
|
{
|
||||||
Segment* segment = _GetEntityAsSegment();
|
Segment* segment = _GetEntityAsSegment();
|
||||||
if ( segment )
|
if ( segment )
|
||||||
return _occurrence.GetPath().GetTransformation().GetPoint ( segment->GetTargetPosition() );
|
return _occurrence.GetPath().GetTransformation().getPoint ( segment->GetTargetPosition() );
|
||||||
|
|
||||||
return GetPosition();
|
return GetPosition();
|
||||||
}
|
}
|
||||||
|
@ -169,7 +169,7 @@ Point RoutingPad::GetCenter() const
|
||||||
{
|
{
|
||||||
Segment* segment = _GetEntityAsSegment();
|
Segment* segment = _GetEntityAsSegment();
|
||||||
if ( segment )
|
if ( segment )
|
||||||
return _occurrence.GetPath().GetTransformation().GetPoint ( segment->GetCenter() );
|
return _occurrence.GetPath().GetTransformation().getPoint ( segment->GetCenter() );
|
||||||
|
|
||||||
return GetPosition();
|
return GetPosition();
|
||||||
}
|
}
|
||||||
|
@ -329,7 +329,7 @@ void RoutingPad::SetExternalComponent(Component* component)
|
||||||
_occurrence.GetMasterCell()->_RemoveSlaveEntity(_occurrence.GetEntity(),this);
|
_occurrence.GetMasterCell()->_RemoveSlaveEntity(_occurrence.GetEntity(),this);
|
||||||
_occurrence = Occurrence(component,Path(plugOccurrence.GetPath(),plug->GetInstance()));
|
_occurrence = Occurrence(component,Path(plugOccurrence.GetPath(),plug->GetInstance()));
|
||||||
|
|
||||||
Point position = _occurrence.GetPath().GetTransformation().GetPoint ( component->GetPosition() );
|
Point position = _occurrence.GetPath().GetTransformation().getPoint ( component->GetPosition() );
|
||||||
|
|
||||||
Horizontal* horizontal = dynamic_cast<Horizontal*>(component);
|
Horizontal* horizontal = dynamic_cast<Horizontal*>(component);
|
||||||
if ( horizontal ) {
|
if ( horizontal ) {
|
||||||
|
@ -374,7 +374,7 @@ void RoutingPad::RestorePlugOccurrence()
|
||||||
if (IsMaterialized()) Unmaterialize();
|
if (IsMaterialized()) Unmaterialize();
|
||||||
|
|
||||||
_occurrence=GetPlugOccurrence();
|
_occurrence=GetPlugOccurrence();
|
||||||
SetPosition ( _occurrence.GetPath().GetTransformation().GetPoint
|
SetPosition ( _occurrence.GetPath().GetTransformation().getPoint
|
||||||
( dynamic_cast<Component*>(_occurrence.GetEntity())->GetPosition() ) );
|
( dynamic_cast<Component*>(_occurrence.GetEntity())->GetPosition() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,56 +23,56 @@ class SharedPath_Instances : public Collection<Instance*> {
|
||||||
// Types
|
// Types
|
||||||
// *****
|
// *****
|
||||||
|
|
||||||
public: typedef Collection<Instance*> Inherit;
|
public: typedef Collection<Instance*> Inherit;
|
||||||
|
|
||||||
public: class Locator : public Hurricane::Locator<Instance*> {
|
public: class Locator : public Hurricane::Locator<Instance*> {
|
||||||
// *********************************************************
|
// *********************************************************
|
||||||
|
|
||||||
public: typedef Hurricane::Locator<Instance*> Inherit;
|
public: typedef Hurricane::Locator<Instance*> Inherit;
|
||||||
|
|
||||||
private: const SharedPath* _sharedPath;
|
private: const SharedPath* _sharedPath;
|
||||||
|
|
||||||
public: Locator(const SharedPath* sharedPath = NULL);
|
public: Locator(const SharedPath* sharedPath = NULL);
|
||||||
public: Locator(const Locator& locator);
|
public: Locator(const Locator& locator);
|
||||||
|
|
||||||
public: Locator& operator=(const Locator& locator);
|
public: Locator& operator=(const Locator& locator);
|
||||||
|
|
||||||
public: virtual Instance* GetElement() const;
|
public: virtual Instance* GetElement() const;
|
||||||
public: virtual Hurricane::Locator<Instance*>* GetClone() const;
|
public: virtual Hurricane::Locator<Instance*>* 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
|
// Attributes
|
||||||
// **********
|
// **********
|
||||||
|
|
||||||
private: const SharedPath* _sharedPath;
|
private: const SharedPath* _sharedPath;
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
// ************
|
// ************
|
||||||
|
|
||||||
public: SharedPath_Instances(const SharedPath* sharedPath = NULL);
|
public: SharedPath_Instances(const SharedPath* sharedPath = NULL);
|
||||||
public: SharedPath_Instances(const SharedPath_Instances& instances);
|
public: SharedPath_Instances(const SharedPath_Instances& instances);
|
||||||
|
|
||||||
// Operators
|
// Operators
|
||||||
// *********
|
// *********
|
||||||
|
|
||||||
public: SharedPath_Instances& operator=(const SharedPath_Instances& instances);
|
public: SharedPath_Instances& operator=(const SharedPath_Instances& instances);
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
// *********
|
// *********
|
||||||
|
|
||||||
public: virtual Collection<Instance*>* GetClone() const;
|
public: virtual Collection<Instance*>* GetClone() const;
|
||||||
public: virtual Hurricane::Locator<Instance*>* GetLocator() const;
|
public: virtual Hurricane::Locator<Instance*>* GetLocator() const;
|
||||||
|
|
||||||
// Others
|
// Others
|
||||||
// ******
|
// ******
|
||||||
|
|
||||||
public: virtual string _GetString() const;
|
public: virtual string _GetString() const;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -87,135 +87,135 @@ static char NAME_SEPARATOR = '.';
|
||||||
SharedPath::SharedPath(Instance* headInstance, SharedPath* tailSharedPath)
|
SharedPath::SharedPath(Instance* headInstance, SharedPath* tailSharedPath)
|
||||||
// ***********************************************************************
|
// ***********************************************************************
|
||||||
: _headInstance(headInstance),
|
: _headInstance(headInstance),
|
||||||
_tailSharedPath(tailSharedPath),
|
_tailSharedPath(tailSharedPath),
|
||||||
_quarkMap(),
|
_quarkMap(),
|
||||||
_nextOfInstanceSharedPathMap(NULL)
|
_nextOfInstanceSharedPathMap(NULL)
|
||||||
{
|
{
|
||||||
if (!_headInstance)
|
if (!_headInstance)
|
||||||
throw Error("Can't create " + _TName("SharedPath") + " : null head instance");
|
throw Error("Can't create " + _TName("SharedPath") + " : null head instance");
|
||||||
|
|
||||||
if (_headInstance->_GetSharedPath(_tailSharedPath))
|
if (_headInstance->_GetSharedPath(_tailSharedPath))
|
||||||
throw Error("Can't create " + _TName("SharedPath") + " : already exists");
|
throw Error("Can't create " + _TName("SharedPath") + " : already exists");
|
||||||
|
|
||||||
if (_tailSharedPath && (_tailSharedPath->GetOwnerCell() != _headInstance->GetMasterCell()))
|
if (_tailSharedPath && (_tailSharedPath->GetOwnerCell() != _headInstance->GetMasterCell()))
|
||||||
throw Error("Can't create " + _TName("SharedPath") + " : incompatible tail path");
|
throw Error("Can't create " + _TName("SharedPath") + " : incompatible tail path");
|
||||||
|
|
||||||
_headInstance->_GetSharedPathMap()._Insert(this);
|
_headInstance->_GetSharedPathMap()._Insert(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
SharedPath::~SharedPath()
|
SharedPath::~SharedPath()
|
||||||
// **********************
|
// **********************
|
||||||
{
|
{
|
||||||
for_each_quark(quark, _GetQuarks()) quark->Delete(); end_for;
|
for_each_quark(quark, _GetQuarks()) quark->Delete(); end_for;
|
||||||
|
|
||||||
Cell* cell = _headInstance->GetCell();
|
Cell* cell = _headInstance->GetCell();
|
||||||
for_each_instance(instance, cell->GetSlaveInstances()) {
|
for_each_instance(instance, cell->GetSlaveInstances()) {
|
||||||
SharedPath* sharedPath = instance->_GetSharedPath(this);
|
SharedPath* sharedPath = instance->_GetSharedPath(this);
|
||||||
if (sharedPath) delete sharedPath;
|
if (sharedPath) delete sharedPath;
|
||||||
end_for;
|
end_for;
|
||||||
}
|
}
|
||||||
_headInstance->_GetSharedPathMap()._Remove(this);
|
_headInstance->_GetSharedPathMap()._Remove(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
SharedPath* SharedPath::GetHeadSharedPath() const
|
SharedPath* SharedPath::GetHeadSharedPath() const
|
||||||
// **********************************************
|
// **********************************************
|
||||||
{
|
{
|
||||||
if (!_tailSharedPath) return NULL;
|
if (!_tailSharedPath) return NULL;
|
||||||
|
|
||||||
SharedPath* tailSharedPath = _tailSharedPath->GetHeadSharedPath();
|
SharedPath* tailSharedPath = _tailSharedPath->GetHeadSharedPath();
|
||||||
|
|
||||||
SharedPath* headSharedPath = _headInstance->_GetSharedPath(tailSharedPath);
|
SharedPath* headSharedPath = _headInstance->_GetSharedPath(tailSharedPath);
|
||||||
|
|
||||||
if (!headSharedPath) headSharedPath = new SharedPath(_headInstance, tailSharedPath);
|
if (!headSharedPath) headSharedPath = new SharedPath(_headInstance, tailSharedPath);
|
||||||
|
|
||||||
return headSharedPath;
|
return headSharedPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
Instance* SharedPath::GetTailInstance() const
|
Instance* SharedPath::GetTailInstance() const
|
||||||
// ******************************************
|
// ******************************************
|
||||||
{
|
{
|
||||||
return (_tailSharedPath) ? _tailSharedPath->GetTailInstance() : _headInstance;
|
return (_tailSharedPath) ? _tailSharedPath->GetTailInstance() : _headInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
char SharedPath::GetNameSeparator()
|
char SharedPath::GetNameSeparator()
|
||||||
// ********************************
|
// ********************************
|
||||||
{
|
{
|
||||||
return NAME_SEPARATOR;
|
return NAME_SEPARATOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
string SharedPath::GetName() const
|
string SharedPath::GetName() const
|
||||||
// *******************************
|
// *******************************
|
||||||
{
|
{
|
||||||
string name = "";
|
string name = "";
|
||||||
string nameSeparator = "";
|
string nameSeparator = "";
|
||||||
SharedPath* sharedPath = (SharedPath*)this;
|
SharedPath* sharedPath = (SharedPath*)this;
|
||||||
while (sharedPath) {
|
while (sharedPath) {
|
||||||
name += nameSeparator + GetString(sharedPath->GetHeadInstance()->GetName());
|
name += nameSeparator + GetString(sharedPath->GetHeadInstance()->GetName());
|
||||||
nameSeparator = GetString(GetNameSeparator());
|
nameSeparator = GetString(GetNameSeparator());
|
||||||
sharedPath = sharedPath->GetTailSharedPath();
|
sharedPath = sharedPath->GetTailSharedPath();
|
||||||
}
|
}
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
Cell* SharedPath::GetOwnerCell() const
|
Cell* SharedPath::GetOwnerCell() const
|
||||||
// ***********************************
|
// ***********************************
|
||||||
{
|
{
|
||||||
return _headInstance->GetCell();
|
return _headInstance->GetCell();
|
||||||
}
|
}
|
||||||
|
|
||||||
Cell* SharedPath::GetMasterCell() const
|
Cell* SharedPath::GetMasterCell() const
|
||||||
// ************************************
|
// ************************************
|
||||||
{
|
{
|
||||||
Cell* masterCell = NULL;
|
Cell* masterCell = NULL;
|
||||||
SharedPath* sharedPath = (SharedPath*)this;
|
SharedPath* sharedPath = (SharedPath*)this;
|
||||||
while (sharedPath) {
|
while (sharedPath) {
|
||||||
masterCell = sharedPath->GetHeadInstance()->GetMasterCell();
|
masterCell = sharedPath->GetHeadInstance()->GetMasterCell();
|
||||||
sharedPath = sharedPath->GetTailSharedPath();
|
sharedPath = sharedPath->GetTailSharedPath();
|
||||||
}
|
}
|
||||||
return masterCell;
|
return masterCell;
|
||||||
}
|
}
|
||||||
|
|
||||||
Instances SharedPath::GetInstances() const
|
Instances SharedPath::GetInstances() const
|
||||||
// ***************************************
|
// ***************************************
|
||||||
{
|
{
|
||||||
return SharedPath_Instances(this);
|
return SharedPath_Instances(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
Transformation SharedPath::GetTransformation(const Transformation& transformation) const
|
Transformation SharedPath::GetTransformation(const Transformation& transformation) const
|
||||||
// *************************************************************************************
|
// *************************************************************************************
|
||||||
{
|
{
|
||||||
Transformation headTransformation = _headInstance->GetTransformation();
|
Transformation headTransformation = _headInstance->GetTransformation();
|
||||||
Transformation tailTransformation =
|
Transformation tailTransformation =
|
||||||
(!_tailSharedPath) ? transformation : _tailSharedPath->GetTransformation(transformation);
|
(!_tailSharedPath) ? transformation : _tailSharedPath->GetTransformation(transformation);
|
||||||
return headTransformation.GetTransformation(tailTransformation);
|
return headTransformation.getTransformation(tailTransformation);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SharedPath::SetNameSeparator(char nameSeparator)
|
void SharedPath::SetNameSeparator(char nameSeparator)
|
||||||
// **************************************************
|
// **************************************************
|
||||||
{
|
{
|
||||||
NAME_SEPARATOR = nameSeparator;
|
NAME_SEPARATOR = nameSeparator;
|
||||||
}
|
}
|
||||||
|
|
||||||
string SharedPath::_GetString() const
|
string SharedPath::_GetString() const
|
||||||
// **********************************
|
// **********************************
|
||||||
{
|
{
|
||||||
string s = "<" + _TName("SharedPath");
|
string s = "<" + _TName("SharedPath");
|
||||||
string name = GetName();
|
string name = GetName();
|
||||||
if (!name.empty()) s += " " + name;
|
if (!name.empty()) s += " " + name;
|
||||||
s += ">";
|
s += ">";
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
Record* SharedPath::_GetRecord() const
|
Record* SharedPath::_GetRecord() const
|
||||||
// *****************************
|
// *****************************
|
||||||
{
|
{
|
||||||
Record* record = new Record(GetString(this));
|
Record* record = new Record(GetString(this));
|
||||||
if (record) {
|
if (record) {
|
||||||
record->Add(GetSlot("HeadInstance", _headInstance));
|
record->Add(GetSlot("HeadInstance", _headInstance));
|
||||||
record->Add(GetSlot("TailSharedPath", _tailSharedPath));
|
record->Add(GetSlot("TailSharedPath", _tailSharedPath));
|
||||||
record->Add(GetSlot("Quarks", &_quarkMap));
|
record->Add(GetSlot("Quarks", &_quarkMap));
|
||||||
}
|
}
|
||||||
return record;
|
return record;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -226,32 +226,32 @@ Record* SharedPath::_GetRecord() const
|
||||||
|
|
||||||
SharedPath::QuarkMap::QuarkMap()
|
SharedPath::QuarkMap::QuarkMap()
|
||||||
// *****************************
|
// *****************************
|
||||||
: Inherit()
|
: Inherit()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
const Entity* SharedPath::QuarkMap::_GetKey(Quark* quark) const
|
const Entity* SharedPath::QuarkMap::_GetKey(Quark* quark) const
|
||||||
// ************************************************************
|
// ************************************************************
|
||||||
{
|
{
|
||||||
return quark->GetOccurrence().GetEntity();
|
return quark->GetOccurrence().GetEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned SharedPath::QuarkMap::_GetHashValue(const Entity* entity) const
|
unsigned SharedPath::QuarkMap::_GetHashValue(const Entity* entity) const
|
||||||
// *********************************************************************
|
// *********************************************************************
|
||||||
{
|
{
|
||||||
return ( (unsigned int)( (unsigned long)entity ) ) / 8;
|
return ( (unsigned int)( (unsigned long)entity ) ) / 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
Quark* SharedPath::QuarkMap::_GetNextElement(Quark* quark) const
|
Quark* SharedPath::QuarkMap::_GetNextElement(Quark* quark) const
|
||||||
// *************************************************************
|
// *************************************************************
|
||||||
{
|
{
|
||||||
return quark->_GetNextOfSharedPathQuarkMap();
|
return quark->_GetNextOfSharedPathQuarkMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SharedPath::QuarkMap::_SetNextElement(Quark* quark, Quark* nextQuark) const
|
void SharedPath::QuarkMap::_SetNextElement(Quark* quark, Quark* nextQuark) const
|
||||||
// *****************************************************************************
|
// *****************************************************************************
|
||||||
{
|
{
|
||||||
quark->_SetNextOfSharedPathQuarkMap(nextQuark);
|
quark->_SetNextOfSharedPathQuarkMap(nextQuark);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -262,44 +262,44 @@ void SharedPath::QuarkMap::_SetNextElement(Quark* quark, Quark* nextQuark) const
|
||||||
|
|
||||||
SharedPath_Instances::SharedPath_Instances(const SharedPath* sharedPath)
|
SharedPath_Instances::SharedPath_Instances(const SharedPath* sharedPath)
|
||||||
// *********************************************************************
|
// *********************************************************************
|
||||||
: Inherit(),
|
: Inherit(),
|
||||||
_sharedPath(sharedPath)
|
_sharedPath(sharedPath)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
SharedPath_Instances::SharedPath_Instances(const SharedPath_Instances& instances)
|
SharedPath_Instances::SharedPath_Instances(const SharedPath_Instances& instances)
|
||||||
// ******************************************************************************
|
// ******************************************************************************
|
||||||
: Inherit(),
|
: Inherit(),
|
||||||
_sharedPath(instances._sharedPath)
|
_sharedPath(instances._sharedPath)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
SharedPath_Instances& SharedPath_Instances::operator=(const SharedPath_Instances& instances)
|
SharedPath_Instances& SharedPath_Instances::operator=(const SharedPath_Instances& instances)
|
||||||
// *****************************************************************************************
|
// *****************************************************************************************
|
||||||
{
|
{
|
||||||
_sharedPath = instances._sharedPath;
|
_sharedPath = instances._sharedPath;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
Collection<Instance*>* SharedPath_Instances::GetClone() const
|
Collection<Instance*>* SharedPath_Instances::GetClone() const
|
||||||
// **********************************************************
|
// **********************************************************
|
||||||
{
|
{
|
||||||
return new SharedPath_Instances(*this);
|
return new SharedPath_Instances(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
Locator<Instance*>* SharedPath_Instances::GetLocator() const
|
Locator<Instance*>* SharedPath_Instances::GetLocator() const
|
||||||
// *********************************************************
|
// *********************************************************
|
||||||
{
|
{
|
||||||
return new Locator(_sharedPath);
|
return new Locator(_sharedPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
string SharedPath_Instances::_GetString() const
|
string SharedPath_Instances::_GetString() const
|
||||||
// ********************************************
|
// ********************************************
|
||||||
{
|
{
|
||||||
string s = "<" + _TName("SharedPath::Instances");
|
string s = "<" + _TName("SharedPath::Instances");
|
||||||
if (_sharedPath) s += " " + GetString(_sharedPath);
|
if (_sharedPath) s += " " + GetString(_sharedPath);
|
||||||
s += ">";
|
s += ">";
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -310,56 +310,56 @@ string SharedPath_Instances::_GetString() const
|
||||||
|
|
||||||
SharedPath_Instances::Locator::Locator(const SharedPath* sharedPath)
|
SharedPath_Instances::Locator::Locator(const SharedPath* sharedPath)
|
||||||
// *****************************************************************
|
// *****************************************************************
|
||||||
: Inherit(),
|
: Inherit(),
|
||||||
_sharedPath(sharedPath)
|
_sharedPath(sharedPath)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
SharedPath_Instances::Locator::Locator(const Locator& locator)
|
SharedPath_Instances::Locator::Locator(const Locator& locator)
|
||||||
// ***********************************************************
|
// ***********************************************************
|
||||||
: Inherit(),
|
: Inherit(),
|
||||||
_sharedPath(locator._sharedPath)
|
_sharedPath(locator._sharedPath)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
SharedPath_Instances::Locator& SharedPath_Instances::Locator::operator=(const Locator& locator)
|
SharedPath_Instances::Locator& SharedPath_Instances::Locator::operator=(const Locator& locator)
|
||||||
// ********************************************************************************************
|
// ********************************************************************************************
|
||||||
{
|
{
|
||||||
_sharedPath = locator._sharedPath;
|
_sharedPath = locator._sharedPath;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
Instance* SharedPath_Instances::Locator::GetElement() const
|
Instance* SharedPath_Instances::Locator::GetElement() const
|
||||||
// ********************************************************
|
// ********************************************************
|
||||||
{
|
{
|
||||||
return (_sharedPath) ? _sharedPath->GetHeadInstance() : NULL;
|
return (_sharedPath) ? _sharedPath->GetHeadInstance() : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Locator<Instance*>* SharedPath_Instances::Locator::GetClone() const
|
Locator<Instance*>* SharedPath_Instances::Locator::GetClone() const
|
||||||
// ****************************************************************
|
// ****************************************************************
|
||||||
{
|
{
|
||||||
return new Locator(*this);
|
return new Locator(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SharedPath_Instances::Locator::IsValid() const
|
bool SharedPath_Instances::Locator::IsValid() const
|
||||||
// ************************************************
|
// ************************************************
|
||||||
{
|
{
|
||||||
return (_sharedPath != NULL);
|
return (_sharedPath != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SharedPath_Instances::Locator::Progress()
|
void SharedPath_Instances::Locator::Progress()
|
||||||
// *******************************************
|
// *******************************************
|
||||||
{
|
{
|
||||||
if (_sharedPath) _sharedPath = _sharedPath->GetTailSharedPath();
|
if (_sharedPath) _sharedPath = _sharedPath->GetTailSharedPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
string SharedPath_Instances::Locator::_GetString() const
|
string SharedPath_Instances::Locator::_GetString() const
|
||||||
// *****************************************************
|
// *****************************************************
|
||||||
{
|
{
|
||||||
string s = "<" + _TName("SharedPath::Instances::Locator");
|
string s = "<" + _TName("SharedPath::Instances::Locator");
|
||||||
if (_sharedPath) s += " " + GetString(_sharedPath);
|
if (_sharedPath) s += " " + GetString(_sharedPath);
|
||||||
s += ">";
|
s += ">";
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -22,19 +22,19 @@ static const int C[8] = {0, 1, 0, -1, 0, -1, 0, 1};
|
||||||
static const int D[8] = {1, 0, -1, 0, 1, 0, -1, 0};
|
static const int D[8] = {1, 0, -1, 0, 1, 0, -1, 0};
|
||||||
|
|
||||||
static const Transformation::Orientation INVERT[8] =
|
static const Transformation::Orientation INVERT[8] =
|
||||||
{TO::ID, TO::R3, TO::R2, TO::R1, TO::MX, TO::XR, TO::MY, TO::YR};
|
{TO::ID, TO::R3, TO::R2, TO::R1, TO::MX, TO::XR, TO::MY, TO::YR};
|
||||||
|
|
||||||
static const int DISCREMINENT[8] = {1, 1, 1, 1, -1, -1, -1, -1};
|
static const int DISCREMINENT[8] = {1, 1, 1, 1, -1, -1, -1, -1};
|
||||||
|
|
||||||
static const Transformation::Orientation COMPOSE[] = {
|
static const Transformation::Orientation COMPOSE[] = {
|
||||||
TO::ID, TO::R1, TO::R2, TO::R3, TO::MX, TO::XR, TO::MY, TO::YR,
|
TO::ID, TO::R1, TO::R2, TO::R3, TO::MX, TO::XR, TO::MY, TO::YR,
|
||||||
TO::R1, TO::R2, TO::R3, TO::ID, TO::XR, TO::MY, TO::YR, TO::MX,
|
TO::R1, TO::R2, TO::R3, TO::ID, TO::XR, TO::MY, TO::YR, TO::MX,
|
||||||
TO::R2, TO::R3, TO::ID, TO::R1, TO::MY, TO::YR, TO::MX, TO::XR,
|
TO::R2, TO::R3, TO::ID, TO::R1, TO::MY, TO::YR, TO::MX, TO::XR,
|
||||||
TO::R3, TO::ID, TO::R1, TO::R2, TO::YR, TO::MX, TO::XR, TO::MY,
|
TO::R3, TO::ID, TO::R1, TO::R2, TO::YR, TO::MX, TO::XR, TO::MY,
|
||||||
TO::MX, TO::YR, TO::MY, TO::XR, TO::ID, TO::R3, TO::R2, TO::R1,
|
TO::MX, TO::YR, TO::MY, TO::XR, TO::ID, TO::R3, TO::R2, TO::R1,
|
||||||
TO::XR, TO::MX, TO::YR, TO::MY, TO::R1, TO::ID, TO::R3, TO::R2,
|
TO::XR, TO::MX, TO::YR, TO::MY, TO::R1, TO::ID, TO::R3, TO::R2,
|
||||||
TO::MY, TO::XR, TO::MX, TO::YR, TO::R2, TO::R1, TO::ID, TO::R3,
|
TO::MY, TO::XR, TO::MX, TO::YR, TO::R2, TO::R1, TO::ID, TO::R3,
|
||||||
TO::YR, TO::MY, TO::XR, TO::MX, TO::R3, TO::R2, TO::R1, TO::ID
|
TO::YR, TO::MY, TO::XR, TO::MX, TO::R3, TO::R2, TO::R1, TO::ID
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -45,201 +45,201 @@ static const Transformation::Orientation COMPOSE[] = {
|
||||||
|
|
||||||
Transformation::Transformation()
|
Transformation::Transformation()
|
||||||
// *****************************
|
// *****************************
|
||||||
: _tx(0),
|
: _tx(0),
|
||||||
_ty(0),
|
_ty(0),
|
||||||
_orientation()
|
_orientation()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Transformation::Transformation(const Unit& tx, const Unit& ty, const Orientation& orientation)
|
Transformation::Transformation(const Unit& tx, const Unit& ty, const Orientation& orientation)
|
||||||
// *******************************************************************************************
|
// *******************************************************************************************
|
||||||
: _tx(tx),
|
: _tx(tx),
|
||||||
_ty(ty),
|
_ty(ty),
|
||||||
_orientation(orientation)
|
_orientation(orientation)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Transformation::Transformation(const Point& translation, const Orientation& orientation)
|
Transformation::Transformation(const Point& translation, const Orientation& orientation)
|
||||||
// *************************************************************************************
|
// *************************************************************************************
|
||||||
: _tx(translation.getX()),
|
: _tx(translation.getX()),
|
||||||
_ty(translation.getY()),
|
_ty(translation.getY()),
|
||||||
_orientation(orientation)
|
_orientation(orientation)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Transformation::Transformation(const Transformation& transformation)
|
Transformation::Transformation(const Transformation& transformation)
|
||||||
// *****************************************************************
|
// *****************************************************************
|
||||||
: _tx(transformation._tx),
|
: _tx(transformation._tx),
|
||||||
_ty(transformation._ty),
|
_ty(transformation._ty),
|
||||||
_orientation(transformation._orientation)
|
_orientation(transformation._orientation)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Transformation& Transformation::operator=(const Transformation& transformation)
|
Transformation& Transformation::operator=(const Transformation& transformation)
|
||||||
// ****************************************************************************
|
// ****************************************************************************
|
||||||
{
|
{
|
||||||
_tx = transformation._tx;
|
_tx = transformation._tx;
|
||||||
_ty = transformation._ty;
|
_ty = transformation._ty;
|
||||||
_orientation = transformation._orientation;
|
_orientation = transformation._orientation;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Transformation::operator==(const Transformation& transformation) const
|
bool Transformation::operator==(const Transformation& transformation) const
|
||||||
// ************************************************************************
|
// ************************************************************************
|
||||||
{
|
{
|
||||||
return ((_tx == transformation._tx) &&
|
return ((_tx == transformation._tx) &&
|
||||||
(_ty == transformation._ty) &&
|
(_ty == transformation._ty) &&
|
||||||
(_orientation == transformation._orientation));
|
(_orientation == transformation._orientation));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Transformation::operator!=(const Transformation& transformation) const
|
bool Transformation::operator!=(const Transformation& transformation) const
|
||||||
// ************************************************************************
|
// ************************************************************************
|
||||||
{
|
{
|
||||||
return ((_tx != transformation._tx) ||
|
return ((_tx != transformation._tx) ||
|
||||||
(_ty != transformation._ty) ||
|
(_ty != transformation._ty) ||
|
||||||
(_orientation != transformation._orientation));
|
(_orientation != transformation._orientation));
|
||||||
}
|
}
|
||||||
|
|
||||||
Unit Transformation::GetX(const Unit& x, const Unit& y) const
|
Unit Transformation::getX(const Unit& x, const Unit& y) const
|
||||||
// **********************************************************
|
// **********************************************************
|
||||||
{
|
{
|
||||||
return (x * A[_orientation]) + (y * B[_orientation]) + _tx;
|
return (x * A[_orientation]) + (y * B[_orientation]) + _tx;
|
||||||
}
|
}
|
||||||
|
|
||||||
Unit Transformation::GetY(const Unit& x, const Unit& y) const
|
Unit Transformation::getY(const Unit& x, const Unit& y) const
|
||||||
// **********************************************************
|
// **********************************************************
|
||||||
{
|
{
|
||||||
return (x * C[_orientation]) + (y * D[_orientation]) + _ty;
|
return (x * C[_orientation]) + (y * D[_orientation]) + _ty;
|
||||||
}
|
}
|
||||||
|
|
||||||
Unit Transformation::GetX(const Point& point) 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
|
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
|
Unit Transformation::getDx(const Unit& dx, const Unit& dy) const
|
||||||
// *************************************************************
|
// *************************************************************
|
||||||
{
|
{
|
||||||
return (dx * A[_orientation]) + (dy * B[_orientation]);
|
return (dx * A[_orientation]) + (dy * B[_orientation]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Unit Transformation::GetDy(const Unit& dx, const Unit& dy) const
|
Unit Transformation::getDy(const Unit& dx, const Unit& dy) const
|
||||||
// *************************************************************
|
// *************************************************************
|
||||||
{
|
{
|
||||||
return (dx * C[_orientation]) + (dy * D[_orientation]);
|
return (dx * C[_orientation]) + (dy * D[_orientation]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Point Transformation::GetPoint(const Unit& x, const Unit& y) const
|
Point Transformation::getPoint(const Unit& x, const Unit& y) const
|
||||||
// ***************************************************************
|
// ***************************************************************
|
||||||
{
|
{
|
||||||
return Point(GetX(x, y), GetY(x, y));
|
return Point(getX(x, y), getY(x, y));
|
||||||
}
|
}
|
||||||
|
|
||||||
Point Transformation::GetPoint(const Point& point) 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
|
Box Transformation::getBox(const Unit& x1, const Unit& y1, const Unit& x2, const Unit& y2) const
|
||||||
// *********************************************************************************************
|
// *********************************************************************************************
|
||||||
{
|
{
|
||||||
return Box(GetX(x1, y1), GetY(x1, y1), GetX(x2, y2), GetY(x2, y2));
|
return Box(getX(x1, y1), getY(x1, y1), getX(x2, y2), getY(x2, y2));
|
||||||
}
|
}
|
||||||
|
|
||||||
Box Transformation::GetBox(const Point& point1, const Point& point2) 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
|
Box Transformation::getBox(const Box& box) const
|
||||||
// *********************************************
|
// *********************************************
|
||||||
{
|
{
|
||||||
if (box.isEmpty()) return box;
|
if (box.isEmpty()) return box;
|
||||||
return GetBox(box.getXMin(), box.getYMin(), box.getXMax(), box.getYMax());
|
return getBox(box.getXMin(), box.getYMin(), box.getXMax(), box.getYMax());
|
||||||
}
|
}
|
||||||
|
|
||||||
Transformation Transformation::GetTransformation(const Transformation& transformation) const
|
Transformation Transformation::getTransformation(const Transformation& transformation) const
|
||||||
// *****************************************************************************************
|
// *****************************************************************************************
|
||||||
{
|
{
|
||||||
Unit x = transformation._tx;
|
Unit x = transformation._tx;
|
||||||
Unit y = transformation._ty;
|
Unit y = transformation._ty;
|
||||||
|
|
||||||
return Transformation(
|
return Transformation(
|
||||||
(x * A[_orientation]) + (y * B[_orientation]) + _tx,
|
(x * A[_orientation]) + (y * B[_orientation]) + _tx,
|
||||||
(x * C[_orientation]) + (y * D[_orientation]) + _ty,
|
(x * C[_orientation]) + (y * D[_orientation]) + _ty,
|
||||||
COMPOSE[(_orientation * 8) + transformation._orientation]);
|
COMPOSE[(_orientation * 8) + transformation._orientation]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Transformation Transformation::GetInvert() const
|
Transformation Transformation::getInvert() const
|
||||||
// *********************************************
|
// *********************************************
|
||||||
{
|
{
|
||||||
Transformation transformation = *this;
|
Transformation transformation = *this;
|
||||||
return transformation.Invert();
|
return transformation.invert();
|
||||||
}
|
}
|
||||||
|
|
||||||
Transformation& Transformation::Invert()
|
Transformation& Transformation::invert()
|
||||||
// *************************************
|
// *************************************
|
||||||
{
|
{
|
||||||
return operator=(
|
return operator=(
|
||||||
Transformation(
|
Transformation(
|
||||||
((_ty * B[_orientation]) - (_tx * D[_orientation])) * DISCREMINENT[_orientation],
|
((_ty * B[_orientation]) - (_tx * D[_orientation])) * DISCREMINENT[_orientation],
|
||||||
((_tx * C[_orientation]) - (_ty * A[_orientation])) * DISCREMINENT[_orientation],
|
((_tx * C[_orientation]) - (_ty * A[_orientation])) * DISCREMINENT[_orientation],
|
||||||
INVERT[_orientation]));
|
INVERT[_orientation]));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Transformation::ApplyOn(Unit& x, Unit& y) const
|
void Transformation::applyOn(Unit& x, Unit& y) const
|
||||||
// *************************************************
|
// *************************************************
|
||||||
{
|
{
|
||||||
Unit xi = x, yi = y;
|
Unit xi = x, yi = y;
|
||||||
x = GetX(xi, yi);
|
x = getX(xi, yi);
|
||||||
y = GetY(xi, yi);
|
y = getY(xi, yi);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Transformation::ApplyOn(Point& point) const
|
void Transformation::applyOn(Point& point) const
|
||||||
// *********************************************
|
// *********************************************
|
||||||
{
|
{
|
||||||
point = GetPoint(point);
|
point = getPoint(point);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Transformation::ApplyOn(Box& box) const
|
void Transformation::applyOn(Box& box) const
|
||||||
// *****************************************
|
// *****************************************
|
||||||
{
|
{
|
||||||
box = GetBox(box);
|
box = getBox(box);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Transformation::ApplyOn(Transformation& transformation) const
|
void Transformation::applyOn(Transformation& transformation) const
|
||||||
// ***************************************************************
|
// ***************************************************************
|
||||||
{
|
{
|
||||||
transformation = GetTransformation(transformation);
|
transformation = getTransformation(transformation);
|
||||||
}
|
}
|
||||||
|
|
||||||
string Transformation::_GetString() const
|
string Transformation::_GetString() const
|
||||||
// **************************************
|
// **************************************
|
||||||
{
|
{
|
||||||
return "<" + _TName("Transformation") + " " +
|
return "<" + _TName("Transformation") + " " +
|
||||||
GetValueString(_tx) + " " +
|
GetValueString(_tx) + " " +
|
||||||
GetValueString(_ty) + " " +
|
GetValueString(_ty) + " " +
|
||||||
GetString(_orientation) +
|
GetString(_orientation) +
|
||||||
">";
|
">";
|
||||||
}
|
}
|
||||||
|
|
||||||
Record* Transformation::_GetRecord() const
|
Record* Transformation::_GetRecord() const
|
||||||
// *********************************
|
// *********************************
|
||||||
{
|
{
|
||||||
Record* record = new Record(GetString(this));
|
Record* record = new Record(GetString(this));
|
||||||
record->Add(GetSlot("X", &_tx));
|
record->Add(GetSlot("X", &_tx));
|
||||||
record->Add(GetSlot("Y", &_ty));
|
record->Add(GetSlot("Y", &_ty));
|
||||||
record->Add(GetSlot("Orientation", _orientation));
|
record->Add(GetSlot("Orientation", _orientation));
|
||||||
return record;
|
return record;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -250,21 +250,21 @@ Record* Transformation::_GetRecord() const
|
||||||
|
|
||||||
Transformation::Orientation::Orientation(const Code& code)
|
Transformation::Orientation::Orientation(const Code& code)
|
||||||
// *******************************************************
|
// *******************************************************
|
||||||
: _code(code)
|
: _code(code)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Transformation::Orientation::Orientation(const Orientation& orientation)
|
Transformation::Orientation::Orientation(const Orientation& orientation)
|
||||||
// *********************************************************************
|
// *********************************************************************
|
||||||
: _code(orientation._code)
|
: _code(orientation._code)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Transformation::Orientation& Transformation::Orientation::operator=(const Orientation& orientation)
|
Transformation::Orientation& Transformation::Orientation::operator=(const Orientation& orientation)
|
||||||
// ************************************************************************************************
|
// ************************************************************************************************
|
||||||
{
|
{
|
||||||
_code = orientation._code;
|
_code = orientation._code;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
string Transformation::Orientation::_GetString() const
|
string Transformation::Orientation::_GetString() const
|
||||||
|
@ -276,9 +276,9 @@ string Transformation::Orientation::_GetString() const
|
||||||
Record* Transformation::Orientation::_GetRecord() const
|
Record* Transformation::Orientation::_GetRecord() const
|
||||||
// **********************************************
|
// **********************************************
|
||||||
{
|
{
|
||||||
Record* record = new Record(GetString(this));
|
Record* record = new Record(GetString(this));
|
||||||
record->Add(GetSlot("Code", &_code));
|
record->Add(GetSlot("Code", &_code));
|
||||||
return record;
|
return record;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -24,105 +24,104 @@ class Transformation {
|
||||||
// *****
|
// *****
|
||||||
|
|
||||||
public: class Orientation {
|
public: class Orientation {
|
||||||
// **********************
|
// **********************
|
||||||
|
|
||||||
public: enum Code {ID=0, R1=1, R2=2, R3=3, MX=4, XR=5, MY=6, YR=7};
|
public: enum Code {ID=0, R1=1, R2=2, R3=3, MX=4, XR=5, MY=6, YR=7};
|
||||||
|
|
||||||
private: Code _code;
|
private: Code _code;
|
||||||
|
|
||||||
public: Orientation(const Code& code = ID);
|
public: Orientation(const Code& code = ID);
|
||||||
public: Orientation(const Orientation& orientation);
|
public: Orientation(const Orientation& orientation);
|
||||||
|
|
||||||
public: Orientation& operator=(const Orientation& orientation);
|
public: Orientation& operator=(const Orientation& orientation);
|
||||||
|
|
||||||
public: operator const Code&() const {return _code;};
|
public: operator const Code&() const {return _code;};
|
||||||
|
|
||||||
public: const Code& GetCode() const {return _code;};
|
public: const Code& GetCode() const {return _code;};
|
||||||
|
|
||||||
public: string _GetTypeName() const { return _TName("Transformation::Orientation"); };
|
public: string _GetTypeName() const { return _TName("Transformation::Orientation"); };
|
||||||
public: string _GetString() const;
|
public: string _GetString() const;
|
||||||
public: Record* _GetRecord() const;
|
public: Record* _GetRecord() const;
|
||||||
|
};
|
||||||
};
|
|
||||||
|
|
||||||
// Attributes
|
// Attributes
|
||||||
// **********
|
// **********
|
||||||
|
|
||||||
private: Unit _tx;
|
private: Unit _tx;
|
||||||
private: Unit _ty;
|
private: Unit _ty;
|
||||||
private: Orientation _orientation;
|
private: Orientation _orientation;
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
// ************
|
// ************
|
||||||
|
|
||||||
public: Transformation();
|
public: Transformation();
|
||||||
|
|
||||||
public: Transformation(const Unit& tx, const Unit& ty, const Orientation& orientation = Orientation::ID);
|
public: Transformation(const Unit& tx, const Unit& ty, const Orientation& orientation = Orientation::ID);
|
||||||
public: Transformation(const Point& translation, const Orientation& orientation = Orientation::ID);
|
public: Transformation(const Point& translation, const Orientation& orientation = Orientation::ID);
|
||||||
|
|
||||||
public: Transformation(const Transformation& transformation);
|
public: Transformation(const Transformation& transformation);
|
||||||
|
|
||||||
// Operators
|
// Operators
|
||||||
// *********
|
// *********
|
||||||
|
|
||||||
public: Transformation& operator=(const Transformation& transformation);
|
public: Transformation& operator=(const Transformation& transformation);
|
||||||
|
|
||||||
public: bool operator==(const Transformation& transformation) const;
|
public: bool operator==(const Transformation& transformation) const;
|
||||||
public: bool operator!=(const Transformation& transformation) const;
|
public: bool operator!=(const Transformation& transformation) const;
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
// *********
|
// *********
|
||||||
|
|
||||||
public: const Unit& GetTx() const {return _tx;};
|
public: const Unit& getTx() const {return _tx;};
|
||||||
public: const Unit& GetTy() const {return _ty;};
|
public: const Unit& getTy() const {return _ty;};
|
||||||
public: Point GetTranslation() const {return Point(_tx, _ty);};
|
public: Point getTranslation() const {return Point(_tx, _ty);};
|
||||||
public: const Orientation& GetOrientation() const {return _orientation;};
|
public: const Orientation& GetOrientation() const {return _orientation;};
|
||||||
|
|
||||||
public: Unit GetX(const Unit& x, const Unit& y) const;
|
public: Unit getX(const Unit& x, const Unit& y) const;
|
||||||
public: Unit GetY(const Unit& x, const Unit& y) const;
|
public: Unit getY(const Unit& x, const Unit& y) const;
|
||||||
|
|
||||||
public: Unit GetX(const Point& point) const;
|
public: Unit getX(const Point& point) const;
|
||||||
public: Unit GetY(const Point& point) const;
|
public: Unit getY(const Point& point) const;
|
||||||
|
|
||||||
public: Unit GetDx(const Unit& dx, const Unit& dy) const;
|
public: Unit getDx(const Unit& dx, const Unit& dy) const;
|
||||||
public: Unit GetDy(const Unit& dx, const Unit& dy) const;
|
public: Unit getDy(const Unit& dx, const Unit& dy) const;
|
||||||
|
|
||||||
public: Point GetPoint(const Unit& x, const Unit& y) const;
|
public: Point getPoint(const Unit& x, const Unit& y) const;
|
||||||
public: Point GetPoint(const Point& point) const;
|
public: Point getPoint(const Point& point) const;
|
||||||
|
|
||||||
public: Box GetBox(const Unit& x1, const Unit& y1, const Unit& x2, const Unit& y2) const;
|
public: Box getBox(const Unit& x1, const Unit& y1, const Unit& x2, const Unit& y2) const;
|
||||||
public: Box GetBox(const Point& point1, const Point& point2) const;
|
public: Box getBox(const Point& point1, const Point& point2) const;
|
||||||
public: Box GetBox(const Box& box) const;
|
public: Box getBox(const Box& box) const;
|
||||||
|
|
||||||
public: Transformation GetTransformation(const Transformation& transformation) const;
|
public: Transformation getTransformation(const Transformation& transformation) const;
|
||||||
|
|
||||||
public: Transformation GetInvert() const;
|
public: Transformation getInvert() const;
|
||||||
|
|
||||||
// Predicates
|
// Predicates
|
||||||
// **********
|
// **********
|
||||||
|
|
||||||
public: bool IsEven() const {return !(_orientation.GetCode() & 1);};
|
public: bool isEven() const {return !(_orientation.GetCode() & 1);};
|
||||||
public: bool IsOdd() const {return (_orientation.GetCode() & 1);};
|
public: bool isOdd() const {return (_orientation.GetCode() & 1);};
|
||||||
|
|
||||||
// Updators
|
// Updators
|
||||||
// ********
|
// ********
|
||||||
|
|
||||||
public: Transformation& Invert();
|
public: Transformation& invert();
|
||||||
|
|
||||||
// Manipulators
|
// Manipulators
|
||||||
// ************
|
// ************
|
||||||
|
|
||||||
public: void ApplyOn(Unit& x, Unit& y) const;
|
public: void applyOn(Unit& x, Unit& y) const;
|
||||||
public: void ApplyOn(Point& point) const;
|
public: void applyOn(Point& point) const;
|
||||||
public: void ApplyOn(Box& box) const;
|
public: void applyOn(Box& box) const;
|
||||||
public: void ApplyOn(Transformation& transformation) const;
|
public: void applyOn(Transformation& transformation) const;
|
||||||
|
|
||||||
// Others
|
// Others
|
||||||
// ******
|
// ******
|
||||||
|
|
||||||
public: string _GetTypeName() const { return _TName("Transformation"); };
|
public: string _GetTypeName() const { return _TName("Transformation"); };
|
||||||
public: string _GetString() const;
|
public: string _GetString() const;
|
||||||
public: Record* _GetRecord() const;
|
public: Record* _GetRecord() const;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ Technology* getTechnology() {
|
||||||
}
|
}
|
||||||
|
|
||||||
CellWidget::CellWidget(Cell* c, QWidget* parent)
|
CellWidget::CellWidget(Cell* c, QWidget* parent)
|
||||||
: QAbstractScrollArea(parent),
|
: QWidget(parent),
|
||||||
cell(c),
|
cell(c),
|
||||||
invalidRegion(),
|
invalidRegion(),
|
||||||
clipBox(),
|
clipBox(),
|
||||||
|
@ -37,32 +37,7 @@ CellWidget::CellWidget(Cell* c, QWidget* parent)
|
||||||
|
|
||||||
void CellWidget::paintEvent(QPaintEvent* event) {
|
void CellWidget::paintEvent(QPaintEvent* event) {
|
||||||
invalidate(event->rect());
|
invalidate(event->rect());
|
||||||
|
redraw();
|
||||||
if (!invalidRegion.isEmpty()) {
|
|
||||||
QRect invalidRect = invalidRegion.boundingRect();
|
|
||||||
|
|
||||||
H::Box area = getBox(invalidRect).inflate(getSize(1));
|
|
||||||
cerr << "akecoucou3" << endl;
|
|
||||||
|
|
||||||
//QPaintDevice* device = this;
|
|
||||||
|
|
||||||
//QPainter newPainter(device);
|
|
||||||
//QPainter* oldPainter = painter;
|
|
||||||
//painter = &newPainter;
|
|
||||||
|
|
||||||
painter->setPen(QPen(QColor(255, 255, 255)));
|
|
||||||
painter->fillRect(QRectF(0, 0, 100, 100), QBrush(QColor(255, 255, 255)));
|
|
||||||
|
|
||||||
|
|
||||||
drawPhantoms(cell, area, Transformation());
|
|
||||||
drawBoundaries(cell, area, Transformation());
|
|
||||||
for_each_layer(layer, getTechnology()->GetLayers()) {
|
|
||||||
drawCell(cell, layer, area, Transformation());
|
|
||||||
end_for;
|
|
||||||
}
|
|
||||||
|
|
||||||
invalidRegion = QRegion();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CellWidget::invalidate() {
|
void CellWidget::invalidate() {
|
||||||
|
@ -85,7 +60,6 @@ void CellWidget::redraw() {
|
||||||
QRect invalidRect = invalidRegion.boundingRect();
|
QRect invalidRect = invalidRegion.boundingRect();
|
||||||
|
|
||||||
H::Box area = getBox(invalidRect).inflate(getSize(1));
|
H::Box area = getBox(invalidRect).inflate(getSize(1));
|
||||||
cerr << "akecoucou2" << endl;
|
|
||||||
|
|
||||||
QPaintDevice* device = this;
|
QPaintDevice* device = this;
|
||||||
|
|
||||||
|
@ -93,16 +67,17 @@ void CellWidget::redraw() {
|
||||||
QPainter* oldPainter = painter;
|
QPainter* oldPainter = painter;
|
||||||
painter = &newPainter;
|
painter = &newPainter;
|
||||||
|
|
||||||
//painter->fillRect(QRectF(0, 0, 100, 100), QBrush(QColor(255, 255, 255)));
|
painter->fillRect(QRectF(0, 0, 100, 100), QBrush(QColor(255, 255, 255)));
|
||||||
|
|
||||||
//painter->setPen(QPen(QColor(255, 255, 255)));
|
painter->setPen(QPen(QColor(255, 255, 0)));
|
||||||
|
painter->setBrush(QBrush(QColor(255, 255, 0)));
|
||||||
|
|
||||||
//drawPhantoms(cell, area, Transformation());
|
drawPhantoms(cell, area, Transformation());
|
||||||
//drawBoundaries(cell, area, Transformation());
|
drawBoundaries(cell, area, Transformation());
|
||||||
//for_each_layer(layer, getTechnology()->GetLayers()) {
|
for_each_layer(layer, getTechnology()->GetLayers()) {
|
||||||
// drawCell(cell, layer, area, Transformation());
|
drawCell(cell, layer, area, Transformation());
|
||||||
// end_for;
|
end_for;
|
||||||
//}
|
}
|
||||||
|
|
||||||
invalidRegion = QRegion();
|
invalidRegion = QRegion();
|
||||||
}
|
}
|
||||||
|
@ -121,8 +96,8 @@ void CellWidget::drawPhantoms(const Cell* cell, const H::Box& updateArea, const
|
||||||
void CellWidget::drawPhantoms(const Instance* instance, const H::Box& updateArea, const Transformation& transformation) const {
|
void CellWidget::drawPhantoms(const Instance* instance, const H::Box& updateArea, const Transformation& transformation) const {
|
||||||
H::Box masterArea = updateArea;
|
H::Box masterArea = updateArea;
|
||||||
Transformation masterTransformation = instance->GetTransformation();
|
Transformation masterTransformation = instance->GetTransformation();
|
||||||
instance->GetTransformation().GetInvert().ApplyOn(masterArea);
|
instance->GetTransformation().getInvert().applyOn(masterArea);
|
||||||
transformation.ApplyOn(masterTransformation);
|
transformation.applyOn(masterTransformation);
|
||||||
drawPhantoms(instance->GetMasterCell(), masterArea, masterTransformation);
|
drawPhantoms(instance->GetMasterCell(), masterArea, masterTransformation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,8 +112,8 @@ void CellWidget::drawBoundaries(const Cell* cell, const H::Box& updateArea, cons
|
||||||
void CellWidget::drawBoundaries(const Instance* instance, const H::Box& updateArea, const Transformation& transformation) const {
|
void CellWidget::drawBoundaries(const Instance* instance, const H::Box& updateArea, const Transformation& transformation) const {
|
||||||
H::Box masterArea = updateArea;
|
H::Box masterArea = updateArea;
|
||||||
Transformation masterTransformation = instance->GetTransformation();
|
Transformation masterTransformation = instance->GetTransformation();
|
||||||
instance->GetTransformation().GetInvert().ApplyOn(masterArea);
|
instance->GetTransformation().getInvert().applyOn(masterArea);
|
||||||
transformation.ApplyOn(masterTransformation);
|
transformation.applyOn(masterTransformation);
|
||||||
drawBoundaries(instance->GetMasterCell(), masterArea, masterTransformation);
|
drawBoundaries(instance->GetMasterCell(), masterArea, masterTransformation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
#ifndef __CELL_WIDGET_H
|
#ifndef __CELL_WIDGET_H
|
||||||
#define __CELL_WIDGET_H
|
#define __CELL_WIDGET_H
|
||||||
|
|
||||||
#include <QAbstractScrollArea>
|
#include <QWidget>
|
||||||
|
|
||||||
#include "Box.h"
|
#include "Box.h"
|
||||||
#include "Cell.h"
|
#include "Cell.h"
|
||||||
using namespace H;
|
using namespace H;
|
||||||
|
|
||||||
|
|
||||||
class CellWidget : public QAbstractScrollArea {
|
class CellWidget : public QWidget {
|
||||||
public:
|
public:
|
||||||
CellWidget(Cell* cell, QWidget* parent=0);
|
CellWidget(Cell* cell, QWidget* parent=0);
|
||||||
void redraw();
|
void redraw();
|
||||||
|
|
Loading…
Reference in New Issue