Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.remoteclient / src / main / java / org / gvsig / remoteclient / wms / request / WMSRequest.java @ 40769

History | View | Annotate | Download (2.98 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
/**
26
 * This class sends a WMS request and returns the
27
 * reply in a local File. It tries if the server
28
 * supports both HTTP Get and Post requests.
29
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
30
 */
31
package org.gvsig.remoteclient.wms.request;
32

    
33
import java.util.Vector;
34

    
35
import org.gvsig.remoteclient.ogc.request.OGCRequest;
36
import org.gvsig.remoteclient.utils.Utilities;
37
import org.gvsig.remoteclient.wms.WMSProtocolHandler;
38
import org.gvsig.remoteclient.wms.WMSStatus;
39

    
40
/**
41
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
42
 */
43
public abstract class WMSRequest extends OGCRequest{
44
        protected WMSStatus status = null;
45
        
46
        public WMSRequest(WMSStatus status,
47
                        WMSProtocolHandler protocolHandler) {
48
                super(status, protocolHandler);
49
                this.status = status;
50
        }
51
        
52

    
53
        /*
54
         * (non-Javadoc)
55
         * @see org.gvsig.remoteClient.wfs.requests.WFSRequest#getSchemaLocation()
56
         */
57
        protected String getSchemaLocation() {
58
                return null;
59
        }
60
        
61
        /**
62
     * Gets the part of the OGC request that share GetMap and GetFeatureInfo
63
     * @return String request
64
     */
65
    protected String getPartialQuery(WMSStatus status)
66
    {
67
        StringBuffer req = new StringBuffer();
68
        req.append("LAYERS=" + Utilities.Vector2CS(status.getLayerNames()))
69
           .append("&SRS=" + status.getSrs())
70
           .append("&BBOX=" + status.getExtent().getMinX()+ "," )
71
           .append(status.getExtent().getMinY()+ ",")
72
           .append(status.getExtent().getMaxX()+ ",")
73
           .append(status.getExtent().getMaxY())
74
           .append("&WIDTH=" + status.getWidth())
75
           .append("&HEIGHT=" + status.getHeight())
76
           .append("&FORMAT=" + status.getFormat())
77
           .append("&STYLES=");
78
        Vector v = status.getStyles();
79
        if (v!=null && v.size()>0)
80
                req.append(Utilities.Vector2CS(v));
81
        v = status.getDimensions();
82
        if (v!=null && v.size()>0)
83
            req.append("&" + Utilities.Vector2URLParamString(v));
84
        if (status.getTransparency()) {
85
            req.append("&TRANSPARENT=TRUE");
86
        }
87
        return req.toString();
88
    }
89
        
90
}