Beispiel #1
0
        //--------------------------------------------------------------------------------------------------

        public void UpdateShape(VisualShape visualShape, bool activate)
        {
            var aisContext = _WorkspaceController?.Workspace?.AisContext;

            if (aisContext == null)
            {
                return;
            }

            var aisObject = visualShape.AisObject;

            if (visualShape.IsSelectable())
            {
                // Get already activated modes
                var colActivatedModes = new TColStd_ListOfInteger();
                aisContext.ActivatedModes(aisObject, colActivatedModes);
                var activatedModes = colActivatedModes.ToList();

                // Enlist all requested modes
                var modesToBeActivated = new bool[5];
                var snapHandler        = _WorkspaceController.SnapHandler;

                modesToBeActivated[0] = activate && _SubshapeTypes == SubshapeTypes.None;
                modesToBeActivated[SubshapeType.Vertex.ToAisSelectionMode()] = activate && _SubshapeTypes.HasFlag(SubshapeTypes.Vertex) || snapHandler.NeedActiveSubshapes(SubshapeType.Vertex);
                modesToBeActivated[SubshapeType.Edge.ToAisSelectionMode()]   = activate && _SubshapeTypes.HasFlag(SubshapeTypes.Edge) || snapHandler.NeedActiveSubshapes(SubshapeType.Edge);
                modesToBeActivated[SubshapeType.Wire.ToAisSelectionMode()]   = activate && _SubshapeTypes.HasFlag(SubshapeTypes.Wire) || snapHandler.NeedActiveSubshapes(SubshapeType.Wire);
                modesToBeActivated[SubshapeType.Face.ToAisSelectionMode()]   = activate && _SubshapeTypes.HasFlag(SubshapeTypes.Face) || snapHandler.NeedActiveSubshapes(SubshapeType.Face);

                // Deactivate all modes which are not requested
                foreach (var mode in activatedModes)
                {
                    if (!modesToBeActivated[mode])
                    {
                        aisContext.SetSelectionModeActive(aisObject, mode, false, AIS_SelectionModesConcurrency.AIS_SelectionModesConcurrency_Multiple);
                    }
                }

                // Activate all requested modes
                for (int mode = 0; mode < 5; mode++)
                {
                    if (modesToBeActivated[mode])
                    {
                        aisContext.SetSelectionModeActive(aisObject, mode, true, AIS_SelectionModesConcurrency.AIS_SelectionModesConcurrency_Multiple);
                    }
                }
            }
            else
            {
                aisContext.Deactivate(visualShape.AisObject);
            }
        }
        //--------------------------------------------------------------------------------------------------

        void _UpdateSelectionSensitivity()
        {
            // Check if shape is activated
            var modes = new TColStd_ListOfInteger();

            AisContext.ActivatedModes(_AisShape, modes);
            var modeList = modes.ToList();

            if (!modeList.Contains(0))
            {
                return;
            }

            if ((_ShapeSource as Body)?.Shape.ShapeType == ShapeType.Sketch)
            {
                var paramSet = InteractiveContext.Current.Parameters.Get <ViewportParameterSet>();
                AisContext.SetSelectionSensitivity(_AisShape, 0, (int)(paramSet.SketchSelectionSensitivity * 10.0));
            }
            else
            {
                AisContext.SetSelectionSensitivity(_AisShape, 0, 2);
            }
        }
Beispiel #3
0
 public void SharedEdges(int theF1, int theF2, TColStd_ListOfInteger theLI,
                         NCollection_BaseAllocator theAllocator)
 {
     throw new NotImplementedException();
 }
Beispiel #4
0
 public void AloneVertices(int theF, TColStd_ListOfInteger theLI)
 {
     throw new NotImplementedException();
 }
Beispiel #5
0
 public void ActivatedModes(AIS_InteractiveObject anIobj, TColStd_ListOfInteger theL_ist)
 {
     throw new NotImplementedException();
 }
 public bool Modes(SelectMgr_SelectableObject theSelectableObject, TColStd_ListOfInteger theModeL_ist)
 {
     throw new NotImplementedException();
 }
 public void ListOfSignature(AIS_KindOfInteractive aType, TColStd_ListOfInteger TheStoredL_ist)
 {
     throw new NotImplementedException();
 }
 public void ListOfStoredTypes(TColStd_ListOfInteger TheL_ist)
 {
     throw new NotImplementedException();
 }
 public void SetSubSet2(TColStd_ListOfInteger theLI)
 {
     throw new NotImplementedException();
 }
 public void ToBeUpdated(TColStd_ListOfInteger L_istOfMode)
 {
     throw new NotImplementedException();
 }
Beispiel #11
0
 public void AppendFaces(TColStd_ListOfInteger aLF)
 {
     throw new NotImplementedException();
 }