Statistics
| Revision:

svn-gvsig-desktop / 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 @ 42756

History | View | Annotate | Download (5.13 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 3
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.fmap.geom.type;
25

    
26
import org.gvsig.fmap.geom.Geometry;
27
import org.gvsig.fmap.geom.exception.CreateGeometryException;
28
import org.gvsig.fmap.geom.operation.GeometryOperation;
29

    
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 
33
 * {@link Geometry}{@link #getGeometryType()} method.
34
 * 
35
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
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
90
     */
91
        public boolean isSubTypeOf(int geometrySubType);
92

    
93
    /**
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
103
     */
104
    public boolean isTypeOf(GeometryType geometryType);
105

    
106
    /**
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
116
     */
117
    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
}