コード例 #1
0
ファイル: MapPanMode.cs プロジェクト: Costigan/siteview
 public override void OnMouseMove(object sender, MouseEventArgs e)
 {
     MapView.DisplayTransform transform = Map.Transform;
     transform.OffsetX = e.Location.X - MouseDownPoint.X + offsetX;
     transform.OffsetY = e.Location.Y - MouseDownPoint.Y + offsetY;
     Map.Transform     = transform;
 }
コード例 #2
0
        public override void Draw(Graphics g, MapView.DisplayTransform t, ImageAttributes attributes = null)
        {
            var view   = MainWindow.MapView;
            var bounds = view.Bounds;

            _features.Draw(g, t);
        }
コード例 #3
0
 public override void Draw(Graphics g, MapView.DisplayTransform t, ImageAttributes attributes = null)
 {
     foreach (var p in MainWindow.MapView.SelectedPatches)
     {
         p.Draw(g, t, _selectionBrush);
         p.Draw(g, t, _selectionPen);
     }
 }
コード例 #4
0
        public override void Draw(Graphics g, MapView.DisplayTransform t, ImageAttributes attributes = null)
        {
            var view   = MainWindow.MapView;
            var bounds = view.Bounds;

            foreach (var p in view.FinishedPatches)
            {
                if (p.IsVisible(t, bounds))
                {
                    p.FillMatrices(TileTreeNode.Terrain);
                    p.Draw(g, t, p.GetEarthShadows(view.EarthVector));
                }
            }
        }
コード例 #5
0
        public override void Draw(Graphics g, MapView.DisplayTransform t)
        {
            if (!IsLoaded)
            {
                Load();
            }
            var r = t.Transform(new Rectangle(0, 0, Bitmap.Width, Bitmap.Height));

            Console.WriteLine($"destrect=[{r.X},{r.Y},{r.Width},{r.Height}]");

            var save = g.CompositingMode;

            g.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceOver;
            g.DrawImage(Bitmap, r, 0, 0, Bitmap.Width, Bitmap.Height, GraphicsUnit.Pixel, _imageAttributes);
            g.CompositingMode = save;
        }
コード例 #6
0
        public override void Paint(PaintEventArgs e, PickablePanel p)
        {
            var m = p as MapView;

            Debug.Assert(p != null);
            MapView.DisplayTransform t = m.Transform;
            Graphics g = e.Graphics;
            float    x = t.X(Location.X);
            float    y = t.Y(Location.Y);

            g.FillRectangle(Brush, x - 1, y - 1, 3, 3);
            g.DrawLine(Pen, x, y, x + Offset.X, y + Offset.Y);
            if (Text != null)
            {
                g.DrawString(Text, DrawingHelper.SecondsFont, Brush, x, y + 12);
            }
        }
コード例 #7
0
        public override void OnMouseWheel(object sender, MouseEventArgs e)
        {
            const float zoom   = 1.1f;
            var         map    = sender as MapView;
            float       factor = e.Delta < 0 ? zoom : 1f / zoom;

            MapView.DisplayTransform t = map.Transform;

            PointF mapLocation = t.MouseToMap(e.Location);
            var    mouse2      = t[mapLocation];

            t.Scale *= factor;
            PointF newLocation = t[mapLocation];

            t.OffsetX += (int)(e.Location.X - newLocation.X);
            t.OffsetY += (int)(e.Location.Y - newLocation.Y);

            map.Transform = t;
        }
コード例 #8
0
        public override void Draw(Graphics g, MapView.DisplayTransform t, ImageAttributes attributes = null)
        {
            var r = t[Bounds];

            if (Image != null)
            {
                if (attributes == null)
                {
                    g.DrawImage(Image, r);
                }
                else
                {
                    var r1 = new Rectangle((int)r.X, (int)r.Y, (int)r.Width, (int)r.Height);
                    g.DrawImage(Image, r1, 0, 0, Image.Width, Image.Height, GraphicsUnit.Pixel, attributes);
                }
            }
            else
            {
                g.DrawRectangle(Pens.Blue, r.Left, r.Top, r.Width, r.Height);
            }
        }
コード例 #9
0
 public abstract void Draw(Graphics g, MapView.DisplayTransform t);
コード例 #10
0
 public abstract void Draw(Graphics g, MapView.DisplayTransform t, ImageAttributes attributes = null);
コード例 #11
0
 public override void Draw(Graphics g, MapView.DisplayTransform t, ImageAttributes attributes = null)
 {
 }
コード例 #12
0
 public override void Draw(Graphics g, MapView.DisplayTransform t, ImageAttributes attributes = null)
 {
     Tree.Draw(g, t, _drawAttributes);
 }