| |
2668 |
def Follow(self):
|
| |
2669 |
nodea = self.Get('NodeA') # these objects might not already be in the diagram
|
| |
2670 |
nodeb = self.Get('NodeB')
|
| |
2671 |
# if not already in the diagram , then create the nodes
|
| |
2672 |
print 'nodea type', nodea.__class__
|
| |
2673 |
if not isinstance(nodea, ORMShape):
|
| |
2674 |
self.canvas.CreateNode(self.canvas.pdc, nodea)
|
| |
2675 |
print 'nodeb type', nodeb.__class__
|
| |
2676 |
if not isinstance(nodeb, ORMShape):
|
| |
2677 |
self.canvas.CreateNode(self.canvas.pdc, nodeb)
|
| |
2678 |
nodea.AddFollower(self) # must be the right subtype to have this method
|
| |
2679 |
nodeb.AddFollower(self)
|
| |
2680 |
|
| 2838 |
|
# if not already in the diagram , then create the nodes
|
| 2839 |
|
print 'nodea type', nodea.__class__
|
| 2840 |
|
if not isinstance(nodea, ORMShape):
|
| 2841 |
|
self.canvas.CreateNode(self.canvas.pdc, nodea)
|
| 2842 |
|
print 'nodeb type', nodeb.__class__
|
| 2843 |
|
if not isinstance(nodeb, ORMShape):
|
| 2844 |
|
self.canvas.CreateNode(self.canvas.pdc, nodeb)
|
| 2845 |
|
nodea.AddFollower(self) # must be the right subtype to have this method
|
| 2846 |
|
nodeb.AddFollower(self)
|
| |
2855 |
enda = (nodea.PosX, nodea.PosY)
|
| |
2856 |
endb = (nodeb.PosX, nodeb.PosY)
|
| |
2857 |
enda, endb = nodea.AdjustEnd(endb), nodeb.AdjustEnd(enda)
|
| |
2858 |
|
| |
2859 |
dc.ClearId(self.dcid)
|
| |
2860 |
dc.SetId(self.dcid)
|
| |
2861 |
|
| |
2862 |
minx = min(enda[0], endb[0])
|
| |
2863 |
maxx = max(enda[0], endb[0])
|
| |
2864 |
miny = min(enda[1], endb[1])
|
| |
2865 |
maxy = max(enda[1], endb[1])
|
| |
2866 |
|
| |
2867 |
box_w = maxx - minx + 6
|
| |
2868 |
box_h = maxy - miny + 6
|
| |
2869 |
|
| |
2870 |
pen = self.canvas.CachedPen(1, 1, wx.SOLID)
|
| |
2871 |
dc.SetPen(pen)
|
| |
2872 |
dc.DrawLine(enda[0], enda[1], endb[0], endb[1])
|
| |
2873 |
self.SetTempPos((enda[0]+endb[0]) / 2, (enda[1] + endb[1]) / 2)
|
| |
2874 |
# need to add logic to draw the role name
|
| |
2875 |
# need to save the calculated PosX and PosY
|
| |
2876 |
|
| |
2877 |
# place mandatory participation
|
| |
2878 |
if 1: # mandatory
|
| |
2879 |
dot_size = 3
|
| |
2880 |
if 1: # one end
|
| |
2881 |
dot = wx.lib.ogl.GetPointOnLine(enda[0], enda[1], endb[0], endb[1], dot_size)
|
| |
2882 |
else:
|
| |
2883 |
dot = wx.lib.ogl.GetPointOnLine(endb[0], endb[1], enda[0], enda[1], dot_size)
|
| |
2884 |
pen = self.canvas.CachedPen(1, 1, wx.SOLID)
|
| |
2885 |
dc.SetPen(pen)
|
| |
2886 |
dc.SetBrush(self.canvas.CachedBrush('Blue'))
|
| |
2887 |
dc.DrawCircle(int(dot[0]),int(dot[1]),dot_size)
|
| |
2888 |
|
| |
2889 |
r = wx.Rect(minx,miny,box_w,box_h)
|
| |
2890 |
r.Inflate(pen.GetWidth(),pen.GetWidth())
|
| |
2891 |
dc.SetIdBounds(self.dcid,r)
|
| |
2892 |
|
| |
2893 |
class ORMSubTypeShape(ORMConnector):
|
| 2882 |
|
def Follow(self):
|
| 2883 |
|
nodea = self.Get('NodeA')
|
| 2884 |
|
nodeb = self.Get('NodeB')
|
| 2885 |
|
# if not already in the diagram , then create the nodes
|
| 2886 |
|
if not isinstance(nodea, ORMShape):
|
| 2887 |
|
shape.canvas.CreateNode(self.canvas.pdc, nodea)
|
| 2888 |
|
if not isinstance(nodeb, ORMShape):
|
| 2889 |
|
shape.canvas.CreateNode(self.canvas.pdc, nodeb)
|
| 2890 |
|
nodea.AddFollower(self) # must be the right subtype to have this method
|
| 2891 |
|
nodeb.AddFollower(self)
|
| 2892 |
|
|
| 2925 |
|
def Follow(self):
|
| 2926 |
|
nodea = self.Get('NodeA')
|
| 2927 |
|
nodeb = self.Get('NodeB')
|
| 2928 |
|
# if not already in the diagram , then create the nodes
|
| 2929 |
|
if not isinstance(nodea, ORMShape):
|
| 2930 |
|
shape.canvas.CreateNode(self.canvas.pdc, nodea)
|
| 2931 |
|
if not isinstance(nodeb, ORMShape):
|
| 2932 |
|
shape.canvas.CreateNode(self.canvas.pdc, nodeb)
|
| 2933 |
|
nodea.AddFollower(self) # must be the right subtype to have this method
|
| 2934 |
|
nodeb.AddFollower(self)
|
| 2935 |
|
|