svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.remoteclient / src / main / java / org / gvsig / remoteclient / wcs / CoverageOfferingBrief.java @ 40559
History | View | Annotate | Download (3.65 KB)
1 | 40559 | jjdelcerro | /**
|
---|---|---|---|
2 | * gvSIG. Desktop Geographic Information System.
|
||
3 | 40435 | jjdelcerro | *
|
4 | 40559 | jjdelcerro | * Copyright (C) 2007-2013 gvSIG Association.
|
5 | 40435 | jjdelcerro | *
|
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 | 40559 | jjdelcerro | * as published by the Free Software Foundation; either version 3
|
9 | 40435 | jjdelcerro | * 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 | 40559 | jjdelcerro | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 | * MA 02110-1301, USA.
|
||
20 | 40435 | jjdelcerro | *
|
21 | 40559 | jjdelcerro | * For any additional information, do not hesitate to contact us
|
22 | * at info AT gvsig.com, or visit our website www.gvsig.com.
|
||
23 | 40435 | jjdelcerro | */
|
24 | /* CVS MESSAGES:
|
||
25 | *
|
||
26 | * $Id: CoverageOfferingBrief.java 33738 2010-10-21 11:54:20Z jpiera $
|
||
27 | * $Log$
|
||
28 | * Revision 1.1 2006-09-04 16:12:17 jaume
|
||
29 | * *** empty log message ***
|
||
30 | *
|
||
31 | *
|
||
32 | */
|
||
33 | package org.gvsig.remoteclient.wcs; |
||
34 | |||
35 | import java.io.IOException; |
||
36 | |||
37 | import org.kxml2.io.KXmlParser; |
||
38 | import org.xmlpull.v1.XmlPullParserException; |
||
39 | |||
40 | import org.gvsig.compat.CompatLocator; |
||
41 | import org.gvsig.compat.lang.StringUtils; |
||
42 | import org.gvsig.remoteclient.utils.BoundaryBox; |
||
43 | import org.gvsig.remoteclient.utils.CapabilitiesTags; |
||
44 | import org.gvsig.remoteclient.utils.DescribeCoverageTags; |
||
45 | |||
46 | public class CoverageOfferingBrief { |
||
47 | private String name; |
||
48 | private String label; |
||
49 | private BoundaryBox lonLatBbox;
|
||
50 | private static final StringUtils stringUtils = CompatLocator.getStringUtils(); |
||
51 | |||
52 | public String getLabel() { |
||
53 | return label;
|
||
54 | } |
||
55 | public void setLabel(String label) { |
||
56 | this.label = label;
|
||
57 | } |
||
58 | public BoundaryBox getLonLatBbox() {
|
||
59 | return lonLatBbox;
|
||
60 | } |
||
61 | public void setLonLatBbox(BoundaryBox lonLatBbox) { |
||
62 | this.lonLatBbox = lonLatBbox;
|
||
63 | } |
||
64 | public String getName() { |
||
65 | return name;
|
||
66 | } |
||
67 | |||
68 | public void setName(String name) { |
||
69 | this.name = name;
|
||
70 | } |
||
71 | |||
72 | public void parse(KXmlParser parser) throws XmlPullParserException, IOException { |
||
73 | int currentTag;
|
||
74 | boolean end = false; |
||
75 | |||
76 | parser.require(KXmlParser.START_TAG, null, "wcs:"+CapabilitiesTags.WCS_COVERAGEOFFERINGBRIEF); |
||
77 | currentTag = parser.next(); |
||
78 | |||
79 | while (!end)
|
||
80 | { |
||
81 | switch(currentTag)
|
||
82 | { |
||
83 | case KXmlParser.START_TAG:
|
||
84 | |||
85 | if (parser.getName().toLowerCase().compareTo(CapabilitiesTags.NAME.toLowerCase())==0) { |
||
86 | this.name = parser.nextText();
|
||
87 | } else if (parser.getName().compareTo(CapabilitiesTags.WCS_LABEL)==0) { |
||
88 | this.label = parser.nextText();
|
||
89 | } else if (parser.getName().compareTo(DescribeCoverageTags.LONLAT_ENVELOPE)==0) { |
||
90 | parser.nextTag(); |
||
91 | this.lonLatBbox = new BoundaryBox(); |
||
92 | this.lonLatBbox.setSrs(DescribeCoverageTags.WGS84);
|
||
93 | parser.require(KXmlParser.START_TAG, null, DescribeCoverageTags.GML_POS);
|
||
94 | String[][] coord = new String[2][2]; |
||
95 | coord[0] = stringUtils.split(parser.nextText(), WCSCoverage.SEPARATOR);
|
||
96 | parser.nextTag(); |
||
97 | parser.require(KXmlParser.START_TAG, null, DescribeCoverageTags.GML_POS);
|
||
98 | coord[1] = stringUtils.split(parser.nextText(), WCSCoverage.SEPARATOR);
|
||
99 | this.lonLatBbox.setXmin(Double.parseDouble(coord[0][0])); |
||
100 | this.lonLatBbox.setYmin(Double.parseDouble(coord[0][1])); |
||
101 | this.lonLatBbox.setXmax(Double.parseDouble(coord[1][0])); |
||
102 | this.lonLatBbox.setYmax(Double.parseDouble(coord[1][1])); |
||
103 | } |
||
104 | |||
105 | case KXmlParser.END_TAG:
|
||
106 | if (parser.getName().compareTo("wcs:"+CapabilitiesTags.WCS_COVERAGEOFFERINGBRIEF) == 0) |
||
107 | end = true;
|
||
108 | break;
|
||
109 | case KXmlParser.TEXT:
|
||
110 | break;
|
||
111 | } |
||
112 | currentTag = parser.next(); |
||
113 | } |
||
114 | |||
115 | } |
||
116 | } |