Exemplo n.º 1
0
        public static void PaintOverview(IGraphics g, SizeI2 totalSize, RectangleI2 visibleWin,
                                         Func <int, int, Bitmap2> getOverviewBitmap, float zoomFactorX, float zoomFactorY)
        {
            Size2      overview = CalcOverviewSize(visibleWin.Width, visibleWin.Height, totalSize.Width, totalSize.Height);
            Rectangle2 win      = CalcWin(overview, totalSize, visibleWin, zoomFactorX, zoomFactorY);

            g.FillRectangle(Brushes2.White, 0, visibleWin.Height - overview.Height, overview.Width, overview.Height);
            g.DrawImageUnscaled(getOverviewBitmap((int)overview.Width, (int)overview.Height), 0,
                                visibleWin.Height - overview.Height);
            Brush2 b = new Brush2(Color2.FromArgb(30, 0, 0, 255));

            if (win.X > 0)
            {
                g.FillRectangle(b, 0, visibleWin.Height - overview.Height, win.X, overview.Height);
            }
            if (overview.Width - win.X - win.Width > 0)
            {
                g.FillRectangle(b, win.X + win.Width, visibleWin.Height - overview.Height, overview.Width - win.X - win.Width,
                                overview.Height);
            }
            if (win.Y > 0)
            {
                g.FillRectangle(b, win.X, visibleWin.Height - overview.Height, win.Width, win.Y);
            }
            if (overview.Height - win.Y - win.Height > 0)
            {
                g.FillRectangle(b, win.X, visibleWin.Height - overview.Height + win.Y + win.Height - 1, win.Width,
                                overview.Height - win.Y - win.Height);
            }
            g.DrawRectangle(Pens2.Black, 0, visibleWin.Height - overview.Height - 1, overview.Width, overview.Height);
            g.DrawRectangle(Pens2.Blue, win.X, visibleWin.Height - overview.Height - 1 + win.Y, win.Width, win.Height);
        }
Exemplo n.º 2
0
        public static Rectangle2 CalcWin(Size2 overview, SizeI2 totalSize, RectangleI2 visibleWin, float zoomFactorX,
			float zoomFactorY)
        {
            float winX = visibleWin.X*overview.Width/totalSize.Width;
            float winWidth = visibleWin.Width*overview.Width/totalSize.Width/zoomFactorX;
            if (winWidth > overview.Width - winX){
                winWidth = overview.Width - winX;
            }
            float winY = visibleWin.Y*overview.Height/totalSize.Height;
            float winHeight = visibleWin.Height*overview.Height/totalSize.Height/zoomFactorY;
            if (winHeight > overview.Height - winY){
                winHeight = overview.Height - winY;
            }
            return new Rectangle2(winX, winY, winWidth, winHeight);
        }
Exemplo n.º 3
0
        public static void PaintOverview(IGraphics g, SizeI2 totalSize, RectangleI2 visibleWin,
                                         Func <int, int, Bitmap2> getOverviewBitmap, float zoomFactorX, float zoomFactorY, bool overviewTopRight)
        {
            if (getOverviewBitmap == null)
            {
                return;
            }
            Size2      overview = CalcOverviewSize(visibleWin.Width, visibleWin.Height, totalSize.Width, totalSize.Height);
            Rectangle2 win      = CalcWin(overview, totalSize, visibleWin, zoomFactorX, zoomFactorY);
            float      xpos     = overviewTopRight ? visibleWin.Width - overview.Width - 1 : 0;
            float      ypos     = overviewTopRight ? 1 : visibleWin.Height - overview.Height;

            g.FillRectangle(Brushes2.White, xpos, ypos, overview.Width, overview.Height);
            Bitmap2 bm = getOverviewBitmap((int)overview.Width, (int)overview.Height);

            if (bm == null)
            {
                return;
            }
            g.DrawImageUnscaled(bm, xpos, ypos);
            Brush2 b = new Brush2(Color2.FromArgb(30, 0, 0, 255));

            if (win.X > 0)
            {
                g.FillRectangle(b, xpos, ypos, win.X, overview.Height);
            }
            if (overview.Width - win.X - win.Width > 0)
            {
                g.FillRectangle(b, xpos + win.X + win.Width, ypos, overview.Width - win.X - win.Width, overview.Height);
            }
            if (win.Y > 0)
            {
                g.FillRectangle(b, xpos + win.X, ypos, win.Width, win.Y);
            }
            if (overview.Height - win.Y - win.Height > 0)
            {
                g.FillRectangle(b, xpos + win.X, ypos + win.Y + win.Height - 1, win.Width, overview.Height - win.Y - win.Height);
            }
            g.DrawRectangle(Pens2.Black, xpos, ypos - 1, overview.Width, overview.Height);
            g.DrawRectangle(Pens2.Blue, xpos + win.X, ypos - 1 + win.Y, win.Width, win.Height);
            if (win.Width < 5 && win.Height < 5)
            {
                g.DrawLine(Pens2.Red, xpos + win.X, ypos + win.Y, xpos + win.X + 5, ypos + win.Y);
                g.DrawLine(Pens2.Red, xpos + win.X, ypos + win.Y, xpos + win.X, ypos + win.Y + 5);
                g.DrawLine(Pens2.Red, xpos + win.X, ypos + win.Y, xpos + win.X + 7, ypos + win.Y + 7);
            }
        }
Exemplo n.º 4
0
        public static Rectangle2 CalcWin(Size2 overview, SizeI2 totalSize, RectangleI2 visibleWin, float zoomFactorX,
                                         float zoomFactorY)
        {
            float winX     = visibleWin.X * overview.Width / totalSize.Width;
            float winWidth = visibleWin.Width * overview.Width / totalSize.Width / zoomFactorX;

            if (winWidth > overview.Width - winX)
            {
                winWidth = overview.Width - winX;
            }
            float winY      = visibleWin.Y * overview.Height / totalSize.Height;
            float winHeight = visibleWin.Height * overview.Height / totalSize.Height / zoomFactorY;

            if (winHeight > overview.Height - winY)
            {
                winHeight = overview.Height - winY;
            }
            return(new Rectangle2(winX, winY, winWidth, winHeight));
        }
Exemplo n.º 5
0
        public static void PaintOverview(IGraphics g, SizeI2 totalSize, RectangleI2 visibleWin,
			Func<int, int, Bitmap2> getOverviewBitmap, float zoomFactorX, float zoomFactorY)
        {
            Size2 overview = CalcOverviewSize(visibleWin.Width, visibleWin.Height, totalSize.Width, totalSize.Height);
            Rectangle2 win = CalcWin(overview, totalSize, visibleWin, zoomFactorX, zoomFactorY);
            g.FillRectangle(Brushes2.White, 0, visibleWin.Height - overview.Height, overview.Width, overview.Height);
            g.DrawImageUnscaled(getOverviewBitmap((int) overview.Width, (int) overview.Height), 0,
                visibleWin.Height - overview.Height);
            Brush2 b = new Brush2(Color2.FromArgb(30, 0, 0, 255));
            if (win.X > 0){
                g.FillRectangle(b, 0, visibleWin.Height - overview.Height, win.X, overview.Height);
            }
            if (overview.Width - win.X - win.Width > 0){
                g.FillRectangle(b, win.X + win.Width, visibleWin.Height - overview.Height, overview.Width - win.X - win.Width,
                    overview.Height);
            }
            if (win.Y > 0){
                g.FillRectangle(b, win.X, visibleWin.Height - overview.Height, win.Width, win.Y);
            }
            if (overview.Height - win.Y - win.Height > 0){
                g.FillRectangle(b, win.X, visibleWin.Height - overview.Height + win.Y + win.Height - 1, win.Width,
                    overview.Height - win.Y - win.Height);
            }
            g.DrawRectangle(Pens2.Black, 0, visibleWin.Height - overview.Height - 1, overview.Width, overview.Height);
            g.DrawRectangle(Pens2.Blue, win.X, visibleWin.Height - overview.Height - 1 + win.Y, win.Width, win.Height);
        }