예제 #1
0
 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;
        }
        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);
            }
        }
        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);
 }