|
From: <xb...@us...> - 2013-07-19 21:07:56
|
Revision: 1853
http://sourceforge.net/p/scstudio/code/1853
Author: xborza
Date: 2013-07-19 21:07:53 +0000 (Fri, 19 Jul 2013)
Log Message:
-----------
ordering shapes automatic snapping remade for snapping to messages connection points (if the message is moving, the ordering is still connected to it)
Modified Paths:
--------------
trunk/src/view/visio/addon/orderSnapping.cpp
trunk/src/view/visio/addon/orderSnapping.h
Modified: trunk/src/view/visio/addon/orderSnapping.cpp
===================================================================
--- trunk/src/view/visio/addon/orderSnapping.cpp 2013-07-19 07:15:06 UTC (rev 1852)
+++ trunk/src/view/visio/addon/orderSnapping.cpp 2013-07-19 21:07:53 UTC (rev 1853)
@@ -125,8 +125,8 @@
conPoint.m_y = CShapeUtils::getShapeCell(orderShape,"EndY");
}
- // connector, to which endpoint should be glued
- Visio::IVConnectPtr con;
+ // connection point of message, to which endpoint should be glued
+ Visio::IVCellPtr con;
double corCenter = CShapeUtils::getShapeCell(coregion,"BeginX");
// on which side glue the ordering endpoint?
@@ -140,7 +140,7 @@
}
// where it should be glued? -- 9999 == max - check the whole coregion area
- con = getNearestMessageEvent(connectors,conPoint, sideToLook, 9999.9);
+ con = getNearestMessageConPoint(connectors,conPoint, sideToLook, 9999.9);
// Do snap and glue!
m_bOrderSnap = true;
@@ -148,7 +148,7 @@
if(con != NULL)
{
Visio::IVCellPtr beg = orderShape->GetCells(endPointX);
- beg->GlueTo(con->ToCell);
+ beg->GlueTo(con);
res = true;
}
@@ -177,8 +177,8 @@
conPoint2.m_x = CShapeUtils::getShapeCell(orderShape,"EndX");
conPoint2.m_y = CShapeUtils::getShapeCell(orderShape,"EndY");
- // connectors, to which OrderShape should be glued
- Visio::IVConnectPtr con1, con2;
+ // messages' connection points, to which OrderShape should be glued
+ Visio::IVCellPtr con1, con2;
double corCenter = CShapeUtils::getShapeCell(coregion,"BeginX");
// on which sides the ordering should be glued?
@@ -201,8 +201,8 @@
}
// where it should be glued? -- 9999 == max - check the whole coregion area
- con1 = getNearestMessageEvent(connectors,conPoint1, sideToLook1, 9999.9);
- con2 = getNearestMessageEvent(connectors,conPoint2, sideToLook2, 9999.9);
+ con1 = getNearestMessageConPoint(connectors,conPoint1, sideToLook1, 9999.9);
+ con2 = getNearestMessageConPoint(connectors,conPoint2, sideToLook2, 9999.9);
//Do snap and glue!
m_bOrderSnap = true;
@@ -210,14 +210,14 @@
if(con1 != NULL)
{
Visio::IVCellPtr beg = orderShape->GetCells("BeginX");
- beg->GlueTo(con1->ToCell);
+ beg->GlueTo(con1);
ret++;
}
if(con2 != NULL && con1 != con2)
{
Visio::IVCellPtr end = orderShape->GetCells("EndX");
- end->GlueTo(con2->ToCell);
+ end->GlueTo(con2);
ret++;
}
m_bOrderSnap = false;
@@ -233,13 +233,12 @@
return (ret > 0);
}
-Visio::IVConnectPtr COrderSnapping::getNearestMessageEvent(l_r_connects& corConns, SPoint point,
- CorSide side, double max_dist)
+Visio::IVCellPtr COrderSnapping::getNearestMessageConPoint(l_r_connects& corConns,
+ SPoint point, CorSide side,double max_dist)
{
- Visio::IVConnectPtr result = NULL;
- //lookup the vector of connectors
- std::vector<Visio::IVConnectPtr> cons;
- cons = (side == LEFT) ? corConns.first : corConns.second;
+ // result = related connection point of the message
+ Visio::IVCellPtr result = NULL;
+#define cons ((side == LEFT) ? corConns.first : corConns.second)
std::vector<Visio::IVConnectPtr>::iterator it, toDel;
@@ -267,18 +266,17 @@
{
min = distance;
toDel = it;
- result = *it;
+ //check to which side of message the connection point is attached
+ Visio::IVShapePtr msgShape = (*it)->FromSheet;
+ if(_tcsicmp((*it)->FromCell->GetName(), L"BeginX") == 0)
+ result = msgShape->CellsSRC[visSectionConnectionPts][0][0];
+ else
+ result = msgShape->CellsSRC[visSectionConnectionPts][1][0];
}
}
- // remove used conPoint from vector (to not use it in the future)
- /*if(side == LEFT && min != max_dist)
- {
- corConns.first.erase(toDel);
- }
- else if(side == RIGHT && min != max_dist)
- {
- corConns.second.erase(toDel);
- }*/
+ if(result != NULL)
+ cons.erase(toDel);
+#undef cons
return result;
-}
\ No newline at end of file
+}
Modified: trunk/src/view/visio/addon/orderSnapping.h
===================================================================
--- trunk/src/view/visio/addon/orderSnapping.h 2013-07-19 07:15:06 UTC (rev 1852)
+++ trunk/src/view/visio/addon/orderSnapping.h 2013-07-19 21:07:53 UTC (rev 1853)
@@ -60,7 +60,7 @@
static Visio::IVShapePtr getIntersectCoregion(Visio::IVShapePtr orderShape,double PinX,
double PinY,double max_dist=3.0);
- static Visio::IVConnectPtr getNearestMessageEvent(l_r_connects& coregionConnectors,
+ static Visio::IVCellPtr getNearestMessageConPoint(l_r_connects& coregionConnectors,
SPoint point, CorSide side,double max_dist=3.0);
static l_r_connects getCoregionsMsgConnectors(Visio::IVShapePtr coregion);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|