Thanks lot for the attachment.
I used it for create a mine composite HostShape, but i have much problem on
dragging and binding events on composite shape.
With an approssimative CalcBoundingBox method i can draw the objects in the
canvas, but i cant bind the events on it. Now the drown object are
unclickable.
To add my HostShape in the canvas i use:
self.Canvas.AddObject(hostShape)
hostShape.Bind(FC.EVT_FC_LEFT_DOWN, self.ObjectHit)
Now my HostShape class is this:
class HostShape(FC.DrawObject,MovingObjectMixin, ConnectorObjectMixin):
def __init__(self, parent, point, testo, tipo,boundingbox=None,
InForeground=False,IsVisible=True):
self.point=point
(x,y)=point
self.__hitable = False
self.textPoint=(x,y-1)
self.pluginPath = parent.pluginPath
self.Canvas=parent.Canvas
FC.DrawObject.__init__(self, InForeground, IsVisible)
if tipo == 'host':
self.bmp = wx.Image(self.pluginPath + 'host.png',
wx.BITMAP_TYPE_PNG).ConvertToBitmap()
if tipo == 'router':
self.bmp = wx.Image(self.pluginPath + 'router.png',
wx.BITMAP_TYPE_PNG).ConvertToBitmap()
self.shape=MovingBitmap(self.bmp, self.point, Height = 3.5, Position
= "bc")
self.text = MovingText(testo, self.textPoint, Size = 1, Position =
"tc")
self.CalcBoundingBox()
def _Draw(self, dc , WorldToPixel, ScaleWorldToPixel, HTdc=None):
self.shape._Draw(dc , WorldToPixel, ScaleWorldToPixel, HTdc=None)
self.text._Draw(dc , WorldToPixel, ScaleWorldToPixel, HTdc=None)
How can i write a correct CalcBoundingBox method?
--
Marco Meoni (Sbaush)
_______________________________________________
FloatCanvas mailing list
[email protected]
http://mail.mithis.com/cgi-bin/mailman/listinfo/floatcanvas