root / trunk / extensions / extWCS / src / es / uji / lsi / wcs / XmlWcsParsing / SupportedCRSs.java @ 1877
History | View | Annotate | Download (3.77 KB)
1 | 1877 | luisw | package es.uji.lsi.wcs.XmlWcsParsing; |
---|---|---|---|
2 | /*
|
||
3 | * SupportedCRCs.java
|
||
4 | *
|
||
5 | * Created on 13 de enero de 2005, 14:21
|
||
6 | */
|
||
7 | import java.util.*; |
||
8 | /**
|
||
9 | *
|
||
10 | * @author jaume
|
||
11 | */
|
||
12 | public class SupportedCRSs { |
||
13 | private ArrayList requestResponseCRSs; |
||
14 | private ArrayList requestCRSs; |
||
15 | private ArrayList responseCRSs; |
||
16 | private ArrayList nativeCRSs; |
||
17 | /** Creates a new instance of SupportedCRCs */
|
||
18 | public SupportedCRSs(XMLNode node) {
|
||
19 | for (int i=0; i<node.getNumSubNodes(); i++){ |
||
20 | XMLNode subnode = node.getSubNode(i); |
||
21 | if (WCSToolkit.isWCSTab(subnode, "requestResponseCRSs")) { |
||
22 | if (requestResponseCRSs == null) requestResponseCRSs = new ArrayList(); |
||
23 | String[] s = subnode.getText().split(" +"); |
||
24 | for (int j=0; j<s.length; j++) requestResponseCRSs.add(s[j]); |
||
25 | } |
||
26 | |||
27 | if (WCSToolkit.isWCSTab(subnode, "requestCRSs")) { |
||
28 | if (requestCRSs == null) requestCRSs = new ArrayList(); |
||
29 | String[] s = subnode.getText().split(" +"); |
||
30 | for (int j=0; j<s.length; j++) requestCRSs.add(s[j]); |
||
31 | } |
||
32 | |||
33 | if (WCSToolkit.isWCSTab(subnode, "responseCRSs")) { |
||
34 | if (responseCRSs == null) responseCRSs = new ArrayList(); |
||
35 | String[] s = subnode.getText().split(" +"); |
||
36 | for (int j=0; j<s.length; j++) responseCRSs.add(s[j]); |
||
37 | } |
||
38 | |||
39 | if (WCSToolkit.isWCSTab(subnode, "nativeCRSs")) { |
||
40 | if (nativeCRSs == null) nativeCRSs = new ArrayList(); |
||
41 | String[] s = subnode.getText().split(" +"); |
||
42 | for (int j=0; j<s.length; j++) nativeCRSs.add(s[j]); |
||
43 | } |
||
44 | } |
||
45 | } |
||
46 | |||
47 | public ArrayList getRequestResponseCRSs(){ |
||
48 | return requestResponseCRSs;
|
||
49 | } |
||
50 | |||
51 | public ArrayList getRequestCRSs(){ |
||
52 | return requestCRSs;
|
||
53 | } |
||
54 | |||
55 | public ArrayList getResponseCRSs(){ |
||
56 | return responseCRSs;
|
||
57 | } |
||
58 | |||
59 | public ArrayList getNativeCRSs(){ |
||
60 | return nativeCRSs;
|
||
61 | } |
||
62 | |||
63 | public ArrayList getAllRequestableCRSs(){ |
||
64 | // Devuelve getRequestResponseCRSs()+getRequestCRSs();
|
||
65 | ArrayList a = new ArrayList(); |
||
66 | if (getRequestResponseCRSs()!= null){ |
||
67 | Iterator it = getRequestResponseCRSs().iterator();
|
||
68 | while (it.hasNext()){
|
||
69 | a.add((String) it.next());
|
||
70 | } |
||
71 | } |
||
72 | if (getRequestCRSs()!= null){ |
||
73 | Iterator it = getRequestCRSs().iterator();
|
||
74 | while (it.hasNext()){
|
||
75 | String s = (String) it.next(); |
||
76 | if (!a.contains(s)) a.add(s);
|
||
77 | } |
||
78 | } |
||
79 | |||
80 | return a;
|
||
81 | } |
||
82 | |||
83 | public String toString(){ |
||
84 | Iterator it;
|
||
85 | String s = "\nSUPPORTED CRS\n"; |
||
86 | if (requestResponseCRSs != null){ |
||
87 | it = requestResponseCRSs.iterator(); |
||
88 | s += "\nRequest REsponse CRS(s): ";
|
||
89 | while (it.hasNext()){
|
||
90 | s += (String) it.next();
|
||
91 | if (it.hasNext()) s += ", "; |
||
92 | } |
||
93 | } |
||
94 | |||
95 | if (requestCRSs != null){ |
||
96 | it = requestCRSs.iterator(); |
||
97 | s += "\nRequest CRS(s): ";
|
||
98 | while (it.hasNext()){
|
||
99 | s += (String) it.next();
|
||
100 | if (it.hasNext()) s += ", "; |
||
101 | } |
||
102 | } |
||
103 | |||
104 | if (responseCRSs != null){ |
||
105 | it = responseCRSs.iterator(); |
||
106 | s += "\nResponse CRS(s): ";
|
||
107 | while (it.hasNext()){
|
||
108 | s += (String) it.next();
|
||
109 | if (it.hasNext()) s += ", "; |
||
110 | } |
||
111 | } |
||
112 | |||
113 | if (nativeCRSs != null){ |
||
114 | it = nativeCRSs.iterator(); |
||
115 | s += "\nNative CRS(s): ";
|
||
116 | while (it.hasNext()){
|
||
117 | s += (String) it.next();
|
||
118 | if (it.hasNext()) s += ", "; |
||
119 | } |
||
120 | } |
||
121 | return s;
|
||
122 | } |
||
123 | } |