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;
21  
22  /***
23   * Defines the scope (such as an axis or a plane) that transformations acts upon.
24   *
25   * @author Fábio Roberto de Miranda, Carlos da Silva dos Santos
26   * @version 1.0
27   */
28  public class TransformScope {
29  
30    private final boolean axis;
31    private final boolean plane;
32    private final String name;
33  
34    /***
35     * Class constructor.
36     * @param name Name of scope entity.
37     * @param axis sets if scope entity is an axis.
38     * @param plane sets if scope entity is a plane.
39     */
40    private TransformScope(String name, boolean axis, boolean plane) {
41       this.name = name;
42       this.axis = axis;
43       this.plane = plane;
44    }
45  
46    /***
47     * Returns a flag indicating whether this scope is an single axis.
48     * @return true if scope is an axis, false otherwise.
49     */
50    public boolean isAxis(){
51      return this.axis;
52    }
53  
54    /***
55     * Returns a flag indicating whether this scope is a plane axis.
56     * @return true if scope is a plane, false otherwise.
57     */
58    public boolean isPlane(){
59      return this.plane;
60    }
61  
62    /***
63     * Returns the TransformScope correspondent to the input name. The valid name of
64     * one TransformScope instance is retrieved by calling the toString() method on
65     * that instance.
66     * @param name Name of desired scope.
67     * @throws IllegalArgumentException if name is not a valid name of any TransformScope.
68     */
69    public static TransformScope scopeForString(String name){
70       if (X.name.equalsIgnoreCase(name)) return X;
71       else if (Y.name.equalsIgnoreCase(name)) return Y;
72       else if (Z.name.equalsIgnoreCase(name)) return Z;
73       else if (XY.name.equalsIgnoreCase(name)) return XY;
74       else if (YZ.name.equalsIgnoreCase(name)) return YZ;
75       else if (ZX.name.equalsIgnoreCase(name)) return ZX;
76       else if (XYZ.name.equalsIgnoreCase(name)) return XYZ;
77       else throw new IllegalArgumentException("Invalid TransformMode name: "+ name);
78    }
79  
80  
81    /*** X axis. */
82    public static final TransformScope X = new TransformScope("X",true,false);
83  
84    /*** Y axis. */
85    public static final TransformScope Y = new TransformScope("Y",true,false);
86  
87    /*** Z axis. */
88    public static final TransformScope Z = new TransformScope("Z",true,false);
89  
90    /*** XY plane. */
91    public static final TransformScope XY = new TransformScope("XY",false,true);
92  
93    /*** YZ plane. */
94    public static final TransformScope YZ = new TransformScope("YZ",false,true);
95  
96    /*** ZX plane. */
97    public static final TransformScope ZX = new TransformScope("ZX",false,true);
98  
99    /*** Specifies a transform that affects X, Y and Z axii simultaneously. */
100   public static final TransformScope XYZ = new TransformScope("XYZ",false,false);
101 
102   /***
103    * Returns a String describing this TransformScope.
104    */
105   public String toString(){
106     return this.name;
107   }
108 
109 }
This page was automatically generated by Maven