Esempio n. 1
0
        public void SwitchActionType(ActionType actionType, object sender)
        {
            // There is no point to change the action with itself
            if (_currentAction == Update2DModifier.CreateModifier(actionType))
            {
                return;
            }

            // The EditDetectionPipe is enabled only when the action is Action2d_Nothing
            if ((actionType != ActionType.Action2d_Nothing) && (actionType != ActionType.Action2d_EditShape))
            {
                _editDetectionPipe.OnNotification(PipeConstants.DisableDetectionPipe);
            }
            else
            {
                _editDetectionPipe.OnNotification(PipeConstants.EnableDetectionPipe);
            }

            log.DebugFormat("Switching action to {0}", actionType);
            if (_currentAction != null)
            {
                _currentAction.OnDeactivate();
            }
            _currentAction = Update2DModifier.CreateModifier(actionType);

            _currentAction.Setup(inputFactory);
            _currentAction.OnActivate();
        }
Esempio n. 2
0
 void InitializeActions()
 {
     Update2DModifier.RegisterAction(ActionType.Action2d_DrawCircle, new DrawCircle());
     Update2DModifier.RegisterAction(ActionType.Action2d_DrawLine, new DrawLine());
     Update2DModifier.RegisterAction(ActionType.Action2d_DrawRectangle, new DrawRectangle());
     Update2DModifier.RegisterAction(ActionType.Action2d_DynamicPanning, new DynamicPanning());
     Update2DModifier.RegisterAction(ActionType.Action2d_DynamicZooming, new DynamicZooming());
     Update2DModifier.RegisterAction(ActionType.Action2d_Nothing, new Nothing());
     Update2DModifier.RegisterAction(ActionType.Action2d_WindowZooming, new WindowZooming());
     Update2DModifier.RegisterAction(ActionType.Action2d_FitAll, new FitAll());
     Update2DModifier.RegisterAction(ActionType.Action2d_DeactivateGrid, new DeactivateGrid());
     Update2DModifier.RegisterAction(ActionType.Action2d_GridLinesHandler, new GridLinesHandler());
     Update2DModifier.RegisterAction(ActionType.Action2d_GridPointsHandler, new GridPointsHandler());
     Update2DModifier.RegisterAction(ActionType.Action2d_CircularGridHandler, new CircularGridHandler());
     Update2DModifier.RegisterAction(ActionType.Action2d_CircularGridPointsHandler, new CircularGridPointsHandler());
     Update2DModifier.RegisterAction(ActionType.Action2d_GlobalPanning, new GlobalPanning());
     Update2DModifier.RegisterAction(ActionType.Action2d_EditShape, new EditAction());
 }