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

History | View | Annotate | Download (5.12 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 java.util.Collection;
27
import org.gvsig.fmap.geom.Geometry;
28
import org.gvsig.fmap.geom.exception.CreateGeometryException;
29
import org.gvsig.fmap.geom.operation.GeometryOperation;
30

    
31
/**
32
 * This class represents the type of a geometry. All the geometries has to have
33
 * a type that can be retrieved using the
34
 * {@link Geometry}{@link #getGeometryType()} method.
35
 *
36
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
37
 */
38
public interface GeometryType {
39

    
40
    /**
41
     * @return the name of the geometry type.
42
     */
43
    public String getName();
44

    
45
    /**
46
     * Return the full name of this geometry type. It include the type name and
47
     * the subtype name.
48
     *
49
     * @return the full name of the geometry type
50
     */
51
    public String getFullName();
52
    
53
    public GeometryType addAlias(String alias);
54
    
55
    public Collection<String> getAlias();
56

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

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

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

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

    
94
    /**
95
     * Check if a geometry type inherits of other type. E.g: the super type of
96
     * an arc could be a a curve, the super type of a circle could be a
97
     * surface...
98
     *
99
     * @param geometryType the geometry type to check if is it super type
100
     * @return if the the parameter is a super type of this geometry type
101
     */
102
    public boolean isTypeOf(GeometryType geometryType);
103

    
104
    /**
105
     * Check if a geometry subType inherits of other subType. E.g: the super
106
     * Subtype of a geometry 3D could be a geometry 2D, because the 3D extends
107
     * the behavior of a geometry 2D.
108
     *
109
     * @param geometryType the geometry type to check if is it super subtype
110
     * @return if the the parameter is a super subType of this geometry type
111
     */
112
    public boolean isSubTypeOf(GeometryType geometryType);
113

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

    
124
    /**
125
     * Registers an operation for this geometry type.
126
     *
127
     * @param index
128
     * @param geomOp
129
     */
130
    public void setGeometryOperation(int index, GeometryOperation geomOp);
131

    
132
    /**
133
     * Get the operation for this geometry at a concrete position
134
     *
135
     * @param index The position of the operation
136
     * @return A geometry operation
137
     */
138
    public GeometryOperation getGeometryOperation(int index);
139

    
140
    /**
141
     * @return the geometry as a String
142
     */
143
    @Override
144
    public String toString();
145

    
146
    public int getDimension();
147

    
148
    public boolean hasZ();
149

    
150
    public boolean hasM();
151

    
152
    public Class getGeometryClass();
153
}