Interactive interface for browsing global, full-resolution satellite imagery
Adding jcrop.css and minified versions of imageDownload and rubberBand to the repository
Tilak Joshi20d54673a1c2
diff --git a/css/ext/jcrop/Jcrop.gif b/css/ext/jcrop/Jcrop.gifnew file mode 100755index 000000000..72ea7ccb5Binary files /dev/null and b/css/ext/jcrop/Jcrop.gif differdiff --git a/css/ext/jcrop/jcrop.css b/css/ext/jcrop/jcrop.cssnew file mode 100644index 000000000..a95bc7b2a--- /dev/null+++ b/css/ext/jcrop/jcrop.css@@ -0,0 +1,86 @@+/* jquery.Jcrop.css v0.9.10 - MIT License */++/*+ The outer-most container in a typical Jcrop instance+ If you are having difficulty with formatting related to styles+ on a parent element, place any fixes here or in a like selector++ You can also style this element if you want to add a border, etc+ A better method for styling can be seen below with .jcrop-light+ (Add a class to the holder and style elements for that extended class)+*/+.jcrop-holder {+ direction: ltr;+ text-align: left;+}++/* These styles define the border lines */+.jcrop-vline,.jcrop-hline{background:#FFF url(Jcrop.gif) top left repeat;font-size:0;position:absolute;}+.jcrop-vline{height:100%;width:1px!important;}+.jcrop-hline{height:1px!important;width:100%;}+.jcrop-vline.right{right:0;}+.jcrop-hline.bottom{bottom:0;}++/* Handle style - size is set by Jcrop handleSize option (currently) */+.jcrop-handle{background-color:#333;border:1px #eee solid;font-size:1px;}++/* This style is used for invisible click targets */+.jcrop-tracker+{+ height: 100%;+ width: 100%;+ -webkit-tap-highlight-color: transparent; /* "turn off" link highlight */+ -webkit-touch-callout: none; /* disable callout, image save panel */+ -webkit-user-select: none; /* disable cut copy paste */+}++/* Positioning of handles and drag bars */+.jcrop-handle.ord-n{left:50%;margin-left:-4px;margin-top:-4px;top:0;}+.jcrop-handle.ord-s{bottom:0;left:50%;margin-bottom:-4px;margin-left:-4px;}+.jcrop-handle.ord-e{margin-right:-4px;margin-top:-4px;right:0;top:50%;}+.jcrop-handle.ord-w{left:0;margin-left:-4px;margin-top:-4px;top:50%;}+.jcrop-handle.ord-nw{left:0;margin-left:-4px;margin-top:-4px;top:0;}+.jcrop-handle.ord-ne{margin-right:-4px;margin-top:-4px;right:0;top:0;}+.jcrop-handle.ord-se{bottom:0;margin-bottom:-4px;margin-right:-4px;right:0;}+.jcrop-handle.ord-sw{bottom:0;left:0;margin-bottom:-4px;margin-left:-4px;}+.jcrop-dragbar.ord-n,.jcrop-dragbar.ord-s{height:7px;width:100%;}+.jcrop-dragbar.ord-e,.jcrop-dragbar.ord-w{height:100%;width:7px;}+.jcrop-dragbar.ord-n{margin-top:-4px;}+.jcrop-dragbar.ord-s{bottom:0;margin-bottom:-4px;}+.jcrop-dragbar.ord-e{margin-right:-4px;right:0;}+.jcrop-dragbar.ord-w{margin-left:-4px;}++/* The "jcrop-light" class/extension */+.jcrop-light .jcrop-vline,.jcrop-light .jcrop-hline+{+ background:#FFF;+ filter:Alpha(opacity=70)!important;+ opacity:.70!important;+}+.jcrop-light .jcrop-handle+{+ -moz-border-radius:3px;+ -webkit-border-radius:3px;+ background-color:#000;+ border-color:#FFF;+ border-radius:3px;+}++/* The "jcrop-dark" class/extension */+.jcrop-dark .jcrop-vline,.jcrop-dark .jcrop-hline+{+ background:#000;+ filter:Alpha(opacity=70)!important;+ opacity:.7!important;+}+.jcrop-dark .jcrop-handle+{+ -moz-border-radius:3px;+ -webkit-border-radius:3px;+ background-color:#FFF;+ border-color:#000;+ border-radius:3px;+}++/* Fix for twitter bootstrap et al. */+.jcrop-holder img,img.jcrop-preview{ max-width: none; opacity:1.0; }diff --git a/js/imageDownload-min.js b/js/imageDownload-min.jsnew file mode 100644index 000000000..73f06fb92--- /dev/null+++ b/js/imageDownload-min.js@@ -0,0 +1 @@+SOTE.namespace("SOTE.widget.ImageDownload");SOTE.widget.ImageDownload=function(a,b){this.container=document.getElementById(a);this.coords=null;this.RESOLUTIONS_ON_SCREEN_GEO_ALL=[0.5625,0.28125,0.140625,0.0703125,0.03515625,0.017578125,0.0087890625,0.00439453125,0.002197265625];this.RESOLUTIONS_ON_SERVER_GEO_250m=[0.5625,0.28125,0.140625,0.0703125,0.03515625,0.017578125,0.0087890625,0.00439453125,0.002197265625];if(this.container==null){this.setStatus("Error: element '"+a+"' not found!",true);return}if(b===undefined){b={}}this.alignTo=b.alignTo;this.id=a;this.map=null;this.WMTSLayer=null;if(b.baselayer===undefined){b.baselayer=null}this.baseLayer=b.baselayer;this.value="";this.init()};SOTE.widget.ImageDownload.prototype=new SOTE.widget.Component;SOTE.widget.ImageDownload.prototype.init=function(){this.container.setAttribute("class","imagedownload");var a=this;SOTE.widget.ImageDownload.setPosition(this);$(window).resize(function(){SOTE.widget.ImageDownload.setPosition(a)});if(REGISTRY){REGISTRY.register(this.id,this);REGISTRY.markComponentReady(this.id)}else{alert("No REGISTRY found! Cannot register Download!")}this.projectionSwitch="geographic";this.map=new OpenLayers.Map({div:"dlMap",theme:null,controls:[],maxExtent:new OpenLayers.Bounds(-180,-90,180,90),projection:"EPSG:4326",numZoomLevels:9,fractionalZoom:false,resolutions:this.RESOLUTIONS_ON_SCREEN_GEO_ALL,allOverlays:false,zoom:2});this.WMTSLayer=new OpenLayers.Layer.WMTS({name:"dl",url:"http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi",layer:"Download",matrixSet:"EPSG4326_250m",projection:"EPSG:4326",serverResolutions:this.RESOLUTIONS_ON_SERVER_GEO_250m,visibility:false,tileSize:new OpenLayers.Size(512,512),maxExtent:new OpenLayers.Bounds(-180,-90,180,90),style:"_null",isBaseLayer:true});this.map.addLayer(this.WMTSLayer);var b="<div>Resolution:<select id='selImgResolution'><option value='1'>250m</option><option value='2'>500m</option><option value='4'>1km</option><option value='20'>5km</option><option value='40'>10km</option></select>";b+="<br />Format: <select id='selImgFormat'><option value='JPEG'>JPEG</option><option value='PNG'>PNG</option><option value='Gtiff'>GeoTIFF</option></select>";b+="<br />Raw Image Size: ~ <span id='imgFileSize'> </span> MB <br />(<span id='imgWidth''></span> x <span id='imgHeight'></span> pixels)";b+="<br /><span style='font-size:10px; color:#aaa; font-style:italic;'>(Max Size: 250 MB)</span> ";b+="<br /><input type='button' id='btnImgDownload' value='Download'/>";b+="</div>";$("#"+this.id).html(b)};SOTE.widget.ImageDownload.setPosition=function(a){var c=$("#"+a.alignTo.id).offset();var b=c.left+parseInt($("#"+a.alignTo.id).css("width"))-parseInt($("#"+a.id).css("width"));$("#"+a.id).css("left",b+"px")};SOTE.widget.ImageDownload.prototype.setValue=function(a){this.value=a};SOTE.widget.ImageDownload.prototype.getValue=function(){return this.id+"="+this.value};SOTE.widget.ImageDownload.prototype.updateComponent=function(a){var b=SOTE.util.extractFromQuery("map",a);var k=SOTE.util.extractFromQuery("time",a);var p=SOTE.util.extractFromQuery("camera",a);var n=SOTE.util.extractFromQuery("switch",a);var d=SOTE.util.extractFromQuery("products",a);var o=p.split(",");var r=o[0];var f=o[1];var q=o[2];var e=o[3];this.map.zoomToExtent(new OpenLayers.Bounds.fromString(b));var j=this.map.getExtent();var h=this.map.getLonLatFromViewPortPx(new OpenLayers.Pixel(r,e));var g=this.map.getLonLatFromViewPortPx(new OpenLayers.Pixel(q,f));var c="http://map2.vis.earthdata.nasa.gov/imagegen/?";var i=new Date((k.split("T"))[0]+"T00:00:00");var m="00"+(1+Math.ceil((i-new Date(i.getFullYear(),0,1))/86400000));c+="TIME="+i.getFullYear()+(m).substr((m.length)-3);c+="&extent="+h.lon+"+"+h.lat+"+"+g.lon+"+"+g.lat;c+="&LAYERS="+(((((d).replace("baselayers.","")).replace("overlays.","")).replace(/~/g,"+")).replace(/\./g,"+"));var l=0;var t=0;$("select#selImgResolution").change(function(){imgRes=$("#selImgResolution option:selected").val();l=Math.round((Math.abs(g.lon-h.lon)/0.002197)/Number(imgRes));t=Math.round((Math.abs(g.lat-h.lat)/0.002197)/Number(imgRes));imgFilesize=((l*t*24)/8388608).toFixed(2);$("#imgWidth").text((l));$("#imgHeight").text((t));$("#imgFileSize").text(imgFilesize);if(imgFilesize>250){$("#imgFileSize").css("color","#D99694");$("#btnImgDownload").attr("disabled","disabled")}else{$("#imgFileSize").css("color","white");$("#btnImgDownload").removeAttr("disabled")}}).change();$("#btnImgDownload").unbind("click").click(function(){window.open(c+"&format="+$("#selImgFormat option:selected").val()+"&size="+$("#imgWidth").text()+"+"+$("#imgHeight").text(),"_blank")});this.setValue(c)};SOTE.widget.ImageDownload.prototype.loadFromQuery=function(a){return this.setValue(SOTE.util.extractFromQuery(this.id,a))};SOTE.widget.ImageDownload.prototype.validate=function(){};SOTE.widget.ImageDownload.prototype.setSourceUrl=function(a){};SOTE.widget.ImageDownload.prototype.getSourceUrl=function(){};SOTE.widget.ImageDownload.prototype.setStatus=function(a){};SOTE.widget.ImageDownload.prototype.getStatus=function(){};\ No newline at end of filediff --git a/js/rubberBand-min.js b/js/rubberBand-min.jsnew file mode 100644index 000000000..104f5d2e2--- /dev/null+++ b/js/rubberBand-min.js@@ -0,0 +1 @@+SOTE.namespace("SOTE.widget.RubberBand");SOTE.widget.RubberBand=function(a,b){this.container=document.getElementById(a);this.coords=null;if(this.container==null){this.setStatus("Error: element '"+a+"' not found!",true);return}if(b===undefined){b={}}this.icon=b.icon;this.onicon=b.onicon;this.cropee=b.cropee;this.projectionSwitch="geographic";this.id=a;this.state="off";this.jcropAPI=null;this.init()};SOTE.widget.RubberBand.prototype=new SOTE.widget.Component;SOTE.widget.RubberBand.prototype.init=function(){this.container.setAttribute("class","rubberband");this.container.innerHTML="<a id='"+this.id+"camera_link' class='toolbaricon'><img src='"+this.icon+"' /></a>";$("#"+this.id+"camera_link").bind("click",{self:this},SOTE.widget.RubberBand.toggle);if(REGISTRY){REGISTRY.register(this.id,this);REGISTRY.markComponentReady(this.id)}else{alert("No REGISTRY found! Cannot register Rubber Band!")}};SOTE.widget.RubberBand.toggle=function(b){var a=b.data.self;if(a.state=="off"){a.state="on";$("#"+a.id+"camera_link img").attr("src",a.onicon);$("#imagedownload").show("slide",{direction:"up"},1000);a.draw()}else{a.state="off";$("#"+a.id+"camera_link img").attr("src",a.icon);a.jcropAPI.destroy();$("#imagedownload").hide("slide",{direction:"up"},1000)}};SOTE.widget.RubberBand.prototype.setValue=function(a){this.coords=a;this.fire()};SOTE.widget.RubberBand.prototype.getValue=function(){if(this.coords){var a=this.id+"="+this.coords.x+","+this.coords.y+","+this.coords.x2+","+this.coords.y2+","+this.coords.w+","+this.coords.h;return a}else{return}};SOTE.widget.RubberBand.prototype.updateComponent=function(a){this.projectionSwitch=SOTE.util.extractFromQuery("switch",a)};SOTE.widget.RubberBand.prototype.loadFromQuery=function(a){return this.setValue(SOTE.util.extractFromQuery(this.id,a))};SOTE.widget.RubberBand.prototype.validate=function(){};SOTE.widget.RubberBand.prototype.setSourceUrl=function(a){};SOTE.widget.RubberBand.prototype.getSourceUrl=function(){};SOTE.widget.RubberBand.prototype.setStatus=function(a){};SOTE.widget.RubberBand.prototype.getStatus=function(){};SOTE.widget.RubberBand.prototype.draw=function(){if(this.projectionSwitch!="geographic"){alert("The download feature is currently available for geograpic projection only.");return -1}var a=this;$("#"+this.cropee).Jcrop({bgColor:"black",bgOpacity:0.3,onSelect:function(b){SOTE.widget.RubberBand.handleChange(b,a)},onChange:function(b){SOTE.widget.RubberBand.handleChange(b,a)},fullScreen:true});this.jcropAPI=$("#"+this.cropee).data("Jcrop");this.jcropAPI.setSelect([($(window).width()/2)-100,($(window).height()/2)-100,($(window).width()/2)+100,($(window).height()/2)+100])};SOTE.widget.RubberBand.handleChange=function(b,a){a.setValue(b)};SOTE.widget.RubberBand.prototype.fire=function(){if(REGISTRY){REGISTRY.fire(this)}else{alert("No REGISTRY found! Cannot fire to REGISTRY from Map!")}};\ No newline at end of file