public void CreatePanCommand_PanAngleGreaterThanMax_ThrowsArgumentException()
        {
            string rawCommand = "<P1201>";

            Assert.Throws <System.ArgumentException>(
                delegate
            {
                PanCommand command = new PanCommand(rawCommand);
            }
                );
        }
        public void CreatePanCommand_ValidInputString_InitializesProperly()
        {
            string rawCommand     = "<P1000>";
            int    actualCamIndex = 1;
            int    actualPanAngle = 0;

            PanCommand command = new PanCommand(rawCommand);

            Assert.AreEqual(command.CameraIndex, actualCamIndex);
            Assert.AreEqual(command.Angle, actualPanAngle);
        }
Example #3
0
        private void OnMouseMove(object sender, MouseEventArgs e)
        {
            // Start panning only if the mouse button was already pushed but the panning has not started yet.
            if (_isPreparedForPanning && !_isPanning)
            {
                StartPanning();
            }

            var position = e.GetPosition(AssociatedObject);

            if (_isPanning && _lastMousePosition != position)
            {
                var panVector = position - _lastMousePosition;
                PanCommand?.Execute(panVector);
            }

            _lastMousePosition = position;
        }
Example #4
0
        public DisplayInteractionManager(IWorkspace workspace, ProjectionStyle uiProjectionStyle)
        {
            _workspace          = workspace;
            UIProjectionStyle   = uiProjectionStyle;
            rubberBandGenerator = _workspace.RubberBandGenerator;
            panCommand          = (PanCommand)_workspace.GetCommand("View.Pan").Item1;

            _workspace.WorkspaceChanged                   += Workspace_WorkspaceChanged;
            _workspace.CommandExecuted                    += Workspace_CommandExecuted;
            _workspace.RubberBandGeneratorChanged         += Workspace_RubberBandGeneratorChanged;
            _workspace.SelectedEntities.CollectionChanged += SelectedEntities_CollectionChanged;
            _workspace.InputService.ValueRequested        += InputService_ValueRequested;
            _workspace.InputService.ValueReceived         += InputService_ValueReceived;
            _workspace.InputService.InputCanceled         += InputService_InputCanceled;
            _workspace.Update(viewControl: this, isDirty: _workspace.IsDirty);

            SetCursorVisibility();
        }
Example #5
0
 protected void Pan(Vector vector)
 {
     PanCommand?.Execute(vector);
 }
        public void CreatePanCommand_ValidInputString_InitializesProperly()
        {
            string rawCommand = "<P1000>";
            int actualCamIndex = 1;
            int actualPanAngle = 0;

            PanCommand command = new PanCommand(rawCommand);
            Assert.AreEqual(command.CameraIndex, actualCamIndex);
            Assert.AreEqual(command.Angle, actualPanAngle);
        }
 public void CreatePanCommand_PanAngleGreaterThanMax_ThrowsArgumentException()
 {
     string rawCommand = "<P1201>";
     Assert.Throws<System.ArgumentException>(
         delegate
         {
             PanCommand command = new PanCommand(rawCommand);
         }
     );
 }
 private void SerializeIf(PanCommand cmd)
 {
     sb.AppendFormat("pan_if {0}\n", cmd.Pan);
 }