Revision 3325 org.gvsig.raster.wms/trunk/org.gvsig.raster.wms/org.gvsig.raster.wms.remoteclient/src/main/java/org/gvsig/remoteclient/wms/wms_1_3_0/WMSProtocolHandler1_3_0.java

View differences:

WMSProtocolHandler1_3_0.java
28 28
import java.io.File;
29 29
import java.io.IOException;
30 30
import java.util.ArrayList;
31
import java.util.Collection;
32
import java.util.Enumeration;
31 33
import java.util.TreeMap;
32 34

  
33 35
import org.kxml2.io.KXmlParser;
34 36
import org.xmlpull.v1.XmlPullParserException;
35

  
37
import org.gvsig.compat.net.ICancellable;
38
import org.gvsig.remoteclient.epsg.CrsAxisOrder;
39
import org.gvsig.remoteclient.utils.BoundaryBox;
36 40
import org.gvsig.remoteclient.utils.CapabilitiesTags;
37 41
import org.gvsig.remoteclient.utils.EncodingXMLParser;
38 42
import org.gvsig.remoteclient.utils.ExceptionTags;
43
import org.gvsig.remoteclient.wms.WMSLayer;
39 44
import org.gvsig.remoteclient.wms.WMSServiceInformation;
40 45
import org.gvsig.remoteclient.wms.WMSStatus;
41 46
import org.gvsig.remoteclient.wms.request.WMSGetCapabilitiesRequest;
......
72 77
// Parsing methods....    
73 78
//------------------------------------------------------------------------------    
74 79

  
80
	@Override
81
	public void getCapabilities(WMSStatus status, boolean override,
82
			ICancellable cancel) {
83
		super.getCapabilities(status, override, cancel);
84
		if (rootLayer!=null && status!=null && !status.isXyAxisOrder()) {
85
			/*	WMSLayer parser gets no information about the user preferences regarding
86
	 			axis order, so the bboxes should be post-processed here,
87
	 			where we get the user preference from the WMSStatus
88
			 */
89
			processLayer(rootLayer);
90
		}
91
	}
92
	
93
	/**
94
	 * WMSLayer parser gets no information about the user preferences regarding
95
	 * axis order, so the bboxes should be should be post-processed here,
96
	 * where we get the information from  at the
97
	 * protocol hanlder
98
	 * @param layer
99
	 */
100
	protected void processLayer(WMSLayer layer) {
101
		if (layer.getBboxes()!=null) {
102
			Collection<BoundaryBox> col = (Collection<BoundaryBox>) layer.getBboxes().values();
103
			for (BoundaryBox bbox: col) {
104
				if (!CrsAxisOrder.isXyAxisOrder(bbox.getSrs())) {
105
					bbox.setXmin(bbox.getYmin());
106
					bbox.setYmin(bbox.getXmin());
107
					bbox.setXmax(bbox.getYmax());
108
					bbox.setYmax(bbox.getXmax());
109
				}
110
			}
111
		}
112
		ArrayList children = layer.getChildren();
113
		if (children!=null) {
114
			for (int i=0; i<children.size(); i++) {
115
				WMSLayer child = (WMSLayer) children.get(i);
116
				processLayer(child);
117
			}
118
		}
119
	}
120
	
75 121
    public boolean parseCapabilities(File f)
76 122
    {   
77 123
    	rootLayer = null;

Also available in: Unified diff