svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.remoteclient / src / main / java / org / gvsig / remoteclient / wcs / CoverageOfferingBrief.java @ 40769
History | View | Annotate | Download (3.48 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 |
package org.gvsig.remoteclient.wcs; |
25 |
|
26 |
import java.io.IOException; |
27 |
|
28 |
import org.kxml2.io.KXmlParser; |
29 |
import org.xmlpull.v1.XmlPullParserException; |
30 |
|
31 |
import org.gvsig.compat.CompatLocator; |
32 |
import org.gvsig.compat.lang.StringUtils; |
33 |
import org.gvsig.remoteclient.utils.BoundaryBox; |
34 |
import org.gvsig.remoteclient.utils.CapabilitiesTags; |
35 |
import org.gvsig.remoteclient.utils.DescribeCoverageTags; |
36 |
|
37 |
public class CoverageOfferingBrief { |
38 |
private String name; |
39 |
private String label; |
40 |
private BoundaryBox lonLatBbox;
|
41 |
private static final StringUtils stringUtils = CompatLocator.getStringUtils(); |
42 |
|
43 |
public String getLabel() { |
44 |
return label;
|
45 |
} |
46 |
public void setLabel(String label) { |
47 |
this.label = label;
|
48 |
} |
49 |
public BoundaryBox getLonLatBbox() {
|
50 |
return lonLatBbox;
|
51 |
} |
52 |
public void setLonLatBbox(BoundaryBox lonLatBbox) { |
53 |
this.lonLatBbox = lonLatBbox;
|
54 |
} |
55 |
public String getName() { |
56 |
return name;
|
57 |
} |
58 |
|
59 |
public void setName(String name) { |
60 |
this.name = name;
|
61 |
} |
62 |
|
63 |
public void parse(KXmlParser parser) throws XmlPullParserException, IOException { |
64 |
int currentTag;
|
65 |
boolean end = false; |
66 |
|
67 |
parser.require(KXmlParser.START_TAG, null, "wcs:"+CapabilitiesTags.WCS_COVERAGEOFFERINGBRIEF); |
68 |
currentTag = parser.next(); |
69 |
|
70 |
while (!end)
|
71 |
{ |
72 |
switch(currentTag)
|
73 |
{ |
74 |
case KXmlParser.START_TAG:
|
75 |
|
76 |
if (parser.getName().toLowerCase().compareTo(CapabilitiesTags.NAME.toLowerCase())==0) { |
77 |
this.name = parser.nextText();
|
78 |
} else if (parser.getName().compareTo(CapabilitiesTags.WCS_LABEL)==0) { |
79 |
this.label = parser.nextText();
|
80 |
} else if (parser.getName().compareTo(DescribeCoverageTags.LONLAT_ENVELOPE)==0) { |
81 |
parser.nextTag(); |
82 |
this.lonLatBbox = new BoundaryBox(); |
83 |
this.lonLatBbox.setSrs(DescribeCoverageTags.WGS84);
|
84 |
parser.require(KXmlParser.START_TAG, null, DescribeCoverageTags.GML_POS);
|
85 |
String[][] coord = new String[2][2]; |
86 |
coord[0] = stringUtils.split(parser.nextText(), WCSCoverage.SEPARATOR);
|
87 |
parser.nextTag(); |
88 |
parser.require(KXmlParser.START_TAG, null, DescribeCoverageTags.GML_POS);
|
89 |
coord[1] = stringUtils.split(parser.nextText(), WCSCoverage.SEPARATOR);
|
90 |
this.lonLatBbox.setXmin(Double.parseDouble(coord[0][0])); |
91 |
this.lonLatBbox.setYmin(Double.parseDouble(coord[0][1])); |
92 |
this.lonLatBbox.setXmax(Double.parseDouble(coord[1][0])); |
93 |
this.lonLatBbox.setYmax(Double.parseDouble(coord[1][1])); |
94 |
} |
95 |
|
96 |
case KXmlParser.END_TAG:
|
97 |
if (parser.getName().compareTo("wcs:"+CapabilitiesTags.WCS_COVERAGEOFFERINGBRIEF) == 0) |
98 |
end = true;
|
99 |
break;
|
100 |
case KXmlParser.TEXT:
|
101 |
break;
|
102 |
} |
103 |
currentTag = parser.next(); |
104 |
} |
105 |
|
106 |
} |
107 |
} |