|
From: <xb...@us...> - 2013-06-24 12:41:33
|
Revision: 1830
http://sourceforge.net/p/scstudio/code/1830
Author: xborza
Date: 2013-06-24 12:41:30 +0000 (Mon, 24 Jun 2013)
Log Message:
-----------
bug #61(Connection points persist on copied instances) fixed
Modified Paths:
--------------
trunk/src/view/visio/addon/document.cpp
trunk/src/view/visio/addon/extract.cpp
trunk/src/view/visio/addon/extract.h
Modified: trunk/src/view/visio/addon/document.cpp
===================================================================
--- trunk/src/view/visio/addon/document.cpp 2013-06-24 10:15:07 UTC (rev 1829)
+++ trunk/src/view/visio/addon/document.cpp 2013-06-24 12:41:30 UTC (rev 1830)
@@ -272,6 +272,8 @@
case ST_BMSC_INSTANCE:
if(vsoShape->Text.length() == 0)
vsoShape->Text = _T("NAME");
+ //Remove blind connection points
+ remove_shape_blind_connections(vsoShape);
break;
case ST_BMSC_MESSAGE:
Modified: trunk/src/view/visio/addon/extract.cpp
===================================================================
--- trunk/src/view/visio/addon/extract.cpp 2013-06-24 10:15:07 UTC (rev 1829)
+++ trunk/src/view/visio/addon/extract.cpp 2013-06-24 12:41:30 UTC (rev 1830)
@@ -17,6 +17,7 @@
*/
#include "stdafx.h"
+#include <set>
#include "extract.h"
#include "errors.h"
@@ -133,6 +134,51 @@
}
}
+int remove_shape_blind_connections(Visio::IVShapePtr shape)
+{
+ // connected shapes
+ Visio::IVConnectsPtr toSheets = shape->Connects;
+ Visio::IVConnectsPtr fromSheets = shape->FromConnects;
+ int size = toSheets->Count + fromSheets->Count;
+
+ int numb_of_conpts = shape->RowCount[visSectionConnectionPts];
+
+ if(numb_of_conpts == size)
+ return 0;
+
+ if(size == 0 && numb_of_conpts != 0){
+ //remove all connection points
+ shape->DeleteSection(visSectionConnectionPts);
+ return numb_of_conpts;
+ }
+ // set of row with connected shape
+ std::set<short>con_rows;
+ for(int i=0; i < numb_of_conpts; i++)
+ {
+ con_rows.insert(i);
+ }
+
+ // go through the all connected shapes and return connection Xi.cell
+ Visio::IVCellPtr toCell;
+ for(int i=1; i <= fromSheets->Count; i++)
+ {
+ toCell = fromSheets->Item[i]->ToCell;
+ short row = toCell->ContainingRow->GetIndex();
+ //check to which connection point is glued and remove its row
+ con_rows.erase(row);
+ }
+
+ //erase all remaining connection points
+ std::set<short>::iterator it;
+ int ret = con_rows.size();
+ int i = 0;
+ for(it = con_rows.begin(); it != con_rows.end(); ++it)
+ {
+ shape->DeleteRow(visSectionConnectionPts,*it - i++);
+ }
+ return ret;
+}
+
TShapeType get_shape_type(Visio::IVShapePtr shape)
{
// walk though all user-defined cells
@@ -207,6 +253,7 @@
return 0; // default value
}
+
bool isMessageShape(Visio::IVShapePtr shape)
{
switch(get_shape_type(shape))
Modified: trunk/src/view/visio/addon/extract.h
===================================================================
--- trunk/src/view/visio/addon/extract.h 2013-06-24 10:15:07 UTC (rev 1829)
+++ trunk/src/view/visio/addon/extract.h 2013-06-24 12:41:30 UTC (rev 1830)
@@ -52,6 +52,10 @@
//! determine MSC symbol represented by the given shape
TShapeType get_shape_type(Visio::IVShapePtr shape);
+//! remove all connection points without connected shape (by copying)
+// return number of removed connection points
+int remove_shape_blind_connections(Visio::IVShapePtr shape);
+
enum TDrawingType
{
DT_UNKNOWN = 0,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|