Statistics
| Revision:

root / branches / v2_0_0_prep / libraries / libRemoteServices / src / org / gvsig / remoteclient / wfs / filters / filterencoding / EnvelopeFEQuery.java @ 33738

History | View | Annotate | Download (2.36 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
package org.gvsig.remoteclient.wfs.filters.filterencoding;
29

    
30
import org.gvsig.fmap.geom.primitive.Envelope;
31
import org.gvsig.remoteclient.wfs.filters.operations.WFSEnvelopeFilterOperation;
32

    
33
/**
34
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
35
 */
36
public class EnvelopeFEQuery extends SpatialFEQuery {
37
        private Envelope envelope = null;
38

    
39
        /**
40
         * @param envelope
41
         * @param geometryName
42
         * @param srsName
43
         */
44
        public EnvelopeFEQuery(Envelope envelope, String geometryName,
45
                        String srsName) {
46
                super(geometryName, srsName);
47
                this.envelope = envelope;                
48
        }
49

    
50
        public EnvelopeFEQuery(WFSEnvelopeFilterOperation envelopeOperation) {
51
                this(envelopeOperation.getEnvelope(),
52
                                envelopeOperation.getAttributeName(),
53
                                envelopeOperation.getSrs());
54
        }
55

    
56
        public String getFilterEncoding(){
57
                StringBuffer request = new StringBuffer();
58
                request.append("<ogc:BBOX>");
59
                request.append("<ogc:PropertyName>" + geometryName + "</ogc:PropertyName>");
60
                request.append("<gml:Envelope srsName=\"" + srsName + "\">");
61
                request.append("<gml:lowerCorner>");
62
                request.append(envelope.getMinimum(0) + " " + envelope.getMinimum(1));
63
                request.append("</gml:lowerCorner>");
64
                request.append("<gml:upperCorner>");
65
                request.append(envelope.getMaximum(0) + " " + envelope.getMaximum(1));
66
                request.append("</gml:upperCorner>");
67
                request.append("</gml:Envelope>");
68
                request.append("</ogc:BBOX>");
69
                return request.toString();
70
        }
71
}
72