svn-gvsig-desktop / tags / v2_0_0_Build_2020 / libraries / libRemoteServices / src / org / gvsig / remoteclient / wcs / CoverageOfferingBrief.java @ 33910
History | View | Annotate | Download (3.84 KB)
1 | 7010 | jaume | /* 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$
|
||
45 | * $Log$
|
||
46 | * Revision 1.1 2006-09-04 16:12:17 jaume
|
||
47 | * *** empty log message ***
|
||
48 | *
|
||
49 | *
|
||
50 | */
|
||
51 | 29649 | jpiera | package org.gvsig.remoteclient.wcs; |
52 | 7010 | jaume | |
53 | import java.io.IOException; |
||
54 | |||
55 | 33738 | jpiera | import org.kxml2.io.KXmlParser; |
56 | import org.xmlpull.v1.XmlPullParserException; |
||
57 | |||
58 | import org.gvsig.compat.CompatLocator; |
||
59 | import org.gvsig.compat.lang.StringUtils; |
||
60 | 29649 | jpiera | import org.gvsig.remoteclient.utils.BoundaryBox; |
61 | import org.gvsig.remoteclient.utils.CapabilitiesTags; |
||
62 | import org.gvsig.remoteclient.utils.DescribeCoverageTags; |
||
63 | 7010 | jaume | |
64 | public class CoverageOfferingBrief { |
||
65 | private String name; |
||
66 | private String label; |
||
67 | private BoundaryBox lonLatBbox;
|
||
68 | 33738 | jpiera | private static final StringUtils stringUtils = CompatLocator.getStringUtils(); |
69 | |||
70 | 7010 | jaume | public String getLabel() { |
71 | return label;
|
||
72 | } |
||
73 | public void setLabel(String label) { |
||
74 | this.label = label;
|
||
75 | } |
||
76 | public BoundaryBox getLonLatBbox() {
|
||
77 | return lonLatBbox;
|
||
78 | } |
||
79 | public void setLonLatBbox(BoundaryBox lonLatBbox) { |
||
80 | this.lonLatBbox = lonLatBbox;
|
||
81 | } |
||
82 | public String getName() { |
||
83 | return name;
|
||
84 | } |
||
85 | |||
86 | public void setName(String name) { |
||
87 | this.name = name;
|
||
88 | } |
||
89 | |||
90 | public void parse(KXmlParser parser) throws XmlPullParserException, IOException { |
||
91 | int currentTag;
|
||
92 | boolean end = false; |
||
93 | |||
94 | parser.require(KXmlParser.START_TAG, null, "wcs:"+CapabilitiesTags.WCS_COVERAGEOFFERINGBRIEF); |
||
95 | currentTag = parser.next(); |
||
96 | |||
97 | while (!end)
|
||
98 | { |
||
99 | switch(currentTag)
|
||
100 | { |
||
101 | case KXmlParser.START_TAG:
|
||
102 | |||
103 | if (parser.getName().toLowerCase().compareTo(CapabilitiesTags.NAME.toLowerCase())==0) { |
||
104 | this.name = parser.nextText();
|
||
105 | } else if (parser.getName().compareTo(CapabilitiesTags.WCS_LABEL)==0) { |
||
106 | this.label = parser.nextText();
|
||
107 | } else if (parser.getName().compareTo(DescribeCoverageTags.LONLAT_ENVELOPE)==0) { |
||
108 | parser.nextTag(); |
||
109 | this.lonLatBbox = new BoundaryBox(); |
||
110 | this.lonLatBbox.setSrs(DescribeCoverageTags.WGS84);
|
||
111 | parser.require(KXmlParser.START_TAG, null, DescribeCoverageTags.GML_POS);
|
||
112 | String[][] coord = new String[2][2]; |
||
113 | 33738 | jpiera | coord[0] = stringUtils.split(parser.nextText(), WCSCoverage.SEPARATOR);
|
114 | 7010 | jaume | parser.nextTag(); |
115 | parser.require(KXmlParser.START_TAG, null, DescribeCoverageTags.GML_POS);
|
||
116 | 33738 | jpiera | coord[1] = stringUtils.split(parser.nextText(), WCSCoverage.SEPARATOR);
|
117 | 7010 | jaume | this.lonLatBbox.setXmin(Double.parseDouble(coord[0][0])); |
118 | this.lonLatBbox.setYmin(Double.parseDouble(coord[0][1])); |
||
119 | this.lonLatBbox.setXmax(Double.parseDouble(coord[1][0])); |
||
120 | this.lonLatBbox.setYmax(Double.parseDouble(coord[1][1])); |
||
121 | } |
||
122 | |||
123 | case KXmlParser.END_TAG:
|
||
124 | if (parser.getName().compareTo("wcs:"+CapabilitiesTags.WCS_COVERAGEOFFERINGBRIEF) == 0) |
||
125 | end = true;
|
||
126 | break;
|
||
127 | case KXmlParser.TEXT:
|
||
128 | break;
|
||
129 | } |
||
130 | currentTag = parser.next(); |
||
131 | } |
||
132 | |||
133 | } |
||
134 | } |