Compare commits

...

692 Commits

Author SHA1 Message Date
Bart van den Eijnden
1cf69634cf update VERSION_NUMBER to 2.13-rc5 2013-05-30 15:41:00 +02:00
ahocevar
c2b7e8b327 Merge pull request #987 from ahocevar/google-orphaned
Vector layer duplicates when changeing to google base layer. r=@bartvde
2013-05-30 15:37:35 +02:00
ahocevar
fe0620dc7f Merge pull request #174 from ahocevar/feature-events
Turning @tschaub's FeatureAgent into an event extension. r=@bartvde
2013-05-30 15:33:24 +02:00
Bart van den Eijnden
8778b746b3 update VERSION_NUMBER to 2.13-rc4 2013-05-24 12:09:53 +02:00
ahocevar
a5ea8d7fcf Fixing tests
Selecting the same feature again should not do anything, which was ensured
in the old implementation by a check in the SelectFeature control. This
means that the previous commit causes a change in behavior in standalone
mode, which I would consider a bugfix. I documented this change in the
release notes.
2013-05-24 12:07:49 +02:00
ahocevar
b103d3b428 We don't want to re-select an already selected feature 2013-05-24 12:07:35 +02:00
ahocevar
8562582dd2 Avoiding duplicate events 2013-05-24 12:07:22 +02:00
ahocevar
cd5ae45273 Do not manage cache when cached tile is on target layer's backbuffer 2013-05-24 12:06:58 +02:00
Tobias Bieniek
d1b00824fc Format/EncodedPolyline: Change default factor to 1e5
This matches the factors in the other methods and the default of the
original algorithm. Having this set at 1 before can be considered
as a bug.
2013-05-24 12:06:39 +02:00
Tobias Bieniek
4399ebcb04 Format/EncodedPolyline: Added opt_factor parameter to encode/decode() 2013-05-24 12:06:25 +02:00
Tobias Bieniek
0bb804c9e7 tests/EncodedPolyline: Fixed indent 2013-05-24 12:06:12 +02:00
Bart van den Eijnden
572d78fb4d set version number to 2.13-rc3 2013-05-17 13:16:49 +02:00
ahocevar
1d948fc914 Make sure that drawTilesFromQueue gets executed
For events other than move, the tile queue may not be populated yet when
updateTimeout is called. So instead of checking for the queue's length,
we register the timer unconditionally in these cases.
2013-05-17 13:15:01 +02:00
ahocevar
449b85966e .olTileReplacing is on the parent of .olTileImage when using frame 2013-05-17 13:14:36 +02:00
ahocevar
1223ea339d Use getTile() instead of imgDiv to get the correct element
The correct way to get the markup of a tile is to use getTile() - the
imgDiv will only be available if the tile does not use a frame.
2013-05-17 13:14:16 +02:00
Bart van den Eijnden
d0f8fa3ecf set version number to RC2 2013-05-13 13:25:03 +02:00
Éric Lemoine
e9a349e4f1 Make feature handler propagate touch events
This commit is a follow-up on issue #294 (commit a6119f6) and #861 (commit c7a4045). The feature handler should not stop the bubbling up of browser events. In this particular case, when the feature handler is activate, Sencha Touch will trigger longpress events when panning the map because the feature handler stops touchmove.
2013-05-13 13:17:02 +02:00
ahocevar
8b4592e71a We are dealing with strings for comparison
Because OpenLayers.Util.getParameters turns comma delimited values into
arrays, comparing e.g. bbox values in urls will return false. By
introducing a splitArgs option, we can use getParameters in a way that
leaves such values as strings and makes them comparable in
OpenLayers.Util.isEquivalentUrl.
2013-05-13 13:01:21 +02:00
iacovlev-pavel
7c5afe1acf Add OpenLayers/Control.js to "requires"
Fix issue #969
2013-05-13 13:01:21 +02:00
Bart van den Eijnden
c0ccf6a8f0 set VERSION_NUMBER 2013-05-06 17:11:59 +02:00
ahocevar
80482acdad Merge pull request #962 from ahocevar/tilequeue-throttling
Bring back throttling for tile loading. r=@bartvde
2013-05-06 07:31:24 -07:00
Tim Schaub
90535134d4 Spelling
See 44a2b50455 (commitcomment-3123666)
2013-05-01 09:26:55 -06:00
Marc Jansen
989464cd93 Minor formatting changes. 2013-05-01 17:51:27 +03:00
ahocevar
1aabcde0a6 Merge pull request #827 from geops/fixed-strategy
Improved Fixed Strategy
2013-04-30 09:21:27 -07:00
ahocevar
70bfba3011 Fixing typo 2013-04-30 15:45:26 +03:00
friedjoff
54655c7fca Merge branch 'master' into fixed-strategy 2013-04-30 12:44:17 +02:00
ahocevar
779c97f43e Using no buffer by default, because it makes no sense with TileManager
And while we're at it, simplify the example to use the OSM layer and the
new default for transitionEffect.
2013-04-29 14:50:43 +02:00
ahocevar
48efd43250 Bring back throttling for tile loading
In OpenLayers 2.12, only one tile was loaded per animation frame. This
change brings back something similar as part of the tile manager. But we
do not use requestAnimationFrame anymore, because @elemoine pointed out
that browsers may give requestAnimationFrame invoked functions a higher
priority than setTimeout invoked functions.

The reason for this change is
http://lists.osgeo.org/pipermail/openlayers-users/2013-April/028063.html.
2013-04-29 14:20:18 +02:00
ahocevar
142546c6d5 Merge pull request #961 from ahocevar/modifyfeature-layerorder
Regression: ModifyFeature control  not act if layer is not on top. r=@jorix
2013-04-29 04:25:59 -07:00
ahocevar
9d6ce21109 Raise layer that's being modified 2013-04-27 21:46:22 +02:00
Marc Jansen
f3c0348567 Merge pull request #543 from jorix/no-manual-tests2
Can test some manual tests as normal tests.
2013-04-26 00:32:48 -07:00
Bart van den Eijnden
ec4d3a48d7 Merge pull request #224 from jorix/3402-touch_logic_to_superclass
Move some touch logic to the `handler` base class
2013-04-25 07:42:39 -07:00
Xavier Mamano
5ecc54a689 Take into account the comments of bartvde 2013-04-25 16:25:56 +02:00
Frédéric Junod
7beb33f99e Merge pull request #357 from fredj/deprecated
mv AnchoredBubble to deprecated.js, rm LayerSwitcher.roundedCorner. r=bartvde
2013-04-25 01:41:08 -07:00
Frederic Junod
96fc2d71e3 Remove Rico/*.js from debug loader. 2013-04-25 10:26:58 +02:00
Frederic Junod
5ed18a9708 Remove deprecated roundedCorner option from LayerSwitcher control. 2013-04-25 10:26:58 +02:00
Frederic Junod
5a3c06aa7e Move OpenLayers.Popup.AnchoredBubble to deprecated.js 2013-04-25 10:25:03 +02:00
ahocevar
27ccd3cbaa Completing mock for 2D transforms (see #950) 2013-04-24 22:03:37 +02:00
Xavier Mamano
43a8821ce6 Can test some manual tests as normal tests. 2013-04-24 17:21:25 +02:00
ahocevar
6af9f5f3d3 Merge pull request #954 from ahocevar/url-compare
URL comparison fails in IE8. r=@bartvde
2013-04-24 07:36:44 -07:00
ahocevar
2782fa47c8 URL comparison fails in IE8
The W3C standard says that setAttribute/getAttribute on any DOM element is
a simple setter/getter thing. IE8 tries to be smarter and returns the full
URL when calling getAttribute('src') on an image instead of the one that
was set with setAttribute('src').

This change makes sure that urls are compared properly, also in IE8.
2013-04-24 15:41:04 +02:00
ahocevar
11977f57a3 Making pagePosition test work in IE8 2013-04-24 14:31:33 +02:00
ahocevar
9f53506754 Tile bounds changed with #517 to remove white lines between tiles 2013-04-24 14:15:12 +02:00
ahocevar
acc497bf3c Making TouchNavigation tests work in Firefox 2013-04-24 01:01:56 +02:00
Marc Jansen
3ef69b967d Merge pull request #631 from jorix/format_undefined
Avoid breaking the "OpenLayers.String.format" execution
2013-04-23 13:54:15 -07:00
ahocevar
11a187ffaf Merge pull request #849 from luizvital/master
Change language code from 'pt-br' to 'pt-BR'
2013-04-23 12:59:26 -07:00
ahocevar
e0f0744500 Merge pull request #946 from Turbo87/uglify
build: Added "uglify-js" as optional compressor
2013-04-23 12:55:15 -07:00
Bart van den Eijnden
872502311f remove trailing comma from cluster strategy tests (see #950) 2013-04-23 15:36:52 +02:00
Bart van den Eijnden
d63055f28c remove trailing comma from PanZoomBar tests (see #950) 2013-04-23 15:25:06 +02:00
ahocevar
60a966714d Hack for making page position calculations work
Many browsers do very limited rendering/reflow on hidden IFrames. By making
the test IFrame visible, we get everything rendered like a real page. This
is a partial fix for #947.
2013-04-23 14:22:59 +02:00
Bart van den Eijnden
415265db40 protect 2 Google test cases for validkey 2013-04-23 13:28:39 +02:00
Bart van den Eijnden
2613ccb504 fix WMSDescribeLayer format exception test case in IE9 and IE10 (see #948) 2013-04-23 13:17:53 +02:00
Bart van den Eijnden
7cb99834e3 fix opacity tests in IE10 (see #948) 2013-04-23 13:02:29 +02:00
ahocevar
2e88ca6905 Use other edge and outside coordinates
This avoids a failing test due to anti-aliasing artifacts in Safari.
2013-04-23 12:40:15 +02:00
ahocevar
7cb38f69d5 Merge pull request #780 from ahocevar/ms-pointer-events
Touch Navigation doesn't work in Internet Explorer 10. r=@bartvde,@gregersrygg,@mpriour
2013-04-23 01:46:10 -07:00
ahocevar
aa2345693a Addressing @bartvde's review comments 2013-04-23 10:45:08 +02:00
Tobias Bieniek
444d9a06ae build: Added "uglify-js" as optional compressor 2013-04-22 23:11:57 +02:00
ahocevar
1bdfb492d5 Merge pull request #944 from Karamell/labelOutlineOpacity2
added a labelOutlineOpacity attribute to SVG and Canvas Renderers.
2013-04-22 00:53:30 -07:00
Karamell
76efa60888 added a labelOutlineOpacity attribute to SVG and Canvas Renderers. 2013-04-21 11:04:06 +02:00
ahocevar
87d8b6003d Merge pull request #927 from adv-isu/HandlerPathUndoTouchFix2
Improved touch support for Handler.Path.undo
2013-04-20 02:32:31 -07:00
ahocevar
f4725c48ce Merge pull request #937 from Turbo87/layer-switcher
LayerSwitcher: Simplified checkRedraw() method
2013-04-20 02:20:26 -07:00
ahocevar
6fb10d6e0a Re-ordering topics in the release notes 2013-04-20 11:08:43 +02:00
ahocevar
44a2b50455 Release notes for GPU, animated zoom and ModifyFeature control 2013-04-20 11:03:46 +02:00
ahocevar
010035e047 New example showing how to switch projections 2013-04-18 16:54:37 +02:00
Tobias Bieniek
ae8a04c601 LayerSwitcher: Simplified checkRedraw() method 2013-04-17 00:00:36 +02:00
ahocevar
111821e86d Making buttons work
Thanks @gregersrygg for testing. With this change, zoom and other buttons
(e.g. editing toolbar) work in touch mode.
2013-04-16 16:44:02 +02:00
ahocevar
9cdc991b8c Attempt to handle IE >= 10 pointer events
Using the same technique as Leaflet, this relays MSPointer events to touch
events. Using the simulator, I can verify that even pinch-zoom works with
this change, but the visual experience is a bit jumpy. Would be great if
people could test this on physical touch devices and see how it looks/feels
there.
2013-04-16 11:18:17 +02:00
ahocevar
80a6185947 Yet another documentation improvement for #932.
Now it should be clear that the map's changelayer event is triggered
whenever the layer's actual visibility (i.e. visible to the user) changes.
2013-04-10 10:21:28 +02:00
ahocevar
92ac9680d8 Another documentation improvement for #932. 2013-04-10 10:21:28 +02:00
ahocevar
f22937b2ae Documentation improvement (fixes #932) 2013-04-10 10:21:28 +02:00
ahocevar
5deb2c6280 Merge pull request #931 from ahocevar/beforefeaturemodified
Also trigger beforefeaturemodified event in non-standalone mode. r=@bartvde
2013-04-10 01:12:29 -07:00
ahocevar
e5dc583d52 Also trigger beforefeaturemodified event in non-standalone mode
d2a32d5 accidently changed the number of assertions in the
test_selectFeature function, so the change in behavior that no
beforefeaturemodified event is called any more in non-standalone mode got
unnoticed: Before unhacking ModifyFeature, the SelectFeature control
called the beforeSelectFeature method directly. Now, without a built-in
SelectFeature control, we need to call it from the selectFeature method in
both standalone and non-standalone mode.
2013-04-09 23:16:30 +02:00
Tim Schaub
e1dea2d8e1 Merge pull request #532 from adv-isu/WKTrequires
Format/WKT.js: add @requires for geometry types
2013-04-04 10:13:25 -07:00
Andrew Vardeman
62cb6d62f6 Explicitly require the various Geometry types, as in GML.js, so listing OpenLayers/Format/WKT.js in a build config file is sufficient to build in these types. 2013-04-04 11:37:19 -05:00
Andrew Vardeman
7ff0247b00 Account for the fact that touch devices have no mouse and therefore no last mouse position. When "undo" is invoked in a mobile app, sync the meaningless last-mouse-position point to the last point in the digitized linestring so there is visible feedback that something has been undone. Otherwise the last-mouse-position point is left at the point of the last tap on the map, which is unfortunately the location of the vertex that has just been undone, incorrectly implying that the vertex is still there. 2013-04-04 11:03:13 -05:00
ahocevar
d3f32c4dea Merge pull request #925 from ahocevar/google-container
Google Maps rendering bug on fresh reload. r=@kevbradwick (fix #925)
2013-04-04 03:36:58 -07:00
ahocevar
f0ef4728d8 Simplifying layer visibility handling
Instead of adding and removing the Google container, we just toggle
style.display. This also removes the unused rendered and displayed
properties of the cache.
2013-04-04 11:40:21 +02:00
Marc Jansen
aaabdbc803 Merge pull request #461 from tschaub/ie9-leaks
OpenLayers-2.12-rc2 + jQuery-1.7.2 Memory leak in Internet Explorer 9 (p=@tschaub,r=@marcjansen,@elemoine)
2013-04-03 02:43:48 -07:00
Marc Jansen
93e800a9bd Merge pull request #919 from IJMacD/patch-1
Fix imageryProviders Bug (p=@IJMacD,r=@marcjansen)
2013-03-28 10:26:56 -07:00
Pierre GIRAUD
27233df5c7 Merge pull request #908 from pgiraud/GPX
Remove prefix 'gpx:' to node tags. Most of the GPX tools don't support it.
2013-03-28 06:04:51 -07:00
Pierre GIRAUD
f562b2a02c Adding a note for 2.13 about changes made to GPX format 2013-03-28 13:55:37 +01:00
Pierre GIRAUD
9f6b803afa Don't add prefix 'gpx:' to node tags. Most of the GPX tools don't support it. 2013-03-28 13:55:37 +01:00
ahocevar
c62ffb29b8 Merge pull request #922 from ahocevar/backbuffer-zindex
Configurable backbuffer order. r=@bartvde
2013-03-27 13:13:36 -07:00
ahocevar
bc5054399c Typo in API docs; use "map-resize" option in example 2013-03-27 21:11:15 +01:00
ahocevar
434178ef49 Making backbuffer order configurable
In OpenLayers 2.12, the backbuffer for each layer was placed right below
the layer itself. With animated zooming, that was changed so backbuffers
are all placed below the base layer. As it turned out, this is only good
for certain kinds of layers (e.g. street labels), so the default now is
to place the backbuffer right below its layer again. But the
transitionEffect option can now have a new value, 'map-resize', which will
cause the backbuffer to be placed below the base layer.
2013-03-27 17:46:36 +01:00
Frédéric Junod
30a4069e8a Merge pull request #921 from gravitystorm/patch-5
Fix UTFGrid isBaseLayer documentation
2013-03-27 08:23:51 -07:00
ahocevar
fe172ccf6e Backbuffer needs z-index
Since we don't rely on the DOM order for layers, we also cannot rely on it
for backbuffers. This change simply adds a sensible z-index to the
backbuffer container.
2013-03-27 16:19:58 +01:00
Andy Allan
c23b09d72a Fix isBaseLayer documentation
Ensure the documentation matches the code with regards to the default value, and make the explanation slightly clearer as to why it defaults to false.
2013-03-27 14:58:34 +00:00
ahocevar
246d2d99d3 Merge pull request #920 from ahocevar/backbuffer-conditional
Backbuffer and transitionend only when there are tiles. r=@bartvde
2013-03-27 07:14:51 -07:00
ahocevar
316c1888d2 Use the last child of the container only if loading was aborted
Otherwise we may pick a tile that is already half way through the
transition, which will cause the backbuffer to go away too early.
2013-03-26 14:48:23 +01:00
Bart van den Eijnden
e6dafa5d01 add default value for ratio to the api docs 2013-03-26 13:13:35 +01:00
ahocevar
7f18a7b3df Backbuffer and transitionend only when there are tiles
When an application zooms the map programmatically right after
initialization, there will be an empty backbuffer. This should be avoided,
because it adds an unnecessary DOM element.

The tile.onLoadEnd handler registers a transitionend listener on the image
of the last loaded tile. But if loading was aborted, there will be no
image. The new logic registers the transitionend event on the last child
of the layer div, which is not necessarily the tile we're handling loadend
for. When the backbuffer is empty (i.e. no tile was loaded at the time the
backbuffer was created), it will be removed immediately.
2013-03-26 11:53:27 +01:00
ahocevar
63ea10a916 Merge pull request #917 from Turbo87/segment-distance
Geometry: Added distanceSquaredToSegment() function
2013-03-25 12:30:05 -07:00
Tobias Bieniek
6b79391b5e Geometry: Added "along" to the API documentation 2013-03-25 19:10:50 +01:00
Iain MacDonald
847584bbbd Fix imageryProviders Bug
Sometimes imageryProviders is null so accessing providers.length on
line 255 causes a TypeError.
2013-03-25 16:16:55 +00:00
ahocevar
cae4df3ce7 Merge pull request #916 from Turbo87/bounds
Added extendXY() method to Bounds class
2013-03-25 05:17:49 -07:00
Tobias Bieniek
29976ba98a Geometry: Added distanceSquaredToSegment() function 2013-03-23 16:56:32 +01:00
Tobias Bieniek
04d3c6ce53 Geometry: Added along attribute to distanceToSegment() function 2013-03-23 16:49:30 +01:00
Tobias Bieniek
467bf66163 Bounds: Simplified extend() method
.. by using the new extendXY() method if the given object is LonLat or a
Point.
2013-03-23 11:49:17 +01:00
Tobias Bieniek
b3ce8d556a Bounds: Added extendXY() method
This is a simpler variant of the extend() method, but with less overhead.
2013-03-23 11:41:58 +01:00
Tobias Bieniek
afd0388f87 Bounds: Fixed comment location 2013-03-23 11:33:21 +01:00
Tobias Bieniek
d65f604b25 tests/Bounds: Fixed indentation and whitespace 2013-03-23 11:33:17 +01:00
Tobias Bieniek
03735b74ab tests/Bounds: Fixed typos 2013-03-23 11:29:11 +01:00
ahocevar
9a06ec47f6 Merge pull request #914 from Turbo87/encoded-polyline
EncodedPolyline: Backported ol3 polyline parser library
2013-03-22 06:12:52 -07:00
Tobias Bieniek
17e972de3d EncodedPolyline: Backported ol3 polyline parser library
The ol3 version of the library is more advanced and complete. It can also
parse into flat array. It can handle unsigned integers, signed integers
and floats.
2013-03-20 20:56:47 +01:00
ahocevar
410a88c674 Thicker strokes make it easier to select line segments 2013-03-20 10:30:05 +01:00
ahocevar
b0bc72fa7f Merge pull request #913 from ahocevar/modify-feature
Simplifying and unhacking the ModifyFeature control. r=@bartvde
2013-03-20 02:23:42 -07:00
ahocevar
6fca6aef60 Addressing @bartvde's review comments 2013-03-20 10:23:00 +01:00
Pierre GIRAUD
15800c01ad Merge pull request #730 from pgiraud/wmts
don't try to update the matrix in setMap since it's too early and done l...
2013-03-20 00:48:41 -07:00
ahocevar
bed011514f Increasing point radius for easier touch selection 2013-03-20 05:12:35 +01:00
ahocevar
d2a32d5421 Simplifying and unhacking the ModifyFeature control
With two nested controls (DragFeature, SelectFeature), which - among
others - activated two OpenLayers.Handler.Feature instances, the
ModifyFeature control was fragile and hard to debug.

The issue that @iwillig, @bartvde and myself tried to track down was
that the two Feature handlers interfered with each other, making it hard
to select features on mobile devices, and causing points to jump during
dragging because of not updated last pixel positions.

With this refactoring, there are no more nested controls. All that's left
is a Drag handler. All tests pass. I had to remove one test that checked
for dragging of an unselected point while another was selected, because
now (and partially even before this change, thanks to the ugly drag
handler hack that is now removed) dragging a point will also select it,
saving the user an extra click.
2013-03-19 23:00:10 +01:00
ahocevar
7002ec49e7 Merge pull request #903 from ahocevar/903
Google Maps and WMS layer Backbuffer error. r=@mosesonline
2013-03-19 14:38:46 -07:00
ahocevar
3dea8dacb4 Using the correct parent node
When we have a Google base layer, the parent node of the base layer's div
will be a different one.
2013-03-13 08:06:41 +01:00
ahocevar
5b98769234 Merge pull request #896 from mosesonline/refresh-bugfix
Refresh bugfix
2013-03-01 07:02:35 -08:00
mosesonline
05227d32d0 [New] Tests for deactivation of refresh strategy 2013-03-01 12:52:18 +01:00
mosesonline
e1e11ab9c6 [BugFix] visibilitychanged listener is not unregistered on deactivation of Strategy/Refresh. 2013-03-01 12:44:29 +01:00
Tim Schaub
a1bf41a4de Merge pull request #886 from rauldobrota/patch-1
Create ro.js
2013-02-26 10:37:18 -08:00
Tim Schaub
7c10331a92 Merge pull request #890 from tschaub/utfgrid-backbuffer
Override createBackBuffer in UTFGrid layer.
2013-02-21 14:50:27 -08:00
Tim Schaub
7c4df5186f Test clean up 2013-02-21 12:19:34 -07:00
Tim Schaub
461c5c4328 Test that createBackBuffer doesn't fail 2013-02-21 12:17:55 -07:00
Tim Schaub
8e555dee56 Overriding createBackBuffer in UTFGrid layer
This layer doesn't need to create a backbuffer.
2013-02-21 12:12:12 -07:00
Tim Schaub
f1a79135b4 Chasing tiles 2013-02-21 11:31:41 -07:00
Tim Schaub
22db2a9f61 Update MapQuest tile URL templates 2013-02-20 13:33:04 -07:00
rauldobrota
007368fce5 Create ro.js
Language support for romanian users.
2013-02-18 23:39:56 -08:00
ahocevar
2f85ca99bf Remove osm layer when back in Vienna
Thanks @tschaub for this suggestion.
2013-02-17 12:53:59 +01:00
ahocevar
419cb272c7 Adding ZoomBox and OSM fallback layer
Using the new defaults, we don't need to pass options to the Navigation
control anymore. As a side effect, we get ZoomBox, but need to add css for
it to work properly. For users outside Vienna, an OSM fallback layer was
added which gets activated when the viewport does not intersect Vienna.
2013-02-16 10:32:35 +01:00
Tim Schaub
efdba65e0a Merge pull request #883 from tschaub/nicer-defaults
Setting `transitionEffect: "resize"` by default for `OpenLayers.Layer.Grid`.  Setting `enableKinetic: true` for `OpenLayers.Control.DragPan`.
2013-02-15 13:34:48 -08:00
Tim Schaub
fdb954100e Merge pull request #882 from tschaub/zoom-box
Restored zoom box behavior (thanks @ahocevar for the review).
2013-02-14 14:48:27 -08:00
Tim Schaub
a2896beafd As the comments mention, this assumes null transitionEffect 2013-02-14 15:26:05 -07:00
Tim Schaub
0cf9833362 Resize transitions by default 2013-02-14 15:18:07 -07:00
Tim Schaub
891cd35f60 Kinetic dragging by default 2013-02-14 15:17:55 -07:00
Tim Schaub
399c8ff643 Correct calculation of anchor for zooming
Quick explanation:

Let targetCenterPx be described by PX and PY.  Let oldRes and newRes be R0 and R1 respectively.  Let centerPx (center after zoom) be described by CX and CY.  And assume there is some anchored pixel point out there that represents the same map location before and after zoom.  Let this be the origin OX and OY.

We want to recenter the map on the provided box.  This means the map distance between the origin and box center at R0 is the same as the map distance between the origin and the map center at R1.

That is,

    R0 * (OX - PX) = R1 * (OX - CX), and
    R1 * (OY - PY) = R1 * (OY - CY)

Or, solving for OX and OY:

    OX = (R0 * PX - R1 * CX) / (R0 - R1), and
    OY = (R0 * PY - R1 * CY) / (R0 - R1)
2013-02-14 14:38:35 -07:00
Tim Schaub
1ac16835f2 If we are getting flipped top/bottom, let's correct it at the source 2013-02-14 14:27:00 -07:00
Tim Schaub
30c82bad45 For pixel bounds, the bottom is a larger value than the top
This still doesn't address the broken ZoomBox test (see #800), it fails in the same way with or without this change.
2013-02-14 14:25:01 -07:00
Tim Schaub
d32ab41292 Correcting misinformation 2013-02-14 14:25:01 -07:00
ahocevar
ba0ba64c74 Updating PinchZoom tests (see #800)
With the map's applyTransform method, the control does not need and have
its own applyTransform and center management any more.
2013-02-14 22:13:07 +01:00
Tim Schaub
e9eefc7a33 Fewer failing tests
There are still tests failing, but this change addresses some of the new failures after 4b163e0482 (which is an awesome improvement despite the test failures :).
2013-02-14 12:29:03 -07:00
Marc Jansen
4d7eaf4939 Merge pull request #866 from marcjansen/866
LayerSwitcher generate bad ID when layername has spaces in it. (r=@ahocevar)
2013-02-14 07:01:32 -08:00
ahocevar
e9b65691c4 Updating example to match @ahocevar's mobile-wmts-vienna branch 2013-02-14 10:44:41 +01:00
ahocevar
4b163e0482 Merge pull request #800 from ahocevar/transform
Use GPU where available; animated zooming. r=@elemoine
2013-02-14 01:15:18 -08:00
ahocevar
18b0c5fc7d Merge pull request #812 from ahocevar/mousewheel
Better mousewheel/touchpad behavior for zooming. r=@elemoine
2013-02-14 01:13:56 -08:00
ahocevar
d0249643b3 Incorporating @elemoine's review comments 2013-02-14 10:11:48 +01:00
Marc Jansen
465498b83a Use blank.gif as WMS-mockup URL in test. 2013-02-14 09:13:01 +01:00
Marc Jansen
73c5dbd8dc Only valid characters in generated ids. 2013-02-14 07:14:13 +01:00
ahocevar
f46ed44131 Merge pull request #857 from faegi/featureClickPatch
Clear cached mousedown/up positions used for distinguishing between (fix #856).
2013-02-12 01:46:30 -08:00
ahocevar
982302ff03 Merge pull request #877 from finn-no/panzoombar-fix
Fix click on PanZoomBar when page is scrolled (fix #798).
2013-02-11 23:58:41 -08:00
Gregers Gram Rygg
97c793281f Subtract page scroll from button position, since clientX/Y is relative to the viewport not page 2013-02-11 16:32:38 +01:00
Bart van den Eijnden
14bc72bcac Merge pull request #876 from bartvde/tilemgr-changelayer
the tileQueue is not always cleared, for instance when adding a layer in... (r=@ahocevar)
2013-02-08 06:17:12 -08:00
Bart van den Eijnden
09d1b9e8ca the tileQueue is not always cleared, for instance when adding a layer in GeoExplorer and then switching base layers, so make sure we also clear the tileQueue when the visibility of a layer changes 2013-02-08 14:02:20 +01:00
ahocevar
47d60a6ab8 Merge pull request #874 from ahocevar/tilemanager-backbuffer-id
Tile images should not have an id. r=@bartvde
2013-02-07 08:17:35 -08:00
ahocevar
7936f0345f Tile images should not have an id
When the TileManager adds an image to its cache, it might be a backbuffer
image. Backbuffer images have an id with a '_bb' postfix. Regular images
do not have an id at all. In OpenLayers.Layer.Grid, in
addTileMonitoringHooks, a loadend listener is created for each tile. This
listener checks for tie image id, and will remove it from its parent node.
This will cause images to be removed from the layerDiv if the image comes
from the TileManager's tileCache and was on a backbuffer by the time it was
added to the cache.

Simply removing the image's id before assigning it to a tile resolves the
issue.
2013-02-07 16:44:16 +01:00
Marc Jansen
661df3593d Merge pull request #873 from marcjansen/dangling-license-space
Remove dangling space in license header.
2013-02-07 06:44:49 -08:00
Marc Jansen
2a5e113126 Merge pull request #872 from marcjansen/wmsgfi-api
WMSGetFeatureInfo API enhancements
2013-02-07 02:16:39 -08:00
Marc Jansen
d417ba7c25 Adjust license header of WPSProcess.js. 2013-02-07 11:13:08 +01:00
Marc Jansen
716d85594c Adjust license header of WPSClient.js. 2013-02-07 11:13:01 +01:00
Marc Jansen
6c5ffb6930 Adjust license header of Animation.js. 2013-02-07 11:08:30 +01:00
Marc Jansen
0dc531794d Adjust license header of vendorPrefix.js. 2013-02-07 11:05:37 +01:00
Marc Jansen
5bfc4db4fb Give ArcGISCache layer a license header. 2013-02-07 11:05:37 +01:00
Marc Jansen
39a5aed5a6 Remove trailing whitespace. 2013-02-07 10:42:18 +01:00
Marc Jansen
a34e627b75 Remove dangling space in license header. 2013-02-07 10:33:20 +01:00
Marc Jansen
c5dbaf7cab Remove end-of-line whitespace.
The license header is left untouched, to keep it the same in all files.
A seperate commit will probably deal with this
2013-02-07 10:23:16 +01:00
Marc Jansen
d141ed60da Merge pull request #871 from marcjansen/measure-api
Measure API enhancements
2013-02-07 01:20:08 -08:00
Marc Jansen
70ea8f6588 Readd dangling space in header.
This allows for easier search and replace operations. The space will
eventually be removed in all files in a seperate commit.
2013-02-07 10:17:06 +01:00
Marc Jansen
a8d7d246e5 Reformat documentation to match surrounding doc. 2013-02-07 10:12:14 +01:00
Marc Jansen
14a3afb6cf Promote several properties to public API.
The properties

  * layers
  * queryVisible
  * url
  * layerUrls
  * infoFormat
  * vendorParams
  * format
  * formatOptions

should all be visible in the public API since they are essentially very
convenient to use when customizing the control.
2013-02-07 10:06:19 +01:00
Marc Jansen
9f7a0ed448 Remove end-of-line whitespace. 2013-02-07 09:52:26 +01:00
Marc Jansen
cbc705bdf7 Adjust method documentation. 2013-02-07 09:52:26 +01:00
Marc Jansen
23355abb42 Make 'geodesic' & 'displaySystem' API properties.
The geodesic-property is used inside of our examples, yet isn't officially
part of the public API.

The displaySystem-property provides a very useful way of configuring the
output of the measurements and should be promoted as well.
2013-02-07 09:52:12 +01:00
Tim Schaub
84e36dd573 Avoid touching the geolocation object until needed
IE9 leaks when `navigator.geolocation` is accessed (see #461).  The goal of this change is to avoid that leak in builds that include the Geolocate control but do not use it.
2013-02-04 15:46:45 -07:00
ahocevar
47e7c300a8 Merge pull request #863 from ahocevar/uncache
Uncache images that are no longer valid. r=@bartvde
2013-02-01 06:01:40 -08:00
ahocevar
378a0e97b5 Uncache images that are no longer valid
When a layer sets a cached image's className to something else than
.olTileImage (e.g. by setting .olTileReplacing), we should not keep the
image in the cache any more, because it may no longer be valid.
2013-02-01 00:58:40 +01:00
Éric Lemoine
69061d3f3d Merge pull request #861 from elemoine/stopevent
Make click handler propagate touchend
2013-01-30 06:58:39 -08:00
Éric Lemoine
c7a4045e88 Make click handler propagate touchend
This commit is a follow-up on issue #294 and commit a6119f6. Our handlers should not prevent the bubbling up of browser events. This, for example, prevents Sencha Touch's longpress events from working properly.
2013-01-30 15:25:34 +01:00
ejn
364d371f10 Add unit test for cleared cache, and adjust existing unit test which
assumed cached position
2013-01-28 16:16:16 +01:00
ejn
dea7438850 Clear cached mousedown/up positions used for distinguishing between
drag and click in feature handler after a click event.

Fixes #856
2013-01-28 10:14:51 +01:00
Bart van den Eijnden
4dd76e0c74 Merge pull request #852 from mpriour/agsCacheZoom
Don't hex encode zoom level in AGSCache layer (r=@bartvde)
2013-01-26 07:51:32 -08:00
Matt Priour
17930432c7 Don't hex encode zoom level in AGSCache layer 2013-01-22 10:06:28 -06:00
ahocevar
40f9296372 Merge pull request #850 from eykamp/irregular_character
Irregular character
2013-01-22 06:56:25 -08:00
Christopher Eykamp
c179c8493b Simplify pull request 2013-01-22 15:50:19 +01:00
Christopher Eykamp
da62be0137 Fix irregular character that Ruby/Rails objects to 2013-01-22 15:44:19 +01:00
Luiz Fernando Barbosa Vital
549c97063b Adjust language code from 'pt-br' to 'pt-BR'
Portuguese Brazilian translations were not loaded due to this.
2013-01-22 12:22:54 -02:00
Christopher Eykamp
5bb5530fd7 Added tests 2013-01-18 15:58:49 +01:00
Christopher Eykamp
459e38c2d6 Update tests 2013-01-18 15:54:38 +01:00
Christopher Eykamp
36fd417095 Merge remote-tracking branch 'upstream/master' 2013-01-18 15:40:25 +01:00
ahocevar
32d7e02ec0 Merge pull request #843 from ahocevar/early-loadend
Safeguard against listeners that recreate the grid. r=@bartvde
2013-01-17 07:30:22 -08:00
ahocevar
c742c14a52 Safeguard against listeners that recreate the grid
We need to handle the backbuffer before we fire the loadend event.
Otherwise listeners that call e.g. mergeNewParams() will cause the
backbuffer removal code to fail, because tile.imgDiv (and hence
this._transitionElement) will be null.
2013-01-17 16:24:15 +01:00
Christopher Eykamp
3bc16555a0 Merge branch 'master' of https://github.com/openlayers/openlayers 2013-01-16 18:40:27 +01:00
Bart van den Eijnden
0f9010cfb8 Merge pull request #840 from bartvde/clone
when cloning a layer that is loading, make sure numLoadingTiles is reset...
2013-01-16 07:29:06 -08:00
Bart van den Eijnden
d7f013ddbd when cloning a layer that is loading, make sure numLoadingTiles is reset to 0 on the clone 2013-01-16 16:26:51 +01:00
ahocevar
86c425774a Merge pull request #839 from ahocevar/tilemanager-changelayer
Process queue immediately when params change. r=@bartvde
2013-01-16 04:14:50 -08:00
ahocevar
e23c18a09c Process queue immediately when params change
This fixes an issue where the queue would never be processed when a layer
is updated using mergeNewParams.
2013-01-16 12:09:37 +01:00
ahocevar
2a7547c36c Merge pull request #836 from ahocevar/replacing
No .olTileReplacing class for singleTile layers. r=@bartvde
2013-01-16 02:48:26 -08:00
ahocevar
fde7c5cc76 After #829 fallThrough needs to be true for this test 2013-01-15 13:41:26 +01:00
ahocevar
2cd14dfbfd No .olTileReplacing class for singleTile layers
This fixes a regression for singleTile layers with transitionEffect set to
'resize', where the .olTileReplacing class was not removed from the tile.
2013-01-15 13:08:48 +01:00
Tim Schaub
e6c264286a Merge pull request #832 from perrygeo/2.12-perrygeo
guard against null tileInfo
2013-01-11 09:42:24 -08:00
ahocevar
3107751fb7 Clarifications on fallThorugh (see #829) 2013-01-10 22:12:35 +01:00
ahocevar
158185e9a2 Merge pull request #829 from bjornharrtell/fallThough
Default fallThrough to false
2013-01-10 13:08:21 -08:00
Björn Harrtell
58e33601ba Update notes/2.13.md 2013-01-10 22:00:48 +01:00
Björn Harrtell
aa6c5b8a35 Default fallThrough to false
Default behaviour in OpenLayers 2.12 is to swallow events, even though the documentation says otherwise.
2013-01-10 21:30:09 +01:00
Matthew Perry
b54faf222c guard against null tileInfo 2013-01-10 10:45:02 -08:00
ahocevar
774e983631 Turning on GPU for the tiles only turns out to be faster
Especially on iOS 6, this gives way better performance. And it does not
seem to cause any additional flicker.
2013-01-09 14:38:18 +01:00
ahocevar
9b7e35d1dd Merge branch 'master' of github.com:openlayers/openlayers into transform
Conflicts:
	theme/default/style.css
2013-01-09 14:31:52 +01:00
Bart van den Eijnden
443c715f51 Merge pull request #626 from mpriour/zeropad
Consolidate numeric zero padding functions (r=@bartvde)
2013-01-09 00:26:17 -08:00
Matt Priour
3b56053849 Use BaseTypes zeropad function in ArcGISCache tests 2013-01-08 14:00:35 -06:00
friedjoff
b92887e76d Remove unnecessary success check 2013-01-08 17:58:34 +01:00
friedjoff
b442f85bf4 Restore layer alias variable 2013-01-08 17:48:59 +01:00
friedjoff
83be3ff7e8 Restore layer alias variable 2013-01-08 17:41:59 +01:00
friedjoff
c1015d31e4 Restore arguments parameter to make function future-proof 2013-01-08 15:40:00 +01:00
friedjoff
77eefdbd55 Fix copyright date 2013-01-08 14:55:22 +01:00
friedjoff
88e184e7e5 Move detection of map procjection to merge function, check for successful response and fix tests. 2013-01-08 14:49:42 +01:00
ahocevar
6ce72e9185 Adding TileManager to mobile build profile, and note in Map.js
As suggested by @probins; see #702.
2013-01-08 14:26:18 +01:00
Tim Schaub
bbc73a21d8 Update copyright date 2013-01-07 22:01:16 -05:00
ahocevar
8b501eb051 Merge pull request #811 from ahocevar/mergenewparams
When the resolution does not change, remove backbuffer tile by tile. r=@bartvde
2013-01-07 13:45:53 -08:00
ahocevar
f0db21f9c9 Fixing tests 2013-01-07 18:16:23 +01:00
ahocevar
c8564838bc When the resolution does not change, remove backbuffer tile by tile
This change introduces a new 'replace' mode for tile transitions: when the
resolution does not change, which happens when mergeNewParams is called,
the tile will be marked with the .olTileReplace class. If this class sets
the tile's imgDiv display to 'none', the backbuffer for the tile will
immediately be removed when the tile is loaded.
2013-01-07 15:42:34 +01:00
ahocevar
18d548f979 Merge pull request #702 from ahocevar/smart-queue
New tile image cache and tile queue improvements. r=@bartvde,@elemoine
2013-01-07 06:38:07 -08:00
ahocevar
4a3651b7da Release notes and additional in-line comment
As suggested by @bartvde.
2013-01-07 15:30:05 +01:00
ahocevar
80f13188a3 Addressing @bartvde's review comments 2013-01-07 14:26:41 +01:00
Bart van den Eijnden
9adbf431ca clear the grid when we change from singleTile mode true to false or vice versa, discussed change with @ahocevar see #821 for the details 2013-01-07 13:25:15 +01:00
ahocevar
1eeda5d9f7 Merge pull request #823 from probins/maxextent
Overview map should use map.getMaxExtent
2013-01-07 00:56:05 -08:00
ahocevar
94020f0fb1 Merge pull request #822 from probins/mapmax
Map: correct docs for maxExtent
2013-01-07 00:55:22 -08:00
Peter Robins
dcaefea3cc Map: correct docs for maxExtent 2013-01-06 13:45:36 +00:00
Peter Robins
e8421fa923 Overview map should use map.getMaxExtent 2013-01-06 11:41:21 +00:00
Bart van den Eijnden
9dfc5870fb Merge pull request #821 from bartvde/singletile
ability to switch between singleTile true and false on the fly (r=@ahocevar)
2013-01-04 08:15:26 -08:00
Bart van den Eijnden
5b5415d6b7 fix indentation 2013-01-04 17:09:38 +01:00
Bart van den Eijnden
de4b995616 incorporate @ahocevar's review 2013-01-04 17:05:03 +01:00
Bart van den Eijnden
1e1ce54e5b add tests and finish off the functionality for switching between singleTile true and false 2013-01-04 15:10:48 +01:00
Bart van den Eijnden
5114ecbaee ability to switch between singleTile true and false 2013-01-04 14:29:07 +01:00
Bart van den Eijnden
193e2696ad fix undefined variable that breaks Closure (closes #819) 2013-01-04 11:11:40 +01:00
Bart van den Eijnden
bec34f2d3d Merge pull request #814 from eykamp/wcsdev
Add WCS GetCapabilities parsing for WCS 1.0.0 and 1.1.0 (r=@bartvde)
2013-01-02 08:40:34 -08:00
Christopher Eykamp
adba74b735 Remove blank line and trailing comma 2013-01-02 17:29:50 +01:00
Christopher Eykamp
fe799ddfff Add notes 2013-01-02 17:15:40 +01:00
Christopher Eykamp
f9bb64505b Add final LF 2013-01-02 17:12:51 +01:00
Christopher Eykamp
9c7f6e1de7 Add final LF 2013-01-02 17:10:02 +01:00
Christopher Eykamp
54c5656df5 Add final LF 2013-01-02 17:08:57 +01:00
Christopher Eykamp
0a93154f32 Remove trailing commas 2013-01-02 17:05:54 +01:00
Christopher Eykamp
91bf459ab2 Tactical retreat from dot notation 2013-01-02 17:04:16 +01:00
Christopher Eykamp
ed6a32cea7 Fix @requires 2013-01-02 16:52:17 +01:00
Christopher Eykamp
730415aa74 Update @requires 2013-01-02 16:49:53 +01:00
Christopher Eykamp
951da38e80 Add @requires 2013-01-02 16:48:32 +01:00
Christopher Eykamp
d0af8726d3 Remove this file properly 2013-01-02 16:26:55 +01:00
Christopher Eykamp
ff4e6fc8d7 git acting strangely 2013-01-02 16:26:24 +01:00
Christopher Eykamp
d720090310 Reduce vertical whitespace 2013-01-02 16:05:06 +01:00
ahocevar
f71976b487 Merge pull request #818 from Turbo87/encoded-polyline
examples/vector-formats: Added "Encoded Polyline" format
2013-01-02 07:03:12 -08:00
Christopher Eykamp
a215f362cc Remove call to applyDefaults 2013-01-02 15:46:35 +01:00
Christopher Eykamp
76aa10c52c Add trailing LF 2013-01-02 15:42:46 +01:00
Christopher Eykamp
c8e0ba5544 Reduce vertical whitespace 2013-01-02 15:42:03 +01:00
Christopher Eykamp
3f9461e91c Update terminology 2013-01-02 15:39:55 +01:00
Christopher Eykamp
c9dbc33649 Remove all traces of Protocol/WCS 2013-01-02 15:38:27 +01:00
eykamp
9788133b03 Update notes/2.13.md 2013-01-02 15:36:17 +01:00
Christopher Eykamp
673f0d9a99 Remove unused commented code 2013-01-02 15:35:00 +01:00
Christopher Eykamp
8193f309dc Update comment/documentation 2013-01-02 15:28:31 +01:00
Christopher Eykamp
ddc6bd817d Prefer dot notation 2013-01-02 14:36:04 +01:00
Christopher Eykamp
f06931b1b7 Update source of sample XML 2013-01-02 14:32:02 +01:00
Christopher Eykamp
b15c751808 Reuse GML pos reader -- something looks not quite right here, but it does work 2013-01-02 14:21:30 +01:00
Christopher Eykamp
37fd98bb03 Move WCS_Capabilities reader into v_1_0_0 class 2013-01-02 13:41:34 +01:00
Christopher Eykamp
eb4bbff8f4 Reinstate deleted comment block 2013-01-02 13:25:15 +01:00
Christopher Eykamp
abd733865b Reference OWS 1.1.0 readers 2013-01-02 13:21:43 +01:00
Christopher Eykamp
a8ae30079e Forgot this somehow... the missing WCS.js file 2013-01-02 13:01:45 +01:00
Christopher Eykamp
008c7d582e Update test to reflect changes in last commit 2013-01-02 12:51:52 +01:00
Christopher Eykamp
15138605c3 Rename contents to contentMetadata to maintain some sort of continuity between WCS 1.0.0 and 1.1.0 2013-01-02 12:48:55 +01:00
Christopher Eykamp
f7605dcb66 Reformat to 80 cols 2013-01-02 12:44:57 +01:00
Christopher Eykamp
d3345a58b1 Whitespace 2013-01-02 12:42:56 +01:00
Christopher Eykamp
5f2c3803f4 Correct comment about inheritance 2013-01-02 12:42:28 +01:00
Christopher Eykamp
57e833d71f Move comment to shorten line 2013-01-02 12:26:51 +01:00
Christopher Eykamp
0a639404c4 Convert APIProperty to Property 2013-01-02 12:26:13 +01:00
Christopher Eykamp
b076dd8041 Remove comment block referring to constructor -- not needed for abstract class 2013-01-02 12:14:19 +01:00
Christopher Eykamp
e40034521b Comments 2013-01-02 12:12:04 +01:00
Christopher Eykamp
543a5f6881 Remove line break 2013-01-02 12:10:54 +01:00
Christopher Eykamp
700b036c1b Remove unneeded WCS protocol lines 2013-01-02 12:09:45 +01:00
Tobias Bieniek
f92f0ad02e examples/vector-formats: Added "Encoded Polyline" format 2013-01-01 20:01:10 +01:00
Stéphane Brunner
fa14b94570 Merge pull request #817 from sbrunner/wmts-restful
Add RESTful compatibility support, r=@marcjansen
2012-12-31 06:38:20 -08:00
Stéphane Brunner
0915fb72a2 Add RESTful compatibility support 2012-12-31 15:35:38 +01:00
ahocevar
b57540ecfc Merge pull request #813 from Turbo87/encoded-polyline
Format: Added EncodedPolyline class. Merging this as a first step towards
support for alternative geometry encodings. See #813 for TBDs.
2012-12-28 11:55:12 -08:00
Tim Schaub
75423660d8 Merge pull request #815 from Turbo87/wkt
Small Format.WKT code cleanup
2012-12-28 11:38:01 -08:00
Tobias Bieniek
06bd07ff8d EncodedPolyline: Added write() method 2012-12-28 20:24:57 +01:00
Tobias Bieniek
69d759635f WKT: Removed unused variables from write() method 2012-12-28 19:30:50 +01:00
Tobias Bieniek
60a02e343b WKT: Added APIMethod keywords to documentation 2012-12-28 19:30:47 +01:00
Tobias Bieniek
06409da72e EncodedPolyline: Added APIMethod keywords to documentation 2012-12-28 19:14:30 +01:00
Tobias Bieniek
510d42b12f EncodedPolyline: Added encode() method
The write() method will follow in the next commit.
2012-12-28 01:31:24 +01:00
Tobias Bieniek
8651e05e75 EncodedPolyline: Allow setting geometryType to "point 2012-12-27 23:19:44 +01:00
Tobias Bieniek
c118d9884d EncodedPolyline: Extracted universal decode(encoded, dims) method 2012-12-27 23:09:08 +01:00
Tobias Bieniek
2c5d4c75d4 EncodedPolyline: Merged duplicate code in read() method
This patch also prepares the code for making it possible to read encoded
strings with multi-dimensional points.
2012-12-27 23:09:08 +01:00
Tobias Bieniek
aedafc0336 EncodedPolyline: Added geometryType attribute
This makes it possible to read polygons or multipoints too. Since the
encoded format is just a list of points the reader needs to be told what
Feature to create from the encoded list.

The example code is edited to reflect that API extension.
2012-12-27 23:09:08 +01:00
Tobias Bieniek
88a3091a90 examples: Added example for the EncodedPolyline Format class 2012-12-27 19:49:49 +01:00
Christopher Eykamp
49ff1b44ea Whitespace 2012-12-27 15:43:33 +01:00
Christopher Eykamp
16981a8afa Remove unneeded files 2012-12-27 15:38:01 +01:00
Christopher Eykamp
0e9691c628 Remove unused readers 2012-12-27 14:40:28 +01:00
Christopher Eykamp
be7c55f432 Added full suite of wcs 1.1.0 tests, all are passing 2012-12-27 14:28:46 +01:00
Christopher Eykamp
a8f1c76811 Whitespace 2012-12-27 13:48:38 +01:00
Christopher Eykamp
5a19c74604 Whitespace 2012-12-27 13:47:37 +01:00
Christopher Eykamp
809ecb1155 Remove uneeded readers from WCS 1.0.0 2012-12-27 13:47:16 +01:00
Christopher Eykamp
b6c2c26580 WCS parsing working properly, but needs more tests; moved errorProperty down to parser, where it arguably belongs, and where it has to live to work with WCS. Also removed null error property on versionedOGC. 2012-12-27 13:29:02 +01:00
Tobias Bieniek
63a9567858 Format: Added EncodedPolyline class
This class is able to convert an encoded polyline string into a LineString embedded in a Vector Feature.

See https://developers.google.com/maps/documentation/utilities/polylinealgorithm for more information.
2012-12-26 18:25:04 +01:00
Christopher Eykamp
8ff05cdeac WCS 1.1.0 parsing correctlyy; error property still not correctly set so parsing reports errors. 2012-12-24 18:19:42 +01:00
ahocevar
4b2e80fa36 Merge pull request #805 from mosesonline/unselectAllFix
unselectAll on removing layer fix
2012-12-24 06:17:04 -08:00
ahocevar
07e039b566 Merge pull request #803 from ahocevar/tween-framerate
Tween: skip frames when minimum frame rate is not reached. r=@bartvde
2012-12-24 06:11:11 -08:00
Bart van den Eijnden
2dfc23e217 Merge pull request #806 from eykamp/master
Identify and fix bug with WFS 1.1.0 (r=@bartvde,@ahocevar)
2012-12-24 05:35:14 -08:00
ahocevar
1b2003a2b4 Recovering from merge conflicts 2012-12-23 19:18:26 +01:00
ahocevar
21448d2fd5 Adding animated zooming 2012-12-23 18:47:03 +01:00
ahocevar
d2b3bded72 Better way to get GPU support, and avoid flicker
These declarations were suggested on
http://blog.teamtreehouse.com/increase-your-sites-performance-with-hardware-accelerated-css
2012-12-23 18:34:55 +01:00
ahocevar
afe53aba7d Put backbuffer below all layers, except when panning 2012-12-23 18:34:55 +01:00
ahocevar
0b8deb11a2 Revert "No backbuffer removal delay needed with 3d enabled"
This reverts commit 7e8271525ed52288092a135b1c65eed4849c8e49.
2012-12-23 18:34:55 +01:00
ahocevar
aa5bab250a 3d transforms in svg content are bad in other browsers as well 2012-12-23 18:34:54 +01:00
ahocevar
a309b24053 Only use 3d transforms when stylesheet has transform on layerContainerDiv
This allows users to control whether 3d acceleration should be used or not:
Just like with plain web pages, having a stylesheet that sets a transform
on the map's layerContainerDiv will make OpenLayers use translate3d and
scale3d. When no such transform is set in the stylesheet, style.left and
style.top will be used, except for e.g. pinch zoom, where scaling is
needed.
2012-12-23 18:34:54 +01:00
ahocevar
13b4ca6560 Do not set translate3d on svg children
In current Webkit browsers, having translate3d on svg child elements
causes the positioning from the layer not to be inherited by the vector
layer content.
2012-12-23 18:34:54 +01:00
ahocevar
b89d3f1ee8 Going one element up with GPU support, adding it to mobile css also 2012-12-23 18:34:54 +01:00
ahocevar
c03f1dc9bf Own applyTransform method is no longer needed 2012-12-23 18:34:53 +01:00
ahocevar
25c8b0ceaf Adding transforms to turn on GPU 2012-12-23 18:34:53 +01:00
ahocevar
980792e190 GPU needs to be turned on for all elements we move 2012-12-23 18:34:53 +01:00
ahocevar
3d79001a92 Updating and adding tests 2012-12-23 18:34:53 +01:00
ahocevar
3ab9a1f63b No closure, to make testing easier 2012-12-23 18:34:52 +01:00
ahocevar
f51211e93f No magic for loadend delay
This change reintroduces the removeBackBufferDelay, and documents exactly
what it does and when it may be useful.
2012-12-23 18:34:52 +01:00
ahocevar
1764bbdd18 Giving the last tile time to render
The loadend event of an image is fired before the image is rendered. For
standard 256x256 tiles, this does not matter. But for singleTile layers on
large screens, rendering time needs to be considered. So we add a delay
that depends on the tile size. TODO: make the denominator configurable.
2012-12-23 18:34:52 +01:00
ahocevar
a02163f01d No backbuffer removal delay needed with 3d enabled 2012-12-23 18:34:52 +01:00
ahocevar
eb65336fa9 Adding docs, removing console.log 2012-12-23 18:32:27 +01:00
ahocevar
64d291ea20 Turn on GPU support for all children of the layerContainerDiv
This seems to remove all kinds of flicker and jumpiness, and to me it feels
also like it makes panning on slow mobile devices smoother.
2012-12-23 18:32:26 +01:00
ahocevar
44f28f8791 Use translate3d and translate where available. 2012-12-23 18:32:26 +01:00
ahocevar
1081fc4b54 Better mousewheel/touchpad behavior for zooming
The navigation control gets better defaults, and the MouseWheel handler
gets a new maxDelta option, which can be used to avoid huge zoom level
jumps on heavy wheel/pad movements.
2012-12-23 18:01:17 +01:00
ahocevar
efd2de870a Recovering from merge conflicts 2012-12-23 17:24:20 +01:00
ahocevar
64177a52ec Enable fade-in for tiles from cache when we have a backbuffer 2012-12-23 17:00:47 +01:00
ahocevar
a02e08ad2a New beforeload event and slightly changed loading sequence
Having the TileManager remove an image from the DOM, then setting the
cached image, and then having to position it felt a bit awkward. With the
new beforeload event, the setImage method and putting renderTile before
positionTile, providing the cached image feels way more natural.
2012-12-23 17:00:46 +01:00
ahocevar
64df7e3d04 Remove images from dom when replacing them with cached images 2012-12-23 17:00:46 +01:00
ahocevar
faa0e60b99 512 tiles is too much for some mobile browsers 2012-12-23 17:00:46 +01:00
ahocevar
c0913668d3 moveTimerId is no longer used 2012-12-23 17:00:45 +01:00
ahocevar
ecbedf5536 Updating tests 2012-12-23 17:00:45 +01:00
ahocevar
273657a6ab Adding API docs for the tileManager property 2012-12-23 17:00:45 +01:00
ahocevar
781f2ac73d Configure maps with TileManger instances (and not the other way around)
This resolves issues with destroying caches on window unload, and makes
cache sharing among maps less confusing to configure.
2012-12-23 17:00:45 +01:00
ahocevar
9609bb1449 Adding destroy method, as suggested by @bartvde 2012-12-23 17:00:45 +01:00
ahocevar
80fa251649 New TileManager
This removes all tile queueing/loading specific code from Layer.Grid
and creates a new class that manages tile loading and caching.
2012-12-23 17:00:45 +01:00
ahocevar
2ee362a79b New tile image cache and tile queue improvements
We now reuse tile images by maintaining a cache of image elements with a
simplified LRU expiry policy (by order, not by timestamp). The tile queue
is bypassed for images that are available in the cache, so they can be
rendered immediately. And the tile queue itself loads more than just one
image at a time now (2 per layer url).
2012-12-23 16:57:24 +01:00
ahocevar
9759902dac Fixing API; addressing @mpriour's doc comment
Previously, minFrameRate could not be set as option with the start method.
The tests failed to catch this flaw. Now both the start method and the
tests are fixed.
2012-12-21 21:24:04 +01:00
Christopher Eykamp
d0986de775 WCS 1.0.0 parsing now passing all tests 2012-12-21 18:51:39 +01:00
Christopher Eykamp
5c07ae47bb WCS testing more-or-less working, many tests failing, as expected 2012-12-21 13:15:01 +01:00
ahocevar
810d9ea95d Fixing line breaks. 2012-12-21 13:10:26 +01:00
ahocevar
c6aa104462 Merge pull request #810 from ahocevar/transitionend
Use transitionend listeners where available. r=@bartvde
2012-12-21 04:08:29 -08:00
ahocevar
fcd8586883 Using an array for the transitionend event names 2012-12-21 13:07:36 +01:00
ahocevar
43c646b6da Use new Opera event name as well
As pointed out by @bartvde, according to
http://stackoverflow.com/questions/5819912/webkit-transition-end-in-mozilla-and-opera,
Opera uses otransitionend or oTransitionEnd, depending on the version.
2012-12-21 13:01:15 +01:00
ahocevar
dd244e6988 Use transitionend listeners where available
In addition to relying on removeBackBufferDelay, we can remove the
backbuffer earlier without flicker in an ontransitionend listener on the
last loaded tile.
2012-12-21 12:33:28 +01:00
ahocevar
86db8fabc6 Merge pull request #807 from ahocevar/units
WMTS Example misaligning with OSM base layer. r=@sbrunner
2012-12-20 14:35:57 -08:00
ahocevar
fc64b2c5f8 Fixing tests properly, as suggested by @sbrunner 2012-12-20 16:30:58 +01:00
mosesonline
ef028b1e91 Update lib/OpenLayers/Control/SelectFeature.js
indentation fixed and added comment to explain null case
2012-12-20 08:55:21 +01:00
ahocevar
f5d7f794c9 Some tweaks to make tests pass again 2012-12-19 23:13:11 +01:00
ahocevar
893966dfae 'm' and 'Meters' in OpenLayers.INCHES_PER_UNIT are not the same
OpenLayers.INCHES_PER_UNIT.m should equal
OpenLayers.INCHES_PER_UNIT.Meters, just like OpenLayers.INCHES_PER_UNIT.km
should equal OpenLayers.Inches_PER_UNIT.Kilometers. This confusion probably
comes from mixing International inches with US Survey inches when compiling
the unit conversion list (1 meter is 39.37007874 International inches, but
39.37 US Survey inches. It may not be obvious, but 'inches'/'Inch' in
OpenLayers means US Survey inch, and 'IInch' means International inch).

This change also fixes offsets caused by incorrect resolution calculations in
OpenLayers.Format.WMTSCapabilities.
2012-12-19 22:23:45 +01:00
Christopher Eykamp
6c5119455d Basic WCS testing in place. Tests are basically meaningless at this point. 2012-12-19 18:11:14 +01:00
Christopher Eykamp
2a21d61400 Change errorProperty to fix bug; now passes all tests 2012-12-19 11:19:56 +01:00
Christopher Eykamp
2c6b8aefcf Improve added error tests 2012-12-19 10:49:16 +01:00
Christopher Eykamp
a2c161be08 Revert error message change 2012-12-19 10:45:25 +01:00
Christopher Eykamp
428335fd0d Even more sensible error message 2012-12-19 10:32:19 +01:00
Christopher Eykamp
7790a0a9b6 More sensible error message 2012-12-19 10:31:42 +01:00
mosesonline
0263b2b5e1 [Change] renamed test and added print of error 2012-12-18 09:47:33 +01:00
mosesonline
7aed43185b [BugFix] Added tests for handle destroyed layer in SelectFeature. 2012-12-18 09:43:22 +01:00
mosesonline
0cdb3aeb52 [BugFix] Fix selectFeatures is null exception when layer is destroyed. Since you can listen only to preremovelayer to handle removing layer with SelectFeature. But preremovelayer is triggered after selectFeatures is set to null. 2012-12-18 09:34:48 +01:00
Pierre GIRAUD
b404ca0a7a Merge pull request #802 from pgiraud/pinch_preserve_center_
Pinch preserve center
2012-12-18 00:20:18 -08:00
Christopher Eykamp
2478e2311f Update number of tests, add comment 2012-12-17 18:33:19 +01:00
Christopher Eykamp
f4be1d138c Add test that demonstrates bug in WFS 1.1.0 parsing 2012-12-17 18:08:23 +01:00
ahocevar
f0f1ea0867 Skip frames when minimum frame rate is not reached
The new minFrameRate option is used to make sure that an animation does not
run longer than the time calculated from that frame rate. Time is made up
by skipping frames, i.e. skipping execution of the eachStep callback.
2012-12-17 14:54:08 +01:00
Pierre GIRAUD
c9fa5aabad Merge pull request #801 from pgiraud/map_movestart_zoomchanged
Send zoomChanged value when triggering movestart event
2012-12-17 04:56:32 -08:00
Pierre GIRAUD
6c21c2043f Completing the doc strings 2012-12-17 13:55:32 +01:00
Pierre GIRAUD
d0c85850f5 More detailed documentation 2012-12-17 13:43:16 +01:00
Pierre GIRAUD
06597f1897 Missing var 2012-12-17 13:23:10 +01:00
Pierre GIRAUD
69580cd698 Don't change the example 2012-12-17 12:56:09 +01:00
Pierre GIRAUD
00c3ca47c0 Adding test for new preserveCenter option 2012-12-17 11:56:33 +01:00
Pierre GIRAUD
0a131f380a Adding preserveCenter config option 2012-12-17 11:56:18 +01:00
Pierre GIRAUD
ee5796cb78 Send zoomChanged value when triggering movestart event 2012-12-17 11:45:10 +01:00
ahocevar
257b249b9d Updating notes after 84cf468 2012-12-14 09:35:15 +01:00
ahocevar
84cf468a22 Use http protocol for non-http (i.e. file) URIs (see #700) 2012-12-14 09:30:13 +01:00
ahocevar
083fcca882 Fixing tests (see #700) 2012-12-14 09:07:26 +01:00
ahocevar
ab5035ba05 Note about Bing protocol change (see #700) 2012-12-14 01:28:21 +01:00
ahocevar
bb788fdd0b Merge pull request #700 from rjmackay/bing-maps-ssl-699
Make Bing maps use SSL (if current document does)
2012-12-13 16:23:54 -08:00
Robbie Mackay
ec5df48d01 Add unit test for OpenLayers.Layer.Bing.protocol
* Test that attribution logo uses correct protocol
* Test that tile urls use correct protocol
2012-12-14 12:34:26 +13:00
Robbie Mackay
3189a473fb Fetch Bing map tiles and logo over HTTPS if document uses https
The Bing REST api still returns HTTP urls in meta data even if
we hit the API over SSL. This replaces http:// with // to
avoid any SSL browser errors.

Default to replacing with // but can force http: or https: with the
protocol parameter
2012-12-14 12:13:24 +13:00
mosesonline
9ea9b85988 Revert "[New] raise feature function to move features in layer."
This reverts commit cb1c3a834a.

the drawing order is controlled by Renderer not the Layer classes
2012-12-11 07:27:09 +01:00
ahocevar
7061cbf0fa Merge pull request #787 from ahocevar/mousewheel-event
Wheel handler does not work on IE when interval is set. r=@bartvde
2012-12-10 14:02:58 -08:00
Tim Schaub
0d78dda8c4 Additional test for filter parsing
This confirms that literals are properly parsed when they have text node siblings (see #794).
2012-12-10 08:59:03 -07:00
ahocevar
e295e3b70f Merge pull request #788 from ahocevar/no-opacity
Rework of Google layer leads to map div transparency. r=@bartvde
2012-12-10 00:49:54 -08:00
ahocevar
e2dcfb7965 Merge pull request #791 from ahocevar/google-tilesloaded
Do not add viewport to GMaps object before it is fully rendered. r=@bartvde
2012-12-10 00:48:30 -08:00
Tim Schaub
3d777cd263 Merge pull request #790 from justb4/master
Atom.js: typo in Polygon parsing causes empty GeoRSS Polygon geometry (closes #789)
2012-12-08 12:02:18 -08:00
ahocevar
6724098f5b Notes about Google.v3 layers (see #484) 2012-12-08 20:10:52 +01:00
ahocevar
ab53f7c311 Do not add viewport to GMaps object before it is fully rendered
This avoids issues with Elements renderers, where the nodeFactory method
cannot find nodes while the map viewport is transitioning from the mapDiv
to the googleControl.
2012-12-08 14:53:48 +01:00
Just van den Broecke
1225c817b4 Fix typo causing empty Polygon geometry
See OpenLayers issue 789, var 'points' needs to be passed, not 'components' at line 649.
2012-12-08 14:44:45 +01:00
ahocevar
64508c741e Avoid transparent OpenLayers content on top of Google layer 2012-12-08 01:53:44 +01:00
ahocevar
c36b897878 Removing unused code
Because this method is called by OpenLayers.Function.bindAsEventListener,
which conditionally assigns window.event already, e cannot be null or
undefined here.
2012-12-07 21:10:20 +01:00
ahocevar
8701a54603 Cloning event for use in delayed function
In IE, where window.event is used, the event can change during the delay.
To avoid this, we store the event properties in a new object.
2012-12-07 21:09:09 +01:00
mosesonline
5bffb3dea3 Update lib/OpenLayers/Handler/Feature.js
simplify code a little
2012-12-07 12:46:28 +01:00
ahocevar
1b1e90c268 Merge pull request #484 from ahocevar/484
Rework Google layer. r=@bartvde
2012-12-06 02:48:55 -08:00
ahocevar
978cb4be9f Only create Google control once
The control div is now an empty container that we can always append to and
remove from without having to worry about GMaps changing styles on it. It
also makes sure that the control is appended before Google's own
attribution control, so the "Report a map error" link will always be
clickable.
2012-12-06 11:44:49 +01:00
ahocevar
d75e3ecac9 Removing google.css from other examples and tests 2012-12-06 10:35:03 +01:00
ahocevar
00d9664b95 No longer touching internal GMaps DOM elements.
Simple and effective: As soon as a map has a Google layer, the whole map viewport is added as control to the GMap. As soon as no Google layer is visible on the map any more, the map viewport is appended to the map container again. With this change, OpenLayers strictly limits its GMaps integration to the GMaps API.

Also note that there are no css overrides for the attribution any more. Instead, controls can now be conditionally positioned differently for Google layer by using the .olForeignContainer selector.
2012-12-06 10:35:03 +01:00
Frédéric Junod
6075b599f3 Merge pull request #786 from probins/xyztypo
XYZ: fix typo
2012-12-05 05:59:05 -08:00
Peter Robins
8a4bf871f1 XYZ: fix typo 2012-12-05 13:54:43 +00:00
Éric Lemoine
b5364727a2 Merge pull request #785 from finn-no/pinch-zoom-fix-issue778
Fix for Issue #778 as suggested by elemoine
2012-12-04 08:09:12 -08:00
Gregers Gram Rygg
262153eecc Fix for Issue #778 as suggested by elemoine 2012-12-04 16:58:40 +01:00
ahocevar
df6e0a0846 Easier workaround for border image squeezing issue 2012-12-04 14:10:33 +01:00
ahocevar
470cce73ab Merge pull request #775 from ahocevar/wmts-resolutions
Fix regression introduced by #732. r=@sbrunner
2012-11-28 05:50:22 -08:00
ahocevar
1cc07232a7 Fixing regression introduced by #732
Now that serverResolutions are set for all layers, we need to generate
resolutions also for non-baselayers.
2012-11-28 07:12:29 -06:00
Antoine Abt
9ddd3d3ed9 Merge pull request #769 from tonio/noimportant
Avoid !important when not needed. img.olTileImage is precise enough to override boostrap’s rule.
2012-11-26 00:02:26 -08:00
Antoine Abt
862a53ddaf Avoid !important when not needed.
This css selector is sufficient to override bootstrap’s one.
2012-11-26 08:54:02 +01:00
Bart van den Eijnden
eef879c152 Merge pull request #767 from bartvde/projdefaults
make sure we do not fail if OpenLayers.Projection.defaults has not been set (r=@ahocevar) thanks @pvgenuchten for the report
2012-11-23 06:08:32 -08:00
Bart van den Eijnden
663ba16b59 make sure we do not fail if OpenLayers.Projection.defaults has not been set for a custom projection 2012-11-23 13:26:26 +01:00
Bart van den Eijnden
1d3eb0e60c Merge pull request #763 from bartvde/insertresult
WFST 1.0.0 InsertResult not read correctly (r=@pgiraud) thanks Pierre for the quick review and thanks to @fgravin for the detailed bug report
2012-11-23 03:39:48 -08:00
Bart van den Eijnden
195352c403 make sure we can have multiple feature ids in InsertResults 2012-11-21 13:08:37 +01:00
Bart van den Eijnden
ec294af55a Merge pull request #762 from bartvde/schema
parse annotation from WFS DescribeFeatureType schemas (r=@ahocevar)
2012-11-20 08:07:29 -08:00
ahocevar
c48458faa5 Merge pull request #760 from ahocevar/wmscaps-scalehint
Correct handling of 0 and Infinity ScaleHint. r=@marcjansen
2012-11-20 08:01:48 -08:00
ahocevar
5273d63f3a Documenting ScaleHint parsing, as suggested by @marcjansen 2012-11-20 17:01:08 +01:00
Bart van den Eijnden
52d69ecfda documentation is also an array, and lang is optional thanks @ahocevar for the catch 2012-11-20 16:48:50 +01:00
Bart van den Eijnden
cbd9a90477 appinfo can be specified multiple times, so use an array instead thanks @ahocevar 2012-11-20 16:42:06 +01:00
Bart van den Eijnden
f410cd7e41 remove JSON parsing from format, applications should handle this, as suggested by @ahocevar 2012-11-20 16:36:12 +01:00
Bart van den Eijnden
14f009e2f7 parse annotation from WFS DescribeFeatureType schemas 2012-11-20 15:48:48 +01:00
Marc Jansen
5febfbc8ff Merge pull request #761 from marcjansen/owsc-inlinegeometry
Fix exporting empty vector layers to OWSContext (p=me,@chrismayer;r=@bartvde).
2012-11-20 04:42:30 -08:00
Marc Jansen
13584d7319 Reuse variable, thanks @bartvde. 2012-11-20 13:39:27 +01:00
Marc Jansen
798d2b2cb7 Fix exporting empty vector layers to OWSContext.
When a vector layer is exported to an OWSContext document, we throw an
exception when the layer contains no features, and the geometries are to be
exported inside of an InlineGeometry-element.

This commit fixes this behaviour by exporting sth. like this in such cases:

<Layer name="vector" hidden="0">i
  <ows:Title xmlns:ows="http://www.opengis.net/ows"/>
  <InlineGeometry/>
</Layer>
2012-11-20 10:38:25 +01:00
ahocevar
cbc4f4e422 Correct handling of 0 and Infinity ScaleHint
minScale and maxScale values of 0 and Infinity do not make sense in
OpenLayers, but they are used in WMS GetCapabilities 1.1.1 to indicate
that there is no minScale or maxScale restriction. Assuming that the
capability values for minScale and maxScale are passed as config options
to a WMS layer, it is better to not set minScale and maxScale when 0 or
Infinity are found in the ScaleHint.
2012-11-16 17:31:45 +01:00
Tim Schaub
12046503ca Merge pull request #435 from tschaub/kind-transform
Stay on the world when transforming coords.
2012-11-14 11:26:11 -08:00
Bart van den Eijnden
1f229ba275 Merge pull request #757 from bartvde/ajax
make sure config.headers does not overwrite DEFAULT_CONFIG.headers in OpenLayers.Request.issue (r=@ahocevar)
2012-11-13 07:15:12 -08:00
Bart van den Eijnden
3265b0e73f Make sure config.headers does not overwrite DEFAULT_CONFIG.headers in OpenLayers.Request.issue 2012-11-13 16:12:14 +01:00
Tim Schaub
57e22ef491 Merge pull request #755 from tschaub/bootstrap-css
Making OpenLayers play well with Bootstrap
2012-11-09 16:51:55 -08:00
Tim Schaub
fa740a42a9 Making OpenLayers play well with Bootstrap
Bootstrap CSS sets the max-width for images to 100%.  This makes it so
OpenLayers maps don't render (the layer container has 0 width, so all images
are given the same).  Even if our layer container had a more sensible width
(e.g. 100% of the viewport), we would still have issues with tiles that are
larger than the viewport.

Since the OpenLayers stylesheet may be loaded before or after bootstrap.css,
we should use !important when setting the max-width to none for images we
control.
2012-11-09 15:05:18 -07:00
ahocevar
7530751d98 Merge pull request #747 from ahocevar/wpsexecute-mixin
Filter.v1 methods need to be available when using Filter writers. r=@bartvde
2012-11-07 09:51:07 -08:00
ahocevar
a2fe036e2c Filter.v1 methods need to be available when using Filter writers
Format classes that define member methods need to be mixed into other
format classes that use their writers. In this case, methods from
Filter.v1 were missing so a test for Format.WPSExecute failed.
2012-11-07 18:14:56 +01:00
ahocevar
d431b504bd Missing change that should have gone in with #705 2012-11-07 16:54:26 +01:00
ahocevar
4f5bcdbe76 Fixing mock 2012-11-07 16:25:34 +01:00
Bart van den Eijnden
575301ad32 Merge pull request #746 from bartvde/loadend
when using BBOX or Fixed strategies, pass on the filter used in the request to the loadstart event (r=@ahocevar,@elemoine)
2012-11-07 02:57:26 -08:00
Bart van den Eijnden
8cc0cdc6a1 incorporate suggestions by @ahocevar and @elemoine 2012-11-07 11:56:04 +01:00
Bart van den Eijnden
a4df9a871b when using BBOX or Fixed strategies, pass on the filter used in the request to the loadstart event. This is mostly important in the case of BBOX, since there is no other way to get the filter used in the request. An example use case is doing a hitCount request using the same filter to find out the true number of features matched on the server-side 2012-11-07 11:43:18 +01:00
Bart van den Eijnden
c420fc6aad fix up Strategy.BBOX tests 2012-11-06 15:14:22 +01:00
Éric Lemoine
7ecbce28aa Merge pull request #742 from finn-no/scroll-touch-fix
Fixed problems with touch events on a scrollable page
2012-11-06 06:04:07 -08:00
Gregers Gram Rygg
7b1bc2a675 Removed Event from doc, since it's not being used 2012-11-05 23:15:53 +01:00
Gregers Gram Rygg
6e18d0e254 Added comment about olMochWin 2012-11-05 23:08:42 +01:00
Gregers Gram Rygg
4842c9e572 Renamed _mochWin to olMochWin 2012-11-05 23:04:32 +01:00
Gregers Gram Rygg
0fbe28a348 Removed debugger statement 2012-11-05 22:31:15 +01:00
ahocevar
a54ecca32b Merge pull request #705 from ahocevar/animation
Remove complexity from the image loading sequence. r=@elemoine,@tschaub
2012-11-05 10:33:59 -08:00
ahocevar
5a3bcc716b Not using requestAnimationFrame
Using the Timeline tab of the Chrome Developer Tools, no significant
difference of Paint events can be observed when requestAnimationFrame is
used. So I agree with @elemoine that there is no need to introduce
asynchronous behavior here.
2012-11-05 17:28:10 +01:00
Bart van den Eijnden
b45f903198 Merge pull request #744 from bartvde/cqlnull
add support for OpenLayers.Filter.Comparison.IS_NULL in CQL format (thanks @elemoine for the review)
2012-11-05 06:42:38 -08:00
Bart van den Eijnden
703e0a2ca1 make it clear with docs that maxFeatures can be specified on Protocol.WFS (non-functional change) 2012-11-05 15:31:08 +01:00
Bart van den Eijnden
31b4c39b5b Merge branch 'master' of github.com:openlayers/openlayers 2012-11-05 15:27:55 +01:00
Bart van den Eijnden
41ac2dea08 add support for OpenLayers.Filter.Comparison.IS_NULL in OpenLayers.Format.CQL 2012-11-05 13:21:51 +01:00
ahocevar
65fa1aaa2d Make sure we do not make abandoned tiles visible 2012-11-05 10:43:05 +01:00
ahocevar
796a349c61 Synchronous image loading for opacity and backbuffer tests 2012-11-05 10:40:50 +01:00
ahocevar
ebeb49b5e7 blankImageUrl is no longer needed for image tiles 2012-11-05 10:40:05 +01:00
Éric Lemoine
8bb58e453b Merge pull request #576 from probins/cors
CORS support in Request: remove console warning if not same origin
2012-11-05 01:36:56 -08:00
Peter Robins
99906c8b98 CORS support in Request: remove console warning if not same origin 2012-11-05 09:32:20 +00:00
Bart van den Eijnden
fcb45d9c41 Merge branch 'cql-quoted' of git://github.com/tschaub/openlayers 2012-11-05 09:44:34 +01:00
Éric Lemoine
41ba4d0d51 Merge pull request #740 from probins/gftex
Update Fusion Tables example for latest API version
2012-11-04 13:00:26 -08:00
tschaub
47ef7e87f7 Handle whitespace and escaped quotes in CQL values
See #743.
2012-11-02 11:44:41 -06:00
Gregers Gram Rygg
9ac758ae86 Removed mobile-scroll example, as it's not an example but a page to reproduce the bugs 2012-11-02 15:38:33 +01:00
Gregers Gram Rygg
a2a391d3b5 Fixed problems with touch events on a scrollable page 2012-11-02 14:22:46 +01:00
Peter Robins
8d36a1d7f7 Update Fusion Tables example for latest API version 2012-10-31 10:24:32 +00:00
Tim Schaub
8d0da09454 Merge pull request #733 from tschaub/filter-tweaks
Allow writer functions to use document fragments when they need to append more than a single child to the parent.
2012-10-26 09:45:53 -07:00
Tim Schaub
8d8a9f3105 Merge pull request #729 from tschaub/date
WFS date filter literal not sent as ISO format
2012-10-26 09:01:54 -07:00
tschaub
4cf7f99de0 Work with formats that copy filter writers 2012-10-25 12:31:20 -06:00
tschaub
9e21911ca3 Unnecessary call to appendChild
The writeNode function already calls appendChild on the parent.
2012-10-25 12:11:25 -06:00
tschaub
e6399a265d Use document fragments to write multiple nodes
For writer functions that need to generate multiple nodes, the
createDocumentFragment method can be used.
2012-10-25 11:56:48 -06:00
tschaub
81d3584e09 Test custom encodeLiteral function 2012-10-25 11:24:55 -06:00
tschaub
993add338d Allow user to customize literal encoding
As suggested by @mpriour, it would be nice if the user could determine how
date values are encoded in literal elements.  Extending this beyond date
values, we can provide an `encodeLiteral` method that can be overridden to
provide application specific behavior.
2012-10-25 10:52:54 -06:00
ahocevar
7f2ce74dd7 Merge pull request #732 from ahocevar/wmts-serverresolutions
WMTS layers created from capabilities have no serverResolutions. r=@sbrunner
2012-10-25 08:06:05 -07:00
ahocevar
ca532c5db6 WMTS layers created from capabilities have no serverResolutions
By adding serverResolutions to the WMTS configuration, it is possible to
use WMTS layers as overlays, even if the map or the base layer is
configured with different resolutions than the WMTS.
2012-10-25 14:40:26 +02:00
Tim Schaub
ed66271be3 Use ISO 8601 formatting for dates in filters 2012-10-24 11:16:29 -06:00
Tim Schaub
1c39820eb1 Merge pull request #728 from tschaub/kml-track
Properly parse track attributes
2012-10-24 09:11:04 -07:00
Pierre GIRAUD
6efcab3d2d don't try to update the matrix in setMap since it's too early and done later in moveTo 2012-10-24 13:31:06 +02:00
tschaub
edb4798518 Testing multiple track attributes 2012-10-23 14:24:48 -06:00
tschaub
596ac680da Use correct track attribute
Previously, the last track attribute name would be used as the
feature attribute name.  For tracks with multiple attributes, this
doesn't work.
2012-10-23 14:15:22 -06:00
Tim Schaub
8a8b3076c8 Adding an example that reprojects GeoJSON. 2012-10-19 14:16:13 -04:00
ahocevar
4b7a0b43b1 Merge pull request #709 from jorix/ghostClusters
Bug: Ghost clusters
2012-10-17 10:33:30 -07:00
Xavier Mamano
ee34448844 Add test remove features and zoom on Strategy/Cluster.html 2012-10-17 19:06:53 +02:00
Stéphane Brunner
788d49a3bb Merge pull request #666 from sbrunner/Prevent.KeyboardDefaults-ie
Prevent KeyboardDefaults.js from triggering keyboard events when user is...
2012-10-17 03:01:58 -07:00
Xavier Mamano
3c416a4d60 Clear the cache on Strategy.Cluster when features are removed.
This prevents reappearing the removed features after zooming.
2012-10-16 18:43:53 +02:00
Bart van den Eijnden
0b46f19ba6 Merge pull request #722 from tomhughes/bbox-fail
Clear the bounds in Protocol.BBOX when a load fails (r=bartvde)
2012-10-16 06:18:02 -07:00
Tom Hughes
628978f894 Clear the bounds in Protocol.BBOX when a load fails
If a load fails then we won't have any features, but we also won't
try and load them again for any part of that area because the bounds
tell us we have already loaded them. So clear the bounds in order
that reloads will be triggered.
2012-10-16 14:16:37 +01:00
Bart van den Eijnden
d098897c79 Merge pull request #717 from walkermatt/master
Support for PropertyIsNull Filter
2012-10-16 00:24:23 -07:00
Matt Walker
a65a231da3 Updated IS_NULL filter to check for strict null.
The IS_NULL filter evaluates to true only when the
property is null. Updated tests to reflect this
change.
2012-10-16 08:11:59 +01:00
Matt Walker
ea5a510d45 Moved node var declaration to the top of the function 2012-10-15 11:16:00 +01:00
Matt Walker
a9494394da Comparing the filter XML written using t.xml_eq.
The PropertyIsNull test now used the t.xml_eq method
to verify the XML output when the filter is written.

Tided up variable names to be consistent with other
tests.
2012-10-15 11:09:52 +01:00
Matt Walker
41dac08cfa Resolved redefinition of filter variable in test 2012-10-15 09:51:56 +01:00
Matt Walker
bccd0824b9 Removed duplicate line that gets the filter value 2012-10-15 09:47:10 +01:00
ahocevar
c3b13b5df3 Using radix parameter to make linter happy 2012-10-15 08:27:01 +02:00
Matt Walker
8f860e516e Removed stray console.log in PropertyIsNull test 2012-10-13 20:05:43 +01:00
Matt Walker
0707bb49bd Merge remote-tracking branch 'upstream/master' 2012-10-13 19:59:41 +01:00
Matt Walker
f08c562955 Added IS_NULL evaluate feature tests 2012-10-13 09:47:23 +01:00
ahocevar
e38ab01752 Fixing image-layer example 2012-10-13 09:26:45 +02:00
Matt Walker
6a37e72ae3 Added some comments to Format/Filter tests. 2012-10-12 22:49:30 +01:00
Matt Walker
d5013d6df5 Added support for PropertyIsNull filter.
Added a simple comparison and read/write for PropertyIsNull
encoded as XML including tests for each.
2012-10-12 22:40:56 +01:00
ahocevar
583dc15700 Merge pull request #587 from ahocevar/587
Layer.WMS: BBOX precision errors in URLs. r=@bartvde
2012-10-12 08:53:23 -07:00
ahocevar
a0acf1e550 Calculating rowSign only once 2012-10-12 16:16:44 +02:00
ahocevar
0eb8949ad2 Updating and fixing API docs 2012-10-12 16:11:10 +02:00
ahocevar
f757580ed4 Merge pull request #634 from ahocevar/634
CacheWrite caches an empty image if the tile is unloaded before the image is loaded. r=@bartvde
2012-10-12 06:41:24 -07:00
ahocevar
e5feda7ad7 Camel casing method name 2012-10-12 15:03:38 +02:00
ahocevar
157dd9e1c2 Fixing typo 2012-10-12 14:44:48 +02:00
ahocevar
6607bcc0bb Do not cache data from aborted tile loads
This also results in a simplified cache method that can more easily be
overridden for use with other storage providers.
2012-10-12 14:06:08 +02:00
ahocevar
cf3ea0c7db Register application listener after the control's 2012-10-12 13:41:54 +02:00
ahocevar
ff4a1b2468 Optimizing positions for rendering
Calculating pixel positions from origin and grid index causes alignment
issues in the grid. By going back to incremental positioning, we get a
result without blank spaces between tiles again.
2012-10-12 03:23:56 +02:00
ahocevar
66455600c7 Better precision for right and top corners 2012-10-12 03:10:42 +02:00
ahocevar
f78d127b1c Removing console.log line 2012-10-11 23:59:17 +02:00
ahocevar
7df5e3ca8e Fixing KaMap layer
This also fixes an issue that has gone unnoticed for a while: the grid did
not cover the bottom of the map viewport, but instead covered an invisible
area above the top of the map viewport.
2012-10-11 23:54:04 +02:00
ahocevar
e7292ecbe2 Fixing ArcGISCache layer
This is done by caching the tileOrigin at grid creation time.
2012-10-11 22:26:59 +02:00
ahocevar
c5bb52d93f No deltas for tile bounds/position calculation
Now we also do not use deltas for shiftRow and shiftColumn. Some
refactoring was done so we do not need different calculateGridLayout
methods for layers with top-left and bottom-left tile origin.

TODO: With this commit, ArcGisCache and KaMap layers are broken.
2012-10-11 21:22:52 +02:00
ahocevar
d4f011d00c Absolute calculation of tile bounds
This avoids cumulated tile bounds errors for layer types that do not use a
tile row/column index in requests (e.g. WMS).
2012-10-10 12:22:57 +02:00
Stéphane Brunner
f1e7425821 use OpenLayers.Event.element 2012-10-10 11:28:18 +02:00
Stéphane Brunner
2e44aff5f0 Prevent KeyboardDefaults.js from triggering keyboard events when user is typing into the form elements for IE 2012-10-10 11:28:18 +02:00
ahocevar
0b3f582e10 Merge pull request #708 from mpriour/displayEvent
Fire the 'changelayer:visibility' event from layer's display method
2012-10-09 14:23:28 -07:00
Matt Priour
e8cc0deeb5 Remove extra event firing logic from Layer::setVisibility 2012-10-09 12:21:25 -05:00
Matt Priour
f17a3c70e4 Fire the 'changelayer:visibility' event from layer's display method
Move the changelayer event firing logic for in / out of resolution range
from the Map class to the Layer class. Tests have been also been created
to specifically test that the display method works correctly and fires
events only when needed.
2012-10-09 11:10:55 -05:00
Bart van den Eijnden
74103ec3e0 Merge pull request #706 from bartvde/wmsc
allow versioned profiled parsers to fallback to the non-profiled parser (r=@ahocevar)
2012-10-08 23:41:57 -07:00
Bart van den Eijnden
ec8fa47a39 remove duplicate line in comment 2012-10-08 16:34:12 +02:00
Bart van den Eijnden
fd6e7ebe03 allow versioned profiled parsers to fallback to the non-profiled parser, this will help deal with situations in which a WMSC parser is created, the server is requested for WMS 1.1.1, but returns 1.1.0 2012-10-08 16:28:19 +02:00
ahocevar
7e5e221c8d Image loading performance improvements
Performance improvements are achieved by using requestAnimationFrame when
a tile's visibility changes, and by not starting with a blank image when
creating a new tile image. It seems that even Firefox does not show a
loading placeholder when the tile is made visible in an animation.
2012-10-05 09:24:53 +02:00
Tim Schaub
e3a5091ebd Merge pull request #699 from tschaub/schemeless
Bing Layers should fetch metadata over HTTPS when the document is server over HTTPS.  Rewriting image URLs to use HTTPS will be handled separately (see #700).
2012-10-04 07:50:54 -07:00
Tim Schaub
c0bff1c3ff Use protocol-relative URL for Bing metadata.
The [URI standard](http://tools.ietf.org/html/rfc3986#section-4.2) allows for URI without a scheme.  Where http is used to load the app, using a schemeless URL for the Bing metadata loads a script using http - and the same goes for https.
2012-10-03 21:44:48 -06:00
ahocevar
8317744d31 Merge pull request #697 from ahocevar/describelayer
Applying VersionedOGC pattern to WMSDescribeLayer format. r=@bartvde
2012-10-03 05:44:54 -07:00
ahocevar
47379ff7a2 Do not provide an 1.1 parser 2012-10-02 16:28:59 +02:00
ahocevar
88a7b7d3e2 Testing backwards compatibility 2012-10-02 16:11:27 +02:00
ahocevar
3d1b0f0bd9 Less intrusive version fallback 2012-10-02 16:07:35 +02:00
ahocevar
e326a9ea2f Adding TODO, as suggested by @bartvde 2012-10-02 14:40:37 +02:00
ahocevar
84a8d8d1f6 Applying VersionedOGC pattern to WMSDescribeLayer format
The WMSDescribeLayer format currently differs from other formats that
inhreit from VersionedOGC by having an array instead of an object as return
type. This especially bad since the VersionedOGC superclass sets a version
property on the array. With this change, the WMSDescribeLayer format will
also be compatible with GeoServer's new JSON response type for
DescribeLayer - see
http://sourceforge.net/mailarchive/message.php?msg_id=29912776.

Another change included here is the removal of the WMSDescribeLayer
format's getVersion hack, which was replaced by a generic fallback to less
generic parsers, e.g. from a v1_1_1 parser to a v1_1 parser if v1_1_1 is
not implemented.
2012-10-02 14:35:05 +02:00
ahocevar
95839728a1 Declaring undeclared variable 2012-10-02 13:30:47 +02:00
ahocevar
9113bc4004 Merge pull request #695 from ahocevar/wmts
Support for multiple resource urls for WMTS. r=@sbrunner
2012-10-02 01:58:00 -07:00
ahocevar
ea86afec16 Addressing @sbrunner's review comment 2012-10-02 10:56:41 +02:00
ahocevar
f055f13a3a Fixing typo
Thanks @sbrunner for catching this. That's what I got from making
last-minute changes before committing without testing again.
2012-10-02 10:56:06 +02:00
ahocevar
363306bcd1 Multiple URLs also for unconstrained GetTile resources 2012-10-02 08:58:47 +02:00
ahocevar
22c5e76b0b Support for multiple resource urls
With this change, createLayer generates url arrays for both KVP and REST
encoding if multiple resource urls are provided. To make this work, the
WMTSCapabilities format got a new resourceUrls property, because
previously only the first resourceUrl for a format was stored.
2012-10-01 15:28:30 +02:00
Pierre GIRAUD
b63ce9af18 Merge pull request #690 from pgiraud/client_zoom
call stopObserving before setting img.src to blank image as well
2012-10-01 00:36:15 -07:00
ahocevar
51ae75a54f Merge pull request #660 from m-click/fix-setAttributeNS
Fix DOM API call to setAttributeNS()
2012-09-28 03:56:58 -07:00
Pierre GIRAUD
8d8abac32a call stopObserving before setting img.src to blank image as well 2012-09-21 11:32:48 +02:00
Stéphane Brunner
9a93e58080 Merge pull request #683 from sbrunner/wmtscapabilities-right-url
Gets the right url (#608 / 3)
2012-09-19 04:20:06 -07:00
Slawomir Messner
cb1c3a834a [New] raise feature function to move features in layer. 2012-09-18 08:14:54 +02:00
Stéphane Brunner
e8987c0683 Gets the right url (#608 / 3) 2012-09-14 15:39:12 +02:00
ahocevar
503fff32b6 Merge pull request #455 from ahocevar/455
Support Subdomains in Openlayers WMTS. r=@sbrunner
2012-09-13 07:07:11 -07:00
Stéphane Brunner
4b91b9c304 Merge pull request #615 from sbrunner/wmts-first-matrix-set
gets the first matrix set instance of only the unique one
2012-09-13 06:06:04 -07:00
Tim Schaub
877d81cffa Merge pull request #676 from tschaub/osm-copyright
Updating attribution for OSM layer.
2012-09-12 20:39:23 -07:00
Tim Schaub
9607ee480a Using the entity reference for copyright symbol. 2012-09-12 21:38:30 -06:00
tschaub
499055e247 Updating attribution for OSM layer.
See http://www.openstreetmap.org/copyright for details.
2012-09-12 09:15:46 -06:00
Marc Jansen
2a48759bc9 Merge pull request #675 from marcjansen/no-tabs
Replace tabs with spaces where appropriate.
2012-09-11 12:55:43 -07:00
Marc Jansen
1348f97546 Replace tabs with spaces where appropriate. 2012-09-11 21:51:18 +02:00
Stéphane Brunner
f7ca64b1aa Merge pull request #671 from sbrunner/add-missing-requires
Add missing requires on Request for UTFGrid Tile
2012-09-11 10:58:24 -07:00
Stéphane Brunner
341c08adee Add missing requires on Request for UTFGrid 2012-09-11 11:38:24 +02:00
ahocevar
c88ad36600 Comment about side effect.
I wonder why isFixed is advertised as APIProperty for Vector layers.
2012-09-07 12:18:12 +02:00
Marc Jansen
6b2836b455 Merge pull request #665 from marcjansen/selected-evt
SLDSelect: Make it possible to change the filter in handlers
2012-09-06 05:23:39 -07:00
Marc Jansen
1063a4cd19 Make it possible to change the filter in handlers
Trigger the 'select'-event earlier, this way any handlers for the event can
change both the filter and the resulting SLD inside the callback.
2012-09-06 13:29:59 +02:00
Marc Jansen
97b75578ba Update lib/OpenLayers/Control/SLDSelect.js
Correct API docs. Non-functional change.
2012-09-06 10:40:13 +03:00
ahocevar
2197f1656a Updating row/col sizes in tests (see #639) 2012-08-31 11:11:34 +02:00
Volker Grabsch
e8051ca1ec Fix DOM API call to setAttributeNS() 2012-08-30 16:54:49 +02:00
Marc Jansen
60cc590bf2 Another API-docs spelling error. 2012-08-30 00:46:57 +03:00
Marc Jansen
a4bc3f33e6 Fix API-docs spelling error.
This fixes #654. Thanks to @dandv for catching this.
2012-08-30 00:40:43 +03:00
ahocevar
ec26dd6564 Merge pull request #644 from fastrde/ModifyFeatureDocumentDrag
Adds documentDrag to ModifyFeature
2012-08-27 02:53:39 -07:00
fastr
e8716847f8 Adding DocumentDrag to ModifyFeature 2012-08-25 23:37:39 +02:00
fastr
053dba59a1 Inserted documentDrag in ModifyFeature so that you can drag vertices over the viewport of the map in analogy to the DragFeature-Control. documentDrag is internaly passed to the DragFreature that's used by ModifyFeature. 2012-08-25 23:30:27 +02:00
Marc Jansen
1d670fcddb Merge pull request #642 from marcjansen/api-docs
Better documentation. Non-functional change.
2012-08-22 15:11:53 -07:00
Marc Jansen
287e9caf46 Code docs for the Bounds-class. 2012-08-22 23:59:11 +02:00
Marc Jansen
04e271570b Document the VERSION_NUMBER "constant". 2012-08-22 23:52:12 +02:00
ahocevar
ddd4c4c022 Merge pull request #517 from ahocevar/no-percent
No more percentage based positioning. r=@bartvde,@elemoine,@rdewit
2012-08-21 05:02:11 -07:00
ahocevar
75f2e1f847 Addressing @bartdve's review comments. 2012-08-21 14:00:48 +02:00
ahocevar
a3ec0f77e0 Using integer pixel space to avoid whitespace between tiles. 2012-08-21 13:57:11 +02:00
ahocevar
475cd7cd60 Fixing test (backBufferLonLat should not be OpenLayers.Bounds).
Thanks @rdewit for the IE7 test report - this fixes one of the reported issues.
2012-08-21 13:57:11 +02:00
ahocevar
b2210d00a9 Removing no longer needed code.
Thanks @elemoine for catching the IE6 reflow in Tile/Image.js.
2012-08-21 13:57:11 +02:00
ahocevar
f0ad48597f No more percentage based positioning.
Client zoom now supports both over- and undersampling.
2012-08-21 13:57:11 +02:00
ahocevar
405cebd482 Merge pull request #639 from ahocevar/grid-align
When using a buffer, the grid lacks rows/columns at the top/left. r=@bartvde
2012-08-21 04:47:10 -07:00
ahocevar
26d4fe3ce8 Making row and column size consistent, as suggested by @bartvde. 2012-08-21 13:37:48 +02:00
ahocevar
0f58868830 When using a buffer, the grid lacks rows/columns at the top/left.
This is because the threshold used for deciding when a column or row is shifted is too far to the bottom right. A tiny fix, but effective. A new test makes sure that we don't shift columns more than necessary when the layer is dragged.
2012-08-20 18:52:17 +02:00
ahocevar
87e7cfe29c Merge pull request #632 from ahocevar/wps-client
WPS Client. r=@bartvde,@tschaub
2012-08-18 10:01:01 -07:00
ahocevar
e04d7cd627 Addressing final review comments. 2012-08-18 18:56:36 +02:00
Marc Jansen
470dde0e38 Documentation enhancements. No functional change. 2012-08-17 23:41:19 +02:00
Marc Jansen
b7063b364c Enhancements to the MouseCoordinates example.
Non-functional change.
2012-08-17 23:40:18 +02:00
Marc Jansen
df19317c95 Merge branch 'master' of https://github.com/openlayers/openlayers
Conflicts:
	tests/list-tests.html
2012-08-17 22:46:06 +02:00
Bart van den Eijnden
f6adcd2651 Merge pull request #637 from bartvde/resizecleanup
cleanup and always use window resize as suggested by @tonio (r=@tonio)
2012-08-17 03:50:47 -07:00
Bart van den Eijnden
7b4cb8e3f5 cleanup and always use window resize as suggested by @tonio 2012-08-17 11:36:03 +02:00
Bart van den Eijnden
5e4aea58f1 Merge pull request #636 from bartvde/autoresize
introduce new property on the Map called autoUpdateSize (r=@ahocevar)
2012-08-17 01:22:23 -07:00
Bart van den Eijnden
3b9ce4ca2d introduce new property on the Map called autoUpdateSize which lets applications take control of window resizing / device orientation changes if they want to 2012-08-17 10:13:04 +02:00
Bart van den Eijnden
2843a18602 Revert "fix issue with orientation changes on mobile devices (tested on Motorola Xoom 2 with Android 3.2.2 in the stock browser)"
This reverts commit 39a6d7d8ef.
2012-08-16 16:35:21 +02:00
Bart van den Eijnden
e4e06a877f Merge pull request #635 from bartvde/resize
fix issue with orientation changes on mobile devices (r=@ahocevar and thanks to @ahocevar for coming up with this idea in the first place)
2012-08-16 05:28:07 -07:00
Bart van den Eijnden
39a6d7d8ef fix issue with orientation changes on mobile devices (tested on Motorola Xoom 2 with Android 3.2.2 in the stock browser) 2012-08-16 14:21:36 +02:00
tschaub
5cf260f38a Add missing requires (closes #633). 2012-08-14 11:01:58 -06:00
ahocevar
88572303fb Addressing @tschaub's review comment. 2012-08-14 13:31:41 +02:00
ahocevar
5fff368a2d Addressing review suggestions and fixing asynchronous function calls.
This commit addresses @bartvde's review comments, adds more documentation, and fixes asynchronous function calls. Previously, when creating multiple processes with the same identifier, the describe callback would only have been called for the first process. This was fixed to move DescribeProcess handling from WPSProcess to WPSClient.
2012-08-14 13:17:07 +02:00
ahocevar
006d98151f Use the correct name of the result, not just hard-coded 'result'. 2012-08-13 13:29:34 +02:00
ahocevar
94f3ab393f Giving the test code more time to execute. 2012-08-12 22:08:43 +02:00
ahocevar
4e3f3e2080 Adding dependencies. 2012-08-12 21:39:15 +02:00
ahocevar
96db01006c Making Firefox happy. 2012-08-11 19:32:17 +02:00
ahocevar
e2acbc56d0 More docs and unit tests. 2012-08-11 19:32:17 +02:00
ahocevar
ebc71b492e Making sure that the process description is not loaded. 2012-08-11 19:32:17 +02:00
ahocevar
ec9ab8129e Adding support for chaining processes. 2012-08-11 19:32:17 +02:00
ahocevar
c64621f510 Adding unit tests. 2012-08-11 19:32:17 +02:00
ahocevar
b61120d3b5 Cache of DescribeProcess responses on the client. 2012-08-11 19:32:17 +02:00
ahocevar
9bc7bb8115 Using proxy and demo server. 2012-08-11 19:32:17 +02:00
ahocevar
0108250ed9 WPSClient and WPSProcess for convenient WPS interaction. 2012-08-11 19:32:17 +02:00
Xavier Mamano
79ca3cfd69 Avoid breaking the "OpenLayers.String.format" execution when searching for an attribute in an undefined object. 2012-08-11 17:28:59 +02:00
Matt Priour
a83ab56f97 Modify classes which contained an internal numeric zero padding function to use the one in BaseTypes instead 2012-08-08 22:36:39 -05:00
Matt Priour
dc93478e6b Move zeroPad function to BaseTypes and add tests for it 2012-08-08 22:34:26 -05:00
tschaub
970448effc Tests for response property on loadend event.
This confirms that the loadend event includes a response property when it results from a call to the strategy merge method (see #624).
2012-08-08 11:41:51 -06:00
tschaub
7e326f97e2 Doc fix for merge method. 2012-08-08 11:41:33 -06:00
tschaub
4ae9f6878d Making events easier to test.
This should make it more straightforward to test the new event properties being sent with loadend on BBOX and Fixed strategies (see #624).
2012-08-08 11:23:02 -06:00
ahocevar
49227967bc Merge pull request #624 from milkypostman/master
return response object on "loadend" event for Fixed strategy. Also closes #85.
2012-08-08 07:51:56 -07:00
Donald Curtis
2696494443 return response object on "loadend" event for Fixed and BBOX strategies 2012-08-08 09:46:58 -05:00
Bart van den Eijnden
bab1858bfc slightly modify the wfs-states example to show how to switch between a WMS and a vector layer at a certain scale (non-functional change) 2012-08-08 09:20:14 +02:00
Stéphane Brunner
65cacaa756 Merge pull request #614 from sbrunner/wmts-fix
correct units in WMTS capabilities
2012-08-03 02:35:26 -07:00
ahocevar
159ee7c7b4 Merge pull request #612 from ahocevar/612
Touch events do not trigger the default action in attribution links. r=@marcjansen
2012-08-01 04:16:38 -07:00
ahocevar
aef5517bfa Adding unit tests. 2012-08-01 13:15:59 +02:00
ahocevar
98569203a6 Check whether an event target should be considered for handling. 2012-08-01 10:20:25 +02:00
Stéphane Brunner
093bb529d2 gets the first matrix set instance of only the unique one 2012-07-30 23:26:45 +02:00
Stéphane Brunner
9d31c57e2a correct units in WMTS capabilities 2012-07-30 23:17:11 +02:00
Pierre GIRAUD
940c0e8ca2 Adding missing attribution for OSM 2012-07-20 16:18:28 +02:00
Stéphane Brunner
584749b524 Merge pull request #601 from temporaryaccount/temporaryopenlayers
Prevent KeyboardDefaults.js from triggering keyboard events when user is...
2012-07-20 04:37:25 -07:00
ahocevar
7249510553 Using the safe unicode representation of the minus sign.
No functional change; see #588.
2012-07-20 09:41:42 +02:00
ahocevar
c786952219 Fixing tests. 2012-07-20 09:19:20 +02:00
temporaryaccount
950904f59a Prevent KeyboardDefaults.js from triggering keyboard events when user is typing into the form elements 2012-07-19 18:08:30 +04:00
Pierre GIRAUD
99553d0ae5 Fixing doc. No functional change. 2012-07-17 16:15:03 +03:00
Stéphane Brunner
f9cf3a0c95 Merge pull request #588 from sbrunner/minus
use minus sign
2012-07-13 02:58:09 -07:00
Stéphane Brunner
a45cbfdb07 use minus sign 2012-07-12 18:32:30 +02:00
ahocevar
af70240191 Merge pull request #580 from jorix/_onImgLoad
Fix typo "_onImageLoad" is "_onImgLoad"
2012-07-08 23:37:18 -07:00
Xavier Mamano
9be8bb2416 Fix typo "_onImageLoad" is "_onImgLoad" 2012-07-08 23:50:52 +02:00
Éric Lemoine
14d5525ced Merge pull request #528 from probins/build
Add AMD and version options to build.py
2012-07-03 08:02:27 -07:00
Éric Lemoine
679111fa88 release.sh script - do not remove the build/closure-compiler folder 2012-07-03 08:57:05 +02:00
Éric Lemoine
90d3c2d9a9 WMTS capabilities format - make JSLint happier 2012-07-03 08:45:19 +02:00
Éric Lemoine
f7860a329c WMTS capabilities format - make the mid var local to the createLayer function 2012-07-03 08:45:19 +02:00
Frédéric Junod
f5aae88a31 Merge pull request #294 from fredj/stopped-map-events
can't listen to mousedown/touchstart on map div
2012-07-02 13:44:06 -07:00
Éric Lemoine
0144a9473e Set VERSION_NUMBER to Release 2.13 dev 2012-07-02 16:33:40 +02:00
Éric Lemoine
37ebc3b991 Merge pull request #567 from rdewit/master
Fix for typo in OL 2.12 release notes
2012-07-01 23:46:29 -07:00
rdewit
b837d9bdf4 Fixed typo in CSS code for overriding default tile animation. 2012-07-02 15:00:50 +10:00
ahocevar
f3b0c2ec9d Merge pull request #558 from dregade/zoomify
fix size initialization and resolution/zoom usage. Thanks @dregade - this change makes fractional zoom work with Layer.Zoomify.
2012-06-29 05:27:08 -07:00
dregade
74f9a943cc fix serverResolutions if not provided 2012-06-29 09:22:54 +02:00
dregade
7b91c9c26f fix size initialization and resolution/zoom usage 2012-06-28 17:16:22 +02:00
ahocevar
f686589d1e Merge pull request #551 from finn-no/projection-test-fix
Fixed broken test
2012-06-27 23:59:56 -07:00
ahocevar
0d8b76d2b2 Merge pull request #546 from finn-no/vendor-prefixes
Vendor prefix detection. Thanks @gregersrygg for this excellent contribution.
2012-06-27 23:29:15 -07:00
Éric Lemoine
0834593f9f Merge branch '2.12' 2012-06-27 22:59:12 +02:00
Éric Lemoine
0412410be0 set VERSION_NUMBER to Release 2.12 2012-06-27 22:56:31 +02:00
Éric Lemoine
301ed5c3ce 2.12 notes - explain how to disable hw accelerated animations (refs #542) 2012-06-27 21:55:37 +02:00
Gregers Gram Rygg
5e0050cc9a Fixed broken test 2012-06-27 18:32:48 +02:00
Gregers Gram Rygg
2bd8b5c4ba Merge branch 'master' of https://github.com/openlayers/openlayers into vendor-prefixes 2012-06-27 16:52:06 +02:00
Gregers Gram Rygg
d71e7a7beb Mock div.style through document.createElement hack instead of exposing method in vendorPrefix.js 2012-06-27 16:49:59 +02:00
Gregers Gram Rygg
1ba6aa75d7 Removed Prefix from method names, since now it's part of the module name 2012-06-27 13:33:47 +02:00
Gregers Gram Rygg
7f32342ec3 Moved OpenLayers.Vendor to OpenLayers.Util.vendorPrefix 2012-06-27 13:28:43 +02:00
Gregers Gram Rygg
36451db928 Expose caches instead of _clearCache method 2012-06-27 12:39:47 +02:00
Gregers Gram Rygg
d1ed8bb952 Removed duplicate declarations of i and l 2012-06-27 11:57:04 +02:00
Gregers Gram Rygg
f40d677164 Removed declaration of OpenLayers if it's not defined (already requires SingleFile.js) 2012-06-27 11:07:41 +02:00
Stéphane Brunner
d42f5ee993 Merge pull request #271 from sbrunner/wmts-capabilities
Create Layer from WMTS capabilities in rest mode
2012-06-27 01:34:02 -07:00
Stéphane Brunner
484eda2ee5 add alternate projection parsing 2012-06-26 16:20:36 +02:00
Stéphane Brunner
419ead9191 fix projection syntax 2012-06-26 16:09:38 +02:00
Frédéric Junod
34750774d7 Merge pull request #547 from fredj/wmts-vienna
mobile-wmts-vienna example: requestEncoding already set in defaults
2012-06-25 09:20:10 -07:00
ahocevar
293d173079 Simple example with an OSM map, a marker and a popup. 2012-06-25 17:19:53 +02:00
Stéphane Brunner
81dffce4f4 remove unworking example in wmts-capabilities 2012-06-25 14:58:14 +02:00
Frederic Junod
8058a800ed mobile-wmts-vienna example: requestEncoding already set in defaults 2012-06-25 14:56:40 +02:00
Frederic Junod
0e78d40da2 Update WMS base layer in strategy-cluster-threshold.html 2012-06-25 14:19:26 +02:00
Gregers Gram Rygg
93211a31bc Merge branch 'master' of https://github.com/openlayers/openlayers into vendor-prefixes 2012-06-25 14:17:19 +02:00
Gregers Gram Rygg
ab6b2ef008 Use vendor detection for requestAnimationFrame 2012-06-25 13:45:33 +02:00
Gregers Gram Rygg
58a83b0d17 Refactored vendor methods to it's own module 2012-06-25 13:44:35 +02:00
Gregers Gram Rygg
b394b93723 Removed unrelated changes 2012-06-25 09:38:23 +02:00
Gregers Gram Rygg
fb3acbdbc2 Renamed char (reserved word in ES3) 2012-06-24 23:48:24 +02:00
Éric Lemoine
533e5f4242 Merge pull request #538 from probins/proj
Change Projection so Proj4js no longer has to be global
2012-06-24 02:16:52 -07:00
Gregers Gram Rygg
da3495beac Merge branch 'master' of https://github.com/openlayers/openlayers into vendor-prefixes 2012-06-24 02:38:05 +02:00
Gregers Gram Rygg
6d5f5c37df Style vendor prefixes should start with first char uppercase, js properties should be lower 2012-06-23 22:46:43 +02:00
Gregers Gram Rygg
b9670a292b Added support to detect vendor-prefixes for non-style objects 2012-06-23 21:48:44 +02:00
ahocevar
78d07c8d8a Merge pull request #524 from ahocevar/panzoombar
Zoom level restriction improvements. r=@bartvde
2012-06-22 16:59:13 -07:00
Marc Jansen
b86394b79b Merge branch 'control-inheritance' of https://github.com/marcjansen/openlayers 2012-06-20 18:08:01 +02:00
Stéphane Brunner
e976f4f627 Merge pull request #539 from jarofgreen/master
Credits on an example map are wrong.
2012-06-20 06:23:40 -07:00
James
dfb1c1e234 According to
http://developer.mapquest.com/web/products/open/map#openlayers (Terms of Use Section)
this is how MapQuest Open Aerial Tiles should be credited.
2012-06-20 12:50:59 +01:00
James
a74fa3d52c According to http://wiki.openstreetmap.org/wiki/Mapquest#MapQuest-hosted_map_tiles the attributtion
for Open Street Map derived Map Quest tiles was wrong. Fixed.
2012-06-20 12:10:36 +01:00
Peter Robins
b6296a40b6 Change Projection so Proj4js no longer has to be global 2012-06-20 08:43:36 +01:00
Bart van den Eijnden
69c8a8e161 Merge pull request #378 from bartvde/wfsdft
error handling in WFSDescribeFeatureType format (r=@ahocevar,elemoine)
2012-06-19 08:31:57 -07:00
Peter Robins
4e956dc80d Add AMD and version options to build.py 2012-06-18 17:31:35 +01:00
ahocevar
fe31af5c80 Adding unit tests. 2012-06-13 23:14:34 +02:00
ahocevar
032df4b90a Adding a getMinZoom API method.
This can be used by zoom slider controls, e.g. the GeoExt.ZoomSlider. Note that adjustZoom now also respects the map's fractionalZoom setting.
2012-06-13 21:37:59 +02:00
ahocevar
7141d237d9 Create a new reliable updatesize event.
The resize event is not fired in all browsers. What we actually need is an event that is called every time the updateSize method is called.
2012-06-13 21:36:17 +02:00
ahocevar
1d680df6d0 Respect zoom level restriction. 2012-06-12 23:39:29 +02:00
Stéphane Brunner
8d1d08b0c2 add tests to create a REST WMTS Layer 2012-06-11 13:21:35 +02:00
Stéphane Brunner
a662f82a1b improve createLayer from WMTS Capabilities 2012-06-11 13:21:35 +02:00
Marc Jansen
0c87de44b4 Merge branch 'control-inheritance' of https://github.com/marcjansen/openlayers into control-inheritance
Conflicts:
	tests/Control/ZoomOut.html
	tests/Control/ZoomToMaxExtent.html
2012-06-08 09:44:36 +02:00
ahocevar
99dd0bbcb2 URL switching for all REST encoded WMTS layers. 2012-06-02 01:48:20 +02:00
Frederic Junod
74dd106082 Use OpenLayers.Event.preventDefault, deprecate OpenLayers.Renderer.SVG.preventDefault. 2012-05-30 09:07:49 +02:00
Frederic Junod
a6119f6a75 Prevent the default browser behavior without stopping the event propagation. 2012-05-30 09:07:49 +02:00
Frederic Junod
cf92ced1c8 Add tests/manual/map-events.html test file 2012-05-30 09:07:49 +02:00
Gregers Gram Rygg
a18ce5adf6 Rewrite PinchZoom to detect vendor-prefix, so it works in more browsers 2012-05-22 17:06:03 +02:00
Gregers Gram Rygg
875a2b98ff API description should inform that the method only tests for DOM style properties. Not object properties. 2012-05-22 17:05:13 +02:00
Gregers Gram Rygg
f27002b565 Tests for vendor prefix detection 2012-05-21 16:41:55 +02:00
Gregers Gram Rygg
e3a32f29a8 Util methods to detect vendor prefix for DOM properties and CSS 2012-05-21 16:40:36 +02:00
Marc Jansen
a87f5ac16a Merge branch 'master' of https://github.com/openlayers/openlayers into control-inheritance 2012-05-15 08:34:53 +02:00
Stéphane Brunner
da67953c61 add a REST example in wmts-capabilities 2012-04-27 18:22:37 +02:00
Tim Schaub
ec7b12257b Stay on the world when transforming coords.
Instead of a transform that results in +/- Infinity northing, we can constrain the results to be within the world bounds.
2012-04-23 18:49:55 -04:00
Marc Jansen
4cd34bc851 Added tests for OpenLayers.Control.Pan. 2012-04-17 21:31:12 +02:00
Marc Jansen
d86c1b6c9c Changed Pan control to inherit from OpenLayers.Control.Button. 2012-04-17 21:29:32 +02:00
Marc Jansen
56d7cee8cf Protect the trigger action of pan control by checking whether
we were added to a map prior to calling this.map.pan().
2012-04-17 21:25:56 +02:00
Marc Jansen
53ed973eec Added tests for OpenLayers.Control.Pan. 2012-04-17 21:24:54 +02:00
Marc Jansen
d08fb575b1 The changed controls should also check whether they have correctly
inherited the property 'type' of the new parent class.
2012-04-17 20:21:06 +02:00
Marc Jansen
d5bdadc18e Removed erroneously commited alert-statements in tests. 2012-04-17 20:06:40 +02:00
Marc Jansen
292da06150 Changed ZoomIn control to inherit from OpenLayers.Control.Button. 2012-04-17 20:05:47 +02:00
Marc Jansen
4af41b41f5 Added tests for ZoomIn control. 2012-04-17 20:04:49 +02:00
Marc Jansen
a5c5fd8d3e Added tests for the 'type' property which is now inherited from the
parent class.
2012-04-17 08:20:09 +02:00
Marc Jansen
3dfa3fd157 Changed ZoomOut control to inherit from OpenLayers.Control.Button. 2012-04-17 08:11:48 +02:00
Marc Jansen
c40bdc90e9 Added tests for ZoomOut control. 2012-04-17 08:11:08 +02:00
Marc Jansen
029bdaccde The ZoomToMaxExtent control should extend the OpenLayers.Control.Button
and not OpenLayers.Control.
2012-04-13 09:59:44 +02:00
Marc Jansen
84e5c47caa Add tests for the ZoomToMaxExtent control. 2012-04-13 09:58:59 +02:00
Bart van den Eijnden
e773ec32d1 incorporate @ahocevar's suggestion 2012-03-30 23:33:10 +02:00
Bart van den Eijnden
2e83863e90 error handling in WFSDescribeFeatureType format 2012-03-30 23:04:03 +02:00
Xavier Mamano
ee8e892bb4 Move some touch logic to the handler base class. 2012-02-15 17:55:37 +01:00
428 changed files with 11850 additions and 3641 deletions

View File

@@ -379,7 +379,6 @@ Group: OpenLayers {
File: Popup (no auto-title, OpenLayers/Popup.js) File: Popup (no auto-title, OpenLayers/Popup.js)
File: Anchored (no auto-title, OpenLayers/Popup/Anchored.js) File: Anchored (no auto-title, OpenLayers/Popup/Anchored.js)
File: AnchoredBubble (no auto-title, OpenLayers/Popup/AnchoredBubble.js)
File: Framed (no auto-title, OpenLayers/Popup/Framed.js) File: Framed (no auto-title, OpenLayers/Popup/Framed.js)
File: FramedCloud (no auto-title, OpenLayers/Popup/FramedCloud.js) File: FramedCloud (no auto-title, OpenLayers/Popup/FramedCloud.js)
} # Group: Popup } # Group: Popup

View File

@@ -32,6 +32,13 @@ def build(config_file = None, output_file = None, options = None):
except ImportError: except ImportError:
print "No minimize" print "No minimize"
try:
import uglify_js
uglify_js.check_available()
have_compressor.append("uglify-js")
except Exception, E:
print "No uglify-js (%s)" % E
use_compressor = None use_compressor = None
if options.compressor and options.compressor in have_compressor: if options.compressor and options.compressor in have_compressor:
use_compressor = options.compressor use_compressor = options.compressor
@@ -52,7 +59,7 @@ def build(config_file = None, output_file = None, options = None):
print "Merging libraries." print "Merging libraries."
try: try:
if use_compressor == "closure": if use_compressor == "closure" or use_compressor == 'uglify-js':
sourceFiles = mergejs.getNames(sourceDirectory, configFilename) sourceFiles = mergejs.getNames(sourceDirectory, configFilename)
else: else:
merged = mergejs.run(sourceDirectory, None, configFilename) merged = mergejs.run(sourceDirectory, None, configFilename)
@@ -60,6 +67,15 @@ def build(config_file = None, output_file = None, options = None):
print "\nAbnormal termination." print "\nAbnormal termination."
sys.exit("ERROR: %s" % E) sys.exit("ERROR: %s" % E)
if options.amdname:
options.amdname = "'" + options.amdname + "',"
else:
options.amdname = ""
if options.amd == 'pre':
print "\nAdding AMD function."
merged = "define(%sfunction(){%sreturn OpenLayers;});" % (options.amdname, merged)
print "Compressing using %s" % use_compressor print "Compressing using %s" % use_compressor
if use_compressor == "jsmin": if use_compressor == "jsmin":
minimized = jsmin.jsmin(merged) minimized = jsmin.jsmin(merged)
@@ -98,9 +114,25 @@ def build(config_file = None, output_file = None, options = None):
print "\nAbnormal termination due to compilation errors." print "\nAbnormal termination due to compilation errors."
sys.exit("ERROR: Closure Compilation failed! See compilation errors.") sys.exit("ERROR: Closure Compilation failed! See compilation errors.")
print "Closure Compilation has completed successfully." print "Closure Compilation has completed successfully."
elif use_compressor == "uglify-js":
minimized = uglify_js.compile(sourceFiles)
if minimized is None:
print "\nAbnormal termination due to compilation errors."
sys.exit("ERROR: Uglify JS compilation failed! See compilation errors.")
print "Uglify JS compilation has completed successfully."
else: # fallback else: # fallback
minimized = merged minimized = merged
if options.amd == 'post':
print "\nAdding AMD function."
minimized = "define(%sfunction(){%sreturn OpenLayers;});" % (options.amdname, minimized)
if options.status:
print "\nAdding status file."
minimized = "// status: " + file(options.status).read() + minimized
print "\nAdding license file." print "\nAdding license file."
minimized = file("license.txt").read() + minimized minimized = file("license.txt").read() + minimized
@@ -111,7 +143,10 @@ def build(config_file = None, output_file = None, options = None):
if __name__ == '__main__': if __name__ == '__main__':
opt = optparse.OptionParser(usage="%s [options] [config_file] [output_file]\n Default config_file is 'full.cfg', Default output_file is 'OpenLayers.js'") opt = optparse.OptionParser(usage="%s [options] [config_file] [output_file]\n Default config_file is 'full.cfg', Default output_file is 'OpenLayers.js'")
opt.add_option("-c", "--compressor", dest="compressor", help="compression method: one of 'jsmin', 'minimize', 'closure_ws', 'closure', or 'none'", default="jsmin") opt.add_option("-c", "--compressor", dest="compressor", help="compression method: one of 'jsmin' (default), 'minimize', 'closure_ws', 'closure', or 'none'", default="jsmin")
opt.add_option("-s", "--status", dest="status", help="name of a file whose contents will be added as a comment at the front of the output file. For example, when building from a git repo, you can save the output of 'git describe --tags' in this file. Default is no file.", default=False)
opt.add_option("--amd", dest="amd", help="output should be AMD module; wrap merged files in define function; can be either 'pre' (before compilation) or 'post' (after compilation). Wrapping the OpenLayers var in a function means the filesize can be reduced by the closure compiler using 'pre', but be aware that a few functions depend on the OpenLayers variable being present. Either option can be used with jsmin or minimize compression. Default false, not AMD.", default=False)
opt.add_option("--amdname", dest="amdname", help="only useful with amd option. Name of AMD module. Default no name, anonymous module.", default=False)
(options, args) = opt.parse_args() (options, args) = opt.parse_args()
if not len(args): if not len(args):
build(options=options) build(options=options)

View File

@@ -2,7 +2,7 @@
OpenLayers.js -- OpenLayers Map Viewer Library OpenLayers.js -- OpenLayers Map Viewer Library
Copyright (c) 2006-2012 by OpenLayers Contributors Copyright (c) 2006-2013 by OpenLayers Contributors
Published under the 2-clause BSD license. Published under the 2-clause BSD license.
See http://openlayers.org/dev/license.txt for the full text of the license, and http://openlayers.org/dev/authors.txt for full list of contributors. See http://openlayers.org/dev/license.txt for the full text of the license, and http://openlayers.org/dev/authors.txt for full list of contributors.

View File

@@ -29,6 +29,7 @@ OpenLayers/Protocol/HTTP.js
OpenLayers/Protocol/WFS.js OpenLayers/Protocol/WFS.js
OpenLayers/Protocol/WFS/v1_0_0.js OpenLayers/Protocol/WFS/v1_0_0.js
OpenLayers/Strategy/Fixed.js OpenLayers/Strategy/Fixed.js
OpenLayers/TileManager.js
[exclude] [exclude]

View File

@@ -379,7 +379,6 @@ Group: OpenLayers {
File: Popup (no auto-title, OpenLayers/Popup.js) File: Popup (no auto-title, OpenLayers/Popup.js)
File: Anchored (no auto-title, OpenLayers/Popup/Anchored.js) File: Anchored (no auto-title, OpenLayers/Popup/Anchored.js)
File: AnchoredBubble (no auto-title, OpenLayers/Popup/AnchoredBubble.js)
File: Framed (no auto-title, OpenLayers/Popup/Framed.js) File: Framed (no auto-title, OpenLayers/Popup/Framed.js)
File: FramedCloud (no auto-title, OpenLayers/Popup/FramedCloud.js) File: FramedCloud (no auto-title, OpenLayers/Popup/FramedCloud.js)
} # Group: Popup } # Group: Popup

View File

@@ -12,11 +12,12 @@
format = new OpenLayers.Format.WMSDescribeLayer(); format = new OpenLayers.Format.WMSDescribeLayer();
html = "<br>"; html = "<br>";
resp = format.read(req.responseText); resp = format.read(req.responseText);
for(var i = 0; i < resp.length; i++) { var layerDescriptions = resp.layerDescriptions;
html += "Layer: typeName: "+ resp[i].typeName+","; for(var i = 0; i < layerDescriptions.length; i++) {
html += "Layer: typeName: "+layerDescriptions[i].typeName+",";
html += "<ul>"; html += "<ul>";
html += "<li>owsURL: "+resp[i].owsURL+"</li>"; html += "<li>owsURL: "+layerDescriptions[i].owsURL+"</li>";
html += "<li>owsType: "+resp[i].owsType+"</li>"; html += "<li>owsType: "+layerDescriptions[i].owsType+"</li>";
html += "</ul>" html += "</ul>"
} }
document.getElementById('output').innerHTML = html; document.getElementById('output').innerHTML = html;

View File

@@ -6,7 +6,6 @@
<meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-capable" content="yes">
<title>OpenLayers All Overlays with Google and OSM</title> <title>OpenLayers All Overlays with Google and OSM</title>
<link rel="stylesheet" href="../theme/default/style.css" type="text/css"> <link rel="stylesheet" href="../theme/default/style.css" type="text/css">
<link rel="stylesheet" href="../theme/default/google.css" type="text/css">
<link rel="stylesheet" href="style.css" type="text/css"> <link rel="stylesheet" href="style.css" type="text/css">
<script src="http://maps.google.com/maps/api/js?v=3&amp;sensor=false"></script> <script src="http://maps.google.com/maps/api/js?v=3&amp;sensor=false"></script>
<script src="../lib/OpenLayers.js"></script> <script src="../lib/OpenLayers.js"></script>

81
examples/bootstrap.html Normal file
View File

@@ -0,0 +1,81 @@
<!DOCTYPE html>
<html>
<head>
<title>Bootstraped OpenLayers</title>
<link rel="stylesheet" href="../theme/default/style.css">
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.2.1/css/bootstrap.min.css" rel="stylesheet">
<style>
body {
padding-top: 60px;
padding-bottom: 40px;
}
#map {
height: 350px;
background-color: #eee;
}
.olControlAttribution {
bottom: 3px;
left: 10px;
line-height: 9px;
font-size: 9px;
color: #ccc;
}
</style>
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.2.1/css/bootstrap-responsive.min.css" rel="stylesheet">
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container-fluid">
<a class="brand" href="/">openlayers.org</a>
<ul class="nav">
<li>
<a href="./">
<i class="icon-globe icon-white"></i> examples
</a>
</li>
</ul>
</div>
</div>
</div>
<div class="container-fluid" ng-controller="AlertsCtrl">
<div class="row-fluid">
<div class="span7">
<div id="map"></div>
</div>
<div class="span5">
<h4>OpenLayers and Bootstrap</h4>
<p>
This example demonstrates an OpenLayers map in a fluid
layout using Bootstrap CSS.
</p>
<p>
Note that the OpenLayers stylesheet is loaded before
Bootstrap. The Bootstrap CSS sets the maximum width for
images to be 100% (of their containing element).
</p>
<pre><code>img {
max-width: 100%;
}
</code></pre>
<p>
This causes problems for images that you might want to be
bigger than their containing element (e.g. big tile in small
map viewport). To overcome this, the OpenLayers CSS
overrides this <code>max-width</code> setting. If you are
not loading the OpenLayers default CSS or are having trouble
with tile sizing and Bootstrap, add the following to your
markup:
</p>
<pre><code>&lt;style>
img.olTileImage {
max-width: none;
}
&lt;/style></code></pre>
</div>
</div>
</div>
<script src="../lib/OpenLayers.js"></script>
<script src="bootstrap.js"></script>
</body>
</html>

31
examples/bootstrap.js vendored Normal file
View File

@@ -0,0 +1,31 @@
var map = new OpenLayers.Map({
div: "map",
projection: "EPSG:900913",
layers: [
new OpenLayers.Layer.XYZ(
"Imagery",
[
"http://oatile1.mqcdn.com/naip/${z}/${x}/${y}.png",
"http://oatile2.mqcdn.com/naip/${z}/${x}/${y}.png",
"http://oatile3.mqcdn.com/naip/${z}/${x}/${y}.png",
"http://oatile4.mqcdn.com/naip/${z}/${x}/${y}.png"
],
{
attribution: "Tiles Courtesy of <a href='http://open.mapquest.co.uk/' target='_blank'>MapQuest</a>. Portions Courtesy NASA/JPL-Caltech and U.S. Depart. of Agriculture, Farm Service Agency. <img src='http://developer.mapquest.com/content/osm/mq_logo.png' border='0'>",
transitionEffect: "resize",
wrapDateLine: true
}
)
],
controls: [
new OpenLayers.Control.Navigation({
dragPanOptions: {
enableKinetic: true
}
}),
new OpenLayers.Control.Zoom(),
new OpenLayers.Control.Attribution()
],
center: [0, 0],
zoom: 1
});

View File

@@ -8,13 +8,10 @@ function init() {
div: "map", div: "map",
projection: "EPSG:900913", projection: "EPSG:900913",
layers: [ layers: [
new OpenLayers.Layer.WMS("OSGeo", "http://vmap0.tiles.osgeo.org/wms/vmap0", { new OpenLayers.Layer.WMS(
layers: "basic" "OSGeo", "http://vmap0.tiles.osgeo.org/wms/vmap0",
}, { {layers: "basic"}
eventListeners: { )
tileloaded: updateStatus
}
})
], ],
center: [0, 0], center: [0, 0],
zoom: 1 zoom: 1
@@ -38,6 +35,7 @@ function init() {
}; };
// update the number of cached tiles and detect local storage support // update the number of cached tiles and detect local storage support
map.layers[0].events.on({'tileloaded': updateStatus});
function updateStatus() { function updateStatus() {
if (window.localStorage) { if (window.localStorage) {
status.innerHTML = localStorage.length + " entries in cache."; status.innerHTML = localStorage.length + " entries in cache.";

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,46 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta name="apple-mobile-web-app-capable" content="yes">
<title>OpenLayers Feature Events Example</title>
<link rel="stylesheet" href="../theme/default/style.css" type="text/css">
<link rel="stylesheet" href="style.css" type="text/css">
<style type="text/css">
#result {
height: 60px;
width: 514px;
font-size: smaller;
overflow: auto;
margin-top: 5px;
}
</style>
</head>
<body>
<h1 id="title">Feature Events Example</h1>
<div id="tags">
feature, select, hover
</div>
<div id="shortdesc">Feature hover and click events</div>
<div id="map" class="smallmap"></div>
<div id="docs">
<p id="result">Hover over or click features on the map.</p>
<p>This example shows how to use the 'featureclick', 'nofeatureclick',
'featureover' and 'featureout' events to make features interactive.
Look at the <a href="feature-events.js">feature-events.js</a> source
code to see how this is done.</p>
<p>Note that these events can be registered both on the map and on
individual layers. If many layers need to be observed, it is
recommended to register listeners once on the map for performance
reasons.</p>
</div>
<script src="../lib/OpenLayers.js"></script>
<script src="feature-events.js"></script>
</body>
</html>

View File

@@ -0,0 +1,67 @@
var layerListeners = {
featureclick: function(e) {
log(e.object.name + " says: " + e.feature.id + " clicked.");
return false;
},
nofeatureclick: function(e) {
log(e.object.name + " says: No feature clicked.");
}
};
var style = new OpenLayers.StyleMap({
'default': OpenLayers.Util.applyDefaults(
{label: "${l}", pointRadius: 10},
OpenLayers.Feature.Vector.style["default"]
),
'select': OpenLayers.Util.applyDefaults(
{pointRadius: 10},
OpenLayers.Feature.Vector.style.select
)
});
var layer1 = new OpenLayers.Layer.Vector("Layer 1", {
styleMap: style,
eventListeners: layerListeners
});
layer1.addFeatures([
new OpenLayers.Feature.Vector(OpenLayers.Geometry.fromWKT("POINT(-1 -1)"), {l:1}),
new OpenLayers.Feature.Vector(OpenLayers.Geometry.fromWKT("POINT(1 1)"), {l:1})
]);
var layer2 = new OpenLayers.Layer.Vector("Layer 2", {
styleMap: style,
eventListeners: layerListeners
});
layer2.addFeatures([
new OpenLayers.Feature.Vector(OpenLayers.Geometry.fromWKT("POINT(-1 1)"), {l:2}),
new OpenLayers.Feature.Vector(OpenLayers.Geometry.fromWKT("POINT(1 -1)"), {l:2})
]);
var map = new OpenLayers.Map({
div: "map",
allOverlays: true,
layers: [layer1, layer2],
zoom: 6,
center: [0, 0],
eventListeners: {
featureover: function(e) {
e.feature.renderIntent = "select";
e.feature.layer.drawFeature(e.feature);
log("Map says: Pointer entered " + e.feature.id + " on " + e.feature.layer.name);
},
featureout: function(e) {
e.feature.renderIntent = "default";
e.feature.layer.drawFeature(e.feature);
log("Map says: Pointer left " + e.feature.id + " on " + e.feature.layer.name);
},
featureclick: function(e) {
log("Map says: " + e.feature.id + " clicked on " + e.feature.layer.name);
}
}
});
function log(msg) {
if (!log.timer) {
result.innerHTML = "";
log.timer = window.setTimeout(function() {delete log.timer;}, 100);
}
result.innerHTML += msg + "<br>";
}

View File

@@ -1,18 +1,9 @@
var urls = [
"http://a.tile.openstreetmap.org/${z}/${x}/${y}.png",
"http://b.tile.openstreetmap.org/${z}/${x}/${y}.png",
"http://c.tile.openstreetmap.org/${z}/${x}/${y}.png"
];
var map = new OpenLayers.Map({ var map = new OpenLayers.Map({
div: "map", div: "map",
tileManager: new OpenLayers.TileManager(),
layers: [ layers: [
new OpenLayers.Layer.XYZ("OSM (with buffer)", urls, { new OpenLayers.Layer.OSM("OSM (without buffer)"),
transitionEffect: "resize", buffer: 2, sphericalMercator: true new OpenLayers.Layer.OSM("OSM (with buffer)", null, {buffer: 2})
}),
new OpenLayers.Layer.XYZ("OSM (without buffer)", urls, {
transitionEffect: "resize", buffer: 0, sphericalMercator: true
})
], ],
controls: [ controls: [
new OpenLayers.Control.Navigation({ new OpenLayers.Control.Navigation({

View File

@@ -20,11 +20,14 @@
<div id="map" class="smallmap"></div> <div id="map" class="smallmap"></div>
<div id="docs"> <div id="docs">
<p> <p>
Google Fusion Tables can be used to store features, and access them using SQL-type commands over HTTP. Tables can be made public, in which case no authorization is needed to read them. Geometries can be stored in Location columns in KML format. The default output is a CSV dump of each table row/column selected. Multi-line CSV files are not easy to parse in Javascript, but by adding a jsonCallback parameter to the HTTP command, the output will be a JSON object with the geometry as GeoJSON. With a custom read method, this example parses the geometry for each row, storing the other columns as feature attributes. You can of course add a 'where' clause to the SQL statement or change the column names to limit the data retrieved. Point geometries can also be stored in Latitude/Longitude columns, and the script could easily be modified to use those instead. Google Fusion Tables can be used to store features, and access them using SQL-type commands over HTTP. Tables are accessed using an authorization key; create/update/delete of tables requires an OAuth2 token, but tables can be public, in which case a simple apikey is all that's needed to read them. Geometries can be stored in Location columns in KML format, but the default output is a JSON object with the geometry as GeoJSON. With a custom read method, this example parses the geometry for each row, storing the other columns as feature attributes. You can of course add a 'where' clause to the SQL statement or change the column names to limit the data retrieved. Point geometries can also be stored in Latitude/Longitude columns, and the script could easily be modified to use those instead.
</p> </p>
<p> <p>
View the <a href="fusiontables.js" target="_blank">fusiontables.js</a> View the <a href="fusiontables.js" target="_blank">fusiontables.js</a>
source to see how this is done. <a href="https://www.google.com/fusiontables/DataSource?docid=1g5DrXcdotCiO_yffkdW0zhuJk0a1i80SPvERHI8">Table used</a> source to see how this is done. You will need to get your own apikey from <a href="https://code.google.com/apis/console">Google's API Console</a> for this to function on your domain.
</p>
<p>
<a href="https://www.google.com/fusiontables/DataSource?docid=1g5DrXcdotCiO_yffkdW0zhuJk0a1i80SPvERHI8">Table used</a>. <a href="https://developers.google.com/fusiontables/docs/v1/using">Fusion Tables Developers Guide</a>
</p> </p>
</div> </div>
<script src="fusiontables.js"></script> <script src="fusiontables.js"></script>

View File

@@ -1,3 +1,6 @@
// change this to your api key
var apikey = "AIzaSyD_1zzMAoZjuP-m4LyhieuYmqiVJTEajyI";
var map = new OpenLayers.Map({ var map = new OpenLayers.Map({
div: "map", div: "map",
layers: [ layers: [
@@ -6,21 +9,24 @@ var map = new OpenLayers.Map({
projection: new OpenLayers.Projection("EPSG:4326"), projection: new OpenLayers.Projection("EPSG:4326"),
strategies: [new OpenLayers.Strategy.Fixed()], strategies: [new OpenLayers.Strategy.Fixed()],
protocol: new OpenLayers.Protocol.Script({ protocol: new OpenLayers.Protocol.Script({
url: "https://www.google.com/fusiontables/api/query", url: "https://www.googleapis.com/fusiontables/v1/query",
params: {sql: "select * from 1g5DrXcdotCiO_yffkdW0zhuJk0a1i80SPvERHI8"}, params: {
sql: "select * from 1g5DrXcdotCiO_yffkdW0zhuJk0a1i80SPvERHI8",
key: apikey
},
format: new OpenLayers.Format.GeoJSON({ format: new OpenLayers.Format.GeoJSON({
ignoreExtraDims: true, ignoreExtraDims: true,
read: function(json) { read: function(json) {
var row, feature, atts = {}, features = []; var row, feature, atts = {}, features = [];
var cols = json.table.cols; // column names var cols = json.columns; // column names
for (var i = 0; i < json.table.rows.length; i++) { for (var i = 0; i < json.rows.length; i++) {
row = json.table.rows[i]; row = json.rows[i];
feature = new OpenLayers.Feature.Vector(); feature = new OpenLayers.Feature.Vector();
atts = {}; atts = {};
for (var j = 0; j < row.length; j++) { for (var j = 0; j < row.length; j++) {
// 'location's are json objects, other types are strings // 'location's are json objects, other types are strings
if (typeof row[j] === "object") { if (typeof row[j] === "object") {
feature.geometry = this.parseGeometry(row[j]); feature.geometry = this.parseGeometry(row[j].geometry);
} else { } else {
atts[cols[j]] = row[j]; atts[cols[j]] = row[j];
} }
@@ -33,8 +39,7 @@ var map = new OpenLayers.Map({
} }
return features; return features;
} }
}), })
callbackKey: "jsonCallback"
}), }),
eventListeners: { eventListeners: {
"featuresadded": function () { "featuresadded": function () {

View File

@@ -0,0 +1,46 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta name="apple-mobile-web-app-capable" content="yes">
<title>OpenLayers GeoJSON Reprojected Example</title>
<link rel="stylesheet" href="../theme/default/style.css" type="text/css">
<link rel="stylesheet" href="style.css" type="text/css">
<style type="text/css">
.olControlAttribution {
left: 2px;
right: inherit;
bottom: 3px;
line-height: 11px;
}
</style>
</head>
<body>
<h1 id="title">GeoJSON Reprojected</h1>
<div id="tags">
geojson, bing, projection
</div>
<div id="shortdesc">Display GeoJSON data over Bing tiles</div>
<div id="map" class="smallmap"></div>
<div id="docs">
<p>This example demonstrates the use of GeoJSON over Bing tiles. The
GeoJSON vector data is in geographic coordinates (EPSG:4326). The Bing
tiles are in a spherical mercator projection (EPSG:900913). By setting
the <code>projection</code> property of the GeoJSON layer to the source
projection (EPSG:4326), the features are properly displayed over the
base layer. In general, the map projection determines how raster or
vector data is displayed. The layer projection corresponds to the
projection of the data source.
<p>See the
<a target="_blank" href="geojson-reprojected.js">geojson-reprojected.js</a>
source for details on how this is done.</p>
</div>
<script src="../lib/OpenLayers.js"></script>
<script src="geojson-reprojected.js"></script>
</body>
</html>

View File

@@ -0,0 +1,27 @@
// API key for http://openlayers.org. Please get your own at
// http://bingmapsportal.com/ and use that instead.
var apiKey = "AqTGBsziZHIJYYxgivLBf0hVdrAk9mWO5cQcb8Yux8sW5M8c8opEC2lZqKR1ZZXf";
var hybrid = new OpenLayers.Layer.Bing({
key: apiKey,
type: "AerialWithLabels",
name: "Bing Aerial With Labels"
});
var vector = new OpenLayers.Layer.Vector("GeoJSON", {
projection: "EPSG:4326",
strategies: [new OpenLayers.Strategy.Fixed()],
protocol: new OpenLayers.Protocol.HTTP({
url: "geojson-reprojected.json",
format: new OpenLayers.Format.GeoJSON()
})
});
var center = new OpenLayers.LonLat(-109.6, 46.7).transform("EPSG:4326", "EPSG:900913");
var map = new OpenLayers.Map({
div: "map",
layers: [hybrid, vector],
center: center,
zoom: 4
});

View File

@@ -0,0 +1 @@
{"type":"FeatureCollection","features":[{"type":"Feature","id":"USA-MT","properties":{"fips":"30","name":"Montana"},"geometry":{"type":"Polygon","coordinates":[[[-104.047534,49.000239],[-104.042057,47.861036],[-104.047534,45.944106],[-104.042057,44.996596],[-104.058488,44.996596],[-105.91517,45.002073],[-109.080842,45.002073],[-111.05254,45.002073],[-111.047063,44.476286],[-111.227803,44.580348],[-111.386634,44.75561],[-111.616665,44.547487],[-111.819312,44.509148],[-111.868605,44.563917],[-112.104113,44.520102],[-112.241036,44.569394],[-112.471068,44.481763],[-112.783254,44.48724],[-112.887315,44.394132],[-113.002331,44.448902],[-113.133778,44.772041],[-113.341901,44.782995],[-113.456917,44.865149],[-113.45144,45.056842],[-113.571933,45.128042],[-113.736241,45.330689],[-113.834826,45.522382],[-113.807441,45.604536],[-113.98818,45.703121],[-114.086765,45.593582],[-114.333228,45.456659],[-114.546828,45.560721],[-114.497536,45.670259],[-114.568736,45.774321],[-114.387997,45.88386],[-114.492059,46.037214],[-114.464674,46.272723],[-114.322274,46.645155],[-114.612552,46.639678],[-114.623506,46.705401],[-114.886399,46.809463],[-114.930214,46.919002],[-115.302646,47.187372],[-115.324554,47.258572],[-115.527201,47.302388],[-115.718894,47.42288],[-115.724371,47.696727],[-116.04751,47.976051],[-116.04751,49.000239],[-111.50165,48.994762],[-109.453274,49.000239],[-104.047534,49.000239]]]}}]}

View File

@@ -6,7 +6,6 @@
<meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-capable" content="yes">
<title>OpenLayers Google (v3) Layer Example</title> <title>OpenLayers Google (v3) Layer Example</title>
<link rel="stylesheet" href="../theme/default/style.css" type="text/css"> <link rel="stylesheet" href="../theme/default/style.css" type="text/css">
<link rel="stylesheet" href="../theme/default/google.css" type="text/css">
<link rel="stylesheet" href="style.css" type="text/css"> <link rel="stylesheet" href="style.css" type="text/css">
<script src="http://maps.google.com/maps/api/js?v=3&amp;sensor=false"></script> <script src="http://maps.google.com/maps/api/js?v=3&amp;sensor=false"></script>
<script src="../lib/OpenLayers.js"></script> <script src="../lib/OpenLayers.js"></script>

View File

@@ -6,7 +6,6 @@
<meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-capable" content="yes">
<title>OpenLayers Google (v3) Layer Example</title> <title>OpenLayers Google (v3) Layer Example</title>
<link rel="stylesheet" href="../theme/default/style.css" type="text/css"> <link rel="stylesheet" href="../theme/default/style.css" type="text/css">
<link rel="stylesheet" href="../theme/default/google.css" type="text/css">
<link rel="stylesheet" href="style.css" type="text/css"> <link rel="stylesheet" href="style.css" type="text/css">
<script src="http://maps.google.com/maps/api/js?v=3&amp;sensor=false"></script> <script src="http://maps.google.com/maps/api/js?v=3&amp;sensor=false"></script>
<script src="../lib/OpenLayers.js"></script> <script src="../lib/OpenLayers.js"></script>
@@ -30,21 +29,6 @@
spherical mercator projection. See the spherical mercator projection. See the
<a href="google-v3.js" target="_blank">google-v3.js source</a> <a href="google-v3.js" target="_blank">google-v3.js source</a>
to see how this is done. to see how this is done.
<p>
In order to position the Google attribution div in the default
location, you must include the extra theme/default/google.css
stylesheet.
</p>
<p>
<strong>Note on Google Maps API versioning:</strong>
This example uses the "nightly" version of Google Maps
API. This is specified by using <code>v=3</code> in the
the Google Maps API URL. Production applications should use the
"release" or "frozen" versions of Google Maps
API. See the <code>OpenLayers.Layer.Google.v3</code> API
docs, and the
<a href="https://developers.google.com/maps/documentation/javascript/basics#Versioning">Versioning Section</a>
of the Google Maps API docs, for more details.
</p> </p>
</div> </div>
</body> </body>

View File

@@ -1,35 +1,34 @@
var map; var map;
function init() { function init() {
map = new OpenLayers.Map('map'); map = new OpenLayers.Map('map', {
projection: 'EPSG:3857',
layers: [
new OpenLayers.Layer.Google(
"Google Physical",
{type: google.maps.MapTypeId.TERRAIN}
),
new OpenLayers.Layer.Google(
"Google Streets", // the default
{numZoomLevels: 20}
),
new OpenLayers.Layer.Google(
"Google Hybrid",
{type: google.maps.MapTypeId.HYBRID, numZoomLevels: 20}
),
new OpenLayers.Layer.Google(
"Google Satellite",
{type: google.maps.MapTypeId.SATELLITE, numZoomLevels: 22}
)
],
center: new OpenLayers.LonLat(10.2, 48.9)
// Google.v3 uses web mercator as projection, so we have to
// transform our coordinates
.transform('EPSG:4326', 'EPSG:3857'),
zoom: 5
});
map.addControl(new OpenLayers.Control.LayerSwitcher()); map.addControl(new OpenLayers.Control.LayerSwitcher());
var gphy = new OpenLayers.Layer.Google(
"Google Physical",
{type: google.maps.MapTypeId.TERRAIN}
);
var gmap = new OpenLayers.Layer.Google(
"Google Streets", // the default
{numZoomLevels: 20}
);
var ghyb = new OpenLayers.Layer.Google(
"Google Hybrid",
{type: google.maps.MapTypeId.HYBRID, numZoomLevels: 20}
);
var gsat = new OpenLayers.Layer.Google(
"Google Satellite",
{type: google.maps.MapTypeId.SATELLITE, numZoomLevels: 22}
);
map.addLayers([gphy, gmap, ghyb, gsat]);
// Google.v3 uses EPSG:900913 as projection, so we have to
// transform our coordinates
map.setCenter(new OpenLayers.LonLat(10.2, 48.9).transform(
new OpenLayers.Projection("EPSG:4326"),
map.getProjectionObject()
), 5);
// add behavior to html // add behavior to html
var animate = document.getElementById("animate"); var animate = document.getElementById("animate");
animate.onclick = function() { animate.onclick = function() {

View File

@@ -19,14 +19,12 @@
function init(){ function init(){
map = new OpenLayers.Map('map'); map = new OpenLayers.Map('map');
var options = {numZoomLevels: 3};
var graphic = new OpenLayers.Layer.Image( var graphic = new OpenLayers.Layer.Image(
'City Lights', 'City Lights',
'http://earthtrends.wri.org/images/maps/4_m_citylights_lg.gif', 'data/4_m_citylights_lg.gif',
new OpenLayers.Bounds(-180, -88.759, 180, 88.759), new OpenLayers.Bounds(-180, -88.759, 180, 88.759),
new OpenLayers.Size(580, 288), new OpenLayers.Size(580, 288),
options {numZoomLevels: 3}
); );
graphic.events.on({ graphic.events.on({
@@ -38,9 +36,12 @@
} }
}); });
var jpl_wms = new OpenLayers.Layer.WMS( "NASA Global Mosaic", var jpl_wms = new OpenLayers.Layer.WMS(
"http://t1.hypercube.telascience.org/cgi-bin/landsat7", "Global Imagery",
{layers: "landsat7"}, options); "http://demo.opengeo.org/geoserver/wms",
{layers: "bluemarble"},
{maxExtent: [-160, -88.759, 160, 88.759], numZoomLevels: 3}
);
map.addLayers([graphic, jpl_wms]); map.addLayers([graphic, jpl_wms]);
map.addControl(new OpenLayers.Control.LayerSwitcher()); map.addControl(new OpenLayers.Control.LayerSwitcher());

View File

@@ -1,35 +1,21 @@
var streets = new OpenLayers.Layer.XYZ( var earth = new OpenLayers.Layer.XYZ(
"MapBox Streets", "Natural Earth",
[ [
"http://a.tiles.mapbox.com/v3/mapbox.mapbox-streets/${z}/${x}/${y}.png", "http://a.tiles.mapbox.com/v3/mapbox.natural-earth-hypso-bathy/${z}/${x}/${y}.png",
"http://b.tiles.mapbox.com/v3/mapbox.mapbox-streets/${z}/${x}/${y}.png", "http://b.tiles.mapbox.com/v3/mapbox.natural-earth-hypso-bathy/${z}/${x}/${y}.png",
"http://c.tiles.mapbox.com/v3/mapbox.mapbox-streets/${z}/${x}/${y}.png", "http://c.tiles.mapbox.com/v3/mapbox.natural-earth-hypso-bathy/${z}/${x}/${y}.png",
"http://d.tiles.mapbox.com/v3/mapbox.mapbox-streets/${z}/${x}/${y}.png" "http://d.tiles.mapbox.com/v3/mapbox.natural-earth-hypso-bathy/${z}/${x}/${y}.png"
], { ], {
attribution: "Tiles &copy; <a href='http://mapbox.com/'>MapBox</a> | " + attribution: "Tiles &copy; <a href='http://mapbox.com/'>MapBox</a>",
"Data &copy; <a href='http://www.openstreetmap.org/'>OpenStreetMap</a> " +
"and contributors, CC-BY-SA",
sphericalMercator: true, sphericalMercator: true,
wrapDateLine: true, wrapDateLine: true,
transitionEffect: "resize", numZoomLevels: 5
buffer: 1,
numZoomLevels: 17
} }
); );
var map = new OpenLayers.Map({ var map = new OpenLayers.Map({
div: "map", div: "map",
layers: [streets], layers: [earth],
controls: [
new OpenLayers.Control.Attribution(),
new OpenLayers.Control.Navigation({
dragPanOptions: {
enableKinetic: true
}
}),
new OpenLayers.Control.Zoom(),
new OpenLayers.Control.Permalink({anchor: true})
],
center: [0, 0], center: [0, 0],
zoom: 1 zoom: 1
}); });

View File

@@ -5,26 +5,26 @@ var map = new OpenLayers.Map({
new OpenLayers.Layer.XYZ( new OpenLayers.Layer.XYZ(
"OpenStreetMap", "OpenStreetMap",
[ [
"http://otile1.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.png", "http://otile1.mqcdn.com/tiles/1.0.0/map/${z}/${x}/${y}.png",
"http://otile2.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.png", "http://otile2.mqcdn.com/tiles/1.0.0/map/${z}/${x}/${y}.png",
"http://otile3.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.png", "http://otile3.mqcdn.com/tiles/1.0.0/map/${z}/${x}/${y}.png",
"http://otile4.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.png" "http://otile4.mqcdn.com/tiles/1.0.0/map/${z}/${x}/${y}.png"
], ],
{ {
attribution: "Tiles Courtesy of <a href='http://open.mapquest.co.uk/' target='_blank'>MapQuest</a> <img src='http://developer.mapquest.com/content/osm/mq_logo.png' border='0'>", attribution: "Data, imagery and map information provided by <a href='http://www.mapquest.com/' target='_blank'>MapQuest</a>, <a href='http://www.openstreetmap.org/' target='_blank'>Open Street Map</a> and contributors, <a href='http://creativecommons.org/licenses/by-sa/2.0/' target='_blank'>CC-BY-SA</a> <img src='http://developer.mapquest.com/content/osm/mq_logo.png' border='0'>",
transitionEffect: "resize" transitionEffect: "resize"
} }
), ),
new OpenLayers.Layer.XYZ( new OpenLayers.Layer.XYZ(
"Imagery", "Imagery",
[ [
"http://oatile1.mqcdn.com/naip/${z}/${x}/${y}.png", "http://otile1.mqcdn.com/tiles/1.0.0/sat/${z}/${x}/${y}.png",
"http://oatile2.mqcdn.com/naip/${z}/${x}/${y}.png", "http://otile2.mqcdn.com/tiles/1.0.0/sat/${z}/${x}/${y}.png",
"http://oatile3.mqcdn.com/naip/${z}/${x}/${y}.png", "http://otile3.mqcdn.com/tiles/1.0.0/sat/${z}/${x}/${y}.png",
"http://oatile4.mqcdn.com/naip/${z}/${x}/${y}.png" "http://otile4.mqcdn.com/tiles/1.0.0/sat/${z}/${x}/${y}.png"
], ],
{ {
attribution: "Tiles Courtesy of <a href='http://open.mapquest.co.uk/' target='_blank'>MapQuest</a> <img src='http://developer.mapquest.com/content/osm/mq_logo.png' border='0'>", attribution: "Tiles Courtesy of <a href='http://open.mapquest.co.uk/' target='_blank'>MapQuest</a>. Portions Courtesy NASA/JPL-Caltech and U.S. Depart. of Agriculture, Farm Service Agency. <img src='http://developer.mapquest.com/content/osm/mq_logo.png' border='0'>",
transitionEffect: "resize" transitionEffect: "resize"
} }
) )

View File

@@ -42,6 +42,7 @@ var init = function (onSelectFeatureFunction) {
theme: null, theme: null,
projection: sm, projection: sm,
numZoomLevels: 18, numZoomLevels: 18,
tileManager: new OpenLayers.TileManager(),
controls: [ controls: [
new OpenLayers.Control.Attribution(), new OpenLayers.Control.Attribution(),
new OpenLayers.Control.TouchNavigation({ new OpenLayers.Control.TouchNavigation({

View File

@@ -5,7 +5,15 @@ function init() {
styleMap: new OpenLayers.StyleMap({ styleMap: new OpenLayers.StyleMap({
temporary: OpenLayers.Util.applyDefaults({ temporary: OpenLayers.Util.applyDefaults({
pointRadius: 16 pointRadius: 16
}, OpenLayers.Feature.Vector.style.temporary) }, OpenLayers.Feature.Vector.style.temporary),
'default': OpenLayers.Util.applyDefaults({
pointRadius: 16,
strokeWidth: 3,
}, OpenLayers.Feature.Vector.style['default']),
select: OpenLayers.Util.applyDefaults({
pointRadius: 16,
strokeWidth: 3
}, OpenLayers.Feature.Vector.style.select)
}) })
}); });

View File

@@ -12,12 +12,48 @@ html, body, #map {
#title, #tags, #shortdesc { #title, #tags, #shortdesc {
display: none; display: none;
} }
div.olMapViewport {
-ms-touch-action: none;
}
/* Turn on GPU support where available */
.olTileImage {
-webkit-transform: translateZ(0);
-moz-transform: translateZ(0);
-o-transform: translateZ(0);
-ms-transform: translateZ(0);
transform: translateZ(0);
-webkit-backface-visibility: hidden;
-moz-backface-visibility: hidden;
-ms-backface-visibility: hidden;
backface-visibility: hidden;
-webkit-perspective: 1000;
-moz-perspective: 1000;
-ms-perspective: 1000;
perspective: 1000;
}
/* Tile fade animation */
.olLayerGrid .olTileImage { .olLayerGrid .olTileImage {
-webkit-transition: opacity 0.2s linear; -webkit-transition: opacity 0.2s linear;
-moz-transition: opacity 0.2s linear; -moz-transition: opacity 0.2s linear;
-o-transition: opacity 0.2s linear; -o-transition: opacity 0.2s linear;
transition: opacity 0.2s linear; transition: opacity 0.2s linear;
} }
/* Zoom Box */
.olHandlerBoxZoomBox {
border: 2px solid red;
position: absolute;
background-color: white;
opacity: 0.50;
font-size: 1px;
filter: alpha(opacity=50);
}
.olDrawBox {
cursor: crosshair;
}
div.olControlAttribution { div.olControlAttribution {
position: absolute; position: absolute;
font-size: 10px; font-size: 10px;

View File

@@ -46,49 +46,53 @@ var map;
// Geolocate control for the Locate button - the locationupdated handler // Geolocate control for the Locate button - the locationupdated handler
// draws a cross at the location and a circle showing the accuracy radius. // draws a cross at the location and a circle showing the accuracy radius.
zoomPanel.addControls([ var geolocate = new OpenLayers.Control.Geolocate({
new OpenLayers.Control.Geolocate({ type: OpenLayers.Control.TYPE_TOGGLE,
type: OpenLayers.Control.TYPE_TOGGLE, bind: false,
geolocationOptions: { watch: true,
enableHighAccuracy: false, geolocationOptions: {
maximumAge: 0, enableHighAccuracy: false,
timeout: 7000 maximumAge: 0,
timeout: 7000
},
eventListeners: {
activate: function() {
map.addLayer(vector);
}, },
eventListeners: { deactivate: function() {
activate: function() { map.removeLayer(vector);
map.addLayer(vector); vector.removeAllFeatures();
}, },
deactivate: function() { locationupdated: function(e) {
map.removeLayer(vector); vector.removeAllFeatures();
vector.removeAllFeatures(); vector.addFeatures([
}, new OpenLayers.Feature.Vector(e.point, null, {
locationupdated: function(e) { graphicName: 'cross',
vector.removeAllFeatures(); strokeColor: '#f00',
vector.addFeatures([ strokeWidth: 2,
new OpenLayers.Feature.Vector(e.point, null, { fillOpacity: 0,
graphicName: 'cross', pointRadius: 10
}),
new OpenLayers.Feature.Vector(
OpenLayers.Geometry.Polygon.createRegularPolygon(
new OpenLayers.Geometry.Point(e.point.x, e.point.y),
e.position.coords.accuracy / 2, 50, 0
), null, {
fillOpacity: 0.1,
fillColor: '#000',
strokeColor: '#f00', strokeColor: '#f00',
strokeWidth: 2, strokeOpacity: 0.6
fillOpacity: 0, }
pointRadius: 10 )
}), ]);
new OpenLayers.Feature.Vector( map.zoomToExtent(vector.getDataExtent());
OpenLayers.Geometry.Polygon.createRegularPolygon(
new OpenLayers.Geometry.Point(e.point.x, e.point.y),
e.position.coords.accuracy / 2, 50, 0
), null, {
fillOpacity: 0.1,
fillColor: '#000',
strokeColor: '#f00',
strokeOpacity: 0.6
}
)
]);
map.zoomToExtent(vector.getDataExtent());
}
} }
}) }
]); });
zoomPanel.addControls([geolocate]);
// Fallback layer when outside Vienna
var osm = new OpenLayers.Layer.OSM();
// Map with navigation controls optimized for touch devices // Map with navigation controls optimized for touch devices
map = new OpenLayers.Map({ map = new OpenLayers.Map({
@@ -96,22 +100,11 @@ var map;
theme: null, theme: null,
projection: "EPSG:3857", projection: "EPSG:3857",
units: "m", units: "m",
maxExtent: [-20037508.34, -20037508.34, 20037508.34, 20037508.34], maxResolution: 38.21851413574219,
maxResolution: 156543.0339, numZoomLevels: 8,
numZoomLevels: 20, tileManager: new OpenLayers.TileManager(),
controls: [ controls: [
new OpenLayers.Control.Navigation({ new OpenLayers.Control.Navigation(),
mouseWheelOptions: {
cumulative: false,
interval: 20
},
dragPanOptions: {
enableKinetic: {
deceleration: 0.02
}
},
zoomBoxEnabled: false
}),
new OpenLayers.Control.Attribution(), new OpenLayers.Control.Attribution(),
zoomPanel, zoomPanel,
layerPanel layerPanel
@@ -121,6 +114,15 @@ var map;
// update anchor for permalinks // update anchor for permalinks
var ctr = map.getCenter(); var ctr = map.getCenter();
window.location.hash = "x="+ctr.lon+"&y="+ctr.lat+"&z="+map.getZoom(); window.location.hash = "x="+ctr.lon+"&y="+ctr.lat+"&z="+map.getZoom();
// switch to OSM when outside Vienna
if (!map.getExtent().intersectsBounds(fmzk.tileFullExtent)) {
if (map.baseLayer !== osm) {
map.addLayer(osm);
map.setBaseLayer(osm);
}
} else if (map.baseLayer === osm) {
map.removeLayer(osm);
}
} }
} }
}); });
@@ -132,14 +134,11 @@ var map;
// Defaults for the WMTS layers // Defaults for the WMTS layers
var defaults = { var defaults = {
zoomOffset: 12,
requestEncoding: "REST", requestEncoding: "REST",
matrixSet: "google3857", matrixSet: "google3857",
attribution: 'Datenquelle: Stadt Wien - <a href="http://data.wien.gv.at">data.wien.gv.at</a>' attribution: 'Datenquelle: Stadt Wien - <a href="http://data.wien.gv.at">data.wien.gv.at</a>'
}; };
// No fade transitions on Android 4, because they are buggy
if (/Android 4\.0.*Safari\/.*/.test(navigator.userAgent)) {
defaults.className = "nofade";
}
// The WMTS layers we're going to add // The WMTS layers we're going to add
var fmzk, aerial, labels; var fmzk, aerial, labels;
@@ -163,13 +162,13 @@ var map;
var doc = request.responseText, var doc = request.responseText,
caps = format.read(doc); caps = format.read(doc);
fmzk = format.createLayer(caps, OpenLayers.Util.applyDefaults( fmzk = format.createLayer(caps, OpenLayers.Util.applyDefaults(
{layer:"fmzk", requestEncoding:"REST", transitionEffect:"resize"}, defaults {layer:"fmzk"}, defaults
)); ));
aerial = format.createLayer(caps, OpenLayers.Util.applyDefaults( aerial = format.createLayer(caps, OpenLayers.Util.applyDefaults(
{layer:"lb", requestEncoding:"REST", transitionEffect:"resize"}, defaults {layer:"lb"}, defaults
)); ));
labels = format.createLayer(caps, OpenLayers.Util.applyDefaults( labels = format.createLayer(caps, OpenLayers.Util.applyDefaults(
{layer:"beschriftung", requestEncoding:"REST", className:"nofade", isBaseLayer: false}, {layer:"beschriftung", isBaseLayer: false, transitionEffect: 'map-resize'},
defaults defaults
)); ));
map.addLayers([fmzk, aerial, labels]); map.addLayers([fmzk, aerial, labels]);
@@ -185,26 +184,41 @@ var map;
var extent = new OpenLayers.Bounds(1799448.394855, 6124949.74777, 1848250.442089, 6162571.828177); var extent = new OpenLayers.Bounds(1799448.394855, 6124949.74777, 1848250.442089, 6162571.828177);
defaults.tileFullExtent = extent; defaults.tileFullExtent = extent;
fmzk = new OpenLayers.Layer.WMTS(OpenLayers.Util.applyDefaults({ fmzk = new OpenLayers.Layer.WMTS(OpenLayers.Util.applyDefaults({
url: "http://maps.wien.gv.at/wmts/fmzk/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpeg", url: [
"http://maps.wien.gv.at/wmts/fmzk/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpeg",
"http://maps1.wien.gv.at/wmts/fmzk/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpeg",
"http://maps2.wien.gv.at/wmts/fmzk/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpeg",
"http://maps3.wien.gv.at/wmts/fmzk/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpeg",
"http://maps4.wien.gv.at/wmts/fmzk/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpeg"
],
layer: "fmzk", layer: "fmzk",
style: "pastell", style: "pastell"
transitionEffect: "resize"
}, },
defaults)); defaults));
aerial = new OpenLayers.Layer.WMTS(OpenLayers.Util.applyDefaults({ aerial = new OpenLayers.Layer.WMTS(OpenLayers.Util.applyDefaults({
url: "http://maps.wien.gv.at/wmts/lb/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpeg", url: [
"http://maps.wien.gv.at/wmts/lb/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpeg",
"http://maps1.wien.gv.at/wmts/lb/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpeg",
"http://maps2.wien.gv.at/wmts/lb/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpeg",
"http://maps3.wien.gv.at/wmts/lb/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpeg",
"http://maps4.wien.gv.at/wmts/lb/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpeg"
],
layer: "lb", layer: "lb",
style: "farbe", style: "farbe"
transitionEffect: "resize"
}, },
defaults)); defaults));
labels = new OpenLayers.Layer.WMTS(OpenLayers.Util.applyDefaults({ labels = new OpenLayers.Layer.WMTS(OpenLayers.Util.applyDefaults({
url: "http://maps.wien.gv.at/wmts/beschriftung/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.png", url: [
"http://maps.wien.gv.at/wmts/beschriftung/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.png",
"http://maps1.wien.gv.at/wmts/beschriftung/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.png",
"http://maps2.wien.gv.at/wmts/beschriftung/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.png",
"http://maps3.wien.gv.at/wmts/beschriftung/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.png",
"http://maps4.wien.gv.at/wmts/beschriftung/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.png"
],
layer: "beschriftung", layer: "beschriftung",
style: "normal", style: "normal",
transitionEffect: null,
isBaseLayer: false, isBaseLayer: false,
className: "nofade" transitionEffect: 'map-resize'
}, },
defaults)); defaults));
map.addLayers([fmzk, aerial, labels]); map.addLayers([fmzk, aerial, labels]);

View File

@@ -1,5 +1,5 @@
<!DOCTYPE html> <!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" debug="true"> <html>
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
@@ -7,20 +7,31 @@
<title>MousePosition Control</title> <title>MousePosition Control</title>
<link rel="stylesheet" href="../theme/default/style.css" type="text/css"> <link rel="stylesheet" href="../theme/default/style.css" type="text/css">
<link rel="stylesheet" href="style.css" type="text/css"> <link rel="stylesheet" href="style.css" type="text/css">
<script src="../lib/OpenLayers.js"></script> <script src="../lib/OpenLayers.js" type="text/javascript"></script>
<script type="text/javascript"> <script type="text/javascript">
var map; var map;
function init(){ function init(){
var map = new OpenLayers.Map('map'); var map = new OpenLayers.Map('map');
map.addControl(new OpenLayers.Control.MousePosition()); map.addControl(
new OpenLayers.Control.MousePosition({
prefix: '<a target="_blank" ' +
'href="http://spatialreference.org/ref/epsg/4326/">' +
'EPSG:4326</a> coordinates: ',
separator: ' | ',
numDigits: 2,
emptyString: 'Mouse is not over map.'
})
);
var ol_wms = new OpenLayers.Layer.WMS( "OpenLayers WMS", var ol_wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://vmap0.tiles.osgeo.org/wms/vmap0", "http://vmap0.tiles.osgeo.org/wms/vmap0",
{layers: 'basic'} ); {layers: 'basic'} );
map.addLayers([ol_wms]); map.addLayers([ol_wms]);
if (!map.getCenter()) map.zoomToMaxExtent(); if (!map.getCenter()) {
map.zoomToMaxExtent();
}
map.events.register("mousemove", map, function(e) { map.events.register("mousemove", map, function(e) {
var position = this.events.getMousePosition(e); var position = this.events.getMousePosition(e);
@@ -29,19 +40,28 @@
} }
</script> </script>
</head> </head>
<body onload="init()"> <body onload="init();">
<h1 id="title">MousePosition Control</h1> <h1 id="title">MousePosition Control</h1>
<div id="tags"> <div id="tags">
coordinate coordinate
</div> </div>
<p id="shortdesc"> <p id="shortdesc">
Use the MousePosition Control to display the coordinates of the cursor Use the MousePosition Control to display the coordinates of the cursor
inside or outside the map div. inside or outside the map div.
</p> </p>
<div id="map" class="smallmap"></div> <div id="map" class="smallmap"></div>
<div id="coords"></div> <div id="coords" style="height: 1.5em;"></div>
<p>Moving your mouse to the upper left corner of this map should return <p>
'x=0,y=0' -- in the past, it didn't in IE. If it returns 2,2, consider it a This example also shows how to use the the "prefix", "separator" and
bug, and report it.</p> "numDigits" options to customize the output of the MousePosition-Control.
By also setting the "emptyString"-property, the contents of the controls
element are resetted to the given string when the mouse isn't above the
map.
</p>
<p>
Moving your mouse to the upper left corner of this map should return
'x=0,y=0' (pixel coordinates) -- in the past, it didn't in IE. If it
returns 'x=2,y=2', consider it a bug, and report it.
</p>
</body> </body>
</html> </html>

View File

@@ -6,7 +6,6 @@
<meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-capable" content="yes">
<title>OpenLayers OSM and Google Example</title> <title>OpenLayers OSM and Google Example</title>
<link rel="stylesheet" href="../theme/default/style.css" type="text/css"> <link rel="stylesheet" href="../theme/default/style.css" type="text/css">
<link rel="stylesheet" href="../theme/default/google.css" type="text/css">
<link rel="stylesheet" href="style.css" type="text/css"> <link rel="stylesheet" href="style.css" type="text/css">
<script src="http://maps.google.com/maps/api/js?v=3&amp;sensor=false"></script> <script src="http://maps.google.com/maps/api/js?v=3&amp;sensor=false"></script>
<script src="../lib/OpenLayers.js"></script> <script src="../lib/OpenLayers.js"></script>

View File

@@ -0,0 +1,32 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta name="apple-mobile-web-app-capable" content="yes">
<title>OpenLayers OSM and Google Example</title>
<link rel="stylesheet" href="../theme/default/style.css" type="text/css">
<link rel="stylesheet" href="style.css" type="text/css">
<script src="../lib/OpenLayers.js"></script>
<script src="osm-marker-popup.js"></script>
</head>
<body onload="init()">
<h1 id="title">OSM with Marker and Popup</h1>
<p id="shortdesc">
Demonstrate use of an OSM layer with a marker and a popup.
</p>
<div id="tags">
openstreetmap osm marker popup
</div>
<div id="map" class="smallmap"></div>
<div id="docs">
<p>
A common use case for OpenLayers is to display a marker at a
location on the map, and add some information in a popup. It
is also easy to add a tooltip with a short description.
See the <a href="osm-marker-popup.js" target="_blank">
osm-marker-popup.js source</a> to see how this is done.
</p>
</div>
</body>
</html>

View File

@@ -0,0 +1,39 @@
var map;
function init() {
// The overlay layer for our marker, with a simple diamond as symbol
var overlay = new OpenLayers.Layer.Vector('Overlay', {
styleMap: new OpenLayers.StyleMap({
externalGraphic: '../img/marker.png',
graphicWidth: 20, graphicHeight: 24, graphicYOffset: -24,
title: '${tooltip}'
})
});
// The location of our marker and popup. We usually think in geographic
// coordinates ('EPSG:4326'), but the map is projected ('EPSG:3857').
var myLocation = new OpenLayers.Geometry.Point(10.2, 48.9)
.transform('EPSG:4326', 'EPSG:3857');
// We add the marker with a tooltip text to the overlay
overlay.addFeatures([
new OpenLayers.Feature.Vector(myLocation, {tooltip: 'OpenLayers'})
]);
// A popup with some information about our location
var popup = new OpenLayers.Popup.FramedCloud("Popup",
myLocation.getBounds().getCenterLonLat(), null,
'<a target="_blank" href="http://openlayers.org/">We</a> ' +
'could be here.<br>Or elsewhere.', null,
true // <-- true if we want a close (X) button, false otherwise
);
// Finally we create the map
map = new OpenLayers.Map({
div: "map", projection: "EPSG:3857",
layers: [new OpenLayers.Layer.OSM(), overlay],
center: myLocation.getBounds().getCenterLonLat(), zoom: 15
});
// and add the popup to it.
map.addPopup(popup);
}

View File

@@ -0,0 +1,41 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta name="apple-mobile-web-app-capable" content="yes">
<title>Switch between polar projections</title>
<link rel="stylesheet" href="../theme/default/style.css" type="text/css">
<link rel="stylesheet" href="style.css" type="text/css">
<script type="text/javascript" src="http://svn.osgeo.org/metacrs/proj4js/trunk/lib/proj4js-compressed.js"></script>
<script type="text/javascript" src="http://spatialreference.org/ref/epsg/3574/proj4js/"></script>
<script type="text/javascript" src="http://spatialreference.org/ref/epsg/3576/proj4js/"></script>
<script type="text/javascript" src="http://spatialreference.org/ref/epsg/3571/proj4js/"></script>
<script type="text/javascript" src="http://spatialreference.org/ref/epsg/3573/proj4js/"></script>
<script type="text/javascript" src="../lib/OpenLayers.js"></script>
<script type="text/javascript" src="polar-projections.js"></script>
</head>
<body onload="init()">
<h1 id="title">Polar Projections WMS Example</h1>
<div id="tags">
switch projections polar
</div>
<div id="shortdesc">Switch between different projections</div>
<div id="map" class="smallmap" style="height:512px"></div>
<button id='epsg3574'>EPSG:3574</button>
<button id='epsg3576'>EPSG:3576</button>
<button id='epsg3571'>EPSG:3571</button>
<button id='epsg3573'>EPSG:3573</button>
<div id="docs">
<p>This example shows how to switch between different projections,
maintaining the center and resolution.</p>
<p>Click the buttons above to try it, and see
<a href='polar-projections.js'>polar-projections.js</a> for the
source code.</p>
</div>
</body>
</html>

View File

@@ -0,0 +1,84 @@
var map, layer, overlay;
var projectionOptions = {
'EPSG:3574': {
projection: new OpenLayers.Projection('EPSG:3574'),
units: 'm',
maxExtent: new OpenLayers.Bounds(-5505054, -5505054, 5505054, 5505054),
maxResolution: 5505054 / 128,
numZoomLevels: 18
},
'EPSG:3576': {
projection: new OpenLayers.Projection('EPSG:3576'),
units: 'm',
maxExtent: new OpenLayers.Bounds(-5505054, -5505054, 5505054, 5505054),
maxResolution: 5505054 / 128,
numZoomLevels: 18
},
'EPSG:3571': {
projection: new OpenLayers.Projection('EPSG:3571'),
units: 'm',
maxExtent: new OpenLayers.Bounds(-5505054, -5505054, 5505054, 5505054),
maxResolution: 5505054 / 128,
numZoomLevels: 18
},
'EPSG:3573': {
projection: new OpenLayers.Projection('EPSG:3573'),
units: 'm',
maxExtent: new OpenLayers.Bounds(-5505054, -5505054, 5505054, 5505054),
maxResolution: 5505054 / 128,
numZoomLevels: 18
}
};
function setProjection() {
projCode = this.innerHTML;
var oldExtent = map.getExtent();
var oldCenter = map.getCenter();
var oldProjection = map.getProjectionObject();
// map projection is controlled by the base layer
map.baseLayer.addOptions(projectionOptions[projCode]);
// with the base layer updated, the map has the new projection now
var newProjection = map.getProjectionObject();
// transform the center of the old projection, not the extent
map.setCenter(
oldCenter.transform(oldProjection, newProjection,
map.getZoomForExtent(oldExtent.transform(oldProjection, newProjection))
));
for (var i=map.layers.length-1; i>=0; --i) {
// update grid settings
map.layers[i].addOptions(projectionOptions[projCode]);
// redraw layer - just in case center and zoom are the same in old and
// new projection
map.layers[i].redraw();
}
}
function init() {
map = new OpenLayers.Map('map');
layer = new OpenLayers.Layer.WMS(
'world',
'http://v2.suite.opengeo.org/geoserver/wms',
{layers: 'world', version: '1.1.1'},
projectionOptions['EPSG:3574']
);
overlay = new OpenLayers.Layer.WMS(
'world',
'http://v2.suite.opengeo.org/geoserver/wms',
{transparent: 'true', layers: 'world:borders', styles: 'line'},
projectionOptions['EPSG:3574']
);
overlay.isBaseLayer = false;
map.addLayers([layer, overlay]);
map.zoomToMaxExtent();
// add behaviour to dom elements
document.getElementById('epsg3574').onclick = setProjection;
document.getElementById('epsg3576').onclick = setProjection;
document.getElementById('epsg3571').onclick = setProjection;
document.getElementById('epsg3573').onclick = setProjection;
}

View File

@@ -17,6 +17,10 @@
right: inherit; right: inherit;
width: 400px; width: 400px;
} }
/* conditionally position control differently for Google Maps */
.olForeignContainer div.olControlMousePosition {
bottom: 28px;
}
#map { #map {
height: 512px; height: 512px;
} }
@@ -38,7 +42,12 @@
</p> </p>
<div id="map" class="smallmap"></div> <div id="map" class="smallmap"></div>
<div id="docs"></div> <div id="docs">
<p>Note that maps with Google layers are a special case, because we
cannot control the position of the attribution. To conditionally
position controls differently for Google layers, prepend the
css selector with <code>.olForeignContainer</code>.</p>
</div>
<script type="text/javascript"> <script type="text/javascript">
var map = new OpenLayers.Map({ var map = new OpenLayers.Map({

View File

@@ -37,10 +37,8 @@
function init() { function init() {
map = new OpenLayers.Map('map'); map = new OpenLayers.Map('map');
var base = new OpenLayers.Layer.WMS("OpenLayers WMS", var base = new OpenLayers.Layer.WMS("OpenLayers WMS",
["http://t3.tilecache.osgeo.org/wms-c/Basic.py", "http://vmap0.tiles.osgeo.org/wms/vmap0",
"http://t2.tilecache.osgeo.org/wms-c/Basic.py", {layers: 'basic'}
"http://t1.tilecache.osgeo.org/wms-c/Basic.py"],
{layers: 'satellite'}
); );
var style = new OpenLayers.Style({ var style = new OpenLayers.Style({

View File

@@ -87,7 +87,8 @@
gml3: new OpenLayers.Format.GML.v3(gmlOptionsIn), gml3: new OpenLayers.Format.GML.v3(gmlOptionsIn),
kml: new OpenLayers.Format.KML(kmlOptionsIn), kml: new OpenLayers.Format.KML(kmlOptionsIn),
atom: new OpenLayers.Format.Atom(in_options), atom: new OpenLayers.Format.Atom(in_options),
gpx: new OpenLayers.Format.GPX(in_options) gpx: new OpenLayers.Format.GPX(in_options),
encoded_polyline: new OpenLayers.Format.EncodedPolyline(in_options)
}, },
'out': { 'out': {
wkt: new OpenLayers.Format.WKT(out_options), wkt: new OpenLayers.Format.WKT(out_options),
@@ -97,7 +98,8 @@
gml3: new OpenLayers.Format.GML.v3(gmlOptionsOut), gml3: new OpenLayers.Format.GML.v3(gmlOptionsOut),
kml: new OpenLayers.Format.KML(out_options), kml: new OpenLayers.Format.KML(out_options),
atom: new OpenLayers.Format.Atom(out_options), atom: new OpenLayers.Format.Atom(out_options),
gpx: new OpenLayers.Format.GPX(out_options) gpx: new OpenLayers.Format.GPX(out_options),
encoded_polyline: new OpenLayers.Format.EncodedPolyline(out_options)
} }
}; };
} }
@@ -202,6 +204,7 @@
<option value="gml3">GML (v3)</option> <option value="gml3">GML (v3)</option>
<option value="wkt">Well-Known Text (WKT)</option> <option value="wkt">Well-Known Text (WKT)</option>
<option value="gpx">GPX</option> <option value="gpx">GPX</option>
<option value="encoded_polyline">Encoded Polyline</option>
</select> </select>
&nbsp; &nbsp;
<label for="prettyPrint">Pretty print</label> <label for="prettyPrint">Pretty print</label>

View File

@@ -22,7 +22,8 @@
<div id="docs"> <div id="docs">
<p> <p>
This example shows the basic use of a vector layer with the This example shows the basic use of a vector layer with the
WFS protocol. WFS protocol, and shows how to switch between a WMS and a vector
layer at a certain scale.
</p> </p>
<p> <p>
See the <a href="wfs-states.js" target="_blank">wfs-states.js See the <a href="wfs-states.js" target="_blank">wfs-states.js

View File

@@ -13,7 +13,13 @@ function init() {
"http://vmap0.tiles.osgeo.org/wms/vmap0", "http://vmap0.tiles.osgeo.org/wms/vmap0",
{layers: "basic"} {layers: "basic"}
), ),
new OpenLayers.Layer.WMS("States WMS",
"http://demo.opengeo.org/geoserver/wms",
{layers: "topp:states", format: "image/png", transparent: true},
{maxScale: 15000000}
),
new OpenLayers.Layer.Vector("States", { new OpenLayers.Layer.Vector("States", {
minScale: 15000000,
strategies: [new OpenLayers.Strategy.BBOX()], strategies: [new OpenLayers.Strategy.BBOX()],
protocol: new OpenLayers.Protocol.WFS({ protocol: new OpenLayers.Protocol.WFS({
url: "http://demo.opengeo.org/geoserver/wfs", url: "http://demo.opengeo.org/geoserver/wfs",

View File

@@ -1,4 +1,4 @@
OpenLayers.ProxyHost = "/proxy/?url="; OpenLayers.ProxyHost = "proxy.cgi/?url=";
var map, format; var map, format;
@@ -55,5 +55,4 @@ function init() {
map.addLayer(osm); map.addLayer(osm);
map.addControl(new OpenLayers.Control.LayerSwitcher()); map.addControl(new OpenLayers.Control.LayerSwitcher());
map.setCenter(new OpenLayers.LonLat(-13677832, 5213272), 13); map.setCenter(new OpenLayers.LonLat(-13677832, 5213272), 13);
} }

31
examples/wps-client.html Normal file
View File

@@ -0,0 +1,31 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta name="apple-mobile-web-app-capable" content="yes">
<title>OpenLayers WPS Client Example</title>
<link rel="stylesheet" href="../theme/default/style.css" type="text/css">
<link rel="stylesheet" href="style.css" type="text/css">
<script src="../lib/OpenLayers.js"></script>
<script src="wps-client.js"></script>
</head>
<body onload="init()">
<h1 id="title">WPS Client Example</h1>
<div id="tags">
wps
</div>
<div id="shortdesc">Shows the usage of the WPS Client</div>
<div id="map" class="smallmap"></div>
<div id="docs">
<p>This example shows how simple it is to use the WPS Client. It
buffers an intersection of a geometry and a feature, which is
accomplished by chaining two processes. See
<a href="wps-client.js">wps-client.js</a> to see how this is done.</p>
</div>
</body>
</html>

75
examples/wps-client.js Normal file
View File

@@ -0,0 +1,75 @@
OpenLayers.ProxyHost = 'proxy.cgi?url=';
var map, client, intersect, buffer;
function init() {
map = new OpenLayers.Map('map', {
allOverlays: true,
center: [114, 16],
zoom: 4,
layers: [new OpenLayers.Layer.Vector()]
});
var features = [new OpenLayers.Feature.Vector(OpenLayers.Geometry.fromWKT(
'LINESTRING(117 22,112 18,118 13, 115 8)'
))];
var geometry = OpenLayers.Geometry.fromWKT(
'POLYGON((110 20,120 20,120 10,110 10,110 20),(112 17,118 18,118 16,112 15,112 17))'
);
map.baseLayer.addFeatures(features);
map.baseLayer.addFeatures([new OpenLayers.Feature.Vector(geometry)]);
client = new OpenLayers.WPSClient({
servers: {
opengeo: 'http://demo.opengeo.org/geoserver/wps'
}
});
// Create a process and configure it
intersect = client.getProcess('opengeo', 'JTS:intersection');
intersect.configure({
// spatial input can be a feature or a geometry or an array of
// features or geometries
inputs: {
a: features,
b: geometry
}
});
// Create another process which chains the previous one and execute it
buffer = client.getProcess('opengeo', 'JTS:buffer');
buffer.execute({
inputs: {
geom: intersect.output(),
distance: 1
},
success: function(outputs) {
// outputs.result is a feature or an array of features for spatial
// processes.
map.baseLayer.addFeatures(outputs.result);
}
});
// Instead of creating a process and executing it, we could call execute on
// the client directly if we are only dealing with a single process:
/*
client.execute({
server: "opengeo",
process: "JTS:intersection",
// spatial input can be a feature or a geometry or an array of
// features or geometries
inputs: {
a: features,
b: geometry
},
success: function(outputs) {
// outputs.result is a feature or an array of features for spatial
// processes.
map.baseLayer.addFeatures(outputs.result);
}
});
*/
}

View File

@@ -50,7 +50,9 @@
<p>This example shows WPS in action by using the WPSCapabilities, <p>This example shows WPS in action by using the WPSCapabilities,
WPSDescribeProcess and WPSExecute formats. See WPSDescribeProcess and WPSExecute formats. See
<a target="_blank" href="wps.js">wps.js</a> for the <a target="_blank" href="wps.js">wps.js</a> for the
source code.</p> source code. <b>Note: For applications using WPS, the high level
approach shown in the <a href="wps-client.html">wps-client</a> example
is recommended instead.</b></p>
<ol> <ol>
<li>Select a process from the list below the map. The list is <li>Select a process from the list below the map. The list is
populated with the result of a WPS GetCapabilities request, parsed populated with the result of a WPS GetCapabilities request, parsed

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license. * full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the * See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */ * full text of the license. */
@@ -132,6 +132,7 @@
jsFiles = [ jsFiles = [
"OpenLayers/BaseTypes/Class.js", "OpenLayers/BaseTypes/Class.js",
"OpenLayers/Util.js", "OpenLayers/Util.js",
"OpenLayers/Util/vendorPrefix.js",
"OpenLayers/Animation.js", "OpenLayers/Animation.js",
"OpenLayers/BaseTypes.js", "OpenLayers/BaseTypes.js",
"OpenLayers/BaseTypes/Bounds.js", "OpenLayers/BaseTypes/Bounds.js",
@@ -143,10 +144,9 @@
"OpenLayers/Console.js", "OpenLayers/Console.js",
"OpenLayers/Tween.js", "OpenLayers/Tween.js",
"OpenLayers/Kinetic.js", "OpenLayers/Kinetic.js",
"Rico/Corner.js",
"Rico/Color.js",
"OpenLayers/Events.js", "OpenLayers/Events.js",
"OpenLayers/Events/buttonclick.js", "OpenLayers/Events/buttonclick.js",
"OpenLayers/Events/featureclick.js",
"OpenLayers/Request.js", "OpenLayers/Request.js",
"OpenLayers/Request/XMLHttpRequest.js", "OpenLayers/Request/XMLHttpRequest.js",
"OpenLayers/Projection.js", "OpenLayers/Projection.js",
@@ -190,7 +190,6 @@
"OpenLayers/Layer/Zoomify.js", "OpenLayers/Layer/Zoomify.js",
"OpenLayers/Layer/ArcGISCache.js", "OpenLayers/Layer/ArcGISCache.js",
"OpenLayers/Popup/Anchored.js", "OpenLayers/Popup/Anchored.js",
"OpenLayers/Popup/AnchoredBubble.js",
"OpenLayers/Popup/Framed.js", "OpenLayers/Popup/Framed.js",
"OpenLayers/Popup/FramedCloud.js", "OpenLayers/Popup/FramedCloud.js",
"OpenLayers/Feature.js", "OpenLayers/Feature.js",
@@ -305,6 +304,7 @@
"OpenLayers/Format/GML/v2.js", "OpenLayers/Format/GML/v2.js",
"OpenLayers/Format/GML/v3.js", "OpenLayers/Format/GML/v3.js",
"OpenLayers/Format/Atom.js", "OpenLayers/Format/Atom.js",
"OpenLayers/Format/EncodedPolyline.js",
"OpenLayers/Format/KML.js", "OpenLayers/Format/KML.js",
"OpenLayers/Format/GeoRSS.js", "OpenLayers/Format/GeoRSS.js",
"OpenLayers/Format/WFS.js", "OpenLayers/Format/WFS.js",
@@ -312,6 +312,10 @@
"OpenLayers/Format/OWSCommon/v1.js", "OpenLayers/Format/OWSCommon/v1.js",
"OpenLayers/Format/OWSCommon/v1_0_0.js", "OpenLayers/Format/OWSCommon/v1_0_0.js",
"OpenLayers/Format/OWSCommon/v1_1_0.js", "OpenLayers/Format/OWSCommon/v1_1_0.js",
"OpenLayers/Format/WCSCapabilities.js",
"OpenLayers/Format/WCSCapabilities/v1.js",
"OpenLayers/Format/WCSCapabilities/v1_0_0.js",
"OpenLayers/Format/WCSCapabilities/v1_1_0.js",
"OpenLayers/Format/WFSCapabilities.js", "OpenLayers/Format/WFSCapabilities.js",
"OpenLayers/Format/WFSCapabilities/v1.js", "OpenLayers/Format/WFSCapabilities/v1.js",
"OpenLayers/Format/WFSCapabilities/v1_0_0.js", "OpenLayers/Format/WFSCapabilities/v1_0_0.js",
@@ -393,7 +397,10 @@
"OpenLayers/Symbolizer/Raster.js", "OpenLayers/Symbolizer/Raster.js",
"OpenLayers/Lang.js", "OpenLayers/Lang.js",
"OpenLayers/Lang/en.js", "OpenLayers/Lang/en.js",
"OpenLayers/Spherical.js" "OpenLayers/Spherical.js",
"OpenLayers/TileManager.js",
"OpenLayers/WPSClient.js",
"OpenLayers/WPSProcess.js"
]; // etc. ]; // etc.
} }
@@ -413,5 +420,10 @@
/** /**
* Constant: VERSION_NUMBER * Constant: VERSION_NUMBER
*
* This constant identifies the version of OpenLayers.
*
* When asking questions or reporting issues, make sure to include the output of
* OpenLayers.VERSION_NUMBER in the question or issue-description.
*/ */
OpenLayers.VERSION_NUMBER="Release 2.12-rc7"; OpenLayers.VERSION_NUMBER="Release 2.13-rc5";

View File

@@ -1,10 +1,11 @@
/** /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license. * full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the * See license.txt in the OpenLayers distribution or repository for the
* full text of the license. * full text of the license. */
*
/**
* @requires OpenLayers/SingleFile.js * @requires OpenLayers/SingleFile.js
* @requires OpenLayers/Util/vendorPrefix.js
*/ */
/** /**
@@ -19,11 +20,8 @@ OpenLayers.Animation = (function(window) {
* Property: isNative * Property: isNative
* {Boolean} true if a native requestAnimationFrame function is available * {Boolean} true if a native requestAnimationFrame function is available
*/ */
var isNative = !!(window.requestAnimationFrame || var requestAnimationFrame = OpenLayers.Util.vendorPrefix.js(window, "requestAnimationFrame");
window.webkitRequestAnimationFrame || var isNative = !!(requestAnimationFrame);
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame);
/** /**
* Function: requestFrame * Function: requestFrame
@@ -36,11 +34,7 @@ OpenLayers.Animation = (function(window) {
* element - {DOMElement} Optional element that visually bounds the animation. * element - {DOMElement} Optional element that visually bounds the animation.
*/ */
var requestFrame = (function() { var requestFrame = (function() {
var request = window.requestAnimationFrame || var request = window[requestAnimationFrame] ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||
function(callback, element) { function(callback, element) {
window.setTimeout(callback, 16); window.setTimeout(callback, 16);
}; };

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license. * full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the * See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */ * full text of the license. */
@@ -127,7 +127,9 @@ OpenLayers.String = {
if (i == 0) { if (i == 0) {
replacement = context; replacement = context;
} }
if (replacement === undefined) {
break;
}
replacement = replacement[subs[i]]; replacement = replacement[subs[i]];
} }
@@ -295,6 +297,24 @@ OpenLayers.Number = {
str = integer + dsep + rem; str = integer + dsep + rem;
} }
return str; return str;
},
/**
* Method: zeroPad
* Create a zero padded string optionally with a radix for casting numbers.
*
* Parameters:
* num - {Number} The number to be zero padded.
* len - {Number} The length of the string to be returned.
* radix - {Number} An integer between 2 and 36 specifying the base to use
* for representing numeric values.
*/
zeroPad: function(num, len, radix) {
var str = num.toString(radix || 10);
while (str.length < len) {
str = "0" + str;
}
return str;
} }
}; };

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license. * full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the * See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */ * full text of the license. */
@@ -63,7 +63,7 @@ OpenLayers.Bounds = OpenLayers.Class({
* left - {Number} The left bounds of the box. Note that for width * left - {Number} The left bounds of the box. Note that for width
* calculations, this is assumed to be less than the right value. * calculations, this is assumed to be less than the right value.
* bottom - {Number} The bottom bounds of the box. Note that for height * bottom - {Number} The bottom bounds of the box. Note that for height
* calculations, this is assumed to be more than the top value. * calculations, this is assumed to be less than the top value.
* right - {Number} The right bounds. * right - {Number} The right bounds.
* top - {Number} The top bounds. * top - {Number} The top bounds.
* *
@@ -128,6 +128,7 @@ OpenLayers.Bounds = OpenLayers.Class({
/** /**
* APIMethod: toString * APIMethod: toString
* Returns a string representation of the bounds object.
* *
* Returns: * Returns:
* {String} String representation of bounds object. * {String} String representation of bounds object.
@@ -138,6 +139,11 @@ OpenLayers.Bounds = OpenLayers.Class({
/** /**
* APIMethod: toArray * APIMethod: toArray
* Returns an array representation of the bounds object.
*
* Returns an array of left, bottom, right, top properties, or -- when the
* optional parameter is true -- an array of the bottom, left, top,
* right properties.
* *
* Parameters: * Parameters:
* reverseAxisOrder - {Boolean} Should we reverse the axis order? * reverseAxisOrder - {Boolean} Should we reverse the axis order?
@@ -155,6 +161,7 @@ OpenLayers.Bounds = OpenLayers.Class({
/** /**
* APIMethod: toBBOX * APIMethod: toBBOX
* Returns a boundingbox-string representation of the bounds object.
* *
* Parameters: * Parameters:
* decimal - {Integer} How many significant digits in the bbox coords? * decimal - {Integer} How many significant digits in the bbox coords?
@@ -163,7 +170,7 @@ OpenLayers.Bounds = OpenLayers.Class({
* *
* Returns: * Returns:
* {String} Simple String representation of bounds object. * {String} Simple String representation of bounds object.
* (e.g. <i>"5,42,10,45"</i>) * (e.g. "5,42,10,45")
*/ */
toBBOX:function(decimal, reverseAxisOrder) { toBBOX:function(decimal, reverseAxisOrder) {
if (decimal== null) { if (decimal== null) {
@@ -202,9 +209,10 @@ OpenLayers.Bounds = OpenLayers.Class({
/** /**
* APIMethod: getWidth * APIMethod: getWidth
* Returns the width of the bounds.
* *
* Returns: * Returns:
* {Float} The width of the bounds * {Float} The width of the bounds (right minus left).
*/ */
getWidth:function() { getWidth:function() {
return (this.right - this.left); return (this.right - this.left);
@@ -212,6 +220,7 @@ OpenLayers.Bounds = OpenLayers.Class({
/** /**
* APIMethod: getHeight * APIMethod: getHeight
* Returns the height of the bounds.
* *
* Returns: * Returns:
* {Float} The height of the bounds (top minus bottom). * {Float} The height of the bounds (top minus bottom).
@@ -222,9 +231,10 @@ OpenLayers.Bounds = OpenLayers.Class({
/** /**
* APIMethod: getSize * APIMethod: getSize
* Returns an <OpenLayers.Size> object of the bounds.
* *
* Returns: * Returns:
* {<OpenLayers.Size>} The size of the box. * {<OpenLayers.Size>} The size of the bounds.
*/ */
getSize:function() { getSize:function() {
return new OpenLayers.Size(this.getWidth(), this.getHeight()); return new OpenLayers.Size(this.getWidth(), this.getHeight());
@@ -232,6 +242,8 @@ OpenLayers.Bounds = OpenLayers.Class({
/** /**
* APIMethod: getCenterPixel * APIMethod: getCenterPixel
* Returns the <OpenLayers.Pixel> object which represents the center of the
* bounds.
* *
* Returns: * Returns:
* {<OpenLayers.Pixel>} The center of the bounds in pixel space. * {<OpenLayers.Pixel>} The center of the bounds in pixel space.
@@ -243,6 +255,8 @@ OpenLayers.Bounds = OpenLayers.Class({
/** /**
* APIMethod: getCenterLonLat * APIMethod: getCenterLonLat
* Returns the <OpenLayers.LonLat> object which represents the center of the
* bounds.
* *
* Returns: * Returns:
* {<OpenLayers.LonLat>} The center of the bounds in map space. * {<OpenLayers.LonLat>} The center of the bounds in map space.
@@ -297,10 +311,23 @@ OpenLayers.Bounds = OpenLayers.Class({
/** /**
* APIMethod: add * APIMethod: add
* Shifts the coordinates of the bound by the given horizontal and vertical
* deltas.
*
* (start code)
* var bounds = new OpenLayers.Bounds(0, 0, 10, 10);
* bounds.toString();
* // => "0,0,10,10"
*
* bounds.add(-1.5, 4).toString();
* // => "-1.5,4,8.5,14"
* (end)
*
* This method will throw a TypeError if it is passed null as an argument.
* *
* Parameters: * Parameters:
* x - {Float} * x - {Float} horizontal delta
* y - {Float} * y - {Float} vertical delta
* *
* Returns: * Returns:
* {<OpenLayers.Bounds>} A new bounds whose coordinates are the same as * {<OpenLayers.Bounds>} A new bounds whose coordinates are the same as
@@ -316,51 +343,77 @@ OpenLayers.Bounds = OpenLayers.Class({
/** /**
* APIMethod: extend * APIMethod: extend
* Extend the bounds to include the point, lonlat, or bounds specified. * Extend the bounds to include the <OpenLayers.LonLat>,
* Note, this function assumes that left < right and bottom < top. * <OpenLayers.Geometry.Point> or <OpenLayers.Bounds> specified.
*
* Please note that this function assumes that left < right and
* bottom < top.
* *
* Parameters: * Parameters:
* object - {Object} Can be LonLat, Point, or Bounds * object - {<OpenLayers.LonLat>, <OpenLayers.Geometry.Point> or
* <OpenLayers.Bounds>} The object to be included in the new bounds
* object.
*/ */
extend:function(object) { extend:function(object) {
var bounds = null;
if (object) { if (object) {
// clear cached center location
switch(object.CLASS_NAME) { switch(object.CLASS_NAME) {
case "OpenLayers.LonLat": case "OpenLayers.LonLat":
bounds = new OpenLayers.Bounds(object.lon, object.lat, this.extendXY(object.lon, object.lat);
object.lon, object.lat);
break; break;
case "OpenLayers.Geometry.Point": case "OpenLayers.Geometry.Point":
bounds = new OpenLayers.Bounds(object.x, object.y, this.extendXY(object.x, object.y);
object.x, object.y);
break; break;
case "OpenLayers.Bounds": case "OpenLayers.Bounds":
bounds = object; // clear cached center location
break; this.centerLonLat = null;
}
if (bounds) { if ( (this.left == null) || (object.left < this.left)) {
this.centerLonLat = null; this.left = object.left;
if ( (this.left == null) || (bounds.left < this.left)) { }
this.left = bounds.left; if ( (this.bottom == null) || (object.bottom < this.bottom) ) {
} this.bottom = object.bottom;
if ( (this.bottom == null) || (bounds.bottom < this.bottom) ) { }
this.bottom = bounds.bottom; if ( (this.right == null) || (object.right > this.right) ) {
} this.right = object.right;
if ( (this.right == null) || (bounds.right > this.right) ) { }
this.right = bounds.right; if ( (this.top == null) || (object.top > this.top) ) {
} this.top = object.top;
if ( (this.top == null) || (bounds.top > this.top) ) { }
this.top = bounds.top; break;
}
} }
} }
}, },
/**
* APIMethod: extendXY
* Extend the bounds to include the XY coordinate specified.
*
* Parameters:
* x - {number} The X part of the the coordinate.
* y - {number} The Y part of the the coordinate.
*/
extendXY:function(x, y) {
// clear cached center location
this.centerLonLat = null;
if ((this.left == null) || (x < this.left)) {
this.left = x;
}
if ((this.bottom == null) || (y < this.bottom)) {
this.bottom = y;
}
if ((this.right == null) || (x > this.right)) {
this.right = x;
}
if ((this.top == null) || (y > this.top)) {
this.top = y;
}
},
/** /**
* APIMethod: containsLonLat * APIMethod: containsLonLat
* Returns whether the bounds object contains the given <OpenLayers.LonLat>.
* *
* Parameters: * Parameters:
* ll - {<OpenLayers.LonLat>|Object} OpenLayers.LonLat or an * ll - {<OpenLayers.LonLat>|Object} OpenLayers.LonLat or an
@@ -399,6 +452,7 @@ OpenLayers.Bounds = OpenLayers.Class({
/** /**
* APIMethod: containsPixel * APIMethod: containsPixel
* Returns whether the bounds object contains the given <OpenLayers.Pixel>.
* *
* Parameters: * Parameters:
* px - {<OpenLayers.Pixel>} * px - {<OpenLayers.Pixel>}
@@ -414,6 +468,7 @@ OpenLayers.Bounds = OpenLayers.Class({
/** /**
* APIMethod: contains * APIMethod: contains
* Returns whether the bounds object contains the given x and y.
* *
* Parameters: * Parameters:
* x - {Float} * x - {Float}
@@ -535,7 +590,7 @@ OpenLayers.Bounds = OpenLayers.Class({
/** /**
* APIMethod: containsBounds * APIMethod: containsBounds
* Determine whether the target bounds is contained within this bounds. * Returns whether the bounds object contains the given <OpenLayers.Bounds>.
* *
* bounds - {<OpenLayers.Bounds>} The target bounds. * bounds - {<OpenLayers.Bounds>} The target bounds.
* partial - {Boolean} If any of the target corners is within this bounds * partial - {Boolean} If any of the target corners is within this bounds
@@ -565,6 +620,8 @@ OpenLayers.Bounds = OpenLayers.Class({
/** /**
* APIMethod: determineQuadrant * APIMethod: determineQuadrant
* Returns the the quadrant ("br", "tr", "tl", "bl") in which the given
* <OpenLayers.LonLat> lies.
* *
* Parameters: * Parameters:
* lonlat - {<OpenLayers.LonLat>} * lonlat - {<OpenLayers.LonLat>}
@@ -615,6 +672,7 @@ OpenLayers.Bounds = OpenLayers.Class({
/** /**
* APIMethod: wrapDateLine * APIMethod: wrapDateLine
* Wraps the bounds object around the dateline.
* *
* Parameters: * Parameters:
* maxExtent - {<OpenLayers.Bounds>} * maxExtent - {<OpenLayers.Bounds>}
@@ -681,10 +739,16 @@ OpenLayers.Bounds = OpenLayers.Class({
/** /**
* APIFunction: fromString * APIFunction: fromString
* Alternative constructor that builds a new OpenLayers.Bounds from a * Alternative constructor that builds a new OpenLayers.Bounds from a
* parameter string * parameter string.
*
* (begin code)
* OpenLayers.Bounds.fromString("5,42,10,45");
* // => equivalent to ...
* new OpenLayers.Bounds(5, 42, 10, 45);
* (end)
* *
* Parameters: * Parameters:
* str - {String}Comma-separated bounds string. (e.g. <i>"5,42,10,45"</i>) * str - {String} Comma-separated bounds string. (e.g. "5,42,10,45")
* reverseAxisOrder - {Boolean} Does the string use reverse axis order? * reverseAxisOrder - {Boolean} Does the string use reverse axis order?
* *
* Returns: * Returns:
@@ -698,11 +762,16 @@ OpenLayers.Bounds.fromString = function(str, reverseAxisOrder) {
/** /**
* APIFunction: fromArray * APIFunction: fromArray
* Alternative constructor that builds a new OpenLayers.Bounds * Alternative constructor that builds a new OpenLayers.Bounds from an array.
* from an array *
* (begin code)
* OpenLayers.Bounds.fromArray( [5, 42, 10, 45] );
* // => equivalent to ...
* new OpenLayers.Bounds(5, 42, 10, 45);
* (end)
* *
* Parameters: * Parameters:
* bbox - {Array(Float)} Array of bounds values (e.g. <i>[5,42,10,45]</i>) * bbox - {Array(Float)} Array of bounds values (e.g. [5,42,10,45])
* reverseAxisOrder - {Boolean} Does the array use reverse axis order? * reverseAxisOrder - {Boolean} Does the array use reverse axis order?
* *
* Returns: * Returns:
@@ -716,12 +785,17 @@ OpenLayers.Bounds.fromArray = function(bbox, reverseAxisOrder) {
/** /**
* APIFunction: fromSize * APIFunction: fromSize
* Alternative constructor that builds a new OpenLayers.Bounds * Alternative constructor that builds a new OpenLayers.Bounds from a size.
* from a size *
* (begin code)
* OpenLayers.Bounds.fromSize( new OpenLayers.Size(10, 20) );
* // => equivalent to ...
* new OpenLayers.Bounds(0, 20, 10, 0);
* (end)
* *
* Parameters: * Parameters:
* size - {<OpenLayers.Size>|Object} OpenLayers.Size or an object with * size - {<OpenLayers.Size> or Object} <OpenLayers.Size> or an object with
* a 'w' and 'h' properties. * both 'w' and 'h' properties.
* *
* Returns: * Returns:
* {<OpenLayers.Bounds>} New bounds object built from the passed-in size. * {<OpenLayers.Bounds>} New bounds object built from the passed-in size.
@@ -737,6 +811,14 @@ OpenLayers.Bounds.fromSize = function(size) {
* Function: oppositeQuadrant * Function: oppositeQuadrant
* Get the opposite quadrant for a given quadrant string. * Get the opposite quadrant for a given quadrant string.
* *
* (begin code)
* OpenLayers.Bounds.oppositeQuadrant( "tl" );
* // => "br"
*
* OpenLayers.Bounds.oppositeQuadrant( "tr" );
* // => "bl"
* (end)
*
* Parameters: * Parameters:
* quadrant - {String} two character quadrant shortstring * quadrant - {String} two character quadrant shortstring
* *

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license. * full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the * See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */ * full text of the license. */

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license. * full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the * See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */ * full text of the license. */
@@ -49,13 +49,6 @@ OpenLayers.Date = {
return date.toISOString(); return date.toISOString();
}; };
} else { } else {
function pad(num, len) {
var str = num + "";
while (str.length < len) {
str = "0" + str;
}
return str;
}
return function(date) { return function(date) {
var str; var str;
if (isNaN(date.getTime())) { if (isNaN(date.getTime())) {
@@ -65,12 +58,12 @@ OpenLayers.Date = {
} else { } else {
str = str =
date.getUTCFullYear() + "-" + date.getUTCFullYear() + "-" +
pad(date.getUTCMonth() + 1, 2) + "-" + OpenLayers.Number.zeroPad(date.getUTCMonth() + 1, 2) + "-" +
pad(date.getUTCDate(), 2) + "T" + OpenLayers.Number.zeroPad(date.getUTCDate(), 2) + "T" +
pad(date.getUTCHours(), 2) + ":" + OpenLayers.Number.zeroPad(date.getUTCHours(), 2) + ":" +
pad(date.getUTCMinutes(), 2) + ":" + OpenLayers.Number.zeroPad(date.getUTCMinutes(), 2) + ":" +
pad(date.getUTCSeconds(), 2) + "." + OpenLayers.Number.zeroPad(date.getUTCSeconds(), 2) + "." +
pad(date.getUTCMilliseconds(), 3) + "Z"; OpenLayers.Number.zeroPad(date.getUTCMilliseconds(), 3) + "Z";
} }
return str; return str;
}; };

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license. * full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the * See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */ * full text of the license. */

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license. * full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the * See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */ * full text of the license. */

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license. * full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the * See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */ * full text of the license. */

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license. * full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the * See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */ * full text of the license. */

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license. * full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the * See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */ * full text of the license. */

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license. * full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the * See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */ * full text of the license. */

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license. * full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the * See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */ * full text of the license. */

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license. * full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the * See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */ * full text of the license. */
@@ -19,8 +19,8 @@ OpenLayers.Control.Attribution =
OpenLayers.Class(OpenLayers.Control, { OpenLayers.Class(OpenLayers.Control, {
/** /**
* APIProperty: seperator * APIProperty: separator
* {String} String used to seperate layers. * {String} String used to separate layers.
*/ */
separator: ", ", separator: ", ",

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license. * full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the * See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */ * full text of the license. */

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license. * full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the * See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */ * full text of the license. */

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license. * full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the * See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */ * full text of the license. */
@@ -111,7 +111,7 @@ OpenLayers.Control.CacheWrite = OpenLayers.Class(OpenLayers.Control, {
addLayer: function(evt) { addLayer: function(evt) {
evt.layer.events.on({ evt.layer.events.on({
tileloadstart: this.makeSameOrigin, tileloadstart: this.makeSameOrigin,
tileloaded: this.cache, tileloaded: this.onTileLoaded,
scope: this scope: this
}); });
}, },
@@ -128,7 +128,7 @@ OpenLayers.Control.CacheWrite = OpenLayers.Class(OpenLayers.Control, {
removeLayer: function(evt) { removeLayer: function(evt) {
evt.layer.events.un({ evt.layer.events.un({
tileloadstart: this.makeSameOrigin, tileloadstart: this.makeSameOrigin,
tileloaded: this.cache, tileloaded: this.onTileLoaded,
scope: this scope: this
}); });
}, },
@@ -156,6 +156,22 @@ OpenLayers.Control.CacheWrite = OpenLayers.Class(OpenLayers.Control, {
} }
}, },
/**
* Method: onTileLoaded
* Decides whether a tile can be cached and calls the cache method.
*
* Parameters:
* evt - {Event}
*/
onTileLoaded: function(evt) {
if (this.active && !evt.aborted &&
evt.tile instanceof OpenLayers.Tile.Image &&
evt.tile.url.substr(0, 5) !== 'data:') {
this.cache({tile: evt.tile});
delete OpenLayers.Control.CacheWrite.urlMap[evt.tile.url];
}
},
/** /**
* Method: cache * Method: cache
* Adds a tile to the cache. When the cache is full, the "cachefull" event * Adds a tile to the cache. When the cache is full, the "cachefull" event
@@ -166,29 +182,25 @@ OpenLayers.Control.CacheWrite = OpenLayers.Class(OpenLayers.Control, {
* <OpenLayers.Tile.Image> with the data to add to the cache * <OpenLayers.Tile.Image> with the data to add to the cache
*/ */
cache: function(obj) { cache: function(obj) {
if (this.active && window.localStorage) { if (window.localStorage) {
var tile = obj.tile; var tile = obj.tile;
if (tile instanceof OpenLayers.Tile.Image && try {
tile.url.substr(0, 5) !== 'data:') { var canvasContext = tile.getCanvasContext();
try { if (canvasContext) {
var canvasContext = tile.getCanvasContext(); var urlMap = OpenLayers.Control.CacheWrite.urlMap;
if (canvasContext) { var url = urlMap[tile.url] || tile.url;
var urlMap = OpenLayers.Control.CacheWrite.urlMap; window.localStorage.setItem(
var url = urlMap[tile.url] || tile.url; "olCache_" + url,
window.localStorage.setItem( canvasContext.canvas.toDataURL(this.imageFormat)
"olCache_" + url, );
canvasContext.canvas.toDataURL(this.imageFormat) }
); } catch(e) {
delete urlMap[tile.url]; // local storage full or CORS violation
} var reason = e.name || e.message;
} catch(e) { if (reason && this.quotaRegEx.test(reason)) {
// local storage full or CORS violation this.events.triggerEvent("cachefull", {tile: tile});
var reason = e.name || e.message; } else {
if (reason && this.quotaRegEx.test(reason)) { OpenLayers.Console.error(e.toString());
this.events.triggerEvent("cachefull", {tile: tile});
} else {
OpenLayers.Console.error(e.toString());
}
} }
} }
} }

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license. * full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the * See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */ * full text of the license. */

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license. * full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the * See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */ * full text of the license. */
@@ -56,11 +56,11 @@ OpenLayers.Control.DragPan = OpenLayers.Class(OpenLayers.Control, {
* {Boolean} Set this option to enable "kinetic dragging". Can be * {Boolean} Set this option to enable "kinetic dragging". Can be
* set to true or to an object. If set to an object this * set to true or to an object. If set to an object this
* object will be passed to the {<OpenLayers.Kinetic>} * object will be passed to the {<OpenLayers.Kinetic>}
* constructor. Defaults to false. * constructor. Defaults to true.
* If you set this property, you should ensure that * To get kinetic dragging, ensure that OpenLayers/Kinetic.js is
* OpenLayers/Kinetic.js is included in your build config * included in your build config.
*/ */
enableKinetic: false, enableKinetic: true,
/** /**
* APIProperty: kineticInterval * APIProperty: kineticInterval
@@ -77,7 +77,7 @@ OpenLayers.Control.DragPan = OpenLayers.Class(OpenLayers.Control, {
* <panMapDone> as callbacks. * <panMapDone> as callbacks.
*/ */
draw: function() { draw: function() {
if(this.enableKinetic) { if (this.enableKinetic && OpenLayers.Kinetic) {
var config = {interval: this.kineticInterval}; var config = {interval: this.kineticInterval};
if(typeof this.enableKinetic === "object") { if(typeof this.enableKinetic === "object") {
config = OpenLayers.Util.extend(config, this.enableKinetic); config = OpenLayers.Util.extend(config, this.enableKinetic);

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license. * full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the * See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */ * full text of the license. */

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license. * full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the * See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */ * full text of the license. */

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license. * full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the * See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */ * full text of the license. */
@@ -45,8 +45,15 @@ OpenLayers.Control.Geolocate = OpenLayers.Class(OpenLayers.Control, {
/** /**
* Property: geolocation * Property: geolocation
* {Object} The geolocation engine, as a property to be possibly mocked. * {Object} The geolocation engine, as a property to be possibly mocked.
* This is set lazily to avoid a memory leak in IE9.
*/ */
geolocation: navigator.geolocation, geolocation: null,
/**
* Property: available
* {Boolean} The navigator.geolocation object is available.
*/
available: ('geolocation' in navigator),
/** /**
* APIProperty: bind * APIProperty: bind
@@ -90,6 +97,10 @@ OpenLayers.Control.Geolocate = OpenLayers.Class(OpenLayers.Control, {
* {Boolean} The control was effectively activated. * {Boolean} The control was effectively activated.
*/ */
activate: function () { activate: function () {
if (this.available && !this.geolocation) {
// set lazily to avoid IE9 memory leak
this.geolocation = navigator.geolocation;
}
if (!this.geolocation) { if (!this.geolocation) {
this.events.triggerEvent("locationuncapable"); this.events.triggerEvent("locationuncapable");
return false; return false;

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license. * full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the * See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */ * full text of the license. */

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license. * full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the * See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */ * full text of the license. */

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license. * full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the * See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */ * full text of the license. */
@@ -6,6 +6,7 @@
/** /**
* @requires OpenLayers/Control.js * @requires OpenLayers/Control.js
* @requires OpenLayers/Handler/Keyboard.js * @requires OpenLayers/Handler/Keyboard.js
* @requires OpenLayers/Events.js
*/ */
/** /**
@@ -75,7 +76,16 @@ OpenLayers.Control.KeyboardDefaults = OpenLayers.Class(OpenLayers.Control, {
*/ */
defaultKeyPress: function (evt) { defaultKeyPress: function (evt) {
var size, handled = true; var size, handled = true;
switch(evt.keyCode) {
var target = OpenLayers.Event.element(evt);
if (target &&
(target.tagName == 'INPUT' ||
target.tagName == 'TEXTAREA' ||
target.tagName == 'SELECT')) {
return;
}
switch (evt.keyCode) {
case OpenLayers.Event.KEY_LEFT: case OpenLayers.Event.KEY_LEFT:
this.map.pan(-this.slideFactor, 0); this.map.pan(-this.slideFactor, 0);
break; break;

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license. * full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the * See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */ * full text of the license. */
@@ -6,7 +6,7 @@
/** /**
* @requires OpenLayers/Control.js * @requires OpenLayers/Control.js
* @requires OpenLayers/Lang.js * @requires OpenLayers/Lang.js
* @requires OpenLayers/Console.js * @requires OpenLayers/Util.js
* @requires OpenLayers/Events/buttonclick.js * @requires OpenLayers/Events/buttonclick.js
*/ */
@@ -23,26 +23,7 @@
* Inherits from: * Inherits from:
* - <OpenLayers.Control> * - <OpenLayers.Control>
*/ */
OpenLayers.Control.LayerSwitcher = OpenLayers.Control.LayerSwitcher = OpenLayers.Class(OpenLayers.Control, {
OpenLayers.Class(OpenLayers.Control, {
/**
* APIProperty: roundedCorner
* {Boolean} If true the Rico library is used for rounding the corners
* of the layer switcher div, defaults to false. *Deprecated*. Use
* CSS3's border-radius instead. If this option is set to true the
* Rico/Corner.js script must be loaded in the page, and therefore
* listed in the build profile.
*
*/
roundedCorner: false,
/**
* APIProperty: roundedCornerColor
* {String} The color of the rounded corners, only applies if roundedCorner
* is true, defaults to "darkblue".
*/
roundedCornerColor: "darkblue",
/** /**
* Property: layerStates * Property: layerStates
@@ -52,7 +33,6 @@ OpenLayers.Control.LayerSwitcher =
*/ */
layerStates: null, layerStates: null,
// DOM Elements // DOM Elements
/** /**
@@ -120,10 +100,6 @@ OpenLayers.Control.LayerSwitcher =
initialize: function(options) { initialize: function(options) {
OpenLayers.Control.prototype.initialize.apply(this, arguments); OpenLayers.Control.prototype.initialize.apply(this, arguments);
this.layerStates = []; this.layerStates = [];
if(this.roundedCorner) {
OpenLayers.Console.warn('roundedCorner option is deprecated');
}
}, },
/** /**
@@ -246,24 +222,23 @@ OpenLayers.Control.LayerSwitcher =
* {Boolean} The layer state changed since the last redraw() call. * {Boolean} The layer state changed since the last redraw() call.
*/ */
checkRedraw: function() { checkRedraw: function() {
var redraw = false;
if ( !this.layerStates.length || if ( !this.layerStates.length ||
(this.map.layers.length != this.layerStates.length) ) { (this.map.layers.length != this.layerStates.length) ) {
redraw = true; return true;
} else { }
for (var i=0, len=this.layerStates.length; i<len; i++) {
var layerState = this.layerStates[i]; for (var i = 0, len = this.layerStates.length; i < len; i++) {
var layer = this.map.layers[i]; var layerState = this.layerStates[i];
if ( (layerState.name != layer.name) || var layer = this.map.layers[i];
(layerState.inRange != layer.inRange) || if ( (layerState.name != layer.name) ||
(layerState.id != layer.id) || (layerState.inRange != layer.inRange) ||
(layerState.visibility != layer.visibility) ) { (layerState.id != layer.id) ||
redraw = true; (layerState.visibility != layer.visibility) ) {
break; return true;
}
} }
} }
return redraw;
return false;
}, },
/** /**
@@ -325,8 +300,14 @@ OpenLayers.Control.LayerSwitcher =
: layer.getVisibility(); : layer.getVisibility();
// create input element // create input element
var inputElem = document.createElement("input"); var inputElem = document.createElement("input"),
inputElem.id = this.id + "_input_" + layer.name; // The input shall have an id attribute so we can use
// labels to interact with them.
inputId = OpenLayers.Util.createUniqueID(
this.id + "_input_"
);
inputElem.id = inputId;
inputElem.name = (baseLayer) ? this.id + "_baseLayers" : layer.name; inputElem.name = (baseLayer) ? this.id + "_baseLayers" : layer.name;
inputElem.type = (baseLayer) ? "radio" : "checkbox"; inputElem.type = (baseLayer) ? "radio" : "checkbox";
inputElem.value = layer.name; inputElem.value = layer.name;
@@ -342,6 +323,8 @@ OpenLayers.Control.LayerSwitcher =
// create span // create span
var labelSpan = document.createElement("label"); var labelSpan = document.createElement("label");
// this isn't the DOM attribute 'for', but an arbitrary name we
// use to find the appropriate input element in <onButtonClick>
labelSpan["for"] = inputElem.id; labelSpan["for"] = inputElem.id;
OpenLayers.Element.addClass(labelSpan, "labelSpan olButton"); OpenLayers.Element.addClass(labelSpan, "labelSpan olButton");
labelSpan._layer = layer.id; labelSpan._layer = layer.id;
@@ -507,16 +490,6 @@ OpenLayers.Control.LayerSwitcher =
this.div.appendChild(this.layersDiv); this.div.appendChild(this.layersDiv);
if(this.roundedCorner) {
OpenLayers.Rico.Corner.round(this.div, {
corners: "tl bl",
bgColor: "transparent",
color: this.roundedCornerColor,
blend: false
});
OpenLayers.Rico.Corner.changeOpacity(this.layersDiv, 0.75);
}
// maximize button div // maximize button div
var img = OpenLayers.Util.getImageLocation('layer-switcher-maximize.png'); var img = OpenLayers.Util.getImageLocation('layer-switcher-maximize.png');
this.maximizeDiv = OpenLayers.Util.createAlphaImageDiv( this.maximizeDiv = OpenLayers.Util.createAlphaImageDiv(

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license. * full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the * See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */ * full text of the license. */
@@ -49,14 +49,14 @@ OpenLayers.Control.Measure = OpenLayers.Class(OpenLayers.Control, {
callbacks: null, callbacks: null,
/** /**
* Property: displaySystem * APIProperty: displaySystem
* {String} Display system for output measurements. Supported values * {String} Display system for output measurements. Supported values
* are 'english', 'metric', and 'geographic'. Default is 'metric'. * are 'english', 'metric', and 'geographic'. Default is 'metric'.
*/ */
displaySystem: 'metric', displaySystem: 'metric',
/** /**
* Property: geodesic * APIProperty: geodesic
* {Boolean} Calculate geodesic metrics instead of planar metrics. This * {Boolean} Calculate geodesic metrics instead of planar metrics. This
* requires that geometries can be transformed into Geographic/WGS84 * requires that geometries can be transformed into Geographic/WGS84
* (if that is not already the map projection). Default is false. * (if that is not already the map projection). Default is false.
@@ -226,8 +226,10 @@ OpenLayers.Control.Measure = OpenLayers.Class(OpenLayers.Control, {
* Method: measureImmediate * Method: measureImmediate
* Called each time the measurement sketch is modified. * Called each time the measurement sketch is modified.
* *
* Parameters: point - {<OpenLayers.Geometry.Point>} The point at the * Parameters:
* mouseposition. feature - {<OpenLayers.Feature.Vector>} The sketch feature. * point - {<OpenLayers.Geometry.Point>} The point at the mouse position.
* feature - {<OpenLayers.Feature.Vector>} The sketch feature.
* drawing - {Boolean} Indicates whether we're currently drawing.
*/ */
measureImmediate : function(point, feature, drawing) { measureImmediate : function(point, feature, drawing) {
if (drawing && !this.handler.freehandMode(this.handler.evt)) { if (drawing && !this.handler.freehandMode(this.handler.evt)) {

View File

@@ -1,11 +1,11 @@
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license. * full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the * See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */ * full text of the license. */
/** /**
* @requires OpenLayers/Control/DragFeature.js * @requires OpenLayers/Control.js
* @requires OpenLayers/Control/SelectFeature.js * @requires OpenLayers/Handler/Drag.js
* @requires OpenLayers/Handler/Keyboard.js * @requires OpenLayers/Handler/Keyboard.js
*/ */
@@ -22,6 +22,13 @@
*/ */
OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, { OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
/**
* APIProperty: documentDrag
* {Boolean} If set to true, dragging vertices will continue even if the
* mouse cursor leaves the map viewport. Default is false.
*/
documentDrag: false,
/** /**
* APIProperty: geometryTypes * APIProperty: geometryTypes
* {Array(String)} To restrict modification to a limited set of geometry * {Array(String)} To restrict modification to a limited set of geometry
@@ -67,6 +74,12 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
*/ */
feature: null, feature: null,
/**
* Property: vertex
* {<OpenLayers.Feature.Vector>} Vertex currently being modified.
*/
vertex: null,
/** /**
* Property: vertices * Property: vertices
* {Array(<OpenLayers.Feature.Vector>)} Verticies currently available * {Array(<OpenLayers.Feature.Vector>)} Verticies currently available
@@ -81,18 +94,6 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
*/ */
virtualVertices: null, virtualVertices: null,
/**
* Property: selectControl
* {<OpenLayers.Control.SelectFeature>}
*/
selectControl: null,
/**
* Property: dragControl
* {<OpenLayers.Control.DragFeature>}
*/
dragControl: null,
/** /**
* Property: handlers * Property: handlers
* {Object} * {Object}
@@ -225,63 +226,50 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
if(!(OpenLayers.Util.isArray(this.deleteCodes))) { if(!(OpenLayers.Util.isArray(this.deleteCodes))) {
this.deleteCodes = [this.deleteCodes]; this.deleteCodes = [this.deleteCodes];
} }
var control = this;
// configure the select control // configure the drag handler
var selectOptions = { var dragCallbacks = {
geometryTypes: this.geometryTypes, down: function(pixel) {
clickout: this.clickout, this.vertex = null;
toggle: this.toggle, var feature = this.layer.getFeatureFromEvent(
onBeforeSelect: this.beforeSelectFeature, this.handlers.drag.evt);
onSelect: this.selectFeature, if (feature) {
onUnselect: this.unselectFeature, this.dragStart(feature);
scope: this } else if (this.clickout) {
}; this._unselect = this.feature;
if(this.standalone === false) { }
this.selectControl = new OpenLayers.Control.SelectFeature(
layer, selectOptions
);
}
// configure the drag control
var dragOptions = {
geometryTypes: ["OpenLayers.Geometry.Point"],
onStart: function(feature, pixel) {
control.dragStart.apply(control, [feature, pixel]);
}, },
onDrag: function(feature, pixel) { move: function(pixel) {
control.dragVertex.apply(control, [feature, pixel]); delete this._unselect;
if (this.vertex) {
this.dragVertex(this.vertex, pixel);
}
}, },
onComplete: function(feature) { up: function() {
control.dragComplete.apply(control, [feature]); this.handlers.drag.stopDown = false;
if (this._unselect) {
this.unselectFeature(this._unselect);
delete this._unselect;
}
}, },
featureCallbacks: { done: function(pixel) {
over: function(feature) { if (this.vertex) {
/** this.dragComplete(this.vertex);
* In normal mode, the feature handler is set up to allow
* dragging of all points. In standalone mode, we only
* want to allow dragging of sketch vertices and virtual
* vertices - or, in the case of a modifiable point, the
* point itself.
*/
if(control.standalone !== true || feature._sketch ||
control.feature === feature) {
control.dragControl.overFeature.apply(
control.dragControl, [feature]);
}
} }
} }
}; };
this.dragControl = new OpenLayers.Control.DragFeature( var dragOptions = {
layer, dragOptions documentDrag: this.documentDrag,
); stopDown: false
};
// configure the keyboard handler // configure the keyboard handler
var keyboardOptions = { var keyboardOptions = {
keydown: this.handleKeypress keydown: this.handleKeypress
}; };
this.handlers = { this.handlers = {
keyboard: new OpenLayers.Handler.Keyboard(this, keyboardOptions) keyboard: new OpenLayers.Handler.Keyboard(this, keyboardOptions),
drag: new OpenLayers.Handler.Drag(this, dragCallbacks, dragOptions)
}; };
}, },
@@ -290,9 +278,14 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
* Take care of things that are not handled in superclass. * Take care of things that are not handled in superclass.
*/ */
destroy: function() { destroy: function() {
if (this.map) {
this.map.events.un({
"removelayer": this.handleMapEvents,
"changelayer": this.handleMapEvents,
scope: this
});
}
this.layer = null; this.layer = null;
this.standalone || this.selectControl.destroy();
this.dragControl.destroy();
OpenLayers.Control.prototype.destroy.apply(this, []); OpenLayers.Control.prototype.destroy.apply(this, []);
}, },
@@ -304,8 +297,14 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
* {Boolean} Successfully activated the control. * {Boolean} Successfully activated the control.
*/ */
activate: function() { activate: function() {
return ((this.standalone || this.selectControl.activate()) && this.moveLayerToTop();
this.handlers.keyboard.activate() && this.map.events.on({
"removelayer": this.handleMapEvents,
"changelayer": this.handleMapEvents,
scope: this
});
return (this.handlers.keyboard.activate() &&
this.handlers.drag.activate() &&
OpenLayers.Control.prototype.activate.apply(this, arguments)); OpenLayers.Control.prototype.activate.apply(this, arguments));
}, },
@@ -320,24 +319,21 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
var deactivated = false; var deactivated = false;
// the return from the controls is unimportant in this case // the return from the controls is unimportant in this case
if(OpenLayers.Control.prototype.deactivate.apply(this, arguments)) { if(OpenLayers.Control.prototype.deactivate.apply(this, arguments)) {
this.moveLayerBack();
this.map.events.un({
"removelayer": this.handleMapEvents,
"changelayer": this.handleMapEvents,
scope: this
});
this.layer.removeFeatures(this.vertices, {silent: true}); this.layer.removeFeatures(this.vertices, {silent: true});
this.layer.removeFeatures(this.virtualVertices, {silent: true}); this.layer.removeFeatures(this.virtualVertices, {silent: true});
this.vertices = []; this.vertices = [];
this.dragControl.deactivate(); this.handlers.drag.deactivate();
var feature = this.feature;
var valid = feature && feature.geometry && feature.layer;
if(this.standalone === false) {
if(valid) {
this.selectControl.unselect.apply(this.selectControl,
[feature]);
}
this.selectControl.deactivate();
} else {
if(valid) {
this.unselectFeature(feature);
}
}
this.handlers.keyboard.deactivate(); this.handlers.keyboard.deactivate();
var feature = this.feature;
if (feature && feature.geometry && feature.layer) {
this.unselectFeature(feature);
}
deactivated = true; deactivated = true;
} }
return deactivated; return deactivated;
@@ -359,19 +355,28 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
/** /**
* APIMethod: selectFeature * APIMethod: selectFeature
* Select a feature for modification in standalone mode. In non-standalone * Select a feature for modification in standalone mode. In non-standalone
* mode, this method is called when the select feature control selects a * mode, this method is called when a feature is selected by clicking.
* feature. Register a listener to the beforefeaturemodified event and * Register a listener to the beforefeaturemodified event and return false
* return false to prevent feature modification. * to prevent feature modification.
* *
* Parameters: * Parameters:
* feature - {<OpenLayers.Feature.Vector>} the selected feature. * feature - {<OpenLayers.Feature.Vector>} the selected feature.
*/ */
selectFeature: function(feature) { selectFeature: function(feature) {
if (!this.standalone || this.beforeSelectFeature(feature) !== false) { if (this.feature === feature ||
(this.geometryTypes && OpenLayers.Util.indexOf(this.geometryTypes,
feature.geometry.CLASS_NAME) == -1)) {
return;
}
if (this.beforeSelectFeature(feature) !== false) {
if (this.feature) {
this.unselectFeature(this.feature);
}
this.feature = feature; this.feature = feature;
this.layer.selectedFeatures.push(feature);
this.layer.drawFeature(feature, 'select');
this.modified = false; this.modified = false;
this.resetVertices(); this.resetVertices();
this.dragControl.activate();
this.onModificationStart(this.feature); this.onModificationStart(this.feature);
} }
// keep track of geometry modifications // keep track of geometry modifications
@@ -401,8 +406,9 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
this.layer.destroyFeatures([this.radiusHandle], {silent: true}); this.layer.destroyFeatures([this.radiusHandle], {silent: true});
delete this.radiusHandle; delete this.radiusHandle;
} }
this.layer.drawFeature(this.feature, 'default');
this.feature = null; this.feature = null;
this.dragControl.deactivate(); OpenLayers.Util.removeItem(this.layer.selectedFeatures, feature);
this.onModificationEnd(feature); this.onModificationEnd(feature);
this.layer.events.triggerEvent("afterfeaturemodified", { this.layer.events.triggerEvent("afterfeaturemodified", {
feature: feature, feature: feature,
@@ -411,63 +417,47 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
this.modified = false; this.modified = false;
}, },
/** /**
* Method: dragStart * Method: dragStart
* Called by the drag feature control with before a feature is dragged. * Called by the drag handler before a feature is dragged. This method is
* This method is used to differentiate between points and vertices * used to differentiate between points and vertices
* of higher order geometries. This respects the <geometryTypes> * of higher order geometries.
* property and forces a select of points when the drag control is
* already active (and stops events from propagating to the select
* control).
* *
* Parameters: * Parameters:
* feature - {<OpenLayers.Feature.Vector>} The point or vertex about to be * feature - {<OpenLayers.Feature.Vector>} The point or vertex about to be
* dragged. * dragged.
* pixel - {<OpenLayers.Pixel>} Pixel location of the mouse event.
*/ */
dragStart: function(feature, pixel) { dragStart: function(feature) {
// only change behavior if the feature is not in the vertices array var isPoint = feature.geometry.CLASS_NAME ==
if(feature != this.feature && !feature.geometry.parent && 'OpenLayers.Geometry.Point';
feature != this.dragHandle && feature != this.radiusHandle) { if (!this.standalone &&
if(this.standalone === false && this.feature) { ((!feature._sketch && isPoint) || !feature._sketch)) {
// unselect the currently selected feature if (this.toggle && this.feature === feature) {
this.selectControl.clickFeature.apply(this.selectControl, // mark feature for unselection
[this.feature]); this._unselect = feature;
}
// check any constraints on the geometry type
if(this.geometryTypes == null ||
OpenLayers.Util.indexOf(this.geometryTypes,
feature.geometry.CLASS_NAME) != -1) {
// select the point
this.standalone || this.selectControl.clickFeature.apply(
this.selectControl, [feature]);
/**
* TBD: These lines improve workflow by letting the user
* immediately start dragging after the mouse down.
* However, it is very ugly to be messing with controls
* and their handlers in this way. I'd like a better
* solution if the workflow change is necessary.
*/
// prepare the point for dragging
this.dragControl.overFeature.apply(this.dragControl,
[feature]);
this.dragControl.lastPixel = pixel;
this.dragControl.handlers.drag.started = true;
this.dragControl.handlers.drag.start = pixel;
this.dragControl.handlers.drag.last = pixel;
} }
this.selectFeature(feature);
}
if (feature._sketch || isPoint) {
// feature is a drag or virtual handle or point
this.vertex = feature;
this.handlers.drag.stopDown = true;
} }
}, },
/** /**
* Method: dragVertex * Method: dragVertex
* Called by the drag feature control with each drag move of a vertex. * Called by the drag handler with each drag move of a vertex.
* *
* Parameters: * Parameters:
* vertex - {<OpenLayers.Feature.Vector>} The vertex being dragged. * vertex - {<OpenLayers.Feature.Vector>} The vertex being dragged.
* pixel - {<OpenLayers.Pixel>} Pixel location of the mouse event. * pixel - {<OpenLayers.Pixel>} Pixel location of the mouse event.
*/ */
dragVertex: function(vertex, pixel) { dragVertex: function(vertex, pixel) {
var pos = this.map.getLonLatFromViewPortPx(pixel);
var geom = vertex.geometry;
geom.move(pos.lon - geom.x, pos.lat - geom.y);
this.modified = true; this.modified = true;
/** /**
* Five cases: * Five cases:
@@ -479,9 +469,6 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
*/ */
if(this.feature.geometry.CLASS_NAME == "OpenLayers.Geometry.Point") { if(this.feature.geometry.CLASS_NAME == "OpenLayers.Geometry.Point") {
// dragging a simple point // dragging a simple point
if(this.feature != vertex) {
this.feature = vertex;
}
this.layer.events.triggerEvent("vertexmodified", { this.layer.events.triggerEvent("vertexmodified", {
vertex: vertex.geometry, vertex: vertex.geometry,
feature: this.feature, feature: this.feature,
@@ -518,7 +505,7 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
this.virtualVertices = []; this.virtualVertices = [];
} }
this.layer.drawFeature(this.feature, this.standalone ? undefined : this.layer.drawFeature(this.feature, this.standalone ? undefined :
this.selectControl.renderIntent); 'select');
} }
// keep the vertex on top so it gets the mouseout after dragging // keep the vertex on top so it gets the mouseout after dragging
// this should be removed in favor of an option to draw under or // this should be removed in favor of an option to draw under or
@@ -528,7 +515,7 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
/** /**
* Method: dragComplete * Method: dragComplete
* Called by the drag feature control when the feature dragging is complete. * Called by the drag handler when the feature dragging is complete.
* *
* Parameters: * Parameters:
* vertex - {<OpenLayers.Feature.Vector>} The vertex being dragged. * vertex - {<OpenLayers.Feature.Vector>} The vertex being dragged.
@@ -564,16 +551,6 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
* Method: resetVertices * Method: resetVertices
*/ */
resetVertices: function() { resetVertices: function() {
// if coming from a drag complete we're about to destroy the vertex
// that was just dragged. For that reason, the drag feature control
// will never detect a mouse-out on that vertex, meaning that the drag
// handler won't be deactivated. This can cause errors because the drag
// feature control still has a feature to drag but that feature is
// destroyed. To prevent this, we call outFeature on the drag feature
// control if the control actually has a feature to drag.
if(this.dragControl.feature) {
this.dragControl.outFeature(this.dragControl.feature);
}
if(this.vertices.length > 0) { if(this.vertices.length > 0) {
this.layer.removeFeatures(this.vertices, {silent: true}); this.layer.removeFeatures(this.vertices, {silent: true});
this.vertices = []; this.vertices = [];
@@ -624,11 +601,10 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
// check for delete key // check for delete key
if(this.feature && if(this.feature &&
OpenLayers.Util.indexOf(this.deleteCodes, code) != -1) { OpenLayers.Util.indexOf(this.deleteCodes, code) != -1) {
var vertex = this.dragControl.feature; var vertex = this.layer.getFeatureFromEvent(this.handlers.drag.evt);
if(vertex && if (vertex &&
OpenLayers.Util.indexOf(this.vertices, vertex) != -1 && OpenLayers.Util.indexOf(this.vertices, vertex) != -1 &&
!this.dragControl.handlers.drag.dragging && !this.handlers.drag.dragging && vertex.geometry.parent) {
vertex.geometry.parent) {
// remove the vertex // remove the vertex
vertex.geometry.parent.removeComponent(vertex.geometry); vertex.geometry.parent.removeComponent(vertex.geometry);
this.layer.events.triggerEvent("vertexremoved", { this.layer.events.triggerEvent("vertexremoved", {
@@ -637,8 +613,7 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
pixel: evt.xy pixel: evt.xy
}); });
this.layer.drawFeature(this.feature, this.standalone ? this.layer.drawFeature(this.feature, this.standalone ?
undefined : undefined : 'select');
this.selectControl.renderIntent);
this.modified = true; this.modified = true;
this.resetVertices(); this.resetVertices();
this.setFeatureState(); this.setFeatureState();
@@ -792,11 +767,49 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
* map - {<OpenLayers.Map>} The control's map. * map - {<OpenLayers.Map>} The control's map.
*/ */
setMap: function(map) { setMap: function(map) {
this.standalone || this.selectControl.setMap(map); this.handlers.drag.setMap(map);
this.dragControl.setMap(map);
OpenLayers.Control.prototype.setMap.apply(this, arguments); OpenLayers.Control.prototype.setMap.apply(this, arguments);
}, },
/**
* Method: handleMapEvents
*
* Parameters:
* evt - {Object}
*/
handleMapEvents: function(evt) {
if (evt.type == "removelayer" || evt.property == "order") {
this.moveLayerToTop();
}
},
/**
* Method: moveLayerToTop
* Moves the layer for this handler to the top, so mouse events can reach
* it.
*/
moveLayerToTop: function() {
var index = Math.max(this.map.Z_INDEX_BASE['Feature'] - 1,
this.layer.getZIndex()) + 1;
this.layer.setZIndex(index);
},
/**
* Method: moveLayerBack
* Moves the layer back to the position determined by the map's layers
* array.
*/
moveLayerBack: function() {
var index = this.layer.getZIndex() - 1;
if (index >= this.map.Z_INDEX_BASE['Feature']) {
this.layer.setZIndex(index);
} else {
this.map.setLayerZIndex(this.layer,
this.map.getLayerIndex(this.layer));
}
},
CLASS_NAME: "OpenLayers.Control.ModifyFeature" CLASS_NAME: "OpenLayers.Control.ModifyFeature"
}); });

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license. * full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the * See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */ * full text of the license. */
@@ -13,6 +13,18 @@
* The MousePosition control displays geographic coordinates of the mouse * The MousePosition control displays geographic coordinates of the mouse
* pointer, as it is moved about the map. * pointer, as it is moved about the map.
* *
* You can use the <prefix>- or <suffix>-properties to provide more information
* about the displayed coordinates to the user:
*
* (code)
* var mousePositionCtrl = new OpenLayers.Control.MousePosition({
* prefix: '<a target="_blank" ' +
* 'href="http://spatialreference.org/ref/epsg/4326/">' +
* 'EPSG:4326</a> coordinates: '
* }
* );
* (end code)
*
* Inherits from: * Inherits from:
* - <OpenLayers.Control> * - <OpenLayers.Control>
*/ */
@@ -33,25 +45,30 @@ OpenLayers.Control.MousePosition = OpenLayers.Class(OpenLayers.Control, {
/** /**
* APIProperty: prefix * APIProperty: prefix
* {String} * {String} A string to be prepended to the current pointers coordinates
* when it is rendered. Defaults to the empty string ''.
*/ */
prefix: '', prefix: '',
/** /**
* APIProperty: separator * APIProperty: separator
* {String} * {String} A string to be used to seperate the two coordinates from each
* other. Defaults to the string ', ', which will result in a
* rendered coordinate of e.g. '42.12, 21.22'.
*/ */
separator: ', ', separator: ', ',
/** /**
* APIProperty: suffix * APIProperty: suffix
* {String} * {String} A string to be appended to the current pointers coordinates
* when it is rendered. Defaults to the empty string ''.
*/ */
suffix: '', suffix: '',
/** /**
* APIProperty: numDigits * APIProperty: numDigits
* {Integer} * {Integer} The number of digits each coordinate shall have when being
* rendered, Defaults to 5.
*/ */
numDigits: 5, numDigits: 5,
@@ -76,8 +93,8 @@ OpenLayers.Control.MousePosition = OpenLayers.Class(OpenLayers.Control, {
/** /**
* APIProperty: displayProjection * APIProperty: displayProjection
* {<OpenLayers.Projection>} The projection in which the * {<OpenLayers.Projection>} The projection in which the mouse position is
* mouse position is displayed * displayed.
*/ */
displayProjection: null, displayProjection: null,

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license. * full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the * See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */ * full text of the license. */

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license. * full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the * See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */ * full text of the license. */
@@ -77,7 +77,9 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
/** /**
* Property: mouseWheelOptions * Property: mouseWheelOptions
* {Object} Options passed to the MouseWheel control (only useful if * {Object} Options passed to the MouseWheel control (only useful if
* <zoomWheelEnabled> is set to true) * <zoomWheelEnabled> is set to true). Default is no options for maps
* with fractionalZoom set to true, otherwise
* {cumulative: false, interval: 50, maxDelta: 6}
*/ */
mouseWheelOptions: null, mouseWheelOptions: null,
@@ -208,10 +210,15 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
{map: this.map, keyMask: this.zoomBoxKeyMask}); {map: this.map, keyMask: this.zoomBoxKeyMask});
this.dragPan.draw(); this.dragPan.draw();
this.zoomBox.draw(); this.zoomBox.draw();
var wheelOptions = this.map.fractionalZoom ? {} : {
cumulative: false,
interval: 50,
maxDelta: 6
};
this.handlers.wheel = new OpenLayers.Handler.MouseWheel( this.handlers.wheel = new OpenLayers.Handler.MouseWheel(
this, {"up" : this.wheelUp, this, {up : this.wheelUp, down: this.wheelDown},
"down": this.wheelDown}, OpenLayers.Util.extend(wheelOptions, this.mouseWheelOptions)
this.mouseWheelOptions ); );
if (OpenLayers.Control.PinchZoom) { if (OpenLayers.Control.PinchZoom) {
this.pinchZoom = new OpenLayers.Control.PinchZoom( this.pinchZoom = new OpenLayers.Control.PinchZoom(
OpenLayers.Util.extend( OpenLayers.Util.extend(
@@ -238,8 +245,7 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
* evt - {Event} * evt - {Event}
*/ */
defaultDblClick: function (evt) { defaultDblClick: function (evt) {
var newCenter = this.map.getLonLatFromViewPortPx( evt.xy ); this.map.zoomTo(this.map.zoom + 1, evt.xy);
this.map.setCenter(newCenter, this.map.zoom + 1);
}, },
/** /**
@@ -249,8 +255,7 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
* evt - {Event} * evt - {Event}
*/ */
defaultDblRightClick: function (evt) { defaultDblRightClick: function (evt) {
var newCenter = this.map.getLonLatFromViewPortPx( evt.xy ); this.map.zoomTo(this.map.zoom - 1, evt.xy);
this.map.setCenter(newCenter, this.map.zoom - 1);
}, },
/** /**
@@ -264,22 +269,14 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
if (!this.map.fractionalZoom) { if (!this.map.fractionalZoom) {
deltaZ = Math.round(deltaZ); deltaZ = Math.round(deltaZ);
} }
var currentZoom = this.map.getZoom(); var currentZoom = this.map.getZoom(),
var newZoom = this.map.getZoom() + deltaZ; newZoom = currentZoom + deltaZ;
newZoom = Math.max(newZoom, 0); newZoom = Math.max(newZoom, 0);
newZoom = Math.min(newZoom, this.map.getNumZoomLevels()); newZoom = Math.min(newZoom, this.map.getNumZoomLevels());
if (newZoom === currentZoom) { if (newZoom === currentZoom) {
return; return;
} }
var size = this.map.getSize(); this.map.zoomTo(newZoom, evt.xy);
var deltaX = size.w/2 - evt.xy.x;
var deltaY = evt.xy.y - size.h/2;
var newRes = this.map.baseLayer.getResolutionForZoom(newZoom);
var zoomPoint = this.map.getLonLatFromPixel(evt.xy);
var newCenter = new OpenLayers.LonLat(
zoomPoint.lon + deltaX * newRes,
zoomPoint.lat + deltaY * newRes );
this.map.setCenter( newCenter, newZoom );
}, },
/** /**

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license. * full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the * See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */ * full text of the license. */

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license. * full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the * See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */ * full text of the license. */
@@ -7,6 +7,9 @@
* @requires OpenLayers/Control.js * @requires OpenLayers/Control.js
* @requires OpenLayers/BaseTypes.js * @requires OpenLayers/BaseTypes.js
* @requires OpenLayers/Events/buttonclick.js * @requires OpenLayers/Events/buttonclick.js
* @requires OpenLayers/Map.js
* @requires OpenLayers/Handler/Click.js
* @requires OpenLayers/Handler/Drag.js
*/ */
/** /**
@@ -450,7 +453,7 @@ OpenLayers.Control.OverviewMap = OpenLayers.Class(OpenLayers.Control, {
*/ */
isSuitableOverview: function() { isSuitableOverview: function() {
var mapExtent = this.map.getExtent(); var mapExtent = this.map.getExtent();
var maxExtent = this.map.maxExtent; var maxExtent = this.map.getMaxExtent();
var testExtent = new OpenLayers.Bounds( var testExtent = new OpenLayers.Bounds(
Math.max(mapExtent.left, maxExtent.left), Math.max(mapExtent.left, maxExtent.left),
Math.max(mapExtent.bottom, maxExtent.bottom), Math.max(mapExtent.bottom, maxExtent.bottom),

View File

@@ -1,10 +1,10 @@
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license. * full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the * See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */ * full text of the license. */
/** /**
* @requires OpenLayers/Control.js * @requires OpenLayers/Control/Button.js
*/ */
/** /**
@@ -15,7 +15,7 @@
* Inherits from: * Inherits from:
* - <OpenLayers.Control> * - <OpenLayers.Control>
*/ */
OpenLayers.Control.Pan = OpenLayers.Class(OpenLayers.Control, { OpenLayers.Control.Pan = OpenLayers.Class(OpenLayers.Control.Button, {
/** /**
* APIProperty: slideFactor * APIProperty: slideFactor
@@ -40,14 +40,6 @@ OpenLayers.Control.Pan = OpenLayers.Class(OpenLayers.Control, {
*/ */
direction: null, direction: null,
/**
* Property: type
* {String} The type of <OpenLayers.Control> -- When added to a
* <Control.Panel>, 'type' is used by the panel to determine how to
* handle our events.
*/
type: OpenLayers.Control.TYPE_BUTTON,
/** /**
* Constructor: OpenLayers.Control.Pan * Constructor: OpenLayers.Control.Pan
* Control which handles the panning (in any of the cardinal directions) * Control which handles the panning (in any of the cardinal directions)
@@ -70,26 +62,27 @@ OpenLayers.Control.Pan = OpenLayers.Class(OpenLayers.Control, {
* Method: trigger * Method: trigger
*/ */
trigger: function(){ trigger: function(){
if (this.map) {
var getSlideFactor = OpenLayers.Function.bind(function (dim) {
return this.slideRatio ?
this.map.getSize()[dim] * this.slideRatio :
this.slideFactor;
}, this);
var getSlideFactor = OpenLayers.Function.bind(function (dim) { switch (this.direction) {
return this.slideRatio ? case OpenLayers.Control.Pan.NORTH:
this.map.getSize()[dim] * this.slideRatio : this.map.pan(0, -getSlideFactor("h"));
this.slideFactor; break;
}, this); case OpenLayers.Control.Pan.SOUTH:
this.map.pan(0, getSlideFactor("h"));
switch (this.direction) { break;
case OpenLayers.Control.Pan.NORTH: case OpenLayers.Control.Pan.WEST:
this.map.pan(0, -getSlideFactor("h")); this.map.pan(-getSlideFactor("w"), 0);
break; break;
case OpenLayers.Control.Pan.SOUTH: case OpenLayers.Control.Pan.EAST:
this.map.pan(0, getSlideFactor("h")); this.map.pan(getSlideFactor("w"), 0);
break; break;
case OpenLayers.Control.Pan.WEST: }
this.map.pan(-getSlideFactor("w"), 0);
break;
case OpenLayers.Control.Pan.EAST:
this.map.pan(getSlideFactor("w"), 0);
break;
} }
}, },

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license. * full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the * See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */ * full text of the license. */

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license. * full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the * See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */ * full text of the license. */

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license. * full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the * See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */ * full text of the license. */
@@ -99,6 +99,7 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
this.map.events.un({ this.map.events.un({
"changebaselayer": this.redraw, "changebaselayer": this.redraw,
"updatesize": this.redraw,
scope: this scope: this
}); });
@@ -116,7 +117,11 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
*/ */
setMap: function(map) { setMap: function(map) {
OpenLayers.Control.PanZoom.prototype.setMap.apply(this, arguments); OpenLayers.Control.PanZoom.prototype.setMap.apply(this, arguments);
this.map.events.register("changebaselayer", this, this.redraw); this.map.events.on({
"changebaselayer": this.redraw,
"updatesize": this.redraw,
scope: this
});
}, },
/** /**
@@ -189,6 +194,7 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
_addZoomBar:function(centered) { _addZoomBar:function(centered) {
var imgLocation = OpenLayers.Util.getImageLocation("slider.png"); var imgLocation = OpenLayers.Util.getImageLocation("slider.png");
var id = this.id + "_" + this.map.id; var id = this.id + "_" + this.map.id;
var minZoom = this.map.getMinZoom();
var zoomsToEnd = this.map.getNumZoomLevels() - 1 - this.map.getZoom(); var zoomsToEnd = this.map.getNumZoomLevels() - 1 - this.map.getZoom();
var slider = OpenLayers.Util.createAlphaImageDiv(id, var slider = OpenLayers.Util.createAlphaImageDiv(id,
centered.add(-1, zoomsToEnd * this.zoomStopHeight), centered.add(-1, zoomsToEnd * this.zoomStopHeight),
@@ -211,7 +217,7 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
var sz = { var sz = {
w: this.zoomStopWidth, w: this.zoomStopWidth,
h: this.zoomStopHeight * this.map.getNumZoomLevels() h: this.zoomStopHeight * (this.map.getNumZoomLevels() - minZoom)
}; };
var imgLocation = OpenLayers.Util.getImageLocation("zoombar.png"); var imgLocation = OpenLayers.Util.getImageLocation("zoombar.png");
var div = null; var div = null;
@@ -242,7 +248,7 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
this.map.events.register("zoomend", this, this.moveZoomBar); this.map.events.register("zoomend", this, this.moveZoomBar);
centered = centered.add(0, centered = centered.add(0,
this.zoomStopHeight * this.map.getNumZoomLevels()); this.zoomStopHeight * (this.map.getNumZoomLevels() - minZoom));
return centered; return centered;
}, },

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license. * full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the * See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */ * full text of the license. */

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license. * full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the * See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */ * full text of the license. */

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license. * full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the * See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */ * full text of the license. */
@@ -21,12 +21,6 @@ OpenLayers.Control.PinchZoom = OpenLayers.Class(OpenLayers.Control, {
*/ */
type: OpenLayers.Control.TYPE_TOOL, type: OpenLayers.Control.TYPE_TOOL,
/**
* Property: containerCenter
* {Object} Cached object representing the layer container center (in pixels).
*/
containerCenter: null,
/** /**
* Property: pinchOrigin * Property: pinchOrigin
* {Object} Cached object representing the pinch start (in pixels). * {Object} Cached object representing the pinch start (in pixels).
@@ -46,6 +40,17 @@ OpenLayers.Control.PinchZoom = OpenLayers.Class(OpenLayers.Control, {
*/ */
autoActivate: true, autoActivate: true,
/**
* APIProperty: preserveCenter
* {Boolean} Set this to true if you don't want the map center to change
* while pinching. For example you may want to set preserveCenter to
* true when the user location is being watched and you want to preserve
* the user location at the center of the map even if he zooms in or
* out using pinch. This property's value can be changed any time on an
* existing instance. Default is false.
*/
preserveCenter: false,
/** /**
* APIProperty: handlerOptions * APIProperty: handlerOptions
* {Object} Used to set non-default properties on the pinch handler * {Object} Used to set non-default properties on the pinch handler
@@ -69,57 +74,6 @@ OpenLayers.Control.PinchZoom = OpenLayers.Class(OpenLayers.Control, {
}, this.handlerOptions); }, this.handlerOptions);
}, },
/**
* APIMethod: activate
* Activate this control. Must be called after the control is added to a
* map.
*
* Returns:
* {Boolean} The control was successfully activated.
*/
activate: function() {
var activated = OpenLayers.Control.prototype.activate.apply(this,arguments);
if (activated) {
this.map.events.on({
moveend: this.updateContainerCenter,
scope: this
});
this.updateContainerCenter();
}
return activated;
},
/**
* APIMethod: deactivate
* Deactivate this control.
*
* Returns:
* {Boolean} The control was successfully deactivated.
*/
deactivate: function() {
var deactivated = OpenLayers.Control.prototype.deactivate.apply(this,arguments);
if (this.map && this.map.events) {
this.map.events.un({
moveend: this.updateContainerCenter,
scope: this
});
}
return deactivated;
},
/**
* Method: updateContainerCenter
* Must be called each time the layer container moves.
*/
updateContainerCenter: function() {
var container = this.map.layerContainerDiv;
// the layer container div is a square of 100px/100px
this.containerCenter = {
x: parseInt(container.style.left, 10) + 50,
y: parseInt(container.style.top, 10) + 50
};
},
/** /**
* Method: pinchStart * Method: pinchStart
* *
@@ -129,8 +83,10 @@ OpenLayers.Control.PinchZoom = OpenLayers.Class(OpenLayers.Control, {
* of the pinch gesture. This give us the current scale of the pinch. * of the pinch gesture. This give us the current scale of the pinch.
*/ */
pinchStart: function(evt, pinchData) { pinchStart: function(evt, pinchData) {
this.pinchOrigin = evt.xy; var xy = (this.preserveCenter) ?
this.currentCenter = evt.xy; this.map.getPixelFromLonLat(this.map.getCenter()) : evt.xy;
this.pinchOrigin = xy;
this.currentCenter = xy;
}, },
/** /**
@@ -143,29 +99,18 @@ OpenLayers.Control.PinchZoom = OpenLayers.Class(OpenLayers.Control, {
*/ */
pinchMove: function(evt, pinchData) { pinchMove: function(evt, pinchData) {
var scale = pinchData.scale; var scale = pinchData.scale;
var containerCenter = this.containerCenter; var containerOrigin = this.map.layerContainerOriginPx;
var pinchOrigin = this.pinchOrigin; var pinchOrigin = this.pinchOrigin;
var current = evt.xy; var current = (this.preserveCenter) ?
this.map.getPixelFromLonLat(this.map.getCenter()) : evt.xy;
var dx = Math.round((current.x - pinchOrigin.x) + (scale - 1) * (containerCenter.x - pinchOrigin.x)); var dx = Math.round((containerOrigin.x + current.x - pinchOrigin.x) + (scale - 1) * (containerOrigin.x - pinchOrigin.x));
var dy = Math.round((current.y - pinchOrigin.y) + (scale - 1) * (containerCenter.y - pinchOrigin.y)); var dy = Math.round((containerOrigin.y + current.y - pinchOrigin.y) + (scale - 1) * (containerOrigin.y - pinchOrigin.y));
this.applyTransform( this.map.applyTransform(dx, dy, scale);
"translate(" + dx + "px, " + dy + "px) scale(" + scale + ")"
);
this.currentCenter = current; this.currentCenter = current;
}, },
/**
* Method: applyTransform
* Applies the given transform to layers.
*/
applyTransform: function(transform) {
var style = this.map.layerContainerDiv.style;
style['-webkit-transform'] = transform;
style['-moz-transform'] = transform;
},
/** /**
* Method: pinchDone * Method: pinchDone
* *
@@ -177,7 +122,7 @@ OpenLayers.Control.PinchZoom = OpenLayers.Class(OpenLayers.Control, {
* of the pinch gesture. This give us the final scale of the pinch. * of the pinch gesture. This give us the final scale of the pinch.
*/ */
pinchDone: function(evt, start, last) { pinchDone: function(evt, start, last) {
this.applyTransform(""); this.map.applyTransform();
var zoom = this.map.getZoomForResolution(this.map.getResolution() / last.scale, true); var zoom = this.map.getZoomForResolution(this.map.getResolution() / last.scale, true);
if (zoom !== this.map.getZoom() || !this.currentCenter.equals(this.pinchOrigin)) { if (zoom !== this.map.getZoom() || !this.currentCenter.equals(this.pinchOrigin)) {
var resolution = this.map.getResolutionForZoom(zoom); var resolution = this.map.getResolutionForZoom(zoom);

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license. * full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the * See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */ * full text of the license. */
@@ -96,7 +96,7 @@ OpenLayers.Control.SLDSelect = OpenLayers.Class(OpenLayers.Control, {
* layerOptions: { * layerOptions: {
* styleMap: new OpenLayers.StyleMap({ * styleMap: new OpenLayers.StyleMap({
* "default": {strokeColor: "yellow"} * "default": {strokeColor: "yellow"}
* }); * })
* } * }
* } * }
* }); * });
@@ -533,13 +533,14 @@ OpenLayers.Control.SLDSelect = OpenLayers.Class(OpenLayers.Control, {
} }
var selectionLayer = this.createSelectionLayer(layer); var selectionLayer = this.createSelectionLayer(layer);
var sld = this.createSLD(layer, filters, geometryAttributes);
this.events.triggerEvent("selected", { this.events.triggerEvent("selected", {
layer: layer, layer: layer,
filters: filters filters: filters
}); });
var sld = this.createSLD(layer, filters, geometryAttributes);
selectionLayer.mergeNewParams({SLD_BODY: sld}); selectionLayer.mergeNewParams({SLD_BODY: sld});
delete this._queue; delete this._queue;
} }

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license. * full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the * See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */ * full text of the license. */

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license. * full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the * See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */ * full text of the license. */

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license. * full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the * See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */ * full text of the license. */
@@ -305,12 +305,17 @@ OpenLayers.Control.SelectFeature = OpenLayers.Class(OpenLayers.Control, {
for(l=0; l<layers.length; ++l) { for(l=0; l<layers.length; ++l) {
layer = layers[l]; layer = layers[l];
numExcept = 0; numExcept = 0;
while(layer.selectedFeatures.length > numExcept) { //layer.selectedFeatures is null when layer is destroyed and
feature = layer.selectedFeatures[numExcept]; //one of it's preremovelayer listener calls setLayer
if(!options || options.except != feature) { //with another layer on this control
this.unselect(feature); if(layer.selectedFeatures != null) {
} else { while(layer.selectedFeatures.length > numExcept) {
++numExcept; feature = layer.selectedFeatures[numExcept];
if(!options || options.except != feature) {
this.unselect(feature);
} else {
++numExcept;
}
} }
} }
} }

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license. * full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the * See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */ * full text of the license. */
@@ -124,7 +124,7 @@ OpenLayers.Control.Snapping = OpenLayers.Class(OpenLayers.Control, {
* objects below. If the items in the targets list are vector layers * objects below. If the items in the targets list are vector layers
* (instead of configuration objects), the defaults from the <defaults> * (instead of configuration objects), the defaults from the <defaults>
* property will apply. The editable layer itself may be a target * property will apply. The editable layer itself may be a target
* layer - allowing newly created or edited features to be snapped to * layer, allowing newly created or edited features to be snapped to
* existing features from the same layer. If no targets are provided * existing features from the same layer. If no targets are provided
* the layer given in the constructor (as <layer>) will become the * the layer given in the constructor (as <layer>) will become the
* initial target. * initial target.

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license. * full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the * See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */ * full text of the license. */

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license. * full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the * See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */ * full text of the license. */
@@ -175,8 +175,7 @@ OpenLayers.Control.TouchNavigation = OpenLayers.Class(OpenLayers.Control, {
* evt - {Event} * evt - {Event}
*/ */
defaultDblClick: function (evt) { defaultDblClick: function (evt) {
var newCenter = this.map.getLonLatFromViewPortPx(evt.xy); this.map.zoomTo(this.map.zoom + 1, evt.xy);
this.map.setCenter(newCenter, this.map.zoom + 1);
}, },
CLASS_NAME: "OpenLayers.Control.TouchNavigation" CLASS_NAME: "OpenLayers.Control.TouchNavigation"

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license. * full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the * See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */ * full text of the license. */

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license. * full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the * See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */ * full text of the license. */

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license. * full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the * See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */ * full text of the license. */
@@ -49,23 +49,25 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
*/ */
maxFeatures: 10, maxFeatures: 10,
/** APIProperty: clickCallback /**
* {String} The click callback to register in the * APIProperty: clickCallback
* {<OpenLayers.Handler.Click>} object created when the hover * {String} The click callback to register in the
* option is set to false. Default is "click". * {<OpenLayers.Handler.Click>} object created when the hover
* option is set to false. Default is "click".
*/ */
clickCallback: "click", clickCallback: "click",
/** APIProperty: output /**
* {String} Either "features" or "object". When triggering a * APIProperty: output
* getfeatureinfo request should we pass on an array of features * {String} Either "features" or "object". When triggering a getfeatureinfo
* or an object with with a "features" property and other properties * request should we pass on an array of features or an object with with
* (such as the url of the WMS). Default is "features". * a "features" property and other properties (such as the url of the
* WMS). Default is "features".
*/ */
output: "features", output: "features",
/** /**
* Property: layers * APIProperty: layers
* {Array(<OpenLayers.Layer.WMS>)} The layers to query for feature info. * {Array(<OpenLayers.Layer.WMS>)} The layers to query for feature info.
* If omitted, all map WMS layers with a url that matches this <url> or * If omitted, all map WMS layers with a url that matches this <url> or
* <layerUrls> will be considered. * <layerUrls> will be considered.
@@ -73,21 +75,21 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
layers: null, layers: null,
/** /**
* Property: queryVisible * APIProperty: queryVisible
* {Boolean} If true, filter out hidden layers when searching the map for * {Boolean} If true, filter out hidden layers when searching the map for
* layers to query. Default is false. * layers to query. Default is false.
*/ */
queryVisible: false, queryVisible: false,
/** /**
* Property: url * APIProperty: url
* {String} The URL of the WMS service to use. If not provided, the url * {String} The URL of the WMS service to use. If not provided, the url
* of the first eligible layer will be used. * of the first eligible layer will be used.
*/ */
url: null, url: null,
/** /**
* Property: layerUrls * APIProperty: layerUrls
* {Array(String)} Optional list of urls for layers that should be queried. * {Array(String)} Optional list of urls for layers that should be queried.
* This can be used when the layer url differs from the url used for * This can be used when the layer url differs from the url used for
* making GetFeatureInfo requests (in the case of a layer using cached * making GetFeatureInfo requests (in the case of a layer using cached
@@ -96,18 +98,18 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
layerUrls: null, layerUrls: null,
/** /**
* Property: infoFormat * APIProperty: infoFormat
* {String} The mimetype to request from the server. If you are using * {String} The mimetype to request from the server. If you are using
* drillDown mode and have multiple servers that do not share a common * drillDown mode and have multiple servers that do not share a common
* infoFormat, you can override the control's infoFormat by providing an * infoFormat, you can override the control's infoFormat by providing an
* INFO_FORMAT parameter in your <OpenLayers.Layer.WMS> instance(s). * INFO_FORMAT parameter in your <OpenLayers.Layer.WMS> instance(s).
*/ */
infoFormat: 'text/html', infoFormat: 'text/html',
/** /**
* Property: vendorParams * APIProperty: vendorParams
* {Object} Additional parameters that will be added to the request, for * {Object} Additional parameters that will be added to the request, for
* WMS implementations that support them. This could e.g. look like * WMS implementations that support them. This could e.g. look like
* (start code) * (start code)
* { * {
* radius: 5 * radius: 5
@@ -117,14 +119,14 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
vendorParams: {}, vendorParams: {},
/** /**
* Property: format * APIProperty: format
* {<OpenLayers.Format>} A format for parsing GetFeatureInfo responses. * {<OpenLayers.Format>} A format for parsing GetFeatureInfo responses.
* Default is <OpenLayers.Format.WMSGetFeatureInfo>. * Default is <OpenLayers.Format.WMSGetFeatureInfo>.
*/ */
format: null, format: null,
/** /**
* Property: formatOptions * APIProperty: formatOptions
* {Object} Optional properties to set on the format (if one is not provided * {Object} Optional properties to set on the format (if one is not provided
* in the <format> property. * in the <format> property.
*/ */

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license. * full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the * See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */ * full text of the license. */

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license. * full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the * See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */ * full text of the license. */
@@ -37,9 +37,9 @@ OpenLayers.Control.Zoom = OpenLayers.Class(OpenLayers.Control, {
/** /**
* APIProperty: zoomOutText * APIProperty: zoomOutText
* {String} * {String}
* Text for zoom-out link. Default is "-". * Text for zoom-out link. Default is "\u2212".
*/ */
zoomOutText: "-", zoomOutText: "\u2212",
/** /**
* APIProperty: zoomOutId * APIProperty: zoomOutId

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license. * full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the * See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */ * full text of the license. */
@@ -69,7 +69,8 @@ OpenLayers.Control.ZoomBox = OpenLayers.Class(OpenLayers.Control, {
*/ */
zoomBox: function (position) { zoomBox: function (position) {
if (position instanceof OpenLayers.Bounds) { if (position instanceof OpenLayers.Bounds) {
var bounds; var bounds,
targetCenterPx = position.getCenterPixel();
if (!this.out) { if (!this.out) {
var minXY = this.map.getLonLatFromPixel({ var minXY = this.map.getLonLatFromPixel({
x: position.left, x: position.left,
@@ -82,13 +83,12 @@ OpenLayers.Control.ZoomBox = OpenLayers.Class(OpenLayers.Control, {
bounds = new OpenLayers.Bounds(minXY.lon, minXY.lat, bounds = new OpenLayers.Bounds(minXY.lon, minXY.lat,
maxXY.lon, maxXY.lat); maxXY.lon, maxXY.lat);
} else { } else {
var pixWidth = Math.abs(position.right-position.left); var pixWidth = position.right - position.left;
var pixHeight = Math.abs(position.top-position.bottom); var pixHeight = position.bottom - position.top;
var zoomFactor = Math.min((this.map.size.h / pixHeight), var zoomFactor = Math.min((this.map.size.h / pixHeight),
(this.map.size.w / pixWidth)); (this.map.size.w / pixWidth));
var extent = this.map.getExtent(); var extent = this.map.getExtent();
var center = this.map.getLonLatFromPixel( var center = this.map.getLonLatFromPixel(targetCenterPx);
position.getCenterPixel());
var xmin = center.lon - (extent.getWidth()/2)*zoomFactor; var xmin = center.lon - (extent.getWidth()/2)*zoomFactor;
var xmax = center.lon + (extent.getWidth()/2)*zoomFactor; var xmax = center.lon + (extent.getWidth()/2)*zoomFactor;
var ymin = center.lat - (extent.getHeight()/2)*zoomFactor; var ymin = center.lat - (extent.getHeight()/2)*zoomFactor;
@@ -96,18 +96,27 @@ OpenLayers.Control.ZoomBox = OpenLayers.Class(OpenLayers.Control, {
bounds = new OpenLayers.Bounds(xmin, ymin, xmax, ymax); bounds = new OpenLayers.Bounds(xmin, ymin, xmax, ymax);
} }
// always zoom in/out // always zoom in/out
var lastZoom = this.map.getZoom(); var lastZoom = this.map.getZoom(),
this.map.zoomToExtent(bounds); size = this.map.getSize(),
centerPx = {x: size.w / 2, y: size.h / 2},
zoom = this.map.getZoomForExtent(bounds),
oldRes = this.map.getResolution(),
newRes = this.map.getResolutionForZoom(zoom),
zoomOriginPx = {
x: (oldRes * targetCenterPx.x - newRes * centerPx.x) /
(oldRes - newRes),
y: (oldRes * targetCenterPx.y - newRes * centerPx.y) /
(oldRes - newRes)
};
this.map.zoomTo(zoom, zoomOriginPx);
if (lastZoom == this.map.getZoom() && this.alwaysZoom == true){ if (lastZoom == this.map.getZoom() && this.alwaysZoom == true){
this.map.zoomTo(lastZoom + (this.out ? -1 : 1)); this.map.zoomTo(lastZoom + (this.out ? -1 : 1));
} }
} else if (this.zoomOnClick) { // it's a pixel } else if (this.zoomOnClick) { // it's a pixel
if (!this.out) { if (!this.out) {
this.map.setCenter(this.map.getLonLatFromPixel(position), this.map.zoomTo(this.map.getZoom() + 1, position);
this.map.getZoom() + 1);
} else { } else {
this.map.setCenter(this.map.getLonLatFromPixel(position), this.map.zoomTo(this.map.getZoom() - 1, position);
this.map.getZoom() - 1);
} }
} }
}, },

View File

@@ -1,10 +1,10 @@
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license. * full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the * See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */ * full text of the license. */
/** /**
* @requires OpenLayers/Control.js * @requires OpenLayers/Control/Button.js
*/ */
/** /**
@@ -14,21 +14,15 @@
* Inherits from: * Inherits from:
* - <OpenLayers.Control> * - <OpenLayers.Control>
*/ */
OpenLayers.Control.ZoomIn = OpenLayers.Class(OpenLayers.Control, { OpenLayers.Control.ZoomIn = OpenLayers.Class(OpenLayers.Control.Button, {
/**
* Property: type
* {String} The type of <OpenLayers.Control> -- When added to a
* <Control.Panel>, 'type' is used by the panel to determine how to
* handle our events.
*/
type: OpenLayers.Control.TYPE_BUTTON,
/** /**
* Method: trigger * Method: trigger
*/ */
trigger: function(){ trigger: function(){
this.map.zoomIn(); if (this.map) {
this.map.zoomIn();
}
}, },
CLASS_NAME: "OpenLayers.Control.ZoomIn" CLASS_NAME: "OpenLayers.Control.ZoomIn"

View File

@@ -1,10 +1,10 @@
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license. * full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the * See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */ * full text of the license. */
/** /**
* @requires OpenLayers/Control.js * @requires OpenLayers/Control/Button.js
*/ */
/** /**
@@ -14,21 +14,15 @@
* Inherits from: * Inherits from:
* - <OpenLayers.Control> * - <OpenLayers.Control>
*/ */
OpenLayers.Control.ZoomOut = OpenLayers.Class(OpenLayers.Control, { OpenLayers.Control.ZoomOut = OpenLayers.Class(OpenLayers.Control.Button, {
/**
* Property: type
* {String} The type of <OpenLayers.Control> -- When added to a
* <Control.Panel>, 'type' is used by the panel to determine how to
* handle our events.
*/
type: OpenLayers.Control.TYPE_BUTTON,
/** /**
* Method: trigger * Method: trigger
*/ */
trigger: function(){ trigger: function(){
this.map.zoomOut(); if (this.map) {
this.map.zoomOut();
}
}, },
CLASS_NAME: "OpenLayers.Control.ZoomOut" CLASS_NAME: "OpenLayers.Control.ZoomOut"

Some files were not shown because too many files have changed in this diff Show More