//-------------------------------------------------------------------------------------------------- public SelectSubshapeAction(object owner, SubshapeTypes subshapeTypes, InteractiveEntity sourceEntity = null, ISelectionFilter selectionFilter = null) : base(owner) { _SubshapeTypes = subshapeTypes; _SourceEntity = sourceEntity; _SelectionFilter = selectionFilter; }
//-------------------------------------------------------------------------------------------------- public void SetSubshapeSelection(SubshapeTypes enabledTypes) { if (_SubshapeTypes == enabledTypes) { return; } _SubshapeTypes = enabledTypes; _RaiseParametersChanged(); }
//-------------------------------------------------------------------------------------------------- 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); }
//-------------------------------------------------------------------------------------------------- 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; } }
//-------------------------------------------------------------------------------------------------- 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; } } }
//-------------------------------------------------------------------------------------------------- public SelectSubshapeAction(object owner, List <TopoDS_Shape> shapes) : base(owner) { _SubshapeTypes = SubshapeTypes.All; _Shapes = shapes; }