Revision 39059
branches/v2_0_0_prep/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/FLayerHidesArea.java | ||
---|---|---|
1 |
package org.gvsig.fmap.mapcontext.layers; |
|
2 |
|
|
3 |
import org.gvsig.fmap.geom.primitive.Envelope; |
|
4 |
|
|
5 |
public interface FLayerHidesArea { |
|
6 |
|
|
7 |
boolean hidesThisArea(Envelope area); |
|
8 |
|
|
9 |
} |
|
0 | 10 |
branches/v2_0_0_prep/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/FLyrDefault.java | ||
---|---|---|
53 | 53 |
import org.cresques.cts.IProjection; |
54 | 54 |
import org.gvsig.fmap.dal.DataTypes; |
55 | 55 |
import org.gvsig.fmap.dal.exception.ReadException; |
56 |
import org.gvsig.fmap.geom.primitive.Envelope; |
|
56 | 57 |
import org.gvsig.fmap.mapcontext.MapContext; |
57 | 58 |
import org.gvsig.fmap.mapcontext.MapContextLocator; |
58 | 59 |
import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException; |
... | ... | |
100 | 101 |
* @see FLayer |
101 | 102 |
* @see FLayerStatus |
102 | 103 |
*/ |
103 |
public abstract class FLyrDefault extends AbstractDisposable implements FLayer, |
|
104 |
public abstract class FLyrDefault extends AbstractDisposable implements FLayer, FLayerHidesArea,
|
|
104 | 105 |
LayerListener { |
105 | 106 |
/** |
106 | 107 |
* Useful for debug the problems during the implementation. |
... | ... | |
1038 | 1039 |
public String toString() { |
1039 | 1040 |
return super.toString() + ": " + getName(); |
1040 | 1041 |
} |
1042 |
|
|
1043 |
public boolean hidesThisArea(Envelope area) { |
|
1044 |
return false; |
|
1045 |
} |
|
1041 | 1046 |
} |
branches/v2_0_0_prep/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/impl/DefaultMapContextDrawer.java | ||
---|---|---|
10 | 10 |
import org.gvsig.compat.CompatLocator; |
11 | 11 |
import org.gvsig.compat.print.PrintAttributes; |
12 | 12 |
import org.gvsig.fmap.dal.exception.ReadException; |
13 |
import org.gvsig.fmap.geom.primitive.Envelope; |
|
13 | 14 |
import org.gvsig.fmap.mapcontext.MapContext; |
14 | 15 |
import org.gvsig.fmap.mapcontext.MapContextDrawer; |
15 | 16 |
import org.gvsig.fmap.mapcontext.ViewPort; |
16 | 17 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
18 |
import org.gvsig.fmap.mapcontext.layers.FLayerHidesArea; |
|
17 | 19 |
import org.gvsig.fmap.mapcontext.layers.FLayers; |
18 | 20 |
import org.gvsig.fmap.mapcontext.layers.LayerDrawEvent; |
19 | 21 |
import org.gvsig.fmap.mapcontext.layers.LayersIterator; |
... | ... | |
82 | 84 |
cachedImage = new CachedImage(); |
83 | 85 |
// Draw all layers |
84 | 86 |
firstLayerToDraw = 0; |
85 |
lastLayerToDraw = drawList.getLayerCount() - 1; |
|
87 |
//lastLayerToDraw = drawList.getLayerCount() - 1; |
|
88 |
lastLayerToDraw = drawList.getLastLayerVisible(viewPort); |
|
86 | 89 |
} else { |
87 | 90 |
// Draw the first group of layers without changes to be cached |
88 | 91 |
// next time |
... | ... | |
275 | 278 |
return this.layers.size(); |
276 | 279 |
} |
277 | 280 |
|
281 |
public int getLastLayerVisible(ViewPort viewPort) { |
|
282 |
Envelope area = viewPort.getAdjustedEnvelope(); |
|
283 |
for( int n=0; n<this.layers.size()-1; n++ ) { |
|
284 |
FLayer layer = (FLayer) this.layers.get(n); |
|
285 |
if( layer instanceof FLayerHidesArea ) { |
|
286 |
if( ((FLayerHidesArea)(layer)).hidesThisArea(area) ) { |
|
287 |
return n; |
|
288 |
} |
|
289 |
} |
|
290 |
} |
|
291 |
return this.layers.size()-1; |
|
292 |
} |
|
293 |
|
|
278 | 294 |
private boolean hasChanged(FLayer layer, int pos) { |
279 | 295 |
FLayer previous = (FLayer) this.previosList.layers.get(pos); |
280 | 296 |
// String previousName = previous.getName(); |
Also available in: Unified diff