Пример #1
0
        void c1Map1_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button != MouseButtons.Left)
            {
                return;
            }

            _currentMark = null;
            var info = c1Map1.HitTest(e.Location);

            if (info == null || info.Type != HitTestType.VectorItem)
            {
                return;
            }

            if (ModifierKeys == Keys.Shift)
            {
                _currentMark = info.Vector;

                var geometry = (GeoPoint)_currentMark.Geometry;
                var location = c1Map1.GeographicToScreen(new C1.Win.Interop.Point(geometry.X, geometry.Y));
                _offset = new Point(e.Location.X - (int)location.X, e.Location.Y - (int)location.Y);
            }
            else if (ModifierKeys == Keys.Alt)
            {
                _layer.Items.Remove(info.Vector);
            }
        }
Пример #2
0
        void c1Map1_MouseUp(object sender, MouseEventArgs e)
        {
            if (e.Button != MouseButtons.Left)
            {
                return;
            }

            _currentMark = null;

            if (ModifierKeys == Keys.Control)
            {
                var p1       = c1Map1.GeographicToScreen(new C1.Win.Interop.Point(-180, 90));
                var p2       = c1Map1.GeographicToScreen(new C1.Win.Interop.Point(180, -90));
                var location = e.Location;
                if (location.X >= p1.X && location.X <= p2.X && location.Y >= p1.Y && location.Y <= p2.Y)
                {
                    var point = c1Map1.ScreenToGeographic(location);
                    AddMark(point.X, point.Y);
                }
            }
        }