def SelectObject(self, Circle):
        self.Circle = Circle
        self.Radius = Circle.WH[0] / 2
        
        self.CenterHandle = self.Canvas.AddBitmap(Resources.getMoveCursorBitmap(),
                                              Circle.Center,
                                              Position='cc',
                                              InForeground=True)

        #cross = Cross(Circle.XY, InForeground=True)
        self.CenterHandle.Bind(FloatCanvas.EVT_FC_LEFT_DOWN, self.OnCenterHit)
        self.Canvas.Draw(True)
示例#2
0
    def __init__(self, parent, id, title, position, size):
        wx.Frame.__init__(self, parent, id, title, position, size)

        self.CreateStatusBar()
        # Add the Canvas
        Canvas = NavCanvas.NavCanvas(
            self,
            -1,
            (500, 500),
            ProjectionFun=None,
            Debug=0,
            BackgroundColor="DARK SLATE BLUE",
        ).Canvas

        self.Canvas = Canvas

        FloatCanvas.EVT_MOTION(self.Canvas, self.OnMove)
        FloatCanvas.EVT_LEFT_UP(self.Canvas, self.OnLeftUp)
        FloatCanvas.EVT_LEFT_DOWN(self.Canvas, self.OnLeftDown)

        Point = N.array((0, 0), N.float)

        Canvas.AddCircle(
            Point,
            Diameter=40,
            FillColor="Red",
            LineStyle=None,
        )

        Width = 300
        self.Box = Canvas.AddScaledTextBox(
            LongString,
            Point,
            10,
            Color="Black",
            BackgroundColor='White',
            LineStyle="Solid",
            LineWidth=2,
            Width=Width,
            PadSize=10.0,
            Family=wx.ROMAN,
            #Family = wx.TELETYPE,
            Style=wx.NORMAL,
            Weight=wx.NORMAL,
            Underlined=False,
            Position='tl',
            LineSpacing=0.8,
            Alignment="left",
            #Alignment = "center",
            #Alignment = "right",
            InForeground=False)

        self.Handle1 = Canvas.AddBitmap(Resources.getMoveCursorBitmap(),
                                        Point,
                                        Position='cc')
        self.Handle2a = Canvas.AddBitmap(Resources.getMoveRLCursorBitmap(),
                                         Point,
                                         Position='cc')
        self.Handle2b = Canvas.AddBitmap(Resources.getMoveRLCursorBitmap(),
                                         Point,
                                         Position='cc')

        self.SetHandles()

        self.Handle1.Bind(FloatCanvas.EVT_FC_LEFT_DOWN, self.Handle1Hit)
        self.Handle2a.Bind(FloatCanvas.EVT_FC_LEFT_DOWN, self.Handle2Hit)
        self.Handle2b.Bind(FloatCanvas.EVT_FC_LEFT_DOWN, self.Handle2Hit)

        self.Show(True)
        self.Canvas.ZoomToBB()

        self.Resizing = False
        self.ResizeRect = None
        self.Moving = False

        return None
示例#3
0
    def __init__(self,parent, id,title,position,size):
        wx.Frame.__init__(self,parent, id,title,position, size)

        self.CreateStatusBar()            
        # Add the Canvas
        Canvas = NavCanvas.NavCanvas(self,-1,(500,500),
                                          ProjectionFun = None,
                                          Debug = 0,
                                          BackgroundColor = "DARK SLATE BLUE",
                                          ).Canvas
        
        self.Canvas = Canvas

        FloatCanvas.EVT_MOTION(self.Canvas, self.OnMove ) 
        FloatCanvas.EVT_LEFT_UP(self.Canvas, self.OnLeftUp ) 
        FloatCanvas.EVT_LEFT_DOWN(self.Canvas, self.OnLeftDown)

        Point = N.array((0,0), N.float)

        

        Canvas.AddCircle(Point,

                         Diameter=40,

                         FillColor="Red",

                         LineStyle=None,

                         )

        
        Width = 300
        self.Box = Canvas.AddScaledTextBox(LongString,
                                      Point,
                                      10,
                                      Color = "Black",
                                      BackgroundColor = 'White',
                                      LineStyle = "Solid",
                                      LineWidth = 2,
                                      Width = Width,
                                      PadSize = 10.0,
                                      Family = wx.ROMAN,
                                      #Family = wx.TELETYPE,
                                      Style = wx.NORMAL,
                                      Weight = wx.NORMAL,
                                      Underlined = False,
                                      Position = 'tl',
                                      LineSpacing = 0.8,     
                                      Alignment = "left",
                                      #Alignment = "center",
                                      #Alignment = "right",
                                      InForeground = False)
        

        self.Handle1 = Canvas.AddBitmap(Resources.getMoveCursorBitmap(), Point, Position='cc')
        self.Handle2a = Canvas.AddBitmap(Resources.getMoveRLCursorBitmap(), Point, Position='cc')
        self.Handle2b = Canvas.AddBitmap(Resources.getMoveRLCursorBitmap(), Point, Position='cc')

        self.SetHandles()
        
        self.Handle1.Bind(FloatCanvas.EVT_FC_LEFT_DOWN, self.Handle1Hit)
        self.Handle2a.Bind(FloatCanvas.EVT_FC_LEFT_DOWN, self.Handle2Hit)
        self.Handle2b.Bind(FloatCanvas.EVT_FC_LEFT_DOWN, self.Handle2Hit)


        self.Show(True)
        self.Canvas.ZoomToBB()

        self.Resizing = False
        self.ResizeRect = None
        self.Moving = False

        return None