Revision 45673 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.api/src/main/java/org/gvsig/fmap/geom/type/GeometryType.java

View differences:

GeometryType.java
28 28
import org.gvsig.fmap.geom.operation.GeometryOperation;
29 29

  
30 30
/**
31
 * This class represents the type of a geometry. All the geometries
32
 * has to have a type that can be retrieved using the 
31
 * This class represents the type of a geometry. All the geometries has to have
32
 * a type that can be retrieved using the
33 33
 * {@link Geometry}{@link #getGeometryType()} method.
34
 * 
34
 *
35 35
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
36 36
 */
37
public interface GeometryType  {
38
	
39
	/**
40
	 * @return the name of the geometry type.
41
	 */
42
	public String getName();
43
	
44
        /**
45
         * Return the full name of this geometry type.
46
         * It include the type name and the subtype name.
47
         * 
48
         * @return the full name of the geometry type
49
         */
50
        public String getFullName();
51
	/**
52
	 * @return the type of the geometry. It is a constant value
53
	 * that has to be one of the values in {@link Geometry.TYPES}
54
	 * The type is an abstract representation of the object (Point, Curve...) 
55
	 * but it is not a concrete representation (Point2D, Point3D...). 
56
	 */
57
	public int getType();	
58
	
59
	/**
60
	 * @return the subtype of the geometry. It is a constant value
61
	 * that has to be one of the values in {@link Geometry.SUBTYPES}.
62
	 * The subtype represents a set of geometries with a 
63
	 * dimensional relationship (2D, 3D, 2DM...)
64
	 */
65
	public int getSubType();
66
	
67
	/**
68
	 * Check if a geometry type inherits of other type. E.g:
69
	 * the super type of an arc could be a a curve, the super 
70
	 * type of a circle could be a surface...
71
	 * @param geometryType
72
	 * the value of the {@link Geometry.TYPES} to check if is 
73
	 * it super type
74
	 * @return
75
	 * <true> if the the parameter is a super type of this
76
	 * geometry type
77
	 */
78
	public boolean isTypeOf(int geometryType);
79
	   
80
	/**
81
     * Check if a geometry subType inherits of other subType. E.g:
82
     * the super Subtype of a geometry 3D could be a geometry 2D, 
83
     * because the 3D extends the behavior of a geometry 2D.
84
     * @param geometrySubType
85
     * the value of the {@link Geometry.SUBTYPES} to check if is 
86
     * it super subType
87
     * @return
88
     * <true> if the the parameter is a super subType of this
89
     * geometry type
37
public interface GeometryType {
38

  
39
    /**
40
     * @return the name of the geometry type.
90 41
     */
91
	public boolean isSubTypeOf(int geometrySubType);
42
    public String getName();
92 43

  
93 44
    /**
94
     * Check if a geometry type inherits of other type. E.g:
95
     * the super type of an arc could be a a curve, the super
96
     * type of a circle could be a surface...
97
     * 
98
     * @param geometryType
99
     *            the geometry type to check if is it super type
100
     * @return
101
     *         if the the parameter is a super type of this
102
     *         geometry type
45
     * Return the full name of this geometry type. It include the type name and
46
     * the subtype name.
47
     *
48
     * @return the full name of the geometry type
103 49
     */
50
    public String getFullName();
51

  
52
    /**
53
     * @return the type of the geometry. It is a constant value that has to be
54
     * one of the values in {@link Geometry.TYPES} The type is an abstract
55
     * representation of the object (Point, Curve...) but it is not a concrete
56
     * representation (Point2D, Point3D...).
57
     */
58
    public int getType();
59

  
60
    /**
61
     * @return the subtype of the geometry. It is a constant value that has to
62
     * be one of the values in {@link Geometry.SUBTYPES}. The subtype represents
63
     * a set of geometries with a dimensional relationship (2D, 3D, 2DM...)
64
     */
65
    public int getSubType();
66

  
67
    /**
68
     * Check if a geometry type inherits of other type. E.g: the super type of
69
     * an arc could be a a curve, the super type of a circle could be a
70
     * surface...
71
     *
72
     * @param geometryType the value of the {@link Geometry.TYPES} to check if
73
     * is it super type
74
     * @return  true if the the parameter is a super type of this geometry type
75
     */
76
    public boolean isTypeOf(int geometryType);
77

  
78
    /**
79
     * Check if a geometry subType inherits of other subType. E.g: the super
80
     * Subtype of a geometry 3D could be a geometry 2D, because the 3D extends
81
     * the behavior of a geometry 2D.
82
     *
83
     * @param geometrySubType the value of the {@link Geometry.SUBTYPES} to
84
     * check if is it super subType
85
     * @return true if the the parameter is a super subType of this geometry type
86
     */
87
    public boolean isSubTypeOf(int geometrySubType);
88

  
89
    /**
90
     * Check if a geometry type inherits of other type. E.g: the super type of
91
     * an arc could be a a curve, the super type of a circle could be a
92
     * surface...
93
     *
94
     * @param geometryType the geometry type to check if is it super type
95
     * @return if the the parameter is a super type of this geometry type
96
     */
104 97
    public boolean isTypeOf(GeometryType geometryType);
105 98

  
106 99
    /**
107
     * Check if a geometry subType inherits of other subType. E.g:
108
     * the super Subtype of a geometry 3D could be a geometry 2D,
109
     * because the 3D extends the behavior of a geometry 2D.
110
     * 
111
     * @param geometryType
112
     *            the geometry type to check if is it super subtype
113
     * @return
114
     *         if the the parameter is a super subType of this
115
     *         geometry type
100
     * Check if a geometry subType inherits of other subType. E.g: the super
101
     * Subtype of a geometry 3D could be a geometry 2D, because the 3D extends
102
     * the behavior of a geometry 2D.
103
     *
104
     * @param geometryType the geometry type to check if is it super subtype
105
     * @return if the the parameter is a super subType of this geometry type
116 106
     */
117 107
    public boolean isSubTypeOf(GeometryType geometryType);
118
	
119
	/**
120
	 * This method creates a {@link Geometry} with the type specified 
121
	 * by this class. The geometry is empty, and all the internal 
122
	 * attributes must be assigned to a value when the geometry has  
123
	 * been created.
124
	 * 
125
	 * @return
126
	 * A empty geometry 
127
	 * @throws InstantiationException
128
	 * This exception is maybe thrown when  the application is  trying 
129
	 * to instantiate the geometry
130
	 * @throws IllegalAccessException
131
	 * This exception is maybe thrown when  the application is  trying 
132
	 * to instantiate the geometry
133
	 */
134
	public Geometry create() throws CreateGeometryException;
135
		
136
	/**
137
	 * Registers an operation for this geometry type. 
138
	 * @param index
139
	 * @param geomOp
140
	 */
141
	public void setGeometryOperation(int index, GeometryOperation geomOp);
142
	
143
	/**
144
	 * Get the operation for this geometry at a concrete position
145
	 * @param index
146
	 * The position of the operation
147
	 * @return
148
	 * A geometry operation
149
	 */
150
	public GeometryOperation getGeometryOperation(int index);
151
		
152
	/**
153
	 * @return the geometry as a String
154
	 */
155
	public String toString();
156
        
157
        public int getDimension();
158
        
159
        
108

  
109
    /**
110
     * This method creates a {@link Geometry} with the type specified by this
111
     * class.The geometry is empty, and all the internal attributes must be
112
     * assigned to a value when the geometry has been created.
113
     *
114
     * @return A empty geometry
115
     * @throws org.gvsig.fmap.geom.exception.CreateGeometryException
116
     */
117
    public Geometry create() throws CreateGeometryException;
118

  
119
    /**
120
     * Registers an operation for this geometry type.
121
     *
122
     * @param index
123
     * @param geomOp
124
     */
125
    public void setGeometryOperation(int index, GeometryOperation geomOp);
126

  
127
    /**
128
     * Get the operation for this geometry at a concrete position
129
     *
130
     * @param index The position of the operation
131
     * @return A geometry operation
132
     */
133
    public GeometryOperation getGeometryOperation(int index);
134

  
135
    /**
136
     * @return the geometry as a String
137
     */
138
    @Override
139
    public String toString();
140

  
141
    public int getDimension();
142

  
160 143
    public boolean hasZ();
161
    
144

  
162 145
    public boolean hasM();
163
	
146

  
147
    public Class getGeometryClass();
164 148
}

Also available in: Unified diff