Debian Codegraph @

dojox/geo/openlayers/_base.js

raw symbols SCIP
1 define(["dojo/_base/lang"], function(lang){
2
3 var openlayers = lang.getObject("dojox.geo.openlayers", true);
4 /*===== openlayers = dojox.geo.openlayers; =====*/
5
6 openlayers.BaseLayerType = {
7 // summary:
8 // Defines the base layer types to be used at Map construction time or
9 // with the setBaseLayerType function.
10 // description:
11 // This object defines the base layer types to be used at Map construction
12 // time or with the setBaseLayerType function.
13
14 // OSM: String
15 // The Open Street Map base layer type selector.
16 OSM: "OSM",
17
18 // Transport: String
19 // The Open Cycle Map transport layer type selector.
20 Transport: "OSM.Transport",
21
22 // WMS: String
23 // The Web Map Server base layer type selector.
24 WMS: "WMS",
25
26 // GOOGLE: String
27 // The Google base layer type selector.
28 GOOGLE: "Google",
29
30 // VIRTUAL_EARTH: String
31 // The Virtual Earth base layer type selector.
32 VIRTUAL_EARTH: "VirtualEarth",
33
34 // BING: String
35 // Same as Virtual Earth
36 BING: "VirtualEarth",
37
38 // YAHOO: String
39 // The Yahoo base layer type selector.
40 YAHOO: "Yahoo",
41
42 // ARCGIS: String
43 // The ESRI ARCGis base layer selector.
44 ARCGIS: "ArcGIS"
45 };
46
47 openlayers.EPSG4326 = new OpenLayers.Projection("EPSG:4326");
48
49 var re = /^\s*(\d{1,3})[D°]\s*(\d{1,2})[M']\s*(\d{1,2}\.?\d*)\s*(S|"|'')\s*([NSEWnsew]{0,1})\s*$/i;
50 openlayers.parseDMS = function(v, toDecimal){
51 // summary:
52 // Parses the specified string and returns degree minute second or decimal degree.
53 // description:
54 // Parses the specified string and returns degree minute second or decimal degree.
55 // v: String
56 // The string to parse
57 // toDecimal: Boolean
58 // Specifies if the result should be returned in decimal degrees or in an array
59 // containing the degrees, minutes, seconds values.
60 // returns: Float|Array
61 // the parsed value in decimal degrees or an array containing the degrees, minutes, seconds values.
62
63 var res = re.exec(v);
64 if(res == null || res.length < 5){
65 return parseFloat(v);
66 }
67 var d = parseFloat(res[1]);
68 var m = parseFloat(res[2]);
69 var s = parseFloat(res[3]);
70 var nsew = res[5];
71 if(toDecimal){
72 var lc = nsew.toLowerCase();
73 var dd = d + (m + s / 60.0) / 60.0;
74 if(lc == "w" || lc == "s"){
75 dd = -dd;
76 }
77 return dd;
78 }
79 return [d, m, s, nsew];
80 };
81
82 return openlayers;
83 });