/src/org/mt4j/input/inputProcessors/componentProcessors/dragProcessor/DragEvent.java

http://mt4j.googlecode.com/ · Java · 103 lines · 31 code · 17 blank · 55 comment · 0 complexity · cbf25eb59a8b256499d488f773fbcd1c MD5 · raw file

  1. /***********************************************************************
  2. * mt4j Copyright (c) 2008 - 2009, C.Ruff, Fraunhofer-Gesellschaft All rights reserved.
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation, either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. *
  17. ***********************************************************************/
  18. package org.mt4j.input.inputProcessors.componentProcessors.dragProcessor;
  19. import org.mt4j.components.interfaces.IMTComponent3D;
  20. import org.mt4j.input.inputData.InputCursor;
  21. import org.mt4j.input.inputProcessors.IInputProcessor;
  22. import org.mt4j.input.inputProcessors.MTGestureEvent;
  23. import org.mt4j.util.math.Vector3D;
  24. /**
  25. * The Class DragEvent.
  26. * @author Christopher Ruff
  27. */
  28. public class DragEvent extends MTGestureEvent {
  29. /** The drag cursor. */
  30. private InputCursor dragCursor;
  31. /** The from. */
  32. private Vector3D from;
  33. /** The to. */
  34. private Vector3D to;
  35. /** The translation vect. */
  36. private Vector3D translationVect;
  37. /**
  38. * Instantiates a new drag event.
  39. *
  40. * @param source the source
  41. * @param id the id
  42. * @param targetComponent the target component
  43. * @param dragCursor the drag cursor
  44. * @param from the from
  45. * @param to the to
  46. */
  47. public DragEvent(IInputProcessor source, int id, IMTComponent3D targetComponent, InputCursor dragCursor, Vector3D from, Vector3D to) {
  48. super(source, id, targetComponent);
  49. this.dragCursor = dragCursor;
  50. this.from = from;
  51. this.to = to;
  52. this.translationVect = to.getSubtracted(from);
  53. }
  54. /**
  55. * Gets the drag cursor.
  56. *
  57. * @return the drag cursor
  58. */
  59. public InputCursor getDragCursor() {
  60. return dragCursor;
  61. }
  62. /**
  63. * Gets the from.
  64. *
  65. * @return the from
  66. */
  67. public Vector3D getFrom() {
  68. return from;
  69. }
  70. /**
  71. * Gets the to.
  72. *
  73. * @return the to
  74. */
  75. public Vector3D getTo() {
  76. return to;
  77. }
  78. /**
  79. * Gets the translation vect.
  80. *
  81. * @return the translation vect
  82. */
  83. public Vector3D getTranslationVect() {
  84. return translationVect;
  85. }
  86. }