Exemplo n.º 1
0
        public void LocateCanvas(Geometry.Vector location)
        {
            double radius  = 500;
            var    pt1     = new Geometry.Vector(location.X + radius, location.Y + radius);
            var    pt2     = new Geometry.Vector(location.X - radius, location.Y - radius);
            var    extents = Extents.FromPoints(pt2, pt1);

            this.Zoom(extents);
        }
Exemplo n.º 2
0
        public override void MouseUpHandler(object sender, MouseButtonEventArgs e)
        {
            if (e.ChangedButton == MouseButton.Left)
            {
                if (_isStarted == false)
                {
                    if (_isMoving == true)
                    {
                        Extents   = Extents.FromPoints(_mouseDownOrigin, _mouseDownEnd);
                        Picked    = true;
                        _isMoving = false;
                    }

                    Rect.Visibility = Visibility.Collapsed;
                    _isDragging     = false;
                }
            }
        }
Exemplo n.º 3
0
        private void ZoomExtentsButton_Click(object sender, RoutedEventArgs e)
        {
            var bubblePositions = this.MyCanvas.Children
                                  .Cast <UIElement>()
                                  .Where(element => element is NodeBubble)
                                  .Cast <NodeBubble>()
                                  .Select(bubble => new Vector(bubble.Position.X, bubble.Position.Y))
                                  .ToArray();

            if (bubblePositions.Length == 0)
            {
                return;
            }

            var extents = Extents.FromPoints(bubblePositions);

            this.Zoom(extents.Offset(200));
        }
Exemplo n.º 4
0
        public override void MouseDownHandler(object sender, MouseButtonEventArgs e)
        {
            if (e.ChangedButton == MouseButton.Left)
            {
                if (_isDragging == false)
                {
                    _isDragging      = true;
                    _mouseDownOrigin = MapControl.Current.GetWorldCoord(e.GetPosition(MapControl.Current));
                    return;
                }

                _mouseDownEnd = MapControl.Current.GetWorldCoord(e.GetPosition(MapControl.Current));
                var extents     = Extents.FromPoints(_mouseDownOrigin, _mouseDownEnd);
                var queryResult = MapDataManager.LatestMap
                                  .QueryFeatures(IsWindow ? SpatialQueryOperation.Window : SpatialQueryOperation.Cross, extents, 0)
                                  .ToArray();

                if (queryResult.Length > 0)
                {
                    if ((Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift &&
                        (Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)    // mod 20140725
                    {
                        SelectionSet.SubtractSelection(queryResult);
                    }
                    else if ((Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift) // mod 20120810
                    {
                        SelectionSet.AddSelection(queryResult);
                    }
                    else
                    {
                        SelectionSet.Select(queryResult); // mod 20120725
                    }
                }
                else
                {
                    SelectionSet.ClearSelection();
                }

                _isDragging          = false;
                this.Rect.Visibility = Visibility.Collapsed;
            }
        }
Exemplo n.º 5
0
        public override void MouseUpHandler(object sender, MouseButtonEventArgs e)
        {
            if (e.ChangedButton == MouseButton.Left)
            {
                if (_isStarted == false)
                {
                    if (_isMoving == true)
                    {
                        var pt1 = MapControl.Current.GetWorldCoord(_mouseDownOrigin);
                        var pt2 = MapControl.Current.GetWorldCoord(_mouseDownEnd);

                        var extents = Extents.FromPoints(pt1, pt2);
                        MapControl.Current.Zoom(extents);

                        _isMoving = false;
                    }

                    MapControl.Current.Children.Remove(Rect);
                    Rect.Visibility = Visibility.Collapsed;
                    _isDragging     = false;
                }
            }
        }