Revision 4314 trunk/libraries/libRemoteServices/src/org/gvsig/remoteClient/wms/wms_1_1_1/WMSLayer1_1_1.java
WMSLayer1_1_1.java | ||
---|---|---|
4 | 4 |
import java.io.IOException; |
5 | 5 |
import java.util.ArrayList; |
6 | 6 |
import java.util.TreeMap; |
7 |
import java.util.Vector; |
|
7 | 8 |
|
8 | 9 |
import org.gvsig.remoteClient.utils.BoundaryBox; |
9 | 10 |
import org.gvsig.remoteClient.utils.CapabilitiesTags; |
10 | 11 |
import org.gvsig.remoteClient.utils.Utilities; |
11 | 12 |
import org.gvsig.remoteClient.wms.WMSDimension; |
13 |
import org.gvsig.remoteClient.wms.WMSExtent; |
|
12 | 14 |
import org.kxml2.io.KXmlParser; |
13 | 15 |
import org.xmlpull.v1.XmlPullParserException; |
14 | 16 |
|
... | ... | |
19 | 21 |
*/ |
20 | 22 |
public class WMSLayer1_1_1 extends org.gvsig.remoteClient.wms.WMSLayer { |
21 | 23 |
|
24 |
/** |
|
25 |
* <p>Extents defined for the layer in the capabilities doc</p> |
|
26 |
*/ |
|
27 |
private java.util.ArrayList extents = new ArrayList(); |
|
22 | 28 |
|
29 |
/** |
|
30 |
* <p> gets the extent vector defined in this layer</p> |
|
31 |
* @return |
|
32 |
*/ |
|
33 |
public ArrayList getExtents() { |
|
34 |
return extents; |
|
35 |
} |
|
36 |
|
|
37 |
public WMSExtent getExtent(String name) |
|
38 |
{ |
|
39 |
for(int i = 0; i < extents.size(); i++ ){ |
|
40 |
if(((WMSExtent)extents.get(i)).getName().compareTo(name)==0) |
|
41 |
{ |
|
42 |
return (WMSExtent)extents.get(i); |
|
43 |
} |
|
44 |
} |
|
45 |
return null; |
|
46 |
} |
|
47 |
|
|
48 |
public ArrayList getDimensions() |
|
49 |
{ |
|
50 |
WMSDimension dimension; |
|
51 |
WMSExtent extent; |
|
52 |
for(int i = 0; i < dimensions.size(); i++) |
|
53 |
{ |
|
54 |
dimension = (WMSDimension)dimensions.get(i); |
|
55 |
extent = getExtent(dimension.getName()); |
|
56 |
if(extent != null) |
|
57 |
{ |
|
58 |
((WMSDimension)dimensions.get(i)).setDimensionExpression( extent.getExtentExpression()); |
|
59 |
} |
|
60 |
} |
|
61 |
|
|
62 |
WMSDimension pDimension; |
|
63 |
WMSDimension myDimension; |
|
64 |
Vector myDimensions = (Vector) this.dimensions.clone(); |
|
65 |
ArrayList pDimensions; |
|
66 |
if (parent!=null) |
|
67 |
{ |
|
68 |
pDimensions = parent.getDimensions(); |
|
69 |
for (int i= 0; i < pDimensions.size(); i++){ |
|
70 |
pDimension = (WMSDimension)pDimensions.get(i); |
|
71 |
myDimension = getDimension(pDimension.getName()); |
|
72 |
if (myDimension != null){ |
|
73 |
pDimensions.remove(pDimension); |
|
74 |
} |
|
75 |
} |
|
76 |
myDimensions.addAll(pDimensions); |
|
77 |
} |
|
78 |
return new ArrayList(myDimensions); |
|
79 |
} |
|
80 |
|
|
81 |
/** |
|
82 |
* <p>Adds an extent to the extent vector </p> |
|
83 |
* @param extent |
|
84 |
*/ |
|
85 |
public void addExtent(org.gvsig.remoteClient.wms.WMSExtent extent) { |
|
86 |
extents.add(extent); |
|
87 |
} |
|
88 |
|
|
23 | 89 |
public WMSLayer1_1_1() |
24 | 90 |
{ |
25 | 91 |
children = new ArrayList(); |
... | ... | |
154 | 220 |
addDimension(dim); |
155 | 221 |
} |
156 | 222 |
} |
223 |
else if (parser.getName().compareTo(CapabilitiesTags.EXTENT)==0) |
|
224 |
{ |
|
225 |
WMSExtent extent = new WMSExtent(); |
|
226 |
extent.parse(parser); |
|
227 |
if ((extent != null) && (extent.getName() != null)) |
|
228 |
{ |
|
229 |
addExtent(extent); |
|
230 |
|
|
231 |
} |
|
232 |
} |
|
157 | 233 |
else if (parser.getName().compareTo(CapabilitiesTags.KEYWORDLIST)==0) |
158 | 234 |
{ |
159 | 235 |
parseKeywordList(parser); |
Also available in: Unified diff