Statistics
| Revision:

root / branches / v10 / libraries / libRemoteServices / src / org / gvsig / remoteClient / wcs / CoverageOfferingBrief.java @ 9048

History | View | Annotate | Download (3.65 KB)

1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Ib??ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   IVER T.I. S.A
34
 *   Salamanca 50
35
 *   46005 Valencia
36
 *   Spain
37
 *
38
 *   +34 963163400
39
 *   dac@iver.es
40
 */
41

    
42
/* CVS MESSAGES:
43
*
44
* $Id: CoverageOfferingBrief.java 7010 2006-09-04 16:12:33Z jaume $
45
* $Log$
46
* Revision 1.1  2006-09-04 16:12:17  jaume
47
* *** empty log message ***
48
*
49
*
50
*/
51
package org.gvsig.remoteClient.wcs;
52

    
53
import java.io.IOException;
54

    
55
import org.gvsig.remoteClient.utils.BoundaryBox;
56
import org.gvsig.remoteClient.utils.CapabilitiesTags;
57
import org.gvsig.remoteClient.utils.DescribeCoverageTags;
58
import org.kxml2.io.KXmlParser;
59
import org.xmlpull.v1.XmlPullParserException;
60

    
61
public class CoverageOfferingBrief {
62
        private String name;
63
        private String label;
64
        private BoundaryBox                lonLatBbox;
65

    
66
        public String getLabel() {
67
                return label;
68
        }
69
        public void setLabel(String label) {
70
                this.label = label;
71
        }
72
        public BoundaryBox getLonLatBbox() {
73
                return lonLatBbox;
74
        }
75
        public void setLonLatBbox(BoundaryBox lonLatBbox) {
76
                this.lonLatBbox = lonLatBbox;
77
        }
78
        public String getName() {
79
                return name;
80
        }
81

    
82
        public void setName(String name) {
83
                this.name = name;
84
        }
85

    
86
        public void parse(KXmlParser parser) throws XmlPullParserException, IOException {
87
                int currentTag;
88
                boolean end = false;
89

    
90
                parser.require(KXmlParser.START_TAG, null, "wcs:"+CapabilitiesTags.WCS_COVERAGEOFFERINGBRIEF);
91
                currentTag = parser.next();
92

    
93
                while (!end)
94
                {
95
                        switch(currentTag)
96
                        {
97
                        case KXmlParser.START_TAG:
98

    
99
                                if (parser.getName().toLowerCase().compareTo(CapabilitiesTags.NAME.toLowerCase())==0) {
100
                                        this.name = parser.nextText();
101
                                } else if (parser.getName().compareTo(CapabilitiesTags.WCS_LABEL)==0) {
102
                                        this.label = parser.nextText();
103
                                } else if (parser.getName().compareTo(DescribeCoverageTags.LONLAT_ENVELOPE)==0) {
104
                                        parser.nextTag();
105
                                        this.lonLatBbox = new BoundaryBox();
106
                                        this.lonLatBbox.setSrs(DescribeCoverageTags.WGS84);
107
                                        parser.require(KXmlParser.START_TAG, null, DescribeCoverageTags.GML_POS);
108
                                        String[][] coord = new String[2][2];
109
                                        coord[0] = parser.nextText().split(WCSCoverage.SEPARATOR);
110
                                        parser.nextTag();
111
                                        parser.require(KXmlParser.START_TAG, null, DescribeCoverageTags.GML_POS);
112
                                        coord[1] = parser.nextText().split(WCSCoverage.SEPARATOR);
113
                                        this.lonLatBbox.setXmin(Double.parseDouble(coord[0][0]));
114
                                        this.lonLatBbox.setYmin(Double.parseDouble(coord[0][1]));
115
                                        this.lonLatBbox.setXmax(Double.parseDouble(coord[1][0]));
116
                                        this.lonLatBbox.setYmax(Double.parseDouble(coord[1][1]));
117
                                }
118

    
119
                        case KXmlParser.END_TAG:
120
                                if (parser.getName().compareTo("wcs:"+CapabilitiesTags.WCS_COVERAGEOFFERINGBRIEF) == 0)
121
                                        end = true;
122
                                break;
123
                        case KXmlParser.TEXT:
124
                                break;
125
                        }
126
                        currentTag = parser.next();
127
                }
128

    
129
        }
130
}