コード例 #1
0
        //--------------------------------------------------------------------------------------------------

        public void Stop()
        {
            if (_PreviewLine != null)
            {
                _PreviewLine.Remove();
                _PreviewLine = null;
            }
            for (int i = 0; i < _HintLines.Length; i++)
            {
                if (_HintLines[i] != null)
                {
                    _HintLines[i].Remove();
                }
                _HintLines[i] = null;
            }
            _Element?.Remove();

            _PointAction.ConstraintPoint -= _PointActionOnConstraintPoint;

            _PointAction.Stop();

            _SketchEditorTool.WorkspaceController.HudManager?.RemoveElement(_Coord2DHudElement);
            _Coord2DHudElement = null;
            _SketchEditorTool.WorkspaceController.HudManager?.RemoveElement(_LabelHudElement);
            _LabelHudElement = null;
        }
コード例 #2
0
        //--------------------------------------------------------------------------------------------------

        void _OnActionPreview(ToolAction toolAction)
        {
            if (toolAction == _PointAction)
            {
                if (_Segments != null)
                {
                    _SetSecondPoint(_PointAction.Point);
                    foreach (var component in _Elements)
                    {
                        component.OnPointsChanged(_Points, null);
                    }

                    if (_LabelHudElement == null)
                    {
                        _LabelHudElement = _SketchEditorTool.WorkspaceController.HudManager?.CreateElement <LabelHudElement>(this);
                    }
                    if (_LabelHudElement != null)
                    {
                        _LabelHudElement.Text = "Size: " + (_Points[0].X - _Points[2].X).Abs().ToRoundedString()
                                                + " x " + (_Points[0].Y - _Points[2].Y).Abs().ToRoundedString();
                    }
                }

                if (_Coord2DHudElement != null)
                {
                    _Coord2DHudElement.CoordinateX = _PointAction.Point.X;
                    _Coord2DHudElement.CoordinateY = _PointAction.Point.Y;
                }
            }
        }
コード例 #3
0
        //--------------------------------------------------------------------------------------------------

        void _OnActionPreview(ToolAction toolAction)
        {
            if (toolAction == _PointAction)
            {
                switch (_PointsCompleted)
                {
                case 1:
                    var p1 = _Points[0];
                    var p2 = _PointAction.Point;
                    if (_PreviewLine == null)
                    {
                        _PreviewLine = new HintLine(_SketchEditorTool.WorkspaceController, HintStyle.ThinDashed | HintStyle.Topmost);
                    }
                    _PreviewLine.Set(p1, p2, _SketchEditorTool.Sketch.Plane);
                    break;

                case 2:
                    if (_Segment != null)
                    {
                        _Points[2] = _PointAction.Point;
                        _Element.OnPointsChanged(_Points, null);

                        if (_LabelHudElement == null)
                        {
                            _LabelHudElement = _SketchEditorTool.WorkspaceController.HudManager?.CreateElement <LabelHudElement>(this);
                        }
                        _LabelHudElement?.SetValue("Radius: " + _Segment.Radius(_Points).ToRoundedString());
                    }
                    break;
                }

                _Coord2DHudElement?.SetValues(_PointAction.Point.X, _PointAction.Point.Y);
            }
        }
コード例 #4
0
        //--------------------------------------------------------------------------------------------------

        void _OnActionPreview(ToolAction toolAction)
        {
            if (toolAction == _PointAction)
            {
                if (_Segment != null)
                {
                    _Points[1] = _PointAction.Point;
                    _Element.OnPointsChanged(_Points, null);
                    _SketchEditorTool.WorkspaceController.Invalidate();

                    if (_LabelHudElement == null)
                    {
                        _LabelHudElement = _SketchEditorTool.WorkspaceController.HudManager?.CreateElement <LabelHudElement>(this);
                    }
                    if (_LabelHudElement != null)
                    {
                        _LabelHudElement.Text = "Radius: " + _Segment.Radius(_Points).ToRoundedString();
                    }
                }

                if (_Coord2DHudElement != null)
                {
                    _Coord2DHudElement.CoordinateX = _PointAction.Point.X;
                    _Coord2DHudElement.CoordinateY = _PointAction.Point.Y;
                }
            }
        }
        //--------------------------------------------------------------------------------------------------

        public void Stop()
        {
            if (_HintCircle != null)
            {
                _HintCircle.Remove();
                _HintCircle = null;
            }
            if (_HintLine != null)
            {
                _HintLine.Remove();
                _HintLine = null;
            }
            for (int i = 0; i < _Marker.Length; i++)
            {
                if (_Marker[i] != null)
                {
                    _Marker[i].Remove();
                }
                _Marker[i] = null;
            }

            _Element?.Remove();
            _PointAction?.Stop();

            _SketchEditorTool.WorkspaceController.HudManager?.RemoveElement(_Coord2DHudElement);
            _Coord2DHudElement = null;
            _SketchEditorTool.WorkspaceController.HudManager?.RemoveElement(_LabelHudElement);
            _LabelHudElement = null;
        }
コード例 #6
0
        //--------------------------------------------------------------------------------------------------

        public void Stop()
        {
            _PointAction.Stop();
            _Element?.Remove();
            _SketchEditorTool.WorkspaceController.HudManager?.RemoveElement(_Coord2DHudElement);
            _Coord2DHudElement = null;
            _SketchEditorTool.WorkspaceController.HudManager?.RemoveElement(_LabelHudElement);
            _LabelHudElement = null;
        }
コード例 #7
0
        //--------------------------------------------------------------------------------------------------

        public void Stop()
        {
            _PointAction.Stop();
            if (_Elements != null)
            {
                foreach (var element in _Elements)
                {
                    element.Remove();
                }
            }

            _SketchEditorTool.WorkspaceController.HudManager?.RemoveElement(_Coord2DHudElement);
            _Coord2DHudElement = null;
            _SketchEditorTool.WorkspaceController.HudManager?.RemoveElement(_LabelHudElement);
            _LabelHudElement = null;
        }
コード例 #8
0
        //--------------------------------------------------------------------------------------------------

        void _OnActionPreview(ToolAction toolAction)
        {
            if (toolAction == _PointAction)
            {
                switch (_PointsCompleted)
                {
                case 1:
                    if (_PreviewLine == null)
                    {
                        _PreviewLine = new HintCircle(_SketchEditorTool.WorkspaceController, HintStyle.ThinDashed | HintStyle.Topmost);
                    }
                    if (_HintLines[0] == null)
                    {
                        _HintLines[0] = new HintLine(_SketchEditorTool.WorkspaceController, HintStyle.ThinDashed | HintStyle.Topmost);
                    }
                    var p1   = _CenterPoint;
                    var p2   = _PointAction.Point;
                    var circ = new gce_MakeCirc2d(p1, p2).Value();
                    _PreviewLine.Set(circ, _SketchEditorTool.Sketch.Plane);
                    _HintLines[0].Set(_CenterPoint, _PointAction.Point, _SketchEditorTool.Sketch.Plane);

                    if (_LabelHudElement == null)
                    {
                        _LabelHudElement = _SketchEditorTool.WorkspaceController.HudManager?.CreateElement <LabelHudElement>(this);
                    }
                    _LabelHudElement?.SetValue("Radius: " + circ.Radius().ToRoundedString());
                    break;

                case 2:
                    if (_HintLines[1] == null)
                    {
                        _HintLines[1] = new HintLine(_SketchEditorTool.WorkspaceController, HintStyle.ThinDashed | HintStyle.Topmost);
                    }
                    _HintLines[1].Set(_CenterPoint, _PointAction.Point, _SketchEditorTool.Sketch.Plane);

                    if (_Segment != null)
                    {
                        _CalcArcRimPoints(_PointAction.Point);
                        _Element.OnPointsChanged(_Points, null);
                    }
                    break;
                }

                _Coord2DHudElement?.SetValues(_PointAction.Point.X, _PointAction.Point.Y);
            }
        }
コード例 #9
0
        //--------------------------------------------------------------------------------------------------

        void _OnActionFinished(ToolAction toolAction)
        {
            if (toolAction == _PointAction)
            {
                if (_Segment == null)
                {
                    _Points.Add(0, _PointAction.Point);
                    _MergePointIndices[0] = _PointAction.MergeCandidateIndex;
                    _Points.Add(1, _PointAction.Point);
                    _Segment = new SketchSegmentLine(0, 1);

                    _Element            = new SketchEditorSegmentElement(_SketchEditorTool, -1, _Segment, _SketchEditorTool.Transform, _SketchEditorTool.Sketch.Plane);
                    _Element.IsCreating = true;
                    _Element.OnPointsChanged(_Points, null);

                    _LabelHudElement = _SketchEditorTool.WorkspaceController.HudManager?.CreateElement <LabelHudElement>(this);
                    _LabelHudElement?.SetValue("Length: " + _Segment.Length(_Points).ToRoundedString());

                    _SketchEditorTool.StatusText = "Select end point for line.";

                    _PointAction.Reset();
                }
                else
                {
                    if (_Points[0].Distance(_PointAction.Point) < 0.001)
                    {
                        _PointAction.Reset();
                        return;
                    }

                    _Points[1]            = _PointAction.Point;
                    _MergePointIndices[1] = _PointAction.MergeCandidateIndex;

                    // Accept point
                    _PointAction.Stop();

                    _SketchEditorTool.FinishSegmentCreation(_Points, _MergePointIndices, new SketchSegment[] { _Segment }, null, _MergePointIndices[1] >= 0 ? -1 : 1);
                }
            }
        }