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

        public SelectSubshapeAction(object owner, SubshapeTypes subshapeTypes, InteractiveEntity sourceEntity = null, ISelectionFilter selectionFilter = null)
            : base(owner)
        {
            _SubshapeTypes   = subshapeTypes;
            _SourceEntity    = sourceEntity;
            _SelectionFilter = selectionFilter;
        }
コード例 #2
0
ファイル: SelectionContext.cs プロジェクト: lanicon/Macad3D
        //--------------------------------------------------------------------------------------------------

        public void SetSubshapeSelection(SubshapeTypes enabledTypes)
        {
            if (_SubshapeTypes == enabledTypes)
            {
                return;
            }

            _SubshapeTypes = enabledTypes;
            _RaiseParametersChanged();
        }
コード例 #3
0
        //--------------------------------------------------------------------------------------------------

        public static int Count(this SubshapeTypes types)
        {
            int count = 0;

            if ((types & SubshapeTypes.Vertex) != 0)
            {
                count++;
            }
            if ((types & SubshapeTypes.Edge) != 0)
            {
                count++;
            }
            if ((types & SubshapeTypes.Wire) != 0)
            {
                count++;
            }
            if ((types & SubshapeTypes.Face) != 0)
            {
                count++;
            }
            return(count);
        }
コード例 #4
0
        //--------------------------------------------------------------------------------------------------

        void ProcessMouseInput(MouseEventData data)
        {
            SelectedEntity = data.DetectedEntities.FirstOrDefault();

            if (data.DetectedShapes.Count == 0)
            {
                SelectedSubshape     = null;
                SelectedSubshapeType = SubshapeTypes.None;
                return;
            }

            var detectedShape = data.DetectedShapes[0];

            if (_SubshapeTypes.HasFlag(SubshapeTypes.Vertex) &&
                (detectedShape.ShapeType() == TopAbs_ShapeEnum.TopAbs_VERTEX))
            {
                SelectedSubshape     = detectedShape;
                SelectedSubshapeType = SubshapeTypes.Vertex;
            }
            else if (_SubshapeTypes.HasFlag(SubshapeTypes.Edge) &&
                     (detectedShape.ShapeType() == TopAbs_ShapeEnum.TopAbs_EDGE))
            {
                SelectedSubshape     = detectedShape;
                SelectedSubshapeType = SubshapeTypes.Edge;
            }
            else if (_SubshapeTypes.HasFlag(SubshapeTypes.Wire) &&
                     (detectedShape.ShapeType() == TopAbs_ShapeEnum.TopAbs_WIRE))
            {
                SelectedSubshape     = detectedShape;
                SelectedSubshapeType = SubshapeTypes.Wire;
            }
            else if (_SubshapeTypes.HasFlag(SubshapeTypes.Face) &&
                     (detectedShape.ShapeType() == TopAbs_ShapeEnum.TopAbs_FACE))
            {
                SelectedSubshape     = detectedShape;
                SelectedSubshapeType = SubshapeTypes.Face;
            }
        }
コード例 #5
0
        //--------------------------------------------------------------------------------------------------

        void ProcessMouseInput(MouseEventData data)
        {
            if (data.DetectedShapes.Count == 0)
            {
                SelectedSubshape     = null;
                SelectedSubshapeType = SubshapeTypes.None;
                return;
            }

            foreach (var detectedShape in data.DetectedShapes)
            {
                if (_SubshapeTypes.HasFlag(SubshapeTypes.Vertex) &&
                    (detectedShape.ShapeType() == TopAbs_ShapeEnum.TopAbs_VERTEX))
                {
                    SelectedSubshape     = detectedShape;
                    SelectedSubshapeType = SubshapeTypes.Vertex;
                }
                else if (_SubshapeTypes.HasFlag(SubshapeTypes.Edge) &&
                         (detectedShape.ShapeType() == TopAbs_ShapeEnum.TopAbs_EDGE))
                {
                    SelectedSubshape     = detectedShape;
                    SelectedSubshapeType = SubshapeTypes.Edge;
                }
                else if (_SubshapeTypes.HasFlag(SubshapeTypes.Wire) &&
                         (detectedShape.ShapeType() == TopAbs_ShapeEnum.TopAbs_WIRE))
                {
                    SelectedSubshape     = detectedShape;
                    SelectedSubshapeType = SubshapeTypes.Wire;
                }
                else if (_SubshapeTypes.HasFlag(SubshapeTypes.Face) &&
                         (detectedShape.ShapeType() == TopAbs_ShapeEnum.TopAbs_FACE))
                {
                    SelectedSubshape     = detectedShape;
                    SelectedSubshapeType = SubshapeTypes.Face;
                }
            }
        }
コード例 #6
0
        //--------------------------------------------------------------------------------------------------

        public SelectSubshapeAction(object owner, List <TopoDS_Shape> shapes)
            : base(owner)
        {
            _SubshapeTypes = SubshapeTypes.All;
            _Shapes        = shapes;
        }