From: Richard G. <ric...@gm...> - 2007-05-24 18:29:59
|
On 5/24/07, olivier.terral <oli...@ge...> wrote: > I begin to integrate cscs.js : > > I choose the way : > -load cscs.js file in mapbuilder.js like others (Sarissa,Util .....). > - delete all lines in Proj.js and replace by loading script necessary to > a specific srs in param like this: > > function Proj(srs) { > var tmp = srs.split(":"); > cs = tmp[0]+tmp[1]; > //transform EPSG:27563 in EPSG27563 > > mapbuilder.loadScript(baseDir+"/util/cscs/lib/defs/"+cs+".js"); > //load proj4 definition of srs > var epsg =new CS(eval("csList."+cs)); > //create th CS object > epsg.srs=srs; > //add a param 'srs', necessary for openlayers > epsg.units="m"; > //units param should be added in cscs.js file > > mapbuilder.loadScript(baseDir+"/util/cscs/lib/"+epsg.proj+".js"); > //load projection script, in that case : lambert conformal conic > return epsg; > //retourne l'objet Proj . > } > > Problem of this method, the function > "mapbuilder.loadScript(baseDir+"/util/cscs/lib/defs/"+cs+".js");" insert > script in the head of html page but cannot execute the contain of the > js file. > > Anybody know another method to load a js file? You could just load the js files statically. (This would require the web application developer to know which files they needed at design time.) I would at least start with that approach and get the function calls working before worrying about dynamic loading. -- Richard Greenwood ric...@gm... www.greenwoodmap.com |