Revision 5226

View differences:

trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/FLyrVect.java
1021 1021
	 * this.selectionSupport = selectionSupport; }
1022 1022
	 */
1023 1023

  
1024
	public SpatialCache getSpatialCache() {
1025
        if (spatialCache == null)
1026
        {
1027
        	spatialCache = new SpatialCache();
1028
        }
1024
	public SpatialCache createSpatialCache() {
1025
       	spatialCache = new SpatialCache();
1029 1026
		return spatialCache;
1030 1027
	}
1031 1028

  
1032
	public void setSpatialCache(SpatialCache spatialCache) {
1033
		this.spatialCache = spatialCache;
1034
	}
1029
//	public void setSpatialCache(SpatialCache spatialCache) {
1030
//		this.spatialCache = spatialCache;
1031
//	}
1035 1032

  
1036 1033
	public boolean isSpatialCacheEnabled() {
1037 1034
		return spatialCacheEnabled;
......
1041 1038
		this.spatialCacheEnabled = spatialCacheEnabled;
1042 1039
	}
1043 1040

  
1041
	public SpatialCache getSpatialCache() {
1042
		return spatialCache;
1043
	}
1044

  
1044 1045
}
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/SpatialCache.java
25 25
	 * @param r
26 26
	 * @param igeometry
27 27
	 */
28
	public void insert(Rectangle2D bounds, IGeometry geom) {
28
	public synchronized void insert(Rectangle2D bounds, IGeometry geom) {
29 29
		Envelope env = FConverter.convertRectangle2DtoEnvelope(bounds);
30 30
		this.insert(env, geom);
31 31
	}
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/operations/strategies/ShpStrategy.java
211 211
            System.out.println("Tiempo en mirar el ?ndice espacial y recuperar los ?ndices:" + (t12-t11));
212 212
            System.out.println("Numero de ?ndices:" + sc); */
213 213
            
214
            SpatialCache cache = lyr.getSpatialCache();
214
            SpatialCache cache = lyr.createSpatialCache();
215 215
            // lyr.setSpatialCacheEnabled(true);
216 216
            int i;
217 217
			for (int aux = 0; aux < sc; aux++) {
......
264 264
							{
265 265
								if (cache.getMaxFeatures() < cache.size())
266 266
								{
267
									lyr.setSpatialCache(null);
268
									cache = null;
267
									// lyr.setSpatialCache(null);
268
									// cache = null;
269 269
								}
270 270
								else
271 271
								{
trunk/extensions/extCAD/src/com/iver/cit/gvsig/gui/cad/CADToolAdapter.java
162 162
		if (!(aux instanceof VectorialLayerEdited)) 
163 163
			return Double.MAX_VALUE;
164 164
		VectorialLayerEdited vle = (VectorialLayerEdited) aux;		
165
		VectorialEditableAdapter vea = vle.getVEA();
166 165
		FLyrVect lyrVect = (FLyrVect) vle.getLayer();
167 166
		SpatialCache cache = lyrVect.getSpatialCache();
168 167
		ViewPort vp = getMapControl().getViewPort();
......
180 179
		// usar e iterar por ellos para obtener el mejor punto.
181 180
		NearestPointSnapper defaultSnap = new NearestPointSnapper();
182 181
		double mapTolerance = vp.toMapDistance(SelectionCADTool.tolerance);
183
		SnappingVisitor snapVisitor = new SnappingVisitor(defaultSnap, point, mapTolerance);		
182
		SnappingVisitor snapVisitor = new SnappingVisitor(defaultSnap, point, mapTolerance);
183
		// System.out.println("Cache size = " + cache.size());
184 184
		cache.query(e, snapVisitor);
185 185
		
186 186

  

Also available in: Unified diff