Revision 45383

View differences:

trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.mapcontext/org.gvsig.fmap.mapcontext.api/src/main/java/org/gvsig/fmap/mapcontext/layers/SpatialCache.java
26 26
import java.util.ArrayList;
27 27
import java.util.Iterator;
28 28
import java.util.List;
29

  
30 29
import org.gvsig.fmap.geom.Geometry;
31 30
import org.gvsig.fmap.geom.GeometryLocator;
32 31
import org.gvsig.fmap.geom.SpatialIndex;
......
41 40
    private int maxFeatures = 1000; // Por defecto, pero se puede cambiar
42 41
	private int fastNumTotalRegs=0;
43 42
	private SpatialIndex index = null;
43
        private boolean overflown = false;
44 44
	
45 45
	private boolean enabled = false;
46 46

  
......
61 61
	}
62 62

  
63 63
	public synchronized void insert(Envelope bounds, Geometry geom) {
64
		if (isEnabled() && getMaxFeatures() >= size()) {
65
		    this.index.insert(bounds, geom);
64
		if (isEnabled()) {
65
                    if (getMaxFeatures() >= size()) {
66
                        this.index.insert(bounds, geom);
67
                    } else {
68
                        overflown = true;
69
                    }
66 70
		}
67 71
	}
68 72

  
......
82 86
	}
83 87

  
84 88
	public void insert(Envelope itemEnv, Object item) {
85
		if (isEnabled() && getMaxFeatures() >= size()) {
89
		if (isEnabled()) {
90
                    if (getMaxFeatures() >= size()) {
86 91
			this.index.insert(itemEnv, item);
87 92
			fastNumTotalRegs++;
93
                    } else {
94
                        overflown = true;
95
                    }
88 96
		}
89 97
	}
90 98

  
......
102 110
	public void clearAll() {
103 111
		index.removeAll();
104 112
		fastNumTotalRegs = 0;
113
                overflown = false;
105 114
	}
106 115

  
107 116
	public void remove(org.gvsig.fmap.geom.primitive.Envelope bounds, Geometry geom) {
......
115 124
	public void setEnabled(boolean enabled) {
116 125
		this.enabled = enabled;
117 126
	}
127
        
128
        public boolean isOverflown() {
129
            return overflown;
130
        }
118 131
}

Also available in: Unified diff