Statistics
| Revision:

gvsig-raster / 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 / request / WMSGetMapRequest1_1_3.java @ 3325

History | View | Annotate | Download (3.3 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 3
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24

    
25
package org.gvsig.remoteclient.wms.wms_1_3_0.request;
26

    
27
import java.util.Vector;
28

    
29
import org.gvsig.remoteclient.epsg.CrsAxisOrder;
30
import org.gvsig.remoteclient.utils.BoundaryBox;
31
import org.gvsig.remoteclient.utils.CapabilitiesTags;
32
import org.gvsig.remoteclient.utils.Utilities;
33
import org.gvsig.remoteclient.wms.WMSProtocolHandler;
34
import org.gvsig.remoteclient.wms.WMSStatus;
35
import org.gvsig.remoteclient.wms.wms_1_1_0.request.WMSGetMapRequest1_1_0;
36

    
37
/**
38
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
39
 */
40
public class WMSGetMapRequest1_1_3 extends WMSGetMapRequest1_1_0{
41

    
42
        public WMSGetMapRequest1_1_3(WMSStatus status,
43
                        WMSProtocolHandler protocolHandler) {
44
                super(status, protocolHandler);                
45
        }
46

    
47
        /*
48
         * (non-Javadoc)
49
         * @see org.gvsig.remoteclient.wms.request.WMSRequest#getPartialQuery(org.gvsig.remoteclient.wms.WMSStatus)
50
         */
51
        protected String getPartialQuery(WMSStatus status){
52
                double coord1, coord2, coord3, coord4;
53
                String epsgCode = status.getSrs();
54
                if (status.isXyAxisOrder() || CrsAxisOrder.isXyAxisOrder(epsgCode)) { 
55
                        coord1 = status.getExtent().getMinX();
56
                        coord2 = status.getExtent().getMinY();
57
                        coord3 = status.getExtent().getMaxX();
58
                        coord4 = status.getExtent().getMaxY();
59
                }
60
                else {
61
                    // use reverse coordinate order as defined by EPSG registry
62
                        coord1 = status.getExtent().getMinY();
63
                        coord2 = status.getExtent().getMinX();
64
                        coord3 = status.getExtent().getMaxY();
65
                        coord4 = status.getExtent().getMaxX();
66
                }
67
                
68
                StringBuffer req = new StringBuffer();
69
                req.append("LAYERS=" + Utilities.Vector2CS(status.getLayerNames()))
70
                .append("&CRS=" + status.getSrs())
71
                .append("&BBOX=" + coord1 + "," )
72
                .append(coord2 + ",")
73
                .append(coord3 + ",")
74
                .append(coord4)
75
                .append("&WIDTH=" + status.getWidth())
76
                .append("&HEIGHT=" + status.getHeight())
77
                .append("&FORMAT=" + status.getFormat())
78
                .append("&STYLES=");
79
                Vector v = status.getStyles();
80
                if (v!=null && v.size()>0)
81
                        req.append(Utilities.Vector2CS(v));
82
                v = status.getDimensions();
83
                if (v!=null && v.size()>0)
84
                        req.append("&" + Utilities.Vector2URLParamString(v));
85
                if (status.getTransparency()) {
86
                        req.append("&TRANSPARENT=TRUE");
87
                }
88
                return req.toString();
89
        }
90

    
91
        /* (non-Javadoc)
92
         * @see org.gvsig.remoteclient.wms.wms_1_1_0.request.WMSGetMapRequest1_1_0#getExceptionsFormat()
93
         */
94
        protected String getExceptionsFormat() {
95
                return CapabilitiesTags.EXCEPTIONS_1_3_0;
96
        }
97
        
98
        
99

    
100
}
101