Compare commits

..

646 Commits

Author SHA1 Message Date
ahocevar
79750c662c Merge pull request #1056 from openlayers/doc
Basic docs
2013-09-24 07:21:43 -07:00
Tim Schaub
394dfa297a Link to API docs 2013-09-24 15:14:50 +02:00
Tim Schaub
c4dba8e828 Link to website root 2013-09-24 15:14:49 +02:00
ahocevar
9e274a61db Fixing typo 2013-09-24 15:06:22 +02:00
Tim Schaub
5c98a47581 Bare bones index pages 2013-09-24 14:57:58 +02:00
Tim Schaub
a9b0e6239b Link to latest, fenced code blocks 2013-09-24 14:57:58 +02:00
ahocevar
860735d7e4 Nicer search box position 2013-09-24 14:56:25 +02:00
ahocevar
b80022036f ol3 logo for examples and apidoc header 2013-09-24 14:42:04 +02:00
ahocevar
d1c0665926 Adding heading 2013-09-24 13:46:14 +02:00
Frédéric Junod
ac6d8f2df1 Merge pull request #1057 from fredj/apidoc
Fix jsdoc formating
2013-09-24 04:30:47 -07:00
ahocevar
3adc46ae4a Adding basic concepts tutorial 2013-09-24 13:28:42 +02:00
Frederic Junod
ef929e9a72 Fix jsdoc formating 2013-09-24 12:18:00 +02:00
Tom Payne
3e8abadf95 Merge pull request #1053 from elemoine/sourceoptions
Use typedef in source code for SourceOptions
2013-09-24 03:03:12 -07:00
Tom Payne
a25eff9283 Merge pull request #1047 from twpayne/remove-load-events
Remove source load events
2013-09-24 02:50:13 -07:00
Frederic Junod
f07294698a Include ol.css in doc/quickstart.hbs 2013-09-24 11:15:26 +02:00
ahocevar
5ab7803402 New font and header background color
With this change, API docs and examples match the website design
of the new-build branch of openlayers.github.io better.
2013-09-24 10:50:27 +02:00
Tim Schaub
aec0c0d9af Adding YAML frontmatter
This will be parsed by the website build task
2013-09-24 10:39:34 +02:00
Tim Schaub
2f2ee22831 Moving quickstart to doc directory 2013-09-24 10:37:43 +02:00
Julien-Samuel Lacroix
3b7db642f1 QuickStart first draft 2013-09-24 10:36:29 +02:00
Tim Schaub
2610e9e0c3 Merge pull request #1054 from tschaub/apidoc
Differentiating doc from apidoc.
2013-09-23 15:38:29 -07:00
Tim Schaub
4def0c6a84 Differentiating doc from apidoc
This renames the doc task to apidoc.  The apidoc delegates to jsdoc3 currently.  We will have additional documentation that is not built by jsdoc3.  It makes sense to reserve the more general 'doc' name for building all documentation (not just apidoc).
2013-09-23 23:58:25 +02:00
Éric Lemoine
b2c336c29e Use typedef in source code for SourceOptions 2013-09-23 17:53:43 +02:00
Frédéric Junod
3546a15f39 Merge pull request #1049 from fredj/webgl_ie11
Add 'experimental-webgl' to ol.webgl.CONTEXT_IDS_ (IE11 support)
2013-09-23 05:55:17 -07:00
Frédéric Junod
29165ddc1f Merge pull request #1050 from fredj/social-links.js
Remove social-links.js script from examples and doc
2013-09-23 05:38:55 -07:00
Frederic Junod
d061994842 Remove webgl-experimental from ol.webgl.CONTEXT_IDS_ 2013-09-23 14:18:30 +02:00
Frederic Junod
88f938ea47 Remove social-links.js script from examples and doc 2013-09-23 13:58:12 +02:00
Frederic Junod
c7b5bd0b6d Add 'experimental-webgl' to ol.webgl.CONTEXT_IDS_ (IE11 support)
see: http://msdn.microsoft.com/en-us/library/ie/ff975238(v=vs.85).aspx
2013-09-23 09:38:45 +02:00
Tim Schaub
6276e633de Merge pull request #832 from fredj/feature_getset_id
Rename setFeatureId to setId (same for get).
2013-09-20 10:31:37 -07:00
Tim Schaub
5d04d74c92 Merge pull request #1045 from tschaub/advanced
Use "advanced" for the production loader.
2013-09-20 10:13:57 -07:00
Tim Schaub
6c2e5f6eca The production loader has special logic for advanced and raw modes 2013-09-20 15:29:29 +01:00
Tom Payne
bd81e6c9a9 Remove source load events 2013-09-20 13:37:40 +01:00
Tom Payne
56e352b7aa Dispatch change events instead of load events when sources change 2013-09-20 13:37:31 +01:00
Tom Payne
8a0809c673 Merge pull request #1028 from twpayne/remove-extent-tostring
Remove ol.extent.toString
2013-09-20 05:10:02 -07:00
Tom Payne
fd28d56c45 Merge pull request #1046 from twpayne/url-capitalization
Use URL instead of Url or url in comments and strings
2013-09-20 05:09:44 -07:00
Tom Payne
abaa220314 Use URL instead of Url or url in comments and strings 2013-09-20 12:28:04 +01:00
Tom Payne
f24c9a807f Merge pull request #1042 from fredj/esri_attributions
Add missing source attribution in xyz-esri example
2013-09-20 04:17:41 -07:00
Tom Payne
aa44547565 Remove ol.extent.toString 2013-09-20 12:14:41 +01:00
Marc Jansen
6a39d11222 Merge pull request #1034 from marcjansen/build-help
Add a help-target to build.py.
2013-09-20 03:47:21 -07:00
Tom Payne
a8d9dad552 Merge pull request #1036 from twpayne/async-tile-load
Asynchronos tile URL calculation
2013-09-20 02:23:09 -07:00
Tom Payne
f3336532dd Merge pull request #1043 from twpayne/remove-xyz-seturl-example
Remove xyz-seturl example
2013-09-20 01:59:33 -07:00
Tom Payne
265c5f1a11 Remove xyz-seturl example 2013-09-20 09:14:13 +01:00
Tim Schaub
387f60f1e5 Merge pull request #1041 from tschaub/antisocial
Don't display the social links on the example index.  Don't display the "mode" selection when running the development server.  Set the mode in the query string when the selection changes.
2013-09-19 16:44:09 -07:00
Bruno Binet
8ccc997ecd Merge pull request #1032 from bbinet/minmax_resolution
Add support for layer min/maxResolution
2013-09-19 09:11:16 -07:00
Frederic Junod
5c15c18f1a Remove xyz-seturl example 2013-09-19 17:23:25 +02:00
Bruno Binet
d1e9dd964b Be consistent with constant names 2013-09-19 16:59:38 +02:00
Bruno Binet
690ed1ed8e Improve doc for minResolution and maxResolution 2013-09-19 16:59:38 +02:00
Bruno Binet
97556f234f Add min-max-resolution example
Show/hide layers depending on current map resolution.
2013-09-19 16:59:38 +02:00
Bruno Binet
fa484cca8c Fix tests for min/maxResolution 2013-09-19 16:59:38 +02:00
Bruno Binet
cf4799e87c Add support for layer min/maxResolution 2013-09-19 16:59:38 +02:00
Tim Schaub
ea66ddf3a4 Don't show compiled option when using node dev server 2013-09-19 15:20:11 +01:00
Tim Schaub
66e1b01c2d Use form.navbar-form for input elements in a navbar 2013-09-19 15:19:20 +01:00
Tim Schaub
ac4b031353 Remove social links from example index 2013-09-19 15:17:02 +01:00
Frederic Junod
e97b2d35d4 Add missing source attribution in xyz-esri example 2013-09-19 16:07:11 +02:00
Frédéric Junod
9a8269f780 Merge pull request #1040 from fredj/goog_global
Use goog.global instead of window
2013-09-19 06:46:34 -07:00
Marc Jansen
346fe30a1b Merge pull request #1038 from marcjansen/example-compression-selection
examples: remove social links / include tool to switch compression
2013-09-19 06:10:53 -07:00
Marc Jansen
9e0b560cf6 Remove now obsolete file social-link.js. 2013-09-19 15:05:31 +02:00
Frederic Junod
4666f64673 Use goog.global instead of window
See f1f319d6ad
2013-09-19 15:03:17 +02:00
Frédéric Junod
58693be9e6 Merge pull request #1039 from fredj/perf
Only reset canvas transformation matrix when it has changed
2013-09-19 02:37:57 -07:00
Frederic Junod
9906497cb8 Only reset canvas transformation matrix when it has changed 2013-09-18 19:12:36 +02:00
Frédéric Junod
8a97535d93 Merge pull request #1037 from fredj/perf
ol.TileCoord.getKeyZXY optimization
2013-09-18 09:16:28 -07:00
Marc Jansen
62a7505d2b Mention default target 'build' in the help output. 2013-09-18 17:49:17 +02:00
Marc Jansen
6d40b170d6 Examples: Remove social links. 2013-09-18 17:39:52 +02:00
Marc Jansen
886e38a69b Examples: Add switch compilation level tool. 2013-09-18 17:26:46 +02:00
Frederic Junod
e30d0fefb0 Concatenate keys instead of joining it
For performances reasons, see http://jsperf.com/array-join-string-concat
2013-09-18 17:19:50 +02:00
Frederic Junod
42f7288d73 Assign function instead of calling it 2013-09-18 17:19:50 +02:00
Tom Payne
0e4c5d10c5 Merge pull request #1024 from pagameba/doc-interactions
Documentation for Interactions
2013-09-18 08:05:46 -07:00
Tom Payne
293ccfda8a Export ol.ImageTile#getImage 2013-09-18 15:37:45 +01:00
Tom Payne
004898e462 Export ol.TileCoord#getZXY 2013-09-18 15:37:45 +01:00
Tom Payne
8ea6a50f03 Add ol.TileCoord#getZXY 2013-09-18 15:37:45 +01:00
Tom Payne
9397720c8e Export ol.Tile#getTileCoord 2013-09-18 15:33:54 +01:00
Tom Payne
f3d5a5c37b Add tileLoadFunction option to ol.source.XYZ 2013-09-18 13:40:07 +01:00
Tom Payne
6896e920f9 Allow tile load function to be overridden 2013-09-18 13:39:42 +01:00
Tom Payne
0085623eee Add ol.TileLoadFunctionType 2013-09-18 13:37:12 +01:00
Marc Jansen
9deffc9d87 Merge pull request #1035 from marcjansen/jsdoc
Fix spelling on API-doc index page.
2013-09-18 04:50:25 -07:00
Marc Jansen
67f2e57635 Fix spelling on API-doc index page. 2013-09-18 13:48:47 +02:00
Marc Jansen
b8a7c5ee9e Add a help-target to build.py. 2013-09-18 13:24:02 +02:00
Tom Payne
578e83d80a Merge pull request #1033 from twpayne/no-coffee
Remove dependency on CoffeeScript
2013-09-18 03:39:10 -07:00
Tom Payne
fef6f5c0a5 Use compiled mocha-phantomjs.js instead of CoffeScript 2013-09-18 11:25:55 +01:00
Tom Payne
98ba6b63a4 Add compiled version of mocha-phantomjs.js 2013-09-18 11:25:28 +01:00
Frederic Junod
764aacb568 Rename {get|set}FeatureId to {get|set}Id 2013-09-17 12:50:56 +02:00
Frédéric Junod
c0486f6f65 Merge pull request #1031 from fredj/unused_requires
Remove unused goog.requires
2013-09-17 01:40:56 -07:00
Frederic Junod
7de0e79c62 Remove unused goog.requires 2013-09-17 09:41:22 +02:00
Éric Lemoine
ddc8fbcff7 Merge pull request #1001 from elemoine/keyhandler
Don't register for keyboard events on the document
2013-09-16 13:59:42 -07:00
Éric Lemoine
aa5214d3a1 Add an "accessible" example 2013-09-16 22:51:57 +02:00
Éric Lemoine
b81a4e875b Remove noModifierKeys condition for keyboad zoom
Refs #917. With the key hanler now attached to the map target by default we can remove the noModifierKeys condition for the keyboard zoom interaction. This will prevent the back button shortcut (alt + <back arrow>) to work, but it's ok, the map is focused so it's the one with the highest priority.
2013-09-16 22:51:44 +02:00
Éric Lemoine
f863ee9e37 Attach key handler to map target 2013-09-16 22:43:26 +02:00
Éric Lemoine
4abdac2abf Merge pull request #1030 from elemoine/touches
Exclude tiles that touches the source extent
2013-09-16 10:00:11 -07:00
Éric Lemoine
4990c797d1 WMTS tiles touching the extent are excluded 2013-09-16 15:53:13 +02:00
Éric Lemoine
832be21c0f WMS tiles touching the extent are excluded 2013-09-16 15:52:52 +02:00
Éric Lemoine
70c66d4cf1 Add ol.extent.touches 2013-09-16 15:51:12 +02:00
Tim Schaub
f54a54a432 Merge pull request #1029 from tschaub/tilejson-extent
Use proper extent structure for TileJSON.
2013-09-16 06:47:29 -07:00
Tim Schaub
7caaed4218 Merge pull request #1017 from tschaub/provide-objects-only
Never use goog.provide with primitives (especially with falsely values).
2013-09-16 06:46:26 -07:00
Tim Schaub
8b25e2a63e Merge pull request #955 from tschaub/proj
Move projection to ol.proj namespace and limit exports.
2013-09-16 06:42:38 -07:00
Tim Schaub
97d614285e New extent structure for TileJSON
The change in e806f51b3d neglected to correct the extent handling for the TileJSON source.
2013-09-15 22:22:20 -06:00
Tim Schaub
e1bafd2f6e Export ol.proj.Projection.prototype.getExtent for use in WMTS example 2013-09-15 22:04:51 -06:00
Tim Schaub
9a2dac7182 Limit ol.proj exports 2013-09-15 22:04:51 -06:00
Tim Schaub
b524de417b Rename ol.ProjectionUnits to ol.proj.Units 2013-09-15 22:04:51 -06:00
Tim Schaub
9a29c0e22d Rename ol.ProjectionLike to ol.proj.ProjectionLike 2013-09-15 22:01:56 -06:00
Tim Schaub
3b20cc7b53 Rename ol.Projection to ol.proj.Projection 2013-09-15 22:01:56 -06:00
Tim Schaub
b192335e56 Merge pull request #1027 from tschaub/closure-util
Use the closure-util package.  Documentation will come when this is a more complete solution.  See #1027 for basic usage instructions.
2013-09-15 15:36:13 -07:00
Tim Schaub
591f022e9a Merge pull request #956 from tschaub/extent
Change structure for ol.Extent.  This makes extent use `[minX, minY, maxX, maxY]` order.
2013-09-15 15:28:35 -07:00
Tim Schaub
13c84b0523 Export ol.Geolocation.SUPPORTED and provide ol.Geolocation 2013-09-15 15:54:41 -06:00
Tim Schaub
589c6f8a0b Export ol.DeviceOrientation.SUPPORTED and provide ol.DeviceOrientation 2013-09-15 15:54:41 -06:00
Tim Schaub
210b489a6c Provide ol.renderer.dom instead of ol.renderer.dom.SUPPORTED 2013-09-15 15:54:41 -06:00
Tim Schaub
a2c70dba85 Provide ol.canvas instead of ol.canvas.SUPPORTED
This is not currently used outside the library, so it is not exported.
2013-09-15 15:54:01 -06:00
Tim Schaub
54738e29eb Export ol.webgl.SUPPORTED and provide ol.webgl 2013-09-15 15:51:17 -06:00
Éric Lemoine
bbe4417be5 Merge pull request #1025 from elemoine/notify
Remove ol.Object#bindTo noNotify option
2013-09-15 14:28:58 -07:00
Tim Schaub
f1f319d6ad Preemptively set global properties
As mentioned in the comments, calling goog.getUid and goog.events.listen on the global object (as done in map.js and deviceorientation.js) set global properties.  To let Mocha check for other leaks, we preemptively set these properties.
2013-09-15 14:22:41 -06:00
Tim Schaub
13b55b04a8 Unnecessary spy 2013-09-15 10:41:44 -06:00
Éric Lemoine
009172951c WebGL image layer tests require the common proj 2013-09-15 10:37:22 -06:00
Éric Lemoine
ecd82297a0 Better setup/teardown for ol.proj tests 2013-09-15 10:37:01 -06:00
Tim Schaub
e806f51b3d Changing extent structure back to single array: [minX, minY, maxX, maxY]
This means we'll have to have a new structure and new methods for 3D envelopes.
2013-09-15 00:31:32 -06:00
Tim Schaub
de0e8aeced New extent structure in examples 2013-09-14 21:14:55 -06:00
Tim Schaub
e84e0e1233 WebGL renderer updates for new extent structure 2013-09-14 21:14:55 -06:00
Tim Schaub
1a7e99f67e DOM renderer updates for new extent structure 2013-09-14 21:13:47 -06:00
Tim Schaub
e575df6df0 Canvas renderer updates for new extent structure 2013-09-14 21:13:47 -06:00
Tim Schaub
3faa035de3 Geom2 package working with new extent structure 2013-09-14 21:13:47 -06:00
Tim Schaub
e6b395e2ee View support for new extent structure 2013-09-14 21:13:46 -06:00
Tim Schaub
511e5ad5e8 Vector layer updates for new extent structure 2013-09-14 21:13:46 -06:00
Tim Schaub
75cb19d7e1 Source updates for new extent structure 2013-09-14 21:13:46 -06:00
Tim Schaub
a670b7979c Tile grid working with new extent structure 2013-09-14 21:11:53 -06:00
Tim Schaub
65863614bb GeoJSON and TopoJSON tests for new extent structure 2013-09-14 21:11:53 -06:00
Tim Schaub
0eb4cd6dd4 Proj support for new extent structure 2013-09-14 21:11:53 -06:00
Tim Schaub
7d00159bff WMS capabilities parsing with new extent structure 2013-09-14 21:11:53 -06:00
Tim Schaub
5d18da4035 Filter encoding with new extent structure 2013-09-14 21:11:53 -06:00
Tim Schaub
3ea6041714 GML parsing with new extent structure 2013-09-14 21:11:53 -06:00
Tim Schaub
9226472380 Update geom package to use new extent structure 2013-09-14 21:11:52 -06:00
Tim Schaub
208d86b5bf Arg order for extent function in expressions 2013-09-14 21:11:52 -06:00
Tim Schaub
6955499534 Update rtree to use new extent structure 2013-09-14 21:11:52 -06:00
Tim Schaub
60bf396e25 Update geom package to use new extent structure 2013-09-14 21:11:52 -06:00
Tim Schaub
dbccb8b231 Function for cloning extents 2013-09-14 21:11:52 -06:00
Tim Schaub
fcf00dea8b New structure for extent: [minCoord, maxCoord] 2013-09-14 21:11:52 -06:00
Tim Schaub
3dc2b69615 Test conventions
* use `be` or `equal` for strict equality tests
 * use `be.a` for `instanceof` checks
 * use dot instead of bracket notation
2013-09-14 18:10:13 -06:00
Tim Schaub
377da9349e Don't use private date_ property (see #1026)
It looks like at some point the Closure Library exposed a public `date` property for this same purpose.  The version of the Closure Library that comes with the closure-util package uses this property.  At some point later, I'll demonstrate how we can control which version of the library we depend on.
2013-09-14 18:10:12 -06:00
Tim Schaub
75fffd1f47 Making use of the closure-util package
This provides some initial development utilities for people using Node.

Instructions for installing:

    npm install

After pulling down the dependencies, you can start a developement server that provides the libraries (ol and Closure Library) in debug mode (not minified/compiled).  Run the dev server with the following:

    npm start

Currently, the example index page needs to be built with `build.py`.  After building that, you should be able to browse all static files, view the examples and run the tests.
2013-09-14 18:10:12 -06:00
Paul Spencer
3a91aa3d36 fix lint issue 2013-09-13 11:23:06 -04:00
Paul Spencer
3ab50facc7 Label the link to ol.interaction as ol.interaction.Interaction
The documentation is really talking about instance of Interaction, not the namespace.  This is more clear for users.
2013-09-13 11:23:06 -04:00
Paul Spencer
28ee9bcd9b remove export for conditionType as it breaks the build to have it in there. 2013-09-13 11:23:06 -04:00
Paul Spencer
d7eee91195 Add exports for interactions. 2013-09-13 11:23:05 -04:00
Bart van den Eijnden
26b46d248b Merge pull request #1022 from bartvde/parser-api
Parser api changes (remove read/write for feature parsers and add parser to the filenames) (r=@elemoine)
2013-09-13 08:01:57 -07:00
Éric Lemoine
8301b01395 Remove ol.Object#bindTo noNotify option 2013-09-13 16:46:49 +02:00
Frédéric Junod
2ce1c29c4d Merge pull request #995 from fredj/export-map_example
Better user notification if a.download attribute is not supported
2013-09-13 05:11:15 -07:00
Bart van den Eijnden
d8ae3c161c rename parser files to have parser as part of their filename, so they follow the ol3 conventions 2013-09-13 11:05:00 +02:00
Bart van den Eijnden
99f2d0e3d5 do not export read and write for feature parsers 2013-09-13 10:35:57 +02:00
Éric Lemoine
60623e3061 Merge pull request #1020 from elemoine/condition
Change the interaction condition signature
2013-09-12 09:53:05 -07:00
Éric Lemoine
ba3f97d50a Change the interaction condition signature 2013-09-12 18:08:01 +02:00
Tim Schaub
daddc61dc6 Merge pull request #1015 from tschaub/export
Export ol.source.XYZ.prototype.setUrl.
2013-09-11 12:14:07 -07:00
Tom Payne
d1782dc4bb Merge pull request #1012 from twpayne/more-renames
More renames
2013-09-11 11:33:40 -07:00
Tim Schaub
c029e8770c Used in example but not exported (see #1011) 2013-09-11 12:21:27 -06:00
Éric Lemoine
364e31fdb1 Merge pull request #1013 from elemoine/tileimage
Even more renames
2013-09-11 09:28:42 -07:00
Éric Lemoine
78a3ac46dd Rename options type for ol.source.TileImage 2013-09-11 18:28:03 +02:00
Éric Lemoine
7db1b4b337 Rename file for ol.source.TileImage 2013-09-11 18:28:03 +02:00
Tom Payne
b2da95de4b Merge pull request #1011 from twpayne/set-url
Add ol.source.XYZ#setUrl
2013-09-11 09:17:07 -07:00
Tom Payne
d0216c80cd Rename ol.source.StaticImage to ol.source.ImageStatic 2013-09-11 17:48:49 +02:00
Tom Payne
4542c689e8 Add FIXME about avoiding tile cache clears 2013-09-11 17:12:58 +02:00
Tom Payne
ae6ecb7103 Add XYZ set URL example 2013-09-11 17:12:57 +02:00
Tom Payne
1ef4c379b2 Add ol.source.XYZ#setUrl and friends 2013-09-11 17:12:57 +02:00
Tom Payne
4ef6254c13 Add ol.source.TileImage#setTileUrlFunction 2013-09-11 17:12:57 +02:00
Tom Payne
184c2e52d5 Factor out ol.TileCoordTransformType 2013-09-11 17:12:57 +02:00
Tim Schaub
d57b4844d1 Merge pull request #979 from tschaub/xyz
Export ol.source.XYZ.
2013-09-11 07:55:57 -07:00
Tom Payne
a21ee997ba Rename ol.source.SingleImageWMS to ol.source.ImageWMS 2013-09-11 16:38:01 +02:00
Tim Schaub
1ee2da76af Add example using XYZ tiles from Esri 2013-09-11 00:41:25 -06:00
Tim Schaub
cf37566606 Remove unused require
This was unused before 03f7bb66374b162aab26289b761e7918b79c0ca7 as well.  It would be interesting to see how many other unused requires there are (types that are only referenced in comments but not used in code).
2013-09-11 00:17:02 -06:00
Tim Schaub
843334627e Moving maxZoom default to XYZ source.
No reason this convenience should be restricted to the OSM layer.
2013-09-11 00:17:01 -06:00
Tim Schaub
8d7d1412c9 Adding XYZOptions to objectliterals.jsdoc
I remain uncertain about when to use the @exportClass annotation and when to use the @exportSymbol.  osmsource.exports seems to get away with simply @exportSymbol, but many other sources use @exportProperty.
2013-09-11 00:17:01 -06:00
Tim Schaub
0df6cebff9 minZoom is not a supported property of ol.tilegrid.XYZOptions 2013-09-11 00:17:01 -06:00
Tim Schaub
a6fb72c240 Export XYZ source 2013-09-11 00:17:01 -06:00
Tim Schaub
32d35386ba Merge pull request #1008 from tschaub/code-gen
Non-greedy pattern matching for types.
2013-09-10 23:13:55 -07:00
Tim Schaub
4d71d2b1e8 Less greedy 2013-09-10 23:24:43 -06:00
Tim Schaub
919e2d39f1 Merge pull request #1009 from tschaub/tile
Use new name for tile layer in moveend example.
2013-09-10 22:23:20 -07:00
Tim Schaub
d9a2c66909 New name for tile layer 2013-09-10 21:59:08 -06:00
Tim Schaub
c845d85a31 Merge pull request #982 from tschaub/moveend
Fire a moveend event when the view settles.
2013-09-10 16:36:31 -07:00
Frédéric Junod
643e4592c5 Merge pull request #1007 from fredj/objectliterals
Fix ol.animation.BounceOptions apidoc (default easing function)
2013-09-10 09:18:39 -07:00
Frederic Junod
adf8422391 Fix ol.animation.BounceOptions apidoc (default easing function) 2013-09-10 18:16:33 +02:00
Frédéric Junod
398c527e1a Merge pull request #1006 from fredj/WMTSOptions
Add missing 'version' property to ol.source.WMTSOptions
2013-09-10 08:16:02 -07:00
Tim Schaub
ba7e0e7da3 Merge pull request #973 from tschaub/default-style
Rework default style handling.
2013-09-10 07:58:44 -07:00
Frederic Junod
25aa1688e5 Add 'version' property to ol.source.WMTSOptions 2013-09-10 16:40:36 +02:00
Frédéric Junod
2e4ffb3591 Merge pull request #1003 from fredj/extent
Minor coding style and simplification for ol.Extent
2013-09-10 07:06:31 -07:00
Tom Payne
b4c2cd0eb2 Merge pull request #1004 from twpayne/tiled-wms-rename
Rename tiledwmssource.exports to tilewmssource.exports
2013-09-10 06:54:28 -07:00
Tom Payne
ea653ceec8 Rename tiledwmssource.exports to tilewmssource.exports 2013-09-10 15:53:14 +02:00
Frederic Junod
f1bce39fa9 Rename optional param to opt_extent 2013-09-10 14:41:12 +02:00
Frederic Junod
d34a63944b Use ol.extent.createOrUpdate function 2013-09-10 14:33:12 +02:00
Éric Lemoine
48b2ece5a1 Merge pull request #1002 from elemoine/tilewms
Rename tiledwmssource.js to tilewmssource.js
2013-09-10 04:43:22 -07:00
Éric Lemoine
762fed6f8d Change Tiled to Tile in a comment 2013-09-10 09:41:38 +02:00
Éric Lemoine
8a7e13a50c Rename tiledwmssource.js to tilewmssource.js 2013-09-10 09:41:38 +02:00
Éric Lemoine
b92f5efbe8 Merge pull request #994 from elemoine/update-params
Allow changing parameters/dimensions for WMS and WMTS
2013-09-10 00:40:29 -07:00
Frédéric Junod
14d550de0f Merge pull request #997 from fredj/apidoc
More api doc content
2013-09-09 08:29:58 -07:00
Éric Lemoine
31cc1f5541 More robust coordinate keys for WMTS and TiledWMS
This uses more robust ZXY coordinate keys, and caches the key to avoid creating garbage each time getKeyZXY is called.
2013-09-09 17:01:38 +02:00
Éric Lemoine
0823ee4ad3 Add getDimensions/updateDimensions to WMTS 2013-09-09 17:00:05 +02:00
Olivier Terral
e16de02cb2 Add getParams/updateParams to TiledWMS 2013-09-09 17:00:05 +02:00
Tom Payne
8663a5027b Handle tile source revisions in DOM tile layer renderer 2013-09-09 17:00:05 +02:00
Tom Payne
00bdeb6bcf Don't use rendered framebuffer when source revision has changed 2013-09-09 17:00:05 +02:00
Tom Payne
cd0186dde5 Store revision number in sources and update it on changes 2013-09-09 17:00:05 +02:00
Tom Payne
4f27dd35d8 Allow tile cache key calculation to be overridden 2013-09-09 17:00:05 +02:00
Olivier Terral
9fb4514b4e Add getParams/updateParams to SingleImageWMS 2013-09-09 16:50:10 +02:00
Tom Payne
c82aeb586f Merge pull request #998 from twpayne/consistent-names
Consistent names
2013-09-09 07:48:42 -07:00
Tom Payne
bcb4813615 Rename ol.layer.VectorLayer2 to ol.layer.Vector2 2013-09-09 16:21:04 +02:00
Tom Payne
d1659b8e69 Rename ol.source.VectorSource2 to ol.source.Vector2 2013-09-09 15:18:31 +02:00
Tom Payne
23505799b6 Rename ol.test.source.MockTileSource to ol.test.source.TileMock 2013-09-09 15:17:36 +02:00
Tom Payne
8f8f94e697 Rename ol.layer.TileLayer to ol.layer.Tile 2013-09-09 15:14:45 +02:00
Tom Payne
8f6f5e42c6 Rename ol.source.TiledWMS to ol.source.TileWMS 2013-09-09 15:12:38 +02:00
Tom Payne
0235caa1e0 Rename ol.source.ImageTileSource to ol.source.TileImage 2013-09-09 15:09:25 +02:00
Tom Payne
bf1d804a5e Rename ol.source.DebugTileSource to ol.source.TileDebug 2013-09-09 15:07:05 +02:00
Frédéric Junod
7ffd2bcaa1 Merge pull request #993 from pagameba/deviceorientation-ios
Detect iOS compass heading
2013-09-09 05:57:34 -07:00
Tom Payne
71a396a189 Rename ol.source.TileSource to ol.source.Tile 2013-09-09 14:40:23 +02:00
Tom Payne
7d5a84ce8a Rename ol.layer.ImageLayer to ol.layer.Image 2013-09-09 14:36:40 +02:00
Tom Payne
5967f96047 Rename ol.source.ImageSource to ol.source.Image 2013-09-09 14:33:12 +02:00
Tom Payne
fc2975f346 Rename ol.layer.LayerGroup to ol.layer.Group 2013-09-09 14:23:16 +02:00
Tom Payne
e428b66ab4 Rename ol.layer.LayerBase to ol.layer.Base 2013-09-09 14:18:24 +02:00
Paul Spencer
4117a5df2d check iOS compass calibration via webkitCompassAccuracy
Ensure that webkitCompassAccuracy is not -1 as this indicates that the
compass has not been calibrated and its values cannot be trusted.
2013-09-09 08:05:37 -04:00
Paul Spencer
f56e01104b Merge pull request #1 from fredj/deviceorientation-ios
Rename externs/html5.js to externs/closure-compiler.js
2013-09-09 05:00:43 -07:00
Frederic Junod
03e2f1a903 Add links to Proj4js and CONTRIBUTING.md 2013-09-09 12:07:16 +02:00
Frederic Junod
20916c75bb Add more api doc 2013-09-09 12:07:03 +02:00
Frédéric Junod
cf7b40268b Merge pull request #988 from fredj/icon_example
IE10 compatibility: no tooltip on icon.html example
2013-09-09 01:58:22 -07:00
Frederic Junod
0efe92ab4c Fix popover in icon example 2013-09-09 10:23:28 +02:00
Frédéric Junod
f123f5e57b Merge pull request #986 from fredj/rotate-north_example
IE10 CSS compatibility: custom-controls example
2013-09-09 01:09:17 -07:00
Frederic Junod
77c7d02873 Better user notification if a.download attribute is not supported 2013-09-09 09:55:30 +02:00
Frederic Junod
0b82cb8050 Fix rotate-north control display on touch devices 2013-09-09 09:19:45 +02:00
Frederic Junod
4bae5e755a Rename externs/html5.js to externs/closure-compiler.js
Add add a fix for issues:
  * https://code.google.com/p/closure-compiler/issues/detail?id=1084
  * https://code.google.com/p/closure-compiler/issues/detail?id=1088
2013-09-08 16:53:28 +02:00
Éric Lemoine
5861f6a148 Merge pull request #992 from elemoine/urlfunction
Stricter with types
2013-09-07 22:44:49 -07:00
Paul Spencer
69872c99d2 Detect iOS compass heading
iOS webkit does not provide an absolute alpha, instead it provides
webkitCompassHeading.
2013-09-07 21:48:49 -04:00
Éric Lemoine
02a285665b Remove unneeded FIXME 2013-09-07 23:50:15 +02:00
Éric Lemoine
e01344f0da Be stricter with types in WMTS 2013-09-07 23:50:01 +02:00
Éric Lemoine
3036ee01ad Be stricter with types in BingMaps 2013-09-07 23:49:37 +02:00
Éric Lemoine
1e308e34f9 Stricter type def for ol.TileUrlFunctionType 2013-09-07 23:32:38 +02:00
Éric Lemoine
30acfc20c3 Stricter type def for ol.ImageUrlFunctionType 2013-09-07 23:32:30 +02:00
Tim Schaub
13a937fad7 Lazily create default style 2013-09-07 09:19:11 -06:00
Tim Schaub
cc11efa420 Merge pull request #958 from tschaub/requires
Make the `build/check-requires-timestamp` target work with namespace provides in cases where the namespace provide isn't required by a module that provides constructors or other objects within that namespace.  This may seem a bit odd, but if I want to provide `foo.bar.Bam` it isn't strictly necessary that my module require `foo.bar`.

To make this build target work, we stick with the following convention (used in the Closure Library):

 * If you want to make a function available via `goog.require`, use `goog.provide` to provide the object of which the function is a member (e.g. to make the `foo.bar.baz` function available, use `goog.provide('foo.bar')`).
2013-09-07 08:13:06 -07:00
Frédéric Junod
a177cf159b Merge pull request #990 from fredj/examples_no_webgl
Better user notification if WebGL is not supported
2013-09-06 14:35:54 -07:00
Frederic Junod
aa823e2b28 Better user notification if WebGL is not supported 2013-09-06 22:36:39 +02:00
Frederic Junod
393566155d Export ol.*.SUPPORTED symbols 2013-09-06 22:34:32 +02:00
Frédéric Junod
48bf1702d4 Merge pull request #981 from fredj/side-by-side
Side-by-side example broken
2013-09-06 12:51:43 -07:00
Frederic Junod
169e66835d Bind to layergroup instead of layers 2013-09-06 18:17:12 +02:00
Éric Lemoine
91b6258f13 Merge pull request #985 from ebelo/patch-1
add webgl only info
2013-09-06 02:09:03 -07:00
Emmanuel Belo
dbfa1726d5 Add "WebGL only" note to bind-input example 2013-09-06 11:05:43 +02:00
Éric Lemoine
bebe39102c Merge pull request #978 from pagameba/doc-deviceorientation
More comprehensive docs for ol.DeviceOrientation
2013-09-06 01:39:17 -07:00
Tim Schaub
6617969d36 Example using the moveend event 2013-09-05 15:36:03 -06:00
Tim Schaub
50ed564bf6 Fire a moveend event after rendering
The moveend event is fired after rendering if there is no pending animation, current interaction, or other pre-render functions in the queue.
2013-09-05 15:35:53 -06:00
Paul Spencer
a0ca05d18e Use markdown format for inline links 2013-09-05 09:01:49 -04:00
Paul Spencer
74158e52be Update based on comments
This removes @class and fixes the return type pattern to match the
project standard.  There are a couple of minor changes to the text as
well.
2013-09-05 07:57:16 -04:00
Paul Spencer
f9ba90f4ca More comprehensive docs for ol.DeviceOrientation
Adding an extended class description of DeviceOrientation along with
some additional details in the property accessors.
2013-09-04 21:28:59 -04:00
Tim Schaub
15609f36ad Unused imports 2013-09-04 13:56:03 -06:00
Tim Schaub
2ac3d4d2cd Export namespaces instead of functions in generated code 2013-09-04 13:56:02 -06:00
Tim Schaub
8b7a0a060c Export ol.interaction namespace instead of the defaults function 2013-09-04 13:55:54 -06:00
Tim Schaub
716b7b0cec Export ol.control namespace instead of ol.control.defaults function 2013-09-04 13:55:54 -06:00
Tim Schaub
7d510310ed Removing unnecessary require 2013-09-04 13:55:54 -06:00
Tim Schaub
36ea408ed2 Handle namespace provides
It looks like the convention in the Closure Library is to export either namespaces (starting with lowercase), constructors (starting with uppercase), or enums (all uppercase, one instance).  I don't see any places where the Closure Library exports a function that is not a constructor.

Following the same convention, when we export `ol.foo`, it means we are making available function properties of the `ol.foo` object that start with a lowercase letter.
2013-09-04 13:55:54 -06:00
Tim Schaub
fa1601f04f Export namespaces or constructors but not functions 2013-09-04 13:55:54 -06:00
Tim Schaub
8ca3f13bd2 Instead of providing animation functions, provide the namespace
This follows the convention in the Closure Library of providing either namespace objects (where the property starts with a lowercase letter), constructors (where the property starts with an uppercase letter), or enums (all uppercase properties, only one instance of this in the closure library).
2013-09-04 13:55:36 -06:00
Frédéric Junod
cd11ebbc8a Merge pull request #976 from fredj/focus_touchend
Reset the map focus on 'mouseout' and 'touchend'
2013-09-04 07:06:22 -07:00
Frederic Junod
ae314916cf Reset the map focus on 'mouseout' and 'touchend' 2013-09-04 13:21:06 +02:00
Éric Lemoine
69107621bf Merge pull request #975 from elemoine/set-target
Remove ol.Map#target_
2013-09-04 04:11:49 -07:00
Éric Lemoine
fe1f10e797 No need for ol.Map#target_ 2013-09-04 12:08:15 +02:00
Tom Payne
9c28d0c112 Merge pull request #971 from twpayne/set-target
Cleaner ol.Map#setTarget handling
2013-09-04 02:32:02 -07:00
Frédéric Junod
25b99d5997 Merge pull request #925 from fredj/ms_pointer_events
MSPointer events fixes
2013-09-03 22:34:14 -07:00
Tim Schaub
a34f5d110c Merge pull request #949 from tschaub/feature-exports
Limited feature exports.
2013-09-03 16:17:32 -07:00
Tim Schaub
bd4f2bf1cb Merge pull request #972 from tschaub/before-render
Rename addPreRenderFunction to beforeRender and remove the plural.
2013-09-03 16:16:48 -07:00
ahocevar
94942e636c Merge pull request #969 from ahocevar/master
WMS getFeatureInfoOptions ignored in minified build
2013-09-03 12:57:09 -07:00
ahocevar
3bce782943 Making sure that options are not renamed 2013-09-03 20:02:49 +02:00
Tim Schaub
8e2b065ece Exporting set and setGeometry
Since the set method is exported on ol.Object, we need to export the method on the feature prototype to get correct behavior.
2013-09-03 11:54:58 -06:00
Tim Schaub
dc76b81780 Rename addPreRenderFunction to beforeRender and remove the plural 2013-09-03 10:57:31 -06:00
Tom Payne
aafd7e91cc Update teleport example to use string target 2013-09-03 15:26:19 +02:00
Tom Payne
83a9724270 Update ol.control.FullScreen to handle string targets 2013-09-03 15:26:19 +02:00
Tom Payne
53223be376 Perform ol.Map#setTarget string-to-Element conversion in event handler
With this change, ol.Map#setTarget no longer changes the type of the
value passed to it.
2013-09-03 15:26:19 +02:00
Éric Lemoine
e83e0e1374 Merge pull request #970 from pagameba/doc-GeolocationPositionOptions
Link to HTML5 Geolocation PositionOptions docs
2013-09-03 06:05:35 -07:00
Paul Spencer
fa48fc1905 Link to HTML5 Geolocation PositionOptions docs 2013-09-03 07:54:20 -04:00
Frederic Junod
f994c4f8a1 Only dispatch touchmove events after a touchstart 2013-09-03 09:35:30 +02:00
Frederic Junod
77f6b4ff59 Only consider touch events to compute ol.interaction.Touch.targetTouches 2013-09-03 09:35:30 +02:00
Frederic Junod
2b5e0c2c31 Change touchmove and touchstart listened element to 'document'
As for the mouse events, this allows to drag, zoom or rotate the map
with pointer(s) who moved outside of the viewport.
2013-09-03 09:35:30 +02:00
Tim Schaub
85509e1a40 Merge pull request #957 from tschaub/use-coordinate
Use ol.Coordinate instead of ol.geom.Vertex.
2013-09-02 15:53:29 -07:00
Éric Lemoine
e826e83530 Merge pull request #940 from elemoine/getarray
Export ol.Collection#getArray
2013-09-02 09:24:22 -07:00
Éric Lemoine
d68f411e82 Add doc for ol.Collection#getArray 2013-09-02 18:24:07 +02:00
Frédéric Junod
4483725185 Merge pull request #933 from fredj/focus
Move focus_ position update into handleMapBrowserEvent
2013-09-02 08:16:55 -07:00
Éric Lemoine
6a66e749f6 Merge pull request #953 from elemoine/overlay
Make ol.Overlay consistent with ol.control.Control
2013-09-02 07:03:11 -07:00
ahocevar
39b4da5ca2 Merge pull request #945 from ahocevar/select-followup
Follow-up improvements for #897
2013-09-02 06:47:01 -07:00
Éric Lemoine
09d9f28fe1 Merge pull request #963 from elemoine/getcontrols
Export ol.Map.prototype.getControls
2013-09-02 05:55:51 -07:00
Frédéric Junod
7b3a95288e Merge pull request #966 from fredj/geolocation_example
Reduce the width of the div to better see the error messages
2013-09-02 05:53:20 -07:00
Tim Schaub
12839f6f50 Merge pull request #946 from tschaub/control-options
Remove map from ControlOptions.
2013-09-02 05:40:45 -07:00
Frederic Junod
19f8ba75bc Reduce the width of the div to better see the error messages 2013-09-02 14:40:34 +02:00
Éric Lemoine
52c58721e1 export ol.Map.prototype.getControls 2013-09-02 14:17:23 +02:00
Éric Lemoine
7e25ecb3dc Remove map from OverlayOptions 2013-09-02 14:15:11 +02:00
Éric Lemoine
dd4b2e3e88 Add overlay-related methods to ol.Map 2013-09-02 14:12:54 +02:00
Éric Lemoine
3885815c1d Merge pull request #959 from probins/controlexamples
Out-of-date examples in control api docs
2013-09-02 05:10:47 -07:00
Peter Robins
6b61e9d84b Remove examples from control api docs
[ci skip]
2013-09-02 07:44:08 -04:00
Éric Lemoine
1c72a4d078 Merge pull request #947 from elemoine/attribution
Make ol.Attribution take an options object
2013-09-02 03:10:41 -07:00
Éric Lemoine
7af4cbb75e Export ol.Collection#getArray 2013-09-02 11:25:52 +02:00
Frédéric Junod
fdc70f3c30 Merge pull request #962 from fredj/lint
Reorder goog.require
2013-09-02 02:17:55 -07:00
Frederic Junod
34f6ba4ee8 Reorder goog.require 2013-09-02 11:01:31 +02:00
Éric Lemoine
e2a1c13439 Merge pull request #960 from elemoine/handlemappostrender
Remove handleMapPostrender extension point
2013-09-01 14:15:19 -07:00
Tim Schaub
109ef38d69 Exporting setMap so it is documented for custom controls 2013-08-31 16:40:46 -06:00
Éric Lemoine
96ef1ed3bd Remove handleMapPostrender extension point 2013-08-31 23:25:08 +02:00
Tim Schaub
8844310bf4 Call setMap instead of passing map to control 2013-08-31 14:45:03 -06:00
Tim Schaub
3e1de0b1ad Call addControl instead of passing map to control 2013-08-31 14:44:29 -06:00
Tim Schaub
6d9d5ecb4b Update ZoomSlider example in docs 2013-08-31 07:29:44 -06:00
Tim Schaub
96dfe5656d Merge pull request #950 from pagameba/doc-animations
Improve documentation for animation-related stuff.
2013-08-30 14:49:07 -07:00
Tim Schaub
b17feb4580 Add extra requires (see #958) 2013-08-30 15:20:21 -06:00
ahocevar
d8bc769758 Do not delete from oldFeatureMap 2013-08-30 23:18:59 +02:00
ahocevar
cbf7f91cfb instanceof check to avoid ducktyping 2013-08-30 23:18:17 +02:00
Tim Schaub
4679ba77c4 Don't export ol.control.Control.prototype.setMap 2013-08-30 14:59:47 -06:00
Tim Schaub
b479909e25 Remove map from control options 2013-08-30 14:59:21 -06:00
Tim Schaub
33f4d1e0ee Add missing provide and require for ol.geom 2013-08-30 13:32:04 -06:00
Tim Schaub
58fe110419 Rename ol.geom.VertexArray to ol.CoordinateArray 2013-08-30 13:30:53 -06:00
Tim Schaub
7165d414c7 Use ol.Coordinate instead of ol.geom.Vertex 2013-08-30 13:30:25 -06:00
Tim Schaub
6f98a75fb8 Limit feature exports 2013-08-30 13:14:17 -06:00
Paul Spencer
bfa1fbc2cd remove trailing whitespace to make the linter happy. 2013-08-30 13:31:10 -04:00
Paul Spencer
8c4c83b207 Improve documentation for animation-related stuff
The animation-related code is missing sufficient detail to make it
usable without digging in to the code.  This adds some additional
detail to the ol.animation namespace, the related options, and makes
note of the existance of ol.animation in the documentation of
ol.Map.addPreRenderFunction(s).
2013-08-30 11:32:47 -04:00
Éric Lemoine
729039ba04 Adapt examples to new signature for ol.Attribution 2013-08-30 16:50:36 +02:00
Éric Lemoine
38ab64c3c3 Adapt sources to new signature for ol.Attribution 2013-08-30 16:50:36 +02:00
Éric Lemoine
818894bb56 ol.Attribution is a single-arg constructor 2013-08-30 16:50:36 +02:00
ahocevar
9dfbfab648 Follow-up improvements for #897
* Interaction is no goog.Disposable any more.
* Permanent cleanup during selection instead of disposeInternal.
* Moved selectionLayers creation outside feature loop.
* Maintain selectedFeatures and unselectedFeatures only for
  layers that have a setRenderIntent method.
2013-08-30 16:26:49 +02:00
ahocevar
29317c3316 Merge pull request #897 from ahocevar/select
Select control
2013-08-30 06:25:14 -07:00
ahocevar
643eb5c4cc Better initial extent 2013-08-30 14:46:32 +02:00
ahocevar
9dae49dc18 Symbolizer defaults for the select renderIntent 2013-08-30 13:47:43 +02:00
ahocevar
83720975f8 More specific INTENTCHANGE instead of SYMBOLIZER event 2013-08-30 12:10:55 +02:00
ahocevar
e2c4fec253 Let's at least be disposable, so we can clean up after ourselves 2013-08-30 12:00:06 +02:00
ahocevar
2a4aef0b58 THIS_IDENTIFIER no longer needed 2013-08-30 11:44:52 +02:00
ahocevar
6bb23cdda5 No longer inheriting from EventTarget 2013-08-30 11:43:35 +02:00
Éric Lemoine
1ee12e696e Merge pull request #942 from elemoine/expr
Move and rename exports file for ol.expr
2013-08-29 13:01:47 -07:00
Éric Lemoine
ff30a89a49 Merge pull request #943 from elemoine/proj
Move exports file for proj
2013-08-29 13:00:46 -07:00
Éric Lemoine
2f5742bc1b Merge pull request #941 from elemoine/feature
ol.Feature.prototype.get need not be exported
2013-08-29 13:00:11 -07:00
ahocevar
8a180e63b2 Filter layer by id 2013-08-29 16:50:55 +02:00
ahocevar
43c67ba09f Do not dispatch selection events for now 2013-08-29 16:50:55 +02:00
ahocevar
95cf0e1264 Less closures 2013-08-29 16:50:55 +02:00
ahocevar
0c1f2328f9 Do not implement a specific clone method
What we need here is a mix of deep and shallow cloning, and we
do not want to do this in a generic ol.Feature#clone() method.
2013-08-29 16:50:55 +02:00
ahocevar
2394b39f6f Use select as keyword 2013-08-29 16:50:54 +02:00
ahocevar
0fbf07fef1 Using a renderIntent lib function instead of this identifier
A 'this' identifier is quite useless with compressed JavaScript,
and in fact it turned out to fail in advanced mode when trying
to access a feature's renderIntent property with it. The added
renderIntent lib function as a Call expression does the job
well.
2013-08-29 16:50:54 +02:00
ahocevar
526dbebadc Re-adding @requires that got lost during rebase. 2013-08-29 16:50:54 +02:00
ahocevar
c47634b2ee Renaming condition to clickOnly, and fixing docs 2013-08-29 16:50:54 +02:00
Frederic Junod
89bdd3bc2c Use a ol.interaction.condition in ol.interaction.Select 2013-08-29 16:50:54 +02:00
ahocevar
bb93a86528 Do not export 'dispose' for now 2013-08-29 16:50:54 +02:00
ahocevar
e5b095bfdf Simplifying setRenderIntent API for bulk changing all features 2013-08-29 16:50:53 +02:00
ahocevar
100b85a7b0 Converting control to an interaction
To dispatch events, the interaction base class now inherits from
goog.events.EventTarget.
2013-08-29 16:50:53 +02:00
ahocevar
c6e61e2d23 Dynamic layers and lazy selection layer creation
With this change, the user provides a filter function instead of
an array of layers. Selection layers are created lazily, and
addition/removal of layers is not handled by the control to give
the user more options, as suggested by @elemoine.
2013-08-29 16:50:53 +02:00
ahocevar
a417b75c1f Simplifying layer mapping
By making selectionLayer an object keyed by source layer UIDs,
we save some indexOf lookups.
2013-08-29 16:50:53 +02:00
ahocevar
d5c0fdd557 Removing addressed TODOs 2013-08-29 16:50:53 +02:00
ahocevar
0391a028c5 Adding layer visibility/addition/removal handling
The Select control creates a selection layer for each layer it
is configured with. When a configured layer is removed from the
map, the selection layer will be made invisible. For configured
layers on the map, the 'visible' property of the selection layer
is bound to the configured layer.
2013-08-29 16:50:53 +02:00
ahocevar
56c228d009 Removing option for temporary layer
Instead, adding setter and getter for a private temp_ property,
as suggested by @elemoine.
2013-08-29 16:50:52 +02:00
ahocevar
3a50a754aa Implementing renderIntent handling 2013-08-29 16:50:52 +02:00
ahocevar
4f2d37b6a3 New ThisIdentifier expression
This allows member expressions to use the 'this' keyword.
2013-08-29 16:50:52 +02:00
ahocevar
89052079b7 Example update after recent API changes 2013-08-29 16:50:52 +02:00
ahocevar
14b69d15f1 One selection layer per source layer
This way all styles can be defined on the source layer, by
defining a rule with a select renderIntent. It also will make
addition and removal of layers easier while the select control
is active.
2013-08-29 16:50:52 +02:00
ahocevar
760694582e Adding missing @requires 2013-08-29 16:50:52 +02:00
ahocevar
f05629b3c3 Work with clones rather than the original features 2013-08-29 16:50:51 +02:00
ahocevar
fdd79a385a Making JSDoc happy 2013-08-29 16:50:51 +02:00
ahocevar
d7e277d0f5 Adding exports 2013-08-29 16:50:51 +02:00
ahocevar
414f4828d6 Making Travis happy 2013-08-29 16:50:51 +02:00
ahocevar
0c54cbd9cc Adding tests 2013-08-29 16:50:51 +02:00
ahocevar
3d22ec4ca8 Simplifying clear/append detection 2013-08-29 16:50:51 +02:00
ahocevar
b06526781c Adding change event 2013-08-29 16:50:51 +02:00
ahocevar
6be1ab80d2 Require layers 2013-08-29 16:50:50 +02:00
ahocevar
19a00bbe27 Making the control's button work 2013-08-29 16:50:50 +02:00
ahocevar
871388d2c0 Adding selection layer and implementing basic click selection 2013-08-29 16:50:50 +02:00
ahocevar
e2526621d1 Select example and skeleton with event listeners 2013-08-29 16:50:50 +02:00
Éric Lemoine
561581cf8b Move exports file for proj 2013-08-29 15:38:00 +02:00
Éric Lemoine
a86ea051bf Move and rename exports file for ol.expr 2013-08-29 15:24:52 +02:00
Éric Lemoine
0c091e868c ol.Feature.prototype.get need not be exported
get is not overridden in ol.Feature.prototype, so there's no need for a specific export.
2013-08-29 14:05:25 +02:00
Frédéric Junod
7298cbd119 Merge pull request #926 from fredj/mapbrowserevent_clanup
ol.MapBrowserEvent cleanup
2013-08-28 22:08:34 -07:00
Tim Schaub
b0e0d18883 Merge pull request #939 from tschaub/initially-hidden
Do not display the popup initially.
2013-08-28 17:07:37 -07:00
Tim Schaub
ba1e985d2f Do not display the popup initially 2013-08-28 18:05:54 -06:00
Tim Schaub
a83f298db1 Merge pull request #937 from tschaub/popup
Bare bones popup example.
2013-08-28 15:04:12 -07:00
Tim Schaub
0361609631 Remove separate arrow element 2013-08-28 15:25:05 -06:00
Tim Schaub
03580bcfec Better title 2013-08-28 14:21:49 -06:00
Tim Schaub
b4df86a17e Remove unused style 2013-08-28 14:21:07 -06:00
Tim Schaub
7cac81857d Merge pull request #936 from tschaub/geom-exports
Proper geometry exports.
2013-08-28 11:40:14 -07:00
Tim Schaub
c34e582f1a Toggle display instead of visibility for proper click handling 2013-08-28 12:36:00 -06:00
Tim Schaub
0f34bbc161 Adding some variety to the examples 2013-08-28 12:35:23 -06:00
Tim Schaub
7f66376315 Basic popup example 2013-08-28 12:28:47 -06:00
Éric Lemoine
e93383c859 Merge pull request #934 from elemoine/vector-layer
ol.layer.Vector pass original options to parent
2013-08-28 10:19:45 -07:00
Tim Schaub
dd37d0e736 Slightly less giant icon 2013-08-28 10:45:24 -06:00
Tim Schaub
9ef439ba23 Exports for specific geometry types 2013-08-28 10:41:07 -06:00
Tim Schaub
fb27d44840 Merge pull request #931 from tschaub/example-data
Move png to data to work with host-examples task.
2013-08-28 07:46:13 -07:00
Éric Lemoine
3deeaa21c7 ol.layer.Vector pass original options to parent
This makes it possible to pass arbitrary property to ol.layer.Vector and use layer.get('property_name') to get the value of properties.
2013-08-28 14:13:37 +02:00
Frederic Junod
d091cfd508 Move focus_ position update into handleMapBrowserEvent
Otherwise, the position is only updated on keyboard or mouse wheel events.
2013-08-28 12:39:25 +02:00
Frédéric Junod
377f031860 Merge pull request #932 from fredj/unclosed_div
Fix unclosed div in examples/icon.html
2013-08-28 03:36:04 -07:00
Frederic Junod
010eda74df Fix unclosed div in examples/icon.html 2013-08-28 11:58:33 +02:00
Frederic Junod
ecf953a125 Remove pressed_ variable and rely on down_ to check if a mouse button is pressed 2013-08-28 11:28:50 +02:00
Éric Lemoine
c608e15943 Merge pull request #929 from elemoine/collectionevent
Add ol.CollectionEvent#getElement
2013-08-28 02:16:57 -07:00
Frederic Junod
dc5b209f7f Change previous_ local variable type to boolean
And rename it to pressed_ for clarity; the variable represents whether
the mouse button is pressed
2013-08-28 11:16:45 +02:00
Frederic Junod
9306704c1d Add documentation in mapbrowserevent.js 2013-08-28 11:16:44 +02:00
Tim Schaub
ab2c4387b8 Move png to data to work with host-examples task 2013-08-27 16:36:13 -06:00
Tim Schaub
01ab16d7d6 Merge pull request #923 from tschaub/icon
Add xOffset and yOffset support to icon symbolizers.
2013-08-27 15:25:22 -07:00
Tim Schaub
e9aa316007 Call getUid once 2013-08-27 16:22:45 -06:00
Tim Schaub
6b625e368b Account for icon offsets when doing feature hit detection 2013-08-27 16:22:45 -06:00
Tim Schaub
efeb00e4a5 Add x/y offset for icon symbolizers 2013-08-27 16:22:45 -06:00
Tim Schaub
6baf5d0b18 Export ol.geom.Geometry.prototype.getCoordinates 2013-08-27 16:22:45 -06:00
Tim Schaub
9c824584b3 Example using an icon symbolizer and displaying a popup
I'm adding this example to demonstrate a few things that should change:

 * the icon symbolizer should accept xOffset and yOffset in pixels
 * the `ol.geom.Geometry.prototype.getCoordinates` method should be exported
 * overlays should have a `panIntoView` method
2013-08-27 16:22:45 -06:00
Tim Schaub
700bb64d2d Merge pull request #927 from tschaub/null-crs
Accept null crs in GeoJSON.
2013-08-27 13:51:18 -07:00
Éric Lemoine
d1e879e03f Use ol.Collection#getElement in tests 2013-08-27 22:11:33 +02:00
Éric Lemoine
9895f879f9 Export ol.CollectionEvent#getElement 2013-08-27 22:08:26 +02:00
Éric Lemoine
9f2c351057 Use ol.CollectionEvent#getElement in LayerGroup 2013-08-27 22:07:45 +02:00
Éric Lemoine
b9f2f7bcb4 Add ol.CollectionEvent#getElement 2013-08-27 22:07:03 +02:00
Tim Schaub
0c555e6e7d Accept null crs 2013-08-27 10:54:00 -06:00
Éric Lemoine
6b6639f620 Merge pull request #924 from elemoine/getextent
Export ol.source.Source.prototype.getExtent
2013-08-27 08:02:49 -07:00
Éric Lemoine
f273be6597 Export ol.source.Source#getExtent 2013-08-27 15:42:55 +02:00
Tim Schaub
e8ddecc8b1 Merge pull request #920 from tschaub/point-examples
Cast to number when creating literals from symbolizers where literal properties must be numeric.
2013-08-26 11:57:09 -07:00
Tim Schaub
ecba1d78c2 Merge pull request #921 from tschaub/geojson-crs
Parse top-level crs member when reading features from GeoJSON.
2013-08-26 10:41:14 -07:00
Tim Schaub
0a3e46b88d Remove unnecessary cast and save 15 bytes using goog.isDef 2013-08-26 09:26:07 -06:00
Tim Schaub
eaf447759f Merge pull request #913 from tschaub/dimension
Allow for vector data with unknown or inconsistent dimension.
2013-08-26 05:59:50 -07:00
Tim Schaub
7e2bd66417 Read crs from top-level object when parsing as features 2013-08-25 12:32:22 -06:00
Tim Schaub
379c11e1ce Add externs for GeoJSON crs member 2013-08-25 12:22:08 -06:00
Tim Schaub
9755240cac Leaving the + operator as a convenience for concatenating strings
When people need to serialize in a format that differentiates string concatenation from addition, they can use the new `concat` function in an expression.  But I don't think we need to throw if people use `+` with strings.
2013-08-23 18:33:52 -04:00
Tim Schaub
8190178fc9 Missing test dependency 2013-08-23 18:28:44 -04:00
Tim Schaub
6ddef67cd9 Add KML earthquake example 2013-08-23 18:17:42 -04:00
Tim Schaub
3c993168c4 Cast to numbers for literals
There are times when we parse from XML without a schema (e.g. KML).  In these cases, features attributes will always be strings.  We can cast to number when creating literals from symbolizers and then assert `!isNaN` instead of asserting that they are numbers before.
2013-08-23 17:30:24 -04:00
Tim Schaub
43953c8efa Call concat instead of using math op in FE expression parsing 2013-08-23 16:46:33 -04:00
Tim Schaub
3b615fa312 Add a concat function for concatenating strings 2013-08-23 13:05:12 -04:00
Frédéric Junod
637bbeb2a7 Merge pull request #903 from fredj/keyboard
Don't react to keyboard events when the focus is on editable inputs
2013-08-22 23:40:42 -07:00
Tom Payne
9a994eab47 Merge pull request #918 from twpayne/source-change-events
Source change events
2013-08-21 07:40:54 -07:00
Tom Payne
0170c426ee Propagate change events from sources via layers 2013-08-21 12:29:49 +02:00
Tom Payne
788ac5f41d Add ol.source.Source#dispatchChangeEvent 2013-08-21 12:29:28 +02:00
Frederic Junod
9e8d559c1b Don't react to keyboard events when the focus is on editable inputs 2013-08-20 14:44:40 +02:00
Tim Schaub
554a725d1a Merge pull request #912 from tschaub/seperate-fill-stroke
Separate fill and stroke symbolizers.  Allow styles with no rules (and also support "else" symbolizers).
2013-08-19 15:43:06 -07:00
Éric Lemoine
9e43719ffb Merge pull request #682 from elemoine/export-func
missing exports
2013-08-19 09:14:16 -07:00
Éric Lemoine
d0f793b7a0 Fix bad option name in ol.control.defaults 2013-08-19 17:00:43 +02:00
Éric Lemoine
d6d15db6e8 Use @exportFunction to export animation functions 2013-08-19 17:00:43 +02:00
Éric Lemoine
f67d3dc165 Use @exportFunction to export ol.interaction.defaults 2013-08-19 17:00:43 +02:00
Éric Lemoine
29a2d2a9f7 Use @exportFunction to export ol.control.defaults 2013-08-19 17:00:43 +02:00
Éric Lemoine
169e986b28 Remove 2nd arg to ol.interaction.defaults 2013-08-19 17:00:43 +02:00
Éric Lemoine
3d2d45e01f Remove 2nd arg to ol.control.defaults 2013-08-19 17:00:37 +02:00
Éric Lemoine
3f6b9c9434 Use ol.Collection#extend in examples
This commit changes the examples to using ol.control.defaults().extend to extend the collection of controls. This is in preparation for a future commit that will remove the 2nd argument to ol.control.defaults. The same is done for ol.interaction.defaults.
2013-08-19 14:25:38 +02:00
Éric Lemoine
41fe103fa4 Export ol.Collection#extend 2013-08-19 14:25:38 +02:00
Éric Lemoine
6576a49178 Make ol.Collection#extend return this
This to be able to do this:

new ol.Map({
  controls: ol.control.defaults().extend([new MyControl()]),
  ...
})
2013-08-19 14:25:38 +02:00
Éric Lemoine
77adbdfa7a Use per-animation function modules
Currently the animation functions share the same module, namely ol.animation. We do differently for ol.control.defaults and ol.interaction.defaults, with ol.control.defaults and ol.interaction.defaults module. This commit replaces the ol.animation module by four modules, one for each animation function.

This makes things more consistent, and will make it possible to use the @exportFunction annotation for the exporting of the animation functions.
2013-08-19 14:25:38 +02:00
Éric Lemoine
a37f114e4b Add export annotation @exportFunction
This commit adds a new export annotation: @exportFunction. @exportFunction is to be used to declare functions that take an options object literal as their first arguments. @exportFunction is to regular functions as @exportClass is to constructors.

The usage of @exportFunction is as follows:

@exportFunction ol.control.defaults ol.control.DefaultsOptions ol.Collection

Note: the Function#export method uses a recursive function. This is to handle nested options.
2013-08-19 14:01:57 +02:00
Éric Lemoine
8d09be7134 No reference to internal types in externs file
Currently we have things like like in the generated externs file (types.js):

/**
 * @type {ol.control.AttributionOptions|undefined}
 */
olx.control.DefaultsOptionsExtern.prototype.attributionOptions;

It doesn't make sense to have external object properties whose types are
internal (ol.control.AttributionOptions in the above example).

With this commit, the generate-exports.py script generates this:

/**
 * @type {olx.control.AttributionOptionsExtern|undefined}
 */
olx.control.DefaultsOptionsExtern.prototype.attributionOptions;
2013-08-19 13:54:26 +02:00
Tom Payne
0ec1f33304 Merge pull request #910 from twpayne/reduced-check-examples
Only check examples in advanced mode
2013-08-19 02:19:48 -07:00
Frédéric Junod
6a276a408d Merge pull request #905 from fredj/css_classes_fixup
IE10 compatibility: full-screen-drag-rotate-and-zoom.html
2013-08-19 01:03:01 -07:00
Tim Schaub
0f9e269057 Ignore extra dimensions and pad with NaN for missing dimensions 2013-08-18 09:57:26 -04:00
Tim Schaub
94c4d420a6 Merge pull request #911 from tschaub/expression-literals
Parse literal nodes in expressions in addition to text nodes.
2013-08-16 08:36:25 -07:00
Tim Schaub
7ccc45b276 No need for rules if no rules have filter 2013-08-15 15:38:58 -04:00
Tim Schaub
9b90129b24 Merge pull request #904 from tschaub/test-correction
Correctly make assertions with expect.
2013-08-15 11:44:31 -07:00
Tim Schaub
183b51a1c0 Parse literal nodes in expressions in addition to text nodes 2013-08-15 14:32:47 -04:00
Tim Schaub
dd72408a88 Dependencies 2013-08-15 14:07:11 -04:00
Tim Schaub
4e053c4c0a No such thing as IconType 2013-08-15 13:57:36 -04:00
Tim Schaub
af1cd64018 Lint 2013-08-15 13:54:37 -04:00
Tim Schaub
966034e4f7 Alphabetize 2013-08-15 13:50:50 -04:00
Tim Schaub
bad401bc17 Add support for "else" symbolizers
When a style has no rules, the "else" symbolizers apply.  When a style has rules and none of them apply to the given feature, the "else" symbolizers apply.  Note that this is different than default symbolizer properties that might be merged into all symbolizers (as in OL2) - I don't think we should support that.
2013-08-15 10:37:18 -04:00
Tim Schaub
6078fe7b02 Line literal color instead of strokeColor etc. 2013-08-15 10:37:18 -04:00
Tim Schaub
a5991aee03 Remove applyDefaultStyle method 2013-08-15 10:37:18 -04:00
Tim Schaub
a670e225cd Clearer naming of method to create symbolizer literals 2013-08-15 10:37:18 -04:00
Tim Schaub
d5d0262b4c Create literal with feature or geometry type 2013-08-15 10:37:18 -04:00
Tim Schaub
c36ceab2a0 Separate stroke and fill 2013-08-15 10:37:18 -04:00
Tim Schaub
dc54128c77 Method to reduce polygon literals 2013-08-15 10:37:18 -04:00
Tim Schaub
36bcd26305 Separate literals from symbolizers 2013-08-15 10:37:18 -04:00
Tim Schaub
90fb37c220 Rename ol.style.SymbolizerLiteral to ol.style.Literal 2013-08-15 10:37:18 -04:00
Tom Payne
b06a6d1aef Only check examples in advanced mode 2013-08-15 15:21:00 +02:00
Frédéric Junod
a12d41b1bc Merge pull request #908 from fredj/bing_key
Fix BingMaps API key in example
2013-08-15 06:11:19 -07:00
Frederic Junod
c793b18c44 Fix BingMaps API key in example 2013-08-15 14:10:29 +02:00
Frederic Junod
4afe025c75 Add missing space between CSS classes 2013-08-15 13:58:58 +02:00
Bart van den Eijnden
c3a920774b Merge pull request #852 from bartvde/ogcfilter2
Add parser for OGC Filter 1.0 and 1.1 (read/write) (r=@tschaub,@ahocevar)
2013-08-15 02:12:58 -07:00
Bart van den Eijnden
ab7d446e25 Merge pull request #3 from tschaub/bartvde-ogcfilter2
Suggestions for filter encoding
2013-08-15 02:12:03 -07:00
Tim Schaub
db658e491f Correct use of expect with spies 2013-08-14 11:57:53 -04:00
Tim Schaub
89daf91c0b Proper use of expect 2013-08-14 11:50:18 -04:00
Tim Schaub
6c8ec8ed95 Test names and instanceof checks 2013-08-14 11:35:44 -04:00
Tim Schaub
2d95488906 Remove special write-only handling for dates 2013-08-14 11:26:01 -04:00
Tim Schaub
824c950824 Parse distance as a number 2013-08-14 09:33:47 -04:00
Tom Payne
e23cbbac13 Merge pull request #902 from twpayne/fix-color
Fix opacity in createFromString
2013-08-14 05:29:09 -07:00
Tom Payne
362ace01da Fix opacity in createFromString 2013-08-14 12:02:23 +02:00
Bruno Binet
7b95509970 Merge pull request #899 from bbinet/renderer-refactoring
Renderer refactoring related to the layer groups
2013-08-13 08:25:33 -07:00
Bruno Binet
88da6da3a7 Trigger CHANGE event only when required
For example only when layer is both ready and visible.
2013-08-13 16:41:43 +02:00
Bruno Binet
8b435059f7 Update color matrices based on framestate values
In getColorMatrix method, we'll update the color matrices only if layerstate
color properties has changed in the framestate.
2013-08-13 16:24:44 +02:00
Bruno Binet
46ea218d0f Make layer renderers more stupid
Layer renderers should not be responsible for listening to layer
properties change and triggering a render.
Layer change events are now forwarded to the map which will trigger a render.
2013-08-13 16:24:44 +02:00
Bruno Binet
a13d4bdded Merge pull request #797 from bbinet/layergroup
Layer group support
2013-08-13 07:24:21 -07:00
Bruno Binet
54bf8c2d2a Bindto valueAsNumber in layer-group example
(now that #898 is in)
2013-08-13 12:37:00 +02:00
Bruno Binet
3ecb5b89ff Create a custom event type for vector layers
Vector layers will now dispatch ol.layer.VectorLayerEventType.ADD and
ol.layer.VectorLayerEventType.REMOVE event types instead of the generic
goog.events.EventType.CHANGE event type.
This will fix a maximum call stack size exceeded javascript error.
2013-08-13 12:27:38 +02:00
Bruno Binet
e4c36378ac ol.Map now have a LAYERGROUP property
The LAYERS property is gone.
2013-08-13 12:27:38 +02:00
Bruno Binet
d84477c1c0 Bind more layer properties in layer-group example
This allows to update hue, saturation, brightness, contrast values.
2013-08-13 12:27:38 +02:00
Bruno Binet
1100cc67da Get opacity from layerState in webglmaprenderer
instead of getting it from layer.getOpacity().
Fix the issue of changing opacity which didn't work with LayerGroups in webgl.
2013-08-13 12:27:38 +02:00
Bruno Binet
f3b63d9c2c Add a layer-group example 2013-08-13 12:27:38 +02:00
Bruno Binet
1aa695580b Add tests for layer.getLayerState() 2013-08-13 12:27:38 +02:00
Bruno Binet
31c8644716 Add tests for ol.layer.LayerGroup 2013-08-13 12:27:38 +02:00
Bruno Binet
1d15d840ac Add layergroup exports 2013-08-13 12:27:37 +02:00
Bruno Binet
097ce52060 Add layergroup support 2013-08-13 12:27:37 +02:00
Bruno Binet
f731d5632c Merge pull request #898 from bbinet/input-valueasnumber
Add support for binding input value as number
2013-08-13 03:24:54 -07:00
Bruno Binet
dddea56c2c Add a temporary html5 externs file
This is needed because the current version of closure compiler we use does not
include externs for valueAsNumber which we now use in ol.dom.Input.
So this backports patch from issue:
https://code.google.com/p/closure-compiler/issues/detail?id=1060

This patch should be reverted when the next closure compiler release is out
with valueAsNumber externs.
2013-08-13 11:31:58 +02:00
Bruno Binet
2dd6321c74 Fix bind-input example to use valueAsNumber 2013-08-13 11:31:58 +02:00
Bruno Binet
afee1ab975 Add VALUE_AS_NUMBER property to ol.dom.Input
This should be used when one want to bind a number instead of a string.
2013-08-13 11:31:58 +02:00
Tim Schaub
a3ec0d776c Building an expression with constructors instead of ol.expr.parse 2013-08-09 17:15:42 -06:00
Bart van den Eijnden
09c27f430d remove accidentally committed swap file 2013-08-09 15:58:31 +02:00
Bart van den Eijnden
8792973c08 make sure the _expression reader can deal with combined propertyname and literals 2013-08-09 15:57:29 +02:00
Bart van den Eijnden
29954d2ff9 trim the string before passing it off to ol.expr.parse 2013-08-09 11:08:19 +02:00
Bart van den Eijnden
deb88a5a6d change _expression reader 2013-08-09 10:42:16 +02:00
Bart van den Eijnden
1948233d1f merge with master - solving conflicts 2013-08-09 09:55:44 +02:00
ahocevar
5673feb48f Merge pull request #885 from ahocevar/wms-getfeatureinfo
Implement WMS GetFeatureInfo
2013-08-08 07:44:04 -07:00
ahocevar
f1e01511b9 Fixing example title
Thanks @bartvde for catching this.
2013-08-08 15:55:37 +02:00
ahocevar
2f37816608 Use X, Y or I, J depending on WMS version
This also adds consistency - Pixel coordinates are now always
rounded to integers.
2013-08-08 14:43:49 +02:00
Tim Schaub
bfff0197d7 Merge pull request #894 from tschaub/more-geojson
Allowing all GeoJSON types to be read as an array of features.  This makes the parser more useful when used with a source that may not already be a feature collection.
2013-08-08 05:41:11 -07:00
ahocevar
c1746f2549 No array needed for a single event
Thanks @bartvde.
2013-08-08 13:19:26 +02:00
Tim Schaub
254f325f29 Provide a method for parsing any GeoJSON as an array of features 2013-08-07 11:50:37 -06:00
Tim Schaub
1f588821b4 Merge pull request #892 from tschaub/symbolizer-opacity
Separate fill and stroke opacity.
2013-08-07 07:52:49 -07:00
Tom Payne
9fdcfedd96 Merge pull request #893 from twpayne/plovr-81ed862
Use plovr-81ed862
2013-08-06 07:05:46 -07:00
Tom Payne
05c950156a Use plovr-81ed862 2013-08-06 15:20:43 +02:00
Tim Schaub
c2cc1af2ac Separate opacity in examples 2013-08-05 11:32:48 -06:00
Tim Schaub
5d0b4563a8 Optionally stroke and fill polygons (closes #475)
This also removes the unsupported width property from PolyStyle (closes #891).
2013-08-05 11:16:49 -06:00
Tim Schaub
993e76e3a1 Support fillOpacity and strokeOpacity on polygon symbolizers 2013-08-05 11:16:49 -06:00
Tim Schaub
f210d6d0e1 Rename line symbolizer opacity to strokeOpacity for consistency
We already have strokeColor and strokeWidth.  Having strokeOpacity makes sense.
2013-08-05 11:16:49 -06:00
Tim Schaub
1cedea6606 Support fillOpacity and strokeOpacity on shape symbolizers 2013-08-05 11:16:48 -06:00
Tim Schaub
2a1ece194d Merge pull request #890 from tschaub/attributions
Move attribution constants to constructors.
2013-08-05 07:43:23 -07:00
ahocevar
759e6ff925 Merge pull request #880 from openlayers/parser-projection
Get source projection from parser
2013-08-05 00:57:27 -07:00
Tim Schaub
c764d76aee Move attributions constant to constructor 2013-08-04 13:31:37 -06:00
ahocevar
cc29ea912b Updating the TopoJSON parser to return a ReadFeaturesResult 2013-08-04 15:10:11 +02:00
ahocevar
9578da0cfb Renaming readFeaturesWithMetadata* back to readFeatures*
Since this is not exported and we do not have a counterpart that
does not return the metadata, it should be fine to use a shorter
name.
2013-08-04 15:10:11 +02:00
ahocevar
0aed05a413 Renaming handleWriteOptions to applyWriteOptions 2013-08-04 15:10:10 +02:00
ahocevar
3ebbdbb48f Use goog.functions.sequence 2013-08-04 15:10:10 +02:00
Bart van den Eijnden
b66f4aef07 make Travis happy 2013-08-04 15:10:10 +02:00
Bart van den Eijnden
8d997f17ec forgot to remove a commented code block 2013-08-04 15:10:10 +02:00
Bart van den Eijnden
17fefda8fd implement GMLReadOptions and GMLWriteOptions as discussed with @ahocevar 2013-08-04 15:10:10 +02:00
Bart van den Eijnden
2f4f508d1a move srsName and axisOrientation from the instance to the read and write functions as discussed with @ahocevar 2013-08-04 15:10:10 +02:00
ahocevar
6f3fa14c53 Sensible axisOrientation and srsName defaults 2013-08-04 15:10:09 +02:00
ahocevar
023d3faf3c Do not translate projections using regular expressions 2013-08-04 15:10:09 +02:00
ahocevar
e32da90f5a Fixing typo
Thanks @bartvde for spotting this.
2013-08-04 15:10:09 +02:00
ahocevar
56e8b1cfb4 Get projection and axis order from GML data
To make tests pass, the winding order of the coordinates in the
test data had to be reversed to conform to common gml practice.
2013-08-04 15:10:09 +02:00
ahocevar
109ec71877 Using single argument for callback and string for projection
This makes the asynchronous and synchronous versions of
readFeatures work with the same data structures, and leaves
projection handling outside the parsers.
2013-08-04 15:10:09 +02:00
Bart van den Eijnden
a4ceb41938 fix up KML tests 2013-08-04 15:10:09 +02:00
Bart van den Eijnden
33dd188f9b fix up the geojson tests 2013-08-04 15:10:08 +02:00
Bart van den Eijnden
7b31ec26ea fix up build 2013-08-04 15:10:08 +02:00
ahocevar
0168c2e46f Better interface for passing projection and other metadata 2013-08-04 15:10:08 +02:00
ahocevar
b0c1ef04a1 Implementing getProjection for KML and GPX 2013-08-04 15:10:08 +02:00
ahocevar
55697dea28 getProjection method on parsers
With this, vector sources/layers do not need to make
assumptions on the data projection.
2013-08-04 15:10:08 +02:00
ahocevar
82a158bdd2 Merge pull request #889 from ahocevar/advanced-param
check-examples target failing because of G+ widgets
2013-08-04 06:09:25 -07:00
ahocevar
da2fd4f80f Append '?mode=advanced' for advanced mode to avoid G+ inclusion 2013-08-04 14:38:55 +02:00
ahocevar
58949ed856 Adding tests, and fixing an issue revealed by the tests 2013-07-31 23:42:08 +02:00
Frédéric Junod
e732b744b7 Merge pull request #864 from fredj/upgrade_font-awesome
Upgrade Font Awesome to version 3.2.1
2013-07-31 09:21:53 -07:00
ahocevar
5acff857e7 Add example, and use getFeatures in other examples
The new dedicated getfeatureinfo example shows how to combine
feature info from a WMS and a vector layer. The other examples
that previously used getFeatureInfo from vector layers now use
the more appropriate getFeatures.
2013-07-31 17:47:16 +02:00
Tim Schaub
b839cea4de Merge pull request #844 from tschaub/topojson
Parser for reading TopoJSON topologies.
2013-07-31 08:33:46 -07:00
ahocevar
4dd148a731 Implementing GetFeatureInfo for WMS 2013-07-31 12:10:02 +02:00
ahocevar
f333acc183 Interface for GetFeatureInfo
When a source implements this interface, the layer renderer can
access the source to get feature info.
2013-07-31 12:09:39 +02:00
ahocevar
5307e5ea3f Until we know what we want to return, return undefined 2013-07-31 11:58:45 +02:00
ahocevar
53765ebd0f Merge pull request #878 from ahocevar/polygon-labels
Better label placement for polygons
2013-07-30 01:04:44 -07:00
ahocevar
b2e25c8f6b Renaming method to getInteriorPoint
as suggested by @tschaub. Also giving credit to JTS.
2013-07-30 09:25:24 +02:00
Tim Schaub
3061fc6941 Missing requires in test and example lint 2013-07-26 16:20:33 -06:00
Tim Schaub
d36a085449 Slightly different style than other vector example 2013-07-26 16:14:57 -06:00
Tim Schaub
e1a5599f6a Update example 2013-07-26 15:52:32 -06:00
Tim Schaub
3023c5b9e6 Tests for parsing world-110m.json 2013-07-26 15:52:22 -06:00
Tim Schaub
b206442418 Exports 2013-07-26 15:05:53 -06:00
Tim Schaub
f677eb8c50 Rendering 110m world TopoJSON 2013-07-26 15:05:53 -06:00
Tim Schaub
a0fd3eec19 Initial spec 2013-07-26 15:05:53 -06:00
Tim Schaub
5b707d4275 Shared structure for crs transforms 2013-07-26 15:05:53 -06:00
Tim Schaub
e53deb62be Transform arcs 2013-07-26 15:05:53 -06:00
Tim Schaub
6580ece2bb GeometryCollection as individual features 2013-07-26 15:05:53 -06:00
Tim Schaub
38172c4f20 Adding TopoJSON parser 2013-07-26 15:05:52 -06:00
Tim Schaub
70be904979 Adding TopoJSON externs 2013-07-26 15:05:52 -06:00
Frédéric Junod
d30efdaa71 Merge pull request #881 from fredj/examples_css
examples: don't inject ol.css from loader.js
2013-07-25 04:48:14 -07:00
Frederic Junod
e13075f6ff Don't inject ol.css from loader.js 2013-07-25 11:40:35 +02:00
Tom Payne
73f77115e1 Merge pull request #882 from twpayne/plovr-2013-rc3
Use Plovr 2013-rc3
2013-07-24 03:14:15 -07:00
Tom Payne
68d943d98d Use Oracle Java on Mac OS X 2013-07-24 12:13:40 +02:00
Tom Payne
45c0e27c36 Use goog.log instead of goog.debug.Logger 2013-07-23 13:06:06 +02:00
Tom Payne
f533f6b654 Merge pull request #4 from fredj/plovr-2013-rc3
IE pointer events names are now defined in goog.events.EventType
2013-07-23 01:55:08 -07:00
Frederic Junod
d43581719b IE pointer events names are now defined in goog.events.EventType 2013-07-23 08:50:57 +02:00
Tom Payne
88ccf64379 Add missing private member 2013-07-22 18:22:58 +02:00
Tom Payne
ccdbd5aae5 Add some type hints in ol.layer.Layer 2013-07-22 18:22:43 +02:00
Tom Payne
ce56ac90a8 Add some type hints in ol.Kinetic 2013-07-22 18:22:29 +02:00
Tom Payne
639000a603 Add some type hints in ol.extent 2013-07-22 18:22:13 +02:00
Tom Payne
6cc8104ad3 Add some type hints in ol.array 2013-07-22 18:21:57 +02:00
Tom Payne
cec83abc3e Use regex module to work around arbitrary limitations in re
Our automatically generated regular expressions break Python's random
and arbitrary limit of 100 groups. See
  http://stackoverflow.com/questions/478458
2013-07-22 18:20:39 +02:00
Tom Payne
5afd564986 Add missing call to base class 2013-07-22 17:51:35 +02:00
Tom Payne
46d16ba0ca Use setElementShown instead of showElement 2013-07-22 17:42:47 +02:00
Tom Payne
0467222e46 Fix various type errors in ol.structs.RTree 2013-07-22 17:42:47 +02:00
Tom Payne
1208dab3e9 Fix various type errors related to features 2013-07-22 17:42:47 +02:00
Tom Payne
272bfceaf8 Fix invalid typecasts 2013-07-22 17:42:47 +02:00
Tom Payne
b6319c9a68 Use goog.events.Key 2013-07-22 17:42:47 +02:00
Tom Payne
368194f293 w3c_device_sensor_event.js is now supplied with Plovr 2013-07-22 17:42:47 +02:00
Tom Payne
0fc60e9957 Use plovr-2013-rc3 2013-07-22 17:42:46 +02:00
Bart van den Eijnden
369d692a90 implement @tschaub's suggestions for ieq and ineq 2013-07-22 14:11:29 +02:00
Bart van den Eijnden
875edc540e implement @tschaub's suggestions for the LIKE function 2013-07-22 13:23:08 +02:00
ahocevar
2d08b5ff2c Merge pull request #850 from ahocevar/vector-events
Render changes when adding and removing features
2013-07-20 02:41:05 -07:00
ahocevar
ca9f9b7563 Re-adding type cast, as suggested by @elemoine 2013-07-20 11:11:26 +02:00
ahocevar
b43625820e Removing addFeatures from the API 2013-07-20 11:09:49 +02:00
ahocevar
11ef2cb7d1 Better label placement for polygons
Using the y-coordinate of the polygon's bounding box, this
simple algorithm intersects the polygon with the horizontal
center line of its bounding box. The x-coordinate of the label
point is the center of the longest segment of this intersection
that is inside the polygon.
2013-07-20 10:36:13 +02:00
Frédéric Junod
58d3314f7a Merge pull request #868 from fredj/apidoc
Add basic ol.animation api doc
2013-07-19 11:10:16 -07:00
Éric Lemoine
65ec948cb0 Merge pull request #859 from elemoine/zoomtoextent
Add a ZoomToExtent control
2013-07-19 05:46:26 -07:00
ahocevar
781caff9e5 Expire tile by range and listen to changes
Instead of just listening for the first change, we now listen
for all changes, and expire tiles by tile range. The outcome is
that the vector layer's addFeatures and removeFeatures methods
now show instant results on the rendered map.
2013-07-19 14:07:16 +02:00
ahocevar
d04c6f4c01 New pruneTileRange method
This also adds an assert that cache values are an instance of
ol.Tile in expireCache, instead of doing a type cast. Later we
will want to enforce the ol.Tile type by overriding the set
method.
2013-07-19 14:07:16 +02:00
ahocevar
ac67c10acd Add and remove features with meaningful events
This adds a removeFeatures method, and makes the CHANGE event
more useful by adding information about changed features and
extent.
2013-07-19 14:07:15 +02:00
ahocevar
c3bed305c7 Merge pull request #870 from ahocevar/vector-api
Give VectorSource the ability to load and parse data
2013-07-19 05:06:19 -07:00
ahocevar
a9fcc5ff15 Addressing @elemoine's review comments 2013-07-19 13:30:14 +02:00
Éric Lemoine
4e1012823f Merge pull request #860 from elemoine/exports
Add exports
2013-07-18 04:21:59 -07:00
Frédéric Junod
fecda5b094 Merge pull request #866 from fredj/object.setOptions
Api docs does not list Object#setValues
2013-07-17 23:56:24 -07:00
Frederic Junod
a965d9ee9f Remove unused ol.Object#setOptions function 2013-07-17 13:50:43 +02:00
Éric Lemoine
3d7316906b Merge pull request #867 from elemoine/bingkeyupdate
Update key in bing-maps example
2013-07-17 03:03:50 -07:00
ahocevar
892088ffac Updating examples to use the new API 2013-07-17 11:39:57 +02:00
ahocevar
9095032014 Removing unused methods and changing getFeaturesObjectForExtent
With this change, getFeaturesObjectForExtent may return null if
the source does not have data loaded for the provided extent.
A callback can be passed to getFeaturesObjectForExtent to get
notified when the requested data is available.
2013-07-17 11:28:48 +02:00
ahocevar
f325046a95 Allow VectorSource to load and parse data
This adds url, data and parser options to the source, and makes
EPSG:4326 the default projection. It also adds a prepareFeatures
method, which is used to load/parse data once the target
projection is known.
2013-07-17 11:24:34 +02:00
Frederic Junod
2565e00e1d Add basic ol.animation api doc 2013-07-17 10:56:19 +02:00
Éric Lemoine
fef6359f75 Update key in bing-maps example 2013-07-17 10:21:28 +02:00
Frédéric Junod
2121a7dc9e Merge pull request #865 from fredj/xyztilegrid_grid_init
tilejson example error
2013-07-16 22:40:59 -07:00
Éric Lemoine
907476f566 No need to impl setMap in ZoomToExtent control 2013-07-16 17:13:38 +02:00
Stéphane Brunner
74f446948f Rotate to north for custom controls example 2013-07-16 17:13:38 +02:00
Stéphane Brunner
d15f68d651 Add navigation controls example 2013-07-16 17:13:38 +02:00
Stéphane Brunner
86001fd331 Add zoom to extent control 2013-07-16 17:13:38 +02:00
Frederic Junod
ad42496948 Initialize all the items in tileRangeByZ 2013-07-16 15:31:05 +02:00
Frederic Junod
bebac2011b Upgrade Font Awesome to version 3.2.1 2013-07-15 10:16:42 +02:00
Tim Schaub
63c4feb6db Merge pull request #862 from tschaub/mutable-symbolizers
Provide getters and setters for symbolizer properties
2013-07-12 16:45:54 -07:00
Frédéric Junod
66a167b4ed Merge pull request #861 from fredj/layer-options
Preserve unexpected items in options object passed to the constructor
2013-07-12 14:10:30 -07:00
Tim Schaub
8b93c5a0a0 Getters and setters for text symbolizer 2013-07-12 11:16:17 -06:00
Tim Schaub
4a098aaee3 Adding tests for text symbolizer 2013-07-12 10:59:52 -06:00
Tim Schaub
0e87922389 Getters and setters for icon symbolizer 2013-07-12 10:42:59 -06:00
Tim Schaub
8844465188 Fixing bug with IconLiteral#equals and adding tests 2013-07-12 10:17:08 -06:00
Tim Schaub
2e08ccce03 Getters and setters for shape symbolizers 2013-07-12 09:57:40 -06:00
Tim Schaub
a0d058b2fa Getters and setters for polygon symbolizer 2013-07-12 09:50:42 -06:00
Éric Lemoine
e17d6aef70 Preserve unexpected items in options object passed to the constructor 2013-07-12 17:47:09 +02:00
Tim Schaub
711261171b Getters and setters for line symbolizers 2013-07-12 09:41:47 -06:00
Éric Lemoine
42d02e064e Export ol.layer.Layer and its getSource func 2013-07-12 10:21:01 +02:00
Éric Lemoine
9b039d76ea Export ol.source.TileSource and its getTileGrid func 2013-07-12 10:20:02 +02:00
Éric Lemoine
b2fc570328 Export tilegrid.WMTS functions 2013-07-12 10:12:51 +02:00
Éric Lemoine
c51265502d Export TileGrid functions 2013-07-12 10:12:30 +02:00
Éric Lemoine
757ccf148b Merge pull request #858 from elemoine/getzoom
Add ol.View2D#getZoom
2013-07-11 00:51:25 -07:00
Éric Lemoine
3e4d39b228 Export ol.View2D#getZoom 2013-07-11 09:50:31 +02:00
Éric Lemoine
d7e838274e Merge pull request #840 from fredj/zoomcontrol
Add ol.control.Zoom#zoomByDelta function
2013-07-09 21:38:41 -07:00
Éric Lemoine
2cc5c7a776 Merge pull request #857 from elemoine/view2d-docs
Better View2D docs
2013-07-09 06:29:12 -07:00
Éric Lemoine
daa03b5ef7 @class doc for View2D 2013-07-09 15:28:31 +02:00
Éric Lemoine
42abdb308a Better docs for View2DOptions 2013-07-09 15:28:31 +02:00
Frederic Junod
17f0d01e9f Add ol.control.Zoom#zoomByDelta function
To replace ol.control.Zoom#handleIn_ and ol.control.Zoom#handleOut_ callbacks.
2013-07-09 14:21:46 +02:00
Éric Lemoine
f72784dc38 Merge pull request #855 from elemoine/zoom-slider-fix
Zoomslider cannot be added to a map with no target
2013-07-09 04:45:50 -07:00
Bart van den Eijnden
31fd41ab14 make filterMap_ static as proposed by @tschaub 2013-07-09 13:34:23 +02:00
Éric Lemoine
44a9c181aa handleMapPostrender may get a null frameState 2013-07-09 10:06:01 +02:00
Éric Lemoine
ccf6aa10ac Zoomslider cannot be added to a map with no target
The zoom slider control's initSlider_ function requires that the control's element is inserted in the document. So if initSlider_ is called before the map have a target then the slider isn't correctly initialized. This commit fixes that by defering the slider initialization until the first handleMapPostrender call.
2013-07-09 10:05:15 +02:00
Éric Lemoine
a10d142752 Add ol.View2D#getZoom 2013-07-09 09:30:45 +02:00
Bart van den Eijnden
c299bfa1cb more dot notation 2013-07-08 17:29:32 +02:00
Bart van den Eijnden
499319fb99 address most of @tschaub's review comments, use dot notation where possible still needs to be done, and I have some questions on the _expression reader still 2013-07-08 17:04:27 +02:00
Tim Schaub
461d85dfc3 Merge pull request #854 from elemoine/remove-gh-pages
Rename build/gh-pages to build/hosted
2013-07-05 17:09:52 -07:00
Tim Schaub
087b4d04a6 Merge pull request #809 from tschaub/clockwise
Consistent winding order for polygon rings.
2013-07-05 17:04:50 -07:00
Éric Lemoine
3af5e530ca Merge pull request #835 from elemoine/setzoom
Add ol.View2D.prototype.setZoom
2013-07-05 12:31:34 -07:00
Éric Lemoine
d9f554e10d Dir build/gh-pages renamed to build/hosted 2013-07-05 20:45:40 +02:00
Tim Schaub
d482b66af3 Doc typo 2013-07-05 11:48:45 -06:00
Éric Lemoine
7efff5c3cf Merge pull request #833 from elemoine/stop-other-interactions
Remove ol.MapBrowserEvent#stopOtherInteractions
2013-07-04 00:48:35 -07:00
Éric Lemoine
d0e198df93 Use constrainResolution function
Use the constrainResolution function when setting the initial view resolution.
2013-07-04 09:16:04 +02:00
Éric Lemoine
e6efa741d2 More type checking for View2D 2013-07-04 09:13:31 +02:00
Éric Lemoine
552853a3b8 Remove unused createContinuous function 2013-07-04 08:58:33 +02:00
Éric Lemoine
0cf4024194 Add ol.View2D.prototype.setZoom 2013-07-04 08:58:32 +02:00
Bart van den Eijnden
ab40ab6208 Add parser for OGC Filter 1.0 and 1.1 (read/write)
This work is based on the ol.expr package by @tschaub.
It adds a few named expression functions to that package:

 * INTERSECTS, CONTAINS, DWITHIN, WITHIN (no client-side implementation as yet)
 * LIKE (like comparison with wildcard, singleChar and escapeChar)
 * IEQ (case-insensitive equality)
 * INEQ (case-insensitive non-equality)

It also adds a few extra parameters to the existing EXTENT function to be able
to deserialize and serialize all info (i.e. projection and property name).

Some changes were needed for the GML parser as well:

 * createGeometry function needed to be public
 * when parsing Box (GML2) and Envelope (GML3) also parse the srsName
 * fix up writing for Box and Envelope now that bounds is an array

Also added createDocumentFragment function to the XML parser. Implementation
is similar to OpenLayers 2.

Some addtional notes on the implementation:

 * PropertyIsBetween was implemented as an ol.expr.Logical with operator
   ol.expr.LogicalOp.AND and two ol.expr.Comparison instances with operator
   ol.expr.ComparisonOp.GTE and ol.expr.ComparisonOp.LTE
 * In OGC Filter And and Or can contain more than 2 sub filters, so this
   is translated into a hierarchy of ol.expr.Logical
2013-07-03 13:09:25 +02:00
Frédéric Junod
a071c3521c Merge pull request #848 from fredj/geolocation-example
Update geolocation example to display all the properties
2013-07-01 07:28:06 -07:00
Frédéric Junod
6ae4b28db8 Merge pull request #847 from fredj/apidoc
API doc update.
2013-07-01 07:01:35 -07:00
Frederic Junod
e1f8863bd2 Update geolocation example to display all the properties 2013-07-01 15:48:50 +02:00
Frederic Junod
1c3369a3f6 Add className parameter documentation 2013-07-01 15:04:14 +02:00
Tim Schaub
f2ce4db85a Merge pull request #842 from tschaub/examples
Updates to example markup.
2013-06-28 12:15:53 -07:00
Tim Schaub
949edb694e Duplicated id 2013-06-28 10:43:57 -06:00
Tim Schaub
7ebacba720 Use full grid
The example documentation should not be restricted to 1/3 of the row unless there is something else consuming the other 2/3.
2013-06-28 10:42:42 -06:00
Tim Schaub
12338783cc Load scripts in RAW mode by default
On-the-fly compilation is a frustrating default.
2013-06-28 10:07:02 -06:00
Tim Schaub
82c791f9f5 Merge pull request #839 from tschaub/delete-gh-pages-branch
Delete gh-pages branch
2013-06-28 08:26:00 -07:00
Tim Schaub
e1a2c72587 Adjective -> adverb 2013-06-27 16:01:22 -06:00
Tim Schaub
dc246cd45b Correct links to hosted examples (and docs) 2013-06-27 15:59:52 -06:00
Tim Schaub
04bab7e436 The examples and docs are deployed from the openlayers.github.io repo
To deploy the latest docs and examples, see https://github.com/openlayers/openlayers.github.io/blob/build/README.md

tl;dr

    git clone -b build https://github.com/openlayers/openlayers.github.io.git
    cd openlayers.github.io
    npm install
    npm run deploy

Subsequent deploys are simply: `npm run deploy`

This publishes the examples (http://ol3js.org/en/master/examples/) and docs (http://ol3js.org/en/master/apidoc/).

The `build.py gh-pages` target published under different paths (http://ol3js.org/ol3/master/examples/ and http://ol3js.org/ol3/master/apidoc/).  Having two (not always up to date) copies of this content hosted on the same domain is A Bad Idea.
2013-06-27 15:56:11 -06:00
Éric Lemoine
6fc4aa68b6 Remove ol.MapBrowserEvent#stopOtherInteractions
and check for false/true in the return from handleMapBrowserEvent. Refs #791.
2013-06-27 14:43:00 +02:00
Tim Schaub
99ba5a0da8 Store rings so exerior is clockwise and interior is counter-clockwise
KML and WKT don't specify a winding order, so we write those out in CW/CCW order (for exterior/interior).  GML references ISO 19107 that specifies CCW/CW, so we serialize in that winding order.

Having hand generated all this GML data the first time around, I reserve the right to modify it for the tests.
2013-06-24 17:46:36 -06:00
Tim Schaub
e292d8fa12 Add method to determine winding order of linear rings 2013-06-24 17:43:22 -06:00
527 changed files with 29314 additions and 6272 deletions

1
.gitignore vendored
View File

@@ -3,3 +3,4 @@
/examples/*.html.png
/examples/example-list.js
/examples/example-list.xml
/node_modules/

View File

@@ -1,5 +1,6 @@
before_install:
- "sudo pip install http://closure-linter.googlecode.com/files/closure_linter-latest.tar.gz"
- "sudo pip install regex"
- "git clone --depth=50 https://github.com/jsdoc3/jsdoc build/jsdoc"
- "git clone https://code.google.com/p/glsl-unit/ build/glsl-unit"

View File

@@ -2,8 +2,8 @@
[![Travis CI Status](https://secure.travis-ci.org/openlayers/ol3.png)](http://travis-ci.org/#!/openlayers/ol3)
Welcome to OpenLayers 3!
Welcome to [OpenLayers 3](http://ol3js.org/)!
To see OpenLayers 3 in action you can look at the live examples on
http://openlayers.github.io/ol3/master/examples/. If you want to contribute
to OpenLayers 3 please read the [CONTRIBUTING](CONTRIBUTING.md) page.
Check out the [hosted examples](http://ol3js.org/en/master/examples/) or poke around the evolving [API docs](http://ol3js.org/en/master/apidoc/).
Please see our guide on [contributing](CONTRIBUTING.md) if you're interested in getting involved.

View File

@@ -1,8 +1,7 @@
{
"opts": {
"recurse": true,
"template": "doc/template",
"tutorials": "doc/tutorials"
"template": "apidoc/template"
},
"tags": {
"allowUnknownTags": true
@@ -13,8 +12,8 @@
},
"plugins": [
"plugins/markdown",
"doc/plugins/inheritdoc",
"doc/plugins/exports"
"apidoc/plugins/inheritdoc",
"apidoc/plugins/exports"
],
"markdown": {
"parser": "gfm"

View File

@@ -1,12 +1,14 @@
Finding your way round
----------------------
Finding your way around
-----------------------
See the class list to the right and especially take a look at {@link ol.Map} and {@link ol.layer.Layer} because those are the central objects.
In general every use of OpenLayers starts by initializing a map, then adding the required layers. Controls and interactions can be added to change the behavior of the map.
Projections
-----------
A {@link ol.Projection} defines which point on earth is represented by a pair of coordinates. Coordinates within OpenLayers can be used in various projections where some common projections are always supported, others can be used via Proj4js.
A {@link ol.proj.Projection} defines which point on earth is represented by a pair of coordinates.
Coordinates within OpenLayers can be used in various projections where some common projections are always supported,
others can be used via [Proj4js](http://trac.osgeo.org/proj4js/).
Maps and Layers
---------------
@@ -14,4 +16,5 @@ A map in OpenLayers is essentially a staple of layers that is viewed from the to
Contributing
------------
See CONTRIBUTING.md for instructions on building and tesing OpenLayers. The file does also describe how to commit your changes to OpenLayers.
See [CONTRIBUTING.md](https://github.com/openlayers/ol3/blob/master/CONTRIBUTING.md) for instructions
on building and testing OpenLayers. The file does also describes how to commit your changes to OpenLayers.

View File

@@ -21,13 +21,7 @@
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="./">OpenLayers 3 API Documentation - <?js= title ?></a>
<ul class="nav pull-right">
<li><iframe class="github-watch-button" src="http://ghbtns.com/github-btn.html?user=openlayers&repo=ol3&type=watch&count=true"
allowtransparency="true" frameborder="0" scrolling="0" height="20" width="90"></iframe></li>
<li><a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-hashtags="openlayers">&nbsp;</a></li>
<li><div class="g-plusone-wrapper"><div class="g-plusone" data-size="medium" data-annotation="none"></div></div></li>
</ul>
<a class="brand" href="/"><img src="../resources/logo.png"> OpenLayers 3</a>
</div>
</div>
</div>
@@ -47,6 +41,5 @@ allowtransparency="true" frameborder="0" scrolling="0" height="20" width="90"></
</footer>
<script> prettyPrint(); </script>
<script src="../resources/social-links.js" type="text/javascript"></script>
</body>
</html>

View File

@@ -1,7 +1,5 @@
#!/usr/bin/env python
from collections import defaultdict
from itertools import ifilter
from operator import attrgetter
from optparse import OptionParser
import re
@@ -92,7 +90,7 @@ class Class(Exportable):
lines.append(' */\n')
lines.append('%s = function(options) {\n' % (self.export_name(),))
lines.append(' /** @type {%s} */\n' % (self.object_literal.name,))
lines.append(' var arg;\n');
lines.append(' var arg = /** @type {%s} */ (options);\n' % (self.object_literal.name,));
lines.append(' if (goog.isDefAndNotNull(options)) {\n')
# FIXME: we modify the user's options object
lines.append(''.join(
@@ -103,12 +101,8 @@ class Class(Exportable):
{'o': o, 'base': b.name, 'ctor': k.export_name(),
'extern': ol.extern_name()} \
for o, ol, k, b in self.nested_options()))
lines.append(' arg = {')
lines.extend(','.join('\n %s: options.%s' % (key, key) for key in sorted(self.object_literal.prop_types.keys())))
lines.append('\n };\n')
lines.append(' } else {\n')
lines.append(' arg = /** @type {%s} */ (options);\n' % (self.object_literal.name,))
lines.append(' }\n')
lines.extend('\n'.join(' arg.%s = options.%s;' % (key, key) for key in sorted(self.object_literal.prop_types.keys())))
lines.append('\n }\n')
lines.append(' goog.base(this, arg);\n')
lines.append('};\n')
lines.append('goog.inherits(\n')
@@ -124,11 +118,84 @@ class Class(Exportable):
return '%sExport' % self.name
class Function(Exportable):
def __init__(self, name, object_literal, return_type, objects):
Exportable.__init__(self, name)
self.object_literal = object_literal
self.return_type = return_type
self.objects = objects
__repr__ = simplerepr
def property_object_literal(self, object_literal, prop):
prop_object_literal = None
types = object_literal.prop_types[prop].split('|')
for t in types:
if t in self.objects:
o = self.objects[t]
if isinstance(o, ObjectLiteral):
if prop_object_literal:
raise RuntimeError('Multiple "literal" types found for '
'option %s.%s: %s, %s.' %
(object_literal.name, prop,
prop_object_literal.name, o.name))
prop_object_literal = o
return prop_object_literal
def recursive_export(self, lines, prop, object_literal, local_var=None, depth=1):
indent = ' ' * depth
if not local_var:
local_var = prop.split('.')[-1]
lines.append('%s/** @type {%s} */\n' % (indent, object_literal.name))
lines.append('%svar %s =\n' % (indent, local_var))
lines.append('%s /** @type {%s} */\n' % (indent, object_literal.name))
lines.append('%s (%s);\n' % (indent, prop))
lines.append('%sif (goog.isDefAndNotNull(%s)) {\n' % (indent, prop))
for key in sorted(object_literal.prop_types.keys()):
prop_object_literal = self.property_object_literal(object_literal, key)
if prop_object_literal:
lv = self.recursive_export(lines, '%s.%s' % (prop, key),
prop_object_literal, depth=depth + 1)
lines.append('%s %s.%s =\n%s %s;\n' %
(indent, local_var, key, indent, lv))
else:
lines.append('%s %s.%s =\n%s %s.%s;\n' %
(indent, local_var, key, indent, prop, key))
lines.append('%s}\n' % (indent,))
return local_var
def export(self):
lines = []
local_var = 'arg'
lines.append('\n\n')
lines.append('/**\n')
lines.append(' * @param {%s} options Options.\n' % (self.object_literal.extern_name(),))
if self.return_type:
lines.append(' * @return {%s} Return value.\n' % (self.return_type,))
lines.append(' */\n')
lines.append('%s = function(options) {\n' % (self.export_name(),))
self.recursive_export(lines, 'options', self.object_literal,
local_var=local_var)
if self.return_type:
lines.append(' return %s(%s);\n' % (self.name, local_var))
else:
lines.append(' %s(arg);\n' % (self.name,))
lines.append('};\n')
lines.append('goog.exportSymbol(\n')
lines.append(' \'%s\',\n' % (self.name,))
lines.append(' %s);\n' % (self.export_name(),))
return ''.join(lines)
def export_name(self):
return '%sExport' % self.name
class ObjectLiteral(Exportable):
def __init__(self, name):
def __init__(self, name, objects):
Exportable.__init__(self, name)
self.prop_types = {}
self.objects = objects
__repr__ = simplerepr
@@ -142,7 +209,12 @@ class ObjectLiteral(Exportable):
for prop in sorted(self.prop_types.keys()):
lines.append('\n\n')
lines.append('/**\n')
lines.append(' * @type {%s}\n' % (self.prop_types[prop],))
prop_types = self.prop_types[prop].split('|')
for i, t in enumerate(prop_types):
if t in self.objects and isinstance(self.objects[t], ObjectLiteral):
prop_types[i] = self.objects[t].extern_name()
prop_types = '|'.join(prop_types)
lines.append(' * @type {%s}\n' % (prop_types,))
lines.append(' */\n')
lines.append('%s.prototype.%s;\n' % (self.extern_name(), prop))
return ''.join(lines)
@@ -225,10 +297,10 @@ def main(argv):
name = m.group('name')
if name in objects:
raise RuntimeError(line) # Name already defined
object_literal = ObjectLiteral(name)
object_literal = ObjectLiteral(name, objects)
objects[name] = object_literal
continue
m = re.match(r'\*\s*@property\s*{(?P<type>.*)}\s*(?P<prop>\S+)', line)
m = re.match(r'\*\s*@property\s*{(?P<type>.*?)}\s*(?P<prop>\S+)', line)
if m:
assert object_literal is not None
prop = m.group('prop')
@@ -266,6 +338,23 @@ def main(argv):
objects[name] = symbol
symbol.props.add(prop)
continue
m = re.match(r'@exportFunction\s+(?P<name>\S+)(?:\s+(?P<object_literal_name>\S+))?(?:\s+(?P<return_type>\S+))?\Z', line)
if m:
name = m.group('name')
if name in objects:
raise RuntimeError(line) # Name already defined
object_literal_name = m.group('object_literal_name')
if object_literal_name not in objects:
raise RuntimeError(line)
object_literal = objects[object_literal_name]
if not isinstance(object_literal, ObjectLiteral):
raise RuntimeError(line)
return_type = m.group('return_type')
function = Function(name, object_literal, return_type, objects)
objects[name] = function
# The require should only be for the namespace, not the function
requires.add('.'.join(name.split('.')[0:-1]))
continue
m = re.match(r'@exportSymbol\s+(?P<name>\S+)(?:\s+(?P<export_as>\S+))?\Z', line)
if m:
name = m.group('name')

141
build.py
View File

@@ -5,7 +5,7 @@ import gzip
import json
import os
import os.path
import re
import regex as re
import shutil
import sys
@@ -72,7 +72,10 @@ if sys.platform == 'win32':
else:
variables.GIT = 'git'
variables.GJSLINT = 'gjslint'
variables.JAVA = 'java'
if sys.platform == 'darwin':
variables.JAVA = '/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java'
else:
variables.JAVA = 'java'
variables.JAR = 'jar'
variables.JSDOC = 'jsdoc'
variables.NODE = 'node'
@@ -142,8 +145,8 @@ SRC = [path
if path.endswith('.js')
if path not in SHADER_SRC]
PLOVR_JAR = 'build/plovr-eba786b34df9.jar'
PLOVR_JAR_MD5 = '20eac8ccc4578676511cf7ccbfc65100'
PLOVR_JAR = 'build/plovr-81ed862.jar'
PLOVR_JAR_MD5 = '1c752daaf11ad6220b298e7d2ee2b87d'
PROJ4JS = 'build/proj4js/lib/proj4js-combined.js'
PROJ4JS_ZIP = 'build/proj4js-1.1.0.zip'
@@ -164,7 +167,7 @@ virtual('default', 'build')
virtual('integration-test', 'lint', 'build', 'build-all',
'test', 'build-examples', 'check-examples', 'doc')
'test', 'build-examples', 'check-examples', 'apidoc')
virtual('build', 'build/ol.css', 'build/ol.js',
@@ -309,10 +312,11 @@ def examples_star_json(name, match):
'../externs/bingmaps.js',
'../externs/bootstrap.js',
'../externs/geojson.js',
'../externs/topojson.js',
'../externs/oli.js',
'../externs/proj4js.js',
'../externs/tilejson.js',
'../externs/w3c_device_sensor_event.js',
'../externs/closure-compiler.js',
],
})
with open(t.name, 'w') as f:
@@ -456,17 +460,23 @@ def build_check_requires_timestamp(t):
self.children = {}
def _build_re(self, key):
if len(self.children) == 1:
if key == '*':
assert len(self.children) == 0
# We want to match `.doIt` but not `.SomeClass` or `.more.stuff`
return '(?=\\.[a-z]\\w*\\b(?!\\.))'
elif len(self.children) == 1:
child_key, child = next(self.children.iteritems())
child_re = '\\.' + child._build_re(child_key)
child_re = child._build_re(child_key)
if child_key != '*':
child_re = '\\.' + child_re
if self.present:
return key + '(' + child_re + ')?'
else:
return key + child_re
elif self.children:
children_re = '(?:\\.(?:' + '|'.join(
self.children[k]._build_re(k)
for k in sorted(self.children.keys())) + '))'
children_re = '(?:' + '|'.join(
('\\.' if k != '*' else '') + self.children[k]._build_re(k)
for k in sorted(self.children.keys())) + ')'
if self.present:
return key + children_re + '?'
else:
@@ -484,7 +494,14 @@ def build_check_requires_timestamp(t):
if component not in node.children:
node.children[component] = Node()
node = node.children[component]
node.present = True
if component[0].islower():
# We've arrived at a namespace provide like `ol.foo`.
# In this case, we want to match uses like `ol.foo.doIt()` but
# not match things like `new ol.foo.SomeClass()`.
# For this purpose, we use the special wildcard key for the child.
node.children['*'] = Node()
else:
node.present = True
provide_res = [child.build_re(key)
for key, child in root.children.iteritems()]
missing_count = 0
@@ -574,29 +591,15 @@ def plovr_jar(t):
t.info('downloaded %r', t.name)
@target('gh-pages', 'host-examples', 'doc', phony=True)
def gh_pages(t):
with t.tempdir() as tempdir:
t.run('%(GIT)s', 'clone', '--branch', 'gh-pages',
'git@github.com:openlayers/ol3.git', tempdir)
with t.chdir(tempdir):
t.rm_rf('%(BRANCH)s')
t.cp_r('build/gh-pages/%(BRANCH)s', tempdir + '/%(BRANCH)s')
with t.chdir(tempdir):
t.run('%(GIT)s', 'add', '--all', '%(BRANCH)s')
t.run('%(GIT)s', 'commit', '--message', 'Updated')
t.run('%(GIT)s', 'push', 'origin', 'gh-pages')
virtual('doc', 'build/jsdoc-%(BRANCH)s-timestamp' % vars(variables))
virtual('apidoc', 'build/jsdoc-%(BRANCH)s-timestamp' % vars(variables))
@target('build/jsdoc-%(BRANCH)s-timestamp' % vars(variables), 'host-resources',
'build/src/external/src/exports.js', 'build/src/external/src/types.js',
SRC, SHADER_SRC, ifind('doc/template'))
SRC, SHADER_SRC, ifind('apidoc/template'))
def jsdoc_BRANCH_timestamp(t):
t.run('%(JSDOC)s', '-c', 'doc/conf.json', 'src', 'doc/index.md',
'-d', 'build/gh-pages/%(BRANCH)s/apidoc')
t.run('%(JSDOC)s', '-c', 'apidoc/conf.json', 'src', 'apidoc/index.md',
'-d', 'build/hosted/%(BRANCH)s/apidoc')
t.touch()
@@ -634,15 +637,15 @@ def split_example_file(example, dst_dir):
@target('host-resources', phony=True)
def host_resources(t):
resources_dir = 'build/gh-pages/%(BRANCH)s/resources'
resources_dir = 'build/hosted/%(BRANCH)s/resources'
t.rm_rf(resources_dir)
t.cp_r('resources', resources_dir)
@target('host-examples', 'build', 'host-resources', 'examples', phony=True)
def host_examples(t):
examples_dir = 'build/gh-pages/%(BRANCH)s/examples'
build_dir = 'build/gh-pages/%(BRANCH)s/build'
examples_dir = 'build/hosted/%(BRANCH)s/examples'
build_dir = 'build/hosted/%(BRANCH)s/build'
t.rm_rf(examples_dir)
t.makedirs(examples_dir)
t.rm_rf(build_dir)
@@ -657,30 +660,27 @@ def host_examples(t):
t.cp('examples/index.html', 'examples/example-list.js',
'examples/example-list.xml', 'examples/Jugl.js',
'examples/jquery.min.js', examples_dir)
t.rm_rf('build/gh-pages/%(BRANCH)s/closure-library')
t.makedirs('build/gh-pages/%(BRANCH)s/closure-library')
with t.chdir('build/gh-pages/%(BRANCH)s/closure-library'):
t.rm_rf('build/hosted/%(BRANCH)s/closure-library')
t.makedirs('build/hosted/%(BRANCH)s/closure-library')
with t.chdir('build/hosted/%(BRANCH)s/closure-library'):
t.run('%(JAR)s', 'xf', '../../../../' + PLOVR_JAR, 'closure')
t.run('%(JAR)s', 'xf', '../../../../' + PLOVR_JAR, 'third_party')
t.rm_rf('build/gh-pages/%(BRANCH)s/ol')
t.makedirs('build/gh-pages/%(BRANCH)s/ol')
t.cp_r('src/ol', 'build/gh-pages/%(BRANCH)s/ol/ol')
t.rm_rf('build/hosted/%(BRANCH)s/ol')
t.makedirs('build/hosted/%(BRANCH)s/ol')
t.cp_r('src/ol', 'build/hosted/%(BRANCH)s/ol/ol')
t.run('%(PYTHON)s', 'bin/closure/depswriter.py',
'--root_with_prefix', 'src ../../../ol',
'--root', 'build/gh-pages/%(BRANCH)s/closure-library/closure/goog',
'--root_with_prefix', 'build/gh-pages/%(BRANCH)s/closure-library/'
'--root', 'build/hosted/%(BRANCH)s/closure-library/closure/goog',
'--root_with_prefix', 'build/hosted/%(BRANCH)s/closure-library/'
'third_party ../../third_party',
'--output_file', 'build/gh-pages/%(BRANCH)s/build/ol-deps.js')
'--output_file', 'build/hosted/%(BRANCH)s/build/ol-deps.js')
@target('check-examples', 'host-examples', phony=True)
def check_examples(t):
examples = ['build/gh-pages/%(BRANCH)s/' + e for e in EXAMPLES]
examples = ['build/hosted/%(BRANCH)s/' + e for e in EXAMPLES]
all_examples = \
[e + '?mode=raw' for e in examples] + \
[e + '?mode=whitespace' for e in examples] + \
[e + '?mode=simple' for e in examples] + \
examples
[e + '?mode=advanced' for e in examples]
for example in all_examples:
t.run('%(PHANTOMJS)s', 'bin/check-example.js', example)
@@ -707,7 +707,7 @@ virtual('test-deps', INTERNAL_SRC, PROJ4JS, 'build/test/requireall.js')
@target('test', 'test-deps', phony=True)
def test(t):
t.run('%(PHANTOMJS)s', 'test/mocha-phantomjs.coffee', 'test/ol.html')
t.run('%(PHANTOMJS)s', 'test/mocha-phantomjs.js', 'test/ol.html')
@target('fixme', phony=True)
@@ -755,5 +755,50 @@ def check_dependencies(t):
print 'For certain targets all above programs need to be present.'
@target('help')
def display_help(t):
print '''
build.py - The OpenLayers 3 build script.
Usage:
./build.py [options] [target] (on Unix-based machines)
<python-executable.exe> build.py [options] [target] (on Windows machines)
There is one option:
-c - Cleans up the repository from previous builds.
The most common targets are:
serve - Serves files through plovr, usually on port 9810.
lint - Runs gjslint on all sourcefiles to enforce specific syntax.
build - Builds singlefile versions of OpenLayers JavaScript and
CSS. This is also the default build target which runs when
no target is specified.
test - Runs the testsuite and displays the results.
check - Runs the lint-target, builds some OpenLayers files, and
then runs test. Many developers call this target often
while working on the code.
help - Shows this help.
Other less frequently used targets are:
apidoc - Builds the API-Documentation using JSDoc3.
integration-test - Builds all examples in various modes and usually tales a
long time to finish. This target calls the following
targets: lint, build, build-all, test, build-examples,
check-examples and apidoc.
reallyclean - Remove untracked files from the repository.
checkdeps - Checks whether all required development software is
installed on your machine.
fixme - Will print a list of parts of the code that are marked
with either TODO or FIXME.
todo - is an alias for the fixme-target
plovr - Fetches the required plovr.jar. Usually called by other
targets that depend on plovr.
If no target is given, the build-target will be executed.
The above list is not complete, please see the sourceode for not-mentioned and
only seldomly called targets.
'''
if __name__ == '__main__':
main()

View File

@@ -42,10 +42,11 @@
"//json.js",
"../externs/bingmaps.js",
"../externs/geojson.js",
"../externs/topojson.js",
"../externs/oli.js",
"../externs/proj4js.js",
"../externs/tilejson.js",
"../externs/w3c_device_sensor_event.js"
"../externs/closure-compiler.js"
],
"level": "VERBOSE",
@@ -99,7 +100,8 @@
"goog.debug.logRecordSerializer",
"goog.debug.makeWhitespaceVisible",
"goog.debug.normalizeErrorObject",
"goog.debug.reflect"
"goog.debug.reflect",
"goog.log"
]
}

View File

@@ -7,10 +7,11 @@
"../build/src/external/externs/types.js",
"../externs/bingmaps.js",
"../externs/geojson.js",
"../externs/topojson.js",
"../externs/oli.js",
"../externs/proj4js.js",
"../externs/tilejson.js",
"../externs/w3c_device_sensor_event.js"
"../externs/closure-compiler.js"
],
"inherits": "base.json",

View File

@@ -16,10 +16,11 @@
"//json.js",
"../externs/bingmaps.js",
"../externs/geojson.js",
"../externs/topojson.js",
"../externs/oli.js",
"../externs/proj4js.js",
"../externs/tilejson.js",
"../externs/w3c_device_sensor_event.js"
"../externs/closure-compiler.js"
],
"inherits": "ol.json",

View File

@@ -17,10 +17,11 @@
"//json.js",
"../externs/bingmaps.js",
"../externs/geojson.js",
"../externs/topojson.js",
"../externs/oli.js",
"../externs/proj4js.js",
"../externs/tilejson.js",
"../externs/w3c_device_sensor_event.js"
"../externs/closure-compiler.js"
],
"inherits": "ol.json",

View File

@@ -17,10 +17,11 @@
"../build/src/external/externs/types.js",
"../externs/bingmaps.js",
"../externs/geojson.js",
"../externs/topojson.js",
"../externs/oli.js",
"../externs/proj4js.js",
"../externs/tilejson.js",
"../externs/w3c_device_sensor_event.js"
"../externs/closure-compiler.js"
],
"inherits": "base.json",

View File

@@ -202,3 +202,43 @@ a.ol-full-screen-true:after {
height: 20px;
width: 24px;
}
.ol-zoom-extent {
position: absolute;
background: rgba(255,255,255,0.4);
border-radius: 4px;
left: 8px;
padding: 2px;
top: 65px;
}
@media print {
.ol-zoom-extent {
display: none;
}
}
.ol-zoom-extent a {
display: block;
margin: 1px;
padding: 0;
color: white;
font-size: 16px;
font-family: 'Lucida Grande',Verdana,Geneva,Lucida,Arial,Helvetica,sans-serif;
font-weight: bold;
text-decoration: none;
text-align: center;
height: 22px;
width: 22px;
background-color: rgba(0, 60, 136, 0.5);
border-radius: 2px;
}
.ol-touch .ol-zoom-extent a {
font-size: 20px;
height: 30px;
width: 30px;
line-height: 26px;
}
.ol-zoom-extent a:hover {
background-color: rgba(0, 60, 136, 0.7);
}
.ol-zoom-extent a:after {
content: "E";
}

12
doc/index.hbs Normal file
View File

@@ -0,0 +1,12 @@
---
title: Documentation
layout: doc.hbs
---
# Documentation
If you're eager to get your first OpenLayers 3 map on a page, dive into the [quick start](quickstart.html).
For a more in-depth overview of OpenLayers 3 core concepts, check out the [tutorials](tutorials/).
Find additional reference material in the [API docs](../apidoc).

132
doc/quickstart.hbs Normal file
View File

@@ -0,0 +1,132 @@
---
title: Quick Start
layout: doc.hbs
---
# Quick Start
## Put a map on a page
Below you'll find a complete working example. Create a new file, copy in the contents below, and open in a browser:
```xml
<!doctype html>
<html lang="en">
<head>
<link rel="stylesheet" href="http://ol3js.org/en/{{ latest }}/build/ol.css" type="text/css">
<style>
.map {
height: 400px;
width: 100%;
}
</style>
<script src="http://ol3js.org/en/{{ latest }}/build/ol.js" type="text/javascript"></script>
<title>OpenLayers 3 example</title>
</head>
<body>
<h2>My Map</h2>
<div id="map" class="map"></div>
<script type="text/javascript">
var map = new ol.Map({
target: 'map',
layers: [
new ol.layer.Tile({
source: new ol.source.MapQuestOpenAerial()
})
],
view: new ol.View2D({
center: ol.proj.transform([37.41, 8.82], 'EPSG:4326', 'EPSG:3857'),
zoom: 4
})
});
</script>
</body>
</html>
```
## Understanding what is going on
To include a map a web page you will need 3 things:
1. Include OpenLayers
2. `<div>` map container
3. JavaScript to create a simple map
### Include OpenLayers
```xml
<script src="http://ol3js.org/en/{{ latest }}/build/ol.js" type="text/javascript"></script>
```
The first part is to include the JavaScript library. For the purpose of this tutorial, here we simply point to the ol3js.org website to get the whole library. In a production environment, we would build a custom version of the library including only the module needed for our application.
### `<div>` to contain the map
```xml
<div id="map" class="map"></div>
```
The map in the application is contained in a [`<div>` HTML element](http://en.wikipedia.org/wiki/Span_and_div). Through this `<div>` the map properties like width, height and border can be controlled through CSS. Here's the CSS element used to make the map 400 pixels high and as wide as the browser window.
```xml
<style>
.map {
height: 400px; width: 100%;
}
</style>
```
### JavaScript to create a simple map
```js
var map = new ol.Map({
target: 'map',
layers: [
new ol.layer.Tile({
source: new ol.source.MapQuestOpenAerial()
})
],
view: new ol.View2D({
center: ol.proj.transform([37.41, 8.82], 'EPSG:4326', 'EPSG:3857'),
zoom: 4
})
});
```
With this JavaScript code, a map object is created with a MapQuest Open Aerial layer zoomed on the African East coast. Let's break this down:
The following line creates an OpenLayers `Map` object. Just by itself, this does nothing since there's no layers or interaction attached to it.
```js
var map = new ol.Map({ ... });
```
To attach the map object to the `<div>`, the map object takes a `target` into arguments. The value is the `id` of the `<div>`:
```js
target: 'map'
```
The `layers: [ ... ]` array is used to define the list of layers available in the map. The first and only layer right now is a tiled layer:
```js
layers: [
new ol.layer.Tile({
source: new ol.source.MapQuestOpenAerial()
})
]
```
Layers in OpenLayers 3 are defined with a type (Image, Tile or Vector) which contains a source. The source is the protocol used to get the map tiles. You can consult the list of [available layer sources here](/en/{{ latest }}/apidoc/ol.source.html)
The next part of the `Map` object is the `View`. The view allow to specify the center, resolution, and rotation of the map. Right now, only `View2D` is supported, but other views should be available at some point. The simplest way to define a view is to define a center point and a zoom level. Note that zoom level 0 is zoomed out.
```js
view: new ol.View2D({
center: ol.proj.transform([37.41, 8.82], 'EPSG:4326', 'EPSG:3857'),
zoom: 4
})
```
You will notice that the `center` specified is in lat/lon coordinates (EPSG:4326). Since the only layer we use is in Spherical Mercator projection (EPSG:3857), we can reproject them on the fly to be able to zoom the map on the right coordinates.

View File

@@ -0,0 +1,73 @@
---
title: Basic Concepts
layout: doc.hbs
---
# Basic Concepts
## Map
The core component of OpenLayers 3 is the map (`ol.Map`). It is rendered to a `target` container (e.g. a `div` element on the web page that contains the map). All map properties can either be configured at construction time, or by using setter methods, e.g. `setTarget()`.
```xml
<div id="map" style="width: 100%, height: 400px"></div>
<script>
var map = new ol.Map({target: 'map'});
</script>
```
## View
`ol.Map` is not responsible for things like center, zoom level and projection of the map. Instead, these are properties of an `ol.View` instance - typically an `ol.View2D` for 2D maps. The reason for this abstraction is the idea of instantly switching e.g. between a 2D and a tilted 3D view, without the need to maintain two copies of the `layers`.
```js
map.setView(new ol.View2D({
center: [0, 0],
zoom: 2
}));
```
An `ol.View2D` also has a `projection`. The projection determines the coordinate system of the `center` and the units for map resolution calculations. If not specified (like in the above snippet), the default projection is Spherical Mercator (EPSG:3857), with meters as map units.
The `zoom` option is a convenient way to specify the map resolution. The available zoom levels are determined by `maxZoom` (default: 28), `zoomFactor` (default: 2) and `maxResolution` (default is calculated in such a way that the projection's validity extent fits in a 256x256 pixel tile). Starting at zoom level 0 with a resolution of `maxResolution` units per pixel, subsequent zoom levels are calculated by dividing the previous zoom level's resolution by `zoomFactor`, until zoom level `maxZoom` is reached.
## Source
To get remote data for a layer, OpenLayers 3 uses `ol.source.Source` subclasses. These are available for free and commercial map tile services like OpenStreetMap or Bing, for OGC sources like WMS or WMTS, and for vector data in formats like GeoJSON or KML.
```js
var osmSource = new ol.source.OSM();
```
## Layer
A layer is a visual representation of data from a `source`. OpenLayers 3 has three basic types of layers: `ol.layer.Tile`, `ol.layer.Image` and `ol.layer.Vector`.
`ol.layer.Tile` is for layer sources that provide pre-rendered, tiled images in grids that are organized by zoom levels for specific resolutions.
`ol.layer.Image` is for server rendered images that are available for arbitrary extents and resolutions.
`ol.layer.Vector` is for vector data that is rendered client-side.
```js
var osmLayer = new ol.layer.Tile({source: osmSource});
map.addLayer(osmLayer);
```
## Putting it all together
The above snippets can be conflated to a self contained map configuration with view and layers:
```xml
<div id="map" style="width: 100%, height: 400px"></div>
<script>
new ol.Map({
layers: [
new ol.layer.Tile({source: new ol.source.OSM()})
],
view: new ol.View2D({
center: [0, 0],
zoom: 2
}),
target: 'map'
});
</script>
```

8
doc/tutorials/index.hbs Normal file
View File

@@ -0,0 +1,8 @@
---
title: Tutorials
layout: doc.hbs
---
# Tutorials
We'll be putting together a more comprehensive set of tutorials here. For now, you can take a look at the [basic concepts](concepts.html) tutorial. Stay tuned for more!

View File

@@ -1,3 +0,0 @@
{
"title": "OpenLayers 3 Architecture"
}

View File

@@ -1,274 +0,0 @@
CLASS HIERARCHY
===============
```
goog.math.Coordinate // Simple 2D point
|
+- TileCoord
goog.math.Box
|
+- Extent // The extent of a single object in two dimensions, projection not stored
|
+- TileBounds // A range of tiles in two dimensions, integer coordinates, z not stored
Projection
goog.events.EventTarget
|
+- MVCObject
| |
| +- Camera
| |
| +- Control
| | |
| | +- ?
| |
| +- Layer
| | |
| | +- TileLayer
| | | |
| | | +- TMSTileLayer
| | | |
| | | +- WMTSTileLayer
| | | |
| | | +- XYZTileLayer / OSMTileLayer
| | |
| | +- VectorLayer
| | |
| | +- ImageLayer
| |
| +- LayerRenderer
| |
| +- LayerRendererOptions
| |
| +- Map
| |
| +- MapRenderer
| | |
| | +- HTMLMapRenderer
| | |
| | +- WebGLMapRenderer
| |
| +- MVCArray
| | |
| | +- ControlArray
| | |
| | +- LayerViewArray
|
| +- TileQueue
|
+- Tile
```
Layer renderer hierarchy
------------------------
```
goog.events.EventTarget
|
+- MVCObject
|
+- LayerRenderer
|
+- SingleTileLayerRenderer
| |
| +- HTMLSingleTileLayerRenderer
| |
| +- WebGLSingleTileLayerRenderer
|
+- TileLayerRenderer
| |
| +- HTMLTileLayerRenderer
| |
| +- WebGLTileLayerRenderer
|
+- VectorLayerRenderer
| |
| +- HTMLVectorLayerRenderer
| | |
| | +- SVGHTMLVectorLayerRenderer
| | |
| | +- Canvas2DHTMLVectorLayerRenderer
| | |
| | +- VMLHTMLVectorLayerRenderer
| |
| +- WebGLVectorLayerRenderer
```
OBJECT PROPERTIES AND METHODS
=============================
Notation:
- `property type` property with type, trailing ? indicates unsure, getters and setters are assumed to exist.
- `f(args) -> type` function taking args returning type.
- `f(args) -> type = something` f is a trivial wrapper around something.
- `fires 'x'` fires events of type 'x'.
Principles:
- All non-trivial objects inherit from `MVCObject`.
- All non-trivial collections are either `MVCArrays` or a child class thereof.
- Resolutions are `Array.<number>`, infinitely scalable resources (e.g. vectore layers) have resolutions == null.
```
MVCObject
as Google Maps MVCObject
freeze()
unfreeze()
TileCoord
clone() -> TileCoord
getHash() -> number
TileBounds
forEachTileCoord(z, function(tileCoord))
Tile
tileCoord TileCoord
url string
state UNLOADED | LOADING | LOADED
fires 'loaded' // when loaded
fires 'aborted' // when loading is aborted
Camera
position goog.math.Coordinate
resolution number
rotation number
Layer
projections Array.<Projection>
extent Extent
getResolutions() -> Array.<number>|null
fires 'change' // when data changes
LayerArray
getResolutions() -> Array.<number>|null
getMaxResolution() = this.getResolutions()[0] | null
LayerRendererOptions
layer Layer
visible boolean
opacity number
brightness number
color number
hue number
saturation number
Map
projection Projection
renderer Renderer
layers LayerArray
addLayer(layer) = layers.push(layer)
getExtent() -> Extent
getMaxResolution() = layers.getMaxResolution()
TileGrid
resolutions Array.<number>
extent ol.Extent
xEast boolean
ySouth boolean
origin(s) Coord|Array.<Coord>
tileSize goog.math.Size
forEachTileCoordChild(tileCoord, function(z, TileBounds))
forEachTileCoordParent(tileCoord, function(z, TileBounds))
getExtentTileBounds(z, extent) -> TileBounds
getTileCoord(coordinate) -> TileCoord
getTileCoordCenter(tileCoord) -> goog.math.Coordinate
getTileCoordExtent(tileCoord) -> ol.Extent
getTileCoordResolution(tileCoord) -> number
getZForResolution(resolution) -> number
TileLayer
tileGrid TileGrid
tileUrl function(tileCoord) -> string
getTileCoordUrl(tileCoord) -> string = this.tileUrl(tileCoord)
TileQueue
camera Camera // or maybe MVCArray.<Camera> ?
getTileCoordPriority(tileCoord) -> number // private
enqueueTile(Tile)
VectorLayer
forEachFeature(resolution, extent, projection, function(Feature))
Renderer
target HTMLDivElement
map Map
camera Camera
getCapabilities() -> Array.<string> // maybe ?
```
Questions:
- Store tile layer extent in TileLayer or in TileGrid? (not clear)
Two concepts: tile coordinate system range and and available data extent.
TileGrid extent is range (or validity extent) of the tile coordinate system.
TileLayer extent is the available data extent. A particular TileGrid may range
from 0,0 to 10,10. My cache may conform to that grid but I may only have tiles
ranging from 2,2 to 8,8. When you need to wrap multiple worlds, you pay
attention to the TileGrid extent. When you need to decide whether or not to
bother requesting a tile, you pay attention to the TileLayer extent.
- Who determines "best" resolution? (static function?)
Todo: if tile layer extent stored in TileLayer rather than TileGrid then extent
will occasionally need to be passed to TileGrid functions for cropping.
DESIGN ASSERTIONS
=================
Map
- A map has a renderer (the map renderer).
- A map has a camera.
- Multiple maps can share the same camera.
- A map has a layer list.
Layer
- A layer can have multiple projections (the supported projections).
- A layer advertizes the projections it supports.
- A layer returns no data if asked data for an unsupported projection.
LayerRendererOptions
- A layer renderer options object stores view-related states for a layer.
- Options include visibility, opacity, saturation, hue, etc.
- A layer renderer options object has a layer.
- Multiple layer renderer options can share the same layer.
- In other words a layer can be viewed in different manners.
Renderer
- The map renderer responds to events.
- The map renderer receives events from the camera.
- The map renderer creates layer renderers.
Control
- A control may listen to map events.
- A control may listen to camera events.
- A map navigation control acts on the camera.
MVC
- Types can be described in MVC terms.
- Models don't know what rendering means.
- Maps are models.
- Layers are models.
- Layer views are models (sorry!).
- Cameras are models.
- Layer lists are collections.
- Renderers are views.
- Controls are views or controllers or both.
- An attribution control is a view.
- A map navigation control is a controller.
- A zoom slider control is both a view and a controller.

60
examples/accessible.html Normal file
View File

@@ -0,0 +1,60 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<link rel="stylesheet" href="../css/ol.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
<title>Accessibility example</title>
<style>
a.accesskey {
color: #FFFFFF;
}
</style>
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="./"><img src="../resources/logo.png"> OpenLayers 3 Examples</a>
</div>
</div>
</div>
<div class="container-fluid">
<div class="row-fluid">
<div class="span12">
<a class="accesskey" onclick="document.getElementById('map').focus(); return false;" accesskey="1" href="">Go to map</a>
<div id="map" class="map" tabindex="0"></div>
<a class="zoom" accesskey="i" href="javascript: void map.getView().setZoom(map.getView().getZoom() + 1);">Zoom in</a>
<a class="zoom" accesskey="o" href="javascript: void map.getView().setZoom(map.getView().getZoom() - 1);">Zoom out</a>
</div>
</div>
<div class="row-fluid">
<div class="span12">
<h4 id="title">Accessibility example</h4>
<p id="shortdesc">Example of an accessible map.</p>
<div id="docs">
<p>This page's <code>map</code> element has its <code>tabindex</code> attribute set to <code>"0"</code>. That makes is focusable. To focus the map element you can either navigate to it using the "tab" key, or use the <a href="http://en.wikipedia.org/wiki/Access_key">Access Key</a> "1" (alt+1 or ctrl+alt+1) which provides a direct access. When the <code>map</code> element is focused the + and - keys can be used to zoom in and out, and the arrow keys can be used to pan.</p>
<p>When clicked the "Zoom in" and "Zoom out" links below the map zoom the map in and out, respectively. You can navigate to the links using the "tab" key, and press the "enter" key to trigger the zooming action. The Access Keys "i" and "o" can also be used, as a direct access to the actions of "Zoom in" and "Zoom out" links.</p>
<p>See the source of the page to see how this done.</p>
</div>
<div id="tags">accessibility, tabindex</div>
</div>
</div>
</div>
<script src="loader.js?id=accessible" type="text/javascript"></script>
<script src="../resources/example-behaviour.js" type="text/javascript"></script>
</body>
</html>

20
examples/accessible.js Normal file
View File

@@ -0,0 +1,20 @@
goog.require('ol.Map');
goog.require('ol.RendererHints');
goog.require('ol.View2D');
goog.require('ol.layer.Tile');
goog.require('ol.source.OSM');
var map = new ol.Map({
layers: [
new ol.layer.Tile({
source: new ol.source.OSM()
})
],
renderers: ol.RendererHints.createFromQueryData(),
target: 'map',
view: new ol.View2D({
center: [0, 0],
zoom: 2
})
});

View File

@@ -4,6 +4,7 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<link rel="stylesheet" href="../css/ol.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
@@ -14,13 +15,7 @@
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="./">OpenLayers 3 Examples</a>
<ul class="nav pull-right">
<li><iframe class="github-watch-button" src="http://ghbtns.com/github-btn.html?user=openlayers&repo=ol3&type=watch&count=true"
allowtransparency="true" frameborder="0" scrolling="0" height="20" width="90"></iframe></li>
<li><a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-hashtags="openlayers">&nbsp;</a></li>
<li><div class="g-plusone-wrapper"><div class="g-plusone" data-size="medium" data-annotation="none"></div></div></li>
</ul>
<a class="brand" href="./"><img src="../resources/logo.png"> OpenLayers 3 Examples</a>
</div>
</div>
</div>
@@ -48,7 +43,7 @@
<div class="row-fluid">
<div class="span4">
<div class="span12">
<h4 id="title">Animation example</h4>
<p id="shortdesc">Demonstrates animated pan, zoom, and rotation.</p>
<div id="docs">
@@ -62,7 +57,7 @@
</div>
<script src="loader.js?id=animation" type="text/javascript"></script>
<script src="../resources/social-links.js" type="text/javascript"></script>
<script src="../resources/example-behaviour.js" type="text/javascript"></script>
</body>
</html>

View File

@@ -3,7 +3,7 @@ goog.require('ol.RendererHints');
goog.require('ol.View2D');
goog.require('ol.animation');
goog.require('ol.easing');
goog.require('ol.layer.TileLayer');
goog.require('ol.layer.Tile');
goog.require('ol.proj');
goog.require('ol.source.OSM');
@@ -23,7 +23,7 @@ var view = new ol.View2D({
var map = new ol.Map({
layers: [
new ol.layer.TileLayer({
new ol.layer.Tile({
preload: 4,
source: new ol.source.OSM()
})
@@ -39,7 +39,7 @@ rotateLeft.addEventListener('click', function() {
duration: 2000,
rotation: -4 * Math.PI
});
map.addPreRenderFunction(rotateLeft);
map.beforeRender(rotateLeft);
}, false);
var rotateRight = document.getElementById('rotate-right');
rotateRight.addEventListener('click', function() {
@@ -47,7 +47,7 @@ rotateRight.addEventListener('click', function() {
duration: 2000,
rotation: 4 * Math.PI
});
map.addPreRenderFunction(rotateRight);
map.beforeRender(rotateRight);
}, false);
@@ -57,7 +57,7 @@ panToLondon.addEventListener('click', function() {
duration: 2000,
source: view.getCenter()
});
map.addPreRenderFunction(pan);
map.beforeRender(pan);
view.setCenter(london);
}, false);
@@ -68,7 +68,7 @@ elasticToMoscow.addEventListener('click', function() {
easing: ol.easing.elastic,
source: view.getCenter()
});
map.addPreRenderFunction(pan);
map.beforeRender(pan);
view.setCenter(moscow);
}, false);
@@ -79,7 +79,7 @@ bounceToIstanbul.addEventListener('click', function() {
easing: ol.easing.bounce,
source: view.getCenter()
});
map.addPreRenderFunction(pan);
map.beforeRender(pan);
view.setCenter(istanbul);
}, false);
@@ -97,7 +97,7 @@ spinToRome.addEventListener('click', function() {
rotation: 2 * Math.PI,
start: start
});
map.addPreRenderFunctions([pan, rotate]);
map.beforeRender(pan, rotate);
view.setCenter(rome);
}, false);
@@ -115,7 +115,7 @@ flyToBern.addEventListener('click', function() {
resolution: 4 * view.getResolution(),
start: start
});
map.addPreRenderFunctions([pan, bounce]);
map.beforeRender(pan, bounce);
view.setCenter(bern);
}, false);
@@ -138,6 +138,6 @@ spiralToMadrid.addEventListener('click', function() {
rotation: -4 * Math.PI,
start: start
});
map.addPreRenderFunctions([pan, bounce, rotate]);
map.beforeRender(pan, bounce, rotate);
view.setCenter(madrid);
}, false);

View File

@@ -4,6 +4,7 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<link rel="stylesheet" href="../css/ol.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
@@ -14,13 +15,7 @@
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="./">OpenLayers 3 Examples</a>
<ul class="nav pull-right">
<li><iframe class="github-watch-button" src="http://ghbtns.com/github-btn.html?user=openlayers&repo=ol3&type=watch&count=true"
allowtransparency="true" frameborder="0" scrolling="0" height="20" width="90"></iframe></li>
<li><a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-hashtags="openlayers">&nbsp;</a></li>
<li><div class="g-plusone-wrapper"><div class="g-plusone" data-size="medium" data-annotation="none"></div></div></li>
</ul>
<a class="brand" href="./"><img src="../resources/logo.png"> OpenLayers 3 Examples</a>
</div>
</div>
</div>
@@ -40,6 +35,11 @@
<p id="shortdesc">Demonstrates two-way binding of HTML input elements to OpenLayers objects.</p>
<div id="docs">
<p>See the <a href="bind-input.js" target="_blank">bind-input.js source</a> to see how this is done.</p>
<div id="no-webgl" class="alert alert-warning" style="display: none">
<h4>Warning!</h4>
A browser that supports <a href="http://get.webgl.org/">WebGL</a> is required to change the
<strong>hue</strong>, <strong>saturation</strong>, <strong>contrast</strong> and <strong>brightness</strong>.
</div>
</div>
<div id="tags">input, bind, openstreetmap</div>
</div>
@@ -54,13 +54,13 @@
<label>opacity</label>
<input id="opacity" type="range" min="0" max="1" step="0.01"/>
<label>hue</label>
<input id="hue" type="range" min="-3.141592653589793" max="3.141592653589793" step="0.01"/>
<input id="hue" class="webgl" type="range" min="-3.141592653589793" max="3.141592653589793" step="0.01"/>
<label>saturation</label>
<input id="saturation" type="range" min="0" max="5" step="0.01"/>
<input id="saturation" class="webgl" type="range" min="0" max="5" step="0.01"/>
<label>contrast</label>
<input id="contrast" type="range" min="0" max="2" step="0.01"/>
<input id="contrast" class="webgl" type="range" min="0" max="2" step="0.01"/>
<label>brightness</label>
<input id="brightness" type="range" min="-1" max="1" step="0.01"/>
<input id="brightness" class="webgl" type="range" min="-1" max="1" step="0.01"/>
</fieldset>
</form>
</div>
@@ -82,7 +82,7 @@
</div>
<script src="loader.js?id=bind-input" type="text/javascript"></script>
<script src="../resources/social-links.js" type="text/javascript"></script>
<script src="../resources/example-behaviour.js" type="text/javascript"></script>
</body>
</html>

View File

@@ -2,10 +2,24 @@ goog.require('ol.Map');
goog.require('ol.RendererHints');
goog.require('ol.View2D');
goog.require('ol.dom.Input');
goog.require('ol.layer.TileLayer');
goog.require('ol.layer.Tile');
goog.require('ol.source.OSM');
goog.require('ol.webgl');
var layer = new ol.layer.TileLayer({
if (!ol.webgl.SUPPORTED) {
var inputs = document.getElementsByClassName('webgl');
for (var i = 0, len = inputs.length; i < len; i++) {
inputs[i].disabled = true;
}
var info = document.getElementById('no-webgl');
/**
* display warning message
*/
info.style.display = '';
}
var layer = new ol.layer.Tile({
source: new ol.source.OSM()
});
var map = new ol.Map({
@@ -22,23 +36,23 @@ var visible = new ol.dom.Input(document.getElementById('visible'));
visible.bindTo('checked', layer, 'visible');
var opacity = new ol.dom.Input(document.getElementById('opacity'));
opacity.bindTo('value', layer, 'opacity');
opacity.bindTo('valueAsNumber', layer, 'opacity');
var hue = new ol.dom.Input(document.getElementById('hue'));
hue.bindTo('value', layer, 'hue');
hue.bindTo('valueAsNumber', layer, 'hue');
var saturation = new ol.dom.Input(document.getElementById('saturation'));
saturation.bindTo('value', layer, 'saturation');
saturation.bindTo('valueAsNumber', layer, 'saturation');
var contrast = new ol.dom.Input(document.getElementById('contrast'));
contrast.bindTo('value', layer, 'contrast');
contrast.bindTo('valueAsNumber', layer, 'contrast');
var brightness = new ol.dom.Input(document.getElementById('brightness'));
brightness.bindTo('value', layer, 'brightness');
brightness.bindTo('valueAsNumber', layer, 'brightness');
var rotation = new ol.dom.Input(document.getElementById('rotation'));
rotation.bindTo('value', map.getView(), 'rotation');
rotation.bindTo('valueAsNumber', map.getView(), 'rotation');
var resolution = new ol.dom.Input(document.getElementById('resolution'));
resolution.bindTo('value', map.getView(), 'resolution');
resolution.bindTo('valueAsNumber', map.getView(), 'resolution');

View File

@@ -4,6 +4,7 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<link rel="stylesheet" href="../css/ol.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
@@ -14,13 +15,7 @@
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="./">OpenLayers 3 Examples</a>
<ul class="nav pull-right">
<li><iframe class="github-watch-button" src="http://ghbtns.com/github-btn.html?user=openlayers&repo=ol3&type=watch&count=true"
allowtransparency="true" frameborder="0" scrolling="0" height="20" width="90"></iframe></li>
<li><a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-hashtags="openlayers">&nbsp;</a></li>
<li><div class="g-plusone-wrapper"><div class="g-plusone" data-size="medium" data-annotation="none"></div></div></li>
</ul>
<a class="brand" href="./"><img src="../resources/logo.png"> OpenLayers 3 Examples</a>
</div>
</div>
</div>
@@ -41,7 +36,7 @@
<div class="row-fluid">
<div class="span4">
<div class="span12">
<h4 id="title">Bing Maps example</h4>
<p id="shortdesc">Example of a Bing Maps layer.</p>
<div id="docs">
@@ -56,7 +51,7 @@
<script src="jquery.min.js" type="text/javascript"></script>
<script src="loader.js?id=bing-maps" type="text/javascript"></script>
<script src="../resources/social-links.js" type="text/javascript"></script>
<script src="../resources/example-behaviour.js" type="text/javascript"></script>
</body>
</html>

View File

@@ -1,7 +1,7 @@
goog.require('ol.Map');
goog.require('ol.RendererHints');
goog.require('ol.View2D');
goog.require('ol.layer.TileLayer');
goog.require('ol.layer.Tile');
goog.require('ol.proj');
goog.require('ol.source.BingMaps');
@@ -9,11 +9,11 @@ goog.require('ol.source.BingMaps');
var styles = ['Road', 'Aerial', 'AerialWithLabels'];
var layers = [];
for (var i = 0; i < styles.length; ++i) {
layers.push(new ol.layer.TileLayer({
layers.push(new ol.layer.Tile({
visible: false,
preload: Infinity,
source: new ol.source.BingMaps({
key: 'AlQLZ0-5yk301_ESrmNLma3LYxEKNSg7w-e_knuRfyYFtld-UFvXVs38NOulku3Q',
key: 'Ar33pRUvQOdESG8m_T15MUmNz__E1twPo42bFx9jvdDePhX0PNgAcEm44OVTS7tt',
style: styles[i]
})
}));

View File

@@ -4,6 +4,7 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<link rel="stylesheet" href="../css/ol.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
@@ -22,13 +23,7 @@
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="./">OpenLayers 3 Examples</a>
<ul class="nav pull-right">
<li><iframe class="github-watch-button" src="http://ghbtns.com/github-btn.html?user=openlayers&repo=ol3&type=watch&count=true"
allowtransparency="true" frameborder="0" scrolling="0" height="20" width="90"></iframe></li>
<li><a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-hashtags="openlayers">&nbsp;</a></li>
<li><div class="g-plusone-wrapper"><div class="g-plusone" data-size="medium" data-annotation="none"></div></div></li>
</ul>
<a class="brand" href="./"><img src="../resources/logo.png"> OpenLayers 3 Examples</a>
</div>
</div>
</div>
@@ -38,6 +33,11 @@
<div class="row-fluid">
<div class="span12">
<div id="map" class="map"></div>
<div id="no-webgl" class="alert alert-error" style="display: none">
This example requires a browser that supports <a href="http://get.webgl.org/">WebGL</a>.
</div>
<div class="btn-group">
<button id="increase-brightness"><i class="icon-plus"></i></button>
<button id="reset-brightness">Brightness</button>
@@ -53,7 +53,7 @@
<div class="row-fluid">
<div class="span4">
<div class="span12">
<h4 id="title">Brightness/contrast example</h4>
<p id="shortdesc">Example of brightness/contrast control on the client (WebGL only).</p>
<div id="docs">
@@ -67,7 +67,7 @@
</div>
<script src="loader.js?id=brightness-contrast" type="text/javascript"></script>
<script src="../resources/social-links.js" type="text/javascript"></script>
<script src="../resources/example-behaviour.js" type="text/javascript"></script>
</body>
</html>

View File

@@ -1,65 +1,76 @@
goog.require('ol.Map');
goog.require('ol.RendererHint');
goog.require('ol.View2D');
goog.require('ol.layer.TileLayer');
goog.require('ol.layer.Tile');
goog.require('ol.source.MapQuestOpenAerial');
goog.require('ol.webgl');
var layer = new ol.layer.TileLayer({
source: new ol.source.MapQuestOpenAerial()
});
var map = new ol.Map({
layers: [layer],
renderer: ol.RendererHint.WEBGL,
target: 'map',
view: new ol.View2D({
center: [0, 0],
zoom: 2
})
});
var increaseBrightness = document.getElementById('increase-brightness');
var resetBrightness = document.getElementById('reset-brightness');
var decreaseBrightness = document.getElementById('decrease-brightness');
function setResetBrightnessButtonHTML() {
resetBrightness.innerHTML = 'Brightness (' +
layer.getBrightness().toFixed(3) + ')';
}
setResetBrightnessButtonHTML();
increaseBrightness.addEventListener('click', function() {
layer.setBrightness(Math.min(layer.getBrightness() + 0.125, 1));
setResetBrightnessButtonHTML();
}, false);
resetBrightness.addEventListener('click', function() {
layer.setBrightness(0);
setResetBrightnessButtonHTML();
}, false);
decreaseBrightness.addEventListener('click', function() {
layer.setBrightness(Math.max(layer.getBrightness() - 0.125, -1));
setResetBrightnessButtonHTML();
}, false);
var increaseContrast = document.getElementById('increase-contrast');
var resetContrast = document.getElementById('reset-contrast');
var decreaseContrast = document.getElementById('decrease-contrast');
function setResetContrastButtonHTML() {
resetContrast.innerHTML = 'Contrast (' + layer.getContrast().toFixed(3) + ')';
}
setResetContrastButtonHTML();
increaseContrast.addEventListener('click', function() {
layer.setContrast(layer.getContrast() + 0.125);
if (!ol.webgl.SUPPORTED) {
var info = document.getElementById('no-webgl');
/**
* display error message
*/
info.style.display = '';
} else {
var layer = new ol.layer.Tile({
source: new ol.source.MapQuestOpenAerial()
});
var map = new ol.Map({
layers: [layer],
renderer: ol.RendererHint.WEBGL,
target: 'map',
view: new ol.View2D({
center: [0, 0],
zoom: 2
})
});
var increaseBrightness = document.getElementById('increase-brightness');
var resetBrightness = document.getElementById('reset-brightness');
var decreaseBrightness = document.getElementById('decrease-brightness');
setResetBrightnessButtonHTML();
increaseBrightness.addEventListener('click', function() {
layer.setBrightness(Math.min(layer.getBrightness() + 0.125, 1));
setResetBrightnessButtonHTML();
}, false);
resetBrightness.addEventListener('click', function() {
layer.setBrightness(0);
setResetBrightnessButtonHTML();
}, false);
decreaseBrightness.addEventListener('click', function() {
layer.setBrightness(Math.max(layer.getBrightness() - 0.125, -1));
setResetBrightnessButtonHTML();
}, false);
var increaseContrast = document.getElementById('increase-contrast');
var resetContrast = document.getElementById('reset-contrast');
var decreaseContrast = document.getElementById('decrease-contrast');
setResetContrastButtonHTML();
}, false);
resetContrast.addEventListener('click', function() {
layer.setContrast(1);
setResetContrastButtonHTML();
}, false);
decreaseContrast.addEventListener('click', function() {
layer.setContrast(Math.max(layer.getContrast() - 0.125, 0));
setResetContrastButtonHTML();
}, false);
increaseContrast.addEventListener('click', function() {
layer.setContrast(layer.getContrast() + 0.125);
setResetContrastButtonHTML();
}, false);
resetContrast.addEventListener('click', function() {
layer.setContrast(1);
setResetContrastButtonHTML();
}, false);
decreaseContrast.addEventListener('click', function() {
layer.setContrast(Math.max(layer.getContrast() - 0.125, 0));
setResetContrastButtonHTML();
}, false);
}

View File

@@ -4,6 +4,7 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<link rel="stylesheet" href="../css/ol.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
@@ -14,13 +15,7 @@
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="./">OpenLayers 3 Examples</a>
<ul class="nav pull-right">
<li><iframe class="github-watch-button" src="http://ghbtns.com/github-btn.html?user=openlayers&repo=ol3&type=watch&count=true"
allowtransparency="true" frameborder="0" scrolling="0" height="20" width="90"></iframe></li>
<li><a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-hashtags="openlayers">&nbsp;</a></li>
<li><div class="g-plusone-wrapper"><div class="g-plusone" data-size="medium" data-annotation="none"></div></div></li>
</ul>
<a class="brand" href="./"><img src="../resources/logo.png"> OpenLayers 3 Examples</a>
</div>
</div>
</div>
@@ -35,7 +30,7 @@
<div class="row-fluid">
<div class="span4">
<div class="span12">
<h4 id="title">Canvas tiles example</h4>
<p id="shortdesc">Renders tiles with coordinates for debugging.</p>
<div id="docs">
@@ -50,7 +45,7 @@
</div>
<script src="loader.js?id=canvas-tiles" type="text/javascript"></script>
<script src="../resources/social-links.js" type="text/javascript"></script>
<script src="../resources/example-behaviour.js" type="text/javascript"></script>
</body>
</html>

View File

@@ -1,20 +1,20 @@
goog.require('ol.Map');
goog.require('ol.RendererHints');
goog.require('ol.View2D');
goog.require('ol.layer.TileLayer');
goog.require('ol.layer.Tile');
goog.require('ol.proj');
goog.require('ol.source.DebugTileSource');
goog.require('ol.source.OSM');
goog.require('ol.source.TileDebug');
goog.require('ol.tilegrid.XYZ');
var map = new ol.Map({
layers: [
new ol.layer.TileLayer({
new ol.layer.Tile({
source: new ol.source.OSM()
}),
new ol.layer.TileLayer({
source: new ol.source.DebugTileSource({
new ol.layer.Tile({
source: new ol.source.TileDebug({
projection: 'EPSG:3857',
tileGrid: new ol.tilegrid.XYZ({
maxZoom: 22

View File

@@ -4,11 +4,12 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<link rel="stylesheet" href="../css/ol.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
<style type="text/css">
.zoom-extent {
.rotate-north {
position: absolute;
top: 65px;
left: 8px;
@@ -16,30 +17,32 @@
border-radius: 4px;
padding: 2px;
}
.zoom-extent a {
.ol-touch .rotate-north {
top: 80px;
}
.rotate-north a {
display: block;
margin: 1px;
padding: 0;
color: white;
font-size: 18px;
font-size: 16px;
font-family: 'Lucida Grande',Verdana,Geneva,Lucida,Arial,Helvetica,sans-serif;
font-weight: bold;
margin: 1px;
text-decoration: none;
text-align: center;
border-radius: 2px;
height: 22px;
width: 22px;
line-height: 19px;
background: rgba(0,60,136,0.5);
}
.zoom-extent a:hover {
.ol-touch .rotate-north a {
font-size: 20px;
height: 30px;
width: 30px;
line-height: 26px;
}
.rotate-north a:hover {
background: rgba(0,60,136,0.7);
}
.zoom-to {
border-radius: 2px 2px 0 0;
}
.zoom-to:before {
content: "E";
}
</style>
<title>ol3 custom controls example</title>
</head>
@@ -48,13 +51,7 @@
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="./">OpenLayers 3 Examples</a>
<ul class="nav pull-right">
<li><iframe class="github-watch-button" src="http://ghbtns.com/github-btn.html?user=openlayers&repo=ol3&type=watch&count=true"
allowtransparency="true" frameborder="0" scrolling="0" height="20" width="90"></iframe></li>
<li><a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-hashtags="openlayers">&nbsp;</a></li>
<li><div class="g-plusone-wrapper"><div class="g-plusone" data-size="medium" data-annotation="none"></div></div></li>
</ul>
<a class="brand" href="./"><img src="../resources/logo.png"> OpenLayers 3 Examples</a>
</div>
</div>
</div>
@@ -68,15 +65,14 @@
</div>
<div class="row-fluid">
<div class="span4">
<div class="span12">
<h4 id="title">Custom controls</h4>
<p id="shortdesc">This example shows how to create custom controls.</p>
<div id="docs">
<p>
This example creates a "zoom to extent" button.
This example creates a "rotate to north" button.
See the <a href="custom-controls.js" target="_blank">custom-controls.js
source</a> to see how this is done.
Per default, the zoom extent control use the map projection extent.
</p>
</div>
<div id="tags">
@@ -87,7 +83,7 @@
</div>
<script src="loader.js?id=custom-controls" type="text/javascript"></script>
<script src="../resources/social-links.js" type="text/javascript"></script>
<script src="../resources/example-behaviour.js" type="text/javascript"></script>
</body>

View File

@@ -2,9 +2,9 @@ goog.require('ol');
goog.require('ol.Map');
goog.require('ol.RendererHints');
goog.require('ol.View2D');
goog.require('ol.control');
goog.require('ol.control.Control');
goog.require('ol.control.defaults');
goog.require('ol.layer.TileLayer');
goog.require('ol.layer.Tile');
goog.require('ol.source.OSM');
@@ -16,7 +16,7 @@ var app = window.app;
//
// Define zoom extent control.
// Define rotate to north control.
//
@@ -26,77 +26,48 @@ var app = window.app;
* @extends {ol.control.Control}
* @param {Object=} opt_options Control options.
*/
app.ZoomExtentControl = function(opt_options) {
app.RotateNorthControl = function(opt_options) {
var options = opt_options || {};
this.extent_ = options.extent;
var anchor = document.createElement('a');
anchor.href = '#zoom-to';
anchor.className = 'zoom-to';
anchor.href = '#rotate-north';
anchor.innerHTML = 'N';
var this_ = this;
var handleZoomTo = function(e) {
this_.handleZoomTo(e);
var handleRotateNorth = function(e) {
// prevent #rotate-north anchor from getting appended to the url
e.preventDefault();
this_.getMap().getView().getView2D().setRotation(0);
};
anchor.addEventListener('click', handleZoomTo, false);
anchor.addEventListener('touchstart', handleZoomTo, false);
anchor.addEventListener('click', handleRotateNorth, false);
anchor.addEventListener('touchstart', handleRotateNorth, false);
var element = document.createElement('div');
element.className = 'zoom-extent ol-unselectable';
element.className = 'rotate-north ol-unselectable';
element.appendChild(anchor);
ol.control.Control.call(this, {
element: element,
map: options.map,
target: options.target
});
};
ol.inherits(app.ZoomExtentControl, ol.control.Control);
/**
* @param {Event} e Browser event.
*/
app.ZoomExtentControl.prototype.handleZoomTo = function(e) {
// prevent #zoomTo anchor from getting appended to the url
e.preventDefault();
var map = this.getMap();
var view = map.getView();
view.fitExtent(this.extent_, map.getSize());
};
/**
* Overload setMap to use the view projection's validity extent
* if no extent was passed to the constructor.
* @param {ol.Map} map Map.
*/
app.ZoomExtentControl.prototype.setMap = function(map) {
ol.control.Control.prototype.setMap.call(this, map);
if (map && !this.extent_) {
this.extent_ = map.getView().getProjection().getExtent();
}
};
ol.inherits(app.RotateNorthControl, ol.control.Control);
//
// Create map, giving it a zoom extent control.
// Create map, giving it a rotate to north control.
//
var map = new ol.Map({
controls: ol.control.defaults({}, [
new app.ZoomExtentControl({
extent: [813079.7791264898, 848966.9639063801,
5929220.284081122, 5936863.986909639]
})
controls: ol.control.defaults().extend([
new app.RotateNorthControl()
]),
layers: [
new ol.layer.TileLayer({
new ol.layer.Tile({
source: new ol.source.OSM()
})
],
@@ -104,6 +75,7 @@ var map = new ol.Map({
target: 'map',
view: new ol.View2D({
center: [0, 0],
zoom: 2
zoom: 2,
rotation: 1
})
});

BIN
examples/data/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -4,6 +4,7 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<link rel="stylesheet" href="../css/ol.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
@@ -14,13 +15,7 @@
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="./">OpenLayers 3 Examples</a>
<ul class="nav pull-right">
<li><iframe class="github-watch-button" src="http://ghbtns.com/github-btn.html?user=openlayers&repo=ol3&type=watch&count=true"
allowtransparency="true" frameborder="0" scrolling="0" height="20" width="90"></iframe></li>
<li><a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-hashtags="openlayers">&nbsp;</a></li>
<li><div class="g-plusone-wrapper"><div class="g-plusone" data-size="medium" data-annotation="none"></div></div></li>
</ul>
<a class="brand" href="./"><img src="../resources/logo.png"> OpenLayers 3 Examples</a>
</div>
</div>
</div>
@@ -35,7 +30,7 @@
<div class="row-fluid">
<div class="span4">
<div class="span12">
<h4 id="title">Device orientation example</h4>
<label class="checkbox" for="track">
<input id="track" type="checkbox"/>track changes
@@ -56,7 +51,7 @@
</div>
<script src="loader.js?id=device-orientation" type="text/javascript"></script>
<script src="../resources/social-links.js" type="text/javascript"></script>
<script src="../resources/example-behaviour.js" type="text/javascript"></script>
</body>
</html>

View File

@@ -3,12 +3,12 @@ goog.require('ol.Map');
goog.require('ol.RendererHints');
goog.require('ol.View2D');
goog.require('ol.dom.Input');
goog.require('ol.layer.TileLayer');
goog.require('ol.layer.Tile');
goog.require('ol.source.OSM');
var map = new ol.Map({
layers: [
new ol.layer.TileLayer({
new ol.layer.Tile({
source: new ol.source.OSM()
})
],

View File

@@ -4,6 +4,7 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<link rel="stylesheet" href="../css/ol.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
@@ -14,13 +15,7 @@
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="./">OpenLayers 3 Examples</a>
<ul class="nav pull-right">
<li><iframe class="github-watch-button" src="http://ghbtns.com/github-btn.html?user=openlayers&repo=ol3&type=watch&count=true"
allowtransparency="true" frameborder="0" scrolling="0" height="20" width="90"></iframe></li>
<li><a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-hashtags="openlayers">&nbsp;</a></li>
<li><div class="g-plusone-wrapper"><div class="g-plusone" data-size="medium" data-annotation="none"></div></div></li>
</ul>
<a class="brand" href="./"><img src="../resources/logo.png"> OpenLayers 3 Examples</a>
</div>
</div>
</div>
@@ -35,7 +30,7 @@
<div class="row-fluid">
<div class="span4">
<div class="span12">
<h4 id="title">Drag rotate and zoom example</h4>
<p id="shortdesc">A single interaction to drag, rotate, and zoom.</p>
<div id="docs">
@@ -50,7 +45,7 @@
</div>
<script src="loader.js?id=drag-rotate-and-zoom" type="text/javascript"></script>
<script src="../resources/social-links.js" type="text/javascript"></script>
<script src="../resources/example-behaviour.js" type="text/javascript"></script>
</body>
</html>

View File

@@ -1,18 +1,18 @@
goog.require('ol.Map');
goog.require('ol.RendererHints');
goog.require('ol.View2D');
goog.require('ol.interaction');
goog.require('ol.interaction.DragRotateAndZoom');
goog.require('ol.interaction.defaults');
goog.require('ol.layer.TileLayer');
goog.require('ol.layer.Tile');
goog.require('ol.source.MapQuestOpenAerial');
var map = new ol.Map({
interactions: ol.interaction.defaults({}, [
interactions: ol.interaction.defaults().extend([
new ol.interaction.DragRotateAndZoom()
]),
layers: [
new ol.layer.TileLayer({
new ol.layer.Tile({
source: new ol.source.MapQuestOpenAerial()
})
],

View File

@@ -4,6 +4,7 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<link rel="stylesheet" href="../css/ol.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
@@ -14,13 +15,7 @@
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="./">OpenLayers 3 Examples</a>
<ul class="nav pull-right">
<li><iframe class="github-watch-button" src="http://ghbtns.com/github-btn.html?user=openlayers&repo=ol3&type=watch&count=true"
allowtransparency="true" frameborder="0" scrolling="0" height="20" width="90"></iframe></li>
<li><a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-hashtags="openlayers">&nbsp;</a></li>
<li><div class="g-plusone-wrapper"><div class="g-plusone" data-size="medium" data-annotation="none"></div></div></li>
</ul>
<a class="brand" href="./"><img src="../resources/logo.png"> OpenLayers 3 Examples</a>
</div>
</div>
</div>
@@ -35,7 +30,7 @@
<div class="row-fluid">
<div class="span4">
<div class="span12">
<h4 id="title">EPSG:4326 example</h4>
<p id="shortdesc">Example of a map in EPSG:4326.</p>
<div id="docs">
@@ -49,7 +44,7 @@
</div>
<script src="loader.js?id=epsg-4326" type="text/javascript"></script>
<script src="../resources/social-links.js" type="text/javascript"></script>
<script src="../resources/example-behaviour.js" type="text/javascript"></script>
</body>
</html>

View File

@@ -1,16 +1,16 @@
goog.require('ol.Map');
goog.require('ol.RendererHint');
goog.require('ol.View2D');
goog.require('ol.control');
goog.require('ol.control.ScaleLine');
goog.require('ol.control.ScaleLineUnits');
goog.require('ol.control.defaults');
goog.require('ol.layer.TileLayer');
goog.require('ol.source.TiledWMS');
goog.require('ol.layer.Tile');
goog.require('ol.source.TileWMS');
var layers = [
new ol.layer.TileLayer({
source: new ol.source.TiledWMS({
new ol.layer.Tile({
source: new ol.source.TileWMS({
url: 'http://vmap0.tiles.osgeo.org/wms/vmap0',
params: {
'VERSION': '1.1.1',
@@ -22,7 +22,7 @@ var layers = [
];
var map = new ol.Map({
controls: ol.control.defaults({}, [
controls: ol.control.defaults().extend([
new ol.control.ScaleLine({
units: ol.control.ScaleLineUnits.DEGREES
})

View File

@@ -4,6 +4,7 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<link rel="stylesheet" href="../css/ol.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
@@ -14,13 +15,7 @@
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="./">OpenLayers 3 Examples</a>
<ul class="nav pull-right">
<li><iframe class="github-watch-button" src="http://ghbtns.com/github-btn.html?user=openlayers&repo=ol3&type=watch&count=true"
allowtransparency="true" frameborder="0" scrolling="0" height="20" width="90"></iframe></li>
<li><a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-hashtags="openlayers">&nbsp;</a></li>
<li><div class="g-plusone-wrapper"><div class="g-plusone" data-size="medium" data-annotation="none"></div></div></li>
</ul>
<a class="brand" href="./"><img src="../resources/logo.png"> OpenLayers 3 Examples</a>
</div>
</div>
</div>
@@ -30,6 +25,10 @@
<div class="row-fluid">
<div class="span12">
<div id="map" class="map"></div>
<div id="no-download" class="alert alert-error" style="display: none">
This example requires a browser that supports the
<a href="http://caniuse.com/#feat=download">link download</a> attribute.
</div>
<a id="export-jpeg" class="btn" download="map.jpeg"><i class="icon-download"></i> Export JPEG</a>
<a id="export-png" class="btn" download="map.png"><i class="icon-download"></i> Export PNG</a>
</div>
@@ -37,7 +36,7 @@
<div class="row-fluid">
<div class="span4">
<div class="span12">
<h4 id="title">Export map example</h4>
<p id="shortdesc">Example of exporting a map as a JPEG or PNG image.</p>
<div id="docs">
@@ -51,7 +50,7 @@
</div>
<script src="loader.js?id=export-map" type="text/javascript"></script>
<script src="../resources/social-links.js" type="text/javascript"></script>
<script src="../resources/example-behaviour.js" type="text/javascript"></script>
</body>
</html>

View File

@@ -1,13 +1,13 @@
goog.require('ol.Map');
goog.require('ol.RendererHint');
goog.require('ol.View2D');
goog.require('ol.layer.TileLayer');
goog.require('ol.layer.Tile');
goog.require('ol.source.OSM');
var map = new ol.Map({
layers: [
new ol.layer.TileLayer({
new ol.layer.Tile({
source: new ol.source.OSM()
})
],
@@ -20,11 +20,20 @@ var map = new ol.Map({
});
var exportJPEGElement = document.getElementById('export-jpeg');
exportJPEGElement.addEventListener('click', function(e) {
e.target.href = map.getRenderer().getCanvas().toDataURL('image/jpeg');
}, false);
var exportPNGElement = document.getElementById('export-png');
exportPNGElement.addEventListener('click', function(e) {
e.target.href = map.getRenderer().getCanvas().toDataURL('image/png');
}, false);
if ('download' in exportJPEGElement && 'download' in exportPNGElement) {
exportJPEGElement.addEventListener('click', function(e) {
e.target.href = map.getRenderer().getCanvas().toDataURL('image/jpeg');
}, false);
exportPNGElement.addEventListener('click', function(e) {
e.target.href = map.getRenderer().getCanvas().toDataURL('image/png');
}, false);
} else {
var info = document.getElementById('no-download');
/**
* display error message
*/
info.style.display = '';
}

View File

@@ -4,6 +4,7 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<link rel="stylesheet" href="../css/ol.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
@@ -25,13 +26,7 @@
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="./">OpenLayers 3 Examples</a>
<ul class="nav pull-right">
<li><iframe class="github-watch-button" src="http://ghbtns.com/github-btn.html?user=openlayers&repo=ol3&type=watch&count=true"
allowtransparency="true" frameborder="0" scrolling="0" height="20" width="90"></iframe></li>
<li><a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-hashtags="openlayers">&nbsp;</a></li>
<li><div class="g-plusone-wrapper"><div class="g-plusone" data-size="medium" data-annotation="none"></div></div></li>
</ul>
<a class="brand" href="./"><img src="../resources/logo.png"> OpenLayers 3 Examples</a>
</div>
</div>
</div>
@@ -46,7 +41,7 @@
<div class="row-fluid">
<div class="span4">
<div class="span12">
<h4 id="title">Full screen drag rotate and zoom example</h4>
<p id="shortdesc">Example of drag rotate and zoom control with full screen effect.</p>
<div id="docs">
@@ -62,7 +57,7 @@
</div>
<script src="loader.js?id=full-screen-drag-rotate-and-zoom" type="text/javascript"></script>
<script src="../resources/social-links.js" type="text/javascript"></script>
<script src="../resources/example-behaviour.js" type="text/javascript"></script>
</body>
</html>

View File

@@ -1,25 +1,25 @@
goog.require('ol.Map');
goog.require('ol.RendererHint');
goog.require('ol.View2D');
goog.require('ol.control');
goog.require('ol.control.FullScreen');
goog.require('ol.control.defaults');
goog.require('ol.interaction');
goog.require('ol.interaction.DragRotateAndZoom');
goog.require('ol.interaction.defaults');
goog.require('ol.layer.TileLayer');
goog.require('ol.layer.Tile');
goog.require('ol.source.BingMaps');
var map = new ol.Map({
controls: ol.control.defaults({}, [
controls: ol.control.defaults().extend([
new ol.control.FullScreen()
]),
interactions: ol.interaction.defaults({}, [
interactions: ol.interaction.defaults().extend([
new ol.interaction.DragRotateAndZoom()
]),
layers: [
new ol.layer.TileLayer({
new ol.layer.Tile({
source: new ol.source.BingMaps({
key: 'AlQLZ0-5yk301_ESrmNLma3LYxEKNSg7w-e_knuRfyYFtld-UFvXVs38NOulku3Q',
key: 'Ar33pRUvQOdESG8m_T15MUmNz__E1twPo42bFx9jvdDePhX0PNgAcEm44OVTS7tt',
style: 'Aerial'
})
})

View File

@@ -4,6 +4,7 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<link rel="stylesheet" href="../css/ol.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
@@ -25,13 +26,7 @@
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="./">OpenLayers 3 Examples</a>
<ul class="nav pull-right">
<li><iframe class="github-watch-button" src="http://ghbtns.com/github-btn.html?user=openlayers&repo=ol3&type=watch&count=true"
allowtransparency="true" frameborder="0" scrolling="0" height="20" width="90"></iframe></li>
<li><a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-hashtags="openlayers">&nbsp;</a></li>
<li><div class="g-plusone-wrapper"><div class="g-plusone" data-size="medium" data-annotation="none"></div></div></li>
</ul>
<a class="brand" href="./"><img src="../resources/logo.png"> OpenLayers 3 Examples</a>
</div>
</div>
</div>
@@ -46,7 +41,7 @@
<div class="row-fluid">
<div class="span4">
<div class="span12">
<h4 id="title">Full screen control example</h4>
<p id="shortdesc">Example of a full screen control.</p>
<div id="docs">
@@ -62,7 +57,7 @@
</div>
<script src="loader.js?id=full-screen" type="text/javascript"></script>
<script src="../resources/social-links.js" type="text/javascript"></script>
<script src="../resources/example-behaviour.js" type="text/javascript"></script>
</body>
</html>

View File

@@ -1,9 +1,9 @@
goog.require('ol.Map');
goog.require('ol.RendererHints');
goog.require('ol.View2D');
goog.require('ol.control');
goog.require('ol.control.FullScreen');
goog.require('ol.control.defaults');
goog.require('ol.layer.TileLayer');
goog.require('ol.layer.Tile');
goog.require('ol.source.BingMaps');
@@ -13,13 +13,13 @@ var view = new ol.View2D({
});
var map = new ol.Map({
controls: ol.control.defaults({}, [
controls: ol.control.defaults().extend([
new ol.control.FullScreen()
]),
layers: [
new ol.layer.TileLayer({
new ol.layer.Tile({
source: new ol.source.BingMaps({
key: 'AlQLZ0-5yk301_ESrmNLma3LYxEKNSg7w-e_knuRfyYFtld-UFvXVs38NOulku3Q',
key: 'Ar33pRUvQOdESG8m_T15MUmNz__E1twPo42bFx9jvdDePhX0PNgAcEm44OVTS7tt',
style: 'Aerial'
})
})

View File

@@ -4,6 +4,7 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<link rel="stylesheet" href="../css/ol.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
@@ -23,13 +24,7 @@
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="./">OpenLayers 3 Examples</a>
<ul class="nav pull-right">
<li><iframe class="github-watch-button" src="http://ghbtns.com/github-btn.html?user=openlayers&repo=ol3&type=watch&count=true"
allowtransparency="true" frameborder="0" scrolling="0" height="20" width="90"></iframe></li>
<li><a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-hashtags="openlayers">&nbsp;</a></li>
<li><div class="g-plusone-wrapper"><div class="g-plusone" data-size="medium" data-annotation="none"></div></div></li>
</ul>
<a class="brand" href="./"><img src="../resources/logo.png"> OpenLayers 3 Examples</a>
</div>
</div>
</div>
@@ -44,13 +39,21 @@
<div class="row-fluid">
<div class="span4">
<div class="span8">
<h4 id="title">Geolocation example</h4>
<label class="checkbox" for="track">
<input id="track" type="checkbox"/>track position
</label>
<p>position accuracy : <code id="accuracy"></code></p>
<p>altitude : <code id="altitude"></code></p>
<p>altitude accuracy : <code id="altitudeAccuracy"></code></p>
<p>heading : <code id="heading"></code></p>
<p>speed : <code id="speed"></code></p>
<p id="shortdesc">Example of a geolocation map.</p>
<div id="docs">
<p>See the <a href="geolocation.js" target="_blank">geolocation.js source</a> to see how this is done.</p>
</div>
<button id="locate"><i class="icon-screenshot"></i> locate</button>
<div id="tags">geolocation, openstreetmap</div>
</div>
<div class="span4 pull-right">
@@ -62,7 +65,7 @@
<script src="jquery.min.js" type="text/javascript"></script>
<script src="../resources/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="loader.js?id=geolocation" type="text/javascript"></script>
<script src="../resources/social-links.js" type="text/javascript"></script>
<script src="../resources/example-behaviour.js" type="text/javascript"></script>
</body>
</html>

View File

@@ -3,13 +3,14 @@ goog.require('ol.Map');
goog.require('ol.Overlay');
goog.require('ol.RendererHints');
goog.require('ol.View2D');
goog.require('ol.layer.TileLayer');
goog.require('ol.dom.Input');
goog.require('ol.layer.Tile');
goog.require('ol.source.OSM');
var map = new ol.Map({
layers: [
new ol.layer.TileLayer({
new ol.layer.Tile({
source: new ol.source.OSM()
})
],
@@ -24,10 +25,21 @@ var map = new ol.Map({
var geolocation = new ol.Geolocation();
geolocation.bindTo('projection', map.getView());
var track = new ol.dom.Input(document.getElementById('track'));
track.bindTo('checked', geolocation, 'tracking');
geolocation.on('change', function() {
$('#accuracy').text(geolocation.getAccuracy() + ' [m]');
$('#altitude').text(geolocation.getAltitude() + ' [m]');
$('#altitudeAccuracy').text(geolocation.getAltitudeAccuracy() + ' [m]');
$('#heading').text(geolocation.getHeading() + ' [rad]');
$('#speed').text(geolocation.getSpeed() + ' [m/s]');
});
var marker = new ol.Overlay({
map: map,
element: /** @type {Element} */ ($('<i/>').addClass('icon-flag').get(0))
});
map.addOverlay(marker);
// bind the marker position to the device location.
marker.bindTo('position', geolocation);
@@ -41,8 +53,3 @@ geolocation.on('error', function(error) {
info.innerHTML = error.message;
info.style.display = '';
});
$('#locate').click(function() {
geolocation.setTracking(true);
});

View File

@@ -0,0 +1,55 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<link rel="stylesheet" href="../css/ol.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
<title>Get feature info example</title>
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="./"><img src="../resources/logo.png"> OpenLayers 3 Examples</a>
</div>
</div>
</div>
<div class="container-fluid">
<div class="row-fluid">
<div class="span12">
<div id="map" class="map"></div>
</div>
</div>
<div class="row-fluid">
<div class="span4">
<h4 id="title">GetFeatureInfo example</h4>
<p id="shortdesc">Example of a WMS layer and a vector layer, both configured to provide feature information on click.</p>
<div id="docs">
<p>See the <a href="getfeatureinfo.js" target="_blank">getfeatureinfo.js source</a> to see how this is done.</p>
</div>
<div id="tags">getfeatureinfo</div>
</div>
<div class="span4 offset4">
<div id="info" class="alert alert-success">
&nbsp;
</div>
</div>
</div>
</div>
<script src="loader.js?id=getfeatureinfo" type="text/javascript"></script>
<script src="../resources/example-behaviour.js" type="text/javascript"></script>
</body>
</html>

View File

@@ -0,0 +1,56 @@
goog.require('ol.Map');
goog.require('ol.RendererHint');
goog.require('ol.View2D');
goog.require('ol.layer.Tile');
goog.require('ol.layer.Vector');
goog.require('ol.parser.GeoJSON');
goog.require('ol.source.TileWMS');
goog.require('ol.source.Vector');
goog.require('ol.style.Stroke');
goog.require('ol.style.Style');
var wms = new ol.layer.Tile({
source: new ol.source.TileWMS({
url: 'http://demo.opengeo.org/geoserver/wms',
params: {'LAYERS': 'ne:ne'}
})
});
var vector = new ol.layer.Vector({
source: new ol.source.Vector({
parser: new ol.parser.GeoJSON(),
url: 'data/countries.geojson'
}),
style: new ol.style.Style({
symbolizers: [
new ol.style.Stroke({
color: '#33cc66',
width: 2
})
]
}),
transformFeatureInfo: function(features) {
return features.length > 0 ?
features[0].getId() + ': ' + features[0].get('name') : '&nbsp;';
}
});
var map = new ol.Map({
layers: [wms, vector],
renderer: ol.RendererHint.CANVAS,
target: 'map',
view: new ol.View2D({
center: [0, 0],
zoom: 1
})
});
map.on('click', function(evt) {
map.getFeatureInfo({
pixel: evt.getPixel(),
success: function(featureInfoByLayer) {
document.getElementById('info').innerHTML = featureInfoByLayer.join('');
}
});
});

View File

@@ -4,6 +4,7 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<link rel="stylesheet" href="../css/ol.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
@@ -14,13 +15,7 @@
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="./">OpenLayers 3 Examples</a>
<ul class="nav pull-right">
<li><iframe class="github-watch-button" src="http://ghbtns.com/github-btn.html?user=openlayers&repo=ol3&type=watch&count=true"
allowtransparency="true" frameborder="0" scrolling="0" height="20" width="90"></iframe></li>
<li><a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-hashtags="openlayers">&nbsp;</a></li>
<li><div class="g-plusone-wrapper"><div class="g-plusone" data-size="medium" data-annotation="none"></div></div></li>
</ul>
<a class="brand" href="./"><img src="../resources/logo.png"> OpenLayers 3 Examples</a>
</div>
</div>
</div>
@@ -35,7 +30,7 @@
<div class="row-fluid">
<div class="span4">
<div class="span12">
<h4 id="title">GML example</h4>
<p id="shortdesc">Example of using the GML parser.</p>
<div id="docs">
@@ -49,7 +44,7 @@
</div>
<script src="loader.js?id=gml" type="text/javascript"></script>
<script src="../resources/social-links.js" type="text/javascript"></script>
<script src="../resources/example-behaviour.js" type="text/javascript"></script>
</body>
</html>

View File

@@ -1,33 +1,35 @@
goog.require('ol.Map');
goog.require('ol.RendererHint');
goog.require('ol.View2D');
goog.require('ol.layer.TileLayer');
goog.require('ol.layer.Tile');
goog.require('ol.layer.Vector');
goog.require('ol.parser.ogc.GML_v3');
goog.require('ol.proj');
goog.require('ol.source.MapQuestOpenAerial');
goog.require('ol.source.Vector');
goog.require('ol.style.Polygon');
goog.require('ol.style.Rule');
goog.require('ol.style.Fill');
goog.require('ol.style.Stroke');
goog.require('ol.style.Style');
var raster = new ol.layer.TileLayer({
var raster = new ol.layer.Tile({
source: new ol.source.MapQuestOpenAerial()
});
var vector = new ol.layer.Vector({
source: new ol.source.Vector({
projection: ol.proj.get('EPSG:4326')
parser: new ol.parser.ogc.GML_v3(),
url: 'data/gml/topp-states-wfs.xml'
}),
style: new ol.style.Style({rules: [
new ol.style.Rule({
symbolizers: [
new ol.style.Polygon({
strokeColor: '#bada55'
})
]
})
]})
style: new ol.style.Style({
symbolizers: [
new ol.style.Fill({
color: '#ffffff',
opacity: 0.25
}),
new ol.style.Stroke({
color: '#6666ff'
})
]
})
});
var map = new ol.Map({
@@ -35,26 +37,7 @@ var map = new ol.Map({
renderer: ol.RendererHint.CANVAS,
target: 'map',
view: new ol.View2D({
center: [-10997171.194994785, 5206335.565590534],
center: [-10997171, 4658434],
zoom: 4
})
});
var gml = new ol.parser.ogc.GML_v3({axisOrientation: 'neu'});
var url = 'data/gml/topp-states-wfs.xml';
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
/**
* onload handler for the XHR request.
*/
xhr.onload = function() {
if (xhr.status == 200) {
// this is silly to have to tell the layer the destination projection
var projection = map.getView().getProjection();
vector.parseFeatures(xhr.responseText, gml, projection);
}
};
xhr.send();

View File

@@ -4,6 +4,7 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<link rel="stylesheet" href="../css/ol.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
@@ -14,13 +15,7 @@
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="./">OpenLayers 3 Examples</a>
<ul class="nav pull-right">
<li><iframe class="github-watch-button" src="http://ghbtns.com/github-btn.html?user=openlayers&repo=ol3&type=watch&count=true"
allowtransparency="true" frameborder="0" scrolling="0" height="20" width="90"></iframe></li>
<li><a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-hashtags="openlayers">&nbsp;</a></li>
<li><div class="g-plusone-wrapper"><div class="g-plusone" data-size="medium" data-annotation="none"></div></div></li>
</ul>
<a class="brand" href="./"><img src="../resources/logo.png"> OpenLayers 3 Examples</a>
</div>
</div>
</div>
@@ -43,7 +38,7 @@
</div>
<div id="tags">GPX</div>
</div>
<div class="span4 pull-right">
<div class="span4 offset4">
<div id="info" class="alert alert-success">
&nbsp;
</div>
@@ -53,7 +48,7 @@
</div>
<script src="loader.js?id=gpx" type="text/javascript"></script>
<script src="../resources/social-links.js" type="text/javascript"></script>
<script src="../resources/example-behaviour.js" type="text/javascript"></script>
</body>
</html>

View File

@@ -1,28 +1,21 @@
goog.require('ol.Map');
goog.require('ol.RendererHint');
goog.require('ol.View2D');
goog.require('ol.layer.TileLayer');
goog.require('ol.layer.Tile');
goog.require('ol.layer.Vector');
goog.require('ol.parser.GPX');
goog.require('ol.proj');
goog.require('ol.source.OSM');
goog.require('ol.source.Vector');
var raster = new ol.layer.TileLayer({
var raster = new ol.layer.Tile({
source: new ol.source.OSM()
});
var vector = new ol.layer.Vector({
source: new ol.source.Vector({
projection: ol.proj.get('EPSG:4326')
}),
transformFeatureInfo: function(features) {
var info = [];
for (var i = 0, ii = features.length; i < ii; ++i) {
info.push(features[i].get('name') + ': ' + features[i].get('type'));
}
return info.join(', ');
}
parser: new ol.parser.GPX(),
url: 'data/gpx/yahoo.xml'
})
});
var map = new ol.Map({
@@ -36,30 +29,16 @@ var map = new ol.Map({
});
map.on(['click', 'mousemove'], function(evt) {
map.getFeatureInfo({
map.getFeatures({
pixel: evt.getPixel(),
layers: [vector],
success: function(featureInfo) {
document.getElementById('info').innerHTML = featureInfo[0] || '&nbsp;';
success: function(featuresByLayer) {
var features = featuresByLayer[0];
var info = [];
for (var i = 0, ii = features.length; i < ii; ++i) {
info.push(features[i].get('name') + ': ' + features[i].get('type'));
}
document.getElementById('info').innerHTML = info.join(', ') || '&nbsp;';
}
});
});
var gpx = new ol.parser.GPX();
var url = 'data/gpx/yahoo.xml';
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
/**
* onload handler for the XHR request.
*/
xhr.onload = function() {
if (xhr.status == 200) {
// this is silly to have to tell the layer the destination projection
var projection = map.getView().getProjection();
vector.parseFeatures(xhr.responseText, gpx, projection);
}
};
xhr.send();

View File

@@ -4,6 +4,7 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<link rel="stylesheet" href="../css/ol.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
@@ -22,13 +23,7 @@
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="./">OpenLayers 3 Examples</a>
<ul class="nav pull-right">
<li><iframe class="github-watch-button" src="http://ghbtns.com/github-btn.html?user=openlayers&repo=ol3&type=watch&count=true"
allowtransparency="true" frameborder="0" scrolling="0" height="20" width="90"></iframe></li>
<li><a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-hashtags="openlayers">&nbsp;</a></li>
<li><div class="g-plusone-wrapper"><div class="g-plusone" data-size="medium" data-annotation="none"></div></div></li>
</ul>
<a class="brand" href="./"><img src="../resources/logo.png"> OpenLayers 3 Examples</a>
</div>
</div>
</div>
@@ -38,6 +33,11 @@
<div class="row-fluid">
<div class="span12">
<div id="map" class="map"></div>
<div id="no-webgl" class="alert alert-error" style="display: none">
This example requires a browser that supports <a href="http://get.webgl.org/">WebGL</a>.
</div>
<div class="btn-group">
<button id="increase-hue"><i class="icon-plus"></i></button>
<button id="reset-hue">Hue</button>
@@ -53,7 +53,7 @@
<div class="row-fluid">
<div class="span4">
<div class="span12">
<h4 id="title">Hue/saturation example</h4>
<p id="shortdesc">Example of hue/saturation control on the client (WebGL only).</p>
<div id="docs">
@@ -67,7 +67,7 @@
</div>
<script src="loader.js?id=hue-saturation" type="text/javascript"></script>
<script src="../resources/social-links.js" type="text/javascript"></script>
<script src="../resources/example-behaviour.js" type="text/javascript"></script>
</body>
</html>

View File

@@ -1,69 +1,80 @@
goog.require('ol.Map');
goog.require('ol.RendererHint');
goog.require('ol.View2D');
goog.require('ol.layer.TileLayer');
goog.require('ol.layer.Tile');
goog.require('ol.proj');
goog.require('ol.source.BingMaps');
goog.require('ol.webgl');
var layer = new ol.layer.TileLayer({
source: new ol.source.BingMaps({
key: 'AlQLZ0-5yk301_ESrmNLma3LYxEKNSg7w-e_knuRfyYFtld-UFvXVs38NOulku3Q',
style: 'Aerial'
})
});
var map = new ol.Map({
layers: [layer],
renderer: ol.RendererHint.WEBGL,
target: 'map',
view: new ol.View2D({
center: ol.proj.transform([-9.375, 51.483333], 'EPSG:4326', 'EPSG:3857'),
zoom: 15
})
});
var increaseHue = document.getElementById('increase-hue');
var resetHue = document.getElementById('reset-hue');
var decreaseHue = document.getElementById('decrease-hue');
function setResetHueButtonHTML() {
resetHue.innerHTML = 'Hue (' + layer.getHue().toFixed(2) + ')';
}
setResetHueButtonHTML();
increaseHue.addEventListener('click', function() {
layer.setHue(layer.getHue() + 0.25);
setResetHueButtonHTML();
}, false);
resetHue.addEventListener('click', function() {
layer.setHue(0);
setResetHueButtonHTML();
}, false);
decreaseHue.addEventListener('click', function() {
layer.setHue(layer.getHue() - 0.25);
setResetHueButtonHTML();
}, false);
var increaseSaturation = document.getElementById('increase-saturation');
var resetSaturation = document.getElementById('reset-saturation');
var decreaseSaturation = document.getElementById('decrease-saturation');
function setResetSaturationButtonHTML() {
resetSaturation.innerHTML = 'Saturation (' +
layer.getSaturation().toFixed(2) + ')';
}
setResetSaturationButtonHTML();
increaseSaturation.addEventListener('click', function() {
layer.setSaturation(layer.getSaturation() + 0.25);
if (!ol.webgl.SUPPORTED) {
var info = document.getElementById('no-webgl');
/**
* display error message
*/
info.style.display = '';
} else {
var layer = new ol.layer.Tile({
source: new ol.source.BingMaps({
key: 'Ar33pRUvQOdESG8m_T15MUmNz__E1twPo42bFx9jvdDePhX0PNgAcEm44OVTS7tt',
style: 'Aerial'
})
});
var map = new ol.Map({
layers: [layer],
renderer: ol.RendererHint.WEBGL,
target: 'map',
view: new ol.View2D({
center: ol.proj.transform([-9.375, 51.483333], 'EPSG:4326', 'EPSG:3857'),
zoom: 15
})
});
var increaseHue = document.getElementById('increase-hue');
var resetHue = document.getElementById('reset-hue');
var decreaseHue = document.getElementById('decrease-hue');
setResetHueButtonHTML();
increaseHue.addEventListener('click', function() {
layer.setHue(layer.getHue() + 0.25);
setResetHueButtonHTML();
}, false);
resetHue.addEventListener('click', function() {
layer.setHue(0);
setResetHueButtonHTML();
}, false);
decreaseHue.addEventListener('click', function() {
layer.setHue(layer.getHue() - 0.25);
setResetHueButtonHTML();
}, false);
var increaseSaturation = document.getElementById('increase-saturation');
var resetSaturation = document.getElementById('reset-saturation');
var decreaseSaturation = document.getElementById('decrease-saturation');
setResetSaturationButtonHTML();
}, false);
resetSaturation.addEventListener('click', function() {
layer.setSaturation(1);
setResetSaturationButtonHTML();
}, false);
decreaseSaturation.addEventListener('click', function() {
layer.setSaturation(Math.max(layer.getSaturation() - 0.25, 0));
setResetSaturationButtonHTML();
}, false);
increaseSaturation.addEventListener('click', function() {
layer.setSaturation(layer.getSaturation() + 0.25);
setResetSaturationButtonHTML();
}, false);
resetSaturation.addEventListener('click', function() {
layer.setSaturation(1);
setResetSaturationButtonHTML();
}, false);
decreaseSaturation.addEventListener('click', function() {
layer.setSaturation(Math.max(layer.getSaturation() - 0.25, 0));
setResetSaturationButtonHTML();
}, false);
}

62
examples/icon.html Normal file
View File

@@ -0,0 +1,62 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<link rel="stylesheet" href="../css/ol.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
<title>Vector Icon Example</title>
<style>
#map {
position: relative;
}
#popup {
padding-bottom: 45px;
}
</style>
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="./"><img src="../resources/logo.png"> OpenLayers 3 Examples</a>
</div>
</div>
</div>
<div class="container-fluid">
<div class="row-fluid">
<div class="span12">
<div id="map" class="map">
<div id="popup"></div>
</div>
</div>
</div>
<div class="row-fluid">
<div class="span12">
<h4 id="title">Icon example</h4>
<p id="shortdesc">Example using an icon to symbolize a point.</p>
<div id="docs">
<p>See the <a href="icon.js" target="_blank">icon.js source</a> to see how this is done.</p>
</div>
<div id="tags">vector, style, icon, marker, popup</div>
</div>
</div>
</div>
<script src="jquery.min.js" type="text/javascript"></script>
<script src="../resources/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="loader.js?id=icon" type="text/javascript"></script>
<script src="../resources/example-behaviour.js" type="text/javascript"></script>
</body>
</html>

92
examples/icon.js Normal file
View File

@@ -0,0 +1,92 @@
goog.require('ol.Map');
goog.require('ol.Overlay');
goog.require('ol.RendererHint');
goog.require('ol.View2D');
goog.require('ol.layer.Tile');
goog.require('ol.layer.Vector');
goog.require('ol.parser.GeoJSON');
goog.require('ol.source.TileJSON');
goog.require('ol.source.Vector');
goog.require('ol.style.Icon');
goog.require('ol.style.Style');
var raster = new ol.layer.Tile({
source: new ol.source.TileJSON({
url: 'http://api.tiles.mapbox.com/v3/mapbox.geography-class.jsonp'
})
});
var data = {
type: 'FeatureCollection',
features: [{
type: 'Feature',
properties: {
name: 'Null Island',
population: 4000,
rainfall: 500
},
geometry: {
type: 'Point',
coordinates: [0, 0]
}
}]
};
var style = new ol.style.Style({
symbolizers: [
new ol.style.Icon({
url: 'data/icon.png',
yOffset: -22
})
]
});
var vector = new ol.layer.Vector({
source: new ol.source.Vector({
parser: new ol.parser.GeoJSON(),
data: data
}),
style: style
});
var map = new ol.Map({
layers: [raster, vector],
renderer: ol.RendererHint.CANVAS,
target: 'map',
view: new ol.View2D({
center: [0, 0],
zoom: 3
})
});
var element = document.getElementById('popup');
var popup = new ol.Overlay({
element: element
});
map.addOverlay(popup);
map.on('click', function(evt) {
map.getFeatures({
pixel: evt.getPixel(),
layers: [vector],
success: function(layerFeatures) {
var feature = layerFeatures[0][0];
if (feature) {
var geometry = feature.getGeometry();
var coord = geometry.getCoordinates();
popup.setPosition(coord);
$(element).popover({
'placement': 'top',
'html': true,
'content': feature.get('name')
});
$(element).popover('show');
} else {
$(element).popover('destroy');
}
}
});
});

View File

@@ -4,6 +4,7 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<link rel="stylesheet" href="../css/ol.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
@@ -19,6 +20,9 @@
.example:hover {
background-color: #ddd;
}
.navbar-search.pull-left {
padding: 5px;
}
::-webkit-scrollbar {
width: 8px;
@@ -174,17 +178,11 @@
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="./">OpenLayers 3 Examples</a>
<a class="brand" href="./"><img src="../resources/logo.png"> OpenLayers 3 Examples</a>
<form class="navbar-search pull-left">
<input name="q" type="text" id="keywords" class="search-query" placeholder="Search">
<span id="count"></span>
</form>
<ul class="nav pull-right">
<li><iframe class="github-watch-button" src="http://ghbtns.com/github-btn.html?user=openlayers&repo=ol3&type=watch&count=true"
allowtransparency="true" frameborder="0" scrolling="0" height="20" width="90"></iframe></li>
<li><a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-hashtags="openlayers">&nbsp;</a></li>
<li><div class="g-plusone-wrapper"><div class="g-plusone" data-size="medium" data-annotation="none"></div></div></li>
</ul>
</div>
</div>
</div>
@@ -208,8 +206,5 @@
</div>
</div>
<script src="../resources/social-links.js" type="text/javascript"></script>
</body>
</html>

View File

@@ -0,0 +1,75 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<link rel="stylesheet" href="../css/ol.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
<title>Earthquakes in KML</title>
<style>
#map {
position: relative;
}
#info {
position: absolute;
height: 1px;
width: 1px;
z-index: 100;
}
.tooltip.in {
opacity: 1;
filter: alpha(opacity=100);
}
.tooltip.top .tooltip-arrow {
border-top-color: white;
}
.tooltip-inner {
border: 2px solid white;
}
</style>
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="./"><img src="../resources/logo.png"> OpenLayers 3 Examples</a>
</div>
</div>
</div>
<div class="container-fluid">
<div class="row-fluid">
<div class="span12">
<div id="map" class="map"><div id="info"></div></div>
</div>
</div>
<div class="row-fluid">
<div class="span12">
<h4 id="title">Earthquakes in KML</h4>
<p id="shortdesc">Demonstrates the use of a Shape symbolizer to render earthquake locations.</p>
<div id="docs">
<p>
This example parses a KML file and renders the features as a vector layer. The layer is given a <code>ol.style.Style</code> that renders earthquake locations with a size relative to their magnitude. The style uses a <code>ol.style.Shape</code> symbolizer where the <code>size</code> comes from the <code>magnitude</code> attribute on the features.
</p>
<p>See the <a href="kml-earthquakes.js" target="_blank">kml-earthquakes.js source</a> to see how this is done.</p>
</div>
<div id="tags">KML, vector, style</div>
</div>
</div>
</div>
<script src="jquery.min.js" type="text/javascript"></script>
<script src="../resources/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="loader.js?id=kml-earthquakes" type="text/javascript"></script>
<script src="../resources/example-behaviour.js" type="text/javascript"></script>
</body>
</html>

View File

@@ -0,0 +1,83 @@
goog.require('ol.Map');
goog.require('ol.RendererHint');
goog.require('ol.View2D');
goog.require('ol.expr');
goog.require('ol.layer.Tile');
goog.require('ol.layer.Vector');
goog.require('ol.parser.KML');
goog.require('ol.source.Stamen');
goog.require('ol.source.Vector');
goog.require('ol.style.Fill');
goog.require('ol.style.Shape');
goog.require('ol.style.Stroke');
goog.require('ol.style.Style');
var style = new ol.style.Style({
symbolizers: [
new ol.style.Shape({
size: ol.expr.parse('5 + 20 * (magnitude - 5)'),
fill: new ol.style.Fill({
color: '#ff9900',
opacity: 0.4
}),
stroke: new ol.style.Stroke({
color: '#ffcc00',
opacity: 0.2
})
})
]
});
var vector = new ol.layer.Vector({
source: new ol.source.Vector({
parser: new ol.parser.KML({dimension: 2}),
url: 'data/kml/2012_Earthquakes_Mag5.kml'
}),
style: style
});
var raster = new ol.layer.Tile({
source: new ol.source.Stamen({
layer: 'toner'
})
});
var map = new ol.Map({
layers: [raster, vector],
renderer: ol.RendererHint.CANVAS,
target: 'map',
view: new ol.View2D({
center: [0, 0],
zoom: 2
})
});
var info = $('#info');
info.tooltip({
animation: false,
trigger: 'manual'
});
map.on(['click', 'mousemove'], function(evt) {
var pixel = evt.getPixel();
info.css({
left: pixel[0] + 'px',
top: (pixel[1] - 15) + 'px'
});
map.getFeatures({
pixel: pixel,
layers: [vector],
success: function(layerFeatures) {
var feature = layerFeatures[0][0];
if (feature) {
info.tooltip('hide')
.attr('data-original-title', feature.get('name'))
.tooltip('fixTitle')
.tooltip('show');
} else {
info.tooltip('hide');
}
}
});
});

View File

@@ -4,6 +4,7 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<link rel="stylesheet" href="../css/ol.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
@@ -25,13 +26,7 @@
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="./">OpenLayers 3 Examples</a>
<ul class="nav pull-right">
<li><iframe class="github-watch-button" src="http://ghbtns.com/github-btn.html?user=openlayers&repo=ol3&type=watch&count=true"
allowtransparency="true" frameborder="0" scrolling="0" height="20" width="90"></iframe></li>
<li><a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-hashtags="openlayers">&nbsp;</a></li>
<li><div class="g-plusone-wrapper"><div class="g-plusone" data-size="medium" data-annotation="none"></div></div></li>
</ul>
<a class="brand" href="./"><img src="../resources/logo.png"> OpenLayers 3 Examples</a>
</div>
</div>
</div>
@@ -46,7 +41,7 @@
<div class="row-fluid">
<div class="span4">
<div class="span12">
<h4 id="title">Timezones in KML</h4>
<p id="shortdesc">Demonstrates rendering timezones from KML.</p>
<div id="docs">
@@ -62,7 +57,7 @@
<script src="jquery.min.js" type="text/javascript"></script>
<script src="../resources/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="loader.js?id=kml-timezones" type="text/javascript"></script>
<script src="../resources/social-links.js" type="text/javascript"></script>
<script src="../resources/example-behaviour.js" type="text/javascript"></script>
</body>
</html>

View File

@@ -2,14 +2,13 @@ goog.require('ol.Map');
goog.require('ol.RendererHint');
goog.require('ol.View2D');
goog.require('ol.expr');
goog.require('ol.layer.TileLayer');
goog.require('ol.layer.Tile');
goog.require('ol.layer.Vector');
goog.require('ol.parser.KML');
goog.require('ol.proj');
goog.require('ol.source.Stamen');
goog.require('ol.source.Vector');
goog.require('ol.style.Polygon');
goog.require('ol.style.Rule');
goog.require('ol.style.Fill');
goog.require('ol.style.Stroke');
goog.require('ol.style.Style');
@@ -41,26 +40,27 @@ ol.expr.register('getOpacity', function() {
return 0.75 * (1 - delta / 12);
});
var style = new ol.style.Style({rules: [
new ol.style.Rule({
symbolizers: [
new ol.style.Polygon({
fillColor: '#ffff33',
strokeColor: '#ffffff',
opacity: ol.expr.parse('getOpacity()')
})
]
})
]});
var style = new ol.style.Style({
symbolizers: [
new ol.style.Fill({
color: '#ffff33',
opacity: ol.expr.parse('getOpacity()')
}),
new ol.style.Stroke({
color: '#ffffff'
})
]
});
var vector = new ol.layer.Vector({
source: new ol.source.Vector({
projection: ol.proj.get('EPSG:4326')
parser: new ol.parser.KML({dimension: 2}),
url: 'data/kml/timezones.kml'
}),
style: style
});
var raster = new ol.layer.TileLayer({
var raster = new ol.layer.Tile({
source: new ol.source.Stamen({
layer: 'toner'
})
@@ -103,21 +103,3 @@ map.on(['click', 'mousemove'], function(evt) {
}
});
});
var kml = new ol.parser.KML({dimension: 2});
var url = 'data/kml/timezones.kml';
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
/**
* onload handler for the XHR request.
*/
xhr.onload = function() {
if (xhr.status == 200) {
var projection = map.getView().getProjection();
vector.parseFeatures(xhr.responseText, kml, projection);
}
};
xhr.send();

View File

@@ -4,6 +4,7 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<link rel="stylesheet" href="../css/ol.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
@@ -14,13 +15,7 @@
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="./">OpenLayers 3 Examples</a>
<ul class="nav pull-right">
<li><iframe class="github-watch-button" src="http://ghbtns.com/github-btn.html?user=openlayers&repo=ol3&type=watch&count=true"
allowtransparency="true" frameborder="0" scrolling="0" height="20" width="90"></iframe></li>
<li><a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-hashtags="openlayers">&nbsp;</a></li>
<li><div class="g-plusone-wrapper"><div class="g-plusone" data-size="medium" data-annotation="none"></div></div></li>
</ul>
<a class="brand" href="./"><img src="../resources/logo.png"> OpenLayers 3 Examples</a>
</div>
</div>
</div>
@@ -43,7 +38,7 @@
</div>
<div id="tags">KML</div>
</div>
<div class="span4 pull-right">
<div class="span4 offset4">
<div id="info" class="alert alert-success">
&nbsp;
</div>
@@ -54,7 +49,7 @@
</div>
<script src="loader.js?id=kml" type="text/javascript"></script>
<script src="../resources/social-links.js" type="text/javascript"></script>
<script src="../resources/example-behaviour.js" type="text/javascript"></script>
</body>
</html>

View File

@@ -1,15 +1,14 @@
goog.require('ol.Map');
goog.require('ol.RendererHint');
goog.require('ol.View2D');
goog.require('ol.layer.TileLayer');
goog.require('ol.layer.Tile');
goog.require('ol.layer.Vector');
goog.require('ol.parser.KML');
goog.require('ol.proj');
goog.require('ol.source.TiledWMS');
goog.require('ol.source.TileWMS');
goog.require('ol.source.Vector');
var raster = new ol.layer.TileLayer({
source: new ol.source.TiledWMS({
var raster = new ol.layer.Tile({
source: new ol.source.TileWMS({
url: 'http://vmap0.tiles.osgeo.org/wms/vmap0',
crossOrigin: null,
params: {
@@ -20,19 +19,13 @@ var raster = new ol.layer.TileLayer({
})
});
var epsg4326 = ol.proj.get('EPSG:4326');
var vector = new ol.layer.Vector({
source: new ol.source.Vector({
projection: epsg4326
}),
transformFeatureInfo: function(features) {
var info = [];
for (var i = 0, ii = features.length; i < ii; ++i) {
info.push(features[i].get('name'));
}
return info.join(', ');
}
parser: new ol.parser.KML({
maxDepth: 1, dimension: 2, extractStyles: true, extractAttributes: true
}),
url: 'data/kml/lines.kml'
})
});
var map = new ol.Map({
@@ -40,37 +33,23 @@ var map = new ol.Map({
renderer: ol.RendererHint.CANVAS,
target: 'map',
view: new ol.View2D({
projection: epsg4326,
projection: 'EPSG:4326',
center: [-112.169, 36.099],
zoom: 11
})
});
var kml = new ol.parser.KML({
maxDepth: 1, dimension: 2, extractStyles: true, extractAttributes: true});
map.on(['click', 'mousemove'], function(evt) {
map.getFeatureInfo({
map.getFeatures({
pixel: evt.getPixel(),
layers: [vector],
success: function(featureInfo) {
document.getElementById('info').innerHTML = featureInfo[0] || '&nbsp';
success: function(featuresByLayer) {
var features = featuresByLayer[0];
var info = [];
for (var i = 0, ii = features.length; i < ii; ++i) {
info.push(features[i].get('name'));
}
document.getElementById('info').innerHTML = info.join(', ') || '&nbsp';
}
});
});
var url = 'data/kml/lines.kml';
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
/**
* onload handler for the XHR request.
*/
xhr.onload = function() {
if (xhr.status == 200) {
// this is silly to have to tell the layer the destination projection
vector.parseFeatures(xhr.responseText, kml, epsg4326);
}
};
xhr.send();

125
examples/layer-group.html Normal file
View File

@@ -0,0 +1,125 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
<style>
#layertree li > span {
cursor: pointer;
}
</style>
<title>Layer group example</title>
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="./"><img src="../resources/logo.png"> OpenLayers 3 Examples</a>
</div>
</div>
</div>
<div class="container-fluid">
<div class="row-fluid">
<div class="span6">
<div id="map" class="map"></div>
<h4 id="title">Layer group example</h4>
<p id="shortdesc">Example of a map with layer group.</p>
<div id="docs">
<p>See the <a href="layer-group.js" target="_blank">layer-group.js source</a> to see how this is done.</p>
</div>
<div id="tags">tilejson, input, bind, group, layergroup</div>
</div>
<div id="layertree" class="span6">
<h5>Click on layer nodes below to change their properties.</h5>
<ul>
<li><span>OpenAerial layer</span>
<fieldset id="layer0">
<label class="checkbox" for="visible0">
<input id="visible0" class="visible" type="checkbox"/>visibility
</label>
<label>opacity</label>
<input class="opacity" type="range" min="0" max="1" step="0.01"/>
<label>hue</label>
<input class="hue" type="range" min="-3.141592653589793" max="3.141592653589793" step="0.01"/>
<label>saturation</label>
<input class="saturation" type="range" min="0" max="5" step="0.01"/>
<label>contrast</label>
<input class="contrast" type="range" min="0" max="2" step="0.01"/>
<label>brightness</label>
<input class="brightness" type="range" min="-1" max="1" step="0.01"/>
</fieldset>
</li>
<li><span>Layer group</span>
<fieldset id="layer1">
<label class="checkbox" for="visible1">
<input id="visible1" class="visible" type="checkbox"/>visibility
</label>
<label>opacity</label>
<input class="opacity" type="range" min="0" max="1" step="0.01"/>
<label>hue</label>
<input class="hue" type="range" min="-3.141592653589793" max="3.141592653589793" step="0.01"/>
<label>saturation</label>
<input class="saturation" type="range" min="0" max="5" step="0.01"/>
<label>contrast</label>
<input class="contrast" type="range" min="0" max="2" step="0.01"/>
<label>brightness</label>
<input class="brightness" type="range" min="-1" max="1" step="0.01"/>
</fieldset>
<ul>
<li><span>Food insecurity layer</span>
<fieldset id="layer10">
<label class="checkbox" for="visible10">
<input id="visible10" class="visible" type="checkbox"/>visibility
</label>
<label>opacity</label>
<input class="opacity" type="range" min="0" max="1" step="0.01"/>
<label>hue</label>
<input class="hue" type="range" min="-3.141592653589793" max="3.141592653589793" step="0.01"/>
<label>saturation</label>
<input class="saturation" type="range" min="0" max="5" step="0.01"/>
<label>contrast</label>
<input class="contrast" type="range" min="0" max="2" step="0.01"/>
<label>brightness</label>
<input class="brightness" type="range" min="-1" max="1" step="0.01"/>
</fieldset>
</li>
<li><span>World borders layer</span>
<fieldset id="layer11">
<label class="checkbox" for="visible11">
<input id="visible11" class="visible" type="checkbox"/>visibility
</label>
<label>opacity</label>
<input class="opacity" type="range" min="0" max="1" step="0.01"/>
<label>hue</label>
<input class="hue" type="range" min="-3.141592653589793" max="3.141592653589793" step="0.01"/>
<label>saturation</label>
<input class="saturation" type="range" min="0" max="5" step="0.01"/>
<label>contrast</label>
<input class="contrast" type="range" min="0" max="2" step="0.01"/>
<label>brightness</label>
<input class="brightness" type="range" min="-1" max="1" step="0.01"/>
</fieldset>
</li>
</ul>
</li>
</ul>
</div>
</div>
<script src="jquery.min.js" type="text/javascript"></script>
<script src="loader.js?id=layer-group" type="text/javascript"></script>
<script src="../resources/example-behaviour.js" type="text/javascript"></script>
</body>
</html>

63
examples/layer-group.js Normal file
View File

@@ -0,0 +1,63 @@
goog.require('ol.Map');
goog.require('ol.RendererHints');
goog.require('ol.View2D');
goog.require('ol.dom.Input');
goog.require('ol.layer.Group');
goog.require('ol.layer.Tile');
goog.require('ol.proj');
goog.require('ol.source.MapQuestOpenAerial');
goog.require('ol.source.TileJSON');
var map = new ol.Map({
layers: [
new ol.layer.Tile({
source: new ol.source.MapQuestOpenAerial()
}), new ol.layer.Group({
layers: [
new ol.layer.Tile({
source: new ol.source.TileJSON({
url: 'http://api.tiles.mapbox.com/v3/' +
'mapbox.20110804-hoa-foodinsecurity-3month.jsonp',
crossOrigin: 'anonymous'
})
}),
new ol.layer.Tile({
source: new ol.source.TileJSON({
url: 'http://api.tiles.mapbox.com/v3/' +
'mapbox.world-borders-light.jsonp',
crossOrigin: 'anonymous'
})
})
]
})
],
renderers: ol.RendererHints.createFromQueryData(),
target: 'map',
view: new ol.View2D({
center: ol.proj.transform([37.40570, 8.81566], 'EPSG:4326', 'EPSG:3857'),
zoom: 4
})
});
function bindInputs(layerid, layer) {
new ol.dom.Input($(layerid + ' .visible')[0])
.bindTo('checked', layer, 'visible');
$.each(['opacity', 'hue', 'saturation', 'contrast', 'brightness'],
function(i, v) {
new ol.dom.Input($(layerid + ' .' + v)[0])
.bindTo('valueAsNumber', layer, v);
}
);
}
map.getLayers().forEach(function(layer, i) {
bindInputs('#layer' + i, layer);
if (layer instanceof ol.layer.Group) {
layer.getLayers().forEach(function(sublayer, j) {
bindInputs('#layer' + i + j, sublayer);
});
}
});
$('#layertree li > span').click(function() {
$(this).siblings('fieldset').toggle();
}).siblings('fieldset').hide();

View File

@@ -1,14 +1,14 @@
/**
* Loader to add the plovr generated script and ol.css to the document.
* Loader to add the plovr generated script to the document.
*
* The following default values may be overridden with query string
* parameters:
*
* * hostname - the current hostname (window.location.hostname)
* * port - 9810
* * mode - ADVANCED
* * mode - RAW
* * id - id param in loader.js query string; defaults to 'ol' if not set
*
* Usage:
@@ -20,7 +20,7 @@
var params = {
hostname: window.location.hostname,
port: '9810',
mode: 'ADVANCED',
mode: 'RAW',
id: 'ol'
};
if (window.location.protocol === 'file:' && !params.hostname) {
@@ -59,8 +59,6 @@
pairs.push(encodeURIComponent(key) + '=' + encodeURIComponent(params[key]));
}
document.write('<link rel="stylesheet" href="../css/ol.css" ' +
'type="text/css">');
var url = 'http://' + host + '/compile?' + pairs.join('&');
document.write('<script type="text/javascript" src="' + url + '"></script>');
}());

View File

@@ -4,6 +4,7 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<link rel="stylesheet" href="../css/ol.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
@@ -14,13 +15,7 @@
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="./">OpenLayers 3 Examples</a>
<ul class="nav pull-right">
<li><iframe class="github-watch-button" src="http://ghbtns.com/github-btn.html?user=openlayers&repo=ol3&type=watch&count=true"
allowtransparency="true" frameborder="0" scrolling="0" height="20" width="90"></iframe></li>
<li><a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-hashtags="openlayers">&nbsp;</a></li>
<li><div class="g-plusone-wrapper"><div class="g-plusone" data-size="medium" data-annotation="none"></div></div></li>
</ul>
<a class="brand" href="./"><img src="../resources/logo.png"> OpenLayers 3 Examples</a>
</div>
</div>
</div>
@@ -35,7 +30,7 @@
<div class="row-fluid">
<div class="span4">
<div class="span12">
<h4 id="title">Localized OpenStreetMap example</h4>
<p id="shortdesc">Example of a localized OpenStreetMap map with a custom tile server and a custom attribution.</p>
<div id="docs">
@@ -49,7 +44,7 @@
</div>
<script src="loader.js?id=localized-openstreetmap" type="text/javascript"></script>
<script src="../resources/social-links.js" type="text/javascript"></script>
<script src="../resources/example-behaviour.js" type="text/javascript"></script>
</body>
</html>

View File

@@ -2,18 +2,19 @@ goog.require('ol.Attribution');
goog.require('ol.Map');
goog.require('ol.RendererHints');
goog.require('ol.View2D');
goog.require('ol.layer.TileLayer');
goog.require('ol.layer.Tile');
goog.require('ol.source.OSM');
var map = new ol.Map({
layers: [
new ol.layer.TileLayer({
new ol.layer.Tile({
source: new ol.source.OSM({
attributions: [
new ol.Attribution(
'All maps &copy; ' +
'<a href="http://www.opencyclemap.org/">OpenCycleMap</a>'),
new ol.Attribution({
html: 'All maps &copy; ' +
'<a href="http://www.opencyclemap.org/">OpenCycleMap</a>'
}),
ol.source.OSM.DATA_ATTRIBUTION
],
url: 'http://{a-c}.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png'

View File

@@ -4,6 +4,7 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<link rel="stylesheet" href="../css/ol.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
@@ -14,13 +15,7 @@
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="./">OpenLayers 3 Examples</a>
<ul class="nav pull-right">
<li><iframe class="github-watch-button" src="http://ghbtns.com/github-btn.html?user=openlayers&repo=ol3&type=watch&count=true"
allowtransparency="true" frameborder="0" scrolling="0" height="20" width="90"></iframe></li>
<li><a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-hashtags="openlayers">&nbsp;</a></li>
<li><div class="g-plusone-wrapper"><div class="g-plusone" data-size="medium" data-annotation="none"></div></div></li>
</ul>
<a class="brand" href="./"><img src="../resources/logo.png"> OpenLayers 3 Examples</a>
</div>
</div>
</div>
@@ -35,7 +30,7 @@
<div class="row-fluid">
<div class="span4">
<div class="span12">
<h4 id="title">MapQuest example</h4>
<p id="shortdesc">Example of a MapQuest map.</p>
<div id="docs">
@@ -49,7 +44,7 @@
</div>
<script src="loader.js?id=mapquest" type="text/javascript"></script>
<script src="../resources/social-links.js" type="text/javascript"></script>
<script src="../resources/example-behaviour.js" type="text/javascript"></script>
</body>
</html>

View File

@@ -1,14 +1,14 @@
goog.require('ol.Map');
goog.require('ol.RendererHints');
goog.require('ol.View2D');
goog.require('ol.layer.TileLayer');
goog.require('ol.layer.Tile');
goog.require('ol.proj');
goog.require('ol.source.MapQuestOSM');
var map = new ol.Map({
layers: [
new ol.layer.TileLayer({
new ol.layer.Tile({
source: new ol.source.MapQuestOSM()
})
],

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