Esempio n. 1
0
    def SelectRect(self, Object):
        Canvas = self.Canvas
        if Object is self.SelectedRectOrig:
            pass
        else:
            if self.SelectedRect:
                self.DeSelectRect()

            self.SelectedRectOrig = Object
            self.SelectedRect = Canvas.AddRectangle(
                Object.XY,
                Object.WH,
                LineWidth=2,
                LineColor="Yellow",
                FillColor=None,
                InForeground=True,
            )
            self.SelectedRect.HasChanged = False
            # draw handles for resizing
            rlPos = Object.XY + Object.WH
            udPos = Object.XY + Object.WH
            self.HandleRL = self.Canvas.AddBitmap(
                Resources.getMoveRLCursorBitmap(), rlPos, Position="cc")
            self.HandleUD = self.Canvas.AddBitmap(
                Resources.getMoveUDCursorBitmap(), udPos, Position="cc")

            self.SetHandles(Object)

            self.HandleRL.Bind(FC.EVT_FC_LEFT_DOWN, self.HandleSizeRL)
            self.HandleUD.Bind(FC.EVT_FC_LEFT_DOWN, self.HandleSizeUD)

            Canvas.Draw()
Esempio n. 2
0
    def SelectRect(self, Object):
        Canvas = self.Canvas
        if Object is self.SelectedRectOrig:
            pass
        else:
            if self.SelectedRect:
                self.DeSelectRect()

            self.SelectedRectOrig = Object
            self.SelectedRect = Canvas.AddRectangle(Object.XY, Object.WH,
                                                  LineWidth = 2,
                                                  LineColor = "Yellow",
                                                  FillColor = None,
                                                  InForeground = True)
            self.SelectedRect.HasChanged = False
            # draw handles for resizing
            rlPos = Object.XY + Object.WH
            udPos = Object.XY + Object.WH
            self.HandleRL = self.Canvas.AddBitmap(Resources.getMoveRLCursorBitmap(), rlPos, Position='cc')
            self.HandleUD = self.Canvas.AddBitmap(Resources.getMoveUDCursorBitmap(), udPos, Position='cc')
    
            self.SetHandles(Object)
            
            self.HandleRL.Bind(FC.EVT_FC_LEFT_DOWN, self.HandleSizeRL)
            self.HandleUD.Bind(FC.EVT_FC_LEFT_DOWN, self.HandleSizeUD)
            
            Canvas.Draw()
Esempio n. 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

        self.Canvas.Bind(FloatCanvas.EVT_MOTION, self.OnMove)
        self.Canvas.Bind(FloatCanvas.EVT_LEFT_UP, self.OnLeftUp)
        self.Canvas.Bind(FloatCanvas.EVT_LEFT_DOWN, 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
Esempio n. 4
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

        self.Canvas.Bind(FloatCanvas.EVT_MOTION, self.OnMove )
        self.Canvas.Bind(FloatCanvas.EVT_LEFT_UP, self.OnLeftUp )
        self.Canvas.Bind(FloatCanvas.EVT_LEFT_DOWN, 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