1 | <html py:extends="'ndgPage.kid'" xmlns="http://www.w3.org/1999/xhtml" |
---|
2 | xmlns:py="http://purl.org/kid/ns#"> |
---|
3 | |
---|
4 | <div py:def="wmsControl()"> |
---|
5 | <!-- Provides the controls necessary to select layers and time, the |
---|
6 | bounding box is dealt with by the openlayers javascript |
---|
7 | directly --> |
---|
8 | </div> |
---|
9 | |
---|
10 | <script py:def="granuleMetadata(granuleDict)" language="javascript"> |
---|
11 | |
---|
12 | var app = null; |
---|
13 | var control = null; |
---|
14 | |
---|
15 | <!--! load the metadata of all selected granules into a javascript object on the browser --> |
---|
16 | var granules = { |
---|
17 | <?python granuleNames = granuleDict.keys() ?> |
---|
18 | <for py:for="granuleName in granuleNames" py:strip="True"> |
---|
19 | <?python |
---|
20 | granule = granuleDict[granuleName] |
---|
21 | featureIds = granule.getFeatureList() |
---|
22 | ?> |
---|
23 | "${granuleName}": { |
---|
24 | "wmsURI": "${h.url_for(controller='csml_wms', uri=granuleName)}", |
---|
25 | <for py:for="featureId in featureIds" py:strip="True"> |
---|
26 | <?python feature = granule.getFeature(featureId) ?> |
---|
27 | "${featureId}": { |
---|
28 | name: "${feature.description.CONTENT}", |
---|
29 | ftype: "${feature.featureType}", |
---|
30 | <!--!TODO make domain generic. This is a hack! --> |
---|
31 | domain: {time: ${str(feature.getDomain()['time'])}} |
---|
32 | }<if py:if="featureId != featureIds[-1]" py:replace="','"/> |
---|
33 | </for> |
---|
34 | }<if py:if="granuleName != granuleNames[-1]" py:replace="','"/> |
---|
35 | </for> |
---|
36 | }; |
---|
37 | |
---|
38 | function initVisMapBox() { |
---|
39 | app = new VisApp('visMap', 'visForm', 600, 10); |
---|
40 | control = new VisControl(app, granules, 'dsList', 'fList', 'visForm'); |
---|
41 | // Update the vis |
---|
42 | control.updateVisApp(); |
---|
43 | } |
---|
44 | |
---|
45 | </script> |
---|
46 | |
---|
47 | <div py:def="inpage()"> |
---|
48 | <!-- This provides the user interaction tabbed material below the |
---|
49 | graphics display --> |
---|
50 | <?python headers=['Granules','Variables','Constraints'] |
---|
51 | print 'Visible',c.visible |
---|
52 | status={} |
---|
53 | for hh in headers:status[hh]='hidden' |
---|
54 | status[c.visible]='current' |
---|
55 | ?> |
---|
56 | <div class="InPageTabs"> |
---|
57 | <!-- This provides the tabs --> |
---|
58 | <div class="InPageHdr"> |
---|
59 | <ul> |
---|
60 | <li py:for="hh in headers" class="${status[hh]}"> |
---|
61 | ${XML(h.link_to_remote(hh,dict(update=c.inpageid, |
---|
62 | url=h.url_for(controller="visualise", |
---|
63 | action="tabChange",dataset=c.viewedDataset,view=hh))))} |
---|
64 | </li> |
---|
65 | </ul> |
---|
66 | </div> |
---|
67 | <div class="InPageContent"> |
---|
68 | <!-- This is the Dataset tab content --> |
---|
69 | <div id="${headers[0]}" class="${status[headers[0]]}"> |
---|
70 | <?python url=h.url_for( |
---|
71 | controller="visualise",action="tabChange",dataset=c.viewedDataset,view=c.visible)?> |
---|
72 | <form action="$url" id="dsList" onchange="control.updateVisApp()"> |
---|
73 | <ul> |
---|
74 | <li py:for="uri in c.selections"> |
---|
75 | <?python selStatus=False |
---|
76 | if uri==c.viewedDataset: selStatus=True |
---|
77 | ?> |
---|
78 | ${XML(h.radio_button(name="dataset",value=uri,checked=selStatus))}$uri</li> |
---|
79 | </ul> |
---|
80 | ${XML(h.submit_to_remote("submit","update",url=url,update=c.inpageid))} |
---|
81 | (This button temporary) |
---|
82 | </form> |
---|
83 | <!--${XML(h.observe_form("dsList",url=url,update=c.inpageid))}--> |
---|
84 | </div> |
---|
85 | <!-- Now we have the variables tab content --> |
---|
86 | <div id="${headers[1]}" class="${status[headers[1]]}"> |
---|
87 | <?python |
---|
88 | url=h.url_for(controller="visualise",action="featureChange",view=c.visible) |
---|
89 | features=c.selections[c.viewedDataset].getFeatureList() |
---|
90 | nfeatures=len(features) |
---|
91 | ii=0 |
---|
92 | localkeys={} |
---|
93 | print c.selected |
---|
94 | for u,f in c.selected: |
---|
95 | if u==c.viewedDataset: localkeys[f]=(u,f) |
---|
96 | ?> |
---|
97 | <h4> $c.viewedDataset</h4> |
---|
98 | <form action="$url" id="fList" onchange="control.updateVisApp()"> |
---|
99 | <ul> |
---|
100 | <li py:for="featureID in features"> |
---|
101 | <?python |
---|
102 | selStatus=False |
---|
103 | if featureID in localkeys: |
---|
104 | selStatus=True |
---|
105 | feature=c.selected[localkeys[featureID]] |
---|
106 | else: feature=c.selections[c.viewedDataset].getFeature(featureID) |
---|
107 | name=feature.description.CONTENT |
---|
108 | ftype=feature.featureType |
---|
109 | checkname='Feature%s'%ii |
---|
110 | ii+=1 |
---|
111 | ?> |
---|
112 | ${XML(h.check_box(name=checkname,value=featureID,checked=selStatus))}$name |
---|
113 | ($ftype)</li> |
---|
114 | </ul> |
---|
115 | ${XML(h.submit_to_remote("submit","update",url=url,update=c.inpageid))} |
---|
116 | (This button temporary) |
---|
117 | </form> |
---|
118 | <!--${XML(h.observe_form("fList",url=url,update=c.inpageid))}--> |
---|
119 | </div> |
---|
120 | <div id="${headers[2]}" class="${status[headers[2]]}"> |
---|
121 | <!-- Provides the constraints tab --> |
---|
122 | <ul> |
---|
123 | <li py:for="u,f in c.selected">$u <ul> |
---|
124 | <li> $f : ${c.selected[(u,f)].featureType}<br /> |
---|
125 | ${','.join(c.selected[(u,f)].getAxisLabels())}</li> |
---|
126 | </ul> |
---|
127 | </li> |
---|
128 | <li py:if="len(c.selected)==0">There are no features |
---|
129 | selected, hence no constraints!</li> |
---|
130 | </ul> |
---|
131 | <div py:if="c.wmsAvailable"> |
---|
132 | <?python |
---|
133 | try: |
---|
134 | #use the first one for now |
---|
135 | for u,f in c.selected: |
---|
136 | i=c.selected[(u,f)] |
---|
137 | break |
---|
138 | taxis=i.getDomain()[i.getTimeAxis()] |
---|
139 | tstep=taxis[0] |
---|
140 | except Exception,e: |
---|
141 | tstep='Error: [%s] '%str(e) |
---|
142 | ?> |
---|
143 | <table> |
---|
144 | <tr><td> |
---|
145 | <form action="" name="visForm" id="visForm" ><table><tr> |
---|
146 | <td>Northerly Latitude:</td> |
---|
147 | <td colspan="2" align="center"> |
---|
148 | <input size="7" value="${c.bbox[0]}" name="bboxN"/> |
---|
149 | </td></tr> |
---|
150 | <tr><td>Longitudinal Extent:</td> |
---|
151 | <td align="center"><input size="8" value="${c.bbox[1]}" name="bboxW"/></td> |
---|
152 | <td align="center"><input size="8" value="${c.bbox[2]}" name="bboxE"/></td></tr> |
---|
153 | <tr><td> Southerly Latitude:</td> |
---|
154 | <td colspan="2" align="center"> |
---|
155 | <input size="7" value="${c.bbox[3]}" name="bboxS"/> |
---|
156 | </td></tr> |
---|
157 | <tr><td colspan="3">(Units: degrees, north and east positive)</td></tr> |
---|
158 | </table></form> |
---|
159 | </td><td> |
---|
160 | <p> Select Time </p> |
---|
161 | <p> This version simply uses the first timestep:<br/> $tstep </p> |
---|
162 | </td><td> |
---|
163 | <p> Select Layer </p> |
---|
164 | <p> Layers are not yet handled </p> |
---|
165 | </td></tr> |
---|
166 | </table> |
---|
167 | </div> |
---|
168 | </div> |
---|
169 | </div> |
---|
170 | <!--inpagecontent --> |
---|
171 | </div> |
---|
172 | <!-- inpagetabs --> |
---|
173 | </div> |
---|
174 | <!-- usertalk --> |
---|
175 | <div py:if="not c.fullpage" py:replace="inpage()"/> |
---|
176 | |
---|
177 | <head py:if="c.fullpage"> |
---|
178 | <replace py:replace="pagehead()" /> |
---|
179 | |
---|
180 | <script src="/js/OpenLayers.js"/> |
---|
181 | <script src="/js/openlayers-x.js"/> |
---|
182 | <script src="/js/VisMapBox.js"/> |
---|
183 | <replace py:replace="granuleMetadata(c.selections)"/> |
---|
184 | |
---|
185 | </head> |
---|
186 | |
---|
187 | <body py:if="c.fullpage" onload="initVisMapBox()"> |
---|
188 | <div id="entirepage"> |
---|
189 | <div py:replace="header()" /> |
---|
190 | <div py:replace="PageTabs('Visualise')" /> |
---|
191 | <div py:replace="searchOneLine()" /> |
---|
192 | <div id="contents"> |
---|
193 | <div py:if="c.wmsAvailable" class="map" id="visMap" /> |
---|
194 | <p> The visualisation feature is not fully implemented. </p> |
---|
195 | <div py:if="c.nothing2see"> |
---|
196 | <p> There are no selected datasets </p> |
---|
197 | </div> |
---|
198 | <div py:if="not c.nothing2see"> |
---|
199 | <div id="graphics"/> |
---|
200 | |
---|
201 | <div id="$c.inpageid"> |
---|
202 | <div py:replace="inpage()"/> |
---|
203 | </div> |
---|
204 | </div> |
---|
205 | </div> |
---|
206 | <div py:replace="footer()" /> |
---|
207 | </div> |
---|
208 | <!-- entire page --> |
---|
209 | </body> |
---|
210 | </html> |
---|