Statistics
| Revision:

svn-gvsig-desktop / branches / v2_0_0_prep / libraries / libRemoteServices / src / org / gvsig / remoteclient / wms / request / WMSRequest.java @ 29658

History | View | Annotate | Download (3 KB)

1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
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 2
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
 */
22

    
23
/*
24
 * AUTHORS (In addition to CIT):
25
 * 2009 Iver T.I.  {{Task}}
26
 */
27

    
28
/**
29
 * This class sends a WMS request and returns the
30
 * reply in a local File. It tries if the server
31
 * supports both HTTP Get and Post requests.
32
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
33
 */
34
package org.gvsig.remoteclient.wms.request;
35

    
36
import java.util.Vector;
37

    
38
import org.gvsig.remoteclient.ogc.request.OGCRequest;
39
import org.gvsig.remoteclient.utils.Utilities;
40
import org.gvsig.remoteclient.wms.WMSProtocolHandler;
41
import org.gvsig.remoteclient.wms.WMSStatus;
42

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

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