Revision 47610
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/spatialindex/SpatialIndexJTSQuadtree.java | ||
---|---|---|
34 | 34 |
import java.io.InputStream; |
35 | 35 |
import java.io.ObjectInputStream; |
36 | 36 |
import java.io.ObjectStreamClass; |
37 |
import java.util.Collections; |
|
37 | 38 |
import java.util.Iterator; |
38 | 39 |
import java.util.List; |
39 | 40 |
import java.util.Objects; |
... | ... | |
129 | 130 |
@Override |
130 | 131 |
public void query(org.gvsig.fmap.geom.primitive.Envelope envelope, |
131 | 132 |
Visitor visitor) { |
133 |
if(envelope == null || envelope.isEmpty()){ |
|
134 |
return; |
|
135 |
} |
|
132 | 136 |
com.vividsolutions.jts.index.ItemVisitor visitor_jts = new JTSVisitorWrapper(visitor); |
133 | 137 |
com.vividsolutions.jts.geom.Envelope env_jts = asJTS(envelope.getGeometry()).getEnvelopeInternal(); |
134 | 138 |
this.index.query(env_jts, visitor_jts); |
... | ... | |
140 | 144 |
if( limit>0 && limit!=Long.MAX_VALUE ) { |
141 | 145 |
throw new UnsupportedOperationException("Not supported yet."); |
142 | 146 |
} |
147 |
if(envelope == null || envelope.isEmpty()){ |
|
148 |
return Collections.emptyIterator(); |
|
149 |
} |
|
143 | 150 |
com.vividsolutions.jts.geom.Envelope env_jts = asJTS(envelope.getGeometry()).getEnvelopeInternal(); |
144 | 151 |
List result = this.index.query(env_jts); |
145 | 152 |
return result.iterator(); |
... | ... | |
158 | 165 |
|
159 | 166 |
@Override |
160 | 167 |
public void insert(org.gvsig.fmap.geom.primitive.Envelope envelope, Object data) { |
168 |
if(envelope == null || envelope.isEmpty()){ |
|
169 |
return; |
|
170 |
} |
|
161 | 171 |
com.vividsolutions.jts.geom.Envelope env_jts = asJTS(envelope.getGeometry()).getEnvelopeInternal(); |
162 | 172 |
index.insert(env_jts, data); |
163 | 173 |
this.modified = true; |
... | ... | |
165 | 175 |
|
166 | 176 |
@Override |
167 | 177 |
public boolean remove(org.gvsig.fmap.geom.primitive.Envelope envelope, Object data) { |
178 |
if(envelope == null || envelope.isEmpty()){ |
|
179 |
return false; |
|
180 |
} |
|
168 | 181 |
com.vividsolutions.jts.geom.Envelope env_jts = asJTS(envelope.getGeometry()).getEnvelopeInternal(); |
169 | 182 |
this.modified = true; |
170 | 183 |
return index.remove(env_jts, data); |
Also available in: Unified diff