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 / primitive / Envelope.java @ 41417

History | View | Annotate | Download (5.73 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

    
25
package org.gvsig.fmap.geom.primitive;
26

    
27
import org.cresques.cts.ICoordTrans;
28
import org.gvsig.fmap.geom.Geometry;
29
import org.gvsig.tools.lang.Cloneable;
30
import org.gvsig.tools.persistence.Persistent;
31

    
32
/**
33
 * <p>
34
 * This interface is equivalent to the GM_Envelope specified in 
35
 * <a href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=26012">ISO 19107</a>.
36
 * A minimum bounding box or rectangle. Regardless of dimension, an Envelope
37
 * can be represented without ambiguity as two direct positions (coordinate
38
 * points). To encode an Envelope, it is sufficient to encode these two
39
 * points. This is consistent with all of the data types in this
40
 * specification, their state is represented by their publicly accessible
41
 * attributes.
42
 * </p>
43
 * @see <a href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=26012">ISO 19107</a>
44
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
45
 */
46
public interface Envelope extends Persistent, Cloneable{
47
    /**
48
     * Returns the center ordinate along the specified dimension.
49
     * @param dimension.
50
     * The dimension
51
     * @return 
52
     * The value of the ordinate.
53
     * @throws EnvelopeNotInitializedException
54
     * if the envelope is empty.
55
     */
56
    double getCenter(int dimension);
57

    
58
    /**
59
     * The length of coordinate sequence (the number of entries) in this
60
     * envelope.
61
     * @return 
62
     * The dimension of the envelope.
63
     */
64
    int getDimension();
65

    
66
    /**
67
     * Returns the envelope length along the specified dimension.
68
     * @param dimension
69
     * The dimension.
70
     * @return
71
     * The envelope length along a dimension.
72
     * @throws EnvelopeNotInitializedException
73
     * if the envelope is empty.
74
     */
75
    double getLength(int dimension);
76

    
77
    /**
78
     * A coordinate position consisting of all the minimal ordinates for each
79
     * dimension for all points within the Envelope.
80
     * @return
81
     * The lower corner.
82
     */
83
    Point getLowerCorner();
84
    
85
    /**
86
     * Sets the coordinate position consisting of all the minimal ordinates for each
87
     * dimension for all points within the Envelope.
88
     * @param point
89
     * The lower corner.
90
     */
91
    void setLowerCorner(Point point);
92

    
93
    /**
94
     * Returns the maximal ordinate along the specified dimension.
95
     * @param dimension
96
     * The dimension.
97
     * @return
98
     * The maximum value
99
     * @throws EnvelopeNotInitializedException
100
     * if the envelope is empty.
101
     */
102
    double getMaximum(int dimension);
103

    
104
    /**
105
     * Returns the minimal ordinate along the specified dimension.
106
     * @param dimension     
107
     * The dimension.
108
     * @return
109
     * The minimum value.
110
     * @throws EnvelopeNotInitializedException
111
     * if the envelope is empty.
112
     */
113
    double getMinimum(int dimension);
114

    
115
    /**
116
     * A coordinate position consisting of all the maximal ordinates for each
117
     * dimension for all points within the Envelope.
118
     * @return
119
     * The upper corner
120
     */
121
    Point getUpperCorner();
122
    
123
    /**
124
     * Sets the coordinate position consisting of all the maximal ordinates for each
125
     * dimension for all points within the Envelope.
126
     * @param point
127
     * The upper corner.
128
     */
129
    void setUpperCorner(Point upperCorner);
130

    
131
    /**
132
     * Adds a envelope to the current envelope.
133
     * 
134
     * If the envelope to add is null or empty do not modify the current 
135
     * enevelop and don't throw a exception.
136
     * 
137
     * @param envelope
138
     *          The envelope to add.
139
     */
140
        void add(Envelope envelope);
141

    
142
        /**
143
         * It returns the equivalent of an envelope like a geometry.
144
         * 
145
         * @return
146
         *          A geometry that contains the same area that the envelope.
147
         * 
148
         * @throws EnvelopeNotInitializedException
149
         *          if the envelope is empty.
150
         */
151
        Geometry getGeometry();
152

    
153
        /**
154
         * Returns <code>true</code> if the new envelope is contained in the 
155
         * current envelope.
156
         * @param envelope
157
         * The envelope to compare.
158
         * @return
159
         * If the current envelope contains the new envelope
160
         */
161
        boolean contains(Envelope envelope);
162

    
163
        /**
164
         * Returns <code>true</code> if the new envelope intersects with the 
165
         * current envelope.
166
         * @param envelope
167
         * The envelope to compare.
168
         * @return
169
         * If the current envelope intersects with the new envelope
170
         */
171
        boolean intersects(Envelope envelope);
172

    
173
        /**
174
         * Converts the envelope to other coordinate reference system
175
         * @param trans
176
         * The CRS conversor
177
         * @return
178
         * A new envelope in other CRS 
179
         * @throws EnvelopeNotInitializedException
180
     * if the envelope is empty.
181
         */
182
        Envelope convert(ICoordTrans trans);
183
        
184
        /**
185
         * Gets if the envelope is <code>null</code> or not. Is
186
         * Empty means that the lower and upper corner are 
187
         * <code>null</code>.
188
         * @return
189
         * <code>null</code> or not if is empty.
190
         */
191
        boolean isEmpty();
192
}