Example #1
0
            public bool inputActionPerformed(AbstractViewInputHandler inputHandler, KeyEventState keys, String target,
                                             ViewInputAttributes.ActionAttributes viewAction)
            {
                double transInput = 0;

                java.util.List keyList = viewAction.getKeyActions();
                foreach (Object k in keyList)
                {
                    ViewInputAttributes.ActionAttributes.KeyAction keyAction =
                        (ViewInputAttributes.ActionAttributes.KeyAction)k;

                    if (keys.isKeyDown(keyAction.keyCode))
                    {
                        transInput += keyAction.sign;
                    }
                }

                if (transInput == 0)
                {
                    return(false);
                }

                //noinspection StringEquality
                if (target == GENERATE_EVENTS)
                {
                    ViewInputAttributes.DeviceAttributes deviceAttributes =
                        getAttributes().getDeviceAttributes(ViewInputAttributes.DEVICE_KEYBOARD);

                    onVerticalTranslate(transInput, transInput, deviceAttributes, viewAction);
                }

                return(true);
            }
Example #2
0
            public bool inputActionPerformed(KeyEventState keys, String target,
                                             ViewInputAttributes.ActionAttributes viewAction)
            {
                bool handleThisEvent = false;

                java.util.List buttonList = viewAction.getMouseActions();
                foreach (Object b in buttonList)
                {
                    ViewInputAttributes.ActionAttributes.MouseAction buttonAction =
                        (ViewInputAttributes.ActionAttributes.MouseAction)b;
                    if ((keys.getMouseModifiersEx() & buttonAction.mouseButton) != 0)
                    {
                        handleThisEvent = true;
                    }
                }
                if (!handleThisEvent)
                {
                    return(false);
                }

                Point point          = constrainToSourceBounds(getMousePoint(), getWorldWindow());
                Point lastPoint      = constrainToSourceBounds(getLastMousePoint(), getWorldWindow());
                Point mouseDownPoint = constrainToSourceBounds(getMouseDownPoint(), getWorldWindow());

                if (point == null || lastPoint == null)
                {
                    return(false);
                }

                Point movement          = ViewUtil.subtract(point, lastPoint);
                int   headingInput      = movement.x;
                int   pitchInput        = movement.y;
                Point totalMovement     = ViewUtil.subtract(point, mouseDownPoint);
                int   totalHeadingInput = totalMovement.x;
                int   totalPitchInput   = totalMovement.y;

                ViewInputAttributes.DeviceAttributes deviceAttributes =
                    getAttributes().getDeviceAttributes(ViewInputAttributes.DEVICE_MOUSE);

                onRotateView(headingInput, pitchInput, totalHeadingInput, totalPitchInput,
                             deviceAttributes, viewAction);
                return(true);
            }
Example #3
0
            public bool inputActionPerformed(AbstractViewInputHandler inputHandler, KeyEventState keys, String target,
                                             ViewInputAttributes.ActionAttributes viewAction)
            {
                double forwardInput = 0;
                double sideInput    = 0;

                java.util.List keyList = viewAction.getKeyActions();
                foreach (Object k in keyList)
                {
                    ViewInputAttributes.ActionAttributes.KeyAction keyAction =
                        (ViewInputAttributes.ActionAttributes.KeyAction)k;
                    if (keys.isKeyDown(keyAction.keyCode))
                    {
                        if (keyAction.direction == ViewInputAttributes.ActionAttributes.KeyAction.KA_DIR_X)
                        {
                            sideInput += keyAction.sign;
                        }
                        else
                        {
                            forwardInput += keyAction.sign;
                        }
                    }
                }

                if (forwardInput == 0 && sideInput == 0)
                {
                    return(false);
                }


                //noinspection StringEquality
                if (target == GENERATE_EVENTS)
                {
                    onHorizontalTranslateRel(forwardInput, sideInput, forwardInput, sideInput,
                                             getAttributes().getDeviceAttributes(ViewInputAttributes.DEVICE_KEYBOARD), viewAction);
                }

                return(true);
            }
Example #4
0
            public bool inputActionPerformed(AbstractViewInputHandler inputHandler, KeyEventState keys, String target,
                                             ViewInputAttributes.ActionAttributes viewAction)
            {
                java.util.List keyList      = viewAction.getKeyActions();
                double         headingInput = 0;
                double         pitchInput   = 0;

                foreach (Object k in keyList)
                {
                    ViewInputAttributes.ActionAttributes.KeyAction keyAction =
                        (ViewInputAttributes.ActionAttributes.KeyAction)k;
                    if (keys.isKeyDown(keyAction.keyCode))
                    {
                        if (keyAction.direction == ViewInputAttributes.ActionAttributes.KeyAction.KA_DIR_X)
                        {
                            headingInput += keyAction.sign;
                        }
                        else
                        {
                            pitchInput += keyAction.sign;
                        }
                    }
                }

                if (headingInput == 0 && pitchInput == 0)
                {
                    return(false);
                }

                //noinspection StringEquality
                if (target == GENERATE_EVENTS)
                {
                    ViewInputAttributes.DeviceAttributes deviceAttributes =
                        inputHandler.getAttributes().getDeviceAttributes(ViewInputAttributes.DEVICE_KEYBOARD);

                    onRotateView(headingInput, pitchInput, headingInput, pitchInput, deviceAttributes, viewAction);
                }
                return(true);
            }
Example #5
0
 protected abstract void onResetHeadingPitchRoll(ViewInputAttributes.ActionAttributes actionAttribs);
Example #6
0
 protected abstract void onRotateView(double headingInput, double pitchInput,
                                      double totalHeadingInput, double totalPitchInput,
                                      ViewInputAttributes.DeviceAttributes deviceAttributes,
                                      ViewInputAttributes.ActionAttributes actionAttributes);
Example #7
0
 protected abstract void onVerticalTranslate(double translateChange, double totalTranslateChange,
                                             ViewInputAttributes.DeviceAttributes deviceAttributes,
                                             ViewInputAttributes.ActionAttributes actionAttributes);
Example #8
0
 protected abstract void onHorizontalTranslateRel(double forwardInput, double sideInput,
                                                  double sideInputFromMouseDown, double forwardInputFromMouseDown,
                                                  ViewInputAttributes.DeviceAttributes deviceAttributes,
                                                  ViewInputAttributes.ActionAttributes actionAttributes);
Example #9
0
 protected abstract void onMoveTo(Position focalPosition,
                                  ViewInputAttributes.DeviceAttributes deviceAttributes,
                                  ViewInputAttributes.ActionAttributes actionAttribs);
 public bool inputActionPerformed(AbstractViewInputHandler inputHandler, KeyEventState keys, String target,
                                  ViewInputAttributes.ActionAttributes viewAction)
 {
     return(false);
 }