<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">the window.plugins.fileDownload is a plugin for PG, but use the one that ships with PG now.<div><br></div><div>You have to set getUrl on the layer....</div><div><br></div><div><br></div><div><div>layer = new OpenLayers.Layer.WMS(ms[s].name ,ms[s].url,{</div><div><span class="Apple-tab-span" style="white-space:pre">                                                                                </span>layers:new String(ms[s].layers),</div><div><span class="Apple-tab-span" style="white-space:pre">                                                                                </span>format:'image/png',</div><div><span class="Apple-tab-span" style="white-space:pre">                                                                                </span>TRANSPARENT:transparent</div><div><span class="Apple-tab-span" style="white-space:pre">                                                                                </span>},{</div><div><span class="Apple-tab-span" style="white-space:pre">                                                                                </span>transitionEffect:'resize',</div><div><span class="Apple-tab-span" style="white-space:pre">                                                                                </span>singleTile: false,&nbsp;</div><div><span class="Apple-tab-span" style="white-space:pre">                                                                                </span>ratio: 1.3671875,</div><div><span class="Apple-tab-span" style="white-space:pre">                                                                                </span>isBaseLayer:false,</div><div><span class="Apple-tab-span" style="white-space:pre">                                                                                </span>visibility:(ms[s].layers != ''),</div><div>getURL:function(bounds)</div><div>{</div><div>var url = this.getFullRequestString({bbox:bounds.toBBOX(),height:this.tileSize.h,width:this.tileSize.w},'');</div><div>//console.log(url);</div><div>var filename = mm.encrypt('md5',url);</div><div>if(typeof(localStorage[filename]) != 'undefined')</div><div>{</div><div>&nbsp; &nbsp; console.log('cache');</div><div>&nbsp; &nbsp; return localStorage[filename];</div><div>}</div><div>else</div><div>{</div><div>&nbsp; &nbsp; console.log('not cache');</div><div>&nbsp; &nbsp; window.plugins.fileDownload.downloadFile(url,'/' + mm.encrypt('sha1',url) + '.png',function(fp){localStorage[filename] = fp},function(){});</div><div>&nbsp; &nbsp; return url;</div><div>}</div><div>}</div><div><span class="Apple-tab-span" style="white-space:pre">                                                                                </span>});</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                                                                </span>map.addLayer(layer);</div></div><div><br></div><div>this the one I use.....</div><div><br></div><div><br><div><div>Den 16/04/2012 kl. 15.36 skrev Steve Nelson:</div><br class="Apple-interchange-newline"><blockquote type="cite">I didn't see this message. That looks exactly like what i'm looking for.<div><br></div><div>What the heck is window.plugins.fileDownload? I've never seen that before.</div><div><br></div><div>Also, I did a search through OpenLayers.js and it found 17 getURL:function(bounds) can you point me in the right direction with which one you modified? If not, I'll just use trial and error to figure it out. Thanks Tue!</div>
<div><br></div><div>Steve<br><br><div class="gmail_quote">On Fri, Mar 23, 2012 at 9:56 AM, Tue Topholm <span dir="ltr">&lt;<a href="mailto:tt@sugee.dk">tt@sugee.dk</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I have used this_<br>
<br>
getURL:function(bounds)<br>
{<br>
var url = this.getFullRequestString({bbox:bounds.toBBOX(),height:this.tileSize.h,width:this.tileSize.w},'');<br>
<br>
if(typeof(localStorage[filename]) != 'undefined')<br>
{<br>
 &nbsp; &nbsp; return localStorage[filename];<br>
}<br>
else<br>
{<br>
 &nbsp; &nbsp;window.plugins.fileDownload.downloadFile(url,'/' + sha1(url) +<br>
'.png',function(fp){localStorage[filename] = fp},function(){});<br>
 &nbsp; &nbsp;return url;<br>
}<br>
}<br>
<br>
<br>
<br>
it was using another download plugin, so it just needs to be changed to PG's<br>
<br>
md5 and sha1 is js functions for doing md5 and sha1<br>
<div class="im">--<br>
<br>
Med venlig hilsen / Kind regards<br>
<br>
Tue Topholm<br>
Sugee<br>
Tlf: <a href="tel:%2B45%2032%2013%2032%2032" value="+4532133232">+45 32 13 32 32</a><br>
W: <a href="http://www.sugee.dk/" target="_blank">http://www.sugee.dk</a><br>
<br>
<br>
<br>
</div>23. mar. 2012 14.49 skrev Diego Guidi &lt;<a href="mailto:diegoguidi@gmail.com">diegoguidi@gmail.com</a>&gt;:<br>
<div><div></div><div class="h5">&gt;&gt; Phonegap (a tool for creating native iphone/android apps with HTML/js) is<br>
&gt;&gt; able to do it and HTML5 is able to do it also.<br>
&gt;&gt;<br>
&gt;&gt; <a href="http://docs.phonegap.com/en/1.5.0/phonegap_file_file.md.html#FileTransfer" target="_blank">http://docs.phonegap.com/en/1.5.0/phonegap_file_file.md.html#FileTransfer</a><br>
&gt; HTML5 uses localstorage, i.e 10mb space maximum available.<br>
&gt; PhoneGap file API doesn't suffer of this limit.<br>
</div></div><div><div></div><div class="h5">&gt; _______________________________________________<br>
&gt; Users mailing list<br>
&gt; <a href="mailto:Users@lists.osgeo.org">Users@lists.osgeo.org</a><br>
&gt; <a href="http://lists.osgeo.org/mailman/listinfo/openlayers-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/openlayers-users</a><br>
</div></div></blockquote></div><br></div>
</blockquote></div><br></div></body></html>