Changeset 8216
- Timestamp:
- 05/04/12 15:02:54 (9 years ago)
- Location:
- mauRepo/MolesManager/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
mauRepo/MolesManager/trunk
-
Property
svn:ignore
set to
.directory
.project
.pydevproject
.settings
-
Property
svn:ignore
set to
-
mauRepo/MolesManager/trunk/src/MolesManager/static/js/cedaObservation.js
r8215 r8216 48 48 } 49 49 50 51 function docLinkObj(moles2url){ 52 var docLinkString = '<p>For further details see the following links: </p><ol><li>' 53 docLinkString += '<a href="' + moles2url + '"> CEDA MOLES2 Metadata Catalogue Entry</a>' + '</li></ol>' 54 return docLinkString 55 } 56 50 57 function createCitation(coObs,ids,rps){ 51 58 var citationString =''; … … 66 73 } 67 74 68 function accessLink(useLimitation){ 75 76 function accessLink(permission){ 69 77 var accessString = ''; 70 78 71 if (useLimitation != ''){ 72 var split = useLimitation[0].split(' http://') 73 console.log(split[1].substring[0,5]) 79 if (permission != null ){ 80 var split = permission.useLimitation[0].split(' http://') 81 split[1] = split[1].trim() 82 console.log(split[1].trim()) 74 83 if (split[1][split[1].length] == '.'){split[1] = split[1].substring[0,split[1].length - 1]} 75 84 accessString = '<p>' + split[0] + ' <a href="http://' + split[1] + '">' + split[1] + '</a></p>' 76 85 77 86 } 78 if (accessString == '' ){ac essString = '<p>These data are open access. Please visit the data centre to access these data or contact the data centre for access assistance.</p>'}87 if (accessString == '' ){accessString = '<p>These data may be open access. Please contact the data centre to enquire about access to these data.</p>'} 79 88 return accessString 80 89 } … … 84 93 map = new OpenLayers.Map(map_id); 85 94 var ol_wms = new OpenLayers.Layer.WMS( "OpenLayers WMS", "http://vmap0.tiles.osgeo.org/wms/vmap0?", {layers: 'basic'} ); 86 95 map.addLayer(ol_wms); 96 97 var renderer = OpenLayers.Util.getParameters(window.location.href).renderer; 98 renderer = (renderer) ? [renderer] : OpenLayers.Layer.Vector.prototype.renderers; 99 87 100 var boxes = new OpenLayers.Layer.Vector( "Boxes" ); 88 //minLon,minLat,maxlon,maxlat 89 if (typeof extents[0].westBoundLongitude != 'undefined'){ 90 box_extents = [[extents[0].westBoundLongitude.value,extents[0].southBoundLatitude.value,extents[0].eastBoundLongitude.value,extents[0].northBoundLatitude.value]] 91 for (var i = 0; i < box_extents.length; i++) { 92 ext = box_extents[i]; 93 101 /* 102 * Layer style 103 */ 104 // we want opaque external graphics and non-opaque internal graphics 105 var layer_style = OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style['default']); 106 layer_style.fillOpacity = 0.2; 107 layer_style.graphicOpacity = 1; 108 var vectorLayer = new OpenLayers.Layer.Vector("Simple Geometry", { 109 style: layer_style, 110 renderers: renderer}) 111 112 if (extents[0]) 113 { 114 if (extents[0].__class__ == 'EX_GeographicBoundingBox') 115 { 116 117 if (Math.abs(extents[0].westBoundLongitude.value - extents[0].eastBoundLongitude.value) > 1.0 && Math.abs(extents[0].northBoundLatitude.value - extents[0].southBoundLatitude.value) > 1.0 ){ 118 var box_extents = [[extents[0].westBoundLongitude.value,extents[0].southBoundLatitude.value,extents[0].eastBoundLongitude.value,extents[0].northBoundLatitude.value]] 119 for (var i = 0; i < box_extents.length; i++) { 120 ext = box_extents[i]; 121 //minLon,minLat,maxlon,maxlat 122 bounds = new OpenLayers.Bounds(ext[0],ext[1],ext[2],ext[3]); 123 124 box = new OpenLayers.Feature.Vector(bounds.toGeometry()); 125 boxes.addFeatures(box); 126 map.addLayer(boxes); 127 var boxes = new OpenLayers.Layer.Vector( "boxes" ); 128 129 } 130 } 131 else { 132 var box_extents = [[extents[0].westBoundLongitude.value,extents[0].southBoundLatitude.value,extents[0].eastBoundLongitude.value,extents[0].northBoundLatitude.value]] 133 ext = box_extents[0]; 134 135 var style_blue = OpenLayers.Util.extend({}, layer_style); 136 style_blue.strokeColor = "blue"; 137 style_blue.fillColor = "blue"; 138 style_blue.graphicName = "star"; 139 style_blue.pointRadius = 10; 140 style_blue.strokeWidth = 3; 141 style_blue.rotation = 45; 142 style_blue.strokeLinecap = "butt"; 143 var point = new OpenLayers.Geometry.Point(ext[0],ext[1]); 144 var pointFeature = new OpenLayers.Feature.Vector(point,null,style_blue); 145 map.addLayer(vectorLayer); 146 vectorLayer.addFeatures([pointFeature]); 147 148 } 149 150 } 151 } 152 else { 153 //in cases where no geographicExtent is given put in global box 154 ext = [-180.0,-90.0,180.0,90.0] 94 155 bounds = new OpenLayers.Bounds(ext[0],ext[1],ext[2],ext[3]); 95 96 156 box = new OpenLayers.Feature.Vector(bounds.toGeometry()); 97 157 boxes.addFeatures(box); 98 }99 }100 101 map.addLayer(ol_wms);102 map.addLayer(boxes);103 var boxes = new OpenLayers.Layer.Vector( "boxes" );104 var layerSwitch = new OpenLayers.Control.LayerSwitcher158 map.addLayer(boxes); 159 var boxes = new OpenLayers.Layer.Vector( "boxes" ); 160 161 } 162 //map.addLayer(boxes); 163 //var boxes = new OpenLayers.Layer.Vector( "boxes" ); 164 //var layerSwitch = new OpenLayers.Control.LayerSwitcher 105 165 // this is where we find there is an issue - the error is: 106 166 // map.addControl(layerSwitch); 107 var sf = new OpenLayers.Control.SelectFeature(boxes);167 //var sf = new OpenLayers.Control.SelectFeature(boxes); 108 168 console.log(ext[0],ext[1],ext[2],ext[3]) 109 169 110 map.addControl(sf);111 sf.activate();170 //map.addControl(sf); 171 //sf.activate(); 112 172 113 173 var proj = new OpenLayers.Projection("EPSG:4326"); … … 115 175 point.transform(proj, map.getProjectionObject()); 116 176 map.setCenter(point,3); 117 map.zoomToMaxExtent(); 118 } 177 map.setCenter(new OpenLayers.LonLat(ext[0], ext[1]), 5); 178 179 180 // map.zoomToMaxExtent(); 181 182 } 119 183 120 184 … … 176 240 var json = dojo.byId('coObs_id').value; 177 241 var coObs = dojo.fromJson(json); 178 179 console.log(coObs.identifier.length)180 181 console.log(coObs)182 var ids = getIDs(coObs);183 var rps = getRelatedParties(coObs);184 242 185 console.log(coObs.permission.useLimitation) 186 var access_id = new dojo.html.set(dojo.byId("access_id"),accessLink(coObs.permission.useLimitation)); 187 188 var help_id = new dojo.html.set(dojo.byId("help_id"),rps[1]); 189 console.log(rps[1]) 190 191 dojo.attr("title_id", 'value', ids['ceda_title']); 192 dojo.attr("citation_id", 'value', createCitation(coObs,ids,rps[0])); 193 dojo.attr("records_dataLineage", 'value', coObs.dataLineage); 194 dojo.attr("description_id", 'value', coObs.description); 195 dojo.attr("keywords_id", 'value', coObs.keywords); 196 //dojo.attr("access_id",'value',''); 197 dojo.attr("help_id",'value',''); 198 drawMap(coObs.geographicExtent,'map'); 243 if (coObs){var ids = getIDs(coObs); 244 console.log(coObs) 245 console.log(coObs.identifier.length) 246 247 var rps = getRelatedParties(coObs); 248 249 var access_id = new dojo.html.set(dojo.byId("access_id"),accessLink(coObs.permission)); 250 var help_id = new dojo.html.set(dojo.byId("help_id"),rps[1]); 251 var docLink_id = new dojo.html.set(dojo.byId("docLink_id"),docLinkObj(ids['moles2url'])); 252 253 console.log(rps[1]) 254 255 dojo.attr("title_id", 'value', ids['ceda_title']); 256 dojo.attr("citation_id", 'value', createCitation(coObs,ids,rps[0])); 257 dojo.attr("records_dataLineage", 'value', coObs.dataLineage); 258 dojo.attr("description_id", 'value', coObs.description); 259 dojo.attr("keywords_id", 'value', coObs.keywords); 260 //dojo.attr("access_id",'value',''); 261 dojo.attr("help_id",'value',''); 262 drawMap(coObs.geographicExtent,'map'); 263 264 } 199 265 }); 200 266 }); -
mauRepo/MolesManager/trunk/src/MolesManager/static/templates/cedaObservation.html
r8215 r8216 125 125 <p>Links to related data products</p> 126 126 </div> 127 <div data-dojo-type="dijit.layout.ContentPane" title="Project Details" selected="true">127 <div data-dojo-type="dijit.layout.ContentPane" title="Project Details"> 128 128 <p>Link to Project</p> 129 129 </div> … … 134 134 <p>Links to external documentation and sites</p> 135 135 </div> 136 <div data-dojo-type="dijit.layout.ContentPane" title="Archive content details" >137 < p>Links to external documentation and sites</p>136 <div data-dojo-type="dijit.layout.ContentPane" title="Archive content details" selected="true"> 137 <div id="docLink_id"><p>Links to external documentation and sites</p></div> 138 138 </div> 139 139 <div data-dojo-type="dijit.layout.ContentPane" title="File list and Checksums">
Note: See TracChangeset
for help on using the changeset viewer.