source:
trunk/workshop-routing-foss4g/web/proj4js/lib/projCode/eqc.js
@
81
Revision 76, 1.2 KB checked in by djay, 13 years ago (diff) | |
---|---|
|
Line | |
---|---|
1 | /* similar to equi.js FIXME proj4 uses eqc */ |
2 | Proj4js.Proj.eqc = { |
3 | init : function() { |
4 | |
5 | if(!this.x0) this.x0=0; |
6 | if(!this.y0) this.y0=0; |
7 | if(!this.lat0) this.lat0=0; |
8 | if(!this.long0) this.long0=0; |
9 | if(!this.lat_ts) this.lat_ts=0; |
10 | if (!this.title) this.title = "Equidistant Cylindrical (Plate Carre)"; |
11 | |
12 | this.rc= Math.cos(this.lat_ts); |
13 | }, |
14 | |
15 | |
16 | // forward equations--mapping lat,long to x,y |
17 | // ----------------------------------------------------------------- |
18 | forward : function(p) { |
19 | |
20 | var lon= p.x; |
21 | var lat= p.y; |
22 | |
23 | var dlon = Proj4js.common.adjust_lon(lon - this.long0); |
24 | var dlat = Proj4js.common.adjust_lat(lat - this.lat0 ); |
25 | p.x= this.x0 + (this.a*dlon*this.rc); |
26 | p.y= this.y0 + (this.a*dlat ); |
27 | return p; |
28 | }, |
29 | |
30 | // inverse equations--mapping x,y to lat/long |
31 | // ----------------------------------------------------------------- |
32 | inverse : function(p) { |
33 | |
34 | var x= p.x; |
35 | var y= p.y; |
36 | |
37 | p.x= Proj4js.common.adjust_lon(this.long0 + ((x - this.x0)/(this.a*this.rc))); |
38 | p.y= Proj4js.common.adjust_lat(this.lat0 + ((y - this.y0)/(this.a ))); |
39 | return p; |
40 | } |
41 | |
42 | }; |
Note: See TracBrowser
for help on using the repository browser.