org.gvsig.fmap.dal.index.spatial.gt2
Class GT2Quadtree

java.lang.Object
  extended by org.gvsig.fmap.dal.feature.spi.index.AbstractFeatureIndexProvider
      extended by org.gvsig.fmap.dal.index.spatial.gt2.GT2Quadtree
All Implemented Interfaces:
org.gvsig.fmap.dal.feature.spi.index.FeatureIndexProvider

public class GT2Quadtree
extends org.gvsig.fmap.dal.feature.spi.index.AbstractFeatureIndexProvider
implements org.gvsig.fmap.dal.feature.spi.index.FeatureIndexProvider

This Quadtree spatial index implementation is based in a fork of org.geotools.index.quadtree.Quadtree implementation.
This implementation offers us:

  1. Persistence of spatial index
We had to fork geotools quadtree for many reasons:
  1. It was strongly dependent of SHP format, so it returned not only a num of rectangle, it also returned byte offset of this rectangle in shp file
  2. Query artifact wasnt run well at all

Author:
azabala

Nested Class Summary
 
Nested classes/interfaces inherited from class org.gvsig.fmap.dal.feature.spi.index.AbstractFeatureIndexProvider
org.gvsig.fmap.dal.feature.spi.index.AbstractFeatureIndexProvider.LongList
 
Field Summary
static String NAME
           
 
Constructor Summary
GT2Quadtree()
           
 
Method Summary
 void clear()
           
 void delete(org.gvsig.fmap.geom.primitive.Envelope env, int index)
           
 void delete(Object value, org.gvsig.fmap.dal.feature.spi.FeatureReferenceProviderServices fref)
           
 boolean exists()
          If the spatial index file exists and has content
 void flush()
           
 void flush(File f)
           
 File getFile()
           
 void initialize()
           
 void insert(org.gvsig.fmap.geom.primitive.Envelope env, int index)
          Inserts an object in the index
 void insert(Object value, org.gvsig.fmap.dal.feature.spi.FeatureReferenceProviderServices fref)
           
 boolean isMatchSupported()
           
 boolean isNearestSupported()
           
 boolean isNearestToleranceSupported()
           
 boolean isRangeSupported()
           
 void load()
           
 void load(File f)
           
 List match(Object value)
           
 List nearest(int count, Object value)
           
 List nearest(int count, Object value, Object tolerance)
           
 List range(Object value1, Object value2)
           
 com.vividsolutions.jts.geom.Envelope toJtsEnvelope(org.gvsig.fmap.geom.primitive.Envelope env)
           
 
Methods inherited from class org.gvsig.fmap.dal.feature.spi.index.AbstractFeatureIndexProvider
allowNulls, getFeatureIndexProviderServices, setFeatureIndexProviderServices
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.gvsig.fmap.dal.feature.spi.index.FeatureIndexProvider
allowNulls, setFeatureIndexProviderServices
 

Field Detail

NAME

public static final String NAME
Constructor Detail

GT2Quadtree

public GT2Quadtree()
Method Detail

initialize

public void initialize()
                throws org.gvsig.fmap.dal.exception.InitializeException
Specified by:
initialize in interface org.gvsig.fmap.dal.feature.spi.index.FeatureIndexProvider
Overrides:
initialize in class org.gvsig.fmap.dal.feature.spi.index.AbstractFeatureIndexProvider
Throws:
org.gvsig.fmap.dal.exception.InitializeException

exists

public boolean exists()
If the spatial index file exists and has content


load

public void load()
          throws org.gvsig.fmap.dal.feature.exception.FeatureIndexException
Throws:
org.gvsig.fmap.dal.feature.exception.FeatureIndexException

load

public void load(File f)
          throws org.gvsig.fmap.dal.feature.exception.FeatureIndexException
Throws:
org.gvsig.fmap.dal.feature.exception.FeatureIndexException

insert

public void insert(org.gvsig.fmap.geom.primitive.Envelope env,
                   int index)
Inserts an object in the index


delete

public void delete(org.gvsig.fmap.geom.primitive.Envelope env,
                   int index)

toJtsEnvelope

public com.vividsolutions.jts.geom.Envelope toJtsEnvelope(org.gvsig.fmap.geom.primitive.Envelope env)

flush

public void flush()
           throws org.gvsig.fmap.dal.feature.exception.FeatureIndexException
Throws:
org.gvsig.fmap.dal.feature.exception.FeatureIndexException

flush

public void flush(File f)
           throws org.gvsig.fmap.dal.feature.exception.FeatureIndexException
Throws:
org.gvsig.fmap.dal.feature.exception.FeatureIndexException

getFile

public File getFile()

delete

public void delete(Object value,
                   org.gvsig.fmap.dal.feature.spi.FeatureReferenceProviderServices fref)
Specified by:
delete in interface org.gvsig.fmap.dal.feature.spi.index.FeatureIndexProvider

insert

public void insert(Object value,
                   org.gvsig.fmap.dal.feature.spi.FeatureReferenceProviderServices fref)
Specified by:
insert in interface org.gvsig.fmap.dal.feature.spi.index.FeatureIndexProvider

match

public List match(Object value)
           throws org.gvsig.fmap.dal.feature.exception.FeatureIndexException
Specified by:
match in interface org.gvsig.fmap.dal.feature.spi.index.FeatureIndexProvider
Throws:
org.gvsig.fmap.dal.feature.exception.FeatureIndexException

nearest

public List nearest(int count,
                    Object value)
             throws org.gvsig.fmap.dal.feature.exception.FeatureIndexException
Specified by:
nearest in interface org.gvsig.fmap.dal.feature.spi.index.FeatureIndexProvider
Throws:
org.gvsig.fmap.dal.feature.exception.FeatureIndexException

isMatchSupported

public boolean isMatchSupported()
Specified by:
isMatchSupported in interface org.gvsig.fmap.dal.feature.spi.index.FeatureIndexProvider

isNearestSupported

public boolean isNearestSupported()
Specified by:
isNearestSupported in interface org.gvsig.fmap.dal.feature.spi.index.FeatureIndexProvider

isNearestToleranceSupported

public boolean isNearestToleranceSupported()
Specified by:
isNearestToleranceSupported in interface org.gvsig.fmap.dal.feature.spi.index.FeatureIndexProvider

isRangeSupported

public boolean isRangeSupported()
Specified by:
isRangeSupported in interface org.gvsig.fmap.dal.feature.spi.index.FeatureIndexProvider

nearest

public List nearest(int count,
                    Object value,
                    Object tolerance)
             throws org.gvsig.fmap.dal.feature.exception.FeatureIndexException
Specified by:
nearest in interface org.gvsig.fmap.dal.feature.spi.index.FeatureIndexProvider
Throws:
org.gvsig.fmap.dal.feature.exception.FeatureIndexException

range

public List range(Object value1,
                  Object value2)
           throws org.gvsig.fmap.dal.feature.exception.FeatureIndexException
Specified by:
range in interface org.gvsig.fmap.dal.feature.spi.index.FeatureIndexProvider
Throws:
org.gvsig.fmap.dal.feature.exception.FeatureIndexException

clear

public void clear()
           throws org.gvsig.fmap.dal.exception.DataException
Specified by:
clear in interface org.gvsig.fmap.dal.feature.spi.index.FeatureIndexProvider
Throws:
org.gvsig.fmap.dal.exception.DataException


Copyright © 2004-2013 gvSIG. All Rights Reserved.