root / tags / v1_0_2_Build_916 / extensions / extWMS / src / com / iver / cit / gvsig / fmap / layers / ComposedLayerWMS.java @ 12327
History | View | Annotate | Download (2.37 KB)
1 |
/**
|
---|---|
2 |
*
|
3 |
*/
|
4 |
package com.iver.cit.gvsig.fmap.layers; |
5 |
|
6 |
import java.awt.Graphics2D; |
7 |
import java.awt.image.BufferedImage; |
8 |
import java.util.Vector; |
9 |
|
10 |
import com.iver.cit.gvsig.fmap.DriverException; |
11 |
import com.iver.cit.gvsig.fmap.ViewPort; |
12 |
import com.iver.cit.gvsig.fmap.layers.layerOperations.ComposedLayer; |
13 |
import com.iver.utiles.swing.threads.Cancellable; |
14 |
|
15 |
/**
|
16 |
* Group WMS layers for make a single petition to the
|
17 |
* server for all layers.
|
18 |
*
|
19 |
* It is posible only if almost all params are the same. For this
|
20 |
* comparasion, ComposedLayerWMS uses the method
|
21 |
* {@link com.iver.cit.gvsig.fmap.layers.FLyrWMS#isComposedLayerCompatible(com.iver.cit.gvsig.fmap.layers.FLayer)}
|
22 |
*
|
23 |
*
|
24 |
* @see com.iver.cit.gvsig.fmap.layers.layerOperations.ComposedLayer
|
25 |
* @see com.iver.cit.gvsig.fmap.layers.FLyrWMS
|
26 |
*/
|
27 |
public class ComposedLayerWMS extends ComposedLayer { |
28 |
private FLyrWMS layer=null; |
29 |
|
30 |
/* (non-Javadoc)
|
31 |
* @see com.iver.cit.gvsig.fmap.layers.layerOperations.ComposedLayer#canAdd(com.iver.cit.gvsig.fmap.layers.FLayer)
|
32 |
*/
|
33 |
public boolean canAdd(FLayer layer) { |
34 |
if (this.layer != null) { |
35 |
return this.layer.isComposedLayerCompatible(layer); |
36 |
} |
37 |
return false; |
38 |
} |
39 |
|
40 |
/* (non-Javadoc)
|
41 |
* @see com.iver.cit.gvsig.fmap.layers.layerOperations.ComposedLayer#doAdd(com.iver.cit.gvsig.fmap.layers.FLayer)
|
42 |
*/
|
43 |
protected void doAdd(FLayer layer) throws Exception { |
44 |
FLyrWMS aLayer =(FLyrWMS)layer; |
45 |
if (this.layer == null) { |
46 |
this.layer = new FLyrWMS(); |
47 |
this.layer.setXMLEntity(aLayer.getXMLEntity());
|
48 |
return;
|
49 |
} |
50 |
this.layer.setLayerQuery( this.layer.getLayerQuery() + ","+ aLayer.getLayerQuery()); |
51 |
Vector aStyles = aLayer.getStyles();
|
52 |
|
53 |
if (aStyles != null) { |
54 |
Vector myStyles = this.layer.getStyles(); |
55 |
if (myStyles == null) { |
56 |
this.layer.setStyles(aStyles);
|
57 |
} else {
|
58 |
myStyles.addAll(aStyles); |
59 |
this.layer.setStyles(myStyles);
|
60 |
} |
61 |
} |
62 |
|
63 |
//revisar el fullextend para ajustarlo a todas las capas
|
64 |
this.layer.getFullExtent().add(aLayer.getFullExtent());
|
65 |
|
66 |
} |
67 |
|
68 |
/* (non-Javadoc)
|
69 |
* @see com.iver.cit.gvsig.fmap.layers.layerOperations.ComposedLayer#doDraw(java.awt.image.BufferedImage, java.awt.Graphics2D, com.iver.cit.gvsig.fmap.ViewPort, com.iver.utiles.swing.threads.Cancellable, double)
|
70 |
*/
|
71 |
protected void doDraw(BufferedImage image, Graphics2D g, ViewPort viewPort, |
72 |
Cancellable cancel, double scale) throws DriverException { |
73 |
this.layer.draw(image,g,viewPort,cancel,scale);
|
74 |
} |
75 |
|
76 |
} |