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 @ 40559

History | View | Annotate | Download (4.86 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 type of the geometry. It is a constant value
46
         * that has to be one of the values in {@link Geometry.TYPES}
47
         * The type is an abstract representation of the object (Point, Curve...) 
48
         * but it is not a concrete representation (Point2D, Point3D...). 
49
         */
50
        public int getType();        
51
        
52
        /**
53
         * @return the subtype of the geometry. It is a constant value
54
         * that has to be one of the values in {@link Geometry.SUBTYPES}.
55
         * The subtype represents a set of geometries with a 
56
         * dimensional relationship (2D, 3D, 2DM...)
57
         */
58
        public int getSubType();
59
        
60
        /**
61
         * Check if a geometry type inherits of other type. E.g:
62
         * the super type of an arc could be a a curve, the super 
63
         * type of a circle could be a surface...
64
         * @param geometryType
65
         * the value of the {@link Geometry.TYPES} to check if is 
66
         * it super type
67
         * @return
68
         * <true> if the the parameter is a super type of this
69
         * geometry type
70
         */
71
        public boolean isTypeOf(int geometryType);
72
           
73
        /**
74
     * Check if a geometry subType inherits of other subType. E.g:
75
     * the super Subtype of a geometry 3D could be a geometry 2D, 
76
     * because the 3D extends the behavior of a geometry 2D.
77
     * @param geometrySubType
78
     * the value of the {@link Geometry.SUBTYPES} to check if is 
79
     * it super subType
80
     * @return
81
     * <true> if the the parameter is a super subType of this
82
     * geometry type
83
     */
84
        public boolean isSubTypeOf(int geometrySubType);
85

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

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