Ejemplo n.º 1
0
 private void SetCurrentTool(TransformationTool tool)
 {
     if (tool != null) _lastTool = tool;
     _currentTool = tool;
     _widgets = (_currentTool == null) ? new List<Widget>() : _currentTool.GetWidgets(Document).ToList();
     foreach (var widget in _widgets)
     {
         widget.OnTransforming = OnWidgetTransforming;
         widget.OnTransformed = OnWidgetTransformed;
         widget.SelectionChanged();
     }
 }
Ejemplo n.º 2
0
        /// <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));
        }
Ejemplo n.º 3
0
 private void SetCurrentTool(TransformationTool tool)
 {
     if (tool != null) _lastTool = tool;
     _currentTool = tool;
 }