Exemplo n.º 1
0
        //--------------------------------------------------------------------------------------------------

        #endregion

        #region Selection

        void _OnSelectionChanged(ToolAction toolAction)
        {
            if (CurrentTool != null)
            {
                return;
            }

            if (_MoveAction != null)
            {
                _MoveAction.Stop();
                _MoveAction = null;
            }

            _UpdateSelections();

            if (SelectedSegments.Any() || SelectedPoints.Any())
            {
                _MoveAction = new MoveSketchPointAction(this);
                if (!WorkspaceController.StartToolAction(_MoveAction, false))
                {
                    return;
                }
                _MoveAction.Previewed += _OnMoveActionPreview;
                _MoveAction.Finished  += _OnMoveActionFinished;

                var segPoints = SelectedSegments.SelectMany(seg => seg.Points);
                _MoveAction.SetSketchElements(Sketch, SelectedPoints.Union(segPoints).ToList());
            }

            WorkspaceController.Invalidate();
        }
Exemplo n.º 2
0
 /// <summary>
 /// Selects required segments
 /// </summary>
 protected void SetSegments()
 {
     if (SelectedSegments.Any())
     {
         for (int i = 0; i < SelectedSegments.Count; i++)
         {
             GeometryFigures.Single(t => (int)t.SegmentNumber == SelectedSegments[i]).IsSelected = true;
         }
     }
     else
     {
         ValueSegmentsSelection();
     }
 }
Exemplo n.º 3
0
        //--------------------------------------------------------------------------------------------------

        void _UpdateStatusText()
        {
            if (SelectedSegments.Any() && !SelectedPoints.Any() && !SelectedConstraints.Any())
            {
                StatusText = SelectedSegments.Count == 1 ? string.Format(SegmentSelectedStatusText, SelectedSegments[0].GetType().Name) : string.Format(MultiSegmentSelectedStatusText, SelectedSegments.Count);
            }
            else if (!SelectedSegments.Any() && SelectedPoints.Any() && !SelectedConstraints.Any())
            {
                StatusText = SelectedPoints.Count == 1 ? string.Format(PointSelectedStatusText, SelectedPoints[0]) : string.Format(MultiPointSelectedStatusText, SelectedPoints.Count);
            }
            else if (!SelectedSegments.Any() && !SelectedPoints.Any() && SelectedConstraints.Any())
            {
                StatusText = SelectedConstraints.Count == 1 ? string.Format(ConstraintSelectedStatusText, SelectedConstraints[0].GetType().Name) : string.Format(MultiConstraintSelectedStatusText, SelectedConstraints.Count);
            }
            else
            if (SelectedSegments.Any() || SelectedPoints.Any() || SelectedConstraints.Any())
            {
                StatusText = MixedSelectedStatusText;
            }
            else
            {
                StatusText = UnselectedStatusText;
            }
        }