Revision 37262

View differences:

tags/v2_0_0_Build_2040/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
	<groupId>org.gvsig</groupId>
8
	<artifactId>org.gvsig.fmap.dal.index.spatial
9
	</artifactId>
10
	<packaging>jar</packaging>
11
	<version>2.0-SNAPSHOT</version>
12
	<name>libFMap_dalindex</name>
13
	<url>http://gvsig.org</url>
14
	<parent>
15
		<groupId>org.gvsig</groupId>
16
		<artifactId>gvsig-base-library-pom</artifactId>
17
		<version>2.0-SNAPSHOT</version>
18
	</parent>	
19
	<distributionManagement>
20
		<site>
21
			<id>gvsig-repository</id>
22
			<url>${site-repository}/</url>
23
		</site>
24
	</distributionManagement>
25

  
26

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

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

  
38
		<!-- jsi -->
39
		<jsi-jarIncludes>org/gvsig/fmap/dal/index/spatial/jsi/**
40
		</jsi-jarIncludes>
41
		<jsi-jarExcludes>NONE</jsi-jarExcludes>
42

  
43
		<!-- spatialindex -->
44
		<sptidx-jarIncludes>org/gvsig/fmap/dal/index/spatial/spatialindex/**
45
		</sptidx-jarIncludes>
46
		<sptidx-jarExcludes>NONE</sptidx-jarExcludes>
47

  
48
		<build-dir>${basedir}/../build</build-dir>
49
        <eclipse.project.name>libFMap_dalindex</eclipse.project.name>
50
	</properties>
51

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

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

  
283
				</plugins>
284
			</build>
285
		</profile>
286
		<profile>
287
			<id>cdc</id>
288
			<activation>
289
				<activeByDefault>false</activeByDefault>
290
			</activation>
291
			<build>
292

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

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

  
370

  
371
</project>
tags/v2_0_0_Build_2040/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_2040/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_2040/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_2040/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_2040/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;
70
import org.geotools.index.quadtree.StoreException;
71
import org.geotools.index.quadtree.fs.FileSystemIndexStore;
72
import org.geotools.index.quadtree.fs.IndexHeader;
73

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

  
85
/**
86
 * This Quadtree spatial index implementation is based in a fork of
87
 * org.geotools.index.quadtree.Quadtree implementation. <br>
88
 * This implementation offers us:
89
 * <ol>
90
 * <li>Persistence of spatial index</li>
91
 * </ol>
92
 * We had to fork geotools quadtree for many reasons:
93
 * <ol>
94
 * <li>It was strongly dependent of SHP format, so it returned not only a num of
95
 * rectangle, it also returned byte offset of this rectangle in shp file</li>
96
 * <li>Query artifact wasnt run well at all</li>
97
 * </ol>
98
 * 
99
 * @author azabala
100
 * 
101
 */
102
public class GT2Quadtree extends AbstractFeatureIndexProvider implements
103
    FeatureIndexProvider {
104

  
105
    public static final String NAME = GT2Quadtree.class.getSimpleName();
106
    /**
107
     * Geotools quadtree implementation
108
     */
109
    QuadTree quadtree;
110
    /**
111
     * Persistent storage
112
     */
113
    String fileName;
114
    /**
115
     * Spatial index file extension
116
     */
117
    final String qExt = ".qix";
118
    /**
119
     * qix format has many versions, and allows different byte orders.
120
     */
121
    String byteOrder;
122
    /**
123
     * Bounds of the layer to index
124
     */
125
    // Envelope bounds;
126
    /**
127
     * Number of records of the layer to index
128
     */
129
    // int numRecs = 0;
130

  
131
    boolean inMemory = false;
132

  
133
    public GT2Quadtree() {
134

  
135
    }
136

  
137
    @Override
138
    public void initialize() throws InitializeException {
139
        try {
140
            File file =
141
                File.createTempFile(getFeatureStore().getName(), ".qix");
142
            this.fileName = file.getAbsolutePath();
143
            this.byteOrder = "NM";
144
            this.quadtree = createQuadTree();
145
            if (exists()) {
146
                load();
147
            }
148
        } catch (IOException e) {
149
            throw new InitializeException(e);
150
        } catch (BaseException e) {
151
            throw new InitializeException(e);
152
        }
153
    }
154

  
155
    /**
156
     * @return
157
     * @throws DataException
158
     */
159
    private QuadTree createQuadTree() throws DataException {
160
        org.gvsig.fmap.geom.primitive.Envelope env =
161
            getFeatureStore().getEnvelope();
162
        int featureCount = (int) getFeatureStore().getFeatureCount();
163
        return new QuadTree(featureCount, toJtsEnvelope(env));
164
    }
165

  
166
    /**
167
     * If the spatial index file exists and has content
168
     */
169
    public boolean exists() {
170
        return (new File(fileName).length() != 0);
171
    }
172

  
173
    public void load() throws FeatureIndexException {
174
        if (quadtree == null) {
175
            load(new File(fileName));
176
        }
177
    }
178

  
179
    public void load(File f) throws FeatureIndexException {
180
        try {
181
            FileSystemIndexStore store = new FileSystemIndexStore(f);
182
            quadtree = store.load();
183
            this.fileName = f.getAbsolutePath();
184
        } catch (StoreException e) {
185
            throw new FeatureIndexException(e);
186
        }
187
    }
188

  
189
    /**
190
     * Inserts an object in the index
191
     */
192
    public void insert(org.gvsig.fmap.geom.primitive.Envelope env, int index) {
193
        if (env == null) {
194
            throw new IllegalArgumentException("Envelope cannot be null");
195
        }
196
        Envelope e = toJtsEnvelope(env);
197
        if (e == null) {
198
            throw new IllegalStateException(
199
                "JTS Envelope conversion returns null");
200
        }
201
        System.out.println("recno=" + index);
202
        if (quadtree == null) {
203
            throw new IllegalStateException("quadtree is null");
204
        }
205
        try {
206
            quadtree.insert(index, toJtsEnvelope(env));
207
        } catch (StoreException se) {
208
            // TODO Auto-generated catch block
209
            se.printStackTrace();
210
        }
211
    }
212

  
213
    public void delete(org.gvsig.fmap.geom.primitive.Envelope env, int index) {
214
        if (inMemory) {
215
            quadtree.delete(toJtsEnvelope(env), index);
216
        }
217
    }
218

  
219
    public Envelope toJtsEnvelope(org.gvsig.fmap.geom.primitive.Envelope env) {
220
        if (env == null) {
221
            return null;
222
        }
223
        Point min = env.getLowerCorner();
224
        Point max = env.getUpperCorner();
225

  
226
        return new Envelope(min.getX(), max.getX(), min.getY(), max.getY());
227
    }
228

  
229
    /**
230
     * 
231
     * @throws StoreException
232
     * @deprecated
233
     */
234
    @Deprecated
235
    void openQuadTree() throws StoreException {
236
        if (quadtree == null) {
237
            File file = new File(this.fileName);
238
            // Intento de cargar todo el quadtree en memoria
239
            FileSystemIndexStore store = new FileSystemIndexStore(file);
240
            quadtree = store.load();
241
        }
242
    }
243

  
244
    void openQuadTreeInMemory() throws StoreException {
245
        if (quadtree == null) {
246
            File file = new File(fileName);
247
            // Intento de cargar todo el quadtree en memoria
248
            FileSystemIndexStore store = new FileSystemIndexStore(file);
249
            QuadTree filequadtree = store.load();
250
            quadtree =
251
                new QuadTree(filequadtree.getNumShapes(),
252
                    filequadtree.getMaxDepth(), filequadtree.getRoot()
253
                        .getBounds());
254
            Stack nodes = new Stack();
255
            nodes.push(filequadtree.getRoot());
256
            while (nodes.size() != 0) {
257
                Node node = (Node) nodes.pop();
258
                Envelope nodeEnv = node.getBounds();
259
                int[] shapeIds = node.getShapesId();
260
                for (int i = 0; i < shapeIds.length; i++) {
261
                    quadtree.insert(shapeIds[i], nodeEnv);
262
                }
263
                int numSubnodes = node.getNumSubNodes();
264
                for (int i = 0; i < numSubnodes; i++) {
265
                    nodes.push(node.getSubNode(i));
266
                }
267
            }// while
268
            filequadtree.close();
269
        }
270
    }
271

  
272
    public void flush() throws FeatureIndexException {
273
        flush(new File(fileName));
274
    }
275

  
276
    public void flush(File f) throws FeatureIndexException {
277
        byte order = 0;
278
        if ((byteOrder == null) || byteOrder.equalsIgnoreCase("NM")) {
279
            order = IndexHeader.NEW_MSB_ORDER;
280
        } else
281
            if (byteOrder.equalsIgnoreCase("NL")) {
282
                order = IndexHeader.NEW_LSB_ORDER;
283
            }
284
        FileSystemIndexStore store = new FileSystemIndexStore(f, order);
285
        try {
286
            store.store(quadtree);
287
            this.fileName = f.getAbsolutePath();
288
        } catch (StoreException e) {
289
            throw new FeatureIndexException(e);
290
        }
291
    }
292

  
293
    public File getFile() {
294
        return new File(this.fileName);
295
    }
296

  
297
    private FeatureStore getFeatureStore() {
298
        return getFeatureIndexProviderServices()
299
            .getFeatureStoreProviderServices().getFeatureStore();
300
    }
301

  
302
    public void delete(Object value, FeatureReferenceProviderServices fref) {
303

  
304
        if (!isCompatibleOID(fref.getOID())) {
305
            throw new IllegalArgumentException(
306
                "OID not compatible. Must be an instance of Number within the Integer range.");
307
        }
308

  
309
        delete(((org.gvsig.fmap.geom.Geometry) value).getEnvelope(),
310
            ((Number) fref.getOID()).intValue());
311
    }
312

  
313
    public void insert(Object value, FeatureReferenceProviderServices fref) {
314

  
315
        if (!isCompatibleOID(fref.getOID())) {
316
            throw new IllegalArgumentException(
317
                "OID not compatible. Must be an instance of Number within the Integer range.");
318
        }
319

  
320
        insert(((org.gvsig.fmap.geom.Geometry) value).getEnvelope(),
321
            ((Number) fref.getOID()).intValue());
322
    }
323

  
324
    public List match(Object value) throws FeatureIndexException {
325
        if (quadtree == null) {
326
            throw new IllegalStateException("This quadtree is null.");
327
        }
328
        if (value == null) {
329
            throw new IllegalArgumentException("Envelope cannot be null.");
330
        }
331
        if (!(value instanceof org.gvsig.fmap.geom.primitive.Envelope)) {
332
            throw new IllegalArgumentException("Not an envelope.");
333
        }
334
        org.gvsig.fmap.geom.primitive.Envelope env = null;
335
        if (value instanceof org.gvsig.fmap.geom.primitive.Envelope) {
336
            env = (org.gvsig.fmap.geom.primitive.Envelope) value;
337
        } else
338
            if (value instanceof Geometry) {
339
                env = ((Geometry) value).getEnvelope();
340
            }
341
        return new LongList(quadtree.query(toJtsEnvelope(env)));
342
    }
343

  
344
    public List nearest(int count, Object value) throws FeatureIndexException {
345
        throw new UnsupportedOperationException();
346
    }
347

  
348
    public boolean isMatchSupported() {
349
        return true;
350
    }
351

  
352
    public boolean isNearestSupported() {
353
        return false;
354
    }
355

  
356
    public boolean isNearestToleranceSupported() {
357
        return false;
358
    }
359

  
360
    public boolean isRangeSupported() {
361
        return false;
362
    }
363

  
364
    public List nearest(int count, Object value, Object tolerance)
365
        throws FeatureIndexException {
366
        throw new UnsupportedOperationException();
367
    }
368

  
369
    public List range(Object value1, Object value2)
370
        throws FeatureIndexException {
371
        throw new UnsupportedOperationException();
372
    }
373

  
374
    /**
375
     * Indicates whether the given OID's type is compatible
376
     * with this provider
377
     * 
378
     * @param oid
379
     * 
380
     * @return
381
     *         true if this index provider supports the given oid type
382
     */
383
    private boolean isCompatibleOID(Object oid) {
384
        if (!(oid instanceof Number)) {
385
            return false;
386
        }
387

  
388
        long num = ((Number) oid).longValue();
389

  
390
        if ((num > Integer.MAX_VALUE) || (num < Integer.MIN_VALUE)) {
391
            return false;
392
        }
393

  
394
        return true;
395
    }
396

  
397
    public void clear() throws DataException {
398
        this.quadtree = createQuadTree();
399
    }
400

  
401
}
tags/v2_0_0_Build_2040/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_2040/libraries/libFMap_dalindex/src/org/gvsig/fmap/dal/index/spatial/jts/JTSQuadtree.java
1
/*
2
 * Created on 28-abr-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: QuadtreeJts.java 11288 2007-04-19 17:32:50Z azabala $
47
 * $Log$
48
 * Revision 1.2  2007-04-19 17:32:50  azabala
49
 * new constructor (fmap spatial index from an existing jts spatial index)
50
 *
51
 * Revision 1.1  2006/05/01 18:38:41  azabala
52
 * primera version en cvs del api de indices espaciales
53
 *
54
 *
55
 */
56
package org.gvsig.fmap.dal.index.spatial.jts;
57

  
58
import java.util.List;
59

  
60
import com.vividsolutions.jts.geom.Envelope;
61
import com.vividsolutions.jts.index.quadtree.Quadtree;
62

  
63
import org.gvsig.fmap.dal.exception.DataException;
64
import org.gvsig.fmap.dal.feature.exception.FeatureIndexException;
65
import org.gvsig.fmap.dal.feature.spi.FeatureReferenceProviderServices;
66
import org.gvsig.fmap.dal.feature.spi.index.AbstractFeatureIndexProvider;
67
import org.gvsig.fmap.dal.feature.spi.index.FeatureIndexProvider;
68
import org.gvsig.fmap.geom.Geometry;
69
import org.gvsig.fmap.geom.primitive.NullGeometry;
70
import org.gvsig.fmap.geom.primitive.Point;
71

  
72
/**
73
 * Adapter for ISPatialIndex gvSIG's interface to
74
 * JTS Quadtree.
75
 * 
76
 * 
77
 * @author azabala
78
 * 
79
 */
80
public class JTSQuadtree extends AbstractFeatureIndexProvider implements
81
    FeatureIndexProvider {
82

  
83
    public static final String NAME = JTSQuadtree.class.getName();
84

  
85
    private Quadtree quadtree;
86

  
87
    public JTSQuadtree() {
88
    }
89

  
90
    public void initialize() {
91
        quadtree = createQuadtree();
92
    }
93

  
94
    private Quadtree createQuadtree() {
95
        return new Quadtree();
96
    }
97

  
98
    private Envelope fromEnvelope(org.gvsig.fmap.geom.primitive.Envelope env) {
99
        Point min = env.getLowerCorner();
100
        Point max = env.getUpperCorner();
101
        Envelope env2 =
102
            new Envelope(min.getX(), max.getX(), min.getY(), max.getY());
103
        return env2;
104
    }
105

  
106
    public void delete(Object o, FeatureReferenceProviderServices fref) {
107
        Integer integer = new Integer(((Long) (fref).getOID()).intValue());
108
        quadtree.remove(fromEnvelope(((Geometry) o).getEnvelope()), integer);
109
    }
110

  
111
    public void insert(Object o, FeatureReferenceProviderServices fref) {
112
        if (o == null || o instanceof NullGeometry) {
113
            return;
114
        }
115
        Integer integer = new Integer(((Long) (fref).getOID()).intValue());
116
        quadtree.insert(fromEnvelope(((Geometry) o).getEnvelope()), integer);
117

  
118
    }
119

  
120
    public List match(Object value) throws FeatureIndexException {
121
        org.gvsig.fmap.geom.primitive.Envelope env = null;
122
        if (value instanceof org.gvsig.fmap.geom.primitive.Envelope) {
123
            env = (org.gvsig.fmap.geom.primitive.Envelope) value;
124
        } else
125
            if (value instanceof Geometry) {
126
                env = ((Geometry) value).getEnvelope();
127
            }
128
        return new LongList(quadtree.query(fromEnvelope(env)));
129
    }
130

  
131
    public List match(Object min, Object max) {
132
        throw new UnsupportedOperationException(
133
            "Can't perform this kind of search.");
134
    }
135

  
136
    public List nearest(int count, Object value) throws FeatureIndexException {
137
        throw new UnsupportedOperationException(
138
            "Can't perform this kind of search.");
139
    }
140

  
141
    public boolean isMatchSupported() {
142
        return true;
143
    }
144

  
145
    public boolean isNearestSupported() {
146
        return false;
147
    }
148

  
149
    public boolean isNearestToleranceSupported() {
150
        return false;
151
    }
152

  
153
    public boolean isRangeSupported() {
154
        return false;
155
    }
156

  
157
    public List nearest(int count, Object value, Object tolerance)
158
        throws FeatureIndexException {
159
        throw new UnsupportedOperationException();
160
    }
161

  
162
    public List range(Object value1, Object value2)
163
        throws FeatureIndexException {
164
        throw new UnsupportedOperationException();
165
    }
166

  
167
    public void clear() throws DataException {
168
        quadtree = createQuadtree();
169
    }
170
}
tags/v2_0_0_Build_2040/libraries/libFMap_dalindex/src/org/gvsig/fmap/dal/index/spatial/jts/JTSIndexLibrary.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.jts;
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 JTSIndexLibrary extends AbstractLibrary {
38

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

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

  
47
	protected void doPostInitialize() throws LibraryException {
48
    	DataManagerProviderServices man = (DataManagerProviderServices) DALLocator.getDataManager();
49

  
50

  
51
    	if (!man.getFeatureIndexProviders().contains(JTSQuadtree.NAME)) {
52
			man.registerFeatureIndexProvider(JTSQuadtree.NAME, "Quadtree index based on JTS",
53
					JTSQuadtree.class, DataTypes.GEOMETRY);
54
			man.setDefaultFeatureIndexProviderName(DataTypes.GEOMETRY, JTSQuadtree.NAME);
55
    	}
56
	}
57
}
58

  
tags/v2_0_0_Build_2040/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_2040/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;
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff