fixes CHANGES.txt
[syp.git] / openlayers / lib / OpenLayers.js
1 /* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD
2  * license.  See http://svn.openlayers.org/trunk/openlayers/license.txt for the
3  * full text of the license. */
4
5 /* 
6  * @requires OpenLayers/BaseTypes.js
7  * @requires OpenLayers/Lang/en.js
8  * @requires OpenLayers/Console.js
9  */ 
10
11 (function() {
12     /**
13      * Before creating the OpenLayers namespace, check to see if
14      * OpenLayers.singleFile is true.  This occurs if the
15      * OpenLayers/SingleFile.js script is included before this one - as is the
16      * case with single file builds.
17      */
18     var singleFile = (typeof OpenLayers == "object" && OpenLayers.singleFile);
19     
20     /**
21      * Namespace: OpenLayers
22      * The OpenLayers object provides a namespace for all things OpenLayers
23      */
24     window.OpenLayers = {
25         
26         /**
27          * Property: _scriptName
28          * {String} Relative path of this script.
29          */
30         _scriptName: (!singleFile) ? "lib/OpenLayers.js" : "OpenLayers.js",
31
32         /**
33          * Function: _getScriptLocation
34          * Return the path to this script.
35          *
36          * Returns:
37          * {String} Path to this script
38          */
39         _getScriptLocation: function () {
40             var scriptLocation = "";            
41             var isOL = new RegExp("(^|(.*?\\/))(" + OpenLayers._scriptName + ")(\\?|$)");
42          
43             var scripts = document.getElementsByTagName('script');
44             for (var i=0, len=scripts.length; i<len; i++) {
45                 var src = scripts[i].getAttribute('src');
46                 if (src) {
47                     var match = src.match(isOL);
48                     if(match) {
49                         scriptLocation = match[1];
50                         break;
51                     }
52                 }
53             }
54             return scriptLocation;
55         }
56     };
57     /**
58      * OpenLayers.singleFile is a flag indicating this file is being included
59      * in a Single File Library build of the OpenLayers Library.
60      * 
61      * When we are *not* part of a SFL build we dynamically include the
62      * OpenLayers library code.
63      * 
64      * When we *are* part of a SFL build we do not dynamically include the 
65      * OpenLayers library code as it will be appended at the end of this file.
66       */
67     if(!singleFile) {
68         var jsfiles = new Array(
69             "OpenLayers/Util.js",
70             "OpenLayers/BaseTypes.js",
71             "OpenLayers/BaseTypes/Class.js",
72             "OpenLayers/BaseTypes/Bounds.js",
73             "OpenLayers/BaseTypes/Element.js",
74             "OpenLayers/BaseTypes/LonLat.js",
75             "OpenLayers/BaseTypes/Pixel.js",
76             "OpenLayers/BaseTypes/Size.js",
77             "OpenLayers/Console.js",
78             "OpenLayers/Tween.js",
79             "Rico/Corner.js",
80             "Rico/Color.js",
81             "OpenLayers/Ajax.js",
82             "OpenLayers/Events.js",
83             "OpenLayers/Request.js",
84             "OpenLayers/Request/XMLHttpRequest.js",
85             "OpenLayers/Projection.js",
86             "OpenLayers/Map.js",
87             "OpenLayers/Layer.js",
88             "OpenLayers/Icon.js",
89             "OpenLayers/Marker.js",
90             "OpenLayers/Marker/Box.js",
91             "OpenLayers/Popup.js",
92             "OpenLayers/Tile.js",
93             "OpenLayers/Tile/Image.js",
94             "OpenLayers/Tile/WFS.js",
95             "OpenLayers/Layer/Image.js",
96             "OpenLayers/Layer/SphericalMercator.js",
97             "OpenLayers/Layer/EventPane.js",
98             "OpenLayers/Layer/FixedZoomLevels.js",
99             "OpenLayers/Layer/Google.js",
100             "OpenLayers/Layer/VirtualEarth.js",
101             "OpenLayers/Layer/Yahoo.js",
102             "OpenLayers/Layer/HTTPRequest.js",
103             "OpenLayers/Layer/Grid.js",
104             "OpenLayers/Layer/MapGuide.js",
105             "OpenLayers/Layer/MapServer.js",
106             "OpenLayers/Layer/MapServer/Untiled.js",
107             "OpenLayers/Layer/KaMap.js",
108             "OpenLayers/Layer/KaMapCache.js",
109             "OpenLayers/Layer/MultiMap.js",
110             "OpenLayers/Layer/Markers.js",
111             "OpenLayers/Layer/Text.js",
112             "OpenLayers/Layer/WorldWind.js",
113             "OpenLayers/Layer/ArcGIS93Rest.js",
114             "OpenLayers/Layer/WMS.js",
115             "OpenLayers/Layer/WMS/Untiled.js",
116             "OpenLayers/Layer/ArcIMS.js",
117             "OpenLayers/Layer/GeoRSS.js",
118             "OpenLayers/Layer/Boxes.js",
119             "OpenLayers/Layer/XYZ.js",
120             "OpenLayers/Layer/TMS.js",
121             "OpenLayers/Layer/TileCache.js",
122             "OpenLayers/Popup/Anchored.js",
123             "OpenLayers/Popup/AnchoredBubble.js",
124             "OpenLayers/Popup/Framed.js",
125             "OpenLayers/Popup/FramedCloud.js",
126             "OpenLayers/Feature.js",
127             "OpenLayers/Feature/Vector.js",
128             "OpenLayers/Feature/WFS.js",
129             "OpenLayers/Handler.js",
130             "OpenLayers/Handler/Click.js",
131             "OpenLayers/Handler/Hover.js",
132             "OpenLayers/Handler/Point.js",
133             "OpenLayers/Handler/Path.js",
134             "OpenLayers/Handler/Polygon.js",
135             "OpenLayers/Handler/Feature.js",
136             "OpenLayers/Handler/Drag.js",
137             "OpenLayers/Handler/RegularPolygon.js",
138             "OpenLayers/Handler/Box.js",
139             "OpenLayers/Handler/MouseWheel.js",
140             "OpenLayers/Handler/Keyboard.js",
141             "OpenLayers/Control.js",
142             "OpenLayers/Control/Attribution.js",
143             "OpenLayers/Control/Button.js",
144             "OpenLayers/Control/ZoomBox.js",
145             "OpenLayers/Control/ZoomToMaxExtent.js",
146             "OpenLayers/Control/DragPan.js",
147             "OpenLayers/Control/Navigation.js",
148             "OpenLayers/Control/MouseDefaults.js",
149             "OpenLayers/Control/MousePosition.js",
150             "OpenLayers/Control/OverviewMap.js",
151             "OpenLayers/Control/KeyboardDefaults.js",
152             "OpenLayers/Control/PanZoom.js",
153             "OpenLayers/Control/PanZoomBar.js",
154             "OpenLayers/Control/ArgParser.js",
155             "OpenLayers/Control/Permalink.js",
156             "OpenLayers/Control/Scale.js",
157             "OpenLayers/Control/ScaleLine.js",
158             "OpenLayers/Control/Snapping.js",
159             "OpenLayers/Control/Split.js",
160             "OpenLayers/Control/LayerSwitcher.js",
161             "OpenLayers/Control/DrawFeature.js",
162             "OpenLayers/Control/DragFeature.js",
163             "OpenLayers/Control/ModifyFeature.js",
164             "OpenLayers/Control/Panel.js",
165             "OpenLayers/Control/SelectFeature.js",
166             "OpenLayers/Control/NavigationHistory.js",
167             "OpenLayers/Control/Measure.js",
168             "OpenLayers/Control/WMSGetFeatureInfo.js",
169             "OpenLayers/Geometry.js",
170             "OpenLayers/Geometry/Rectangle.js",
171             "OpenLayers/Geometry/Collection.js",
172             "OpenLayers/Geometry/Point.js",
173             "OpenLayers/Geometry/MultiPoint.js",
174             "OpenLayers/Geometry/Curve.js",
175             "OpenLayers/Geometry/LineString.js",
176             "OpenLayers/Geometry/LinearRing.js",        
177             "OpenLayers/Geometry/Polygon.js",
178             "OpenLayers/Geometry/MultiLineString.js",
179             "OpenLayers/Geometry/MultiPolygon.js",
180             "OpenLayers/Geometry/Surface.js",
181             "OpenLayers/Renderer.js",
182             "OpenLayers/Renderer/Elements.js",
183             "OpenLayers/Renderer/SVG.js",
184             "OpenLayers/Renderer/Canvas.js",
185             "OpenLayers/Renderer/VML.js",
186             "OpenLayers/Layer/Vector.js",
187             "OpenLayers/Layer/Vector/RootContainer.js",
188             "OpenLayers/Strategy.js",
189             "OpenLayers/Strategy/Fixed.js",
190             "OpenLayers/Strategy/Cluster.js",
191             "OpenLayers/Strategy/Paging.js",
192             "OpenLayers/Strategy/BBOX.js",
193             "OpenLayers/Strategy/Save.js",
194             "OpenLayers/Protocol.js",
195             "OpenLayers/Protocol/HTTP.js",
196             "OpenLayers/Protocol/SQL.js",
197             "OpenLayers/Protocol/SQL/Gears.js",
198             "OpenLayers/Protocol/WFS.js",
199             "OpenLayers/Protocol/WFS/v1.js",
200             "OpenLayers/Protocol/WFS/v1_0_0.js",
201             "OpenLayers/Protocol/WFS/v1_1_0.js",
202             "OpenLayers/Layer/PointTrack.js",
203             "OpenLayers/Layer/GML.js",
204             "OpenLayers/Style.js",
205             "OpenLayers/StyleMap.js",
206             "OpenLayers/Rule.js",
207             "OpenLayers/Filter.js",
208             "OpenLayers/Filter/FeatureId.js",
209             "OpenLayers/Filter/Logical.js",
210             "OpenLayers/Filter/Comparison.js",
211             "OpenLayers/Filter/Spatial.js",
212             "OpenLayers/Format.js",
213             "OpenLayers/Format/XML.js",
214             "OpenLayers/Format/ArcXML.js",
215             "OpenLayers/Format/ArcXML/Features.js",
216             "OpenLayers/Format/GML.js",
217             "OpenLayers/Format/GML/Base.js",
218             "OpenLayers/Format/GML/v2.js",
219             "OpenLayers/Format/GML/v3.js",
220             "OpenLayers/Format/KML.js",
221             "OpenLayers/Format/GeoRSS.js",
222             "OpenLayers/Format/WFS.js",
223             "OpenLayers/Format/WFSCapabilities.js",
224             "OpenLayers/Format/WFSCapabilities/v1.js",
225             "OpenLayers/Format/WFSCapabilities/v1_0_0.js",
226             "OpenLayers/Format/WFSCapabilities/v1_1_0.js",
227             "OpenLayers/Format/WFSDescribeFeatureType.js",
228             "OpenLayers/Format/WMSDescribeLayer.js",
229             "OpenLayers/Format/WMSDescribeLayer/v1_1.js",
230             "OpenLayers/Format/WKT.js",
231             "OpenLayers/Format/OSM.js",
232             "OpenLayers/Format/GPX.js",
233             "OpenLayers/Format/Filter.js",
234             "OpenLayers/Format/Filter/v1.js",
235             "OpenLayers/Format/Filter/v1_0_0.js",
236             "OpenLayers/Format/Filter/v1_1_0.js",
237             "OpenLayers/Format/SLD.js",
238             "OpenLayers/Format/SLD/v1.js",
239             "OpenLayers/Format/SLD/v1_0_0.js",
240             "OpenLayers/Format/SLD/v1.js",
241             "OpenLayers/Format/WFST.js",
242             "OpenLayers/Format/WFST/v1.js",
243             "OpenLayers/Format/WFST/v1_0_0.js",
244             "OpenLayers/Format/WFST/v1_1_0.js",
245             "OpenLayers/Format/Text.js",
246             "OpenLayers/Format/JSON.js",
247             "OpenLayers/Format/GeoJSON.js",
248             "OpenLayers/Format/WMC.js",
249             "OpenLayers/Format/WMC/v1.js",
250             "OpenLayers/Format/WMC/v1_0_0.js",
251             "OpenLayers/Format/WMC/v1_1_0.js",
252             "OpenLayers/Format/WMSCapabilities.js",
253             "OpenLayers/Format/WMSCapabilities/v1_1.js",
254             "OpenLayers/Format/WMSCapabilities/v1_1_0.js",
255             "OpenLayers/Format/WMSCapabilities/v1_1_1.js",
256             "OpenLayers/Format/WMSGetFeatureInfo.js",
257             "OpenLayers/Layer/WFS.js",
258             "OpenLayers/Control/GetFeature.js",
259             "OpenLayers/Control/MouseToolbar.js",
260             "OpenLayers/Control/NavToolbar.js",
261             "OpenLayers/Control/PanPanel.js",
262             "OpenLayers/Control/Pan.js",
263             "OpenLayers/Control/ZoomIn.js",
264             "OpenLayers/Control/ZoomOut.js",
265             "OpenLayers/Control/ZoomPanel.js",
266             "OpenLayers/Control/EditingToolbar.js",
267             "OpenLayers/Lang.js",
268             "OpenLayers/Lang/en.js"
269         ); // etc.
270
271         var agent = navigator.userAgent;
272         var docWrite = (agent.match("MSIE") || agent.match("Safari"));
273         if(docWrite) {
274             var allScriptTags = new Array(jsfiles.length);
275         }
276         var host = OpenLayers._getScriptLocation() + "lib/";    
277         for (var i=0, len=jsfiles.length; i<len; i++) {
278             if (docWrite) {
279                 allScriptTags[i] = "<script src='" + host + jsfiles[i] +
280                                    "'></script>"; 
281             } else {
282                 var s = document.createElement("script");
283                 s.src = host + jsfiles[i];
284                 var h = document.getElementsByTagName("head").length ? 
285                            document.getElementsByTagName("head")[0] : 
286                            document.body;
287                 h.appendChild(s);
288             }
289         }
290         if (docWrite) {
291             document.write(allScriptTags.join(""));
292         }
293     }
294 })();
295
296 /**
297  * Constant: VERSION_NUMBER
298  */
299 OpenLayers.VERSION_NUMBER="OpenLayers 2.8 -- $Revision: 9492 $";