예제 #1
0
파일: SelectTool.cs 프로젝트: silky/sledge
 private void SetCurrentTool(TransformationTool tool)
 {
     if (tool != null) _lastTool = tool;
     _currentTool = tool;
     _sidebarPanel.TransformationToolChanged(_currentTool);
     _widgets = (_currentTool == null || !Sledge.Settings.Select.Show3DSelectionWidgets) ? new List<Widget>() : _currentTool.GetWidgets(Document).ToList();
     foreach (var widget in _widgets)
     {
         widget.OnTransforming = OnWidgetTransforming;
         widget.OnTransformed = OnWidgetTransformed;
         widget.SelectionChanged();
     }
 }
예제 #2
0
파일: SelectTool.cs 프로젝트: silky/sledge
        /// <summary>
        /// Deselect (first) a list of objects and then select (second) another list.
        /// </summary>
        /// <param name="objectsToDeselect">The objects to deselect</param>
        /// <param name="objectsToSelect">The objects to select</param>
        /// <param name="deselectAll">If true, this will ignore the objectToDeselect parameter and just deselect everything</param>
        /// <param name="ignoreGrouping">If true, object groups will be ignored</param>
        private void SetSelected(IEnumerable<MapObject> objectsToDeselect, IEnumerable<MapObject> objectsToSelect, bool deselectAll, bool ignoreGrouping)
        {
            if (objectsToDeselect == null) objectsToDeselect = new MapObject[0];
            if (objectsToSelect == null) objectsToSelect = new MapObject[0];

            if (deselectAll)
            {
                objectsToDeselect = Document.Selection.GetSelectedObjects();
                _lastTool = null;
            }

            // Normalise selections
            objectsToDeselect = NormaliseSelection(objectsToDeselect.Where(x => x != null), ignoreGrouping);
            objectsToSelect = NormaliseSelection(objectsToSelect.Where(x => x != null), ignoreGrouping);

            // Don't bother deselecting the objects we're about to select
            objectsToDeselect = objectsToDeselect.Where(x => !objectsToSelect.Contains(x));

            // Perform selections
            var deselected = objectsToDeselect.ToList();
            var selected = objectsToSelect.ToList();

            Document.PerformAction("Selection changed", new ChangeSelection(selected, deselected));
        }
예제 #3
0
 public void TransformationToolChanged(TransformationTool tt)
 {
     _selectedType = tt == null ? null : tt.GetType();
     SetCheckState();
 }