Ejemplo n.º 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);
            }
Ejemplo n.º 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);
            }
Ejemplo n.º 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);
            }
Ejemplo n.º 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);
            }
 public bool inputActionPerformed(AbstractViewInputHandler inputHandler, KeyEventState keys, String target,
                                  ViewInputAttributes.ActionAttributes viewAction)
 {
     return(false);
 }