コード例 #1
0
        public override void Run()
        {
            ILegendItem selectedItem = (GIS.FrameWork.Application.App.Legend as GIS.Common.Dialogs.Legend).SelectedLegendMenuItem;

            if (selectedItem != null)
            {
                selectedItem.ParentMapFrame().ViewExtents = (selectedItem as Layer).Extent;
            }
        }
コード例 #2
0
        public override void Run()
        {
            ILegendItem selectedItem = (GIS.FrameWork.Application.App.Legend as GIS.Common.Dialogs.Legend).SelectedLegendMenuItem;

            if (selectedItem != null)
            {
                LayerActions la       = new LayerActions();
                IFrame       mapFrame = selectedItem.ParentMapFrame();
                if (la != null && selectedItem != null)
                {
                    la.DynamicVisibility(selectedItem as IDynamicVisibility, mapFrame);
                }
            }
        }
コード例 #3
0
        /// <summary>
        /// Zooms to the envelope of the selected features, adding a border of the size specified.
        /// </summary>
        public void ZoomToSelected(ILegendItem _selectedItem, double distanceX, double distanceY)
        {
            ISelection selection;

            if (_selectedItem != null)
            {
                if (!(_selectedItem is FeatureLayer))
                {
                    return;
                }
                selection = (_selectedItem as FeatureLayer).Selection;
                if (selection.Count == 0)
                {
                    return;
                }

                Envelope env = selection.Envelope;
                _selectedItem.ParentMapFrame().ViewExtents = env.ToExtent();
            }
        }
コード例 #4
0
ファイル: Legend.cs プロジェクト: qingqibing/aa
        /// <summary>
        /// Checks the Mouse Up event to see if it occurs inside a legend item.
        /// </summary>
        /// <param name="e"></param>
        protected override void OnMouseUp(MouseEventArgs e)
        {
            Point loc = new Point(e.X + ControlRectangle.X, e.Location.Y + ControlRectangle.Top);

            if (!_wasDoubleClick)
            {
                foreach (LegendBox box in _legendBoxes)
                {
                    if (!box.Bounds.Contains(loc))
                    {
                        continue;
                    }
                    ItemMouseEventArgs args = new ItemMouseEventArgs(e, box);
                    DoItemMouseUp(args);
                }
            }

            if (_isDragging && _dragItem != null)
            {
                if (_dragTarget != null && _dragTarget.Item != _dragItem.Item)
                {
                    ILegendItem potentialParent = _dragTarget.Item.GetValidContainerFor(_dragItem.Item);
                    if (potentialParent != null)
                    {
                        potentialParent.ParentMapFrame().SuspendEvents();

                        // The target must be a group, and the item must be a layer.
                        ILayer lyr = _dragItem.Item as ILayer;
                        if (lyr != null)
                        {
                            IGroup grp = _dragItem.Item.GetParentItem() as IGroup;
                            lyr.LockDispose();
                            //when original location is inside group, remove layer from the group.
                            if (grp != null)
                            {
                                grp.Remove(lyr);
                            }
                            int index = _dragTarget.Item.InsertIndex(_dragItem.Item);
                            if (index == -1)
                            {
                                index = 0;
                            }
                            grp = potentialParent as IGroup;
                            if (grp != null)
                            {
                                grp.Insert(index, lyr);
                                //when the target is a group, assign the parent item.
                                lyr.SetParentItem(grp);
                            }
                            lyr.UnlockDispose();
                        }
                        potentialParent.ParentMapFrame().ResumeEvents();
                        OnOrderChanged();
                        potentialParent.ParentMapFrame().Invalidate();
                    }
                }
                Cursor      = Cursors.Arrow;
                _isDragging = false;
                Invalidate();
            }
            _wasDoubleClick = false;

            base.OnMouseUp(e);
        }