Ejemplo n.º 1
0
        //--------------------------------------------------------------------------------------------------

        public override void Remove()
        {
            if (_Marker == null)
            {
                return;
            }

            foreach (var visualObj in _Marker.VisualObjects)
            {
                visualObj.Remove();
            }

            _Marker = null;
        }
Ejemplo n.º 2
0
        //--------------------------------------------------------------------------------------------------

        public override void OnPointsChanged(Dictionary <int, Pnt2d> points, Dictionary <int, SketchSegment> segments, Dictionary <int, int> markerCounts = default)
        {
            if (_Marker == null)
            {
                _Marker = _CreateMarker();
                foreach (var visualobj in _Marker.VisualObjects)
                {
                    visualobj.IsSelectable = _IsSelectable;
                }
                _Marker?.UpdateVisual(points, segments, Plane, SketchEditorTool.WorkspaceController.ActiveViewport.PixelSize, markerCounts);
                UpdateVisual();
            }
            else
            {
                _Marker?.UpdateVisual(points, segments, Plane, SketchEditorTool.WorkspaceController.ActiveViewport.PixelSize, markerCounts);
            }
        }
Ejemplo n.º 3
0
        ConstraintMarker _CreateMarker()
        {
            ConstraintMarker marker = null;

            bool swapOrientation = false;

            if (InteractiveContext.Current?.WorkspaceController?.LockWorkingPlane ?? false)
            {
                swapOrientation = ((int)((InteractiveContext.Current?.WorkspaceController?.ActiveViewport?.Twist ?? 0.0 + 45.0) / 90.0) & 0x01) == 1;
            }

            switch (Constraint)
            {
            case SketchConstraintRadius _:
                marker = new ConstraintMarker(SketchEditorTool, Constraint, "Marker_SketchConstraintCircleRadius");
                break;

            case SketchConstraintConcentric _:
                marker = new ConstraintMarker(SketchEditorTool, Constraint, "Marker_SketchConstraintConcentric");
                break;

            case SketchConstraintAngle _:
                marker = new ConstraintMarker(SketchEditorTool, Constraint, "Marker_SketchConstraintAngle");
                break;

            case SketchConstraintEqual _:
                marker = new ConstraintMarker(SketchEditorTool, Constraint, "Marker_SketchConstraintEqual");
                break;

            case SketchConstraintFixed _:
                marker = new ConstraintMarker(SketchEditorTool, Constraint, "Marker_SketchConstraintFixed");
                break;

            case SketchConstraintHorizontal _:
                marker = new ConstraintMarker(SketchEditorTool, Constraint, swapOrientation ? "Marker_SketchConstraintVertical" : "Marker_SketchConstraintHorizontal");
                break;

            case SketchConstraintHorizontalDistance _:
                marker = new ConstraintMarker(SketchEditorTool, Constraint, swapOrientation ?  "Marker_SketchConstraintVerticalDistance" : "Marker_SketchConstraintHorizontalDistance");
                break;

            case SketchConstraintLength _:
                marker = new ConstraintMarker(SketchEditorTool, Constraint, "Marker_SketchConstraintLineLength");
                break;

            case SketchConstraintParallel _:
                marker = new ConstraintMarker(SketchEditorTool, Constraint, "Marker_SketchConstraintParallel");
                break;

            case SketchConstraintPerpendicular _:
                marker = new ConstraintMarker(SketchEditorTool, Constraint, "Marker_SketchConstraintPerpendicular");
                break;

            case SketchConstraintPointOnSegment _:
                marker = new ConstraintMarker(SketchEditorTool, Constraint, "Marker_SketchConstraintPointOnSegment");
                break;

            case SketchConstraintPointOnMidpoint _:
                marker = new ConstraintMarker(SketchEditorTool, Constraint, "Marker_SketchConstraintPointOnMidpoint");
                break;

            case SketchConstraintVertical _:
                marker = new ConstraintMarker(SketchEditorTool, Constraint, swapOrientation ? "Marker_SketchConstraintHorizontal" : "Marker_SketchConstraintVertical");
                break;

            case SketchConstraintVerticalDistance _:
                marker = new ConstraintMarker(SketchEditorTool, Constraint, swapOrientation ? "Marker_SketchConstraintHorizontalDistance" : "Marker_SketchConstraintVerticalDistance");
                break;

            case SketchConstraintTangent _:
                marker = new ConstraintMarker(SketchEditorTool, Constraint, "Marker_SketchConstraintTangent");
                break;

            case SketchConstraintSmoothCorner _:
                marker = new ConstraintMarker(SketchEditorTool, Constraint, "Marker_SketchConstraintSmoothCorner");
                break;
            }

            return(marker);
        }