Compare commits

...

69 Commits

Author SHA1 Message Date
crschmidt
0e9c6a45e4 Tag final 2.3 release.
git-svn-id: http://svn.openlayers.org/tags/openlayers/release-2.3@2255 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2007-02-21 21:24:03 +00:00
crschmidt
a4c86b0489 Tag 2.3-RC3.
git-svn-id: http://svn.openlayers.org/tags/openlayers/release-2.3-rc3@2235 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2007-02-16 21:32:40 +00:00
crschmidt
538302fa9b Pullups for 2.3:
svn merge svn.openlayers.org/trunk/openlayers/@2230 svn.openlayers.org/trunk/openlayers/@2233 svn.openlayers.org/branches/openlayers/2.3/
#480   Grid funkiness
#491   improper URL encoding of LAYERS list in WMS GetMap request
#500   layer.destroy() should remove itself from the map but not set new baselayer


git-svn-id: http://svn.openlayers.org/branches/openlayers/2.3@2234 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2007-02-16 21:10:02 +00:00
Schuyler Erle
b7bf7d5436 Pull up r2181:r2229 to 2.3 branch. Includes fixes for:
#429 fix panning for odd size viewport
#478 Double clicking overview map expand/contract button zooms in Safari
#484 conflict between _addButton of MouseToolbar and PanZoom
#485 null pointer exception on CTRL+F5 in IE for WMS.Untiled
#486 add a few sanity checks to overview map
#489 requires tag incorrect in OverviewMap.js   
#498 overviewmap: rectangle has minimum height in IE



git-svn-id: http://svn.openlayers.org/branches/openlayers/2.3@2230 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2007-02-16 19:08:01 +00:00
crschmidt
7232cfa3a0 Pull up patches for the following bugs from trunk:
#385: building for windows users (fix license)
#453: IE gives new DOM elements a parent with fragment node type
#454: Fix tests which are breaking in Opera
#455: Util.isEquivalentUrl broken in Opera
#463: map.setBaseLayer is a bit funky
#464: Overview Map dissappears when on permalinked page
#465: allow controls to live outside viewport (for real)
#466: HTMLDivElement is still undefined in IE7 (but 
      OpenLayers.Util.alphaHack() is now false)
#467: isEquivalentURL() not complete for IE
#468: Overview MapLosing Rectangle
#469: Default marker is incorrectly centered
#470: Can not use "search" property IE7
#473: Remove call to checkImgURL
#474: overview map isn't properly updated when the argparser kicks in


git-svn-id: http://svn.openlayers.org/branches/openlayers/2.3@2181 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2007-01-22 23:26:32 +00:00
crschmidt
2642f000fd Create 2.3 release.
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.3@2105 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-12-31 02:10:30 +00:00
euzuro
8ebc5b227a adding example for changing the marker icon
git-svn-id: http://svn.openlayers.org/trunk/openlayers@2103 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-12-27 21:11:35 +00:00
crschmidt
4cac0a24ea Patch from euzuro for #448 . Make mouseWheel work on MouseToolbar.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@2102 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-12-27 16:53:26 +00:00
crschmidt
6c9cb570c7 Remove accidental debugging statement.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@2101 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-12-23 05:20:09 +00:00
crschmidt
f028effec2 tschaub pointed out that this test didn't actually test anything interesting.
Change that.


git-svn-id: http://svn.openlayers.org/trunk/openlayers@2100 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-12-22 20:21:58 +00:00
Schuyler Erle
5d00a21863 Updated release.sh to fix #416.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@2099 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-12-22 20:19:19 +00:00
Schuyler Erle
ba85494e5e Merged in r1747 from source:/sandbox/tschaub/wc/tools/mergejs.py.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@2098 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-12-22 20:04:48 +00:00
Schuyler Erle
7c0bc17be1 Refactored mergejs.py to make it possible to call from other Python scripts.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@2097 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-12-22 19:52:56 +00:00
Schuyler Erle
86d4133039 Statement should end in a semicolon.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@2096 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-12-22 19:49:19 +00:00
euzuro
6462a7dc29 sorry. last few bits of #441
git-svn-id: http://svn.openlayers.org/trunk/openlayers@2095 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-12-22 19:33:57 +00:00
euzuro
112978ac3d patch for #441 - resolving Rico namespace conflict
git-svn-id: http://svn.openlayers.org/trunk/openlayers@2094 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-12-22 19:31:32 +00:00
crschmidt
01cf10f53d Tests, example change, and Util addition, plus usage in Tile/Image to allow
use of relative URLs, urls with port 80 in them, etc. patch originally from
tschaub, revised by euzuro, reviewed by me. 


git-svn-id: http://svn.openlayers.org/trunk/openlayers@2093 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-12-22 19:03:32 +00:00
crschmidt
88ac5a803c Followup to #449: Missed part of the commit, which protects against doing
a checkImgURL on a tile which has been destroyed.


git-svn-id: http://svn.openlayers.org/trunk/openlayers@2092 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-12-22 18:50:30 +00:00
crschmidt
7e9eef8d07 Commit a number of improvements to grid handling from #449. This adds
support for buffer:0 on grids, and includes changes to Remove extra 
rows and columns from the grid in _initTiles when reusing an existing 
grid, which is a fix to #357 and #436. 


git-svn-id: http://svn.openlayers.org/trunk/openlayers@2091 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-12-22 18:35:04 +00:00
crschmidt
b46a513077 Fix EOL-style on all remaining files.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@2090 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-12-22 17:43:14 +00:00
crschmidt
f17ec3ab7d Fix SVN eol-style properties on controls.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@2089 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-12-22 17:40:54 +00:00
crschmidt
063a10d4ac This is the outside_viewport patch from tschaub for #446:
http://trac.openlayers.org/attachment/ticket/446/outside_viewport.patch

The large diff is because I am suffering under constraints of a bad working
environment. I hate newlines! This patch closes #446.


git-svn-id: http://svn.openlayers.org/trunk/openlayers@2088 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-12-22 17:35:34 +00:00
crschmidt
46767efed2 change map.addControlToMap to allow controls outside viewport, from
Ticket #445: externalControl.patch. Closes #445. 


git-svn-id: http://svn.openlayers.org/trunk/openlayers@2087 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-12-22 17:19:23 +00:00
crschmidt
9c6817f5d6 Apply "patch to put event registering in correct place", euzuro, #448 .
git-svn-id: http://svn.openlayers.org/trunk/openlayers@2075 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-12-16 15:47:37 +00:00
crschmidt
94dc03ea90 Patch for #438 from Tim Schaub: "forces untiled WMS layer to redraw on
mergeNewParams". Since the Untiled layer won't redraw if the map is not
outside the current bounds, we force it with a 'zoomChanged' flag, which 
indicates that the layer should redraw regardless.


git-svn-id: http://svn.openlayers.org/trunk/openlayers@2074 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-12-16 15:30:16 +00:00
crschmidt
2d7f2d2f47 Commit tschaub's patch for #447. This should let people who are having 'pink
tile' problems where right clicking returns the right tile not have problems
anymore. Note that this is seperate from TileCache related issues where 
OpenLayers doesn't request tiles on a grid. 

Note that I have no reason why this should work. In fact, I'd say it 
*shouldn't* work, but other people are seeing this problem, so I'm glad
to have the code in trunk, since it doesn't change teh default behavior.

Thanks to Tim for the patch.


git-svn-id: http://svn.openlayers.org/trunk/openlayers@2048 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-12-13 20:22:30 +00:00
euzuro
c014e5ea72 r2039 contained a small stylistic change that I thought was insignificant but upon further reflection is not. the '||' style is beautiful, but it breaks if a 0, '', or 'false' value is specified (as they all evaluate to false, and thus the default is taken). So if the user wants to specify a 0-width border, s/he cannot. This commit reverts to how it previously was, with the addition of {} as per OL coding standards. Also the addition of one small line break, also for coding standards
git-svn-id: http://svn.openlayers.org/trunk/openlayers@2040 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-12-13 13:22:47 +00:00
euzuro
d5a7f1ef5c updating jsdoc comments for accuracy
git-svn-id: http://svn.openlayers.org/trunk/openlayers@2039 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-12-13 13:15:29 +00:00
euzuro
ba89ea595e updating jsdoc for parameter type on one more ajax handler
git-svn-id: http://svn.openlayers.org/trunk/openlayers@2030 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-12-11 00:20:26 +00:00
euzuro
cc3a4c113b updating jsdoc for parameter type on ajax handlers
git-svn-id: http://svn.openlayers.org/trunk/openlayers@2029 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-12-11 00:19:29 +00:00
crschmidt
2467940cd3 A fix for #440. Prevent people who somehow get a null element in the event
cache from shooting themselves in the foot: This doesn't seem to happen often,
but it has happened in internal code. I'm going to add more debugging info to 
#440 as we get it, but want to get this in to prevent people from shooting 
themselves in the foot in IE accidentally.


git-svn-id: http://svn.openlayers.org/trunk/openlayers@2024 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-12-07 21:18:24 +00:00
crschmidt
bef4a7d3a9 This is a partial fix to the fact that putting WMS overlays over WMS does not
use the same grid boundaries as the underlying tiles, although not a complete
fix.


git-svn-id: http://svn.openlayers.org/trunk/openlayers@2018 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-12-06 21:29:36 +00:00
crschmidt
046fbf0662 Patch for #430 by Tim Schaub. Reviewed, passes all tests.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@2017 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-12-06 21:25:19 +00:00
crschmidt
632a2bd123 Typo in documentation, spotted by castaway. (Thx)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@1973 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-11-26 19:55:15 +00:00
crschmidt
ff4899f520 The popup test had a test in here which tested the size of the content div...
however, for some reason, the test was testing the existing, broken behavior!
Fix the test so that we make sure we don't regress in the future. (Thanks uz.) 


git-svn-id: http://svn.openlayers.org/trunk/openlayers@1949 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-11-21 15:47:02 +00:00
euzuro
15c2ab578f mousewheel zooms on mouse position. patch from #341. thanks frederic \!
git-svn-id: http://svn.openlayers.org/trunk/openlayers@1945 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-11-21 09:32:13 +00:00
crschmidt
c951391368 Patch from penyaskito: setSize function got updated in AnchoredBubble,
but never updated in Popup.js. Fix for #422 .   


git-svn-id: http://svn.openlayers.org/trunk/openlayers@1940 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-11-20 17:51:11 +00:00
euzuro
36eb8c0bc9 change name of example to be consistent with openlayers datatypes (ours is not called latlon, it is lonlat)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@1937 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-11-20 12:07:28 +00:00
crschmidt
e6ef35c174 Fix for #415 , reported by penyaskito, approved by Schuyler. Due to an oversight
in my new setSize function didn't test setting size before popup was added to 
the map.


git-svn-id: http://svn.openlayers.org/trunk/openlayers@1935 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-11-20 01:11:21 +00:00
crschmidt
5e7b2e03f1 Commit TMS support from 'crschmidt/refractions' Ticket #394 , reviewed by
Schuyler.


git-svn-id: http://svn.openlayers.org/trunk/openlayers@1927 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-11-19 19:54:42 +00:00
crschmidt
71bcdb9b7c A nice overviewmap example. Shows how to use a different baselayer for the
OverviewMap, as well as how to set the min/max ratio to something different.
Thanks penyaskito! (Closes #413 ... with a vengence!)


git-svn-id: http://svn.openlayers.org/trunk/openlayers@1914 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-11-19 13:26:24 +00:00
crschmidt
e1d715fc94 Add example for determining lat/lon from pixel, on a mouse click.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@1913 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-11-19 13:21:26 +00:00
crschmidt
4c9e46e240 Commit patches to documentation, from tickets #411 and #412 , from
penyaskito. (Thanks!) 


git-svn-id: http://svn.openlayers.org/trunk/openlayers@1912 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-11-18 22:55:34 +00:00
crschmidt
c14732b711 Missed another broken test. I should really build in broken-test reporting.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@1911 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-11-18 16:09:39 +00:00
crschmidt
41f798eaf2 Update test plan. Mistake from r1909.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@1910 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-11-18 15:42:08 +00:00
crschmidt
d77b849405 Parameters for URLs should be URI encoded. Add test for params that need
to be URI encoded in test_Util, and add Tim Schaub's patch from #381 to make
test pass.


git-svn-id: http://svn.openlayers.org/trunk/openlayers@1909 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-11-18 15:35:02 +00:00
crschmidt
b4ae7778b6 Update tests in preperation for #381 -- this closes #383. The primary purpose
of this patch is to change the purpose of the getFullRequestString tests to actually
test that function, rather than testing both that function and getParameterString.


git-svn-id: http://svn.openlayers.org/trunk/openlayers@1908 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-11-18 15:29:32 +00:00
crschmidt
76850371fe Fix for #380 from Tim Schaub, with test. Don't overwrite already-existing parameters
in the URL. This makes the precedence of parameters: 
 * params in URL
 * params in Layer
 * DEFAULT_PARAMS on the Layer.


git-svn-id: http://svn.openlayers.org/trunk/openlayers@1907 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-11-18 15:19:42 +00:00
crschmidt
fb7b5fff56 Improve getArgs to not use deprecated features, and add support to pass a
URL to the function to parse instead of the window.location. Patch by
Tim Schaub, Closes #378 


git-svn-id: http://svn.openlayers.org/trunk/openlayers@1906 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-11-18 15:01:17 +00:00
crschmidt
57dc3a7f53 Commit patch from Tim Schaub for #361 : replace tabs with spaces in
jsmin.py and mergejs.py, to make all our python stuff follow the same 
conventions. 


git-svn-id: http://svn.openlayers.org/trunk/openlayers@1905 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-11-18 14:53:52 +00:00
euzuro
ac949589a0 applying patch for #399 - MultiServer - some small formatting/commenting changes.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@1872 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-11-16 09:03:17 +00:00
euzuro
1f18b68e7d ie and ff have some discrepancies in how they output formed html. in this case, ie was capitalizing everything and mixing the elements around. so we just compare straight on the dom. better this way anyways.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@1783 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-11-08 19:01:48 +00:00
euzuro
17633136aa same as previous commit, need to give map div dimensions for proper tests in IE
git-svn-id: http://svn.openlayers.org/trunk/openlayers@1782 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-11-08 18:44:17 +00:00
euzuro
6e8754af91 fix test which breaks in ie because there are no size values to grab
git-svn-id: http://svn.openlayers.org/trunk/openlayers@1781 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-11-08 18:40:45 +00:00
crschmidt
876051d619 Fix for #392 , another tile.clear we missed.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@1780 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-11-08 18:22:48 +00:00
euzuro
8bd55016aa applying patch from #387 - if map has changed size, destroy old tile, make a new one
git-svn-id: http://svn.openlayers.org/trunk/openlayers@1779 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-11-08 16:42:56 +00:00
crschmidt
7ecc62e55a A fix for #366 , this prevents bailing out in the case where originPx
can't be determined from the baselayer yet. This is the case in Google,
because Google can't call getLatLonFromPx until after setCenter has been
called, which comes after this. There may be some cases where this isn't 
a perfect fix, but we're going to fix this for now, and punt on further
testing until 2.3.


git-svn-id: http://svn.openlayers.org/trunk/openlayers@1778 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-11-08 16:01:39 +00:00
crschmidt
819ccd7e06 Having a port number of ':80' in a WMS URL doesn't work right now, because
Firefox changes it, and then the URLs we're getting don't match the ones
we're expecting.


git-svn-id: http://svn.openlayers.org/trunk/openlayers@1774 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-11-08 11:48:59 +00:00
crschmidt
b5334bde43 Make the freemap example better documented and simpler. Before it had some
stuff that didn't actually work in there, so removing it is a Good Thing, and
makes the example more legible, and some additional comments which make
what the code is doing more understandable.


git-svn-id: http://svn.openlayers.org/trunk/openlayers@1773 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-11-08 11:45:57 +00:00
crschmidt
1325843cb3 Never actually committed layer.image docs.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@1739 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-10-27 14:24:16 +00:00
Tim Schaub
9f9c366154 Apply patch for #376 - fixing tile.clear() calls that were mistakenly replaced with OpenLayers.Util.clearArray() at r1590
git-svn-id: http://svn.openlayers.org/trunk/openlayers@1738 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-10-26 15:22:37 +00:00
Tim Schaub
3d58bc6698 Pull in euzuro's patch from #366 - changing how maxResolution is set and a number of other efficiency changes
git-svn-id: http://svn.openlayers.org/trunk/openlayers@1737 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-10-25 23:05:23 +00:00
crschmidt
786c2a20fb Change files to point to repository-license. Part of build process will now
be to change the licensing terms in the final build.


git-svn-id: http://svn.openlayers.org/trunk/openlayers@1721 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-10-24 18:16:39 +00:00
crschmidt
af6307fd9b Jeff Dege offered better/more clear documentation for the MousePosition
control, and an updated default granularity to make it more useful by default.
Closes #372.


git-svn-id: http://svn.openlayers.org/trunk/openlayers@1719 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-10-24 14:45:20 +00:00
crschmidt
43c916a433 Patch from Tim Schaub to change from old class inheritance to new
inheritance. Closes #370.


git-svn-id: http://svn.openlayers.org/trunk/openlayers@1717 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-10-23 17:27:29 +00:00
crschmidt
69b66e2100 Patch layers which have had wiki page name changes. Patch from Erik, closes
#363. Request for pullup to 2.2 release. 


git-svn-id: http://svn.openlayers.org/trunk/openlayers@1713 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-10-21 16:06:27 +00:00
crschmidt
f50fd0b7ac Bring in Tim Schaub's "Graphic" layer as "Layer.Image" (since in the future,
'graphic' may mean something different, like SVG graphic). Tests, docs, 
example, and library change. Thanks, Tim! 


git-svn-id: http://svn.openlayers.org/trunk/openlayers@1712 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-10-21 16:02:15 +00:00
jrf
7ced2241fe splitting release and repository licenses
git-svn-id: http://svn.openlayers.org/trunk/openlayers@1711 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-10-20 19:41:24 +00:00
euzuro
02c285091e no longer need to exclude yahoo layer from singlefile build
git-svn-id: http://svn.openlayers.org/trunk/openlayers@1710 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-10-20 18:49:41 +00:00
91 changed files with 2796 additions and 1288 deletions

27
build/build.py Executable file
View File

@@ -0,0 +1,27 @@
#!/usr/bin/env python
import sys
sys.path.append("../tools")
import jsmin, mergejs
sourceDirectory = "../lib"
configFilename = "library.cfg"
outputFilename = "OpenLayers.js"
if len(sys.argv) > 1:
configFilename = sys.argv[1] + ".cfg"
if len(sys.argv) > 2:
outputFilename = sys.argv[2]
print "Merging libraries."
merged = mergejs.run(sourceDirectory, None, configFilename)
print "Compressing."
minimized = jsmin.jsmin(merged)
print "Adding license file."
minimized = file("license.txt").read() + minimized
print "Writing to %s." % outputFilename
file(outputFilename, "w").write(minimized)
print "Done."

View File

@@ -1,44 +0,0 @@
#!/bin/sh
#
# Script to build compressed single file version of OpenLayers library
#
OUTPUT_FILENAME=OpenLayers.js
TMP_OUTPUT_FILENAME=tmp.${OUTPUT_FILENAME}
TOOLS_DIR=../tools
if [ "$1" != "" ]; then
CFG_FILENAME="$1.cfg"
else
CFG_FILENAME=library.cfg
fi
SRC_DIR=../lib
CMD_MERGE_JS=${TOOLS_DIR}/mergejs.py
CMD_SHRINKSAFE=${TOOLS_DIR}/shrinksafe.py
CMD_JSMIN=${TOOLS_DIR}/jsmin.py
LICENSE_HEADER_FILENAME=license.txt
## Generate "fat" single file library version
${CMD_MERGE_JS} -c ${CFG_FILENAME} ${TMP_OUTPUT_FILENAME} ${SRC_DIR}
## Compress ("shrink") the single file library version
echo
echo Shrinking and post-processing...
# (We also append the license header here.)
cat ${LICENSE_HEADER_FILENAME} > ${OUTPUT_FILENAME}
${CMD_JSMIN} <${TMP_OUTPUT_FILENAME} >> ${OUTPUT_FILENAME}
echo Cleaning up...
rm $TMP_OUTPUT_FILENAME
echo
echo Done.

View File

@@ -1,7 +1,7 @@
#!/bin/sh
rm ../doc/reference.html
CLASSES="Map Layer Layer.HTTPRequest Layer.Grid Layer.WMS Layer.KaMap Layer.EventPane Layer.Google Layer.VirtualEarth Layer.Markers Layer.Text Layer.GeoRSS Layer.Boxes Icon Marker Marker.Box Tile Tile.Image Tile.WFS Control Control.LayerSwitcher Control.MouseDefaults Control.MousePosition Control.MouseToolbar Control.OverviewMap Control.PanZoom Control.PanZoomBar Control.Permalink Control.Scale LonLat Size Pixel Bounds Util Ajax"
CLASSES="Map Layer Layer.Image Layer.HTTPRequest Layer.Grid Layer.WMS Layer.KaMap Layer.EventPane Layer.Google Layer.VirtualEarth Layer.Markers Layer.Text Layer.GeoRSS Layer.Boxes Layer.TMS Icon Marker Marker.Box Tile Tile.Image Tile.WFS Control Control.LayerSwitcher Control.MouseDefaults Control.MousePosition Control.MouseToolbar Control.OverviewMap Control.PanZoom Control.PanZoomBar Control.Permalink Control.Scale LonLat Size Pixel Bounds Util Ajax"
echo "<html>
<head>
<title>OpenLayers Class Reference Documentation</title>

View File

@@ -10,5 +10,4 @@ Rico/Corner.js
[include]
[exclude]
OpenLayers/Layer/Yahoo.js
OpenLayers/Control/KeyboardDefaults.js

View File

@@ -2,8 +2,8 @@
OpenLayers.js -- OpenLayers Map Viewer Library
Copyright 2005-2006 MetaCarta, Inc., released under the BSD License.
Please see http://svn.openlayers.org/trunk/openlayers/license.txt
Copyright 2005-2007 MetaCarta, Inc., released under the BSD license.
Please see http://svn.openlayers.org/trunk/openlayers/release-license.txt
for the full text of the license.
Includes compressed code under the following licenses:

View File

@@ -13,7 +13,7 @@ A small control which displays the Longitude and Latitude of the current mouse p
separator -- html to separate the longitude and latitude values (default: '<br />')
suffix -- html to follow the latitude value (default: '')
numdigits -- number of digits to the right of the decimal (default: 5)
granularity -- a change of how many pixels is considered a mouse move (default: 1)
granularity -- Don't refresh display if mouse has moved more than this (default: 10)
prefix, separator, and suffix are used to format the lon/lat values.

View File

@@ -0,0 +1,38 @@
OpenLayers.Control.OverviewMap
This control provides a locator or overview map linked to another map. By default, the overview map shows up in the lower right of the main map and can be expdaned with the '+' button.
* Constructor
OpenLayers.Control.OverviewMap(opts?) -- Creates a new overview map. The opts variable is an object with various options, as described in the options section below.
* Methods
isSuitableOverview() -- {Boolean} -- Determines if the overview map is suitable given the extent and resolution of the main map.
getRectPxBounds() -- {OpenLayers.Bounds|bounds} -- An OpenLayers.Bounds which is the extent rectangle's pixel bounds (relative to the parent element).
setRectPxBounds({OpenLayers.Bounds|bounds}) -- none -- Set extent rectangle pixel bounds.
getRectBoundsFromMapBounds({OpenLayers.Bounds|lonLatBounds}) -- {OpenLayers.Bounds|bounds} -- An OpenLayers.Bounds which is the passed-in map lon/lat extent translated into pixel bounds for the overview map.
getMapBoundsFromRectBounds({OpenLayers.Bounds|pxBounds]}) -- {OpenLayers.Bounds|bounds} -- An OpenLayers.Bounds which is the passed-in overview rect bounds translated into lon/lat bounds for the overview map.
getLonLatFromOverviewPx({OpenLayers.Pixel|pixel}) -- {OpenLayers.LonLat|lonlat} -- An OpenLayers.LonLat which is the passed-in overview map OpenLayers.Pixel translated into lon/lat by the overview map.
getOverviewPxFromLonLat({OpenLayers.LonLat|lonlat}) -- {OpenLayers.Pixel|pixel} -- An OpenLayers.Pixel which is the passed-in OpenLayers.LonLat, translated into overview map pixels
* Events
* Rectangle events
They are defined on OverviewMap.rectEvents
mouseover -- rectangle is moused over
mouseout -- rectangle is no longer mousedout
mousemove -- mouse moves inside rectangle
mousedown -- mouse button is pressed over the rectangle.
mouseup -- mouse button is released over the rectangle.
click -- mouse clicked
dblclick -- mouse double clicked
* Map events
They are defined on OverviewMap.mapDivEvents
click -- mouse clicked
* Options:
* minRatio -- The ratio of the overview map resolution to the main map resolution at which to zoom farther out on the overview map.
* maxRatio -- The ratio of the overview map resolution to the main map resolution at which to zoom farther in on the overview map.
* layers -- Ordered list of layers in the overview map. If none, then the map base layer is used.

View File

@@ -1,4 +1,4 @@
OpenLayers.Control.PanZoom
OpenLayers.Control.PanZoomBar
Creates a small toolset for controlling the location of the map with panning and zooming, including four directional arrows, a zoom in and zoom out, and a bar on which a slider can be moved to zoom in or out by multiple stops at once.

View File

@@ -12,5 +12,5 @@ The Google Layer in OpenLayers allows you to include Google Maps functionality i
getGPointFromOLPixel({OpenLayers.Pixel|pixel}) -- GPoint -- Create GPoint from OpenLayers Pixel.
* Parameters
type -- one of G_MAP, G_SATELLITE_MAP, G_HYBRID_MAP, used to choose the type of map to display.
type -- one of G_NORMAL_MAP, G_SATELLITE_MAP, G_HYBRID_MAP, used to choose the type of map to display. (See <a href="http://www.google.com/apis/maps/documentation/reference.html#GMapType">GMapType in the Google documentation</a> for more.)

9
doc/Layer.Image.txt Normal file
View File

@@ -0,0 +1,9 @@
OpenLayers.Layer.Image
The Image Layer allows you to load a single image and use it as a layer in your
map.
* Constructor
OpenLayers.Layer(name, url, {OpenLayers.Bounds|bounds}, {OpenLayers.Size|size}, {options}) -- Image Layer constructor requires a name, URL of the image, geographic bounds of the image, pixel size of the image, and an optional options parameter.

15
doc/Layer.TMS.txt Normal file
View File

@@ -0,0 +1,15 @@
OpenLayers.Layer.TMS
The TMS layer allows one to connect to a TMS -- Tiled Map Service -- server to obtain images.
* Constructor
OpenLayers.Layer.TMS(name, url, options) -- URL is the base URL to the layer. Options is a set of options, extending the parameters of the layer.
* Methods
getURL({OpenLayers.Bounds|bounds}) -- {String} -- Returns a TMS URL for the given bounds based on the properties of the layer.
All other methods are inherited from {OpenLayers.Layer.Grid}
* Options
tileOrigin -- The tileOrigin option will allow you to set your tileOrigin to something other than the lower left extent of your map.
layername -- Name of the layer in the TMS request.
type -- The extension images have.

View File

@@ -2,14 +2,13 @@
<head>
<style type="text/css">
body { font-family: sans-serif; font-weight: bold; font-size: .8em; }
body {
border: 0px;
margin: 0px;
padding: 0px;
}
#map {
width: 65%;
width: 100%;
height: 100%;
border: 0px;
padding: 0px;
@@ -25,83 +24,26 @@
var map, layer;
function init(){
// these should be object methods or something
map = new OpenLayers.Map( $('map') );
var basemap = new OpenLayers.Layer.WMS( "Boston",
"http://boston.freemap.in/cgi-bin/mapserv?",
{map: '/www/freemap.in/boston/map/gmaps.map', layers: 'border,water,roads', format: 'png', 'transparent': 'off'},
{map: '/www/freemap.in/boston/map/gmaps.map', layers: 'border,water,roads,rapid_transit,buildings', format: 'png', 'transparent': 'off'},
// These are the important parts for creating a non-epsg:4326
// map: Maxextent is the boundary of the map/tile loading area,
// maxResolution is the units/pixel at the highest zoom, and
// projection is the projection to be used in WMS/WFS Requests.
{maxExtent: new OpenLayers.Bounds(33861, 717605, 330846, 1019656), maxResolution: 296985/1024, projection:"EPSG:2805" } );
var rapid = new OpenLayers.Layer.WMS( "Rapid Transit",
"http://boston.freemap.in/cgi-bin/mapserv?",
{map: '/www/freemap.in/boston/map/mass.map', layers: 'rapid_transit', format: 'png', transparent:'true'} );
var buildings = new OpenLayers.Layer.WMS( "Buildings",
"http://boston.freemap.in/cgi-bin/mapserv?",
{map: '/www/freemap.in/boston/map/mass.map', layers: 'buildings', format: 'png', transparent:'true'} );
map.addLayer(basemap);
map.addLayer(rapid);
map.addLayer(buildings);
map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
map.addControl(new OpenLayers.Control.LayerSwitcher());
}
function getaddress() {
if (!document.getElementById('address').value) {return; }
document.getElementById('status').innerHTML = "Finding address...";
var address = document.getElementById('address').value;
address = escape(address);
addr = "/geocode.cgi?address="+address;
var handler = XMLrequest();
if (handler) {
handler.onreadystatechange=function() {
if (handler.readyState == 4 && handler.status == 200) {
var latlon = handler.responseText;
latlon = latlon.split(",");
if (latlon[1]) {
map.setCenter(new OpenLayers.LonLat(parseFloat(latlon[1]), parseFloat(latlon[0])), 15);
document.getElementById('status').innerHTML = "";
} else {
document.getElementById('status').innerHTML = "Could not find address, sorry.";
}
}
}
handler.open("GET", addr, true);
handler.send('');
}
}
function XMLrequest() {
xmlhttp={};
try {
xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) { }
}
try {
xmlhttp = new XMLHttpRequest();
} catch (e) {}
return xmlhttp;
}
function setLink() {
var link = document.getElementById("link");
var center = map.getCenter();
var zoom = map.getZoom();
link.innerHTML="http://boston.freemap.in/?zoom="+zoom+"&amp;lat="+center.lat+"&amp;lon="+center.lon;
}
// -->
</script>
</head>
<body onload="init()">
<div id="right" style="float:right;width:30%;padding:10px;" ><h1>Boston Free Map</h1><!--Search: <input type="text" id='address' name="address"><input type="submit" value="Go!" onclick="javascript:getaddress()"/>--><div id="status" style="height:20px;min-height:20px;">&nbsp;</div>
<div>Map powered by <a href="http://www.openlayers.org/">OpenLayers</a>
and <a href="http://mapserver.gis.umn.edu/">MapServer</a>.
Data downloaded from
<a href="http://www.mass.gov/mgis/">Office of Geographic and Environmental Information (MassGIS)</a>.</div>
<!--<a onclick="setLink(); return false" href="#" id="update">Update Link</a>
<div id="link"></div>-->
</div>
<div id="map"></div>
</body>
</html>

View File

@@ -14,7 +14,7 @@
var map = new OpenLayers.Map('map');
var ol_wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://labs.metacarta.com/wms/vmap0?", {layers: 'basic'});
"http://labs.metacarta.com:80/wms/vmap0?", {layers: 'basic'});
var jpl_wms = new OpenLayers.Layer.WMS( "NASA Global Mosaic",
"http://wms.jpl.nasa.gov/wms.cgi",

51
examples/image-layer.html Normal file
View File

@@ -0,0 +1,51 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
p {
width: 512px;
}
#map {
width: 512px;
height: 256px;
border: 1px solid gray;
}
</style>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript">
<!--
function init(){
var map = new OpenLayers.Map('map');
var options = {maxResolution: 'auto', numZoomLevels: 3};
var graphic = new OpenLayers.Layer.Image(
'City Lights',
'http://earthtrends.wri.org/images/maps/4_m_citylights_lg.gif',
new OpenLayers.Bounds(-180, -88.759, 180, 88.759),
new OpenLayers.Size(580, 288),
options);
var jpl_wms = new OpenLayers.Layer.WMS( "NASA Global Mosaic",
"http://wms.jpl.nasa.gov/wms.cgi",
{layers: "modis,global_mosaic"}, options);
map.addLayers([graphic, jpl_wms]);
map.addControl(new OpenLayers.Control.LayerSwitcher());
map.zoomToMaxExtent();
}
// -->
</script>
</head>
<body onload="init()">
<h1>OpenLayers Image Layer Example</h1>
<div id="map"></div>
<p>
The "City Lights" layer above is created from a single web accessible
image. If you construct it without any resolution related options,
the layer will be given a single resolution based on the extent/size.
Otherwise, it behaves much like a regular layer. This is primarily
intended to be used in an overview map - where another layer type
might not make a good overview.
</p>
</body>
</html>

View File

@@ -59,7 +59,7 @@
"http://terraservice.net/ogcmap.ashx",
{layers: "DRG"});
shade = new OpenLayers.Layer.WMS("Shaded Relief",
"http://ims.cr.usgs.gov:80/servlet19/com.esri.wms.Esrimap/USGS_EDC_Elev_NED_3",
"http://ims.cr.usgs.gov/servlet19/com.esri.wms.Esrimap/USGS_EDC_Elev_NED_3",
{layers: "HR-NED.IMAGE", reaspect: "false", transparent: 'true'},
{isBaseLayer: false, opacity: 0.3});
map.addLayers([drg, shade]);

View File

@@ -0,0 +1,43 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>OpenLayers Cursor Example</title>
<style type="text/css">
#map {
width: 700px;
height: 400px;
border: 1px solid black;
}
</style>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript">
<!--
function init(){
var map = new OpenLayers.Map('map', { controls: [] });
map.addControl(new OpenLayers.Control.PanZoomBar());
map.addControl(new OpenLayers.Control.MouseToolbar());
map.addControl(new OpenLayers.Control.MousePosition());
var ol_wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://labs.metacarta.com/wms/vmap0",
{layers: 'basic'} );
map.addLayers([ol_wms]);
OpenLayers.Event.observe($('map'),"click",mapclicked.bindAsEventListener(map));
function mapclicked(e){
var lonlat = map.getLonLatFromPixel(e.xy);
alert("Lat: " + lonlat.lat + " (Pixel.x:" + e.xy.x + ")" + "\n" + "Lon: " + lonlat.lon + " (Pixel.y:" + e.xy.y + ")" );
};
if (!map.getCenter()) map.zoomToMaxExtent();
}
// -->
</script>
</head>
<body onload="init()">
<h1>OpenLayers Cursor Example</h1>
<div id="map"></div>
</body>
</html>

35
examples/multiserver.html Normal file
View File

@@ -0,0 +1,35 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
#map {
width: 800px;
height: 475px;
border: 1px solid black;
}
</style>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript">
<!--
var lon = 5;
var lat = 40;
var zoom = 5;
var map, layer;
function init(){
map = new OpenLayers.Map( $('map') );
var urlArray = ["http://labs.metacarta.com/wms-c/Basic.py",
"http://monitor.metacarta.com/wms-c/Basic.py"];
layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
urlArray,
{layers: 'basic'} );
map.addLayer(layer);
map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
}
// -->
</script>
</head>
<body onload="init()">
<div id="map"></div>
</body>
</html>

47
examples/overviewmap.html Normal file
View File

@@ -0,0 +1,47 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Overview Map Example</title>
<script src="../lib/OpenLayers.js" type="text/javascript"></script>
<style>
#map{
width:100%;
height:500px;
border:1px solid;
}
</style>
</head>
<body>
<div id="map"></div>
<script defer="defer" type="text/javascript">
var map = new OpenLayers.Map('map');
// my city
var constantina = new OpenLayers.LonLat(-5.6165,37.8623);
var wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} );
var nasa_wms = new OpenLayers.Layer.WMS( "NASA Global Mosaic",
"http://wms.jpl.nasa.gov/wms.cgi", {layers: "modis,global_mosaic"} );
map.addLayers([
nasa_wms,
wms
]);
map.addControl(new OpenLayers.Control.LayerSwitcher());
var options = {
layers: [wms.clone()],
minRatio: 8,
maxRatio: 128
};
var overview = new OpenLayers.Control.OverviewMap(options);
map.addControl(overview);
map.setCenter(constantina, 4);
overview.maximizeControl();
</script>
</body>
</html>

View File

@@ -1,4 +1,4 @@
point title description iconSize
10,20 my orange title my orange description 21,25
2,4 my aqua title my aqua description 21,25
42,-71 my purple title my purple description<br/>is great. 21,25
point title description icon
10,20 my orange title my orange description
2,4 my aqua title my aqua description
42,-71 my purple title my purple description<br/>is great. http://www.openlayers.org/api/img/zoom-world-mini.png

39
examples/tms.html Normal file
View File

@@ -0,0 +1,39 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
#map {
width: 800px;
height: 475px;
border: 1px solid black;
}
</style>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript">
<!--
var lon = 5;
var lat = 40;
var zoom = 5;
var map, layer;
function init(){
map = new OpenLayers.Map( $('map'), {maxResolution:1.40625/2} );
layer = new OpenLayers.Layer.TMS( "TMS",
"http://labs.metacarta.com/wms-c/Basic.py/", {layername: 'basic', type:'png'} );
map.addLayer(layer);
map.addControl(new OpenLayers.Control.LayerSwitcher());
map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
}
function addTMS() {
l=new OpenLayers.Layer.TMS($('layer').value, $('url').value, {layername: $('layer').value, type:$('type').value});
map.addLayer(l);
map.setBaseLayer(l);
}
// -->
</script>
</head>
<body onload="init()">
URL of TMS (Should end in /): <input type="text" id="url" size="60" /> layer_name <input type="text" id="layer" /> <select id="type"><option>png</option><option>jpg</option></select> <input type="submit" onclick="addTMS()"/><br />
Example: http://mapserver.refractions.net/cgi-bin/tms/, global_mosaic, jpg
<div id="map"></div>
</body>
</html>

View File

@@ -1,6 +1,7 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */
////
/// This blob sucks in all the files in uncompressed form for ease of use
///
@@ -65,6 +66,7 @@ if (typeof(_OPENLAYERS_SFL_) == "undefined") {
"OpenLayers/Feature/WFS.js",
"OpenLayers/Tile/Image.js",
"OpenLayers/Tile/WFS.js",
"OpenLayers/Layer/Image.js",
"OpenLayers/Layer/EventPane.js",
"OpenLayers/Layer/FixedZoomLevels.js",
"OpenLayers/Layer/Google.js",
@@ -84,6 +86,7 @@ if (typeof(_OPENLAYERS_SFL_) == "undefined") {
"OpenLayers/Layer/GeoRSS.js",
"OpenLayers/Layer/Boxes.js",
"OpenLayers/Layer/Canvas.js",
"OpenLayers/Layer/TMS.js",
"OpenLayers/Popup/Anchored.js",
"OpenLayers/Popup/AnchoredBubble.js",
"OpenLayers/Control.js",

View File

@@ -1,6 +1,7 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */
OpenLayers.ProxyHost = "";
//OpenLayers.ProxyHost = "examples/proxy.cgi?url=";

View File

@@ -1,6 +1,7 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */
/* OpenLayers.Class metaclass */
OpenLayers.Class = {

View File

@@ -1,6 +1,7 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */
/**
* @class

View File

@@ -1,6 +1,7 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */
/**
* @class

View File

@@ -1,6 +1,7 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */
/**
* @class

View File

@@ -1,6 +1,6 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */
/**
* @class
@@ -354,12 +354,12 @@ OpenLayers.Control.LayerSwitcher.prototype =
this.div.appendChild(this.layersDiv);
Rico.Corner.round(this.div, {corners: "tl bl",
OpenLayers.Rico.Corner.round(this.div, {corners: "tl bl",
bgColor: "transparent",
color: this.activeColor,
blend: false});
Rico.Corner.changeOpacity(this.layersDiv, 0.75);
OpenLayers.Rico.Corner.changeOpacity(this.layersDiv, 0.75);
var imgLocation = OpenLayers.Util.getImagesLocation();
var sz = new OpenLayers.Size(18,18);

View File

@@ -1,6 +1,7 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */
/**
* @class
@@ -19,14 +20,6 @@ OpenLayers.Control.MouseDefaults.prototype =
*/
initialize: function() {
OpenLayers.Control.prototype.initialize.apply(this, arguments);
//register mousewheel events specifically on the window and document
OpenLayers.Event.observe(window, "DOMMouseScroll",
this.onWheelEvent.bindAsEventListener(this));
OpenLayers.Event.observe(window, "mousewheel",
this.onWheelEvent.bindAsEventListener(this));
OpenLayers.Event.observe(document, "mousewheel",
this.onWheelEvent.bindAsEventListener(this));
},
/**
@@ -39,6 +32,24 @@ OpenLayers.Control.MouseDefaults.prototype =
this.map.events.register( "mouseup", this, this.defaultMouseUp );
this.map.events.register( "mousemove", this, this.defaultMouseMove );
this.map.events.register( "mouseout", this, this.defaultMouseOut );
this.registerWheelEvents();
},
/**
*
*/
registerWheelEvents: function() {
//register mousewheel events specifically on the window and document
OpenLayers.Event.observe(window, "DOMMouseScroll",
this.onWheelEvent.bindAsEventListener(this));
OpenLayers.Event.observe(window, "mousewheel",
this.onWheelEvent.bindAsEventListener(this));
OpenLayers.Event.observe(document, "mousewheel",
this.onWheelEvent.bindAsEventListener(this));
},
/**
@@ -93,6 +104,9 @@ OpenLayers.Control.MouseDefaults.prototype =
* @param {Event} evt
*/
defaultMouseMove: function (evt) {
// record the mouse position, used in onWheelEvent
this.mousePosition = evt.xy.clone();
if (this.mouseDragStart != null) {
if (this.zoomBox) {
var deltaX = Math.abs(this.mouseDragStart.x - evt.xy.x);
@@ -154,15 +168,21 @@ OpenLayers.Control.MouseDefaults.prototype =
/** User spun scroll wheel up
*
*/
defaultWheelUp: function() {
this.map.zoomIn();
defaultWheelUp: function(evt) {
if (this.map.getZoom() <= this.map.getNumZoomLevels()) {
this.map.setCenter(this.map.getLonLatFromPixel(evt.xy),
this.map.getZoom() + 1);
}
},
/** User spun scroll wheel down
*
*/
defaultWheelDown: function() {
this.map.zoomOut();
defaultWheelDown: function(evt) {
if (this.map.getZoom() > 0) {
this.map.setCenter(this.map.getLonLatFromPixel(evt.xy),
this.map.getZoom() - 1);
}
},
/** Zoombox function.
@@ -237,10 +257,15 @@ OpenLayers.Control.MouseDefaults.prototype =
delta = -e.detail / 3;
}
if (delta) {
// add the mouse position to the event because mozilla has a bug
// with clientX and clientY (see https://bugzilla.mozilla.org/show_bug.cgi?id=352179)
// getLonLatFromViewPortPx(e) returns wrong values
e.xy = this.mousePosition;
if (delta < 0) {
this.defaultWheelDown();
this.defaultWheelDown(e);
} else {
this.defaultWheelUp();
this.defaultWheelUp(e);
}
}

View File

@@ -1,6 +1,7 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */
/**
* @class
@@ -27,7 +28,7 @@ OpenLayers.Control.MousePosition.prototype =
numdigits: 5,
/** @type int */
granularity: 1,
granularity: 10,
/** @type OpenLayers.LonLat */
lastXy: null,

View File

@@ -1,6 +1,7 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */
/**
* @class
@@ -47,8 +48,10 @@ OpenLayers.Control.MouseToolbar.prototype =
this._addButton("pan", "panning-hand-off.png", "panning-hand-on.png", centered, sz, "Drag the map to pan.");
centered = centered.add((this.direction == "vertical" ? 0 : sz.w), (this.direction == "vertical" ? sz.h : 0));
this.switchModeTo("pan");
return this.div;
this.registerWheelEvents();
return this.div;
},
_addButton:function(id, img, activeImg, xy, sz, title) {

View File

@@ -1,17 +1,20 @@
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */
/**
* @fileoverview Locator Map Control
* @author Tim Schaub
*/
// @require: OpenLayers/Control.js
/**
* @class
*
* @requires OpenLayers/Control.js
*/
OpenLayers.Control.OverviewMap = OpenLayers.Class.create();
OpenLayers.Control.OverviewMap.prototype =
OpenLayers.Util.extend( new OpenLayers.Control(), {
OpenLayers.Class.inherit( OpenLayers.Control, {
/** For div.id
* @type String */
@@ -26,6 +29,15 @@ OpenLayers.Control.OverviewMap.prototype =
*/
ovmap: null,
/**
* The overvew map size in pixels. Note that this is the size of the map
* itself - the element that contains the map (class name
* olControlOverviewMapElement) may have padding or other style attributes
* added via CSS.
* @type OpenLayers.Size
*/
size: new OpenLayers.Size(180, 90),
/**
* Ordered list of layers in the overview map. If none are sent at
* construction, then the default below is used.
@@ -48,6 +60,14 @@ OpenLayers.Control.OverviewMap.prototype =
*/
maxRatio: 32,
/**
* An object containing any non-default properties to be sent to the
* overview map's map constructor. These should include any non-default
* options that the main map was constructed with.
* @type: Object
*/
mapOptions: {},
/**
* @constructor
* @param {Object} options Hashtable of options to set on the overview map
@@ -61,7 +81,6 @@ OpenLayers.Control.OverviewMap.prototype =
*/
draw: function() {
OpenLayers.Control.prototype.draw.apply(this, arguments);
if(!(this.layers.length > 0)) {
if (this.map.baseLayer) {
var layer = this.map.baseLayer.clone();
@@ -78,8 +97,8 @@ OpenLayers.Control.OverviewMap.prototype =
this.element.style.display = 'none';
this.mapDiv = document.createElement('div');
this.mapDiv.style.width = '180px';
this.mapDiv.style.height = '90px';
this.mapDiv.style.width = this.size.w + 'px';
this.mapDiv.style.height = this.size.h + 'px';
this.mapDiv.style.position = 'relative';
this.mapDiv.style.overflow = 'hidden';
this.mapDiv.id = OpenLayers.Util.createUniqueID('overviewMap');
@@ -87,6 +106,7 @@ OpenLayers.Control.OverviewMap.prototype =
this.extentRectangle = document.createElement('div');
this.extentRectangle.style.position = 'absolute';
this.extentRectangle.style.zIndex = 1000; //HACK
this.extentRectangle.style.overflow = 'hidden';
this.extentRectangle.style.backgroundImage = 'url(' +
OpenLayers.Util.getImagesLocation() +
'/blank.png)';
@@ -96,7 +116,6 @@ OpenLayers.Control.OverviewMap.prototype =
this.element.appendChild(this.mapDiv);
this.div.appendChild(this.element);
this.div.className = 'olControlOverviewMapContainer';
this.map.events.register('moveend', this, this.update);
@@ -115,7 +134,6 @@ OpenLayers.Control.OverviewMap.prototype =
OpenLayers.Event.stop(e);
});
this.rectEvents = new OpenLayers.Events(this, this.extentRectangle);
this.rectEvents.register('mouseover', this, this.rectMouseOver);
this.rectEvents.register('mouseout', this, this.rectMouseOut);
this.rectEvents.register('mousedown', this, this.rectMouseDown);
this.rectEvents.register('mousemove', this, this.rectMouseMove);
@@ -127,8 +145,10 @@ OpenLayers.Control.OverviewMap.prototype =
this.mapDivEvents = new OpenLayers.Events(this, this.mapDiv);
this.mapDivEvents.register('click', this, this.mapDivClick);
// There should be an option to place the control outside of the
// map viewport. This would make these buttons optional.
// Optionally add min/max buttons if the control will go in the
// map viewport.
if(!this.outsideViewport) {
this.div.className = 'olControlOverviewMapContainer';
var imgLocation = OpenLayers.Util.getImagesLocation();
// maximize button div
var img = imgLocation + 'layer-switcher-maximize.png';
@@ -143,6 +163,11 @@ OpenLayers.Control.OverviewMap.prototype =
OpenLayers.Event.observe(this.maximizeDiv,
'click',
this.maximizeControl.bindAsEventListener(this));
OpenLayers.Event.observe(this.maximizeDiv,
'dblclick',
function(e) {
OpenLayers.Event.stop(e);
});
this.div.appendChild(this.maximizeDiv);
// minimize button div
@@ -158,11 +183,21 @@ OpenLayers.Control.OverviewMap.prototype =
OpenLayers.Event.observe(this.minimizeDiv,
'click',
this.minimizeControl.bindAsEventListener(this));
OpenLayers.Event.observe(this.minimizeDiv,
'dblclick',
function(e) {
OpenLayers.Event.stop(e);
});
this.div.appendChild(this.minimizeDiv);
this.minimizeControl();
} else {
// show the overview map
this.element.style.display = '';
}
if(this.map.getExtent()) {
this.update();
}
return this.div;
},
@@ -171,21 +206,23 @@ OpenLayers.Control.OverviewMap.prototype =
this.map.events.unregister("changebaselayer", this, this.baseLayerDraw);
},
/**
* @param {OpenLayers.Event} evt
*/
rectMouseOver: function (evt) {
this.extentRectangle.style.cursor = 'move';
},
/**
* @param {OpenLayers.Event} evt
*/
rectMouseOut: function (evt) {
this.extentRectangle.style.cursor = 'default';
if(this.rectDragStart != null) {
if(this.performedRectDrag) {
this.rectMouseMove(evt);
var rectPxBounds = this.getRectPxBounds();
// if we're off of the overview map, update the main map
// otherwise, keep moving the rect
if((rectPxBounds.top <= 0) || (rectPxBounds.left <= 0) ||
(rectPxBounds.bottom >= this.size.h - this.hComp) ||
(rectPxBounds.right >= this.size.w - this.wComp)) {
this.updateMapToRect();
} else {
return;
}
}
document.onselectstart = null;
this.rectDragStart = null;
@@ -366,7 +403,9 @@ OpenLayers.Control.OverviewMap.prototype =
createMap: function() {
// create the overview map
this.ovmap = new OpenLayers.Map(this.mapDiv.id, {controls: [], maxResolution: 'auto'});
var options = OpenLayers.Util.extend(
{controls: [], maxResolution: 'auto'}, this.mapOptions);
this.ovmap = new OpenLayers.Map(this.mapDiv.id, options);
this.ovmap.addLayers(this.layers);
this.ovmap.zoomToMaxExtent();
// check extent rectangle border width
@@ -386,13 +425,17 @@ OpenLayers.Control.OverviewMap.prototype =
* Updates the extent rectangle position and size to match the map extent
*/
updateRectToMap: function() {
// The base layer for overview map needs to be in the same projection
// as the base layer for the main map. This should be made more robust.
if(this.map.units != 'degrees') {
if(this.map.projection != this.ovmap.map.projection) {
if(this.ovmap.getProjection() && (this.map.getProjection() != this.ovmap.getProjection())) {
alert('The overview map only works when it is in the same projection as the main map');
}
}
var pxBounds = this.getRectBoundsFromMapBounds(this.map.getExtent());
if (pxBounds) {
this.setRectPxBounds(pxBounds);
}
},
/**
@@ -448,8 +491,12 @@ OpenLayers.Control.OverviewMap.prototype =
lonLatBounds.top);
var leftBottomPx = this.getOverviewPxFromLonLat(leftBottomLonLat);
var rightTopPx = this.getOverviewPxFromLonLat(rightTopLonLat);
return new OpenLayers.Bounds(leftBottomPx.x, leftBottomPx.y,
var bounds = null;
if (leftBottomPx && rightTopPx) {
bounds = new OpenLayers.Bounds(leftBottomPx.x, leftBottomPx.y,
rightTopPx.x, rightTopPx.y);
}
return bounds;
},
/**
@@ -499,10 +546,13 @@ OpenLayers.Control.OverviewMap.prototype =
getOverviewPxFromLonLat: function(lonlat) {
var res = this.ovmap.getResolution();
var extent = this.ovmap.getExtent();
return new OpenLayers.Pixel(
var px = null;
if (extent) {
px = new OpenLayers.Pixel(
Math.round(1/res * (lonlat.lon - extent.left)),
Math.round(1/res * (extent.top - lonlat.lat))
);
Math.round(1/res * (extent.top - lonlat.lat)));
}
return px;
},
/** @final @type String */

View File

@@ -1,6 +1,7 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */
/**
* @class
@@ -84,8 +85,8 @@ OpenLayers.Control.PanZoom.prototype =
this.div.appendChild(btn);
btn.onmousedown = this.buttonDown.bindAsEventListener(btn);
btn.onmouseup = this.doubleClick.bindAsEventListener(btn);
btn.ondblclick = this.doubleClick.bindAsEventListener(btn);
btn.onclick = this.doubleClick.bindAsEventListener(btn);
btn.action = id;
btn.map = this.map;
btn.slideFactor = this.slideFactor;

View File

@@ -1,6 +1,7 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */
/**
* @class

View File

@@ -1,6 +1,7 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */
/**
* @class

View File

@@ -1,6 +1,7 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */
/**
* @class

View File

@@ -1,6 +1,7 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */
OpenLayers.Event = {
KEY_BACKSPACE: 8,
@@ -95,9 +96,9 @@ OpenLayers.Event = {
|| element.detachEvent))
name = 'keydown';
if (element.removeEventListener) {
if (element && element.removeEventListener) {
element.removeEventListener(name, observer, useCapture);
} else if (element.detachEvent) {
} else if (element && element.detachEvent) {
element.detachEvent('on' + name, observer);
}
}
@@ -271,7 +272,10 @@ OpenLayers.Events.prototype = {
evt.element = this.element;
// execute all callbacks registered for specified type
var listeners = this.listeners[type];
// get a clone of the listeners array to
// allow for splicing during callbacks
var listeners = (this.listeners[type]) ?
this.listeners[type].slice() : null;
if ((listeners != null) && (listeners.length > 0)) {
for (var i = 0; i < listeners.length; i++) {
var callback = listeners[i];

View File

@@ -1,6 +1,7 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */
/**
* @class

View File

@@ -1,6 +1,7 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */
/**
* @class

View File

@@ -1,6 +1,7 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */
/**
* @class

View File

@@ -1,6 +1,7 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */
/**
* @class
@@ -17,6 +18,15 @@ OpenLayers.Layer.prototype = {
/** @type DOMElement */
div: null,
/** supported application event types
*
* @type Array */
EVENT_TYPES: [
"loadstart", "loadend", "loadcancel"],
/** @type OpenLayers.Events */
events: null,
/** This variable is set when the layer is added to the map, via the
* accessor function setMap()
*
@@ -120,20 +130,30 @@ OpenLayers.Layer.prototype = {
this.div.style.height = "100%";
this.div.id = this.id;
}
this.events = new OpenLayers.Events(this, this.div, this.EVENT_TYPES);
},
/**
* Destroy is a destructor: this is to alleviate cyclic references which
* the Javascript garbage cleaner can not take care of on its own.
*
* @param {Boolean} setNewBaseLayer Should a new baselayer be selected when
* this has been removed?
* Default is true
*/
destroy: function() {
destroy: function(setNewBaseLayer) {
if (setNewBaseLayer == null) {
setNewBaseLayer = true;
}
if (this.map != null) {
this.map.removeLayer(this);
this.map.removeLayer(this, setNewBaseLayer);
}
this.map = null;
this.name = null;
this.div = null;
this.options = null;
this.events = null;
},
/**

View File

@@ -1,6 +1,7 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */
/**
* @class

View File

@@ -1,6 +1,7 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */
/**
* @class

View File

@@ -1,6 +1,7 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */
/**
* @class

View File

@@ -1,6 +1,7 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */
/**

View File

@@ -1,6 +1,7 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */
/**
* @class
@@ -44,7 +45,7 @@ OpenLayers.Layer.GeoRSS.prototype =
},
/**
* @param {?} ajaxRequest
* @param {XMLHttpRequest} ajaxRequest
*/
parseData: function(ajaxRequest) {
var doc = ajaxRequest.responseXML;

View File

@@ -1,6 +1,7 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */
/**
* @class
@@ -226,7 +227,7 @@ OpenLayers.Layer.Google.prototype =
html += " correct API key for your site.<br>";
html += "<br>";
html += "Developers: For help getting this working correctly, ";
html += "<a href='http://trac.openlayers.org/wiki/GoogleMapsLayer' "
html += "<a href='http://trac.openlayers.org/wiki/Google' "
html += "target='_blank'>";
html += "click here";
html += "</a>";

View File

@@ -1,6 +1,7 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */
/**
* @class
@@ -106,21 +107,33 @@ OpenLayers.Layer.Grid.prototype =
|| !this.getGridBounds().containsBounds(bounds, true)) {
this._initTiles();
} else {
var buffer = (this.buffer) ? this.buffer*1.5 : 1;
while (true) {
var tlLayer = this.grid[0][0].position;
var tlViewPort =
this.map.getViewPortPxFromLayerPx(tlLayer);
if (tlViewPort.x > -this.tileSize.w * (this.buffer - 1)) {
if (tlViewPort.x > -this.tileSize.w * (buffer - 1)) {
this.shiftColumn(true);
} else if (tlViewPort.x < -this.tileSize.w * this.buffer) {
} else if (tlViewPort.x < -this.tileSize.w * buffer) {
this.shiftColumn(false);
} else if (tlViewPort.y > -this.tileSize.h * (this.buffer - 1)) {
} else if (tlViewPort.y > -this.tileSize.h * (buffer - 1)) {
this.shiftRow(true);
} else if (tlViewPort.y < -this.tileSize.h * this.buffer) {
} else if (tlViewPort.y < -this.tileSize.h * buffer) {
this.shiftRow(false);
} else {
break;
}
};
if (this.buffer == 0) {
for (var r=0, rl=this.grid.length; r<rl; r++) {
var row = this.grid[r];
for (var c=0, cl=row.length; c<cl; c++) {
var tile = row[c];
if (!tile.drawn && tile.bounds.intersectsBounds(bounds, false)) {
tile.draw();
}
}
}
}
}
}
@@ -152,7 +165,13 @@ OpenLayers.Layer.Grid.prototype =
* @private
*/
_initTiles:function() {
// work out mininum number of rows and columns; this is the number of
// tiles required to cover the viewport plus one for panning
var viewSize = this.map.getSize();
var minRows = Math.ceil(viewSize.h/this.tileSize.h) + 1;
var minCols = Math.ceil(viewSize.w/this.tileSize.w) + 1;
var bounds = this.map.getExtent();
var extent = this.map.getMaxExtent();
var resolution = this.map.getResolution();
@@ -215,11 +234,30 @@ OpenLayers.Layer.Grid.prototype =
tileoffsetlon += tilelon;
tileoffsetx += this.tileSize.w;
} while (tileoffsetlon <= bounds.right + tilelon * this.buffer)
} while ((tileoffsetlon <= bounds.right + tilelon * this.buffer)
|| colidx < minCols)
tileoffsetlat -= tilelat;
tileoffsety += this.tileSize.h;
} while(tileoffsetlat >= bounds.bottom - tilelat * this.buffer)
} while((tileoffsetlat >= bounds.bottom - tilelat * this.buffer)
|| rowidx < minRows)
// remove extra rows
while (this.grid.length > rowidx) {
var row = this.grid.pop();
for (var i=0, l=row.length; i<l; i++) {
row[i].destroy();
}
}
// remove extra columns
while (this.grid[0].length > colidx) {
for (var i=0, l=this.grid.length; i<l; i++) {
var row = this.grid[i];
var tile = row.pop();
tile.destroy();
}
}
//now actually draw the tiles
this.spiralTileLoad();
@@ -324,8 +362,9 @@ OpenLayers.Layer.Grid.prototype =
for(var iRow=0; iRow < this.grid.length; iRow++) {
var row = this.grid[iRow];
for(var iCol=0; iCol < row.length; iCol++) {
OpenLayers.Util.clearArray(row[iCol]);
row[iCol].destroy();
}
this.grid = [];
}
}
},

View File

@@ -1,6 +1,7 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */
/**
* @class
@@ -108,21 +109,34 @@ OpenLayers.Layer.HTTPRequest.prototype =
// use layer's url unless altUrl passed in
var url = (altUrl == null) ? this.url : altUrl;
// if url is not a string, it should be an array of strings,
// in which case we will randomly select one of them in order
// to evenly distribute requests to different urls.
if (typeof url == "object") {
url = url[Math.floor(Math.random()*url.length)];
}
// requestString always starts with url
var requestString = url;
// create a new params hashtable with all the layer params and the
// new params together. then convert to string
var allParams = OpenLayers.Util.extend(new Object(), this.params);
var allParams = OpenLayers.Util.extend(allParams, newParams);
allParams = OpenLayers.Util.extend(allParams, newParams);
// ignore parameters that are already in the url search string
var urlParams = OpenLayers.Util.upperCaseObject(
OpenLayers.Util.getArgs(url));
for(var key in allParams) {
if(key.toUpperCase() in urlParams) {
delete allParams[key];
}
}
var paramsString = OpenLayers.Util.getParameterString(allParams);
if (paramsString != "") {
var lastServerChar = this.url.charAt(this.url.length - 1);
var lastServerChar = url.charAt(url.length - 1);
if ((lastServerChar == "&") || (lastServerChar == "?")) {
requestString += paramsString;
} else {
if (this.url.indexOf('?') == -1) {
if (url.indexOf('?') == -1) {
//serverPath has no ? -- add one
requestString += '?' + paramsString;
} else {

View File

@@ -0,0 +1,161 @@
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */
/**
* @fileoverview Image Layer
* @author Tim Schaub
*/
/**
* @class
*
* @requires OpenLayers/Layer.js
*/
OpenLayers.Layer.Image = OpenLayers.Class.create();
OpenLayers.Layer.Image.prototype =
OpenLayers.Class.inherit(OpenLayers.Layer, {
/** By default, Layer.Image will be a baselayer
*
* @type Boolean */
isBaseLayer: true,
/** @type String */
url: null,
/** @type OpenLayers.Bounds */
extent: null,
/** @type OpenLayers.Size */
size: null,
/** @type OpenLayers.Tile.Image */
tile: null,
/** The ratio of height/width represented by a single pixel in the graphic
*
* @type Float */
aspectRatio: null,
/**
* @constructor
*
* @param {String} name
* @param {String} url Relative or absolute path to the image
* @param {OpenLayers.Bounds} extent The extent represented by the image
* @param {OpenLayers.Size} size The size (in pixels) of the image
* @param {Object} options Hashtable of extra options to tag onto the layer
*/
initialize: function(name, url, extent, size, options) {
this.url = url;
this.extent = extent;
this.size = size;
OpenLayers.Layer.prototype.initialize.apply(this, [name, options]);
this.aspectRatio = (this.extent.getHeight() / this.size.h) /
(this.extent.getWidth() / this.size.w);
},
/**
*
*/
destroy: function() {
this.tile.destroy();
this.tile = null;
OpenLayers.Layer.prototype.destroy.apply(this, arguments);
},
/**
* @param {Object} obj
*
* @returns An exact clone of this OpenLayers.Layer.Image
* @type OpenLayers.Layer.Image
*/
clone: function(obj) {
if(obj == null) {
obj = new OpenLayers.Layer.Image(this.name,
this.url,
this.extent,
this.size,
this.options);
}
//get all additions from superclasses
obj = OpenLayers.Layer.prototype.clone.apply(this, [obj]);
// copy/set any non-init, non-simple values here
return obj;
},
/**
* @param {OpenLayers.Map} map
*/
setMap: function(map) {
// If nothing to do with resolutions has been set, assume a single
// resolution determined by extent/size
if( this.options.maxResolution == null ) {
this.options.maxResolution = this.extent.getWidth() / this.size.w;
}
OpenLayers.Layer.prototype.setMap.apply(this, arguments);
},
/** Create the tile for the image or resize it for the new resolution
*
* @param {OpenLayers.Bounds} bounds
* @param {Boolean} zoomChanged
* @param {Boolean} dragging
*/
moveTo:function(bounds, zoomChanged, dragging) {
OpenLayers.Layer.prototype.moveTo.apply(this, arguments);
var firstRendering = (this.tile == null);
if(zoomChanged || firstRendering) {
//determine new tile size
var tileWidth = this.extent.getWidth() / this.map.getResolution();
var tileHeight = this.extent.getHeight() /
(this.map.getResolution() * this.aspectRatio);
var tileSize = new OpenLayers.Size(tileWidth, tileHeight);
//determine new position (upper left corner of new bounds)
var ul = new OpenLayers.LonLat(this.extent.left, this.extent.top);
var ulPx = this.map.getLayerPxFromLonLat(ul);
if(firstRendering) {
//create the new tile
this.tile = new OpenLayers.Tile.Image(this, ulPx, this.extent,
this.url, tileSize);
} else {
//just resize the tile and set it's new position
this.tile.size = tileSize.clone();
this.tile.position = ulPx.clone();
}
this.tile.draw();
}
},
/**
* @param {String} newUrl
*/
setUrl: function(newUrl) {
this.url = newUrl;
this.draw();
},
/** The url we return is always the same (the image itself never changes)
* so we can ignore the bounds parameter (it will always be the same,
* anyways)
*
* @param {OpenLayers.Bounds} bounds
*/
getURL: function(bounds) {
return this.url;
},
/** @final @type String */
CLASS_NAME: "OpenLayers.Layer.Image"
});

View File

@@ -1,6 +1,7 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */
/**
* @class

View File

@@ -1,6 +1,6 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */
// @requires OpenLayers/Layer/Grid.js
/**
* @class

View File

@@ -1,6 +1,7 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */
/**
* @class

View File

@@ -1,6 +1,6 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */
/**
* @class
@@ -65,7 +65,7 @@ OpenLayers.Layer.MultiMap.prototype =
html += " script was either not correctly included.<br>";
html += "<br>";
html += "Demmlopers: For help getting this working correctly, ";
html += "<a href='http://trac.openlayers.org/wiki/MultiMapLayer' "
html += "<a href='http://trac.openlayers.org/wiki/MultiMap' "
html += "target='_blank'>";
html += "click here";
html += "</a>";

112
lib/OpenLayers/Layer/TMS.js Normal file
View File

@@ -0,0 +1,112 @@
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD licence.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */
/**
* @class
*
* @requires OpenLayers/Layer/Grid.js
*/
OpenLayers.Layer.TMS = OpenLayers.Class.create();
OpenLayers.Layer.TMS.prototype =
OpenLayers.Class.inherit( OpenLayers.Layer.Grid, {
reproject: false,
isBaseLayer: true,
tileOrigin: null,
/**
* @constructor
*
* @param {String} name
* @param {String} url
* @param {Object} params
* @param {Object} options Hashtable of extra options to tag onto the layer
*/
initialize: function(name, url, options) {
var newArguments = new Array();
newArguments.push(name, url, {}, options);
OpenLayers.Layer.Grid.prototype.initialize.apply(this, newArguments);
},
/**
*
*/
destroy: function() {
// for now, nothing special to do here.
OpenLayers.Layer.Grid.prototype.destroy.apply(this, arguments);
},
/**
* @param {Object} obj
*
* @returns An exact clone of this OpenLayers.Layer.TMS
* @type OpenLayers.Layer.TMS
*/
clone: function (obj) {
if (obj == null) {
obj = new OpenLayers.Layer.TMS(this.name,
this.url,
this.options);
}
//get all additions from superclasses
obj = OpenLayers.Layer.Grid.prototype.clone.apply(this, [obj]);
// copy/set any non-init, non-simple values here
return obj;
},
/**
* @param {OpenLayers.Bounds} bounds
*
* @returns A string with the layer's url and parameters and also the
* passed-in bounds and appropriate tile size specified as
* parameters
* @type String
*/
getURL: function (bounds) {
var res = this.map.getResolution();
var x = (bounds.left - this.tileOrigin.lon) / (res * this.tileSize.w);
var y = (bounds.bottom - this.tileOrigin.lat) / (res * this.tileSize.h);
var z = this.map.getZoom();
return this.url + "1.0.0" + "/" + this.layername + "/" + z + "/" + x + "/" + y + "." + this.type;
},
/**
* addTile creates a tile, initializes it, and
* adds it to the layer div.
*
* @param {OpenLayers.Bounds} bounds
*
* @returns The added OpenLayers.Tile.Image
* @type OpenLayers.Tile.Image
*/
addTile:function(bounds,position) {
var url = this.getURL(bounds);
return new OpenLayers.Tile.Image(this, position, bounds,
url, this.tileSize);
},
/** When the layer is added to a map, then we can fetch our origin
* (if we don't have one.)
*
* @param {OpenLayers.Map} map
*/
setMap: function(map) {
OpenLayers.Layer.Grid.prototype.setMap.apply(this, arguments);
if (!this.tileOrigin) {
this.tileOrigin = new OpenLayers.LonLat(this.map.maxExtent.left,
this.map.maxExtent.bottom);
}
},
/** @final @type String */
CLASS_NAME: "OpenLayers.Layer.TMS"
});

View File

@@ -1,6 +1,7 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */
/**
* @class
@@ -48,7 +49,7 @@ OpenLayers.Layer.Text.prototype =
/**
* @param {?} ajaxRequest
* @param {XMLHttpRequest} ajaxRequest
*/
parseData: function(ajaxRequest) {
var text = ajaxRequest.responseText;

View File

@@ -1,6 +1,7 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */
/**
* @class
@@ -80,7 +81,7 @@ OpenLayers.Layer.VirtualEarth.prototype =
html += " script was either not correctly included.<br>";
html += "<br>";
html += "Developers: For help getting this working correctly, ";
html += "<a href='http://trac.openlayers.org/wiki/VirtualEarthLayer' "
html += "<a href='http://trac.openlayers.org/wiki/VirtualEarth' "
html += "target='_blank'>";
html += "click here";
html += "</a>";

View File

@@ -1,6 +1,7 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */
/**
* @class

View File

@@ -1,6 +1,7 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */
/**
* @class

View File

@@ -1,6 +1,7 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */
/**
* @class
@@ -30,6 +31,9 @@ OpenLayers.Layer.WMS.Untiled.prototype =
/** @type OpenLayers.Tile.Image */
tile: null,
/** did the image finish loading before a new draw was initiated?
* @type Boolean */
doneLoading: false,
/**
* @constructor
@@ -62,8 +66,10 @@ OpenLayers.Layer.WMS.Untiled.prototype =
*
*/
destroy: function() {
if (this.tile) {
this.tile.destroy();
this.tile = null;
}
OpenLayers.Layer.HTTPRequest.prototype.destroy.apply(this, arguments);
},
@@ -107,6 +113,10 @@ OpenLayers.Layer.WMS.Untiled.prototype =
* @param {Boolean} dragging
*/
moveTo:function(bounds, zoomChanged, dragging) {
if (!this.doneLoading) {
this.events.triggerEvent("loadcancel");
this.doneLoading = true;
}
OpenLayers.Layer.HTTPRequest.prototype.moveTo.apply(this,arguments);
if (bounds == null) {
@@ -124,7 +134,7 @@ OpenLayers.Layer.WMS.Untiled.prototype =
//clear out the old tile
if (this.tile) {
OpenLayers.Util.clearArray(this.tile);
this.tile.clear();
}
//determine new tile bounds
@@ -149,10 +159,23 @@ OpenLayers.Layer.WMS.Untiled.prototype =
var ul = new OpenLayers.LonLat(tileBounds.left, tileBounds.top);
var pos = this.map.getLayerPxFromLonLat(ul);
if ( this.tile && !this.tile.size.equals(tileSize)) {
this.tile.destroy();
this.tile = null;
}
this.events.triggerEvent("loadstart");
this.doneLoading = false;
if (!this.tile) {
this.tile = new OpenLayers.Tile.Image(this, pos, tileBounds,
url, tileSize);
this.tile.draw();
var onload = function() {
this.doneLoading = true;
this.events.triggerEvent("loadend");
}
OpenLayers.Event.observe(this.tile.imgDiv, 'load',
onload.bindAsEventListener(this));
} else {
this.tile.moveTo(tileBounds, pos);
}
@@ -187,7 +210,7 @@ OpenLayers.Layer.WMS.Untiled.prototype =
OpenLayers.Layer.HTTPRequest.prototype.mergeNewParams.apply(this,
newArguments);
//redraw
this.moveTo();
this.moveTo(null, true);
},
/** combine the layer's url with its params and these newParams.

View File

@@ -1,6 +1,7 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */
/**
* @class

View File

@@ -1,6 +1,7 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */
/**
* @class
@@ -94,7 +95,7 @@ OpenLayers.Layer.Yahoo.prototype =
html += " script was either not correctly included.<br>";
html += "<br>";
html += "Developers: For help getting this working correctly, ";
html += "<a href='http://trac.openlayers.org/wiki/YahooLayer' "
html += "<a href='http://trac.openlayers.org/wiki/Yahoo' "
html += "target='_blank'>";
html += "click here";
html += "</a>";

View File

@@ -1,6 +1,7 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */
/**
* @class
@@ -76,6 +77,18 @@ OpenLayers.Map.prototype = {
/** @type int */
zoom: 0,
/** Used to store a unique identifier that changes when the map view
* changes. viewRequestID should be used when adding data asynchronously
* to the map: viewRequestID is incremented when you initiate your
* request (right now during changing of baselayers and changing of zooms).
* It is stored here in the map and also in the data that will be coming
* back asynchronously. Before displaying this data on request completion,
* we check that the viewRequestID of the data is still the same as that
* of the map. Fix for #480
*
* @type String */
viewRequestID: 0,
// Options
/** @type OpenLayers.Size */
@@ -200,7 +213,9 @@ OpenLayers.Map.prototype = {
destroy:function() {
if (this.layers != null) {
for(var i=0; i< this.layers.length; i++) {
this.layers[i].destroy();
//pass 'false' to destroy so that map wont try to set a new
// baselayer after each baselayer is removed
this.layers[i].destroy(false);
}
this.layers = null;
}
@@ -343,8 +358,13 @@ OpenLayers.Map.prototype = {
* its own personal list of popups, removing them from the map.
*
* @param {OpenLayers.Layer} layer
* @param {Boolean} setNewBaseLayer Default is true
*/
removeLayer: function(layer) {
removeLayer: function(layer, setNewBaseLayer) {
if (setNewBaseLayer == null) {
setNewBaseLayer = true;
}
if (layer.isFixed) {
this.viewPortDiv.removeChild(layer.div);
} else {
@@ -354,7 +374,7 @@ OpenLayers.Map.prototype = {
OpenLayers.Util.removeItem(this.layers, layer);
// if we removed the base layer, need to set a new one
if (this.baseLayer == layer) {
if (setNewBaseLayer && (this.baseLayer == layer)) {
this.baseLayer = null;
for(i=0; i < this.layers.length; i++) {
var iLayer = this.layers[i];
@@ -430,29 +450,37 @@ OpenLayers.Map.prototype = {
* @param {Boolean} noEvent
*/
setBaseLayer: function(newBaseLayer, noEvent) {
var oldBaseLayer = this.baseLayer;
var oldExtent = null;
if(this.baseLayer) {
oldExtent = this.baseLayer.getExtent();
}
if (newBaseLayer != oldBaseLayer) {
if (newBaseLayer != this.baseLayer) {
// is newBaseLayer an already loaded layer?
if (OpenLayers.Util.indexOf(this.layers, newBaseLayer) != -1) {
// make the old base layer invisible
if (oldBaseLayer != null) {
oldBaseLayer.setVisibility(false, noEvent);
if (this.baseLayer != null) {
this.baseLayer.setVisibility(false, noEvent);
}
// set new baselayer and make it visible
this.baseLayer = newBaseLayer;
// Increment viewRequestID since the baseLayer is
// changing. This is used by tiles to check if they should
// draw themselves.
this.viewRequestID++;
this.baseLayer.setVisibility(true, noEvent);
//redraw all layers
var center = this.getCenter();
if (center != null) {
if (oldBaseLayer == null) {
if (oldExtent == null) {
this.setCenter(center);
} else {
this.zoomToExtent(oldBaseLayer.getExtent());
this.zoomToExtent(oldExtent);
}
}
@@ -479,13 +507,18 @@ OpenLayers.Map.prototype = {
* @param {OpenLayers.Pixel} px
*/
addControlToMap: function (control, px) {
// If a control doesn't have a div at this point, it belongs in the
// viewport.
control.outsideViewport = (control.div != null);
control.setMap(this);
var div = control.draw(px);
if (div) {
if(!control.outsideViewport) {
div.style.zIndex = this.Z_INDEX_BASE['Control'] +
this.controls.length;
this.viewPortDiv.appendChild( div );
}
}
},
/**
@@ -734,6 +767,9 @@ OpenLayers.Map.prototype = {
for (var i = 0; i < this.popups.length; i++) {
this.popups[i].updatePosition();
}
// zoom level has changed, increment viewRequestID.
this.viewRequestID++;
}
var bounds = this.getExtent();
@@ -785,8 +821,10 @@ OpenLayers.Map.prototype = {
var originPx = this.getViewPortPxFromLonLat(this.layerContainerOrigin);
var newPx = this.getViewPortPxFromLonLat(lonlat);
if ((originPx != null) && (newPx != null)) {
this.layerContainerDiv.style.left = (originPx.x - newPx.x) + "px";
this.layerContainerDiv.style.top = (originPx.y - newPx.y) + "px";
}
},
/**

View File

@@ -1,6 +1,7 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */
/**
* @class
@@ -125,7 +126,11 @@ OpenLayers.Marker.prototype = {
OpenLayers.Marker.defaultIcon = function() {
var url = OpenLayers.Util.getImagesLocation() + "marker.png";
var size = new OpenLayers.Size(21, 25);
return new OpenLayers.Icon(url, size);
var calculateOffset = function(size) {
return new OpenLayers.Pixel(-(size.w/2), -size.h);
};
return new OpenLayers.Icon(url, size, null, calculateOffset);
};

View File

@@ -1,6 +1,7 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */
/**
* @class
@@ -8,17 +9,21 @@
* @requires OpenLayers/Marker.js
*/
OpenLayers.Marker.Box = OpenLayers.Class.create();
OpenLayers.Marker.Box.prototype = OpenLayers.Class.inherit( OpenLayers.Marker, {
/** @type OpenLayers.LonLat */
OpenLayers.Marker.Box.prototype =
OpenLayers.Class.inherit( OpenLayers.Marker, {
/** @type OpenLayers.Bounds */
bounds: null,
/** @type DOMElement */
div: null,
/**
* @constructor
*
* @param {OpenLayers.Icon} icon
* @param {OpenLayers.LonLat lonlat
* @param {OpenLayers.Bounds} bounds
* @param {String} borderColor
* @param {int} borderWidth
*/
initialize: function(bounds, borderColor, borderWidth) {
this.bounds = bounds;
@@ -28,14 +33,24 @@ OpenLayers.Marker.Box.prototype = OpenLayers.Class.inherit( OpenLayers.Marker, {
this.setBorder(borderColor, borderWidth);
},
/** Allow the user to change the box's color and border width
*
* @param {String} color Default is "red"
* @param {int} width Default is 2
*/
setBorder: function (color, width) {
if (!color) color = "red";
if (!width) width = 2;
if (!color) {
color = "red";
}
if (!width) {
width = 2;
}
this.div.style.border = width + "px solid " + color;
},
/**
* @param {OpenLayers.Pixel} px
* @param {OpenLayers.Size} sz
*
* @return A new DOM Image with this marker<65>s icon set at the
* location passed-in

View File

@@ -1,6 +1,7 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */
/**
* @class
@@ -206,6 +207,10 @@ OpenLayers.Popup.prototype = {
this.div.style.width = this.size.w + "px";
this.div.style.height = this.size.h + "px";
}
if (this.contentDiv != null){
this.contentDiv.style.width = this.size.w + "px";
this.contentDiv.style.height = this.size.h + "px";
}
},
/**

View File

@@ -1,6 +1,7 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */
/**
* @class

View File

@@ -1,6 +1,7 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */
/**
* @class
@@ -69,11 +70,14 @@ OpenLayers.Popup.AnchoredBubble.prototype =
contentSize.h -= (2 * this.padding);
this.contentDiv.style.height = contentSize.h + "px";
this.contentDiv.style.width = contentSize.w + "px";
if (this.map) {
//size has changed - must redo corners
this.setRicoCorners(!this.rounded);
this.rounded = true;
}
}
},
/**
@@ -87,7 +91,7 @@ OpenLayers.Popup.AnchoredBubble.prototype =
if (this.div != null) {
if (this.contentDiv != null) {
this.div.style.background = "transparent";
Rico.Corner.changeColor(this.contentDiv, this.backgroundColor);
OpenLayers.Rico.Corner.changeColor(this.contentDiv, this.backgroundColor);
}
}
},
@@ -102,7 +106,7 @@ OpenLayers.Popup.AnchoredBubble.prototype =
if (this.div != null) {
if (this.contentDiv != null) {
Rico.Corner.changeOpacity(this.contentDiv, this.opacity);
OpenLayers.Rico.Corner.changeOpacity(this.contentDiv, this.opacity);
}
}
},
@@ -133,9 +137,9 @@ OpenLayers.Popup.AnchoredBubble.prototype =
blend: false};
if (firstTime) {
Rico.Corner.round(this.div, options);
OpenLayers.Rico.Corner.round(this.div, options);
} else {
Rico.Corner.reRound(this.contentDiv, options);
OpenLayers.Rico.Corner.reRound(this.contentDiv, options);
//set the popup color and opacity
this.setBackgroundColor();
this.setOpacity();

View File

@@ -1,5 +1,6 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
_OPENLAYERS_SFL_=true
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */
_OPENLAYERS_SFL_=true;

View File

@@ -1,6 +1,7 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */
/*
* @class
@@ -68,7 +69,12 @@ OpenLayers.Tile.prototype = {
/**
*/
draw:function() {
this.drawn = true;
this.clear();
return ((this.layer.displayOutsideMaxExtent
|| (this.layer.maxExtent
&& this.bounds.intersectsBounds(this.layer.maxExtent, false)))
&& !(this.layer.buffer == 0
&& !this.bounds.intersectsBounds(this.layer.map.getExtent(), false)));
},
/**
@@ -82,7 +88,7 @@ OpenLayers.Tile.prototype = {
redraw = true;
}
OpenLayers.Util.clearArray(this);
this.clear();
this.bounds = bounds.clone();
this.position = position.clone();
if (redraw) {
@@ -98,8 +104,8 @@ OpenLayers.Tile.prototype = {
},
getBoundsFromBaseLayer: function(position) {
var topLeft = this.layer.map.getLonLatFromLayerPx(this.position);
var bottomRightPx = this.position.clone();
var topLeft = this.layer.map.getLonLatFromLayerPx(position);
var bottomRightPx = position.clone();
bottomRightPx.x += this.size.w;
bottomRightPx.y += this.size.h;
var bottomRight = this.layer.map.getLonLatFromLayerPx(bottomRightPx);
@@ -120,3 +126,4 @@ OpenLayers.Tile.prototype = {
CLASS_NAME: "OpenLayers.Tile"
};

View File

@@ -1,6 +1,7 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */
/**
* @class
@@ -33,6 +34,7 @@ OpenLayers.Tile.Image.prototype =
destroy: function() {
if ((this.imgDiv != null) && (this.imgDiv.parentNode == this.layer.div)) {
this.layer.div.removeChild(this.imgDiv);
this.imgDiv.map = null;
}
this.imgDiv = null;
OpenLayers.Tile.prototype.destroy.apply(this, arguments);
@@ -42,20 +44,20 @@ OpenLayers.Tile.Image.prototype =
*
*/
draw:function() {
OpenLayers.Tile.prototype.draw.apply(this, arguments);
if (this.imgDiv == null) {
this.initImgDiv();
}
if (this.layer != this.layer.map.baseLayer && this.layer.reproject) {
this.bounds = this.getBoundsFromBaseLayer(this.position);
}
if (!OpenLayers.Tile.prototype.draw.apply(this, arguments)) {
return false;
}
if (this.imgDiv == null) {
this.initImgDiv();
}
this.imgDiv.viewRequestID = this.layer.map.viewRequestID;
this.url = this.layer.getURL(this.bounds);
this.imgDiv.style.display = "none";
if (this.layer.displayOutsideMaxExtent || (this.layer.maxExtent &&
(this.bounds.intersectsBounds(this.layer.maxExtent,false))
)) {
if (this.layer.alpha) {
OpenLayers.Util.modifyAlphaImageDiv(this.imgDiv,
null, this.position, this.size, this.url);
@@ -64,7 +66,8 @@ OpenLayers.Tile.Image.prototype =
OpenLayers.Util.modifyDOMElement(this.imgDiv,
null, this.position, this.size) ;
}
}
this.drawn = true;
return true;
},
/** Clear the tile of any bounds/position-related data so that it can
@@ -117,12 +120,14 @@ OpenLayers.Tile.Image.prototype =
this.imgDiv.className = 'olTileImage';
/* checkImgURL *should* pretty predictably get called after the
createImage / createAlphaImageDiv onLoad handler */
/* checkImgURL used to be used to called as a work around, but it
ended up hiding problems instead of solving them and broke things
like relative URLs. See discussion on the dev list:
http://openlayers.org/pipermail/dev/2006-2007-January/000205.html
OpenLayers.Event.observe( this.imgDiv, "load",
this.checkImgURL.bindAsEventListener(this) );
*/
this.layer.div.appendChild(this.imgDiv);
if(this.layer.opacity != null) {
@@ -130,6 +135,10 @@ OpenLayers.Tile.Image.prototype =
null, null, null,
this.layer.opacity);
}
// we need this reference to check back the viewRequestID
this.imgDiv.map = this.layer.map;
},
/**
@@ -140,13 +149,25 @@ OpenLayers.Tile.Image.prototype =
* when the new URL loads in the image, or (b) we don't want to display
* this tile after all because its new bounds are outside our maxExtent.
*
* This function should no longer be neccesary with the improvements to
* Grid.js in OpenLayers 2.3. The lack of a good isEquivilantURL function
* caused problems in 2.2, but it's possible that with the improved
* isEquivilant URL function, this might be neccesary at some point.
*
* See discussion in the thread at
* http://openlayers.org/pipermail/dev/2006-2007-January/000205.html
*
* @private
*/
checkImgURL: function () {
// Sometimes our image will load after it has already been removed
// from the map, in which case this check is not needed.
if (this.layer) {
var loaded = this.layer.alpha ? this.imgDiv.firstChild.src : this.imgDiv.src;
if (loaded != this.url) {
if (!OpenLayers.Util.isEquivalentUrl(loaded, this.url)) {
this.imgDiv.style.display = "none";
}
}
},
/** @final @type String */

View File

@@ -1,6 +1,7 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */
/**
* @class
@@ -56,14 +57,12 @@ OpenLayers.Tile.WFS.prototype =
*
*/
draw:function() {
if (this.drawn) {
OpenLayers.Util.clearArray(this);
if (!OpenLayers.Tile.prototype.draw.apply(this, arguments)) {
return false;
}
OpenLayers.Tile.prototype.draw.apply(this, arguments);
if (this.layer.displayOutsideMaxExtent || (this.layer.maxExtent &&
this.layer.maxExtent.intersectsBounds(this.bounds, false))) {
this.loadFeaturesForRegion(this.requestSuccess);
}
this.drawn = true;
return true;
},
/** get the full request string from the ds and the tile params
@@ -89,7 +88,7 @@ OpenLayers.Tile.WFS.prototype =
/** Return from AJAX request
*
* @param {} request
* @param {XMLHttpRequest} request
*/
requestSuccess:function(request) {
var doc = request.responseXML;
@@ -130,3 +129,4 @@ OpenLayers.Tile.WFS.prototype =
}
);

View File

@@ -1,6 +1,7 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */
/**
* @class
@@ -216,14 +217,36 @@ OpenLayers.Util.setOpacity = function(element, opacity) {
}
OpenLayers.Util.onImageLoad = function() {
// The complex check here is to solve issues described in #480.
// Every time a map view changes, it increments the 'viewRequestID'
// property. As the requests for the images for the new map view are sent
// out, they are tagged with this unique viewRequestID.
//
// If an image has no viewRequestID property set, we display it regardless,
// but if it does have a viewRequestID property, we check that it matches
// the viewRequestID set on the map.
//
// If the viewRequestID on the map has changed, that means that the user
// has changed the map view since this specific request was sent out, and
// therefore this tile does not need to be displayed (so we do not execute
// this code that turns its display on).
//
if (!this.viewRequestID ||
(this.viewRequestID == this.map.viewRequestID)) {
this.style.backgroundColor = null;
this.style.display = "";
}
};
OpenLayers.Util.onImageLoadErrorColor = "pink";
OpenLayers.IMAGE_RELOAD_ATTEMPTS = 0;
OpenLayers.Util.onImageLoadError = function() {
this._attempts = (this._attempts) ? (this._attempts + 1) : 1;
if(this._attempts <= OpenLayers.IMAGE_RELOAD_ATTEMPTS) {
this.src = this.src;
} else {
this.style.backgroundColor = OpenLayers.Util.onImageLoadErrorColor;
}
this.style.display = "";
};
@@ -315,7 +338,7 @@ OpenLayers.Util.createAlphaImageDiv = function(id, px, sz, imgURL,
var div = OpenLayers.Util.createDiv();
var img = OpenLayers.Util.createImage(null, null, null, null, null, null,
false);
null, false);
div.appendChild(img);
if (delayDisplay) {
@@ -371,6 +394,9 @@ OpenLayers.Util.applyDefaults = function (to, from) {
* @returns a concatenation of the properties of an object in
* http parameter notation.
* (ex. <i>"key1=value1&key2=value2&key3=value3"</i>)
* If a parameter is actually a list, that parameter will then
* be set to a comma-seperated list of values (foo,bar) instead
* of being URL escaped (foo%3Abar).
* @type String
*/
OpenLayers.Util.getParameterString = function(params) {
@@ -379,7 +405,20 @@ OpenLayers.Util.getParameterString = function(params) {
for (var key in params) {
var value = params[key];
if ((value != null) && (typeof value != 'function')) {
paramsArray.push(key + "=" + value);
var encodedValue;
if (typeof value == 'object' && value.constructor == Array) {
/* value is an array; encode items and separate with "," */
var encodedItemArray = new Array();
for (var itemIndex=0; itemIndex<value.length; itemIndex++) {
encodedItemArray.push(encodeURIComponent(value[itemIndex]));
}
encodedValue = encodedItemArray.join(",");
}
else {
/* value is a string; simply encode */
encodedValue = encodeURIComponent(value);
}
paramsArray.push(encodeURIComponent(key) + "=" + encodedValue);
}
}
@@ -552,20 +591,30 @@ OpenLayers.Util.distVincenty=function(p1, p2) {
return d;
};
OpenLayers.Util.getArgs = function() {
var args = new Object();
var query = location.search.substring(1); // Get query string.
var pairs = query.split("&"); // Break at ampersand. //+pjl
for(var i = 0; i < pairs.length; i++) {
var pos = pairs[i].indexOf('='); // Look for "name=value".
if (pos == -1) continue; // If not found, skip.
var argname = pairs[i].substring(0,pos); // Extract the name.
var value = pairs[i].substring(pos+1); // Extract the value.
args[argname] = unescape(value); // Store as a property.
/**
* @param {String} url Optional url used to extract the query string.
* If null, query string is taken from page location.
*
* @returns An object of key/value pairs from the query string.
* @type Object
*/
OpenLayers.Util.getArgs = function(url) {
if(url == null) {
url = window.location.href;
}
var query = (url.indexOf('?') != -1) ? url.substring(url.indexOf('?') + 1) : '';
var args = new Object();
pairs = query.split(/[&;]/);
for(var i = 0; i < pairs.length; ++i) {
keyValue = pairs[i].split(/=/);
if(keyValue.length == 2) {
args[decodeURIComponent(keyValue[0])] =
decodeURIComponent(keyValue[1]);
}
}
return args;
}
return args; // Return the object.
};
/**
* @param {String} prefix String to prefix random id. If null, default
@@ -691,3 +740,218 @@ OpenLayers.Util.pagePosition = function(forElement) {
return [valueL, valueT];
};
/** Test two URLs for equivalence.
*
* Setting 'ignoreCase' allows for case-independent comparison.
*
* Comparison is based on:
* - Protocol
* - Host (evaluated without the port)
* - Port (set 'ignorePort80' to ignore "80" values)
* - Hash ( set 'ignoreHash' to disable)
* - Pathname (for relative <-> absolute comparison)
* - Arguments (so they can be out of order)
*
*
*
* @param {String} url1
* @param {String} url2
* @param {Object} options allows for customization of comparison:
* 'ignoreCase' - Default is True
* 'ignorePort80' - Default is True
* 'ignoreHash' - Default is True
*
* @returns Whether or not the two URLs are equivalent
* @type Boolean
*/
OpenLayers.Util.isEquivalentUrl = function(url1, url2, options) {
options = options || new Object();
OpenLayers.Util.applyDefaults(options, {
ignoreCase: true,
ignorePort80: true,
ignoreHash: true
});
urlObj1 = OpenLayers.Util.createUrlObject(url1, options);
urlObj2 = OpenLayers.Util.createUrlObject(url2, options);
//compare all keys (host, port, etc)
for(var key in urlObj1) {
if (options.test) {
alert(key + "\n1:" + urlObj1[key] + "\n2:" + urlObj2[key]);
}
var val1 = urlObj1[key];
var val2 = urlObj2[key];
switch(key) {
case "args":
//do nothing, they'll be treated below
break;
case "host":
case "port":
case "protocol":
if ((val1 == "") || (val2 == "")) {
//these will be blank for relative urls, so no need to
// compare them here -- call break.
//
break;
}
// otherwise continue with default compare
//
default:
if ( (key != "args") && (urlObj1[key] != urlObj2[key]) ) {
return false;
}
break;
}
}
// compare search args - irrespective of order
for(var key in urlObj1.args) {
if(urlObj1.args[key] != urlObj2.args[key]) {
return false;
}
delete urlObj2.args[key];
}
// urlObj2 shouldn't have any args left
for(var key in urlObj2.args) {
return false;
}
return true;
};
/**
* @private
*
* @param {String} url
* @param {Object} options
*
* @returns An object with separate url, a, port, host, and args parsed out
* and ready for comparison
* @type Object
*/
OpenLayers.Util.createUrlObject = function(url, options) {
options = options || new Object();
var urlObject = new Object();
if (options.ignoreCase) {
url = url.toLowerCase();
}
var a = document.createElement('a');
a.href = url;
//host (without port)
urlObject.host = a.host;
var port = a.port;
if (port.length <= 0) {
var newHostLength = urlObject.host.length - (port.length);
urlObject.host = urlObject.host.substring(0, newHostLength);
}
//protocol
urlObject.protocol = a.protocol;
//port
urlObject.port = ((port == "80") && (options.ignorePort80)) ? "" : port;
//hash
urlObject.hash = (options.ignoreHash) ? "" : a.hash;
//args
var queryString = a.search;
if (!queryString) {
var qMark = url.indexOf("?");
queryString = (qMark != -1) ? url.substr(qMark) : "";
}
urlObject.args = OpenLayers.Util.getArgs(queryString);
//pathname (this part allows for relative <-> absolute comparison)
if ( ((urlObject.protocol == "file:") && (url.indexOf("file:") != -1)) ||
((urlObject.protocol != "file:") && (urlObject.host != "")) ) {
urlObject.pathname = a.pathname;
//Test to see if the pathname includes the arguments (Opera)
var qIndex = urlObject.pathname.indexOf("?");
if (qIndex != -1) {
urlObject.pathname = urlObject.pathname.substring(0, qIndex);
}
} else {
var relStr = OpenLayers.Util.removeTail(url);
var backs = 0;
do {
var index = relStr.indexOf("../");
if (index == 0) {
backs++
relStr = relStr.substr(3);
} else if (index >= 0) {
var prevChunk = relStr.substr(0,index - 1);
var slash = prevChunk.indexOf("/");
prevChunk = (slash != -1) ? prevChunk.substr(0, slash +1)
: "";
var postChunk = relStr.substr(index + 3);
relStr = prevChunk + postChunk;
}
} while(index != -1)
var windowAnchor = document.createElement("a");
var windowUrl = window.location.href;
if (options.ignoreCase) {
windowUrl = windowUrl.toLowerCase();
}
windowAnchor.href = windowUrl;
//set protocol of window
urlObject.protocol = windowAnchor.protocol;
var splitter = (windowAnchor.pathname.indexOf("/") != -1) ? "/" : "\\";
var dirs = windowAnchor.pathname.split(splitter);
dirs.pop(); //remove filename
while ((backs > 0) && (dirs.length > 0)) {
dirs.pop();
backs--;
}
relStr = dirs.join("/") + "/"+ relStr;
urlObject.pathname = relStr;
}
if ((urlObject.protocol == "file:") || (urlObject.protocol == "")) {
urlObject.host = "localhost";
}
return urlObject;
};
/**
* @param {String} url
*
* @returns The string with all queryString and Hash removed
* @type String
*/
OpenLayers.Util.removeTail = function(url) {
var head = null;
var qMark = url.indexOf("?");
var hashMark = url.indexOf("#");
if (qMark == -1) {
head = (hashMark != -1) ? url.substr(0,hashMark) : url;
} else {
head = (hashMark != -1) ? url.substr(0,Math.min(qMark, hashMark))
: url.substr(0, qMark);
}
return head;
};

View File

@@ -1,6 +1,6 @@
Rico.Color = OpenLayers.Class.create();
OpenLayers.Rico.Color = OpenLayers.Class.create();
Rico.Color.prototype = {
OpenLayers.Rico.Color.prototype = {
initialize: function(red, green, blue) {
this.rgb = { r: red, g : green, b : blue };
@@ -25,7 +25,7 @@ Rico.Color.prototype = {
hsb.h = h;
// convert back to RGB...
this.rgb = Rico.Color.HSBtoRGB(hsb.h, hsb.s, hsb.b);
this.rgb = OpenLayers.Rico.Color.HSBtoRGB(hsb.h, hsb.s, hsb.b);
},
setSaturation: function(s) {
@@ -34,7 +34,7 @@ Rico.Color.prototype = {
hsb.s = s;
// convert back to RGB and set values...
this.rgb = Rico.Color.HSBtoRGB(hsb.h, hsb.s, hsb.b);
this.rgb = OpenLayers.Rico.Color.HSBtoRGB(hsb.h, hsb.s, hsb.b);
},
setBrightness: function(b) {
@@ -43,17 +43,17 @@ Rico.Color.prototype = {
hsb.b = b;
// convert back to RGB and set values...
this.rgb = Rico.Color.HSBtoRGB( hsb.h, hsb.s, hsb.b );
this.rgb = OpenLayers.Rico.Color.HSBtoRGB( hsb.h, hsb.s, hsb.b );
},
darken: function(percent) {
var hsb = this.asHSB();
this.rgb = Rico.Color.HSBtoRGB(hsb.h, hsb.s, Math.max(hsb.b - percent,0));
this.rgb = OpenLayers.Rico.Color.HSBtoRGB(hsb.h, hsb.s, Math.max(hsb.b - percent,0));
},
brighten: function(percent) {
var hsb = this.asHSB();
this.rgb = Rico.Color.HSBtoRGB(hsb.h, hsb.s, Math.min(hsb.b + percent,1));
this.rgb = OpenLayers.Rico.Color.HSBtoRGB(hsb.h, hsb.s, Math.min(hsb.b + percent,1));
},
blend: function(other) {
@@ -80,7 +80,7 @@ Rico.Color.prototype = {
},
asHSB: function() {
return Rico.Color.RGBtoHSB(this.rgb.r, this.rgb.g, this.rgb.b);
return OpenLayers.Rico.Color.RGBtoHSB(this.rgb.r, this.rgb.g, this.rgb.b);
},
toString: function() {
@@ -89,7 +89,7 @@ Rico.Color.prototype = {
};
Rico.Color.createFromHex = function(hexCode) {
OpenLayers.Rico.Color.createFromHex = function(hexCode) {
if(hexCode.length==4) {
var shortHexCode = hexCode;
var hexCode = '#';
@@ -101,39 +101,39 @@ shortHexCode.charAt(i));
var red = hexCode.substring(0,2);
var green = hexCode.substring(2,4);
var blue = hexCode.substring(4,6);
return new Rico.Color( parseInt(red,16), parseInt(green,16), parseInt(blue,16) );
return new OpenLayers.Rico.Color( parseInt(red,16), parseInt(green,16), parseInt(blue,16) );
}
/**
* Factory method for creating a color from the background of
* an HTML element.
*/
Rico.Color.createColorFromBackground = function(elem) {
OpenLayers.Rico.Color.createColorFromBackground = function(elem) {
var actualColor = RicoUtil.getElementsComputedStyle($(elem), "backgroundColor", "background-color");
if ( actualColor == "transparent" && elem.parentNode )
return Rico.Color.createColorFromBackground(elem.parentNode);
return OpenLayers.Rico.Color.createColorFromBackground(elem.parentNode);
if ( actualColor == null )
return new Rico.Color(255,255,255);
return new OpenLayers.Rico.Color(255,255,255);
if ( actualColor.indexOf("rgb(") == 0 ) {
var colors = actualColor.substring(4, actualColor.length - 1 );
var colorArray = colors.split(",");
return new Rico.Color( parseInt( colorArray[0] ),
return new OpenLayers.Rico.Color( parseInt( colorArray[0] ),
parseInt( colorArray[1] ),
parseInt( colorArray[2] ) );
}
else if ( actualColor.indexOf("#") == 0 ) {
return Rico.Color.createFromHex(actualColor);
return OpenLayers.Rico.Color.createFromHex(actualColor);
}
else
return new Rico.Color(255,255,255);
return new OpenLayers.Rico.Color(255,255,255);
}
Rico.Color.HSBtoRGB = function(hue, saturation, brightness) {
OpenLayers.Rico.Color.HSBtoRGB = function(hue, saturation, brightness) {
var red = 0;
var green = 0;
@@ -188,7 +188,7 @@ Rico.Color.HSBtoRGB = function(hue, saturation, brightness) {
return { r : parseInt(red), g : parseInt(green) , b : parseInt(blue) };
}
Rico.Color.RGBtoHSB = function(r, g, b) {
OpenLayers.Rico.Color.RGBtoHSB = function(r, g, b) {
var hue;
var saturation;

View File

@@ -14,8 +14,8 @@
**/
var Rico = new Object();
Rico.Corner = {
OpenLayers.Rico = new Object();
OpenLayers.Rico.Corner = {
round: function(e, options) {
var e = $(e);
@@ -305,8 +305,8 @@ Rico.Corner = {
},
_hasString: function(str) { for(var i=1 ; i<arguments.length ; i++) if (str.indexOf(arguments[i]) >= 0) return true; return false; },
_blend: function(c1, c2) { var cc1 = Rico.Color.createFromHex(c1); cc1.blend(Rico.Color.createFromHex(c2)); return cc1; },
_background: function(el) { try { return Rico.Color.createColorFromBackground(el).asHex(); } catch(err) { return "#ffffff"; } },
_blend: function(c1, c2) { var cc1 = OpenLayers.Rico.Color.createFromHex(c1); cc1.blend(OpenLayers.Rico.Color.createFromHex(c2)); return cc1; },
_background: function(el) { try { return OpenLayers.Rico.Color.createColorFromBackground(el).asHex(); } catch(err) { return "#ffffff"; } },
_isTransparent: function() { return this.options.color == "transparent"; },
_isTopRounded: function() { return this._hasString(this.options.corners, "all", "top", "tl", "tr"); },
_isBottomRounded: function() { return this._hasString(this.options.corners, "all", "bottom", "bl", "br"); },

View File

@@ -1,4 +1,6 @@
Copyright (c) 2005-2006 MetaCarta, Inc.
This license applies to official code releases at www.openlayers.org:
Copyright (c) 2005-2007 MetaCarta, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without

32
tests/grid_inittiles.html Normal file
View File

@@ -0,0 +1,32 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
#map {
width: 800px;
height: 475px;
border: 1px solid black;
}
</style>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript">
<!--
function init(){
var map = new OpenLayers.Map('map', {'maxResolution': 1.40625/2, tileSize: new OpenLayers.Size(256,256)});
ww = new OpenLayers.Layer.WMS( "Basic",
"http://labs.metacarta.com/wms-c/Basic.py?",
{layers:"basic"});
map.addLayers([ww]);
map.zoomToMaxExtent();
map.zoomIn();
map.zoomOut();
map.zoomOut();
}
// -->
</script>
</head>
<body onload="init()">
<h1>Grid Test</h1>
<p>Map should display with two centered tiles. If there appear to be a combination of two zoom levels, then this test is failed, and something is broken in OpenLayers.</p>
<div id="map"></div>
</body>
</html>

View File

@@ -11,6 +11,7 @@
<li>test_Events.html</li>
<li>test_Util.html</li>
<li>test_Layer.html</li>
<li>test_Layer_Image.html</li>
<li>test_Layer_EventPane.html</li>
<li>test_Layer_FixedZoomLevels.html</li>
<li>test_Layer_HTTPRequest.html</li>
@@ -20,6 +21,7 @@
<li>test_Layer_GeoRSS.html</li>
<li>test_Layer_KaMap.html</li>
<li>test_Layer_WMS.html</li>
<li>test_Layer_TMS.html</li>
<li>test_Tile.html</li>
<li>test_Tile_Image.html</li>
<li>test_Control.html</li>

View File

@@ -24,16 +24,14 @@
t.eq( cloned.url, "b", "cloned.url does change when edited" );
}
function test_02_Marker_setOpacity(t) {
function test_03_Marker_setOpacity(t) {
t.plan( 2 );
icon = new OpenLayers.Icon("a",new OpenLayers.Size(5,6));
t.ok(!icon.imageDiv.style.opacity, "default icon has no opacity");
icon.setOpacity(0.5);
t.eq(icon.imageDiv.style.opacity + "", "0.5", "icon.setOpacity() works");
t.eq(parseFloat(icon.imageDiv.style.opacity), 0.5, "icon.setOpacity() works");
}
// -->

View File

@@ -3,6 +3,7 @@
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript"><!--
var isMozilla = (navigator.userAgent.indexOf("compatible") == -1);
var isOpera = (navigator.userAgent.indexOf("Opera") != -1);
var layer;
function test_01_Layer_EventPane_constructor (t) {
@@ -56,7 +57,7 @@
// MOUSEMOVE test does not seem to work...
// t.plan( 2 );
if (document.createEventObject) {
if (!isMozilla || isOpera) {
t.plan(4);
} else {
t.plan(3);
@@ -108,6 +109,6 @@
</script>
</head>
<body>
<div id="map"></div>
<div id="map" style="height:500px;width:500px"></div>
</body>
</html>

View File

@@ -89,56 +89,64 @@
tParams = { layers: 'basic',
format: 'image/png'};
t.plan( 8 );
t.plan( 9 );
// without ?
tUrl = "http://octo.metacarta.com/cgi-bin/mapserv";
layer = new OpenLayers.Layer.HTTPRequest(name, tUrl, tParams, null);
str = layer.getFullRequestString();
t.eq(str, "http://octo.metacarta.com/cgi-bin/mapserv?layers=basic&format=image/png", "getFullRequestString() works for url sans ?");
t.eq(str, tUrl + '?' + OpenLayers.Util.getParameterString(tParams), "getFullRequestString() works for url sans ?");
// with ?
tUrl = "http://octo.metacarta.com/cgi-bin/mapserv?";
layer = new OpenLayers.Layer.HTTPRequest(name, tUrl, tParams, null);
str = layer.getFullRequestString();
t.eq(str, "http://octo.metacarta.com/cgi-bin/mapserv?layers=basic&format=image/png", "getFullRequestString() works for url with ?");
t.eq(str, tUrl + OpenLayers.Util.getParameterString(tParams), "getFullRequestString() works for url with ?");
// with ?param1=5
tUrl = "http://octo.metacarta.com/cgi-bin/mapserv?param1=5";
layer = new OpenLayers.Layer.HTTPRequest(name, tUrl, tParams, null);
str = layer.getFullRequestString();
t.eq(str, "http://octo.metacarta.com/cgi-bin/mapserv?param1=5&layers=basic&format=image/png", "getFullRequestString() works for url with ?param1=5");
t.eq(str, tUrl + '&' + OpenLayers.Util.getParameterString(tParams), "getFullRequestString() works for url with ?param1=5");
// with ?param1=5&
tUrl = "http://octo.metacarta.com/cgi-bin/mapserv?param1=5&format=image/jpeg";
layer = new OpenLayers.Layer.HTTPRequest(name, tUrl, tParams, null);
str = layer.getFullRequestString();
t.eq(str, tUrl + '&' + OpenLayers.Util.getParameterString({'layers':'basic'}), "getFullRequestString() doesn't override already-existing params in URL");
// with ?param1=5&
tUrl = "http://octo.metacarta.com/cgi-bin/mapserv?param1=5&";
layer = new OpenLayers.Layer.HTTPRequest(name, tUrl, tParams, null);
str = layer.getFullRequestString();
t.eq(str, "http://octo.metacarta.com/cgi-bin/mapserv?param1=5&layers=basic&format=image/png", "getFullRequestString() works for url with ?param1=5&");
t.eq(str, tUrl + OpenLayers.Util.getParameterString(tParams), "getFullRequestString() works for url with ?param1=5&");
// passing in new params
layer = new OpenLayers.Layer.HTTPRequest(name, tUrl, tParams, null);
str = layer.getFullRequestString( { chicken: 6,
layers:"road" } );
t.eq(str, "http://octo.metacarta.com/cgi-bin/mapserv?param1=5&layers=road&format=image/png&chicken=6", "getFullRequestString() works for passing in new params");
t.eq(str, tUrl + OpenLayers.Util.getParameterString({layers: 'road', format: "image/png", chicken: 6}), "getFullRequestString() works for passing in new params");
// layer with null params
layer = new OpenLayers.Layer.HTTPRequest(name, tUrl, null, null);
str = layer.getFullRequestString();
t.eq(str, "http://octo.metacarta.com/cgi-bin/mapserv?param1=5&", "getFullRequestString() works for layer with null params");
t.eq(str, tUrl + OpenLayers.Util.getParameterString({}), "getFullRequestString() works for layer with null params");
// layer with null params passing in new params
layer = new OpenLayers.Layer.HTTPRequest(name, tUrl, null, null);
str = layer.getFullRequestString( { chicken: 6,
layers:"road" } );
t.eq(str, "http://octo.metacarta.com/cgi-bin/mapserv?param1=5&chicken=6&layers=road", "getFullRequestString() works for layer with null params passing in new params");
t.eq(str, tUrl + OpenLayers.Util.getParameterString({chicken: 6, layers: "road"}), "getFullRequestString() works for layer with null params passing in new params");
// with specified altUrl parameter
tUrl = "http://octo.metacarta.com/cgi-bin/mapserv";
layer = new OpenLayers.Layer.HTTPRequest(name, "chicken", tParams, null);
str = layer.getFullRequestString(null, tUrl);
t.eq(str, "http://octo.metacarta.com/cgi-bin/mapserv?layers=basic&format=image/png", "getFullRequestString() works for url sans ?");
t.eq(str, tUrl + '?' + OpenLayers.Util.getParameterString(tParams), "getFullRequestString() works for url sans ?");
}

View File

@@ -0,0 +1,96 @@
<html>
<head>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript"><!--
var layer;
function test_01_Layer_Image_constructor (t) {
t.plan( 13 );
var options = { chicken: 151, foo: "bar", projection: "none" };
var layer = new OpenLayers.Layer.Image('Test Layer',
'http://earthtrends.wri.org/images/maps/4_m_citylights_lg.gif',
new OpenLayers.Bounds(-180, -88.759, 180, 88.759),
new OpenLayers.Size(580, 288), options);
t.ok( layer instanceof OpenLayers.Layer.Image, "new OpenLayers.Layer.Image returns object" );
t.eq( layer.CLASS_NAME, "OpenLayers.Layer.Image", "CLASS_NAME variable set correctly");
t.eq( layer.name, "Test Layer", "layer.name is correct" );
t.ok( layer.id != null, "Layer is given an id");
t.ok( layer.projection, "none", "default layer projection correctly set");
t.ok( ((layer.chicken == 151) && (layer.foo == "bar")), "layer.options correctly set to Layer Object" );
t.ok( ((layer.options["chicken"] == 151) && (layer.options["foo"] == "bar")), "layer.options correctly backed up" );
options.chicken = 552;
t.eq( layer.options["chicken"], 151 , "layer.options correctly made fresh copy" );
t.eq( layer.isBaseLayer, true, "Default img layer is base layer" );
layer = new OpenLayers.Layer.Image('Test Layer',
'http://earthtrends.wri.org/images/maps/4_m_citylights_lg.gif',
new OpenLayers.Bounds(-180, -88.759, 180, 88.759),
new OpenLayers.Size(580, 288));
t.ok( layer instanceof OpenLayers.Layer.Image, "new OpenLayers.Layer.Image returns object" );
t.eq( layer.name, "Test Layer", "layer.name is correct" );
t.ok( layer.projection == null, "default layer projection correctly set");
t.ok( layer.options instanceof Object, "layer.options correctly initialized as a non-null Object" );
}
function test_50_Layer_Image_tileTests (t) {
t.plan(4);
var map = new OpenLayers.Map('map');
layer = new OpenLayers.Layer.Image('Test Layer',
'http://earthtrends.wri.org/images/maps/4_m_citylights_lg.gif',
new OpenLayers.Bounds(-180, -88.759, 180, 88.759),
new OpenLayers.Size(580, 288));
map.addLayer(layer);
map.zoomToMaxExtent();
t.eq(layer.tile.position.x,-40, "Tile x positioned correctly at maxextent");
t.eq(layer.tile.position.y,107, "Tile y positioned correctly at maxextent");
t.eq(layer.tile.imgDiv.src, "http://earthtrends.wri.org/images/maps/4_m_citylights_lg.gif", "URL is correct");
map.zoomIn();
t.eq(layer.tile.imgDiv.src, "http://earthtrends.wri.org/images/maps/4_m_citylights_lg.gif", "URL is correct");
}
/******
*
*
* HERE IS WHERE SOME TESTS SHOULD BE PUT TO CHECK ON THE LONLAT-PX TRANSLATION
* FUNCTIONS AND RESOLUTION AND GETEXTENT GETZOOMLEVEL, ETC
*
*
*/
function test_99_Layer_Image_destroy (t) {
t.plan( 4 );
var map = new OpenLayers.Map('map');
layer = new OpenLayers.Layer.Image('Test Layer',
'http://earthtrends.wri.org/images/maps/4_m_citylights_lg.gif',
new OpenLayers.Bounds(-180, -88.759, 180, 88.759),
new OpenLayers.Size(580, 288));
map.addLayer(layer);
map.zoomToMaxExtent();
layer.destroy();
t.eq( layer.name, null, "layer.name is null after destroy" );
t.eq( layer.div, null, "layer.div is null after destroy" );
t.eq( layer.map, null, "layer.map is null after destroy" );
t.eq( layer.options, null, "layer.options is null after destroy" );
}
// -->
</script>
</head>
<body>
<div id="map" style="width:500px;height:500px"></div>
<div id="map2" style="width:100px;height:100px"></div>
</body>
</html>

164
tests/test_Layer_TMS.html Normal file
View File

@@ -0,0 +1,164 @@
<html>
<head>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript"><!--
var isMozilla = (navigator.userAgent.indexOf("compatible") == -1);
var layer;
var name = 'Test Layer';
var url = "http://labs.metacarta.com/wms-c/Basic.py/";
var options = {'layername':'basic', 'type':'png'};
function test_01_Layer_TMS_constructor (t) {
t.plan( 1 );
layer = new OpenLayers.Layer.TMS(name, url, options);
t.ok( layer instanceof OpenLayers.Layer.TMS, "returns OpenLayers.Layer.TMS object" );
}
function test_03_Layer_TMS_clearTiles (t) {
t.plan( 1 );
var map = new OpenLayers.Map('map');
layer = new OpenLayers.Layer.TMS(name, url, options);
map.addLayer(layer);
map.setCenter(new OpenLayers.LonLat(0,0));
//grab a reference to one of the tiles
var tile = layer.grid[0][0];
layer.clearGrid();
t.ok( layer.grid != null, "layer.grid does not get nullified" );
}
function test_04_Layer_TMS_getTMSBounds(t) {
t.plan( 1 );
layer = new OpenLayers.Layer.TMS(name, url, options);
var bl = { bounds: new OpenLayers.Bounds(1,2,0,0)};
var tr = { bounds: new OpenLayers.Bounds(0,0,3,4)};
layer.grid = [ [6, tr],
[bl, 7]];
var bounds = layer.getGridBounds();
var testBounds = new OpenLayers.Bounds(1,2,3,4);
t.ok( bounds.equals(testBounds), "getTMSBounds() returns correct bounds")
layer.grid = null;
}
function test_05_Layer_TMS_getResolution(t) {
t.plan( 1 );
var map = new OpenLayers.Map('map');
layer = new OpenLayers.Layer.TMS(name, url, options);
map.addLayer(layer);
map.zoom = 5;
t.eq( layer.getResolution(), 0.0439453125, "getResolution() returns correct value");
}
function test_06_Layer_TMS_getZoomForExtent(t) {
t.plan( 2 );
var bounds, zoom;
var map = new OpenLayers.Map('map');
layer = new OpenLayers.Layer.TMS(name, url, options);
map.addLayer(layer);
bounds = new OpenLayers.Bounds(10,10,12,12);
zoom = layer.getZoomForExtent(bounds);
t.eq( zoom, 8, "getZoomForExtent() returns correct value");
bounds = new OpenLayers.Bounds(10,10,100,100);
zoom = layer.getZoomForExtent(bounds);
t.eq( zoom, 2, "getZoomForExtent() returns correct value");
}
/** THIS WOULD BE WHERE THE TESTS WOULD GO FOR
*
* -moveTo
* -insertColumn
* -insertRow
function 07_Layer_TMS_moveTo(t) {
}
function 08_Layer_TMS_insertColumn(t) {
}
function 09_Layer_TMS_insertRow(t) {
}
*
*/
function test_10_Layer_TMS_getURL(t) {
t.plan(1);
var map = new OpenLayers.Map('map', options);
var options = {'layername':'basic', 'type':'png'};
layer = new OpenLayers.Layer.TMS(name, url, options);
map.addLayer(layer);
map.setCenter(new OpenLayers.LonLat(0,0), 9);
var tileurl = layer.getURL(new OpenLayers.Bounds(3.515625,45,4.21875,45.703125));
t.eq(tileurl, "http://labs.metacarta.com/wms-c/Basic.py/1.0.0/basic/9/261/192.png", "Tile URL is correct");
}
function test_11_Layer_TMS_setMap(t) {
t.plan(3);
var map = new OpenLayers.Map('map', options);
layer = new OpenLayers.Layer.TMS(name, url, options);
t.eq(layer.tileOrigin, null, "Tile origin starts out null");
layer.setMap(map);
t.eq(layer.tileOrigin.lat, -90, "lat is -90");
t.eq(layer.tileOrigin.lon, -180, "lon is -180");
}
function test_99_Layer_TMS_destroy (t) {
t.plan( 3 );
var map = new OpenLayers.Map('map');
layer = new OpenLayers.Layer.TMS(name, url, options);
map.addLayer(layer);
layer.destroy();
t.eq( layer.grid, null, "layer.grid is null after destroy" );
t.eq( layer.tileSize, null, "layer.tileSize is null after destroy" );
//test with tile creation
layer = new OpenLayers.Layer.TMS(name, url, options);
map.addLayer(layer);
map.setCenter(new OpenLayers.LonLat(0,0), 5);
//grab a reference to one of the tiles
var tile = layer.grid[0][0];
layer.destroy();
t.ok( layer.grid == null, "tiles appropriately destroyed");
}
// -->
</script>
</head>
<body>
<div id="map" style="width:500px;height:550px"></div>
</body>
</html>

View File

@@ -38,8 +38,18 @@
tile.draw();
var img = tile.imgDiv;
t.eq( img.src, "http://octo.metacarta.com/cgi-bin/mapserv?MAP=/mapdata/vmap_wms.map&LAYERS=basic&FORMAT=image/png&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application/vnd.ogc.se_inimage&SRS=EPSG:4326&BBOX=1,2,3,4&WIDTH=256&HEIGHT=256", "image src is created correctly via addtile" );
var tParams = OpenLayers.Util.extend({},
OpenLayers.Util.upperCaseObject(params));
tParams = OpenLayers.Util.extend(tParams, {
SERVICE: "WMS", VERSION: "1.1.1",
REQUEST: "GetMap", STYLES: "",
EXCEPTIONS: "application/vnd.ogc.se_inimage",
SRS: "EPSG:4326", BBOX: "1,2,3,4",
WIDTH: "256", HEIGHT: "256"
});
t.eq( img.src,
url + "?" + OpenLayers.Util.getParameterString(tParams),
"image src is created correctly via addtile" );
t.eq( tile.imgDiv.style.top, "6px", "image top is set correctly via addtile" );
t.eq( tile.imgDiv.style.left, "5px", "image top is set correctly via addtile" );
@@ -48,7 +58,9 @@
t.ok( true, "skipping element test outside of Mozilla");
else
t.ok( firstChild instanceof HTMLElement, "div first child is an image object" );
t.eq( firstChild.src, "http://octo.metacarta.com/cgi-bin/mapserv?MAP=/mapdata/vmap_wms.map&LAYERS=basic&FORMAT=image/png&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application/vnd.ogc.se_inimage&SRS=EPSG:4326&BBOX=1,2,3,4&WIDTH=256&HEIGHT=256", "div first child is correct image object" );
t.eq( firstChild.src,
url + "?" + OpenLayers.Util.getParameterString(tParams),
"div first child is correct image object" );
t.eq( tile.position.toString(), "x=5,y=6", "Position of tile is set correctly." );
}
@@ -130,7 +142,6 @@
t.plan( 2 );
var map = new OpenLayers.Map('map');
map.projection = "xx";
tUrl = "http://octo.metacarta.com/cgi-bin/mapserv";
@@ -139,11 +150,21 @@
var tLayer = new OpenLayers.Layer.WMS(name, tUrl, tParams);
map.addLayer(tLayer);
str = tLayer.getFullRequestString();
t.eq(str, "http://octo.metacarta.com/cgi-bin/mapserv?LAYERS=basic&FORMAT=image/png&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application/vnd.ogc.se_inimage&SRS=xx", "getFullRequestString() adds SRS value");
var tParams = {
LAYERS: "basic", FORMAT: "image/png", SERVICE: "WMS",
VERSION: "1.1.1", REQUEST: "GetMap", STYLES: "",
EXCEPTIONS: "application/vnd.ogc.se_inimage", SRS: "xx"
};
t.eq(str,
tUrl + "?" + OpenLayers.Util.getParameterString(tParams),
"getFullRequestString() adds SRS value");
tLayer.projection = "none";
str = tLayer.getFullRequestString();
t.eq(str, "http://octo.metacarta.com/cgi-bin/mapserv?LAYERS=basic&FORMAT=image/png&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application/vnd.ogc.se_inimage", "getFullRequestString() by default does *not* add SRS value if projection is 'none'");
delete tParams['SRS'];
t.eq(str,
tUrl + "?" + OpenLayers.Util.getParameterString(tParams),
"getFullRequestString() by default does *not* add SRS value if projection is 'none'");
}
@@ -160,14 +181,14 @@
map.addLayer(tLayer);
map.zoomToMaxExtent();
t.eq(tLayer.opacity, "0.5", "Opacity is set correctly");
t.eq(tLayer.div.firstChild.style.opacity, "0.5", "Opacity on tile is correct");
t.eq(parseFloat(tLayer.div.firstChild.style.opacity), 0.5, "Opacity on tile is correct");
tLayer.setOpacity("0.6");
t.eq(tLayer.opacity, "0.6", "setOpacity works properly");
t.eq(tLayer.div.firstChild.style.opacity, "0.6", "Opacity on tile is changed correctly");
t.eq(parseFloat(tLayer.div.firstChild.style.opacity), 0.6, "Opacity on tile is changed correctly");
var pixel = new OpenLayers.Pixel(5,6);
var tile = tLayer.addTile(new OpenLayers.Bounds(1,2,3,4), pixel);
tile.draw();
t.eq(tile.imgDiv.style.opacity, "0.6", "Tile opacity is set correctly");
t.eq(parseFloat(tile.imgDiv.style.opacity), 0.6, "Tile opacity is set correctly");
}

View File

@@ -45,7 +45,7 @@
}
function test_02_Marker_setOpacity(t) {
function test_03_Marker_setOpacity(t) {
t.plan( 2 );
var map = new OpenLayers.Map("map");
@@ -69,7 +69,7 @@
marker.setOpacity(0.5);
t.eq(marker.icon.imageDiv.style.opacity + "", "0.5", "marker.setOpacity() works");
t.eq(parseFloat(marker.icon.imageDiv.style.opacity), 0.5, "marker.setOpacity() works");
}
// -->

View File

@@ -52,7 +52,7 @@
function test_03_Popup_draw(t) {
t.plan( 11 );
t.plan( 17 );
var id = "chicken";
var x = 50;
@@ -61,6 +61,7 @@
var h = 400;
var content = "charlie";
var color = "red";
var hexColor = "#ff0000";
var opacity = 0.5;
var border = "1px solid";
@@ -78,8 +79,20 @@
t.eq(popup.div.style.top, y + "px", "top position of popup.div set correctly");
t.eq(popup.div.style.width, w + "px", "width position of popup.div set correctly");
t.eq(popup.div.style.height, h + "px", "heightposition of popup.div set correctly");
t.eq(popup.div.innerHTML, '<div class="olPopupContent" style="overflow: hidden; width: 200px; height: 200px; position: relative;" id="chicken_contentDiv">charlie</div>', "good default popup.contentHTML");
t.eq(popup.div.style.backgroundColor, color, "good default popup.backgroundColor");
var contentDiv = popup.div.childNodes[0];
t.eq(contentDiv.className, "olPopupContent", "correct content div className");
t.eq(contentDiv.id, "chicken_contentDiv", "correct content div id");
t.eq(contentDiv.style.width, "500px", "correct content div width");
t.eq(contentDiv.style.height, "400px", "correct content div height");
t.eq(contentDiv.style.position, "relative", "correct content div position");
t.eq(contentDiv.style.overflow, "hidden", "correct content div overflow");
t.eq(contentDiv.innerHTML, content, "correct content div content");
var bColor = popup.div.style.backgroundColor;
var goodColor = ( (bColor == color) || (bColor == hexColor));
t.ok(goodColor, "good default popup.backgroundColor");
if (navigator.appName.indexOf("Microsoft") == -1) {
t.eq(parseFloat(popup.div.style.opacity), opacity, "good default popup.opacity");

View File

@@ -48,7 +48,16 @@
t.ok( true, "skipping element test outside of Mozilla");
else
t.ok( img instanceof HTMLImageElement, "tile.draw creates an image");
t.eq( img.src, "http://labs.metacarta.com/TESTURL?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application/vnd.ogc.se_inimage&FORMAT=image/jpeg&SRS=EPSG:4326&BBOX=1,2,3,4&WIDTH=256&HEIGHT=256", "tile.draw creates an image");
var tParams = {
SERVICE: "WMS", VERSION: "1.1.1",
REQUEST: "GetMap", STYLES: "",
EXCEPTIONS: "application/vnd.ogc.se_inimage", FORMAT: "image/jpeg",
SRS: "EPSG:4326", BBOX: "1,2,3,4",
WIDTH: "256", HEIGHT: "256"
};
t.eq( img.src,
"http://labs.metacarta.com/TESTURL?" + OpenLayers.Util.getParameterString(tParams),
"tile.draw creates an image");
t.eq( tile.imgDiv.style.width, "5px", "Image width is correct" );
t.eq( tile.imgDiv.style.height, "6px", "Image height is correct" );
}
@@ -64,42 +73,78 @@
map.addLayer(layer);
tile = new OpenLayers.Tile.Image(layer, position, new OpenLayers.Bounds(-185,-90,-180,90), url, size);
tile.draw()
t.eq(tile.imgDiv.src, "", "Images against side of maxextent don't load");
t.eq(tile.imgDiv, null, "Images against side of maxextent don't load");
tile = new OpenLayers.Tile.Image(layer, position, new OpenLayers.Bounds(-181,-91,180,90), url, size);
tile.draw()
t.eq(tile.imgDiv.src, "http://labs.metacarta.com/wms/vmap0?LAYERS=basic&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application/vnd.ogc.se_inimage&FORMAT=image/jpeg&SRS=EPSG:4326&BBOX=-181,-91,180,90&WIDTH=256&HEIGHT=256", "Images over edges of maxextent do load");
var tParams = {
LAYERS: "basic", SERVICE: "WMS", VERSION: "1.1.1",
REQUEST: "GetMap", STYLES: "",
EXCEPTIONS: "application/vnd.ogc.se_inimage", FORMAT: "image/jpeg",
SRS: "EPSG:4326", BBOX: "-181,-91,180,90",
WIDTH: "256", HEIGHT: "256"
};
t.eq(tile.imgDiv.src,
"http://labs.metacarta.com/wms/vmap0?" + OpenLayers.Util.getParameterString(tParams),
"Images over edges of maxextent do load");
tile = new OpenLayers.Tile.Image(layer, position, new OpenLayers.Bounds(-181,-90,180,90), url, size);
tile.draw()
t.eq(tile.imgDiv.src, "http://labs.metacarta.com/wms/vmap0?LAYERS=basic&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application/vnd.ogc.se_inimage&FORMAT=image/jpeg&SRS=EPSG:4326&BBOX=-181,-90,180,90&WIDTH=256&HEIGHT=256", "Images over edges of maxextent do load");
tParams = OpenLayers.Util.extend(tParams, {BBOX: "-181,-90,180,90"});
t.eq(tile.imgDiv.src,
"http://labs.metacarta.com/wms/vmap0?" + OpenLayers.Util.getParameterString(tParams),
"Images over edges of maxextent do load");
tile = new OpenLayers.Tile.Image(layer, position, new OpenLayers.Bounds(-180,-90,180,90), url, size);
tile.draw()
t.eq(tile.imgDiv.src, "http://labs.metacarta.com/wms/vmap0?LAYERS=basic&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application/vnd.ogc.se_inimage&FORMAT=image/jpeg&SRS=EPSG:4326&BBOX=-180,-90,180,90&WIDTH=256&HEIGHT=256", "Image covering all of extent loads");
tParams = OpenLayers.Util.extend(tParams, {BBOX: "-180,-90,180,90"});
t.eq(tile.imgDiv.src,
"http://labs.metacarta.com/wms/vmap0?" + OpenLayers.Util.getParameterString(tParams),
"Image covering all of extent loads");
tile = new OpenLayers.Tile.Image(layer, position, new OpenLayers.Bounds(-80,-45,80,45), url, size);
tile.draw()
t.eq(tile.imgDiv.src, "http://labs.metacarta.com/wms/vmap0?LAYERS=basic&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application/vnd.ogc.se_inimage&FORMAT=image/jpeg&SRS=EPSG:4326&BBOX=-80,-45,80,45&WIDTH=256&HEIGHT=256", "Image covering small part of extent loads");
tParams = OpenLayers.Util.extend(tParams, {BBOX: "-80,-45,80,45"});
t.eq(tile.imgDiv.src,
"http://labs.metacarta.com/wms/vmap0?" + OpenLayers.Util.getParameterString(tParams),
"Image covering small part of extent loads");
tile = new OpenLayers.Tile.Image(layer, position, new OpenLayers.Bounds(-185,-95,185,95), url, size);
tile.draw()
t.eq(tile.imgDiv.src, "http://labs.metacarta.com/wms/vmap0?LAYERS=basic&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application/vnd.ogc.se_inimage&FORMAT=image/jpeg&SRS=EPSG:4326&BBOX=-185,-95,185,95&WIDTH=256&HEIGHT=256", "Image covering more than all of extent loads");
tParams = OpenLayers.Util.extend(tParams, {BBOX: "-185,-95,185,95"});
t.eq(tile.imgDiv.src,
"http://labs.metacarta.com/wms/vmap0?" + OpenLayers.Util.getParameterString(tParams),
"Image covering more than all of extent loads");
layer.displayOutsideMaxExtent=1;
tile = new OpenLayers.Tile.Image(layer, position, new OpenLayers.Bounds(-185,-90,-180,90), url, size);
tile.draw()
t.eq(tile.imgDiv.src, "http://labs.metacarta.com/wms/vmap0?LAYERS=basic&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application/vnd.ogc.se_inimage&FORMAT=image/jpeg&SRS=EPSG:4326&BBOX=-185,-90,-180,90&WIDTH=256&HEIGHT=256", "Images against side of maxextent do load with displayOutsideMaxExtent");
tParams = OpenLayers.Util.extend(tParams, {BBOX: "-185,-90,-180,90"});
t.eq(tile.imgDiv.src,
"http://labs.metacarta.com/wms/vmap0?" + OpenLayers.Util.getParameterString(tParams),
"Images against side of maxextent do load with displayOutsideMaxExtent");
tile = new OpenLayers.Tile.Image(layer, position, new OpenLayers.Bounds(-181,-90,180,90), url, size);
tile.draw()
t.eq(tile.imgDiv.src, "http://labs.metacarta.com/wms/vmap0?LAYERS=basic&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application/vnd.ogc.se_inimage&FORMAT=image/jpeg&SRS=EPSG:4326&BBOX=-181,-90,180,90&WIDTH=256&HEIGHT=256", "Images over edges of maxextent do load with displayOutsideMaxExtent set");
tParams = OpenLayers.Util.extend(tParams, {BBOX: "-181,-90,180,90"});
t.eq(tile.imgDiv.src,
"http://labs.metacarta.com/wms/vmap0?" + OpenLayers.Util.getParameterString(tParams),
"Images over edges of maxextent do load with displayOutsideMaxExtent set");
tile = new OpenLayers.Tile.Image(layer, position, new OpenLayers.Bounds(-180,-90,180,90), url, size);
tile.draw()
t.eq(tile.imgDiv.src, "http://labs.metacarta.com/wms/vmap0?LAYERS=basic&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application/vnd.ogc.se_inimage&FORMAT=image/jpeg&SRS=EPSG:4326&BBOX=-180,-90,180,90&WIDTH=256&HEIGHT=256", "Image covering all of extent loads with display outside max extent");
tParams = OpenLayers.Util.extend(tParams, {BBOX: "-180,-90,180,90"});
t.eq(tile.imgDiv.src,
"http://labs.metacarta.com/wms/vmap0?" + OpenLayers.Util.getParameterString(tParams),
"Image covering all of extent loads with display outside max extent");
tile = new OpenLayers.Tile.Image(layer, position, new OpenLayers.Bounds(-80,-45,80,45), url, size);
tile.draw()
t.eq(tile.imgDiv.src, "http://labs.metacarta.com/wms/vmap0?LAYERS=basic&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application/vnd.ogc.se_inimage&FORMAT=image/jpeg&SRS=EPSG:4326&BBOX=-80,-45,80,45&WIDTH=256&HEIGHT=256", "Image covering small part of extent loads with display outside max extent");
tParams = OpenLayers.Util.extend(tParams, {BBOX: "-80,-45,80,45"});
t.eq(tile.imgDiv.src,
"http://labs.metacarta.com/wms/vmap0?" + OpenLayers.Util.getParameterString(tParams),
"Image covering small part of extent loads with display outside max extent");
tile = new OpenLayers.Tile.Image(layer, position, new OpenLayers.Bounds(-185,-95,185,95), url, size);
tile.draw()
t.eq(tile.imgDiv.src, "http://labs.metacarta.com/wms/vmap0?LAYERS=basic&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application/vnd.ogc.se_inimage&FORMAT=image/jpeg&SRS=EPSG:4326&BBOX=-185,-95,185,95&WIDTH=256&HEIGHT=256", "Image covering more than all of extent loads");
tParams = OpenLayers.Util.extend(tParams, {BBOX: "-185,-95,185,95"});
t.eq(tile.imgDiv.src,
"http://labs.metacarta.com/wms/vmap0?" + OpenLayers.Util.getParameterString(tParams),
"Image covering more than all of extent loads");
}
function test_04_Tile_Image_Display_After_Move(t) {
t.plan(3);
t.plan(2);
var position = new OpenLayers.Pixel(20,30);
var bounds = new OpenLayers.Bounds(1,2,3,4);
var url = "http://www.openlayers.org/dev/tests/tileimage";
@@ -112,22 +157,21 @@
tile = new OpenLayers.Tile.Image(layer, position, new OpenLayers.Bounds(-90,-85,-90,85), url, size);
tile.draw();
tile.moveTo(new OpenLayers.Bounds(-185,-90,-180,-80), new OpenLayers.Pixel(-180,-85), true);
t.delay_call( 1, function() { t.eq(tile.imgDiv.style.display, 'none', "Tile display is set to none.") } );
t.delay_call( 1, function() { t.eq(tile.imgDiv, null, "Tile imgDiv is null.") } );
var layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://labs.metacarta.com/wms/vmap0?", {layers: 'basic'}, {'alpha':true});
map.addLayer(layer);
tile = new OpenLayers.Tile.Image(layer, position, new OpenLayers.Bounds(-90,-85,-90,85), url, size);
tile.draw();
tile.moveTo(new OpenLayers.Bounds(-185,-90,-180,-80), new OpenLayers.Pixel(-180,-85), true)
t.ok(tile.imgDiv.firstChild.src != tile.url, "Check to make sure that the alpha image URL really is different");
t.delay_call( 1, function() { t.eq(tile.imgDiv.style.display, 'none', "Alpha tile display is set to none.") } );
t.delay_call( 1, function() { t.eq(tile.imgDiv, null, "Alpha tile imgDiv is null.") } );
}
// -->
</script>
</head>
<body>
<div id="map"></div>
<div id="map" style="height:500px;width:500px"></div>
</body>
</html>

View File

@@ -67,12 +67,15 @@
t.eq( div.style.width, sz.w + "px", "div.style.width set correctly");
t.eq( div.style.height, sz.h + "px", "div.style.height set correctly");
t.eq( div.style.backgroundImage, "url(" + img + ")", "div.style.backgroundImage correctly");
bImg = div.style.backgroundImage;
imgCorrect = ( (bImg == "url(" + img + ")") ||
(bImg == "url(\"" + img + "\")") );
t.ok(imgCorrect, "div.style.backgroundImage correctly");
t.eq( div.style.position, position, "div.style.positionset correctly");
t.ok( (div.style.border.indexOf(border) != -1), "div.style.border set correctly");
t.eq( div.style.overflow, overflow, "div.style.overflow set correctly");
t.eq( div.style.opacity + "", opacity + "", "elemnt.style.opacity set correctly");
t.eq( parseFloat(div.style.opacity), opacity, "element.style.opacity set correctly");
var filterString = 'alpha(opacity=' + (opacity * 100) + ')';
t.eq( div.style.filter, filterString, "element.style.filter set correctly");
@@ -95,7 +98,7 @@
t.eq( div.style.position, "absolute", "div.style.positionset correctly");
t.eq( div.style.border, "", "div.style.border set correctly");
t.eq(div.style.overflow, "", "div.style.overflow set correctly");
t.ok( !div.style.opacity, "elemnt.style.opacity set correctly");
t.ok( !div.style.opacity, "element.style.opacity set correctly");
t.ok( !div.style.filter, "element.style.filter set correctly");
}
@@ -116,7 +119,7 @@
if (!isMozilla)
t.ok( true, "skipping element test outside of Mozilla");
else
t.ok( image instanceof HTMLImageElement, "createImage creates a valid HTMLImageElement" );
t.ok( image.nodeName == "IMG", "createImage creates a valid HTMLImageElement" );
t.eq( image.id, id, "image.id set correctly");
t.eq( image.style.left, xy.x + "px", "image.style.left set correctly");
t.eq( image.style.top, xy.y + "px", "image.style.top set correctly");
@@ -127,7 +130,7 @@
t.ok( (image.style.border.indexOf(border) != -1), "image.style.border set correctly");
t.eq( image.src, img, "image.style.backgroundImage correctly");
t.eq( image.style.position, position, "image.style.position set correctly");
t.eq( image.style.opacity+"", opacity + "", "image.style.opacity set correctly");
t.eq( parseFloat(image.style.opacity), opacity, "image.style.opacity set correctly");
var filterString = 'alpha(opacity=' + (opacity * 100) + ')';
t.eq( image.style.filter, filterString, "element.style.filter set correctly");
@@ -137,7 +140,7 @@
if (!isMozilla)
t.ok( true, "skipping element test outside of Mozilla");
else
t.ok( image instanceof HTMLImageElement, "createDiv creates a valid HTMLDivElement" );
t.ok( image.nodeName == "IMG", "createDiv creates a valid HTMLDivElement" );
t.ok( (image.id != ""), "image.id set to something");
t.eq( image.style.left, "", "image.style.left set correctly");
t.eq( image.style.top, "", "image.style.top set correctly");
@@ -148,7 +151,7 @@
t.ok((image.style.border == ""), "image.style.border set correctly");
t.eq(image.src, "", "image.style.backgroundImage correctly");
t.eq( image.style.position, "relative", "image.style.positionset correctly");
t.ok( !image.style.opacity, "elemnt.style.opacity default unset");
t.ok( !image.style.opacity, "element.style.opacity default unset");
t.ok( !image.style.filter, "element.style.filter default unset");
}
@@ -174,13 +177,23 @@
}
function test_07_Util_getParameterString(t) {
t.plan( 1 );
t.plan( 4 );
var params = { foo: "bar",
chicken: 1.5
}
t.eq( OpenLayers.Util.getParameterString(params), "foo=bar&chicken=1.5", "getParameterString returns correctly");
t.eq( OpenLayers.Util.getParameterString({'a:':'b='}), "a%3A=b%3D", "getParameterString returns correctly with non-ascii keys/values");
// Parameters which are a list should end up being a comma-seperated
// list of the URL encoded strings
var params = { foo: ["bar,baz"] };
t.eq( OpenLayers.Util.getParameterString(params), "foo=bar%2Cbaz", "getParameterString encodes , correctly in arrays");
var params = { foo: ["bar","baz,"] };
t.eq( OpenLayers.Util.getParameterString(params), "foo=bar,baz%2C", "getParameterString returns with list of CSVs when given a list. ");
}
function test_08_Util_createAlphaImageDiv(t) {
@@ -210,7 +223,7 @@
t.eq( imageDiv.style.height, sz.h + "px", "image.style.height set correctly");
t.eq( imageDiv.style.position, position, "image.style.positionset correctly");
t.eq( imageDiv.style.opacity+"", opacity + "", "elemnt.style.opacity set correctly");
t.eq( parseFloat(imageDiv.style.opacity), opacity, "element.style.opacity set correctly");
var filterString;
if (OpenLayers.Util.alphaHack()) {
@@ -222,11 +235,10 @@
image = imageDiv.firstChild;
if (!isMozilla)
t.ok( true, "skipping element test outside of Mozilla");
else
t.ok( image instanceof HTMLImageElement, "createImage creates a valid HTMLImageElement" );
t.ok( image.nodeName == "IMG", "createImage creates a valid HTMLImageElement" );
t.eq( image.id, id + "_innerImage", "image.id set correctly");
t.eq( image.style.width, sz.w + "px", "image.style.width set correctly");
@@ -292,7 +304,7 @@
t.eq( element.style.position, position, "element.style.position set correctly");
t.ok( (element.style.border.indexOf(border) != -1), "element.style.border set correctly");
t.eq( element.style.overflow, overflow, "element.style.overflow set correctly");
t.eq( element.style.opacity+"", opacity + "", "elemnt.style.opacity set correctly");
t.eq( parseFloat(element.style.opacity), opacity, "element.style.opacity set correctly");
var filterString = 'alpha(opacity=' + (opacity * 100) + ')';
t.eq( element.style.filter, filterString, "element.style.filter set correctly");
}
@@ -312,11 +324,10 @@
var opacity = 0.5;
OpenLayers.Util.modifyAlphaImageDiv(imageDiv, id, xy, sz, img, position, border, sizing, opacity);
if (OpenLayers.Util.alphaHack())
t.ok( true, "skipping element test outside of Mozilla");
else
t.ok( imageDiv instanceof HTMLDivElement, "createDiv creates a valid HTMLDivElement" );
t.ok( imageDiv.nodeName == "DIV", "createDiv creates a valid HTMLDivElement" );
t.eq( imageDiv.id, id, "image.id set correctly");
t.eq( imageDiv.style.left, xy.x + "px", "image.style.left set correctly");
@@ -326,7 +337,7 @@
t.eq( imageDiv.style.height, sz.h + "px", "image.style.height set correctly");
t.eq( imageDiv.style.position, position, "image.style.position set correctly");
t.eq( imageDiv.style.opacity+"", opacity + "", "elemnt.style.opacity set correctly");
t.eq( parseFloat(imageDiv.style.opacity), opacity, "element.style.opacity set correctly");
@@ -338,7 +349,7 @@
t.ok( true, "skipping element test outside of Mozilla");
} else {
var filterString = 'alpha(opacity=' + (opacity * 100) + ')';
t.ok( image instanceof HTMLImageElement, "createImage creates a valid HTMLImageElement" );
t.ok( image.nodeName == "IMG", "createImage creates a valid HTMLImageElement" );
}
t.eq( imageDiv.style.filter, filterString, "element.style.filter set correctly");
t.eq( image.id, id + "_innerImage", "image.id set correctly");
@@ -489,6 +500,70 @@
OpenLayers.ImgPath = '';
t.eq(OpenLayers.Util.getImagesLocation().substr(OpenLayers.Util.getImagesLocation().length-4,4), "img/", "ImgPath works as expected when set to ''.");
}
function test_15_Util_isEquivalentUrl(t) {
t.plan(8);
var url1, url2, options;
//CASE
url1 = "http://www.openlayers.org";
url2 = "HTTP://WWW.OPENLAYERS.ORG";
t.ok(OpenLayers.Util.isEquivalentUrl(url1, url2), "default ignoreCase works");
//ARGS
url1 = "http://www.openlayers.org?foo=5;bar=6";
url2 = "http://www.openlayers.org?bar=6;foo=5";
t.ok(OpenLayers.Util.isEquivalentUrl(url1, url2), "shuffled arguments works");
//PORT
url1 = "http://www.openlayers.org:80";
url2 = "http://www.openlayers.org";
t.ok(OpenLayers.Util.isEquivalentUrl(url1, url2), "default ignorePort80 works");
options = {
'ignorePort80': false
}
url1 = "http://www.openlayers.org:80";
url2 = "http://www.openlayers.org:50";
t.ok(!OpenLayers.Util.isEquivalentUrl(url1, url2, options), "port check works");
//HASH
url1 = "http://www.openlayers.org#barf";
url2 = "http://www.openlayers.org";
t.ok(OpenLayers.Util.isEquivalentUrl(url1, url2), "default ignoreHash works");
options = {
'ignoreHash': false
}
t.ok(!OpenLayers.Util.isEquivalentUrl(url1, url2, options), "ignoreHash FALSE works");
//PROTOCOL
url1 = "http://www.openlayers.org";
url2 = "ftp://www.openlayers.org";
t.ok(!OpenLayers.Util.isEquivalentUrl(url1, url2), "default ignoreHash works");
//PATHNAME
url1 = "foo.html?bar=now#go";
url2 = "../tests/../tests/foo.html?bar=now#go";
t.ok(OpenLayers.Util.isEquivalentUrl(url1, url2), "relative vs. absolute paths works");
}
// -->
</script>
</head>

View File

@@ -56,6 +56,7 @@ div.olControlMousePosition {
}
.olControlOverviewMapExtentRectangle {
cursor: move;
border: 2px dotted red;
}
.olLayerGeoRSSDescription {

View File

@@ -127,28 +127,10 @@ class Config:
self.include = lines[lines.index("[include]") + 1:lines.index("[exclude]")]
self.exclude = lines[lines.index("[exclude]") + 1:]
if __name__ == "__main__":
import getopt
options, args = getopt.getopt(sys.argv[1:], "-c:")
try:
outputFilename = args[0]
except IndexError:
usage(sys.argv[0])
raise SystemExit
else:
sourceDirectory = args[1]
if not sourceDirectory:
usage(sys.argv[0])
raise SystemExit
def run (sourceDirectory, outputFilename = None, configFile = None):
cfg = None
if options and options[0][0] == "-c":
filename = options[0][1]
print "Parsing configuration file: %s" % filename
cfg = Config(filename)
if configFile:
cfg = Config(configFile)
print cfg.include
allFiles = []
@@ -158,6 +140,7 @@ if __name__ == "__main__":
for filename in files:
if filename.endswith(SUFFIX_JAVASCRIPT) and not filename.startswith("."):
filepath = os.path.join(root, filename)[len(sourceDirectory)+1:]
filepath = filepath.replace("\\", "/")
if cfg and cfg.include:
if filepath in cfg.include or filepath in cfg.forceFirst:
allFiles.append(filepath)
@@ -227,6 +210,30 @@ if __name__ == "__main__":
print "\nTotal files merged: %d " % len(allFiles)
if outputFilename:
print "\nGenerating: %s" % (outputFilename)
open(outputFilename, "w").write("".join(result))
return "".join(result)
if __name__ == "__main__":
import getopt
options, args = getopt.getopt(sys.argv[1:], "-c:")
try:
outputFilename = args[0]
except IndexError:
usage(sys.argv[0])
raise SystemExit
else:
sourceDirectory = args[1]
if not sourceDirectory:
usage(sys.argv[0])
raise SystemExit
configFile = None
if options and options[0][0] == "-c":
configFile = options[0][1]
print "Parsing configuration file: %s" % filename
run( sourceDirectory, outputFilename, configFile )

View File

@@ -12,4 +12,5 @@ cp -a theme/ /www/openlayers/htdocs/api/$VERSION
rm tools/*.pyc
cd ..
tar -zvcf OpenLayers-$VERSION.tar.gz OpenLayers-$VERSION
cp OpenLayers-$VERSION.tar.gz /www/openlayers/htdocs/download/
zip -9r OpenLayers-$VERSION.zip OpenLayers-$VERSION
cp OpenLayers-$VERSION.{tar.gz,zip} /www/openlayers/htdocs/download/