View Javadoc
1 /***************************************************************************** 2 * Virtual Mockup for Machine Vision 3 * Copyright (C) 2001-2003 Fabio R. de Miranda, João E. Kogler Jr., 4 * Carlos S. Santos. 5 * Virtual Mockup for Machine Vision Project funded by SENAC-SP 6 * 7 * Permission is granted to redistribute and/or modify this 8 * software under the terms of the GNU Lesser General Public 9 * License as published by the Free Software Foundation; either 10 * version 2.1 of the License, or (at your option) any later version. 11 * 12 * This software is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * Lesser General Public License (http://www.gnu.org/copyleft/lesser.html) 16 * for more details. 17 * 18 *****************************************************************************/ 19 20 package camera3d.manipulation; 21 22 23 import java.util.Vector; 24 import javax.vecmath.*; 25 import javax.media.j3d.Canvas3D; 26 import camera3d.TransformMode; 27 import camera3d.TransformScope; 28 29 /*** 30 * Abstract superclass for mouse manipulators that change the transformation of scene objects.<BR> 31 * 32 * @author Fábio Roberto de Miranda, Carlos da Silva dos Santos 33 * @version 1.0 34 */ 35 public abstract class TransformationManipulator { 36 37 boolean debugflag = false; 38 39 Canvas3D canvas3d; 40 41 TransformScope scope = TransformScope.X; 42 /*** Mode (absolute or relative) of transformation. */ 43 TransformMode mode = TransformMode.ABSOLUTE; 44 45 public TransformationManipulator() { 46 47 } 48 49 50 /*** 51 * Sets the location at which manipulation started. 52 * @param x x coordinate of initial mouse click. 53 * @param y y coordinate of initial mouse click. 54 */ 55 public void setBeginPoint(int x, int y){ 56 //this.beginX = x; 57 //this.beginY = y; 58 } 59 60 61 /*** 62 * Sets value of the axis or set of axii affected by current manipulation. 63 * @see camera3d.TransformScope 64 */ 65 public void setTransformationScope(TransformScope scope){ 66 this.scope = scope; 67 debugln("Manip "+scope.toString()); 68 } 69 70 /*** 71 * Returns value of the axis or set of axii affected by current manipulation. 72 * @see camera3d.TransformScope 73 */ 74 public TransformScope getSelectedScope(){ 75 return this.scope; 76 } 77 78 /*** 79 * Sets mode of current manipulation. 80 * @see camera3d.TransformMode 81 */ 82 public void setTransformationMode(TransformMode mode){ 83 this.mode = mode; 84 } 85 86 /*** 87 * Sets current location of mouse cursor. The transformation of the selected 88 * object(s) will then be updated accordingly. 89 * @param x x coordinate of initial mouse click. 90 * @param y y coordinate of initial mouse click. 91 */ 92 public void setCurrentPoint(int x, int y){ 93 transform(x,y); 94 } 95 96 /*** 97 * Sets the Canvas3D from which manipulation is performed. 98 */ 99 public void setCanvas3D(Canvas3D canvas){ 100 this.canvas3d = canvas; 101 } 102 103 /*** 104 * Applies transformation to selected object(s). 105 */ 106 abstract void transform(int x, int y); 107 108 /*** 109 * Clears current selection of scene object(s) to be manipulated. 110 */ 111 abstract public void clearSelection(); 112 113 /*** 114 * Used to print debug messages. 115 */ 116 void debugln(String s){ 117 if (this.debugflag) 118 System.out.println(s); 119 } 120 121 }

This page was automatically generated by Maven