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