new conventions

This commit is contained in:
The Coriolis Project 2008-01-07 12:55:04 +00:00
parent 7134556b5e
commit 611d368c9c
13 changed files with 380 additions and 406 deletions

View File

@ -8,36 +8,36 @@
using namespace H;
inline void BoxToRectangle(const Box& box, QRectF& rec) {
double xmin = GetValue(box.getXMin());
double xmax = GetValue(box.getXMax());
double ymin = GetValue(box.getYMin());
double ymax = GetValue(box.getYMax());
rec.setCoords(xmin, ymin, xmax, ymax);
double xmin = GetValue(box.getXMin());
double xmax = GetValue(box.getXMax());
double ymin = GetValue(box.getYMin());
double ymax = GetValue(box.getYMax());
rec.setCoords(xmin, ymin, xmax, ymax);
}
inline void HurricanePositionToQtPosition(const Transformation& transformation, QTransform& transform, QPoint& position) {
double tx = GetValue(transformation.GetTx());
double ty = GetValue(transformation.GetTy());
double tx = GetValue(transformation.getTx());
double ty = GetValue(transformation.getTy());
position.setX((int)tx);
position.setY((int)ty);
position.setX((int)tx);
position.setY((int)ty);
switch (transformation.GetOrientation()) {
case Transformation::Orientation::ID:
transform.setMatrix(1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0);
break;
case Transformation::Orientation::MX:
transform.setMatrix(-1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0);
break;
case Transformation::Orientation::MY:
transform.setMatrix(1.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 0.0, 1.0);
break;
case Transformation::Orientation::R2:
transform.setMatrix(-1.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 0.0, 1.0);
break;
default:
break;
}
switch (transformation.GetOrientation()) {
case Transformation::Orientation::ID:
transform.setMatrix(1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0);
break;
case Transformation::Orientation::MX:
transform.setMatrix(-1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0);
break;
case Transformation::Orientation::MY:
transform.setMatrix(1.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 0.0, 1.0);
break;
case Transformation::Orientation::R2:
transform.setMatrix(-1.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 0.0, 1.0);
break;
default:
break;
}
}

View File

@ -279,7 +279,7 @@ void Cell::_Fit(const Box& box)
if (_boundingBox.contains(box)) return;
_boundingBox.merge(box);
for_each_instance(instance, GetSlaveInstances()) {
instance->GetCell()->_Fit(instance->GetTransformation().GetBox(box));
instance->GetCell()->_Fit(instance->GetTransformation().getBox(box));
end_for;
}
}
@ -292,7 +292,7 @@ void Cell::_Unfit(const Box& box)
if (!_boundingBox.isConstrainedBy(box)) return;
_boundingBox.makeEmpty();
for_each_instance(instance, GetSlaveInstances()) {
instance->GetCell()->_Unfit(instance->GetTransformation().GetBox(box));
instance->GetCell()->_Unfit(instance->GetTransformation().getBox(box));
end_for;
}
}

View File

@ -2407,7 +2407,7 @@ void Cell_OccurrencesUnder::Locator::Progress()
}
else {
Box masterArea = _area;
instance->GetTransformation().GetInvert().ApplyOn(masterArea);
instance->GetTransformation().getInvert().applyOn(masterArea);
Cell* masterCell = instance->GetMasterCell();
_occurrenceLocator =
masterCell->GetOccurrencesUnder(masterArea, _searchDepth - 1).GetLocator();
@ -2728,7 +2728,7 @@ Cell_LeafInstanceOccurrencesUnder::Locator::Locator(const Cell* cell, const Box&
Instance* instance = _nonLeafInstanceLocator.GetElement();
Cell* masterCell = instance->GetMasterCell();
Box masterArea = _area;
instance->GetTransformation().GetInvert().ApplyOn(masterArea);
instance->GetTransformation().getInvert().applyOn(masterArea);
_occurrenceLocator =
masterCell->GetLeafInstanceOccurrencesUnder(masterArea).GetLocator();
if (_occurrenceLocator.IsValid())
@ -2807,7 +2807,7 @@ void Cell_LeafInstanceOccurrencesUnder::Locator::Progress()
Instance* instance = _nonLeafInstanceLocator.GetElement();
Cell* masterCell = instance->GetMasterCell();
Box masterArea = _area;
instance->GetTransformation().GetInvert().ApplyOn(masterArea);
instance->GetTransformation().getInvert().applyOn(masterArea);
_occurrenceLocator =
masterCell->GetLeafInstanceOccurrencesUnder(masterArea).GetLocator();
if (_occurrenceLocator.IsValid())
@ -2827,7 +2827,7 @@ void Cell_LeafInstanceOccurrencesUnder::Locator::Progress()
Instance* instance = _nonLeafInstanceLocator.GetElement();
Cell* masterCell = instance->GetMasterCell();
Box masterArea = _area;
instance->GetTransformation().GetInvert().ApplyOn(masterArea);
instance->GetTransformation().getInvert().applyOn(masterArea);
_occurrenceLocator =
masterCell->GetLeafInstanceOccurrencesUnder(masterArea).GetLocator();
if (_occurrenceLocator.IsValid())
@ -3137,7 +3137,7 @@ Cell_TerminalInstanceOccurrencesUnder::Locator::Locator(const Cell* cell, const
Instance* instance = _nonTerminalInstanceLocator.GetElement();
Cell* masterCell = instance->GetMasterCell();
Box masterArea = _area;
instance->GetTransformation().GetInvert().ApplyOn(masterArea);
instance->GetTransformation().getInvert().applyOn(masterArea);
_occurrenceLocator =
masterCell->GetTerminalInstanceOccurrencesUnder(masterArea).GetLocator();
if (_occurrenceLocator.IsValid())
@ -3216,7 +3216,7 @@ void Cell_TerminalInstanceOccurrencesUnder::Locator::Progress()
Instance* instance = _nonTerminalInstanceLocator.GetElement();
Cell* masterCell = instance->GetMasterCell();
Box masterArea = _area;
instance->GetTransformation().GetInvert().ApplyOn(masterArea);
instance->GetTransformation().getInvert().applyOn(masterArea);
_occurrenceLocator =
masterCell->GetTerminalInstanceOccurrencesUnder(masterArea).GetLocator();
if (_occurrenceLocator.IsValid())
@ -3236,7 +3236,7 @@ void Cell_TerminalInstanceOccurrencesUnder::Locator::Progress()
Instance* instance = _nonTerminalInstanceLocator.GetElement();
Cell* masterCell = instance->GetMasterCell();
Box masterArea = _area;
instance->GetTransformation().GetInvert().ApplyOn(masterArea);
instance->GetTransformation().getInvert().applyOn(masterArea);
_occurrenceLocator =
masterCell->GetTerminalInstanceOccurrencesUnder(masterArea).GetLocator();
if (_occurrenceLocator.IsValid())
@ -3584,7 +3584,7 @@ Cell_ComponentOccurrencesUnder::Locator::Locator(const Cell* cell, const Box& ar
Instance* instance = _instanceLocator.GetElement();
Cell* masterCell = instance->GetMasterCell();
Box masterArea = _area;
instance->GetTransformation().GetInvert().ApplyOn(masterArea);
instance->GetTransformation().getInvert().applyOn(masterArea);
_occurrenceLocator =
masterCell->GetComponentOccurrencesUnder(masterArea, _mask).GetLocator();
if (_occurrenceLocator.IsValid())
@ -3665,7 +3665,7 @@ void Cell_ComponentOccurrencesUnder::Locator::Progress()
Instance* instance = _instanceLocator.GetElement();
Cell* masterCell = instance->GetMasterCell();
Box masterArea = _area;
instance->GetTransformation().GetInvert().ApplyOn(masterArea);
instance->GetTransformation().getInvert().applyOn(masterArea);
_occurrenceLocator =
masterCell->GetComponentOccurrencesUnder(masterArea, _mask).GetLocator();
if (_occurrenceLocator.IsValid())
@ -3685,7 +3685,7 @@ void Cell_ComponentOccurrencesUnder::Locator::Progress()
Instance* instance = _instanceLocator.GetElement();
Cell* masterCell = instance->GetMasterCell();
Box masterArea = _area;
instance->GetTransformation().GetInvert().ApplyOn(masterArea);
instance->GetTransformation().getInvert().applyOn(masterArea);
_occurrenceLocator =
masterCell->GetComponentOccurrencesUnder(masterArea, _mask).GetLocator();
if (_occurrenceLocator.IsValid())

View File

@ -507,10 +507,10 @@ static bool IsConnex(const Occurrence& componentOccurrence1, const Occurrence& c
Transformation transformation1 = componentOccurrence1.GetPath().GetTransformation();
Transformation transformation2 = componentOccurrence2.GetPath().GetTransformation();
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()) {
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;
}
end_for;

View File

@ -207,7 +207,7 @@ Instance* Instance::Create(Cell* cell, const Name& name, Cell* masterCell, const
Box Instance::GetBoundingBox() const
// *********************************
{
return _transformation.GetBox(_masterCell->GetBoundingBox());
return _transformation.getBox(_masterCell->GetBoundingBox());
}
Plugs Instance::GetConnectedPlugs() const
@ -231,7 +231,7 @@ Path Instance::GetPath(const Path& tailPath) const
Box Instance::GetAbutmentBox() const
// *********************************
{
return _transformation.GetBox(_masterCell->GetAbutmentBox());
return _transformation.getBox(_masterCell->GetAbutmentBox());
}
bool Instance::IsTerminal() const
@ -327,7 +327,7 @@ void Instance::Translate(const Unit& dx, const Unit& dy)
// *****************************************************
{
if ((dx != 0) || (dy !=0)) {
Point translation = _transformation.GetTranslation();
Point translation = _transformation.getTranslation();
Unit x = translation.getX() + dx;
Unit y = translation.getY() + dy;
Transformation::Orientation orientation = _transformation.GetOrientation();

View File

@ -118,7 +118,7 @@ Box Occurrence::GetBoundingBox() const
{
if (!_entity) return Box();
if (!_sharedPath) return _entity->GetBoundingBox();
return _sharedPath->GetTransformation().GetBox(_entity->GetBoundingBox());
return _sharedPath->GetTransformation().getBox(_entity->GetBoundingBox());
}
bool Occurrence::HasProperty() const

View File

@ -21,17 +21,17 @@ namespace Hurricane {
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)
// *******************************************
: Inherit(NULL, true),
_instance(instance),
_masterNet(masterNet),
_nextOfInstancePlugMap(NULL)
: Inherit(NULL, true),
_instance(instance),
_masterNet(masterNet),
_nextOfInstancePlugMap(NULL)
{
if (!_instance)
throw Error("Can't create " + _TName("Plug") + " : null instance");
if (!_instance)
throw Error("Can't create " + _TName("Plug") + " : null instance");
if (!_masterNet)
throw Error("Can't create " + _TName("Plug") + " : null master net");
if (!_masterNet)
throw Error("Can't create " + _TName("Plug") + " : null master net");
if (_masterNet->GetCell() != _instance->GetMasterCell())
throw Error("Can't create " + _TName("Plug") + " : incompatible master net");
if (_masterNet->GetCell() != _instance->GetMasterCell())
throw Error("Can't create " + _TName("Plug") + " : incompatible master net");
if (!_masterNet->IsExternal())
throw Error("Can't create " + _TName("Plug") + " : not an external master net");
if (!_masterNet->IsExternal())
throw Error("Can't create " + _TName("Plug") + " : not an external master net");
if (_instance->GetPlug(_masterNet))
throw Error("Can't create " + _TName("Plug") + " : already exists");
if (_instance->GetPlug(_masterNet))
throw Error("Can't create " + _TName("Plug") + " : already exists");
}
void Plug::Delete()
// ****************
{
throw Error("Abnormal deletion of " + _TName("Plug"));
throw Error("Abnormal deletion of " + _TName("Plug"));
}
Cell* Plug::GetCell() const
// ************************
{
return _instance->GetCell();
return _instance->GetCell();
}
Unit Plug::GetX() const
// ********************
{
return _instance->GetTransformation().GetX(_masterNet->GetPosition());
return _instance->GetTransformation().getX(_masterNet->GetPosition());
}
Unit Plug::GetY() const
// ********************
{
return _instance->GetTransformation().GetY(_masterNet->GetPosition());
return _instance->GetTransformation().getY(_masterNet->GetPosition());
}
Point Plug::GetPosition() const
// ****************************
{
return _instance->GetTransformation().GetPoint(_masterNet->GetPosition());
return _instance->GetTransformation().getPoint(_masterNet->GetPosition());
}
Box Plug::GetBoundingBox() const
// *****************************
{
return _instance->GetTransformation().GetBox(_masterNet->GetPosition());
return _instance->GetTransformation().getBox(_masterNet->GetPosition());
}
Box Plug::GetBoundingBox(BasicLayer* basicLayer) const
// ***************************************************
{
return Box();
return Box();
}
PlugFilter Plug::GetIsConnectedFilter()
// ************************************
{
return Plug_IsConnectedFilter();
return Plug_IsConnectedFilter();
}
PlugFilter Plug::GetIsUnconnectedFilter()
// **************************************
{
return !Plug_IsConnectedFilter();
return !Plug_IsConnectedFilter();
}
void Plug::Materialize()
@ -131,42 +131,42 @@ void Plug::Unmaterialize()
void Plug::SetNet(Net* net)
// ************************
{
if (net != GetNet()) {
if (net != GetNet()) {
if (net && (GetCell() != net->GetCell()))
throw Error("Can't change net of plug : net : " + GetString(net) + "does not belong to the cell : " + GetString(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()));
if (!GetBodyHook()->GetSlaveHooks().IsEmpty())
throw Error("Can't change net of plug : not empty slave hooks");
if (!GetBodyHook()->GetSlaveHooks().IsEmpty())
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 = new Plug(instance, masterNet);
Plug* plug = new Plug(instance, masterNet);
plug->_PostCreate();
plug->_PostCreate();
return plug;
return plug;
}
void Plug::_PostCreate()
// *********************
{
_instance->_GetPlugMap()._Insert(this);
_instance->_GetPlugMap()._Insert(this);
Inherit::_PostCreate();
Inherit::_PostCreate();
}
void Plug::_Delete()
// *****************
{
_PreDelete();
_PreDelete();
delete this;
delete this;
}
void Plug::_PreDelete()
@ -175,9 +175,9 @@ void Plug::_PreDelete()
// trace << "entering Plug::_PreDelete: " << this << endl;
// trace_in();
Inherit::_PreDelete();
Inherit::_PreDelete();
_instance->_GetPlugMap()._Remove(this);
_instance->_GetPlugMap()._Remove(this);
// trace << "exiting Plug::_PreDelete:" << endl;
// trace_out();
@ -186,20 +186,20 @@ void Plug::_PreDelete()
string Plug::_GetString() const
// ****************************
{
string s = Inherit::_GetString();
s.insert(s.length() - 1, " " + GetName());
return s;
string s = Inherit::_GetString();
s.insert(s.length() - 1, " " + GetName());
return s;
}
Record* Plug::_GetRecord() const
// ***********************
{
Record* record = Inherit::_GetRecord();
if (record) {
record->Add(GetSlot("Instance", _instance));
record->Add(GetSlot("MasterNet", _masterNet));
}
return record;
Record* record = Inherit::_GetRecord();
if (record) {
record->Add(GetSlot("Instance", _instance));
record->Add(GetSlot("MasterNet", _masterNet));
}
return record;
}
string Plug::GetName() const

View File

@ -52,11 +52,11 @@ RoutingPad* RoutingPad::Create(Net* net, Occurrence occurrence)
Point position;
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()) ) ) {
position = occurrence.GetPath().GetTransformation().GetPoint( pin->GetPosition() );
position = occurrence.GetPath().GetTransformation().getPoint( pin->GetPosition() );
} 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 )
@ -95,7 +95,7 @@ Box RoutingPad::GetBoundingBox() const
{
Component* component = _GetEntityAsComponent();
if ( component ) {
return _occurrence.GetPath().GetTransformation().GetBox ( component->GetBoundingBox() );
return _occurrence.GetPath().GetTransformation().getBox ( component->GetBoundingBox() );
}
return Box(GetPosition());
@ -106,7 +106,7 @@ Box RoutingPad::GetBoundingBox(BasicLayer* basicLayer) const
{
Component* component = _GetEntityAsComponent();
if ( component )
return _occurrence.GetPath().GetTransformation().GetBox ( component->GetBoundingBox(basicLayer) );
return _occurrence.GetPath().GetTransformation().getBox ( component->GetBoundingBox(basicLayer) );
return Box(GetPosition());
}
@ -125,7 +125,7 @@ Point RoutingPad::GetSourcePosition() const
{
Segment* segment = _GetEntityAsSegment();
if ( segment )
return _occurrence.GetPath().GetTransformation().GetPoint ( segment->GetSourcePosition() );
return _occurrence.GetPath().GetTransformation().getPoint ( segment->GetSourcePosition() );
return GetPosition();
}
@ -135,7 +135,7 @@ Point RoutingPad::GetTargetPosition() const
{
Segment* segment = _GetEntityAsSegment();
if ( segment )
return _occurrence.GetPath().GetTransformation().GetPoint ( segment->GetTargetPosition() );
return _occurrence.GetPath().GetTransformation().getPoint ( segment->GetTargetPosition() );
return GetPosition();
}
@ -169,7 +169,7 @@ Point RoutingPad::GetCenter() const
{
Segment* segment = _GetEntityAsSegment();
if ( segment )
return _occurrence.GetPath().GetTransformation().GetPoint ( segment->GetCenter() );
return _occurrence.GetPath().GetTransformation().getPoint ( segment->GetCenter() );
return GetPosition();
}
@ -329,7 +329,7 @@ void RoutingPad::SetExternalComponent(Component* component)
_occurrence.GetMasterCell()->_RemoveSlaveEntity(_occurrence.GetEntity(),this);
_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);
if ( horizontal ) {
@ -374,7 +374,7 @@ void RoutingPad::RestorePlugOccurrence()
if (IsMaterialized()) Unmaterialize();
_occurrence=GetPlugOccurrence();
SetPosition ( _occurrence.GetPath().GetTransformation().GetPoint
SetPosition ( _occurrence.GetPath().GetTransformation().getPoint
( dynamic_cast<Component*>(_occurrence.GetEntity())->GetPosition() ) );
}

View File

@ -23,56 +23,56 @@ class SharedPath_Instances : public Collection<Instance*> {
// 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 Locator& locator);
public: Locator(const SharedPath* sharedPath = NULL);
public: Locator(const Locator& locator);
public: Locator& operator=(const Locator& locator);
public: Locator& operator=(const Locator& locator);
public: virtual Instance* GetElement() const;
public: virtual Hurricane::Locator<Instance*>* GetClone() const;
public: virtual Instance* GetElement() 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
// **********
private: const SharedPath* _sharedPath;
private: const SharedPath* _sharedPath;
// Constructors
// ************
public: SharedPath_Instances(const SharedPath* sharedPath = NULL);
public: SharedPath_Instances(const SharedPath_Instances& instances);
public: SharedPath_Instances(const SharedPath* sharedPath = NULL);
public: SharedPath_Instances(const SharedPath_Instances& instances);
// Operators
// *********
public: SharedPath_Instances& operator=(const SharedPath_Instances& instances);
public: SharedPath_Instances& operator=(const SharedPath_Instances& instances);
// Accessors
// *********
public: virtual Collection<Instance*>* GetClone() const;
public: virtual Hurricane::Locator<Instance*>* GetLocator() const;
public: virtual Collection<Instance*>* GetClone() const;
public: virtual Hurricane::Locator<Instance*>* GetLocator() const;
// 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)
// ***********************************************************************
: _headInstance(headInstance),
_tailSharedPath(tailSharedPath),
_quarkMap(),
_nextOfInstanceSharedPathMap(NULL)
_tailSharedPath(tailSharedPath),
_quarkMap(),
_nextOfInstanceSharedPathMap(NULL)
{
if (!_headInstance)
throw Error("Can't create " + _TName("SharedPath") + " : null head instance");
if (!_headInstance)
throw Error("Can't create " + _TName("SharedPath") + " : null head instance");
if (_headInstance->_GetSharedPath(_tailSharedPath))
throw Error("Can't create " + _TName("SharedPath") + " : already exists");
if (_headInstance->_GetSharedPath(_tailSharedPath))
throw Error("Can't create " + _TName("SharedPath") + " : already exists");
if (_tailSharedPath && (_tailSharedPath->GetOwnerCell() != _headInstance->GetMasterCell()))
throw Error("Can't create " + _TName("SharedPath") + " : incompatible tail path");
if (_tailSharedPath && (_tailSharedPath->GetOwnerCell() != _headInstance->GetMasterCell()))
throw Error("Can't create " + _TName("SharedPath") + " : incompatible tail path");
_headInstance->_GetSharedPathMap()._Insert(this);
_headInstance->_GetSharedPathMap()._Insert(this);
}
SharedPath::~SharedPath()
// **********************
{
for_each_quark(quark, _GetQuarks()) quark->Delete(); end_for;
for_each_quark(quark, _GetQuarks()) quark->Delete(); end_for;
Cell* cell = _headInstance->GetCell();
for_each_instance(instance, cell->GetSlaveInstances()) {
SharedPath* sharedPath = instance->_GetSharedPath(this);
if (sharedPath) delete sharedPath;
end_for;
}
_headInstance->_GetSharedPathMap()._Remove(this);
Cell* cell = _headInstance->GetCell();
for_each_instance(instance, cell->GetSlaveInstances()) {
SharedPath* sharedPath = instance->_GetSharedPath(this);
if (sharedPath) delete sharedPath;
end_for;
}
_headInstance->_GetSharedPathMap()._Remove(this);
}
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
// ******************************************
{
return (_tailSharedPath) ? _tailSharedPath->GetTailInstance() : _headInstance;
return (_tailSharedPath) ? _tailSharedPath->GetTailInstance() : _headInstance;
}
char SharedPath::GetNameSeparator()
// ********************************
{
return NAME_SEPARATOR;
return NAME_SEPARATOR;
}
string SharedPath::GetName() const
// *******************************
{
string name = "";
string nameSeparator = "";
SharedPath* sharedPath = (SharedPath*)this;
while (sharedPath) {
name += nameSeparator + GetString(sharedPath->GetHeadInstance()->GetName());
nameSeparator = GetString(GetNameSeparator());
sharedPath = sharedPath->GetTailSharedPath();
}
return name;
string name = "";
string nameSeparator = "";
SharedPath* sharedPath = (SharedPath*)this;
while (sharedPath) {
name += nameSeparator + GetString(sharedPath->GetHeadInstance()->GetName());
nameSeparator = GetString(GetNameSeparator());
sharedPath = sharedPath->GetTailSharedPath();
}
return name;
}
Cell* SharedPath::GetOwnerCell() const
// ***********************************
{
return _headInstance->GetCell();
return _headInstance->GetCell();
}
Cell* SharedPath::GetMasterCell() const
// ************************************
{
Cell* masterCell = NULL;
SharedPath* sharedPath = (SharedPath*)this;
while (sharedPath) {
masterCell = sharedPath->GetHeadInstance()->GetMasterCell();
sharedPath = sharedPath->GetTailSharedPath();
}
return masterCell;
Cell* masterCell = NULL;
SharedPath* sharedPath = (SharedPath*)this;
while (sharedPath) {
masterCell = sharedPath->GetHeadInstance()->GetMasterCell();
sharedPath = sharedPath->GetTailSharedPath();
}
return masterCell;
}
Instances SharedPath::GetInstances() const
// ***************************************
{
return SharedPath_Instances(this);
return SharedPath_Instances(this);
}
Transformation SharedPath::GetTransformation(const Transformation& transformation) const
// *************************************************************************************
{
Transformation headTransformation = _headInstance->GetTransformation();
Transformation tailTransformation =
(!_tailSharedPath) ? transformation : _tailSharedPath->GetTransformation(transformation);
return headTransformation.GetTransformation(tailTransformation);
Transformation headTransformation = _headInstance->GetTransformation();
Transformation tailTransformation =
(!_tailSharedPath) ? transformation : _tailSharedPath->GetTransformation(transformation);
return headTransformation.getTransformation(tailTransformation);
}
void SharedPath::SetNameSeparator(char nameSeparator)
// **************************************************
{
NAME_SEPARATOR = nameSeparator;
NAME_SEPARATOR = nameSeparator;
}
string SharedPath::_GetString() const
// **********************************
{
string s = "<" + _TName("SharedPath");
string name = GetName();
if (!name.empty()) s += " " + name;
s += ">";
return s;
string s = "<" + _TName("SharedPath");
string name = GetName();
if (!name.empty()) s += " " + name;
s += ">";
return s;
}
Record* SharedPath::_GetRecord() const
// *****************************
{
Record* record = new Record(GetString(this));
if (record) {
record->Add(GetSlot("HeadInstance", _headInstance));
record->Add(GetSlot("TailSharedPath", _tailSharedPath));
record->Add(GetSlot("Quarks", &_quarkMap));
}
return record;
Record* record = new Record(GetString(this));
if (record) {
record->Add(GetSlot("HeadInstance", _headInstance));
record->Add(GetSlot("TailSharedPath", _tailSharedPath));
record->Add(GetSlot("Quarks", &_quarkMap));
}
return record;
}
@ -226,32 +226,32 @@ Record* SharedPath::_GetRecord() const
SharedPath::QuarkMap::QuarkMap()
// *****************************
: Inherit()
: Inherit()
{
}
const Entity* SharedPath::QuarkMap::_GetKey(Quark* quark) const
// ************************************************************
{
return quark->GetOccurrence().GetEntity();
return quark->GetOccurrence().GetEntity();
}
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
// *************************************************************
{
return quark->_GetNextOfSharedPathQuarkMap();
return quark->_GetNextOfSharedPathQuarkMap();
}
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)
// *********************************************************************
: Inherit(),
_sharedPath(sharedPath)
: Inherit(),
_sharedPath(sharedPath)
{
}
SharedPath_Instances::SharedPath_Instances(const SharedPath_Instances& instances)
// ******************************************************************************
: Inherit(),
_sharedPath(instances._sharedPath)
: Inherit(),
_sharedPath(instances._sharedPath)
{
}
SharedPath_Instances& SharedPath_Instances::operator=(const SharedPath_Instances& instances)
// *****************************************************************************************
{
_sharedPath = instances._sharedPath;
return *this;
_sharedPath = instances._sharedPath;
return *this;
}
Collection<Instance*>* SharedPath_Instances::GetClone() const
// **********************************************************
{
return new SharedPath_Instances(*this);
return new SharedPath_Instances(*this);
}
Locator<Instance*>* SharedPath_Instances::GetLocator() const
// *********************************************************
{
return new Locator(_sharedPath);
return new Locator(_sharedPath);
}
string SharedPath_Instances::_GetString() const
// ********************************************
{
string s = "<" + _TName("SharedPath::Instances");
if (_sharedPath) s += " " + GetString(_sharedPath);
s += ">";
return s;
string s = "<" + _TName("SharedPath::Instances");
if (_sharedPath) s += " " + GetString(_sharedPath);
s += ">";
return s;
}
@ -310,56 +310,56 @@ string SharedPath_Instances::_GetString() const
SharedPath_Instances::Locator::Locator(const SharedPath* sharedPath)
// *****************************************************************
: Inherit(),
_sharedPath(sharedPath)
: Inherit(),
_sharedPath(sharedPath)
{
}
SharedPath_Instances::Locator::Locator(const Locator& locator)
// ***********************************************************
: Inherit(),
_sharedPath(locator._sharedPath)
: Inherit(),
_sharedPath(locator._sharedPath)
{
}
SharedPath_Instances::Locator& SharedPath_Instances::Locator::operator=(const Locator& locator)
// ********************************************************************************************
{
_sharedPath = locator._sharedPath;
return *this;
_sharedPath = locator._sharedPath;
return *this;
}
Instance* SharedPath_Instances::Locator::GetElement() const
// ********************************************************
{
return (_sharedPath) ? _sharedPath->GetHeadInstance() : NULL;
return (_sharedPath) ? _sharedPath->GetHeadInstance() : NULL;
}
Locator<Instance*>* SharedPath_Instances::Locator::GetClone() const
// ****************************************************************
{
return new Locator(*this);
return new Locator(*this);
}
bool SharedPath_Instances::Locator::IsValid() const
// ************************************************
{
return (_sharedPath != NULL);
return (_sharedPath != NULL);
}
void SharedPath_Instances::Locator::Progress()
// *******************************************
{
if (_sharedPath) _sharedPath = _sharedPath->GetTailSharedPath();
if (_sharedPath) _sharedPath = _sharedPath->GetTailSharedPath();
}
string SharedPath_Instances::Locator::_GetString() const
// *****************************************************
{
string s = "<" + _TName("SharedPath::Instances::Locator");
if (_sharedPath) s += " " + GetString(_sharedPath);
s += ">";
return s;
string s = "<" + _TName("SharedPath::Instances::Locator");
if (_sharedPath) s += " " + GetString(_sharedPath);
s += ">";
return s;
}

View File

@ -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 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 Transformation::Orientation COMPOSE[] = {
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::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::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::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::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::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::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::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
};
@ -45,201 +45,201 @@ static const Transformation::Orientation COMPOSE[] = {
Transformation::Transformation()
// *****************************
: _tx(0),
_ty(0),
_orientation()
: _tx(0),
_ty(0),
_orientation()
{
}
Transformation::Transformation(const Unit& tx, const Unit& ty, const Orientation& orientation)
// *******************************************************************************************
: _tx(tx),
_ty(ty),
_orientation(orientation)
: _tx(tx),
_ty(ty),
_orientation(orientation)
{
}
Transformation::Transformation(const Point& translation, const Orientation& orientation)
// *************************************************************************************
: _tx(translation.getX()),
_ty(translation.getY()),
_orientation(orientation)
: _tx(translation.getX()),
_ty(translation.getY()),
_orientation(orientation)
{
}
Transformation::Transformation(const Transformation& transformation)
// *****************************************************************
: _tx(transformation._tx),
_ty(transformation._ty),
_orientation(transformation._orientation)
: _tx(transformation._tx),
_ty(transformation._ty),
_orientation(transformation._orientation)
{
}
Transformation& Transformation::operator=(const Transformation& transformation)
// ****************************************************************************
{
_tx = transformation._tx;
_ty = transformation._ty;
_orientation = transformation._orientation;
return *this;
_tx = transformation._tx;
_ty = transformation._ty;
_orientation = transformation._orientation;
return *this;
}
bool Transformation::operator==(const Transformation& transformation) const
// ************************************************************************
{
return ((_tx == transformation._tx) &&
(_ty == transformation._ty) &&
(_orientation == transformation._orientation));
return ((_tx == transformation._tx) &&
(_ty == transformation._ty) &&
(_orientation == transformation._orientation));
}
bool Transformation::operator!=(const Transformation& transformation) const
// ************************************************************************
{
return ((_tx != transformation._tx) ||
(_ty != transformation._ty) ||
(_orientation != transformation._orientation));
return ((_tx != transformation._tx) ||
(_ty != transformation._ty) ||
(_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;
return GetBox(box.getXMin(), box.getYMin(), box.getXMax(), box.getYMax());
if (box.isEmpty()) return box;
return getBox(box.getXMin(), box.getYMin(), box.getXMax(), box.getYMax());
}
Transformation Transformation::GetTransformation(const Transformation& transformation) const
Transformation Transformation::getTransformation(const Transformation& transformation) const
// *****************************************************************************************
{
Unit x = transformation._tx;
Unit y = transformation._ty;
Unit x = transformation._tx;
Unit y = transformation._ty;
return Transformation(
(x * A[_orientation]) + (y * B[_orientation]) + _tx,
(x * C[_orientation]) + (y * D[_orientation]) + _ty,
COMPOSE[(_orientation * 8) + transformation._orientation]);
return Transformation(
(x * A[_orientation]) + (y * B[_orientation]) + _tx,
(x * C[_orientation]) + (y * D[_orientation]) + _ty,
COMPOSE[(_orientation * 8) + transformation._orientation]);
}
Transformation Transformation::GetInvert() const
Transformation Transformation::getInvert() const
// *********************************************
{
Transformation transformation = *this;
return transformation.Invert();
Transformation transformation = *this;
return transformation.invert();
}
Transformation& Transformation::Invert()
Transformation& Transformation::invert()
// *************************************
{
return operator=(
Transformation(
((_ty * B[_orientation]) - (_tx * D[_orientation])) * DISCREMINENT[_orientation],
((_tx * C[_orientation]) - (_ty * A[_orientation])) * DISCREMINENT[_orientation],
INVERT[_orientation]));
return operator=(
Transformation(
((_ty * B[_orientation]) - (_tx * D[_orientation])) * DISCREMINENT[_orientation],
((_tx * C[_orientation]) - (_ty * A[_orientation])) * DISCREMINENT[_orientation],
INVERT[_orientation]));
}
void Transformation::ApplyOn(Unit& x, Unit& y) const
void Transformation::applyOn(Unit& x, Unit& y) const
// *************************************************
{
Unit xi = x, yi = y;
x = GetX(xi, yi);
y = GetY(xi, yi);
Unit xi = x, yi = y;
x = getX(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
// **************************************
{
return "<" + _TName("Transformation") + " " +
GetValueString(_tx) + " " +
GetValueString(_ty) + " " +
GetString(_orientation) +
">";
return "<" + _TName("Transformation") + " " +
GetValueString(_tx) + " " +
GetValueString(_ty) + " " +
GetString(_orientation) +
">";
}
Record* Transformation::_GetRecord() const
// *********************************
{
Record* record = new Record(GetString(this));
record->Add(GetSlot("X", &_tx));
record->Add(GetSlot("Y", &_ty));
record->Add(GetSlot("Orientation", _orientation));
return record;
Record* record = new Record(GetString(this));
record->Add(GetSlot("X", &_tx));
record->Add(GetSlot("Y", &_ty));
record->Add(GetSlot("Orientation", _orientation));
return record;
}
@ -250,21 +250,21 @@ Record* Transformation::_GetRecord() const
Transformation::Orientation::Orientation(const Code& code)
// *******************************************************
: _code(code)
: _code(code)
{
}
Transformation::Orientation::Orientation(const Orientation& orientation)
// *********************************************************************
: _code(orientation._code)
: _code(orientation._code)
{
}
Transformation::Orientation& Transformation::Orientation::operator=(const Orientation& orientation)
// ************************************************************************************************
{
_code = orientation._code;
return *this;
_code = orientation._code;
return *this;
}
string Transformation::Orientation::_GetString() const
@ -276,9 +276,9 @@ string Transformation::Orientation::_GetString() const
Record* Transformation::Orientation::_GetRecord() const
// **********************************************
{
Record* record = new Record(GetString(this));
record->Add(GetSlot("Code", &_code));
return record;
Record* record = new Record(GetString(this));
record->Add(GetSlot("Code", &_code));
return record;
}

View File

@ -24,105 +24,104 @@ class Transformation {
// *****
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 Orientation& orientation);
public: Orientation(const Code& code = ID);
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 _GetString() const;
public: Record* _GetRecord() const;
};
public: string _GetString() const;
public: Record* _GetRecord() const;
};
// Attributes
// **********
private: Unit _tx;
private: Unit _ty;
private: Orientation _orientation;
private: Unit _tx;
private: Unit _ty;
private: Orientation _orientation;
// Constructors
// ************
public: Transformation();
public: Transformation();
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 Unit& tx, const Unit& ty, 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
// *********
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
// *********
public: const Unit& GetTx() const {return _tx;};
public: const Unit& GetTy() const {return _ty;};
public: Point GetTranslation() const {return Point(_tx, _ty);};
public: const Orientation& GetOrientation() const {return _orientation;};
public: const Unit& getTx() const {return _tx;};
public: const Unit& getTy() const {return _ty;};
public: Point getTranslation() const {return Point(_tx, _ty);};
public: const Orientation& GetOrientation() const {return _orientation;};
public: Unit GetX(const Unit& x, const Unit& y) const;
public: Unit GetY(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 GetX(const Point& point) const;
public: Unit GetY(const Point& point) const;
public: Unit getX(const Point& point) const;
public: Unit getY(const Point& point) const;
public: Unit GetDx(const Unit& dx, const Unit& dy) const;
public: Unit GetDy(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: Point GetPoint(const Unit& x, const Unit& y) const;
public: Point GetPoint(const Point& point) const;
public: Point getPoint(const Unit& x, const Unit& y) 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 Point& point1, const Point& point2) const;
public: Box GetBox(const Box& box) 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 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
// **********
public: bool IsEven() const {return !(_orientation.GetCode() & 1);};
public: bool IsOdd() const {return (_orientation.GetCode() & 1);};
public: bool isEven() const {return !(_orientation.GetCode() & 1);};
public: bool isOdd() const {return (_orientation.GetCode() & 1);};
// Updators
// ********
public: Transformation& Invert();
public: Transformation& invert();
// Manipulators
// ************
public: void ApplyOn(Unit& x, Unit& y) const;
public: void ApplyOn(Point& point) const;
public: void ApplyOn(Box& box) const;
public: void ApplyOn(Transformation& transformation) const;
public: void applyOn(Unit& x, Unit& y) const;
public: void applyOn(Point& point) const;
public: void applyOn(Box& box) const;
public: void applyOn(Transformation& transformation) const;
// Others
// ******
public: string _GetTypeName() const { return _TName("Transformation"); };
public: string _GetString() const;
public: Record* _GetRecord() const;
public: string _GetString() const;
public: Record* _GetRecord() const;
};

View File

@ -24,7 +24,7 @@ Technology* getTechnology() {
}
CellWidget::CellWidget(Cell* c, QWidget* parent)
: QAbstractScrollArea(parent),
: QWidget(parent),
cell(c),
invalidRegion(),
clipBox(),
@ -37,32 +37,7 @@ CellWidget::CellWidget(Cell* c, QWidget* parent)
void CellWidget::paintEvent(QPaintEvent* event) {
invalidate(event->rect());
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();
}
redraw();
}
void CellWidget::invalidate() {
@ -85,7 +60,6 @@ void CellWidget::redraw() {
QRect invalidRect = invalidRegion.boundingRect();
H::Box area = getBox(invalidRect).inflate(getSize(1));
cerr << "akecoucou2" << endl;
QPaintDevice* device = this;
@ -93,16 +67,17 @@ void CellWidget::redraw() {
QPainter* oldPainter = painter;
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());
//drawBoundaries(cell, area, Transformation());
//for_each_layer(layer, getTechnology()->GetLayers()) {
// drawCell(cell, layer, area, Transformation());
// end_for;
//}
drawPhantoms(cell, area, Transformation());
drawBoundaries(cell, area, Transformation());
for_each_layer(layer, getTechnology()->GetLayers()) {
drawCell(cell, layer, area, Transformation());
end_for;
}
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 {
H::Box masterArea = updateArea;
Transformation masterTransformation = instance->GetTransformation();
instance->GetTransformation().GetInvert().ApplyOn(masterArea);
transformation.ApplyOn(masterTransformation);
instance->GetTransformation().getInvert().applyOn(masterArea);
transformation.applyOn(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 {
H::Box masterArea = updateArea;
Transformation masterTransformation = instance->GetTransformation();
instance->GetTransformation().GetInvert().ApplyOn(masterArea);
transformation.ApplyOn(masterTransformation);
instance->GetTransformation().getInvert().applyOn(masterArea);
transformation.applyOn(masterTransformation);
drawBoundaries(instance->GetMasterCell(), masterArea, masterTransformation);
}

View File

@ -1,14 +1,14 @@
#ifndef __CELL_WIDGET_H
#define __CELL_WIDGET_H
#include <QAbstractScrollArea>
#include <QWidget>
#include "Box.h"
#include "Cell.h"
using namespace H;
class CellWidget : public QAbstractScrollArea {
class CellWidget : public QWidget {
public:
CellWidget(Cell* cell, QWidget* parent=0);
void redraw();