Revision 38676

View differences:

tags/v2_0_0_Build_2050/libraries/libFMap_dalindex/pom.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2

  
3
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
5
                      http://maven.apache.org/maven-v4_0_0.xsd">
6
	<modelVersion>4.0.0</modelVersion>
7
	<artifactId>org.gvsig.fmap.dal.index.spatial
8
	</artifactId>
9
	<packaging>jar</packaging>
10
	<version>2.0-SNAPSHOT</version>
11
	<name>libFMap_dalindex</name>
12
	<parent>
13
		<groupId>org.gvsig</groupId>
14
		<artifactId>gvsig-base-library-pom</artifactId>
15
		<version>2.0-SNAPSHOT</version>
16
	</parent>	
17
	<properties>
18
		<!-- gt2 -->
19
		<gt2-jarIncludes>org/gvsig/fmap/dal/index/spatial/gt2/**
20
		</gt2-jarIncludes>
21
		<gt2-jarExcludes>NONE</gt2-jarExcludes>
22

  
23
		<!-- jts -->
24
		<jts-jarIncludes>org/gvsig/fmap/dal/index/spatial/jts/**
25
		</jts-jarIncludes>
26
		<jts-jarExcludes>NONE</jts-jarExcludes>
27

  
28
		<!-- jsi -->
29
		<jsi-jarIncludes>org/gvsig/fmap/dal/index/spatial/jsi/**
30
		</jsi-jarIncludes>
31
		<jsi-jarExcludes>NONE</jsi-jarExcludes>
32

  
33
		<!-- spatialindex -->
34
		<sptidx-jarIncludes>org/gvsig/fmap/dal/index/spatial/spatialindex/**
35
		</sptidx-jarIncludes>
36
		<sptidx-jarExcludes>NONE</sptidx-jarExcludes>
37

  
38
		<build-dir>${basedir}/../build</build-dir>
39
        <eclipse.project.name>libFMap_dalindex</eclipse.project.name>
40
	</properties>
41

  
42
	<dependencies>
43
        <dependency>
44
            <groupId>org.gvsig</groupId>
45
            <artifactId>org.gvsig.tools.lib</artifactId>
46
            <scope>compile</scope>
47
        </dependency>
48
		<dependency>
49
			<groupId>org.gvsig</groupId>
50
			<artifactId>org.gvsig.fmap.dal</artifactId>
51
            <scope>compile</scope>
52
		</dependency>
53
		<dependency>
54
			<groupId>org.gvsig</groupId>
55
			<artifactId>org.gvsig.fmap.dal</artifactId>
56
			<classifier>spi</classifier>
57
            <scope>compile</scope>
58
		</dependency>
59
        <dependency>
60
            <groupId>org.gvsig</groupId>
61
            <artifactId>org.gvsig.fmap.geometry</artifactId>
62
            <scope>compile</scope>
63
        </dependency>
64
        <dependency>
65
            <groupId>org.gvsig</groupId>
66
            <artifactId>org.gvsig.metadata.lib.basic.api</artifactId>
67
            <scope>compile</scope>
68
        </dependency>        
69
        <dependency>
70
            <groupId>org.gvsig</groupId>
71
            <artifactId>org.gvsig.projection</artifactId>
72
            <scope>compile</scope>
73
        </dependency>
74
		<dependency>
75
			<groupId>com.vividsolutions</groupId>
76
			<artifactId>jts</artifactId>
77
            <scope>compile</scope>
78
		</dependency>
79
		<dependency>
80
			<groupId>net.sf</groupId>
81
			<artifactId>jsi</artifactId>
82
            <scope>compile</scope>
83
		</dependency>
84
		<dependency>
85
			<groupId>sil</groupId>
86
			<artifactId>sil</artifactId>
87
            <scope>compile</scope>
88
		</dependency>
89
		<dependency>
90
			<groupId>gnu.trove</groupId>
91
			<artifactId>trove</artifactId>
92
            <scope>compile</scope>
93
		</dependency>
94
		<dependency>
95
			<groupId>org.geotools</groupId>
96
			<artifactId>gt2-main</artifactId>
97
            <scope>compile</scope>
98
		</dependency>		
99
 		<dependency>
100
		    <groupId>spatialindex</groupId>
101
   			<artifactId>spatialindex</artifactId>
102
            <scope>compile</scope>
103
   		</dependency>
104
   		<dependency>
105
            <groupId>org.gvsig</groupId>
106
            <artifactId>org.gvsig.timesupport.lib.api</artifactId>
107
            <scope>compile</scope>
108
        </dependency>
109
	</dependencies>
110
	<build>
111
		<sourceDirectory>src</sourceDirectory>
112
		<testSourceDirectory>src-test</testSourceDirectory>
113
		<testResources>
114
			<testResource>
115
				<directory>src-test</directory>
116
			</testResource>
117
		</testResources>
118
	</build>
119

  
120
	<profiles>
121
		<profile>
122
			<id>se</id>
123
			<activation>
124
				<activeByDefault>true</activeByDefault>
125
			</activation>
126
			<build>
127
				<plugins>
128
					<plugin>
129
						<groupId>org.apache.maven.plugins
130
						</groupId>
131
						<artifactId>maven-jar-plugin</artifactId>
132
						<configuration>
133
							<excludes>
134
								<exclude>${gt2-jarIncludes}</exclude>
135
								<exclude>${jts-jarIncludes}</exclude>
136
								<exclude>${jsi-jarIncludes}</exclude>
137
								<exclude>${sptidx-jarIncludes}</exclude>
138
							</excludes>
139
						</configuration>
140
						<executions>
141
							<!--
142
								Generates a jar file only with the GT2 based spatial index
143
								classes
144
							-->
145
							<execution>
146
								<id>gt2</id>
147
								<phase>package</phase>
148
								<goals>
149
									<goal>jar</goal>
150
								</goals>
151
								<configuration>
152
									<classifier>gt2</classifier>
153
									<includes>
154
										<include>${gt2-jarIncludes}</include>
155
									</includes>
156
									<excludes>
157
										<exclude>${gt2-jarExcludes}</exclude>
158
									</excludes>
159
								</configuration>
160
							</execution>
161
							<!--
162
								Generates a jar file only with the JTS based spatial index
163
								classes
164
							-->
165
							<execution>
166
								<id>jts</id>
167
								<phase>package</phase>
168
								<goals>
169
									<goal>jar</goal>
170
								</goals>
171
								<configuration>
172
									<classifier>jts</classifier>
173
									<includes>
174
										<include>${jts-jarIncludes}</include>
175
									</includes>
176
									<excludes>
177
										<exclude>${jts-jarExcludes}</exclude>
178
									</excludes>
179
								</configuration>
180
							</execution>
181
							<!--
182
								Generates a jar file only with the JSI based spatial index
183
								classes
184
							-->
185
							<execution>
186
								<id>jsi</id>
187
								<phase>package</phase>
188
								<goals>
189
									<goal>jar</goal>
190
								</goals>
191
								<configuration>
192
									<classifier>jsi</classifier>
193
									<includes>
194
										<include>${jsi-jarIncludes}</include>
195
									</includes>
196
									<excludes>
197
										<exclude>${jsi-jarExcludes}</exclude>
198
									</excludes>
199
								</configuration>
200
							</execution>
201
							<!--
202
								Generates a jar file only with the spatialindex based spatial
203
								index classes
204
							-->
205
							<execution>
206
								<id>spatialindex</id>
207
								<phase>package</phase>
208
								<goals>
209
									<goal>jar</goal>
210
								</goals>
211
								<configuration>
212
									<classifier>spatialindex</classifier>
213
									<includes>
214
										<include>${sptidx-jarIncludes}</include>
215
									</includes>
216
									<excludes>
217
										<exclude>${sptidx-jarExcludes}</exclude>
218
									</excludes>
219
								</configuration>
220
							</execution>
221
						</executions>
222
					</plugin>
223
					<plugin>
224
						<artifactId>maven-antrun-plugin</artifactId>
225
						<executions>
226
							<execution>
227
								<id>services</id>
228
								<phase>package</phase>
229
								<goals>
230
									<goal>run</goal>
231
								</goals>
232
								<configuration>
233
									<tasks>
234
										<jar
235
											destfile="${project.build.directory}/${project.build.finalName}-gt2.jar"
236
											update="true">
237
											<fileset dir="${basedir}/resources/gt2" />
238
										</jar>
239
										<jar
240
											destfile="${project.build.directory}/${project.build.finalName}-jsi.jar"
241
											update="true">
242
											<fileset dir="${basedir}/resources/jsi" />
243
										</jar>
244
										<jar
245
											destfile="${project.build.directory}/${project.build.finalName}-jts.jar"
246
											update="true">
247
											<fileset dir="${basedir}/resources/jts" />
248
										</jar>
249
										<jar
250
											destfile="${project.build.directory}/${project.build.finalName}-spatialindex.jar"
251
											update="true">
252
											<fileset dir="${basedir}/resources/spatialindex" />
253
										</jar>
254
									</tasks>
255
								</configuration>
256
							</execution>
257
						</executions>
258
					</plugin>
259
					<plugin>
260
						<groupId>org.apache.maven.plugins
261
						</groupId>
262
						<artifactId>maven-surefire-plugin
263
						</artifactId>
264
						<configuration>
265
							<additionalClasspathElements>
266
								<additionalClasspathElement>${basedir}/resources/gt2
267
								</additionalClasspathElement>
268
								<additionalClasspathElement>${basedir}/resources/jsi
269
								</additionalClasspathElement>
270
								<additionalClasspathElement>${basedir}/resources/jts
271
								</additionalClasspathElement>
272
								<additionalClasspathElement>${basedir}/resources/spatialindex
273
								</additionalClasspathElement>
274
							</additionalClasspathElements>
275
						</configuration>
276
					</plugin>
277

  
278
				</plugins>
279
			</build>
280
		</profile>
281
		<profile>
282
			<id>cdc</id>
283
			<activation>
284
				<activeByDefault>false</activeByDefault>
285
			</activation>
286
			<build>
287

  
288
				<plugins>
289
					<plugin>
290
						<groupId>org.apache.maven.plugins
291
						</groupId>
292
						<artifactId>maven-compiler-plugin
293
						</artifactId>
294
						<configuration>
295
							<source>1.4</source>
296
							<target>1.4</target>
297
							<!-- put your configurations here -->
298
							<encoding>ISO-8859-1</encoding>
299
							<excludes>
300
								<exclude>${jts-jarExcludes}</exclude>
301
								<exclude>**/gt2/**</exclude>
302
								<exclude>**/jsi/**</exclude>
303
								<exclude>**/spatialindex/**</exclude>
304
							</excludes>
305
						</configuration>
306
					</plugin>
307
					<plugin>
308
						<groupId>org.apache.maven.plugins
309
						</groupId>
310
						<artifactId>maven-jar-plugin</artifactId>
311
						<configuration>
312
							<excludes>
313
								<exclude>${jts-jarIncludes}</exclude>
314
							</excludes>
315
						</configuration>
316
						<executions>
317

  
318
							<!--
319
								Generates a jar file only with the JTS based spatial index
320
								classes
321
							-->
322
							<execution>
323
								<id>jts</id>
324
								<phase>package</phase>
325
								<goals>
326
									<goal>jar</goal>
327
								</goals>
328
								<configuration>
329
									<classifier>jts</classifier>
330
									<includes>
331
										<include>${jts-jarIncludes}</include>
332
									</includes>
333
									<excludes>
334
										<exclude>${jts-jarExcludes}</exclude>
335
										<exclude>**/gt2/**</exclude>
336
										<exclude>**/jsi/**</exclude>
337
										<exclude>**/spatialindex/**</exclude>
338
									</excludes>
339
								</configuration>
340
							</execution>
341
						</executions>
342
					</plugin>
343
				</plugins>
344
			</build>
345
		</profile>
346
		<profile>
347
			<id>eclipse-project</id>
348
			<build>
349
				<defaultGoal>antrun:run</defaultGoal>
350
				<plugins>
351
					<plugin>
352
						<artifactId>maven-antrun-plugin</artifactId>
353
						<configuration>
354
							<tasks>
355
								<ant antfile="${build-dir}/ant-tasks/eclipse-tasks.xml"
356
									target="eclipse.all"/>
357
							</tasks>
358
						</configuration>
359
					</plugin>
360
				</plugins>
361
			</build>				
362
		</profile>		
363
	</profiles>
364

  
365

  
366
</project>
tags/v2_0_0_Build_2050/libraries/libFMap_dalindex/resources/gt2/META-INF/services/org.gvsig.tools.library.Library
1
org.gvsig.fmap.dal.index.spatial.gt2.Gt2IndexLibrary
tags/v2_0_0_Build_2050/libraries/libFMap_dalindex/resources/jts/META-INF/services/org.gvsig.tools.library.Library
1
org.gvsig.fmap.dal.index.spatial.jts.JTSIndexLibrary
tags/v2_0_0_Build_2050/libraries/libFMap_dalindex/resources/jsi/META-INF/services/org.gvsig.tools.library.Library
1
org.gvsig.fmap.dal.index.spatial.jsi.JSIIndexLibrary
tags/v2_0_0_Build_2050/libraries/libFMap_dalindex/resources/spatialindex/META-INF/services/org.gvsig.tools.library.Library
1
org.gvsig.fmap.dal.index.spatial.spatialindex.SPTLIBIndexLibrary
tags/v2_0_0_Build_2050/libraries/libFMap_dalindex/src/org/gvsig/fmap/dal/index/spatial/jsi/JSIRTree.java
1
/*
2
 * Created on 15-may-2006
3
 *
4
 * gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
5
 *
6
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
7
 *
8
 * This program is free software; you can redistribute it and/or
9
 * modify it under the terms of the GNU General Public License
10
 * as published by the Free Software Foundation; either version 2
11
 * of the License, or (at your option) any later version.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU General Public License
19
 * along with this program; if not, write to the Free Software
20
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
21
 *
22
 * For more information, contact:
23
 *
24
 *  Generalitat Valenciana
25
 *   Conselleria d'Infraestructures i Transport
26
 *   Av. Blasco Ib��ez, 50
27
 *   46010 VALENCIA
28
 *   SPAIN
29
 *
30
 *      +34 963862235
31
 *   gvsig@gva.es
32
 *      www.gvsig.gva.es
33
 *
34
 *    or
35
 *
36
 *   IVER T.I. S.A
37
 *   Salamanca 50
38
 *   46005 Valencia
39
 *   Spain
40
 *
41
 *   +34 963163400
42
 *   dac@iver.es
43
 */
44
/* CVS MESSAGES:
45
 *
46
 * $Id: RTreeJsi.java 13884 2007-09-19 16:26:04Z jaume $
47
 * $Log$
48
 * Revision 1.5  2007-09-19 16:25:39  jaume
49
 * ReadExpansionFileException removed from this context and removed unnecessary imports
50
 *
51
 * Revision 1.4  2007/06/27 20:17:30  azabala
52
 * new spatial index (rix)
53
 *
54
 * Revision 1.3  2007/03/06 17:08:59  caballero
55
 * Exceptions
56
 *
57
 * Revision 1.2  2006/06/05 16:59:08  azabala
58
 * implementada busqueda de vecino mas proximo a partir de rectangulos
59
 *
60
 * Revision 1.1  2006/05/24 21:58:04  azabala
61
 * *** empty log message ***
62
 *
63
 *
64
 */
65
package org.gvsig.fmap.dal.index.spatial.jsi;
66

  
67
import java.util.ArrayList;
68
import java.util.Iterator;
69
import java.util.List;
70
import java.util.Properties;
71

  
72
import com.infomatiq.jsi.IntProcedure;
73
import com.infomatiq.jsi.Rectangle;
74
import com.infomatiq.jsi.rtree.RTree;
75

  
76
import org.gvsig.fmap.dal.exception.DataException;
77
import org.gvsig.fmap.dal.exception.InitializeException;
78
import org.gvsig.fmap.dal.feature.exception.FeatureIndexException;
79
import org.gvsig.fmap.dal.feature.spi.FeatureReferenceProviderServices;
80
import org.gvsig.fmap.dal.feature.spi.index.AbstractFeatureIndexProvider;
81
import org.gvsig.fmap.dal.feature.spi.index.FeatureIndexProvider;
82
import org.gvsig.fmap.geom.Geometry;
83
import org.gvsig.fmap.geom.primitive.Envelope;
84
import org.gvsig.fmap.geom.primitive.Point;
85

  
86
/**
87
 * RTree spatial index implementation based in library
88
 * JSI (java spatial index).
89
 * 
90
 * http://jsi.sourceforge.net/
91
 * 
92
 * This RTree has better performance that Spatial Index Library
93
 * RTree, and that JTS'RTree, because
94
 * it uses the GNU's Trove Collections API.
95
 * 
96
 * We are doing some probes with it, because it offers
97
 * a Nearest Neighbour algorithm implementation
98
 * (useful for Spatial Join geoprocess, for example).
99
 * 
100
 * It isnt persistent, and We've found some problems
101
 * with delete operations.
102
 * 
103
 * 
104
 * 
105
 * 
106
 * @author azabala
107
 * @author jyarza
108
 * 
109
 */
110
public class JSIRTree extends AbstractFeatureIndexProvider implements
111
    FeatureIndexProvider {
112

  
113
    public static final String NAME = JSIRTree.class.getSimpleName();
114

  
115
    protected RTree rtree;
116

  
117
    public JSIRTree() {
118
    }
119

  
120
    public void initialize() throws InitializeException {
121
        this.rtree = createRTree();
122
    }
123

  
124
    private RTree createRTree() {
125
        RTree rtree = new RTree();
126
        Properties props = new Properties();
127
        // props.setProperty("MaxNodeEntries", "500");
128
        // props.setProperty("MinNodeEntries", "200");
129
        rtree.init(props);
130
        return rtree;
131
    }
132

  
133
    class ListIntProcedure implements IntProcedure {
134

  
135
        ArrayList solution = new ArrayList();
136

  
137
        public boolean execute(int arg0) {
138
            solution.add(new Integer(arg0));
139
            return true;
140
        }
141

  
142
        public List getSolution() {
143
            return solution;
144
        }
145
    }
146

  
147
    protected List findNNearest(int numberOfNearest, Point point) {
148
        com.infomatiq.jsi.Point jsiPoint =
149
            new com.infomatiq.jsi.Point((float) point.getX(),
150
                (float) point.getY());
151
        return (List) rtree.nearest(jsiPoint, numberOfNearest);
152
    }
153

  
154
    public Iterator iterator() {
155
        return rtree.iterator();
156
    }
157

  
158
    public int size() {
159
        return rtree.size();
160
    }
161

  
162
    protected Rectangle toJsiRect(Envelope env) {
163
        Point min = env.getLowerCorner();
164
        Point max = env.getUpperCorner();
165

  
166
        Rectangle jsiRect =
167
            new Rectangle((float) min.getX(), (float) min.getY(),
168
                (float) max.getX(), (float) max.getY());
169
        return jsiRect;
170
    }
171

  
172
    public void insert(Object value, FeatureReferenceProviderServices fref) {
173
        Envelope env = getEnvelope(value);
174

  
175
        if (env == null) {
176
            throw new IllegalArgumentException(
177
                "value is neither Geometry or Envelope");
178
        }
179

  
180
        Object oid = fref.getOID();
181
        if (!isCompatibleOID(oid)) {
182
            throw new IllegalArgumentException("OID type not compatible: "
183
                + oid.getClass().getName());
184
        }
185

  
186
        rtree.add(toJsiRect(env), ((Number) oid).intValue());
187
    }
188

  
189
    public void delete(Object value, FeatureReferenceProviderServices fref) {
190
        Envelope env = getEnvelope(value);
191

  
192
        if (env == null) {
193
            throw new IllegalArgumentException(
194
                "value is neither Geometry or Envelope");
195
        }
196

  
197
        Object oid = fref.getOID();
198
        if (!isCompatibleOID(oid)) {
199
            throw new IllegalArgumentException("OID type not compatible: "
200
                + oid.getClass().getName());
201
        }
202

  
203
        rtree.delete(toJsiRect(env), ((Number) oid).intValue());
204
    }
205

  
206
    public List match(Object value) throws FeatureIndexException {
207
        Envelope env = getEnvelope(value);
208

  
209
        if (env == null) {
210
            throw new IllegalArgumentException(
211
                "value is neither Geometry or Envelope");
212
        }
213
        ListIntProcedure solution = new ListIntProcedure();
214
        rtree.intersects(toJsiRect(env), solution);
215
        return new LongList(solution.getSolution());
216
    }
217

  
218
    public List nearest(int count, Object value) {
219
        if (value == null) {
220
            throw new IllegalArgumentException("value is null");
221
        }
222

  
223
        if (value instanceof Point) {
224
            Point p = (Point) value;
225
            com.infomatiq.jsi.Point jsiPoint =
226
                new com.infomatiq.jsi.Point((float) p.getDirectPosition()
227
                    .getOrdinate(0), (float) p.getDirectPosition().getOrdinate(
228
                    1));
229
            return (List) rtree.nearest(jsiPoint, count);
230
        } else {
231
            Envelope env = getEnvelope(value);
232

  
233
            if (env == null) {
234
                throw new IllegalArgumentException(
235
                    "value is neither Geometry or Envelope");
236
            }
237
            return new LongList((List) rtree.nearest(toJsiRect(env), count));
238
        }
239
    }
240

  
241
    public boolean isMatchSupported() {
242
        return true;
243
    }
244

  
245
    public boolean isNearestSupported() {
246
        return true;
247
    }
248

  
249
    public boolean isNearestToleranceSupported() {
250
        return false;
251
    }
252

  
253
    public boolean isRangeSupported() {
254
        return false;
255
    }
256

  
257
    public List nearest(int count, Object value, Object tolerance)
258
        throws FeatureIndexException {
259
        throw new UnsupportedOperationException();
260
    }
261

  
262
    public List range(Object value1, Object value2)
263
        throws FeatureIndexException {
264
        throw new UnsupportedOperationException();
265
    }
266

  
267
    /**
268
     * Indicates whether the given OID's type is compatible
269
     * with this provider
270
     * 
271
     * @param oid
272
     * 
273
     * @return
274
     *         true if this index provider supports the given oid type
275
     */
276
    private boolean isCompatibleOID(Object oid) {
277
        if (!(oid instanceof Number)) {
278
            return false;
279
        }
280

  
281
        long num = ((Number) oid).longValue();
282

  
283
        if (num > Integer.MAX_VALUE || num < Integer.MIN_VALUE) {
284
            return false;
285
        }
286

  
287
        return true;
288
    }
289

  
290
    protected Envelope getEnvelope(Object value) {
291
        Envelope env = null;
292

  
293
        if (value instanceof Envelope) {
294
            env = (Envelope) value;
295
        } else
296
            if (value instanceof Geometry) {
297
                env = ((Geometry) value).getEnvelope();
298
            }
299
        return env;
300
    }
301

  
302
    public void clear() throws DataException {
303
        rtree = createRTree();
304
    }
305
}
tags/v2_0_0_Build_2050/libraries/libFMap_dalindex/src/org/gvsig/fmap/dal/index/spatial/jsi/JSIPersistentRTree.java
1
/*
2
 * Created on 13-jun-2007
3
 *
4
 * gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
5
 *
6
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
7
 *
8
 * This program is free software; you can redistribute it and/or
9
 * modify it under the terms of the GNU General Public License
10
 * as published by the Free Software Foundation; either version 2
11
 * of the License, or (at your option) any later version.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU General Public License
19
 * along with this program; if not, write to the Free Software
20
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
21
 *
22
 * For more information, contact:
23
 *
24
 *  Generalitat Valenciana
25
 *   Conselleria d'Infraestructures i Transport
26
 *   Av. Blasco Ib��ez, 50
27
 *   46010 VALENCIA
28
 *   SPAIN
29
 *
30
 *      +34 963862235
31
 *   gvsig@gva.es
32
 *      www.gvsig.gva.es
33
 *
34
 *    or
35
 *
36
 *   IVER T.I. S.A
37
 *   Salamanca 50
38
 *   46005 Valencia
39
 *   Spain
40
 *
41
 *   +34 963163400
42
 *   dac@iver.es
43
 */
44
/* CVS MESSAGES:
45
*
46
* $Id: PersistentRTreeJsi.java 12380 2007-06-27 20:17:30Z azabala $
47
* $Log$
48
* Revision 1.1  2007-06-27 20:17:30  azabala
49
* new spatial index (rix)
50
*
51
*
52
*/
53
package org.gvsig.fmap.dal.index.spatial.jsi;
54

  
55
import java.awt.geom.Point2D;
56
import java.io.File;
57
import java.io.FileNotFoundException;
58
import java.io.IOException;
59
import java.io.RandomAccessFile;
60
import java.nio.ByteOrder;
61
import java.nio.MappedByteBuffer;
62
import java.nio.channels.FileChannel;
63
import java.util.Iterator;
64
import java.util.LinkedHashMap;
65
import java.util.List;
66
import java.util.Properties;
67

  
68
import javax.imageio.stream.FileImageOutputStream;
69

  
70
import org.gvsig.fmap.dal.exception.InitializeException;
71
import org.gvsig.fmap.dal.feature.exception.FeatureIndexException;
72
import org.gvsig.fmap.dal.feature.spi.FeatureReferenceProviderServices;
73
import org.gvsig.fmap.geom.Geometry;
74
import org.gvsig.fmap.geom.primitive.Envelope;
75

  
76
import com.infomatiq.jsi.Rectangle;
77
import com.infomatiq.jsi.rtree.RTree;
78

  
79
/**
80
 * Persistent spatial index which can resolve nearest neighbour queries.
81
 * <br>
82
 *
83
 * To use:
84
 *
85
 * PersistentRTreeJsi sptidx = new PersistentRtreeJsi("/home/kk");
86
 * if(sptidx.exists())
87
 *  sptidx.load();
88
 *
89
 *
90
 *  sptidx.add(rect, int);
91
 *  ...
92
 *  sptidx.add(rect2,int2);
93
 *  sptidx.flush();
94
 *
95
 * @author azabala
96
 *
97
 */
98
public class JSIPersistentRTree extends JSIRTree {
99

  
100
	public static final String NAME = JSIPersistentRTree.class.getSimpleName();
101

  
102
	/**
103
	 * Spatial index file
104
	 */
105
	private File file;
106

  
107
	private boolean hasChanged = false;
108
	/**
109
	 * Spatial index file extension
110
	 */
111
	final String rExt = ".rix";
112

  
113
	private LinkedHashMap  rectangles;
114

  
115
	public JSIPersistentRTree() {
116
		super();
117
	}
118

  
119
	public void initialize() throws InitializeException {
120
		super.initialize();
121
		try {
122
			file = File.createTempFile("RTreeJsi" + getFeatureIndexProviderServices().getTemporaryFileName(), rExt);
123
			rectangles = new LinkedHashMap();
124
			load(file);
125
		} catch (IOException e) {
126
			throw new InitializeException(e);
127
		} catch (FeatureIndexException e) {
128
			throw new InitializeException(e);
129
		}
130
	}
131

  
132
	public void flush(File f) throws FeatureIndexException {
133
		try {
134
			if(! hasChanged) {
135
				return;
136
			}
137
			RandomAccessFile file = new RandomAccessFile(f,
138
															"rw");
139
			FileImageOutputStream output = new FileImageOutputStream(file);
140
			output.setByteOrder(ByteOrder.LITTLE_ENDIAN);
141
			int numShapes = rtree.size();
142
			output.writeInt(numShapes);
143

  
144
			Iterator iterator = rtree.iterator();
145
			int count = 0;
146
			while(iterator.hasNext()){
147
				Integer  idx = (Integer) iterator.next();
148
				Rectangle nr = (Rectangle) rectangles.get(idx);
149
				float xmin = nr.min[0];
150
				float ymin = nr.min[1];
151

  
152
				float xmax = nr.max[0];
153
				float ymax = nr.max[1];
154

  
155
				output.writeFloat(xmin);
156
				output.writeFloat(ymin);
157
				output.writeFloat(xmax);
158
				output.writeFloat(ymax);
159

  
160
				output.writeInt(idx.intValue());
161
				count++;
162
			}
163
			output.flush();
164
			output.close();
165
			file.close();
166
			hasChanged = false;
167
		} catch (FileNotFoundException e) {
168
			throw new FeatureIndexException(e);
169
		} catch (IOException e) {
170
			throw new FeatureIndexException(e);
171
		}
172

  
173
	}
174

  
175
	private void load(File f) throws FeatureIndexException {
176
		if (f == null) {
177
			throw new IllegalArgumentException("File f cannot be null");
178
		}
179

  
180
		try {
181
			if(! f.exists()){
182
				return;
183
			}
184
			RandomAccessFile file = new RandomAccessFile(f, "r");
185
			FileChannel channel = file.getChannel();
186
			MappedByteBuffer buf = channel.map(FileChannel.MapMode.READ_ONLY, 0, channel.size());
187
			buf.order(ByteOrder.LITTLE_ENDIAN);
188
			int numShapes = buf.getInt();
189
			for(int i = 0; i < numShapes; i++){
190
				float xmin, ymin, xmax, ymax;
191
				int shapeIndex;
192
				xmin = buf.getFloat();
193
				ymin = buf.getFloat();
194
				xmax = buf.getFloat();
195
				ymax = buf.getFloat();
196
				shapeIndex = buf.getInt();
197

  
198
				Rectangle jsiRect = new Rectangle(xmin, ymin, xmax, ymax);
199
				rtree.add(jsiRect, shapeIndex);
200
			}
201
		}catch(Exception e){
202
			throw new FeatureIndexException(e);
203
		}
204
	}
205

  
206
	public void insert(Object value, FeatureReferenceProviderServices fref) {	
207
		super.insert(value, fref);
208
		Envelope env = getEnvelope(value);
209
		rectangles.put(fref.getOID(), toJsiRect(env));
210
		hasChanged = true;
211
	}
212

  
213

  
214
	public void delete(Object value, FeatureReferenceProviderServices fref) {
215
		super.delete(value, fref);
216
		rectangles.remove(fref.getOID());
217
		hasChanged = true;
218
	}
219

  
220
}
221

  
tags/v2_0_0_Build_2050/libraries/libFMap_dalindex/src/org/gvsig/fmap/dal/index/spatial/jsi/JSIIndexLibrary.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
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 2
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
*/
22

  
23
/*
24
* AUTHORS (In addition to CIT):
25
* 2008 {{Company}}   {{Task}}
26
*/
27

  
28
package org.gvsig.fmap.dal.index.spatial.jsi;
29

  
30
import org.gvsig.fmap.dal.DALLibrary;
31
import org.gvsig.fmap.dal.DALLocator;
32
import org.gvsig.fmap.dal.DataTypes;
33
import org.gvsig.fmap.dal.spi.DataManagerProviderServices;
34
import org.gvsig.tools.library.AbstractLibrary;
35
import org.gvsig.tools.library.LibraryException;
36

  
37
public class JSIIndexLibrary extends AbstractLibrary {
38

  
39
    @Override
40
    public void doRegistration() {
41
        registerAsServiceOf(DALLibrary.class);
42
    }
43

  
44
	@Override
45
	protected void doInitialize() throws LibraryException {
46
	}
47

  
48
	@Override
49
	protected void doPostInitialize() throws LibraryException {
50
    	DataManagerProviderServices man = (DataManagerProviderServices) DALLocator.getDataManager();
51

  
52
    	if (!man.getFeatureIndexProviders().contains(JSIPersistentRTree.NAME)) {
53
			man.registerFeatureIndexProvider(JSIPersistentRTree.NAME, "Persistent RTree index based on JSI",
54
					JSIPersistentRTree.class, DataTypes.GEOMETRY);
55
    	}
56

  
57
    	if (!man.getFeatureIndexProviders().contains(JSIRTree.NAME)) {
58
			man.registerFeatureIndexProvider(JSIRTree.NAME, "RTree index based on JSI",
59
					JSIRTree.class, DataTypes.GEOMETRY);
60
    	}
61
	}
62
}
tags/v2_0_0_Build_2050/libraries/libFMap_dalindex/src/org/gvsig/fmap/dal/index/spatial/spatialindex/SPTLIBIndexLibrary.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
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 2
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
*/
22

  
23
/*
24
* AUTHORS (In addition to CIT):
25
* 2008 {{Company}}   {{Task}}
26
*/
27

  
28
package org.gvsig.fmap.dal.index.spatial.spatialindex;
29

  
30
import org.gvsig.fmap.dal.DALLibrary;
31
import org.gvsig.fmap.dal.DALLocator;
32
import org.gvsig.fmap.dal.DataTypes;
33
import org.gvsig.fmap.dal.spi.DataManagerProviderServices;
34
import org.gvsig.tools.library.AbstractLibrary;
35
import org.gvsig.tools.library.LibraryException;
36

  
37
public class SPTLIBIndexLibrary extends AbstractLibrary {
38

  
39
    @Override
40
    public void doRegistration() {
41
        registerAsServiceOf(DALLibrary.class);
42
    }
43

  
44
	@Override
45
	protected void doInitialize() throws LibraryException {
46
	}
47

  
48
	@Override
49
	protected void doPostInitialize() throws LibraryException {
50
    	DataManagerProviderServices man = (DataManagerProviderServices) DALLocator.getDataManager();
51

  
52

  
53
    	if (!man.getFeatureIndexProviders().contains(SPTLIBRTree.NAME)) {
54
			man.registerFeatureIndexProvider(SPTLIBRTree.NAME, "RTree index based on spatialindex",
55
					SPTLIBRTree.class, DataTypes.GEOMETRY);
56
    	}
57
	}
58
}
59

  
tags/v2_0_0_Build_2050/libraries/libFMap_dalindex/src/org/gvsig/fmap/dal/index/spatial/spatialindex/SPTLIBRTree.java
1
package org.gvsig.fmap.dal.index.spatial.spatialindex;
2

  
3
import java.io.File;
4
import java.io.FileNotFoundException;
5
import java.io.IOException;
6
import java.util.ArrayList;
7
import java.util.List;
8

  
9
import org.gvsig.fmap.dal.exception.DataException;
10
import org.gvsig.fmap.dal.exception.InitializeException;
11
import org.gvsig.fmap.dal.feature.exception.FeatureIndexException;
12
import org.gvsig.fmap.dal.feature.spi.FeatureReferenceProviderServices;
13
import org.gvsig.fmap.dal.feature.spi.index.AbstractFeatureIndexProvider;
14
import org.gvsig.fmap.dal.feature.spi.index.FeatureIndexProvider;
15
import org.gvsig.fmap.geom.Geometry;
16
import org.gvsig.fmap.geom.primitive.Envelope;
17
import org.gvsig.fmap.geom.primitive.Point;
18

  
19
import spatialindex.rtree.RTree;
20
import spatialindex.spatialindex.IData;
21
import spatialindex.spatialindex.INode;
22
import spatialindex.spatialindex.IVisitor;
23
import spatialindex.spatialindex.Region;
24
import spatialindex.storagemanager.DiskStorageManager;
25
import spatialindex.storagemanager.IBuffer;
26
import spatialindex.storagemanager.IStorageManager;
27
import spatialindex.storagemanager.PropertySet;
28
import spatialindex.storagemanager.RandomEvictionsBuffer;
29

  
30
/**
31
 * <p>
32
 * RTree spatial index based in spatial index library: <br>
33
 * http://u-foria.org/marioh/spatialindex/index.html <br>
34
 * marioh@cs.ucr.edu
35
 * </p>
36
 * It has the problem that spatial index file creation is a bit slowly (in
37
 * comparation with other indexes).
38
 */
39
public class SPTLIBRTree extends AbstractFeatureIndexProvider implements
40
    FeatureIndexProvider {
41

  
42
    public static final String NAME = SPTLIBRTree.class.getSimpleName();
43
    /**
44
     * Page size of associated file
45
     */
46
    private static final int defaultPageSize = 32 * 1024;
47
    private static final double defaultFillFactor = 0.85d;
48

  
49
    /**
50
     * Size of memory buffer of the index
51
     */
52
    private static final int BUFFER_SIZE = 25000;
53
    RTree rtree;
54
    String fileName;
55
    IStorageManager diskfile;
56

  
57
    public SPTLIBRTree() {
58

  
59
    }
60

  
61
    public void initialize() throws InitializeException {
62
        try {
63
            PropertySet ps = new PropertySet();
64
            ps.setProperty("Overwrite", new Boolean(false));
65
            // .idx and .dat extensions will be added.
66
            fileName =
67
                getFeatureIndexProviderServices().getNewFileName(null, null);
68
            ps.setProperty("FileName", fileName);
69
            ps.setProperty("PageSize", new Integer(defaultPageSize));
70
            diskfile = new DiskStorageManager(ps);
71
            rtree = createRTree();
72
        } catch (SecurityException e) {
73
            throw new InitializeException(e);
74
        } catch (FileNotFoundException e) {
75
            throw new InitializeException(e);
76
        } catch (IOException e) {
77
            throw new InitializeException(e);
78
        }
79
    }
80

  
81
    /**
82
     * If the spatial index file exists and has content
83
     */
84
    public boolean exists() {
85
        return (new File(fileName + ".dat").length() != 0);
86
    }
87

  
88
    class RTreeVisitor implements IVisitor {
89

  
90
        ArrayList solution = new ArrayList();
91

  
92
        public void visitNode(INode n) {
93
        }
94

  
95
        public void visitData(IData d) {
96
            solution.add(new Integer(d.getIdentifier()));
97
        }
98

  
99
        public List getSolution() {
100
            return solution;
101
        }
102
    }
103

  
104
    public List containtmentQuery(Envelope env) {
105
        List solution = null;
106
        Region region = createRegion(env);
107
        RTreeVisitor visitor = new RTreeVisitor();
108
        rtree.containmentQuery(region, visitor);
109
        solution = visitor.getSolution();
110
        return solution;
111
    }
112

  
113
    /**
114
     * Warn! This RTree implemention doesnt care if 'index' entry has been
115
     * indexed yet
116
     */
117
    public void insert(Envelope env, int index) {
118
        rtree.insertData(null, createRegion(env), index);
119
    }
120

  
121
    private Region createRegion(Envelope env) {
122
        double[] x = new double[2];
123
        double[] y = new double[2];
124
        x[0] = env.getLowerCorner().getX();
125
        y[0] = env.getLowerCorner().getY();
126
        x[1] = env.getUpperCorner().getX();
127
        y[1] = env.getUpperCorner().getY();
128
        return new Region(x, y);
129
    }
130

  
131
    /**
132
     * Looks for N indexes nearest to the specified rect.
133
     * 
134
     * @param numberOfNearest
135
     * @param rect
136
     * @return
137
     */
138
    public List findNNearest(int numberOfNearest, Envelope env) {
139
        List solution = null;
140
        Region region = createRegion(env);
141
        RTreeVisitor visitor = new RTreeVisitor();
142
        rtree.nearestNeighborQuery(numberOfNearest, region, visitor);
143
        solution = visitor.getSolution();
144
        return solution;
145
    }
146

  
147
    /**
148
     * Looks for the N indexes nearest to the specified point
149
     * 
150
     * @param numberOfNearest
151
     * @param point
152
     * @return
153
     */
154
    public List findNNearest(int numberOfNearest, Point point) {
155
        List solution = null;
156
        spatialindex.spatialindex.Point sptPoint =
157
            new spatialindex.spatialindex.Point(new double[] { point.getX(),
158
                point.getY() });
159
        RTreeVisitor visitor = new RTreeVisitor();
160
        rtree.nearestNeighborQuery(numberOfNearest, sptPoint, visitor);
161
        solution = visitor.getSolution();
162
        return solution;
163
    }
164

  
165
    public void flush() {
166
        rtree.flush();
167
    }
168

  
169
    private RTree createRTree() {
170
        // applies a main memory random buffer on top of the persistent
171
        // storage manager
172
        IBuffer buffer =
173
            new RandomEvictionsBuffer(diskfile, BUFFER_SIZE, false);
174

  
175
        // Create a new, empty, RTree with dimensionality 2, minimum load
176
        // 70%, using "file" as
177
        // the StorageManager and the RSTAR splitting policy.
178
        PropertySet ps2 = new PropertySet();
179

  
180
        Double f = new Double(defaultFillFactor);
181
        ps2.setProperty("FillFactor", f);
182

  
183
        Integer i = new Integer(2);
184
        ps2.setProperty("Dimension", i);
185

  
186
        File file = new File(fileName + ".dat");
187
        if (file.length() != 0) {
188
            ps2.setProperty("IndexIdentifier", new Integer(1));
189
        }
190
        return new RTree(ps2, buffer);
191
    }
192

  
193
    public void load(File f) throws FeatureIndexException {
194
        createRTree();
195
    }
196

  
197
    public void flush(File f) throws FeatureIndexException {
198
        flush();
199
    }
200

  
201
    public void close() {
202
    }
203

  
204
    public File getFile() {
205
        return new File(fileName + ".dat");
206
    }
207

  
208
    public void delete(Object value, FeatureReferenceProviderServices fref) {
209
        rtree.deleteData(createRegion(((Geometry) value).getEnvelope()),
210
            ((Integer) fref.getOID()).intValue());
211
    }
212

  
213
    public void insert(Object value, FeatureReferenceProviderServices fref) {
214
        Envelope env = null;
215
        if (value instanceof Envelope) {
216
            env = (Envelope) value;
217
        } else
218
            if (value instanceof Geometry) {
219
                env = ((Geometry) value).getEnvelope();
220
            }
221
        rtree.insertData(null, createRegion(env),
222
            ((Integer) fref.getOID()).intValue());
223
    }
224

  
225
    public List match(Object value) throws FeatureIndexException {
226
        List solution = null;
227
        Envelope env = null;
228
        if (value instanceof Envelope) {
229
            env = (Envelope) value;
230
        } else
231
            if (value instanceof Geometry) {
232
                env = ((Geometry) value).getEnvelope();
233
            }
234
        Region region = createRegion(env);
235
        RTreeVisitor visitor = new RTreeVisitor();
236
        rtree.intersectionQuery(region, visitor);
237
        solution = visitor.getSolution();
238
        return new LongList(solution);
239
    }
240

  
241
    public List match(Object min, Object max) {
242
        throw new UnsupportedOperationException();
243
    }
244

  
245
    public List nearest(int count, Object value) throws FeatureIndexException {
246
        if (value instanceof Envelope) {
247
            return this.findNNearest(count, (Envelope) value);
248
        } else
249
            if (value instanceof Point) {
250
                return this.findNNearest(count, (Point) value);
251
            } else
252
                if (value instanceof Geometry) {
253
                    return this.findNNearest(count,
254
                        ((Geometry) value).getEnvelope());
255
                } else {
256
                    throw new IllegalArgumentException(
257
                        "value must be either an Envelope or either a Point2D");
258
                }
259
    }
260

  
261
    public boolean isMatchSupported() {
262
        return true;
263
    }
264

  
265
    public boolean isNearestSupported() {
266
        return true;
267
    }
268

  
269
    public boolean isNearestToleranceSupported() {
270
        return false;
271
    }
272

  
273
    public boolean isRangeSupported() {
274
        // TODO Auto-generated method stub
275
        return false;
276
    }
277

  
278
    public List nearest(int count, Object value, Object tolerance)
279
        throws FeatureIndexException {
280
        throw new UnsupportedOperationException();
281
    }
282

  
283
    public List range(Object value1, Object value2)
284
        throws FeatureIndexException {
285
        throw new UnsupportedOperationException();
286
    }
287

  
288
    public void clear() throws DataException {
289
        rtree = createRTree();
290
    }
291
}
tags/v2_0_0_Build_2050/libraries/libFMap_dalindex/src/org/gvsig/fmap/dal/index/spatial/gt2/Gt2IndexLibrary.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
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 2
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
*/
22

  
23
/*
24
* AUTHORS (In addition to CIT):
25
* 2008 {{Company}}   {{Task}}
26
*/
27

  
28

  
29
package org.gvsig.fmap.dal.index.spatial.gt2;
30

  
31
import org.gvsig.fmap.dal.DALLibrary;
32
import org.gvsig.fmap.dal.DALLocator;
33
import org.gvsig.fmap.dal.DataTypes;
34
import org.gvsig.fmap.dal.spi.DataManagerProviderServices;
35
import org.gvsig.tools.library.AbstractLibrary;
36
import org.gvsig.tools.library.LibraryException;
37

  
38
public class Gt2IndexLibrary extends AbstractLibrary {
39

  
40
    @Override
41
    public void doRegistration() {
42
        registerAsServiceOf(DALLibrary.class);
43
    }
44

  
45
	@Override
46
	protected void doInitialize() throws LibraryException {
47
	}
48

  
49
	@Override
50
	protected void doPostInitialize() throws LibraryException {
51
    	DataManagerProviderServices man = (DataManagerProviderServices) DALLocator.getDataManager();
52

  
53
    	if (!man.getFeatureIndexProviders().contains(GT2Quadtree.NAME)) {
54
			man.registerFeatureIndexProvider(GT2Quadtree.NAME, "Quadtree index based on Geotools 2",
55
					GT2Quadtree.class, DataTypes.GEOMETRY);
56
    	}
57
	}
58
}
tags/v2_0_0_Build_2050/libraries/libFMap_dalindex/src/org/gvsig/fmap/dal/index/spatial/gt2/GT2Quadtree.java
1
/*
2
 * Created on 16-may-2006
3
 *
4
 * gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
5
 *
6
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
7
 *
8
 * This program is free software; you can redistribute it and/or
9
 * modify it under the terms of the GNU General Public License
10
 * as published by the Free Software Foundation; either version 2
11
 * of the License, or (at your option) any later version.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU General Public License
19
 * along with this program; if not, write to the Free Software
20
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
21
 *
22
 * For more information, contact:
23
 *
24
 *  Generalitat Valenciana
25
 *   Conselleria d'Infraestructures i Transport
26
 *   Av. Blasco Ib��ez, 50
27
 *   46010 VALENCIA
28
 *   SPAIN
29
 *
30
 *      +34 963862235
31
 *   gvsig@gva.es
32
 *      www.gvsig.gva.es
33
 *
34
 *    or
35
 *
36
 *   IVER T.I. S.A
37
 *   Salamanca 50
38
 *   46005 Valencia
39
 *   Spain
40
 *
41
 *   +34 963163400
42
 *   dac@iver.es
43
 */
44
/* CVS MESSAGES:
45
 *
46
 * $Id: QuadtreeGt2.java 10627 2007-03-06 17:10:21Z caballero $
47
 * $Log$
48
 * Revision 1.3  2007-03-06 17:08:59  caballero
49
 * Exceptions
50
 *
51
 * Revision 1.2  2006/11/29 19:27:59  azabala
52
 * bug fixed (caused when we query for a bbox which is greater or equal to a layer bbox)
53
 *
54
 * Revision 1.1  2006/05/24 21:58:04  azabala
55
 * *** empty log message ***
56
 *
57
 *
58
 */
59
package org.gvsig.fmap.dal.index.spatial.gt2;
60

  
61
import java.io.File;
62
import java.io.IOException;
63
import java.util.List;
64
import java.util.Stack;
65

  
66
import com.vividsolutions.jts.geom.Envelope;
67

  
68
import org.geotools.index.quadtree.Node;
69
import org.geotools.index.quadtree.QuadTree;
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff