[Uml-devel] branches/work/soc-umbrello/umbrello
Gopala Krishna A
krishna.ggk at gmail.com
Sun Jun 14 15:49:00 UTC 2009
SVN commit 981969 by gopala:
Prefix Uml::Region's enum names with "reg_" for better consistency.
Also removed the unused Center region from the Uml::Region enumeration.
M +17 -19 associationspacemanager.cpp
M +30 -30 newlinepath.cpp
M +9 -10 umlnamespace.h
M +1 -1 widgets/newassociationwidget.cpp
--- branches/work/soc-umbrello/umbrello/associationspacemanager.cpp #981968:981969
@@ -40,13 +40,12 @@
* registered.
* @note This method does not call arrange(region) as that is the decision to
* be taken dynamically.
- * @note region should not be Uml::Center nor Uml::Error.
+ * @note region should not be Uml::reg_Error.
*/
void AssociationSpaceManager::add(New::AssociationWidget *assoc,
Uml::Region region)
{
- Q_ASSERT(region != Uml::Center);
- Q_ASSERT(region != Uml::Error);
+ Q_ASSERT(region != Uml::reg_Error);
if (registered(assoc)) {
uDebug() << assoc->name() << " is already registered!";
@@ -71,13 +70,12 @@
{
if (!registered(assoc)) {
uDebug() << assoc->name() << " is not registered!";
- return Uml::Error;
+ return Uml::reg_Error;
}
Uml::Region reg = region(assoc);
//TODO: Remove these checks after extensive testing.
- Q_ASSERT(reg != Uml::Error);
- Q_ASSERT(reg != Uml::Center);
+ Q_ASSERT(reg != Uml::reg_Error);
QList<New::AssociationWidget*> &listRef = m_regionAssociationsMap[reg];
listRef.removeOne(assoc);
@@ -132,13 +130,13 @@
*/
void AssociationSpaceManager::arrange(Uml::Region region)
{
- if (region == Uml::Error || region == Uml::Center) return;
+ if (region == Uml::reg_Error) return;
QRectF rect = m_umlWidget->sceneRect();
// Holds whether arrangement is based on x(horizontal) or not (which means
// its vertically arranged based on y).
- bool xBasis = (region == Uml::North || region == Uml::South);
+ bool xBasis = (region == Uml::reg_North || region == Uml::reg_South);
QList<New::AssociationWidget*> &listRef = m_regionAssociationsMap[region];
if (listRef.isEmpty()) {
@@ -178,15 +176,15 @@
foreach (New::AssociationWidget *assoc, listRef) {
QPointF end(pos, pos);
switch (region) {
- case Uml::North: end.setY(rect.top()); break;
- case Uml::East: end.setX(rect.right()); break;
- case Uml::South: end.setY(rect.bottom()); break;
- case Uml::West: end.setX(rect.left()); break;
+ case Uml::reg_North: end.setY(rect.top()); break;
+ case Uml::reg_East: end.setX(rect.right()); break;
+ case Uml::reg_South: end.setY(rect.bottom()); break;
+ case Uml::reg_West: end.setX(rect.left()); break;
- case Uml::NorthWest: end = rect.topLeft(); break;
- case Uml::NorthEast: end = rect.topRight(); break;
- case Uml::SouthEast: end = rect.bottomRight(); break;
- case Uml::SouthWest: end = rect.bottomLeft(); break;
+ case Uml::reg_NorthWest: end = rect.topLeft(); break;
+ case Uml::reg_NorthEast: end = rect.topRight(); break;
+ case Uml::reg_SouthEast: end = rect.bottomRight(); break;
+ case Uml::reg_SouthWest: end = rect.bottomLeft(); break;
default: break;
}
@@ -205,7 +203,7 @@
*/
void AssociationSpaceManager::arrangeAllRegions()
{
- for (int i = Uml::West; i <= Uml::SouthWest; ++i) {
+ for (int i = Uml::reg_West; i <= Uml::reg_SouthWest; ++i) {
arrange((Uml::Region)i);
}
}
@@ -216,7 +214,7 @@
Uml::Region AssociationSpaceManager::region(New::AssociationWidget *assoc) const
{
if (!registered(assoc)) {
- return Uml::Error;
+ return Uml::reg_Error;
}
QMapIterator<Uml::Region, QList<New::AssociationWidget*> >
it(m_regionAssociationsMap);
@@ -226,7 +224,7 @@
return it.key();
}
}
- return Uml::Error;
+ return Uml::reg_Error;
}
/**
--- branches/work/soc-umbrello/umbrello/newlinepath.cpp #981968:981969
@@ -862,15 +862,15 @@
QMap<Uml::Region, QLineF> aRectLines, bRectLines;
// Do the mapping.
- aRectLines[Uml::West] = QLineF(aRect.topLeft(), aRect.bottomLeft());
- aRectLines[Uml::North] = QLineF(aRect.topLeft(), aRect.topRight());
- aRectLines[Uml::East] = QLineF(aRect.topRight(), aRect.bottomRight());
- aRectLines[Uml::South] = QLineF(aRect.bottomLeft(), aRect.bottomRight());
+ aRectLines[Uml::reg_West] = QLineF(aRect.topLeft(), aRect.bottomLeft());
+ aRectLines[Uml::reg_North] = QLineF(aRect.topLeft(), aRect.topRight());
+ aRectLines[Uml::reg_East] = QLineF(aRect.topRight(), aRect.bottomRight());
+ aRectLines[Uml::reg_South] = QLineF(aRect.bottomLeft(), aRect.bottomRight());
- bRectLines[Uml::West] = QLineF(bRect.topLeft(), bRect.bottomLeft());
- bRectLines[Uml::North] = QLineF(bRect.topLeft(), bRect.topRight());
- bRectLines[Uml::East] = QLineF(bRect.topRight(), bRect.bottomRight());
- bRectLines[Uml::South] = QLineF(bRect.bottomLeft(), bRect.bottomRight());
+ bRectLines[Uml::reg_West] = QLineF(bRect.topLeft(), bRect.bottomLeft());
+ bRectLines[Uml::reg_North] = QLineF(bRect.topLeft(), bRect.topRight());
+ bRectLines[Uml::reg_East] = QLineF(bRect.topRight(), bRect.bottomRight());
+ bRectLines[Uml::reg_South] = QLineF(bRect.bottomLeft(), bRect.bottomRight());
// NOTE: Don't add tracker to scene for now.. tracker is still needed
// for visual debugging and hence not removed yet.
@@ -890,7 +890,7 @@
// Now determine which all regions (represented by QLineF objects) is
// intersected by the aLine and bLine for widA and widB
// respectively, and store resultant in the above declared maps.
- for (int i = Uml::West; i <= Uml::South; ++i) {
+ for (int i = Uml::reg_West; i <= Uml::reg_South; ++i) {
Uml::Region r = (Uml::Region)i;
QPointF temp;
aIntersections[r] = (aLine.intersect(aRectLines[r], &temp) ==
@@ -903,30 +903,30 @@
}
// Do intersection mapping separately for corner regions.
- aIntersections[Uml::NorthWest] = (aIntersections[Uml::North] == true
- && aIntersections[Uml::West] == true);
- aIntersections[Uml::NorthEast] = (aIntersections[Uml::North] == true
- && aIntersections[Uml::East] == true);
- aIntersections[Uml::SouthWest] = (aIntersections[Uml::South] == true
- && aIntersections[Uml::West] == true);
- aIntersections[Uml::SouthEast] = (aIntersections[Uml::South] == true
- && aIntersections[Uml::East] == true);
+ aIntersections[Uml::reg_NorthWest] = (aIntersections[Uml::reg_North] == true
+ && aIntersections[Uml::reg_West] == true);
+ aIntersections[Uml::reg_NorthEast] = (aIntersections[Uml::reg_North] == true
+ && aIntersections[Uml::reg_East] == true);
+ aIntersections[Uml::reg_SouthWest] = (aIntersections[Uml::reg_South] == true
+ && aIntersections[Uml::reg_West] == true);
+ aIntersections[Uml::reg_SouthEast] = (aIntersections[Uml::reg_South] == true
+ && aIntersections[Uml::reg_East] == true);
- bIntersections[Uml::NorthWest] = (bIntersections[Uml::North] == true
- && bIntersections[Uml::West] == true);
- bIntersections[Uml::NorthEast] = (bIntersections[Uml::North] == true
- && bIntersections[Uml::East] == true);
- bIntersections[Uml::SouthWest] = (bIntersections[Uml::South] == true
- && bIntersections[Uml::West] == true);
- bIntersections[Uml::SouthEast] = (bIntersections[Uml::South] == true
- && bIntersections[Uml::East] == true);
+ bIntersections[Uml::reg_NorthWest] = (bIntersections[Uml::reg_North] == true
+ && bIntersections[Uml::reg_West] == true);
+ bIntersections[Uml::reg_NorthEast] = (bIntersections[Uml::reg_North] == true
+ && bIntersections[Uml::reg_East] == true);
+ bIntersections[Uml::reg_SouthWest] = (bIntersections[Uml::reg_South] == true
+ && bIntersections[Uml::reg_West] == true);
+ bIntersections[Uml::reg_SouthEast] = (bIntersections[Uml::reg_South] == true
+ && bIntersections[Uml::reg_East] == true);
// If no intersecion happened above, default it to North
if (!aSomeIntersection) {
- aIntersections[Uml::North] = true;
+ aIntersections[Uml::reg_North] = true;
}
if (!bSomeIntersection) {
- bIntersections[Uml::North] = true;
+ bIntersections[Uml::reg_North] = true;
}
// Determine the new region occupied so that an updation of only
@@ -935,9 +935,9 @@
// regions, the new regions determined will appropriately point to
// corner region if it intersected corner region (two edge regions).
// (i.e we are not breaking from loop on first true value)
- Uml::Region aNewRegion = Uml::Error;
- Uml::Region bNewRegion = Uml::Error;
- for (int i = Uml::West; i <= Uml::SouthWest; ++i) {
+ Uml::Region aNewRegion = Uml::reg_Error;
+ Uml::Region bNewRegion = Uml::reg_Error;
+ for (int i = Uml::reg_West; i <= Uml::reg_SouthWest; ++i) {
Uml::Region r = (Uml::Region)i;
if (aIntersections[r] == true) {
aNewRegion = r;
--- branches/work/soc-umbrello/umbrello/umlnamespace.h #981968:981969
@@ -305,16 +305,15 @@
* @note Do not change this ordering, as we use these values in for loop.
*/
enum Region {
- Error = 0,
- West,
- North,
- East,
- South,
- NorthWest,
- NorthEast,
- SouthEast,
- SouthWest,
- Center
+ reg_Error = 0,
+ reg_West,
+ reg_North,
+ reg_East,
+ reg_South,
+ reg_NorthWest,
+ reg_NorthEast,
+ reg_SouthEast,
+ reg_SouthWest
};
/**
--- branches/work/soc-umbrello/umbrello/widgets/newassociationwidget.cpp #981968:981969
@@ -473,7 +473,7 @@
void AssociationWidget::setWidgetForRole(UMLWidget *widget, Uml::Role_Type role)
{
m_widgetRole[role].umlWidget = widget;
- widget->associationSpaceManager()->add(this, Uml::North);
+ widget->associationSpaceManager()->add(this, Uml::reg_North);
}
Uml::Association_Type AssociationWidget::associationType() const
More information about the umbrello-devel
mailing list