root / trunk / extensions / extWCS / src / es / uji / lsi / wcs / XmlWcsParsing / GMLEnvelopeWithTimePeriod.java @ 1877
History | View | Annotate | Download (2.18 KB)
1 | 1877 | luisw | package es.uji.lsi.wcs.XmlWcsParsing; |
---|---|---|---|
2 | /*
|
||
3 | * GMLEnvelopeWithTmePeriod.java
|
||
4 | *
|
||
5 | * Created on 3 de enero de 2005, 12:57
|
||
6 | */
|
||
7 | |||
8 | /**
|
||
9 | *
|
||
10 | * @author jaume
|
||
11 | */
|
||
12 | public class GMLEnvelopeWithTimePeriod{ |
||
13 | private String srsName; |
||
14 | private double [][] gml_pos = new double[2][2]; |
||
15 | private double [][] gml_timePosition = new double[2][2]; |
||
16 | |||
17 | /** Creates a new instance of LonLatEnvelope */
|
||
18 | public GMLEnvelopeWithTimePeriod(XMLNode node) {
|
||
19 | srsName = node.getAttribute("srsName");
|
||
20 | int gml_posIndex = 0; |
||
21 | int gml_timePositionIndex = 0; |
||
22 | for (int i=0; i<node.getNumSubNodes(); i++){ |
||
23 | if (WCSToolkit.isWCSTab(node.getSubNode(i), "gml:pos")){ |
||
24 | setGmlPos(gml_posIndex, node.getSubNode(i)); |
||
25 | gml_posIndex++; |
||
26 | } |
||
27 | if (WCSToolkit.isWCSTab(node.getSubNode(i), "gml:timePosition")){ |
||
28 | setGmlTimePosition(gml_timePositionIndex, node.getSubNode(i)); |
||
29 | gml_timePositionIndex++; |
||
30 | } |
||
31 | } |
||
32 | |||
33 | } |
||
34 | |||
35 | public void setGmlPos(int index, XMLNode node){ |
||
36 | String s = node.getText();
|
||
37 | gml_pos[index][0] = Double.parseDouble(s.substring(0, s.indexOf(" "))); |
||
38 | gml_pos[index][1] = Double.parseDouble(s.substring(s.indexOf(" ")+1, s.length())); |
||
39 | } |
||
40 | |||
41 | public void setGmlTimePosition(int index, XMLNode node){ |
||
42 | String s = node.getText();
|
||
43 | gml_timePosition[index][0] = Double.parseDouble(s.substring(0, s.indexOf(" "))); |
||
44 | gml_timePosition[index][1] = Double.parseDouble(s.substring(s.indexOf(" ")+1, s.length())); |
||
45 | } |
||
46 | |||
47 | public double getMinX(){ |
||
48 | return gml_pos[0][0]; |
||
49 | } |
||
50 | |||
51 | public double getMinY(){ |
||
52 | return gml_pos[0][1]; |
||
53 | } |
||
54 | |||
55 | public double getMaxX(){ |
||
56 | return gml_pos[1][0]; |
||
57 | } |
||
58 | |||
59 | public double getMaxY(){ |
||
60 | return gml_pos[1][1]; |
||
61 | } |
||
62 | |||
63 | |||
64 | public String getSRSName(){ |
||
65 | return srsName;
|
||
66 | } |
||
67 | public String toString(){ |
||
68 | return "\ngml pos: ("+gml_pos[0][0]+", "+gml_pos[0][1]+") ("+gml_pos[1][0]+", "+gml_pos[1][1]+")"+ |
||
69 | "\ngml time position: ("+gml_timePosition[0][0]+", "+gml_timePosition[0][1]+") ("+gml_timePosition[1][0]+", "+gml_timePosition[1][1]+")"; |
||
70 | } |
||
71 | } |