Statistics
| Revision:

root / branches / v2_0_0_prep / libraries / libFMap_geometries / src / org / gvsig / fmap / geom / type / GeometryType.java @ 38596

History | View | Annotate | Download (3.92 KB)

1
package org.gvsig.fmap.geom.type;
2

    
3
import org.gvsig.fmap.geom.Geometry;
4
import org.gvsig.fmap.geom.exception.CreateGeometryException;
5
import org.gvsig.fmap.geom.operation.GeometryOperation;
6

    
7
/**
8
 * This class represents the type of a geometry. All the geometries
9
 * has to have a type that can be retrieved using the 
10
 * {@link Geometry}{@link #getGeometryType()} method.
11
 * 
12
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
13
 */
14
public interface GeometryType {
15
        
16
        /**
17
         * @return the name of the geometry type.
18
         */
19
        public String getName();
20
        
21
        /**
22
         * @return the type of the geometry. It is a constant value
23
         * that has to be one of the values in {@link Geometry.TYPES}
24
         * The type is an abstract representation of the object (Point, Curve...) 
25
         * but it is not a concrete representation (Point2D, Point3D...). 
26
         */
27
        public int getType();        
28
        
29
        /**
30
         * @return the subtype of the geometry. It is a constant value
31
         * that has to be one of the values in {@link Geometry.SUBTYPES}.
32
         * The subtype represents a set of geometries with a 
33
         * dimensional relationship (2D, 3D, 2DM...)
34
         */
35
        public int getSubType();
36
        
37
        /**
38
         * Check if a geometry type inherits of other type. E.g:
39
         * the super type of an arc could be a a curve, the super 
40
         * type of a circle could be a surface...
41
         * @param geometryType
42
         * the value of the {@link Geometry.TYPES} to check if is 
43
         * it super type
44
         * @return
45
         * <true> if the the parameter is a super type of this
46
         * geometry type
47
         */
48
        public boolean isTypeOf(int geometryType);
49
           
50
        /**
51
     * Check if a geometry subType inherits of other subType. E.g:
52
     * the super Subtype of a geometry 3D could be a geometry 2D, 
53
     * because the 3D extends the behavior of a geometry 2D.
54
     * @param geometrySubType
55
     * the value of the {@link Geometry.SUBTYPES} to check if is 
56
     * it super subType
57
     * @return
58
     * <true> if the the parameter is a super subType of this
59
     * geometry type
60
     */
61
        public boolean isSubTypeOf(int geometrySubType);
62

    
63
    /**
64
     * Check if a geometry type inherits of other type. E.g:
65
     * the super type of an arc could be a a curve, the super
66
     * type of a circle could be a surface...
67
     * 
68
     * @param geometryType
69
     *            the geometry type to check if is it super type
70
     * @return
71
     *         if the the parameter is a super type of this
72
     *         geometry type
73
     */
74
    public boolean isTypeOf(GeometryType geometryType);
75

    
76
    /**
77
     * Check if a geometry subType inherits of other subType. E.g:
78
     * the super Subtype of a geometry 3D could be a geometry 2D,
79
     * because the 3D extends the behavior of a geometry 2D.
80
     * 
81
     * @param geometryType
82
     *            the geometry type to check if is it super subtype
83
     * @return
84
     *         if the the parameter is a super subType of this
85
     *         geometry type
86
     */
87
    public boolean isSubTypeOf(GeometryType geometryType);
88
        
89
        /**
90
         * This method creates a {@link Geometry} with the type specified 
91
         * by this class. The geometry is empty, and all the internal 
92
         * attributes must be assigned to a value when the geometry has  
93
         * been created.
94
         * 
95
         * @return
96
         * A empty geometry 
97
         * @throws InstantiationException
98
         * This exception is maybe thrown when  the application is  trying 
99
         * to instantiate the geometry
100
         * @throws IllegalAccessException
101
         * This exception is maybe thrown when  the application is  trying 
102
         * to instantiate the geometry
103
         */
104
        public Geometry create() throws CreateGeometryException;
105
                
106
        /**
107
         * Registers an operation for this geometry type. 
108
         * @param index
109
         * @param geomOp
110
         */
111
        public void setGeometryOperation(int index, GeometryOperation geomOp);
112
        
113
        /**
114
         * Get the operation for this geometry at a concrete position
115
         * @param index
116
         * The position of the operation
117
         * @return
118
         * A geometry operation
119
         */
120
        public GeometryOperation getGeometryOperation(int index);
121
                
122
        /**
123
         * @return the geometry as a String
124
         */
125
        public String toString();
126
        
127
}