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

        void _UpdateToolActive(bool isActive)
        {
            if (isActive)
            {
                if (IsToolActive == false)
                {
                    IsToolActive             = true;
                    _CurrentSketchEditorTool = (SketchEditorTool)WorkspaceController.CurrentTool;

                    _PointsPanel = CreatePanel <SketchPointsPropertyPanel>(_CurrentSketchEditorTool);
                    InteractiveContext.Current.PropertyPanelManager?.AddPanel(_PointsPanel, PropertyPanelSortingKey.Shapes + 1);
                    _SegmentsPanel = CreatePanel <SketchSegmentsPropertyPanel>(_CurrentSketchEditorTool);
                    InteractiveContext.Current.PropertyPanelManager?.AddPanel(_SegmentsPanel, _PointsPanel);
                    _ConstraintsPanel = CreatePanel <SketchConstraintsPropertyPanel>(_CurrentSketchEditorTool);
                    InteractiveContext.Current.PropertyPanelManager?.AddPanel(_ConstraintsPanel, _SegmentsPanel);
                }
            }
            else if (_CurrentSketchEditorTool != null)
            {
                IsToolActive = false;
                InteractiveContext.Current.PropertyPanelManager?.RemovePanel(_ConstraintsPanel);
                _ConstraintsPanel = null;
                InteractiveContext.Current.PropertyPanelManager?.RemovePanel(_SegmentsPanel);
                _SegmentsPanel = null;
                InteractiveContext.Current.PropertyPanelManager?.RemovePanel(_PointsPanel);
                _PointsPanel             = null;
                _CurrentSketchEditorTool = null;
            }
        }
コード例 #2
0
            //--------------------------------------------------------------------------------------------------

            public ConstraintMarker(SketchEditorTool sketchEditorTool, SketchConstraint constraint, string image)
            {
                _Constraint = constraint;

                if (_Constraint.Points != null)
                {
                    for (var index = 0; index < _Constraint.Points.Length; index++)
                    {
                        var marker = new Marker(sketchEditorTool.WorkspaceController,
                                                Marker.Styles.Image | Marker.Styles.Background | Marker.Styles.Topmost | Marker.Styles.Selectable, image);
                        marker.Tag = index;
                        marker.SetBackgroundColor(Colors.AttributeMarkerBackground);
                        _Marker.Add(marker);
                    }
                }
                else if (_Constraint.Segments != null)
                {
                    for (var index = 0; index < _Constraint.Segments.Length; index++)
                    {
                        var marker = new Marker(sketchEditorTool.WorkspaceController,
                                                Marker.Styles.Image | Marker.Styles.Background | Marker.Styles.Topmost | Marker.Styles.Selectable, image);
                        marker.Tag = index | TagIsSegment;
                        marker.SetBackgroundColor(Colors.AttributeMarkerBackground);
                        _Marker.Add(marker);
                    }
                }
            }
コード例 #3
0
        //--------------------------------------------------------------------------------------------------

        public bool Start(SketchEditorTool sketchEditorTool)
        {
            _SketchEditorTool = sketchEditorTool;

            _PointAction = new SketchPointAction(_SketchEditorTool);
            if (!_SketchEditorTool.WorkspaceController.StartToolAction(_PointAction, false))
            {
                return(false);
            }

            _PointAction.EnablePointMerge     = false;
            _PointAction.AdditionalSnapPoints = new List <Pnt2d> {
                Pnt2d.Origin
            };
            _PointAction.Previewed += _PointAction_Previewed;
            _PointAction.Finished  += _PointAction_OnFinished;

            // Re-enable elements for snapping
            _SketchEditorTool.Elements.Activate(true, false, false);

            _SketchEditorTool.StatusText = "Select new workspace center position.";
            _SketchEditorTool.WorkspaceController.HudManager?.SetCursor(Cursors.WorkingPlane);

            _OriginMarker = new Marker(_SketchEditorTool.WorkspaceController, Marker.Styles.Bitmap | Marker.Styles.Topmost | Marker.Styles.Selectable, Marker.BallImage);
            _OriginMarker.Set(_SketchEditorTool.Sketch.Plane.Location);
            _OriginMarker.SetColor(Quantity_NameOfColor.Quantity_NOC_WHITE.ToColor());

            return(true);
        }
コード例 #4
0
        public SketchEditorPointElement(SketchEditorTool sketchEditorTool, int pointIndex, Pnt2d point, Trsf transform, Pln plane)
            : base(sketchEditorTool, transform, plane)
        {
            var geomPoint = new Geom_CartesianPoint(point.X, point.Y, 0);

            geomPoint.Transform(Transform);
            _Marker = new Marker(SketchEditorTool.WorkspaceController, Marker.Styles.Bitmap | Marker.Styles.Topmost | Marker.Styles.Selectable, Marker.BallImage);
            _Marker.Set(geomPoint);

            PointIndex = pointIndex;
        }
コード例 #5
0
        //--------------------------------------------------------------------------------------------------

        public bool Start(SketchEditorTool sketchEditorTool)
        {
            _SketchEditorTool = sketchEditorTool;

            _PointAction = new SplitSketchElementAction(sketchEditorTool);
            if (!_SketchEditorTool.WorkspaceController.StartToolAction(_PointAction, false))
            {
                return(false);
            }
            _PointAction.Finished += _PointAction_Finished;

            _SketchEditorTool.StatusText = _Message;
            return(true);
        }
コード例 #6
0
        //--------------------------------------------------------------------------------------------------

        public bool Start(SketchEditorTool sketchEditorTool)
        {
            _SketchEditorTool = sketchEditorTool;

            _PointAction = new SketchPointAction(_SketchEditorTool);
            if (!_SketchEditorTool.WorkspaceController.StartToolAction(_PointAction, false))
            {
                return(false);
            }
            _PointAction.Previewed += _OnActionPreview;
            _PointAction.Finished  += _OnActionFinished;

            _Coord2DHudElement = _SketchEditorTool.WorkspaceController.HudManager?.CreateElement <Coord2DHudElement>(this);

            _SketchEditorTool.StatusText = "Select first corner of the rectangle.";

            return(true);
        }
コード例 #7
0
        //--------------------------------------------------------------------------------------------------

        internal SketchEditElements(SketchEditorTool sketchEditorTool)
        {
            _SketchEditorTool = sketchEditorTool;
        }
コード例 #8
0
        //--------------------------------------------------------------------------------------------------

        protected SketchEditorElement(SketchEditorTool sketchEditorTool, Trsf transform, Pln plane)
        {
            SketchEditorTool = sketchEditorTool;
            Transform        = transform;
            Plane            = plane;
        }
コード例 #9
0
        //--------------------------------------------------------------------------------------------------

        public SketchEditorSegmentElement(SketchEditorTool sketchEditorTool, int segmentIndex, SketchSegment segment, Trsf transform, Pln plane)
            : base(sketchEditorTool, transform, plane)
        {
            Segment      = segment;
            SegmentIndex = segmentIndex;
        }
コード例 #10
0
        //--------------------------------------------------------------------------------------------------

        public SketchEditorConstraintElement(SketchEditorTool sketchEditorTool, SketchConstraint constraint, Trsf transform, Pln plane)
            : base(sketchEditorTool, transform, plane)
        {
            Constraint = constraint;
        }