Compare commits

...

696 Commits

Author SHA1 Message Date
É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
É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
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
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
Éric Lemoine
e29d0aa52c Merge pull request #841 from elemoine/fix-ign-example
Fix wmts-ign example when hosted (take 2)
2013-06-28 02:35:00 -07:00
Éric Lemoine
5d5a248344 ol.source.Source#setLogo is not exported 2013-06-28 11:33:02 +02:00
Éric Lemoine
09a50ad442 Merge pull request #838 from elemoine/fix-ign-example
Fix wmts-ign example when hosted
2013-06-28 02:10:17 -07:00
Éric Lemoine
1d6e428e8f ol.source.Source#setAttributions is not exported 2013-06-28 00:10:27 +02: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
Tim Schaub
cd14753495 Merge pull request #831 from tschaub/kml-example
Nicer KML example
2013-06-27 14:38:57 -07:00
Éric Lemoine
445f85b3e2 Merge pull request #801 from elemoine/ign
Add an IGN WMTS example
2013-06-27 14:19:48 -07:00
Tim Schaub
a2bc986785 Timezone offset in a tooltip 2013-06-27 14:51:04 -06:00
Éric Lemoine
2974c74f1a Export ol.tilegrid.TileGrid#getResolutions 2013-06-27 22:37:27 +02:00
Éric Lemoine
943bad6e17 Add an IGN WMTS example 2013-06-27 22:37:27 +02:00
Éric Lemoine
a19cb9ca64 Sort matrixIds by scaleDenominator
We cannot assume that the matrixIds are ordered in the matrixSet. For example, they're not ordered in http://wxs.ign.fr/cle/geoportail/wmts?SERVICE=WMTS&REQUEST=GetCapabilities.
2013-06-27 21:36:14 +02:00
Éric Lemoine
e6e98a6ca2 Fix WMTS requestEncoding 2013-06-27 21:36:14 +02:00
Tim Schaub
aab5c8472c Update example to use expression parsing 2013-06-27 10:17:40 -06:00
Tim Schaub
b7412552a5 Adding a prettier KML example 2013-06-27 10:17:40 -06:00
Tim Schaub
fa4d2d485d Merge pull request #829 from tschaub/kml
Parse MultiGeometry in KML
2013-06-27 06:35:50 -07: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
Frédéric Junod
07d790260c Merge pull request #690 from fredj/layer-options
ol.layer.Layer: default values
2013-06-27 04:35:02 -07:00
Tom Payne
d6f442bbee Merge pull request #820 from twpayne/use-view2dstate-in-interactions
Use view2DState in interactions
2013-06-27 04:06:05 -07:00
Tom Payne
f360dd86a0 Use view2DState in ol.interaction.TouchZoom 2013-06-27 12:25:52 +02:00
Tom Payne
dc9d7e857a Use view2DState in ol.interaction.TouchRotate 2013-06-27 12:25:52 +02:00
Tom Payne
e84c484677 Use view2DState in ol.interaction.TouchPan 2013-06-27 12:25:52 +02:00
Tom Payne
79e0c81301 Use view2DState in ol.interaction.DragRotate 2013-06-27 12:25:50 +02:00
Tom Payne
ec4110ee54 Use view2DState in ol.interaction.DragRotateAndZoom 2013-06-27 12:20:48 +02:00
Tom Payne
8565201c74 Use view2DState in ol.interaction.DragPan 2013-06-27 12:20:46 +02:00
Tom Payne
b555c52013 Use view2DState in ol.interaction.Drag 2013-06-27 12:19:16 +02:00
Tom Payne
a4e8e529c4 Make View2D-only comments more consistent 2013-06-27 12:19:15 +02:00
Tom Payne
d96ea1cb97 Don't invoke interactions if view is not defined 2013-06-27 12:19:15 +02:00
Tim Schaub
a7ca22dde0 Merge pull request #790 from tschaub/expression
Expression parsing
2013-06-26 16:40:08 -07:00
Tim Schaub
71153d26d1 Prefer if/else to switch 2013-06-26 17:01:27 -06:00
Tim Schaub
42aa94de21 KML MultiGeometry may contain other MultiGeometry
As demonstrated in the tests, a MultiGeometry may contain other MultiGeometry nodes.  We can support this with heterogenous GeometryCollection instances - though these are not currently rendered.
2013-06-26 12:31:08 -06:00
Tim Schaub
30d947521d The fromParts factories take geometry instances instead of coords
The MultiLineString case was correct here.  The MultiPoint and MultiPolygon cases should be using the constructor instead of the `fromParts` factories.
2013-06-26 12:23:19 -06:00
Tim Schaub
f06208920f Merge pull request #828 from tschaub/shortdesc
Minor edits to shortdesc in examples
2013-06-26 10:59:58 -07:00
Éric Lemoine
16e23a33fb Merge pull request #823 from elemoine/tilegridbug
Tile has a child if z < maxZoom
2013-06-26 10:10:38 -07:00
Tim Schaub
0958674765 Shortdesc edits 2013-06-26 10:57:36 -06:00
Tim Schaub
e0a3f8ca07 Removing markup from shortdesc element (see #827)
The text in `shortdesc` is shown on the example index page.  It shouldn't have any markup in it.
2013-06-26 10:28:15 -06:00
Frédéric Junod
3800676e97 Merge pull request #812 from fredj/812
INTERACTION view hint ever growing on pinch zoom
2013-06-26 06:42:25 -07:00
Frederic Junod
87dda95b18 Handle ol.ViewHint.INTERACTING in ol.interaction.Touch 2013-06-26 09:27:44 +02:00
Frederic Junod
ae7b342ee9 Handle ol.ViewHint.INTERACTING in ol.interaction.Drag 2013-06-26 09:27:44 +02:00
Éric Lemoine
020d528e73 Tile has a child if z < maxZoom 2013-06-26 07:18:59 +02:00
Tim Schaub
4ccff4e8b6 Merge pull request #817 from tschaub/vector-exports
Proper vector exports to get vector examples working
2013-06-25 18:17:37 -07:00
Tim Schaub
3dc8c4bc7b Properly exporting the transformFeatureInfo option
This was previously called getTransformFeatureInfo, which is a method instead of an option.  In addition, the generate-exports.py script does not properly export properties whose names appear on a different line than the @property annotation.  This makes the vector-layer.html, kml.html, and gpx.html examples work with the built lib.
2013-06-25 13:21:13 -06:00
Tim Schaub
72532b7dd6 Export individual geometry types
This makes the style-rules.html example work with built lib.
2013-06-25 13:21:13 -06:00
Tim Schaub
34acea5366 Merge pull request #821 from tschaub/generated-file-linting
Create separate target for linting generated files
2013-06-25 12:20:45 -07:00
Tim Schaub
4e5ef05e5e Expression for evaluating feature ids 2013-06-25 12:15:34 -06:00
Tim Schaub
1eaf82ead5 Enum for checking built-in lib functions internally 2013-06-25 12:15:34 -06:00
Tim Schaub
70fef73869 Testing operator precedence 2013-06-25 12:15:34 -06:00
Tim Schaub
c81057780a More tests for binary operators 2013-06-25 12:15:34 -06:00
Tim Schaub
1f23a245e4 More tests for unary expression 2013-06-25 12:15:34 -06:00
Tim Schaub
2577d3f7d6 Rename ol.expression to ol.expr 2013-06-25 12:15:34 -06:00
Tim Schaub
9928730bd3 Tests for ol.expression.register() 2013-06-25 12:15:33 -06:00
Tim Schaub
233595ac75 Allow registration of custom functions for expressions 2013-06-25 12:15:33 -06:00
Tim Schaub
8e8b26805f Uniformly support evaluating symbolizers without features
In combination with a (not yet implemented) `Symbolizer#isLiteral` method, calling `Symbolizer#evaluate` without a feature is the fast track for rendering batches of like-styled features.  This change also simplifies the handling of undefined symbolizer literal properties (where stroke or fill properties are optional).
2013-06-25 12:15:33 -06:00
Tim Schaub
cab983f826 We are guarnteed that all TextLiteral properties are defined (see #770)
Instead of using the browser defaults, we use `ol.style.TextDefaults`.
2013-06-25 12:15:33 -06:00
Tim Schaub
c7da7e4c2e Using new expressions in text symbolizer 2013-06-25 12:15:33 -06:00
Tim Schaub
b04a36ede7 Replace use of filter with expressions
The canvas vector layer still has the (API candidate) `getFeatures` method that accepts an arbitrary expression (was filter).  This, and the `getFeaturesObject` method under it are only used in the tests.  The rendering code that was using filters is now calling `layer.getFeaturesObjectForExtent` with an explicit extent and optional geometry type.
2013-06-25 12:15:33 -06:00
Tim Schaub
a663d8fcae Accept an expression string for rule filter 2013-06-25 12:11:50 -06:00
Tim Schaub
38b784d672 Support +/- unary operators for literals 2013-06-25 12:11:50 -06:00
Tim Schaub
d70a9eba01 Lib for well-known functions
This reveals a lexer bug that needs addressing.
2013-06-25 12:11:50 -06:00
Tim Schaub
bd5d9d572e Lint 2013-06-25 12:11:50 -06:00
Tim Schaub
5e309e244b Using ol.expression.parse 2013-06-25 12:11:50 -06:00
Tim Schaub
53abedaada Correct doc and arg order 2013-06-25 12:11:50 -06:00
Tim Schaub
72d32ec71a Correct index for tokens 2013-06-25 12:11:50 -06:00
Tim Schaub
f0567f5053 Expect the unexpected 2013-06-25 12:11:49 -06:00
Tim Schaub
36d10bef11 Custom error for unexpected token
This makes it clearer to the compiler where we are throwing.
2013-06-25 12:11:49 -06:00
Tim Schaub
62eb0dd72b Give token an index and throw unexpected token from a common place 2013-06-25 12:11:49 -06:00
Tim Schaub
bb1b0cba95 Getter for not expression argument 2013-06-25 12:11:49 -06:00
Tim Schaub
c05fb8c61b Getters for member expression properties 2013-06-25 12:11:49 -06:00
Tim Schaub
2528581642 Getters for math expression properties 2013-06-25 12:11:49 -06:00
Tim Schaub
4a617871da Getters for logical expression properties 2013-06-25 12:11:49 -06:00
Tim Schaub
3de330eb99 Getter for literal expression value 2013-06-25 12:11:49 -06:00
Tim Schaub
6d6ec357e1 Getter for identifier expression name 2013-06-25 12:11:48 -06:00
Tim Schaub
582a52849c Getters for comparison expression properties 2013-06-25 12:11:48 -06:00
Tim Schaub
be636d7f46 Getters for call expression properties 2013-06-25 12:11:48 -06:00
Tim Schaub
6458f98996 Describing the extent of support for ES-5 expressions 2013-06-25 12:11:48 -06:00
Tim Schaub
2fd8f4cb00 Integration testing for binary logical operators 2013-06-25 12:11:48 -06:00
Tim Schaub
973606e67a Integration tests for equality operators 2013-06-25 12:11:48 -06:00
Tim Schaub
d5e133b7d8 Satisfy the build/check-requires-timestamp task (see #785)
I think this line should not be required, as `ol.expression.Char` is only used internally in this file.
2013-06-25 12:11:48 -06:00
Tim Schaub
3a3f9bc20b Integration testing for relational operators
No `instanceof` or `in` operator support.
2013-06-25 12:11:47 -06:00
Tim Schaub
9d5424236c Integration testing for additive operators 2013-06-25 12:11:47 -06:00
Tim Schaub
7c2550fefa Integration testing for multiplicative operators 2013-06-25 12:11:47 -06:00
Tim Schaub
2492515e8f Integration testing for unary operators
Only supporting ! at the moment.
2013-06-25 12:11:47 -06:00
Tim Schaub
e6f03c8f22 Confirm whitespace is consumed as expected 2013-06-25 12:11:47 -06:00
Tim Schaub
26a7d907a2 Test unary expression parsing 2013-06-25 12:11:47 -06:00
Tim Schaub
a0bd736948 Left-hand-side expression parsing 2013-06-25 12:11:47 -06:00
Tim Schaub
803b3a3f7d Binary expression parsing 2013-06-25 12:11:46 -06:00
Tim Schaub
40b12410f0 Increment after scanning >= and <= (and expect EOF in tests) 2013-06-25 12:11:46 -06:00
Tim Schaub
379ac82688 Test argument parsing 2013-06-25 12:11:46 -06:00
Tim Schaub
38c8927ae2 Doc and method reorg 2013-06-25 12:11:46 -06:00
Tim Schaub
6d0badcf2a Optional scope (works for expressions without identifiers) 2013-06-25 12:11:46 -06:00
Tim Schaub
d920d8e578 Test left-hand-side expression parsing 2013-06-25 12:11:46 -06:00
Tim Schaub
13d0b8b084 Provide ol.expression.parse method
This is the only method needed in the API.
2013-06-25 12:11:46 -06:00
Tim Schaub
3643ea164f Cast boolean and null before creating literal expression 2013-06-25 12:11:46 -06:00
Tim Schaub
ce67aa2617 Make way for convenience functions in ol.expression package 2013-06-25 12:11:45 -06:00
Tim Schaub
737d669e4a Correct types 2013-06-25 12:11:45 -06:00
Tim Schaub
7a1e69e288 Initial parsing tests 2013-06-25 12:11:45 -06:00
Tim Schaub
cb9725bdfb Provide static method to check for valid operators 2013-06-25 12:11:45 -06:00
Tim Schaub
29b77a2dac Member expressions 2013-06-25 12:11:45 -06:00
Tim Schaub
fbb028e15e Call expressions 2013-06-25 12:11:45 -06:00
Tim Schaub
2f7e74ab35 Create binary expressions when parsing 2013-06-25 12:11:45 -06:00
Tim Schaub
f050546fe2 Logical expressions 2013-06-25 12:11:44 -06:00
Tim Schaub
153df45f95 Math expressions
Just simple binary type expressions supported here.  These can be serialized in a variety of formats.  More complex operations to be supported by call expressions.
2013-06-25 12:11:44 -06:00
Tim Schaub
b2ff793ea1 Comparison expressions 2013-06-25 12:11:44 -06:00
Tim Schaub
c4867bafec Smaller subset of binary operators 2013-06-25 12:11:44 -06:00
Tim Schaub
7800e9b0cc Comments, links, copyrights 2013-06-25 12:11:44 -06:00
Tim Schaub
052b973b39 Reduce to a single literal 2013-06-25 12:11:44 -06:00
Tim Schaub
20b66fc447 Proper specs 2013-06-25 12:11:43 -06:00
Tim Schaub
0abcbb9854 Stray not 2013-06-25 12:11:43 -06:00
Tim Schaub
ed2e21dffa Parsing 2013-06-25 12:11:43 -06:00
Tim Schaub
1f68522837 Utility methods on the lexer 2013-06-25 12:11:43 -06:00
Tim Schaub
a87ebfe97b Specific expression types 2013-06-25 12:11:43 -06:00
Tim Schaub
d7e0d043f3 Consistently number 2013-06-25 12:11:43 -06:00
Tim Schaub
063b461ffd Fewer calls to charCodeAt 2013-06-25 12:11:43 -06:00
Tim Schaub
9edc9ebcc5 Use next instead 2013-06-25 12:11:42 -06:00
Tim Schaub
f272350e00 Expose next and peek methods 2013-06-25 12:11:42 -06:00
Tim Schaub
5baa38b82c Test punctuator scanning 2013-06-25 12:11:42 -06:00
Tim Schaub
957b6db3d7 Skip whitespace 2013-06-25 12:11:42 -06:00
Tim Schaub
50f94911b1 Scan string literals 2013-06-25 12:11:42 -06:00
Tim Schaub
4d62cea700 Escape sequences in our identifiers have already been handled 2013-06-25 12:11:42 -06:00
Tim Schaub
0844df8cc2 Scanning identifiers
This includes code that is likely not necessary.  The escape sequence scanning will likely not be used in our case, but I'm committing it here so it can be brought back if needed later.
2013-06-25 12:11:42 -06:00
Tim Schaub
a748665646 Space and comment 2013-06-25 12:11:42 -06:00
Tim Schaub
040c80a5ad Expectations about token type 2013-06-25 12:11:42 -06:00
Tim Schaub
193cf4de50 Scan numeric literals 2013-06-25 12:11:41 -06:00
Tim Schaub
81b344715a Renaming for clarity 2013-06-25 12:11:41 -06:00
Tim Schaub
a5343161bf Separate lexer 2013-06-25 12:11:41 -06:00
Tim Schaub
84a9fb40ef More char code tests 2013-06-25 12:11:41 -06:00
Tim Schaub
88fd0fda64 Initial bits for parser 2013-06-25 12:11:41 -06:00
Tim Schaub
48130670ca Create separate target for linting generated files
This allows us to ignore specific error codes (e.g. LINE_TOO_LONG) for externs, exports, types, etc. (any auto-generated files).
2013-06-25 10:43:27 -06:00
Tom Payne
ca3e1f0843 Merge pull request #819 from twpayne/fix-819
Drag rotate and zoom example is broken
2013-06-25 08:07:03 -07:00
Tim Schaub
40b10c13dc Merge pull request #802 from tschaub/802-multilinstring-typo
Multiline strings are not rendered correctly due to typo in VectorLayer
2013-06-25 07:33:08 -07:00
Tom Payne
23e54e4543 Stop other interactions when dragging 2013-06-25 15:46:00 +02:00
Tom Payne
38893eaf8c Merge pull request #818 from twpayne/view2d-properties
View2D properties
2013-06-25 04:50:30 -07:00
Frederic Junod
cd13e700ac Pass options to the base class 2013-06-25 13:13:41 +02:00
Tom Payne
fab12b10c1 Handle projection being undefined in getView2DState 2013-06-25 12:26:35 +02:00
Tom Payne
f462adbe53 Set default View2D rotation in constructor and getView2DState instead of in getRotation 2013-06-25 12:19:30 +02:00
Tom Payne
e5d6ccd6ba Use getView2DState instead of getResolution/getRotation in interactions 2013-06-25 12:18:31 +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
ahocevar
a427719a22 Merge pull request #816 from ahocevar/tilegrid-units
Use ol.Projection#getMetersPerUnit(). r=@tschaub
2013-06-24 16:05:56 -07:00
ahocevar
a14b21d80c Use ol.Projection#.getMetersPerUnit()
As a follow-up to #815, this change makes
ol.tilegrid.createForProjection work in cases where a Proj4
projection does not have units set. For better code readability,
a new variable is used when calculating the resolution.
2013-06-25 00:29:50 +02:00
Tim Schaub
d1eec80324 Merge pull request #815 from tschaub/override
Override for clarity
2013-06-24 14:38:26 -07:00
Tim Schaub
bb915cbf3d Less code
Since out meters per unit conversion table is a bit spare, prefer the configured conversion.
2013-06-24 12:27:36 -06:00
Tim Schaub
129e4d5704 Fix doc bug 2013-06-24 12:21:56 -06:00
Tim Schaub
5a95d606f8 Override for clarity 2013-06-24 12:20:34 -06:00
Tim Schaub
388967d00c Merge pull request #814 from tschaub/814-min-resolution
Fix vector rendering for projections that do not specify units
2013-06-24 11:08:50 -07:00
Tim Schaub
20527ab1f1 Reuse tile range 2013-06-24 11:34:59 -06:00
Tim Schaub
a9f01a4390 Use getMetersPer unit method 2013-06-24 11:34:48 -06:00
Tim Schaub
d10eff97a2 Allow getMetersPerUnit to work without units identifier (see #814) 2013-06-24 11:34:16 -06:00
Tim Schaub
3f169b1751 Merge pull request #810 from tschaub/async-tests
Proper async testing
2013-06-24 09:02:47 -07:00
ahocevar
f697450523 Merge pull request #811 from ahocevar/conditional-click
Click handler called with empty event object on Android. r=@fredj
2013-06-24 03:09:48 -07:00
ahocevar
a405279f34 Click handler called with empty event object on Android
On Android (both native browser and Chrome), the handleTouchEnd_
method is sometimes reached in a state where this.down_ is null.
This check protects against this.click_ being called without
an event object. To see this issue, open any example in Android,
and tap the zoom + or - button.
2013-06-24 10:35:02 +02:00
ahocevar
b30dcdd35a Merge pull request #799 from ahocevar/dynamic-canvas-tilegrid
Do not use a fixed tile grid for vector rendering. r=@elemoine,@tschaub,@twpayne
2013-06-23 11:15:50 -07:00
Tim Schaub
d6be28a7bb Get rid of unnecessary waitsFor function
This was a relic from the Jasmine tests.  Mocha tests have a built-in timeout.  Async tests are registered with a function that takes a callback.
2013-06-23 11:20:57 -06:00
Tim Schaub
7a620de1bf Calling callback in WMS capabilities tests 2013-06-23 11:08:34 -06:00
Tim Schaub
be33fd58b3 Calling callback in GML v3 tests 2013-06-23 11:04:03 -06:00
Tim Schaub
54378f394a Calling callback in GML v2 tests 2013-06-23 11:02:38 -06:00
Tim Schaub
7bf24eb918 Calling callback in kml tests
Also reordering things so we have `expect(got).to.xmleql(expected)`.
2013-06-23 11:00:41 -06:00
ahocevar
5cc3e189eb Need to take units into account 2013-06-23 18:48:21 +02:00
ahocevar
af0764b1ca Simpler tile coord access now that we only have one resolution 2013-06-23 18:47:49 +02:00
ahocevar
27c23f676b Fixing requires 2013-06-23 18:47:00 +02:00
ahocevar
1c5f466e61 Adding comment about MIN_RESOLUTION 2013-06-23 18:31:25 +02:00
ahocevar
61fcbd560e Do not render tiles during animation and interaction 2013-06-23 18:31:25 +02:00
ahocevar
f20e6002cc Tile grid and cache for one resolution only 2013-06-23 18:31:25 +02:00
ahocevar
89c23b5560 Use binaryInsert instead of sort 2013-06-23 18:31:25 +02:00
ahocevar
aa62764d90 Do not add resolutions while interacting 2013-06-23 18:31:25 +02:00
ahocevar
0aacf197bf Separate method for updating the tile cache 2013-06-23 18:31:24 +02:00
ahocevar
3afd8b4242 Do not use a fixed tile grid for vector rendering
Instead, we create a new tile grid whenever renderFrame is
called, no animation is active, and the resolution is not in the
tile grid already. This gives better rendering results because
we get vector tiles at native resolutions.
2013-06-23 18:30:57 +02:00
ahocevar
1826b7a9be Merge pull request #808 from ahocevar/no-empty-tiles
Don't render/cache tiles with no features. r=@tschaub
2013-06-23 09:11:55 -07:00
ahocevar
3fc4fc3eb8 Only render and cache tiles that have features 2013-06-23 15:52:31 +02:00
Frédéric Junod
8fe0027d98 Merge pull request #805 from fredj/cleanup
ol.Geolocation and ol.DeviceOrientation cleanup
2013-06-21 08:07:03 -07:00
Frédéric Junod
2a7b9381bc Merge pull request #807 from fredj/mouse-position
Don't attempt to display the mouse position if the frameState is null
2013-06-21 04:51:57 -07:00
Frederic Junod
23f09937bc Don't attempt to display the mouse position if the frameState is null 2013-06-21 12:27:39 +02:00
Éric Lemoine
04344ed184 Merge pull request #762 from elemoine/controls
Add addControl and removeControl methods to the map
2013-06-21 00:53:12 -07:00
Frederic Junod
9cac8a92df Set default 'tracking' property to false 2013-06-21 09:21:48 +02:00
Frederic Junod
c4ce85c847 Add missing 'undefined' in type cast 2013-06-21 09:14:41 +02:00
Frédéric Junod
f83fe424fb Merge pull request #800 from fredj/control_object
Make ol.control.Control extends ol.Object
2013-06-20 22:44:10 -07:00
Tim Schaub
91a8703852 Correct typo in geometry type (thanks @jystic)
Previously read 'multilinstring' instead of 'multilinestring'.  Letting the compiler check for typos instead now.
2013-06-20 17:57:29 -06:00
Tom Payne
b7a1ada94d Merge pull request #798 from twpayne/fix-layer-setters
Don't attempt to constrain values in setters
2013-06-20 09:52:40 -07:00
Frederic Junod
4217c5e47a Meaningful variable names 2013-06-20 16:56:59 +02:00
Frederic Junod
22adf354e2 Add 'projection' and 'coordinateFormat' to ol.control.MousePosition 2013-06-20 16:50:43 +02:00
Éric Lemoine
b0dde2ecb4 Do not call setMap(null) if control not in map 2013-06-20 16:47:23 +02:00
ahocevar
10f03a360c Merge pull request #770 from ahocevar/text-symbolizer
Basic support for text symbolizers. r=@bartvde,@tschaub
2013-06-20 07:06:38 -07:00
ahocevar
d250f4449c Updating example to use new properties 2013-06-20 15:24:54 +02:00
ahocevar
ba87c2e5ab Adding TODOs 2013-06-20 15:02:12 +02:00
ahocevar
f316b79bcd Proper handling of defaults 2013-06-20 14:57:01 +02:00
Éric Lemoine
be86b83b67 Add addControl and removeControl methods to ol.Map 2013-06-20 14:51:10 +02:00
Frederic Junod
9d63217778 Add 'units' property to ol.control.ScaleLine 2013-06-20 14:50:32 +02:00
Éric Lemoine
b85520f504 The map now has a collection of controls 2013-06-20 14:39:20 +02:00
Tom Payne
11cfcda37c Stop buttons from moving so much when changing values 2013-06-20 05:41:39 +02:00
Tom Payne
61f89bab6e Prevent buttons from setting out-of-range brightness/contrast/saturation values 2013-06-20 05:41:39 +02:00
ahocevar
9e3ca1c13c Changing renderLabels_ method name to renderText_ 2013-06-19 22:14:52 +02:00
ahocevar
cb9f4972df Use 'text' instead of 'name' for the label text 2013-06-19 22:10:44 +02:00
ahocevar
7353e05a90 Fixing merge errors from unmerging #404 2013-06-19 22:01:51 +02:00
ahocevar
c17424deec Basic support for text symbolizers
This adds basic label rendering for points and polygons to the
canvas renderer, and a text symbolizer to the style package.
2013-06-19 22:01:51 +02:00
Frederic Junod
cbf0402471 Make ol.control.Control extends ol.Object 2013-06-19 16:43:59 +02:00
Tom Payne
aa1a71ed96 Don't attempt to constrain values in setters 2013-06-19 13:38:57 +02:00
Frédéric Junod
79980bc7be Merge pull request #795 from fredj/pan_actionbutton
Right click pan
2013-06-18 22:18:57 -07:00
Tim Schaub
56c2b85fce Merge pull request #796 from tschaub/geojson-rename
Use .geojson extension for GeoJSON
2013-06-18 15:54:47 -07:00
Tim Schaub
2ee0805075 Taking advantage of GitHub's rendering of .geojson 2013-06-18 15:39:45 -06:00
Frederic Junod
6adedacaf8 Only pan the map when the mouse action button is pressed 2013-06-18 16:53:03 +02:00
Tom Payne
bf9b0b4dd2 Merge pull request #779 from twpayne/ch-projection
Add native support for Swiss projections
2013-06-18 06:36:29 -07:00
Frédéric Junod
81a167ef01 Merge pull request #791 from fredj/mapbrowserevent
ol.MapBrowserEvent: call browserEvent.{preventDefault|stopPropagation}
2013-06-18 06:25:43 -07:00
Frédéric Junod
517b4b27d7 Merge pull request #688 from fredj/mouse-position
Add ol.control.MousePosition.setProjection
2013-06-18 06:04:08 -07:00
Frederic Junod
fd5f4f3dd8 API doc strings for preventDefault and stopPropagation
thanks @elemoine
2013-06-18 15:02:42 +02:00
Frederic Junod
bed44dd82c Add ol.MapBrowserEvent.stopOtherInteractions
When called, stops the interaction chain.
2013-06-18 13:02:17 +02:00
Frederic Junod
2bd87313cd ol.MapBrowserEvent: call browserEvent.{preventDefault|stopPropagation} 2013-06-18 11:31:44 +02:00
Frederic Junod
f99fd26386 Add ol.control.MousePosition.getProjection 2013-06-18 11:20:19 +02:00
Frederic Junod
916dde0045 Add ol.control.MousePosition.setProjection 2013-06-18 11:12:20 +02:00
ahocevar
4392feef1b Merge pull request #794 from ahocevar/simplify-ranges
Simplifying ranges structure by adding compiler hints. r=@tschaub,@twpayne,@elemoine
2013-06-18 01:27:24 -07:00
Frédéric Junod
153fea538a Merge pull request #788 from fredj/mapevent
Remove defaultPrevented attribut from ol.MapEvent
2013-06-17 09:24:12 -07:00
ahocevar
c54d81258a Merge pull request #793 from ahocevar/proj-no-extent
Making extent optional for projections. r=@twpayne
2013-06-17 08:40:22 -07:00
ahocevar
11cbbab901 Simplifying ranges structure by adding compiler hints
In JavaScript, keys of object literals are always strings, and
internal type conversions are performed. Now if we tell the
compiler that keys are numbers, we get inconsistent types when
iterating through keys. So instead we set the key type to string
and do a type cast to make the compiler happy. Note that we
could also do toString() instead of a type cast, but it would
add a performance penalty (see
http://jsperf.com/internal-type-conversion-vs-tostring-for-object-keys).
2013-06-17 17:37:48 +02:00
ahocevar
b71bf9607c Do not set center constraint
This change slipped in accidently. Thanks @twpayne for catching
this.
2013-06-17 16:46:47 +02:00
Tom Payne
7b9ac53ace Merge pull request #749 from openlayers/webgl-vector
Skeleton WebGL vector support
2013-06-17 07:08:33 -07:00
Bruno Binet
be0149e478 Merge pull request #763 from bbinet/cleanup-attribution-control
Cleanup attribution control
2013-06-17 07:01:00 -07:00
ahocevar
24953e5f0e Making it clear that Proj4js is used 2013-06-17 15:28:05 +02:00
ahocevar
29b5af9c87 New example using a projection unknown to the client 2013-06-17 15:27:06 +02:00
ahocevar
caefacac35 Serve WMS tiles for sources without specified extent
With this change, WMS sources do not need an extent configured.
The result is that the WMS will be queried for tiles for any
extent.
2013-06-17 15:26:23 +02:00
ahocevar
37b369e0d7 Making extent optional for projections
The projection validity extent is used to generate a sensible
set of default resolutions and a sensible default tile grid.
By making it optional, we can still generate defaults - with
zoom levels that are similar to the default web mercator zoom
levels (based on fitting the world on a single tile, even if the
projection is not available for the whole world).
2013-06-17 15:24:37 +02:00
Tom Payne
cbf88de606 Don't include Swiss projections in default build 2013-06-17 12:23:29 +02:00
Tom Payne
941432af75 Use rigorous Swiss grid / EPSG:4326 transforms 2013-06-17 12:23:29 +02:00
Tom Payne
826556775c Add ol.ellipsoid.BESSEL1841 2013-06-17 12:23:29 +02:00
Tom Payne
0968e2b00b Add ol.proj.EPSG2056 and factor out common code 2013-06-17 12:23:29 +02:00
Tom Payne
c02e2530f1 Add ol.proj.EPSG21781 2013-06-17 12:23:28 +02:00
Bruno Binet
6b904573a0 Hide attribution instead of DOM removal
The reasons are:

 - It minimizes DOM updates (most changes to the attribution are just toggling
   visibility, not the more expensive creation, insertion and removal of DOM
   elements)
 - The order of attributions remains stable as layer visibilities are toggled
   and the user interacts with the map
2013-06-14 00:23:01 +02:00
Bruno Binet
950b53f6dc Clean up attribution control
Do not use map.getLayers() anymore, but get layers from frameState.layersArray.
2013-06-14 00:22:47 +02:00
Bart van den Eijnden
d552d27a35 Merge pull request #783 from bartvde/apidoc2
Add more content for the API doc (r=@twpayne,@tschaub,@fredj)
2013-06-12 11:05:07 -07:00
Bart van den Eijnden
0237675711 address review comments 2013-06-12 20:03:57 +02:00
Frederic Junod
ba8684b585 Remove defaultPrevented attribut from ol.MapEvent
already defined in parent class: http://docs.closure-library.googlecode.com/git/class_goog_events_Event.html
2013-06-12 16:50:12 +02:00
Tom Payne
b08a086a11 Merge pull request #787 from twpayne/proj-related-clean-ups
Projection-related clean ups
2013-06-12 07:44:52 -07:00
Tim Schaub
489879eb0d Merge pull request #784 from tschaub/missing-detail
More useful detail in log messages on the check for missing requires.
2013-06-12 07:21:27 -07:00
Tom Payne
e0dd15567c Add ol.Ellipsoid#e and #eSquared 2013-06-12 16:05:00 +02:00
Tom Payne
1e9ccab806 Make ol.Ellipsoid properties constant 2013-06-12 16:05:00 +02:00
Tom Payne
9751bde8d1 Clean up whitespace 2013-06-12 16:05:00 +02:00
Frédéric Junod
3fab93fc4a Merge pull request #786 from fredj/contextmenu-events
Relay contextmenu browser event
2013-06-12 06:06:53 -07:00
Frederic Junod
1de3ffe57e Relay contextmenu browser event 2013-06-12 14:14:25 +02:00
Tim Schaub
bb980abe8c And the proper syntax 2013-06-11 16:53:55 -06:00
Tim Schaub
9726be64c6 More useful detail in log messages
One line per missing require.  Include line number of last use.  Include proper syntax for adding requires.
2013-06-11 16:42:39 -06:00
ahocevar
f7fd1cf2b0 Merge pull request #404 from ahocevar/canvas-transform
Vector features disappear completely as you zoom in (r=@tschaub)
2013-06-11 12:07:14 -07:00
ahocevar
ea02626c28 Reducing number of default zoom levels
To avoid issues with long segments, we accept scaled tiles for
now. Further workarounds and browser tickets reporting our
issues are needed.
2013-06-11 21:06:18 +02:00
Bart van den Eijnden
8dc97790bc Add more content for the API doc
Involves additions to (there will be subsequent pull requests for other
classes):
- ol.Attribution
- ol.Collection
- ol.Expression
- ol.Feature
- ol.Geolocation
- ol.Map
- ol.Object
- ol.Overlay
- ol.Projection
- ol.View2D
- ol.control.Attribution
- ol.control.Control
- ol.control.FullScreen
- ol.control.Logo
- ol.control.MousePosition
- ol.control.ScaleLine
- ol.control.Zoom
- ol.control.ZoomSlider
- ol.dom.Input
- ol.filter.Filter
- ol.filter.Geometry
- ol.filter.Logical
2013-06-11 20:56:04 +02:00
Frédéric Junod
55b3cbaf17 Merge pull request #552 from fredj/deviceorientation
Add ol.DeviceOrientation
2013-06-11 02:09:38 -07:00
Tim Schaub
9647567704 Merge pull request #776 from tschaub/proj-test
Rename spec to be like src
2013-06-10 10:21:30 -07:00
Tim Schaub
e56a791d41 Merge pull request #774 from tschaub/test-deps
Test dependencies in a common place
2013-06-10 09:08:57 -07:00
Tim Schaub
e7d6bae0ad Providing proj in ol.test 2013-06-10 09:34:43 -06:00
Tim Schaub
a631c50979 Rename spec to be like src 2013-06-10 09:29:00 -06:00
Tim Schaub
2964cc922c Test dependencies in a common place 2013-06-10 09:19:02 -06:00
Tom Payne
bbb95e15fa Fix line collection arguments in tests, thanks @ahocevar 2013-06-10 14:43:01 +02:00
Tom Payne
fc79a0ef3b Merge pull request #771 from ahocevar/leaner-webgl-vector
Removing canvas renderer stub for VectorLayer2
2013-06-10 05:11:19 -07:00
ahocevar
e8ab4f9f0c Removing canvas renderer stub for VectorLayer2
Setting the renderer of the ten-thousand-points example to
WebGL should remove the need for this stub. This is basically
the same approach we took for all vector examples in master,
where we set the renderer to Canvas.
2013-06-10 11:22:32 +02:00
Frédéric Junod
526c38a698 Merge pull request #769 from fredj/export-supported
Export ol.Geolocation.SUPPORTED
2013-06-10 01:37:23 -07:00
ahocevar
489459f313 Apply transform to coordinates rather than the canvas
Credit goes to @jystic for figuring out this approach.
2013-06-09 20:20:53 +02:00
Frederic Junod
4d4a654a8e Export ol.DeviceOrientation.SUPPORTED 2013-06-08 09:53:06 +02:00
Frederic Junod
79f99485c1 Export ol.Geolocation.SUPPORTED 2013-06-08 09:32:39 +02:00
Frederic Junod
ea8c970d6e Better device orientation example 2013-06-07 16:26:45 +02:00
Frederic Junod
9b00967df0 Replace 'changed' with 'change' (see #694) 2013-06-07 16:16:02 +02:00
Frederic Junod
b66b0be8b4 Add options to ol.DeviceOrientation constructor 2013-06-07 16:16:02 +02:00
Frederic Junod
15e5242611 Add 'heading' property to ol.DeviceOrientation 2013-06-07 16:16:02 +02:00
Frederic Junod
c431cc7f63 Add 'tracking' property to ol.DeviceOrientation 2013-06-07 16:16:02 +02:00
Frederic Junod
448e300a03 Add ol.DeviceOrientation 2013-06-07 16:16:02 +02:00
ahocevar
7cd5266d39 Merge pull request #744 from ahocevar/getfeature
getFeatures method and featureInfo templates. r=@bartvde
2013-06-07 07:06:00 -07:00
ahocevar
f83fedb9e1 API doc improvements 2013-06-07 15:34:14 +02:00
ahocevar
3a6c7cf204 Renaming featureInfoFunction to transformFeatureInfo 2013-06-07 15:34:13 +02:00
ahocevar
77d22c4038 getFeatures method and featureInfo templates
To avoid surprises for application developers, this change
creates a new getFeatures method. So it is clear now beforehand
whether features or feature info markup is returned. The result
is now also grouped by layer, so application developers always
have a link between a layer and the feature info it returns.

To make getFeatureInfo return markup for vector layers, this
change also adds a featureInfoFunction property to the vector
layer, which gives developers full control over how features are
rendered to feature info markup.
2013-06-07 15:34:13 +02:00
Frédéric Junod
34becd6871 Merge pull request #768 from fredj/mouseout
Relay mouseout browser event
2013-06-07 01:18:23 -07:00
Frederic Junod
d05bb872f3 Relay mouseout browser event 2013-06-07 09:48:15 +02:00
Tom Payne
85ca39cf0c Add warnings about internal classes and functions 2013-06-06 18:36:40 +02:00
Tom Payne
a858664035 Add warning about internal API to example 2013-06-06 18:36:00 +02:00
Frédéric Junod
286438ae0e Merge pull request #766 from fredj/cleanup
Cleanup
2013-06-06 05:12:17 -07:00
Frederic Junod
ece2a4b64c Store listener keys into an array instead of individual variables 2013-06-06 12:08:32 +02:00
Frédéric Junod
fd62963ad2 Merge pull request #760 from fredj/issue-758
Fix viewportPosition attributes access (closes #758)
2013-06-03 02:28:11 -07:00
Frederic Junod
4f0e09c00e Fix viewportPosition attributes access (closes #758) 2013-06-03 10:40:13 +02:00
ahocevar
461d2a1ba8 Merge pull request #756 from ahocevar/extent-equals
Use ol.extent.equals, removing TODO. r=@elemoine
2013-06-01 15:14:20 -07:00
ahocevar
57e36f4eda Use ol.extent.equals, removing TODO 2013-06-01 11:11:13 -06:00
Tom Payne
5850dff254 Use long LineString in ten-thousand-points example 2013-06-01 18:16:44 +02:00
Tom Payne
45572931a1 Draw LineStrings using drawElements
This enables drawing of LineStrings with more than two coordinates.
2013-06-01 18:16:43 +02:00
Tom Payne
e260255ce8 Return Uint16Array from ol.geom2.LineStringCollection#getIndices 2013-06-01 18:16:43 +02:00
Tom Payne
38c0e24bcd Add Assertion#arreql
Needed because expect.js's eql does not support typed arrays.
2013-06-01 18:16:43 +02:00
Tom Payne
3225a07f6f Add ol.geom2.LineStringCollection#getIndices 2013-06-01 18:16:43 +02:00
Tom Payne
db2f805ed9 Return split values in a single interleaved Float32Array 2013-06-01 18:16:43 +02:00
Tom Payne
42f15f000b Add ol.structs.Buffer#getSplit32 2013-06-01 18:16:43 +02:00
Tom Payne
f61edacb5c Activate ol.renderer.canvas.VectorLayer2 bare skeleton 2013-06-01 18:16:43 +02:00
Tom Payne
674468268e Add ol.renderer.canvas.VectorLayer2 bare skeleton 2013-06-01 18:16:43 +02:00
Tom Payne
f55fed9bc3 Add ten thousand points example 2013-06-01 18:16:42 +02:00
Tom Payne
2484cf2c55 Add line string rendering 2013-06-01 18:16:42 +02:00
Tom Payne
8f86288614 Add line string collections to ol.source.VectorSource2 2013-06-01 18:16:42 +02:00
Tom Payne
1690cb9cae Add ol.geom2.LineStringCollection 2013-06-01 18:16:42 +02:00
Tom Payne
4cc5441579 Activate ol.renderer.webgl.VectorLayer2 2013-06-01 18:16:42 +02:00
Tom Payne
e4b5ec8f0b Add ol.renderer.webgl.VectorLayer2 2013-06-01 18:16:42 +02:00
Tom Payne
bed8c44859 Add ol.layer.VectorLayer2 2013-06-01 18:09:29 +02:00
Tom Payne
ac48fae0af Add ol.source.VectorSource2 2013-06-01 18:09:29 +02:00
Tom Payne
93ba55d357 Add ol.geom2.PointCollection 2013-06-01 18:09:29 +02:00
Tom Payne
d51cdc0e48 Add ol.geom2 utility functions 2013-06-01 18:09:29 +02:00
Tom Payne
7fd2e1ffca Factor out ol.structs.Buffer#allocate 2013-06-01 18:09:29 +02:00
Tom Payne
bcf7707b01 Factor out ol.structs.Buffer#markDirty 2013-06-01 18:09:28 +02:00
Frédéric Junod
07694c52b0 Merge pull request #753 from fredj/size-as-array
Redefine ol.Size to be Array.<number>
2013-06-01 08:40:35 -07:00
Frederic Junod
a1a7e21f92 Redefine ol.Size to be Array.<number> 2013-06-01 10:22:06 +02:00
ahocevar
5560829695 Merge pull request #755 from ahocevar/newline
Fixing linter error
2013-05-31 19:07:46 -07:00
ahocevar
b746116a20 Fixing linter error 2013-05-31 20:07:04 -06:00
ahocevar
4d5149a35f Merge pull request #754 from ahocevar/geom-doc
Exposing ol.geom.GeometryType
2013-05-31 14:05:22 -07:00
ahocevar
56ac30de91 Exposing ol.geom.GeometryType
This is necessary for using ol.filter.Geometry.
2013-05-31 15:04:55 -06:00
Frédéric Junod
1d7ca27e61 Merge pull request #478 from fredj/pixel-as-array
Redefine ol.Pixel to be Array.<number>
2013-05-31 07:26:54 -07:00
Éric Lemoine
a2316e6e14 Merge pull request #752 from elemoine/color-examples
Add color filter values to buttons
2013-05-31 07:22:53 -07:00
Frederic Junod
be081fd44e Redefine ol.Pixel to be Array.<number> 2013-05-31 15:53:04 +02:00
Éric Lemoine
93fd685ca7 Display hue/saturation value in button text 2013-05-31 15:47:17 +02:00
Éric Lemoine
84b1886666 Display brightness/contrast value in button text 2013-05-31 15:45:40 +02:00
Tom Payne
075f4aadc7 Merge pull request #748 from twpayne/rename-projection-to-proj
Rename ol.projection to ol.proj
2013-05-31 04:34:22 -07:00
Frédéric Junod
e9adc06bee Merge pull request #694 from fredj/backbone-model
Change ol.Object event name syntax
2013-05-31 04:33:51 -07:00
Frederic Junod
984002a7ec Change ol.Object event name syntax
'changed' to 'change' and '<attribute>_changed' to 'change:<attribute>'.
2013-05-31 12:38:37 +02:00
Tom Payne
46553c719c Rename ol.projection to ol.proj 2013-05-30 18:55:58 +02:00
Tim Schaub
5e5d8e5b17 Merge pull request #739 from tschaub/attribution-style
Style for attribution control
2013-05-30 08:00:21 -07:00
Tim Schaub
7e20ea160c Simplify style 2013-05-30 08:59:31 -06:00
Tim Schaub
3d0f7f3b70 Merge pull request #738 from tschaub/allow-stop
Allow user to stop map at the end of a drag
2013-05-30 06:15:05 -07:00
Bart van den Eijnden
317281b37b Merge pull request #729 from bartvde/wktsingleton
static read and write methods on ol.parser.WKT (r=@ahocevar)
2013-05-30 00:29:53 -07:00
Tom Payne
795ea69982 Merge pull request #722 from twpayne/unused-variable-check
More rigorous linting
2013-05-28 08:06:30 -07:00
Tom Payne
11672db967 Use === and !== for comparisons with 0 2013-05-28 16:07:48 +02:00
Tom Payne
c0cfc7872e Add missing semicolons 2013-05-28 16:03:32 +02:00
Tom Payne
e744a1b6e9 Enable all gjslint errors 2013-05-28 16:01:34 +02:00
Tom Payne
975e180b26 Fix typo in ol.style.Icon 2013-05-28 16:01:34 +02:00
Tom Payne
7046ebe261 Remove unused variables in tile range 2013-05-28 16:01:34 +02:00
Tom Payne
f4d54ace1d Remove unused variables in structs 2013-05-28 16:01:34 +02:00
Tom Payne
8b539cd4cc Remove unused variables in sphere 2013-05-28 16:01:34 +02:00
Tom Payne
20982bba31 Remove unused variables in sources 2013-05-28 16:01:33 +02:00
Tom Payne
f64e35e8bb Remove unused variables in renderers 2013-05-28 16:01:33 +02:00
Tom Payne
268c18988b Remove unused variables in parsers 2013-05-28 16:01:33 +02:00
Tom Payne
42b6ed5d2a Remove unused variables in interactions 2013-05-28 16:01:33 +02:00
Tom Payne
b021bfd70f Remove unused variables in geom 2013-05-28 16:01:33 +02:00
Tom Payne
6900c90bc5 Remove unused variables in examples 2013-05-28 15:15:49 +02:00
Tom Payne
1c77fb2357 Merge pull request #740 from twpayne/rtree-clean-ups
R-tree clean-ups
2013-05-28 06:14:57 -07:00
Frédéric Junod
c28f64efde Merge pull request #742 from fredj/geolocation
Dispatch an error on Geolocation failure
2013-05-27 04:36:42 -07:00
Frederic Junod
82d2fa373a Dispatch an error on Geolocation failure 2013-05-27 12:46:36 +02:00
Bart van den Eijnden
9968a5feda Merge pull request #734 from bartvde/xml-ie9
Fix XML serialize and xml_eql in IE9 (r=@ahocevar)
2013-05-27 02:28:48 -07:00
Bart van den Eijnden
0f3c151058 implement review comment by @ahocevar 2013-05-27 11:04:27 +02:00
Bart van den Eijnden
b921bece0e Merge pull request #725 from bartvde/gpx
Implement GPX parser (read/write). (r=@fredj)
2013-05-27 01:42:09 -07:00
Bart van den Eijnden
81bffb464f Merge pull request #737 from bartvde/feature-id
FeatureId support in GML (r/w) and KML (w) (r=@fredj)
2013-05-27 01:39:59 -07:00
Frédéric Junod
e2fa562326 Merge pull request #741 from fredj/export-view-constraints
Export constrainResolution and constrainRotation from ol.View2D
2013-05-26 23:47:59 -07:00
Frederic Junod
dab8c8dcd0 Export constrainResolution and constrainRotation from ol.View2D 2013-05-26 08:56:06 +02:00
Frederic Junod
836700669f Sort exported properties 2013-05-26 08:46:30 +02:00
Tom Payne
a162b6fab3 Use empty extents and refactor for clarity 2013-05-25 20:39:55 -05:00
Tom Payne
f0baf2efc2 Add ol.extent.empty 2013-05-25 20:38:11 -05:00
Tom Payne
18b1789512 Sort methods alphabetically 2013-05-25 19:50:44 -05:00
Tom Payne
d80ded31ee Clean up some comments 2013-05-25 19:46:40 -05:00
Tom Payne
aaa4fec141 Move insert into method 2013-05-25 19:39:51 -05:00
Tom Payne
a871f29e75 Move remove into method 2013-05-25 19:35:59 -05:00
Tom Payne
ea1ee73392 Move search and searchReturningObject into methods 2013-05-25 19:33:46 -05:00
Tom Payne
32c663cf2c Move more functions into private methods 2013-05-25 19:24:45 -05:00
Tom Payne
3cdb9f130b Make minWidth and maxWidth private member variables 2013-05-25 18:27:38 -05:00
Tom Payne
476e35c276 Move makeMBR into private static function 2013-05-25 18:17:38 -05:00
Tom Payne
7f22455eed Move squarifiedRatio into private static function 2013-05-25 18:14:52 -05:00
Tim Schaub
439a8a5330 Style for attribution control 2013-05-24 19:02:43 -05:00
Tim Schaub
fa970f1ae2 Allow user to stop map at the end of a drag
If the time between the last move and now is longer than the configured delay, this means that the user stopped panning before releasing the map.
2013-05-24 18:18:34 -05:00
Bart van den Eijnden
3ee533a9b0 FeatureId support in GML (r/w) and KML (w)
Now that we have FeatureId support (see #733), we can add this back to the
GML parsers (v2 and v3). Also add write support for FeatureId in KML, read
support was already added by @fredj
2013-05-24 17:00:59 +02:00
Bart van den Eijnden
e63423eafe Merge pull request #736 from bartvde/jsdoc2
Add parser.jsdoc file for docs on parser options (p=@ahocevar, r=@bartvde)
2013-05-24 07:02:06 -07:00
Bart van den Eijnden
392d529168 Add parser.jsdoc file for docs on parser options.
Pointer by @ahocevar in #735
2013-05-24 16:00:17 +02:00
ahocevar
5a3ac559be Merge pull request #733 from ahocevar/fid
Store the feature's commonly used id. r=@fredj,@bartvde
2013-05-24 06:15:00 -07:00
ahocevar
111b127bf7 Merge pull request #2 from fredj/fid
Store the KML Placemark identifier
2013-05-24 06:14:29 -07:00
Bart van den Eijnden
9881411090 fix typo in WMTS parser 2013-05-24 14:02:00 +02:00
Bart van den Eijnden
6e80a35960 Static read and write functions on WKT parser
Use a singleton to implement static read and write methods on ol.parser.WKT.
2013-05-24 11:17:21 +02:00
Bart van den Eijnden
d8232bb484 Fix XML serialize and xml_eql in IE9
Use the xml property instead in IE for serializing XML.
The xml_eql tests were failing in IE9 on a difference between null and an
empty string for namespaceURI of attributes, this difference is not
relevant to our testing so make sure we ignore.
2013-05-24 10:53:29 +02:00
Bart van den Eijnden
f8ef902af4 Merge pull request #732 from bartvde/geojson-write
Write support for ol.parser.GeoJSON (r=@tschaub)
2013-05-24 00:38:10 -07:00
Frederic Junod
a452915d8a Store the KML Placemark identifier 2013-05-24 09:29:30 +02:00
ahocevar
8c0f1f979a Store the feature's commonly used id
To not clobber the feature's attributes, this is a separate
member property.
2013-05-23 11:16:17 -05:00
ahocevar
d1beaff8e4 Merge pull request #731 from ahocevar/rtree-api-tests
RTree API improvements and more tests. r=@twpayne
2013-05-23 08:28:56 -07:00
Bart van den Eijnden
4b0c43fb8b Merge pull request #726 from bartvde/kml_serialize
Small fixes for KML write (r=@ahocevar)
2013-05-23 07:36:33 -07:00
Bart van den Eijnden
93b067b6bc Write support for ol.parser.GeoJSON
Also add some convenience with static read and write methods based on the
singleton.
2013-05-23 15:57:11 +02:00
ahocevar
10e3a16f40 RTree API improvements and more tests
This change reverts the RTree API back to the original one (i.e.
insert() instead of put(), search() instead of find()), and
creates a new searchReturningObject() method that returns an
object keyed by UIDs.

It also adds missing tests for type restricted search and
searchReturningObject().
2013-05-22 18:25:40 -05:00
ahocevar
513115ea3b Merge pull request #730 from ahocevar/fix-rtree-tests
Fixing bug in tests
2013-05-22 11:42:22 -07:00
ahocevar
597405c288 Fixing bug in tests
That's what you get from copying and pasting and forgetting to
modify the pasted lines to suit your needs.
2013-05-22 13:41:29 -05:00
Frédéric Junod
2d765a6cf9 Merge pull request #728 from fredj/cleanup
Examples cleanup
2013-05-22 07:57:06 -07:00
Frederic Junod
2991c4ab57 Add a resolution input 2013-05-22 16:13:17 +02:00
Frederic Junod
fc12370765 Remove stray end tag fieldset 2013-05-22 16:03:59 +02:00
Frederic Junod
7ba4045e59 geolocation example: suppresses line breaks in tooltip 2013-05-22 15:53:55 +02:00
Frédéric Junod
cf605f2d52 Merge pull request #727 from fredj/mobile-featureinfo
getFeatureInfo examples: listen to click events
2013-05-22 04:31:33 -07:00
Bart van den Eijnden
0f0ea7e63f make feature info work on touch devices for gpx example see #727 2013-05-22 13:06:56 +02:00
Bart van den Eijnden
969b47c78c address review by @fredj 2013-05-22 13:01:41 +02:00
Frederic Junod
db34b37716 getFeatureInfo examples: listen to click events
This make the examples works on touch devices.
2013-05-22 12:30:31 +02:00
Bart van den Eijnden
3a83f1b861 Small fixes for KML write.
Be a good XML citizen and always write out schemaLocation.
Use serialize on ol.parser.XML so that we don't have to set xmlns manually.
2013-05-22 12:00:58 +02:00
Bart van den Eijnden
dc922b4ffa Implement GPX parser (read/write).
Implement a parser for GPX which supports read and write.
2013-05-22 10:44:36 +02:00
ahocevar
783e6d33d5 Merge pull request #723 from ahocevar/add-features
Export addFeatures. r=@tschaub
2013-05-21 20:47:08 -07:00
ahocevar
32d669ccc8 Export addFeatures
This needs discussion, but it's useful for now to be able to
have applications with programmatically created features.
2013-05-21 22:44:28 -05:00
ahocevar
485245fbfd Merge pull request #719 from ahocevar/fast-rtree
More sophisticated RTree implementation. r=@tschaub
2013-05-21 13:01:16 -07:00
ahocevar
a2927a0dd9 Addressing @tschaub's review comments 2013-05-21 15:00:50 -05:00
Frédéric Junod
77e60f8417 Merge pull request #721 from fredj/cleanup
Pass layers as array instead of ol.Collection
2013-05-21 05:28:43 -07:00
Frederic Junod
7d544e0868 Pass layers as array instead of ol.Collection 2013-05-21 12:35:02 +02:00
ahocevar
0f4a5c09af Porting tests from http://github.com/imbcmdth/RTree/
Also fixes some issues that were revealed by the new tests.
2013-05-20 17:47:04 +02:00
ahocevar
97d48277b5 Making docs more clear 2013-05-20 16:20:41 +02:00
ahocevar
2b410cf2d0 More performance and size optimizations
Not using Math.max and Math.min increases performance, and by
using ol.extent functions instead of RTree's rectangle
structures and calculations we can get rid of several functions.
2013-05-20 16:20:21 +02:00
ahocevar
9dd4dc3730 Better optimization for advanced compilation mode 2013-05-20 08:50:15 +02:00
ahocevar
bf510b570a Making RTree work in advanced compilation mode 2013-05-19 23:59:21 +02:00
ahocevar
958ee7af51 Use strings, like with other indices 2013-05-19 11:16:24 +02:00
ahocevar
2ff2e85fbb Only query RTree if requested geometryType is used 2013-05-19 11:16:02 +02:00
ahocevar
79e4ee2717 More sophisticated RTree implementation
This new implementation is based on
http://github.com/imbcmdth/RTree/, with only a few modifications
to add the optional type and provide the API of the previous
implementation.

There is still room for optimization, but this is such an
improvement over the previous RTree already that it's worth
bringing it in now.
2013-05-19 01:47:21 +02:00
Tim Schaub
dc4ca15430 Merge pull request #718 from tschaub/dirty-frame
Properly reset the dirty flag
2013-05-18 09:27:33 -07:00
Tim Schaub
38752f4700 Properly reset the dirty flag
Currently, the dirty flag is never reset (to false).  This is a bug.  Because renderFrame is called very often (every layer render gets called when every other layer needs to re-render), it is criticial to know when we can bail out early.  The dirty flag is currently the way that the vector layer renderer knows that it needs to do more work.  On an empty cache, the renderFrame method of the vector layer renderer is called ~30 times for a single zoom in the vector layer example (due to tiles loading on other layers).  Without this change, we miss the fast path out and clear/re-render the canvas all 30 times.  With this change, we are only clear the canvas and redraw 6 times in a typical zoom animation.
2013-05-17 23:22:07 -06:00
ahocevar
02ba8a86e6 Merge pull request #715 from ahocevar/rtree-performance
Making RTree's find more efficient. r=@bartvde
2013-05-17 04:06:20 -07:00
ahocevar
ecea771801 Making RTree's find more efficient
By doing the type check before the intersection check, we can
save he intersection check for cases where we don't care about
type or have the specified type in a node.
2013-05-17 12:54:06 +02:00
Bart van den Eijnden
b3ad00da13 Merge pull request #714 from bartvde/gmloptions
GML options not always applied (=r@ahocevar)
2013-05-17 03:51:06 -07:00
Bart van den Eijnden
0aa4fe258e GML options not always applied.
This is a follow-up for https://github.com/openlayers/ol3/pull/711
for the GML parser. Also use goog.array.map instead of map as was
pointed out by @twpayne on the WKT review and update the example data
to use all US states as pointed out by @tschaub on the Google hangout.
2013-05-17 11:48:05 +02:00
Bart van den Eijnden
921aa28b42 Merge pull request #712 from bartvde/wkt
Add WKT parser (r=@ahocevar,@twpayne,@tschaub)
2013-05-17 01:55:42 -07:00
Bart van den Eijnden
3e3b5ab02d move last RegExp into constant 2013-05-17 10:15:22 +02:00
Bart van den Eijnden
585887b04e address review comments by @twpayne 2013-05-17 10:09:40 +02:00
ahocevar
9342ebdc98 Merge pull request #713 from ahocevar/kml-responsetext
Do not rely on responseXML, also use responseText. r=@bartvde
2013-05-16 12:49:51 -07:00
ahocevar
5d7cdd2646 Use goog.isString() instad of typeof check 2013-05-16 21:20:34 +02:00
ahocevar
22c4508c27 Don't rely on responseXML, also use responseText
On servers that report an incorrect content type for XML
documents, responseXML will be empty. In these cases we need to
use responseText instead. This change also prevents readNode
calls with empty data.
2013-05-16 21:11:32 +02:00
ahocevar
e50c314c33 Merge pull request #711 from ahocevar/kml-options
KML options not applied when library built separately from application. r=@bartvde
2013-05-16 07:04:42 -07:00
Bart van den Eijnden
bb16820ab0 add exports for WKT 2013-05-16 15:44:31 +02:00
Bart van den Eijnden
bf8c12d9f7 Add WKT parser.
Add a parser (read/write) for OGC Well-Known-Text (WKT). It deals with
geometries only, not with features, mostly because WKT can only contain a
single geometry (or geometry collection). This can later on be used to
serialize and deserialize geometries in ol3.
2013-05-16 15:29:39 +02:00
ahocevar
3e6cdf8901 trackAttributes is optional 2013-05-16 15:26:54 +02:00
ahocevar
cde4ef435c Adding another option 2013-05-16 15:14:38 +02:00
ahocevar
1929403cda Do not extend the instance with options 2013-05-16 14:37:40 +02:00
ahocevar
c245794e56 Sorting properties 2013-05-16 14:37:27 +02:00
ahocevar
7ed51f97aa Merge pull request #710 from ahocevar/hit-detection
Accurate hit detection. r=@bartvde
2013-05-16 02:10:50 -07:00
ahocevar
8084e20e64 Fixing typo 2013-05-16 10:45:25 +02:00
ahocevar
7a800068ed Fixing typedef 2013-05-16 10:44:22 +02:00
ahocevar
824397e6ba Do not change ol.extent.containsCoordinate 2013-05-16 10:42:28 +02:00
ahocevar
2d5c0df7cd More verbose variable names 2013-05-16 10:14:56 +02:00
Éric Lemoine
b7f0f9ba86 Merge pull request #708 from elemoine/user-extensions
The compilation of ol.js produces a warning
2013-05-16 01:06:36 -07:00
ahocevar
4e7ffc2711 Store symbol sizes by tile
The reason for this change is that symbolSizes and maxSymbolSize
on the instance will be wrong as soon as the resolution changes
and cached tiles are used. It turned out that the approach used
now has several advantages: smaller symbolSizes objects, no need
to merge symbolSizes objects, and cache management for free (no
risk of memory leaks). Note that the symbolSizes and
maxSymbolSize for each tile are not strictly tile specific -
they represent the rendering pass that created the tile. This
has no negative side effects, and it has the advantage that
there is not a single additional loop needed to create these
structures.
2013-05-16 09:57:26 +02:00
ahocevar
037e44e084 Accurate hit detection
With this change, hit detection for lines and points gets very
accurate, because the vector renderer instance keeps track of
line widths and point symbol sizes. After doing a bbox query in
the RTree, returned lines and points are evaluated against the
thresholds of their line width or symbol size. The KML example
with its different symbolizers now has getFeatureInfo too to
show this in action.
2013-05-15 23:44:22 +02:00
Bart van den Eijnden
32ea32521d Merge pull request #709 from bartvde/gmlfresh
GML parser (r=@ahocevar)
2013-05-15 07:08:24 -07:00
Bart van den Eijnden
e8ed1674ea do not specify the source projection in ol.parser.ReadFeaturesOptions anymore 2013-05-15 15:34:11 +02:00
Bart van den Eijnden
2ad3ee6f99 incorporate review from @ahocevar 2013-05-15 14:50:37 +02:00
Bart van den Eijnden
5ad4734c24 GML parser.
This adds a parser (read/write) for GML v2 and v3. GML v3 is limited to the
simple features profile of GML 3.1.1, just like OpenLayers 2 was. This will
be the basis for the WFS parser, but it only makes sense to continue this work
once feature modification (insert, update, delete) is in place in ol3. So the
WFS parser will be another pull request.
2013-05-14 20:12:05 +02:00
Éric Lemoine
124b195d3e handleMapPostrender returns undefined
Without this we get the following warning from the compiler:

JSC_EXPORTED_FUNCTION_UNKNOWN_RETURN_TYPE. Unable to determine return type for exported function ol.control.Control.prototype.handleMapPostrender at ../src/ol/control/control.js line 79 : 51

I'm not sure why explicitely specifying the return type is required here.
2013-05-10 14:04:50 +02:00
Éric Lemoine
42cc4d7683 Merge pull request #706 from elemoine/user-extensions
Custom control framework
2013-05-10 04:47:39 -07:00
Éric Lemoine
4c144c3d5c Merge pull request #700 from elemoine/calculate-extent
Add and export View2D.calculateExtent
2013-05-10 03:57:24 -07:00
Bart van den Eijnden
87b3a3274d Merge pull request #699 from bartvde/kmlxmleql3
Use xmleql in the KML tests (r=@ahocevar)
2013-05-10 03:14:35 -07:00
ahocevar
72fce33956 Merge pull request #703 from ahocevar/getfeatureinfo-async
Asynchronous API for map#getFeatureInfo. r=@elemoine
2013-05-10 02:50:11 -07:00
Éric Lemoine
3a4fc2a99a Use our own null function for handleMapPostrender
If we use ol.control.Control.prototype.handleMapPostrender = goog.nullFunction the API doc doesn't show the mapEvent parameter of the handleMapPostRender function.
2013-05-10 10:56:39 +02:00
Éric Lemoine
88352092ee Externalize Control.handleMapPostrender 2013-05-10 10:45:24 +02:00
Éric Lemoine
c845682ecb Export Control.getMap 2013-05-10 10:24:11 +02:00
Éric Lemoine
4e51888651 Add a custom controls example
Inspired from @cedricmoullet's ZoomExtent example in 3312c37ed0.
2013-05-10 10:24:11 +02:00
Éric Lemoine
9685c87bc9 Create ol.inherits alias, and export it 2013-05-10 10:24:11 +02:00
Éric Lemoine
7a71f107cb Export and externalize Control.setMap 2013-05-10 10:24:11 +02:00
Éric Lemoine
2944b31c69 Merge pull request #707 from elemoine/gjslint
Use new gjslint version (2.3.10)
2013-05-09 22:03:38 -07:00
Éric Lemoine
41fb355804 New gslint doesn't like va_filters 2013-05-10 00:13:15 +02:00
Éric Lemoine
410f35bb44 Use latest gjslint version (2.3.10) 2013-05-10 00:13:05 +02:00
Éric Lemoine
917e78a096 Merge pull request #701 from elemoine/rm-google-exports
Remove google.exports
2013-05-09 15:03:35 -07:00
Éric Lemoine
d71c690794 Merge pull request #705 from elemoine/getextent
Fix typo in View2D:getExtent
2013-05-09 15:02:48 -07:00
Éric Lemoine
c34d637de1 Fix typo in View2D:getExtent 2013-05-09 23:42:55 +02:00
Éric Lemoine
c9299f3b8d Merge pull request #704 from elemoine/no-namespace-export
Export fixes
2013-05-09 14:13:48 -07:00
Éric Lemoine
ca332a3fef Minor fix to the generate-exports.py script
Now that we correctly export the ol.animation.*, ol.easing.* and ol.coordinate.* symbols we can make the generate-exports.py script work for more cases.
2013-05-09 22:46:08 +02:00
Éric Lemoine
4b7f3e85c2 No need to export ol.coordinate 2013-05-09 22:45:20 +02:00
Éric Lemoine
f47ac87f12 No need to export ol.easing 2013-05-09 22:45:11 +02:00
Éric Lemoine
17e779177b ol.easing.* functions are symbols 2013-05-09 22:44:49 +02:00
Éric Lemoine
31930290cf No need to export ol.animation 2013-05-09 22:44:11 +02:00
Éric Lemoine
a96031f435 ol.animation.* functions are symbols 2013-05-09 22:43:04 +02:00
ahocevar
53b85c99ae map#getFeatureInfo does not return anything
Thanks @elemoine for catching this.
2013-05-09 22:32:40 +02:00
ahocevar
7b256c3ec6 Asynchronous API for map#getFeatureInfo
This change allows us to use feature info services on the
server. It will also be useful for the GetFeature control to
get results from a WFS.
2013-05-09 22:26:55 +02:00
Éric Lemoine
fa1eb354f2 Merge pull request #702 from elemoine/closure-linter
Use closure_linter-2.3.9.tar.gz
2013-05-09 12:48:48 -07:00
Éric Lemoine
1d709cc6ac Use closure_linter-2.3.9.tar.gz
closure_linter-latest.tar.gz is no longer available in http://closure-linter.googlecode.com/files/, so use closure_linter-2.3.9.tar.gz.
2013-05-09 21:23:31 +02:00
Éric Lemoine
8779b90f7c Remove google.exports
This .exports file made goog.require be exported as a null function. This was needed to be able to run the ol3 examples uncompiled against the ol.js build. Now that host-examples target removes the goog.require statements from the examples' js files (74b8fea6) we don't need to export goog.require anymore.
2013-05-09 21:13:20 +02:00
Bart van den Eijnden
c69e5c1dba Use xmleql in the KML tests
This also involves some modifications to the xmleql functionality now that
it was tested with a real-life case (KML). Also, some of the input KML files
needed to be changed since we currently cannot roundtrip 100% of the input.
2013-05-08 16:41:45 +02:00
Tom Payne
0b09148fb5 Merge pull request #697 from twpayne/fix-nan-test
Fix NaN test
2013-05-08 05:59:16 -07:00
Tom Payne
9286d63133 Merge pull request #693 from twpayne/class-name
Add className option to control options
2013-05-08 05:35:37 -07:00
Tom Payne
b4598aa5d9 Fix NaN test 2013-05-08 14:32:16 +02:00
ahocevar
96c3a86314 Merge pull request #692 from ahocevar/pnpoly
Point-in-polygon improvements. r=@bartvde
2013-05-08 05:11:16 -07:00
Tom Payne
97510ba0be Use className in mouse position example 2013-05-07 17:33:33 +02:00
Tom Payne
2ad5dea737 Rename ol-mouseposition to ol-mouse-position 2013-05-07 17:31:26 +02:00
Bart van den Eijnden
14e073fb5a Merge pull request #689 from bartvde/xmleql4
Improvements for xmleql (r=@ahocevar)
2013-05-07 08:06:57 -07:00
Tom Payne
b698b1736f Add className option to ol.control.ZoomSlider 2013-05-07 16:36:25 +02:00
Tom Payne
9c59116dd1 Make zoom slider control options optional 2013-05-07 16:31:39 +02:00
Tom Payne
ab9fc9cc71 Inline simple function that is only called once 2013-05-07 16:28:22 +02:00
Tom Payne
b7e2a9b40e Add className option to ol.control.Zoom 2013-05-07 16:19:50 +02:00
Tom Payne
09feaedd00 Add className option to ol.control.ScaleLine 2013-05-07 16:19:21 +02:00
Tom Payne
f31a4f8549 Add className option to ol.control.MousePosition 2013-05-07 16:18:05 +02:00
Tom Payne
525d5c5337 Add className option to ol.control.Logo 2013-05-07 16:17:51 +02:00
Tom Payne
f08814250e Add className option to ol.control.FullScreen 2013-05-07 16:17:35 +02:00
Tom Payne
8c396e5afb Add className option to ol.control.Attribution 2013-05-07 16:17:13 +02:00
ahocevar
019fc86ac5 Entertaining linter and compiler 2013-05-07 14:20:09 +02:00
Éric Lemoine
c105a98443 Merge pull request #691 from elemoine/mouseposition
Add default CSS for mouse position control
2013-05-07 02:48:10 -07:00
ahocevar
666a010e3b Point-in-polygon improvements
As suggested by @tschaub in #674, geom.pointInPoly is not needed
if we have geom.LinearRing#containsCoordinate. This pull request
also adds tests and documentation on the limitations of the
containsCoordinate method.

I think for now it is ok to keep geometry/topology functions as
simple as possible in ol3. If we decide to not rely on third
party libraries like jsts for topology operations, we can always
refine what we have and e.g. port topology operations over from
ol2.
2013-05-07 10:49:51 +02:00
Frédéric Junod
aa3cc0cec4 Merge pull request #687 from fredj/geolocation
Use ol.projection.identityTransform instead of goog.functions.identity
2013-05-06 08:41:36 -07:00
Bart van den Eijnden
3fc0f2b47d Improvements for xmleql
This adds some improvements for the xmleql test assertion. When passed in a
document, use the documentElement. Also improve error reporting as suggested
by @tschaub.
2013-05-06 15:35:40 +02:00
Thomas
f219393149 Add default CSS style for mouse position
Missing CSS was confirmed with issue #680, this commit is to fix it and change
ol-mouse-position class to ol-mouseposition. I choose for the moment the top
right corner to display the coordinates from mouse position control because of
potential conflict with the scaleline control.
2013-05-06 14:07:13 +02:00
Bart van den Eijnden
10b690b5f9 Merge pull request #661 from bartvde/xmleql
Add Assertion.prototype.xmleql (r=@twpayne,@tschaub,@elemoine)
2013-05-06 02:43:24 -07:00
Bart van den Eijnden
865404a0d3 Add Assertion.prototype.xmleql
This is based on the xml_eq function we had in the OL2 test framework but
adapted to expect.js.
2013-05-06 11:18:49 +02:00
Frederic Junod
fdfe057efe Use ol.projection.identityTransform instead of goog.functions.identity 2013-05-06 10:21:24 +02:00
Tom Payne
331a5260c9 Merge pull request #679 from twpayne/rename-create-empty-extent
Rename ol.extent.createEmptyExtent to ol.extent.createEmpty
2013-05-01 03:45:51 -07:00
Tom Payne
b070b572d0 Rename ol.extent.createEmptyExtent to ol.extent.createEmpty 2013-05-01 12:36:54 +02:00
Tom Payne
70fc6879db Merge pull request #676 from twpayne/testing-clean-ups
Testing clean-ups
2013-05-01 03:25:09 -07:00
Tom Payne
a9b5f003e5 Merge pull request #677 from twpayne/improve-type-checking
Improve type checking
2013-04-30 15:55:34 -07:00
Tim Schaub
c1ddc55a12 Merge pull request #678 from tschaub/once
Rename onOnce to once
2013-04-30 15:10:47 -07:00
Tim Schaub
ffe9105891 Rename onOnce to once (see #678) 2013-04-30 14:58:39 -06:00
Tom Payne
1ab9de8b2c Improve type checking in ol.View2D 2013-04-30 22:00:22 +02:00
Tom Payne
0541053fa9 Improve type checking in ol.TileUrlFunction 2013-04-30 22:00:22 +02:00
Tom Payne
0e69af847e Improve type checking in ol.source.WMTS 2013-04-30 22:00:22 +02:00
Tom Payne
6e1f049456 Improve type checking in ol.source.StaticImage 2013-04-30 22:00:22 +02:00
Tom Payne
65f891a30d Improve type checking in ol.source.BingMaps 2013-04-30 22:00:22 +02:00
Tom Payne
fe9fee1609 Improve type checking in ol.RotationConstraint 2013-04-30 22:00:22 +02:00
Tom Payne
bd9d723315 Improve type checking in ol.ResolutionConstraint 2013-04-30 22:00:22 +02:00
Tom Payne
2690410cbe Improve type checking in ol.renderer.Layer 2013-04-30 22:00:22 +02:00
Tom Payne
070c286c54 Improve type checking in ol.ImageUrlFunction 2013-04-30 22:00:21 +02:00
Tom Payne
539529af59 Improve type checking in ol.coordinate 2013-04-30 21:29:56 +02:00
Tom Payne
d2979fc4ff Improve type checking in ol.animation 2013-04-30 21:29:10 +02:00
Tom Payne
f0df0d7bf2 Display test errors in Chrome's console, thanks @Turbo87 2013-04-30 18:44:09 +02:00
Tom Payne
984121e095 Remove Assertion#equalArray 2013-04-30 18:22:16 +02:00
Tom Payne
efccede678 Use eql instead of equalArray 2013-04-30 18:21:58 +02:00
Tom Payne
fcc079a5f2 Extend expect.js's eql to handle NaNs 2013-04-30 18:20:34 +02:00
Tom Payne
c012afdbae Remove unused Assertion#intersect 2013-04-30 18:08:24 +02:00
Tom Payne
59a4155651 Merge pull request #665 from twpayne/fix-firefox-dom-renderer
Prevent Bootstrap's setting of max-width from infecting map
2013-04-30 06:46:41 -07:00
Tom Payne
2d83003b64 Merge pull request #671 from twpayne/refactor-tile-functions
Refactor tile functions
2013-04-30 06:39:25 -07:00
Frédéric Junod
c3348d1734 Merge pull request #675 from fredj/object-listen
ol.Object.{on|onOnce|un} type can also be an array of string
2013-04-30 06:35:54 -07:00
ahocevar
8fb8a718c3 Merge pull request #674 from ahocevar/getfeatureinfo
Getting feature information for vector layers. r=@twpayne,@fredj
2013-04-30 06:12:47 -07:00
Frederic Junod
6366bd05b3 ol.Object.{on|onOnce|un} type can also be an array of string 2013-04-30 15:03:52 +02:00
ahocevar
00777de581 Do not check for listeners, as suggested by @fredj 2013-04-30 14:45:47 +02:00
ahocevar
d2c81db06a Info box instead of tooltip as suggested by @fredj 2013-04-30 14:15:39 +02:00
ahocevar
58c8b07ab5 Get hit candidates from RTree, then refine result
Now we get exact hits also for lines and polygons.
2013-04-30 13:34:12 +02:00
ahocevar
cc1b70c74b Giving the map a getFeatureInfoForPixel method
This method is an entry point for getting feature information.
Renderers can use a hit canvas or defer to a layer (source) to
get matching features for a pixel.

For now this is only implemented for vector layers, and it uses
a bbox query because we cannot refine the result because of
missing geometry intersection functions yet.
2013-04-30 13:32:16 +02:00
Éric Lemoine
a0340faa63 Merge pull request #673 from elemoine/closure-no-deps
Always set CLOSURE_NO_DEPS to true
2013-04-30 03:30:31 -07:00
Tom Payne
7ed672752d Merge pull request #668 from twpayne/strip-debug-classes
Strip debug classes when compiling
2013-04-30 03:30:05 -07:00
Tom Payne
daa975d01f Prevent user's setting of max-width from infecting map
Thanks @ThomasG77.
2013-04-30 12:26:31 +02:00
Tom Payne
66d95316f1 Merge pull request #666 from twpayne/remove-unused-css-classes
Remove unused CSS classes
2013-04-30 02:33:50 -07:00
Tom Payne
09d245c54b Promote createTileCoordTransform into base class 2013-04-30 11:01:57 +02:00
Tom Payne
7a8d29f5e0 Clip tiles to extent in tile coordinate space 2013-04-30 10:30:50 +02:00
Frédéric Junod
28fcbbf1fe Merge pull request #672 from fredj/export-update-size
Export ol.Map.updateSize
2013-04-30 00:41:08 -07:00
Éric Lemoine
1281d9987a Add and export View2D.calculateExtent 2013-04-30 09:39:09 +02:00
Éric Lemoine
aa5a571ab1 Always set CLOSURE_NO_DEPS to true 2013-04-30 09:25:09 +02:00
Frederic Junod
a723b4e215 Export ol.Map.updateSize 2013-04-30 09:04:35 +02:00
Tom Payne
6976fd96e3 Refactor tile functions
* Add support for minZoom in XYZ tile grids and tile sources
* Factor out common tile coordinate transforms
2013-04-29 19:54:26 +02:00
Tom Payne
1ff8df8936 Log WebGL shader and program errors 2013-04-29 12:51:16 +02:00
Tom Payne
37ef03c956 Re-enable logging 2013-04-29 12:50:37 +02:00
Tom Payne
2447f09128 Merge pull request #670 from twpayne/fix-glsl-escaping
Don't escape HTML characters in shader generation
2013-04-29 02:22:19 -07:00
Tom Payne
14da0cfd11 Don't escape HTML characters in shader generation
This tells Mustache not to escape <, >, &, and " characters.
2013-04-29 11:18:49 +02:00
Tom Payne
ca7081bde3 Merge pull request #669 from twpayne/more-animations
Minor changes to the animation example
2013-04-29 02:15:14 -07:00
Tom Payne
390cc17161 Cosmetic clean-ups 2013-04-28 20:01:44 +02:00
Tom Payne
b666fc49b7 Add spiral to Madrid animation example 2013-04-28 20:01:25 +02:00
Tom Payne
cfa29b0022 Strip debug classes when compiling 2013-04-28 18:00:24 +02:00
Tom Payne
5bfef2805d Merge pull request #663 from twpayne/render-error-tiles-as-empty
Render error tiles as empty
2013-04-28 08:21:51 -07:00
Tom Payne
65a2aef4ed Merge pull request #658 from twpayne/ol-object-events
ol.Object events
2013-04-28 08:20:29 -07:00
Tom Payne
ef915e1cd0 Remove unused CSS classes
The classes ol-layers, ol-layer-image, and ol-layer-tile are not used.
2013-04-28 16:40:17 +02:00
Frédéric Junod
01d06d0a2e Merge pull request #662 from fredj/canvas-draw-image-perf
Possible canvas performance enhancement
2013-04-26 07:40:00 -07:00
Frederic Junod
b3e5ac2717 Optimize canvas renderer.
Only use setTransform when it's needed (ie. when the view is rotated)
2013-04-26 13:32:18 +02:00
Tom Payne
3643908427 Only set center once in mobile full screen example 2013-04-25 19:41:03 +02:00
Tom Payne
e8109919e9 Add ol.Object#onOnce 2013-04-25 19:41:03 +02:00
Tom Payne
09fe09e42b Add ol.Object#unByKey 2013-04-25 19:41:03 +02:00
Tom Payne
fa2582a2f1 Return listener key from ol.Object#on 2013-04-25 19:41:02 +02:00
Tom Payne
c576b2a34e Treat image tiles with a zero dimension as empty 2013-04-25 15:17:24 +02:00
Tom Payne
d8a4b19b54 Render error tiles as empty 2013-04-25 14:49:55 +02:00
Tom Payne
e7eb07197e Merge pull request #655 from twpayne/scale-tile-queue
Scale tile queue according to number of sources
2013-04-25 05:44:46 -07:00
Frédéric Junod
4828835292 Merge pull request #653 from fredj/background-color
Remove BACKGROUND_COLOR from ol.Map
2013-04-25 02:43:00 -07:00
Frederic Junod
a1af290d18 Add a background image to the example maps
image from http://subtlepatterns.com/
2013-04-24 17:52:43 +02:00
Frederic Junod
4094ace04b Remove BACKGROUND_COLOR from ol.Map
Let the map be transparent, the background color can be set with CSS.
2013-04-24 17:38:25 +02:00
Frédéric Junod
cec47dbfc3 Merge pull request #652 from fredj/ol.feature-jsdoc
Update ol.Feature jsdoc
2013-04-24 05:31:38 -07:00
Frederic Junod
6b74dcf75b Update ol.Feature jsdoc 2013-04-24 12:35:24 +02:00
Tom Payne
9defa59d2d Merge pull request #651 from twpayne/full-screen-drag-rotate-and-zoom
Show off
2013-04-23 16:39:51 -07:00
Tom Payne
bd0512fea7 Show off 2013-04-24 01:38:03 +02:00
Tom Payne
2b48f03e0f Merge pull request #650 from twpayne/fix-out-of-scope-variables
Fix out of scope variables in ol.Map
2013-04-23 14:27:33 -07:00
Tom Payne
51905b54a2 Fix out of scope variables in ol.Map 2013-04-23 22:47:22 +02:00
Tom Payne
43f313cb18 Scale tile queue according to number of sources 2013-04-23 22:18:51 +02:00
Tom Payne
db1ab50938 Merge pull request #639 from twpayne/fix-webgl-map-renderer
Bing Maps example is broken
2013-04-23 08:08:19 -07:00
Tom Payne
1a72e59c54 Fix stray return 2013-04-23 16:42:39 +02:00
Tom Payne
ed5433d290 Merge pull request #649 from twpayne/fix-canvas-tiles-webgl
Use negative frame index as frame marker
2013-04-23 07:16:52 -07:00
Tom Payne
bedfa5e2d3 Merge pull request #640 from twpayne/interaction-options
Interaction options
2013-04-23 07:11:56 -07:00
Éric Lemoine
5842d771fe Merge pull request #646 from elemoine/target
Make it possible to set map target after map creation
2013-04-23 06:33:30 -07:00
Tom Payne
4da61e8ae9 Configure ol.interaction.TouchRotate with options 2013-04-23 15:31:16 +02:00
Tom Payne
9e8d20aee4 Re-use ol.Kinetic object 2013-04-23 15:31:16 +02:00
Tom Payne
2dff59a4d4 Configure ol.interaction.TouchPan with options 2013-04-23 15:31:16 +02:00
Tom Payne
a36b4a0466 Configure ol.interaction.DragPan with options 2013-04-23 15:31:16 +02:00
Tom Payne
3b9699fbc8 Configure ol.interaction.DragZoom with options 2013-04-23 15:31:16 +02:00
Tom Payne
48d4554317 Configure ol.interaction.KeyboardZoom with options 2013-04-23 15:31:16 +02:00
Tom Payne
cc33727fad Configure ol.interaction.KeyboardPan with options 2013-04-23 15:31:16 +02:00
Tom Payne
d1b2e4e483 Add drag rotate and zoom example 2013-04-23 15:31:16 +02:00
Tom Payne
808de79d16 Export ol.interaction.DragRotateAndZoom 2013-04-23 15:31:15 +02:00
Tom Payne
76a9f80545 Update ol.interaction.DragRotateAndZoom 2013-04-23 15:31:15 +02:00
Tom Payne
75ac8a4847 Export ol.interaction.condition.* 2013-04-23 15:31:15 +02:00
Tom Payne
8d29bf3c20 Add ol.interaction.condition.always 2013-04-23 15:31:15 +02:00
Tom Payne
d90f292c71 Initialize all properties in constructor 2013-04-23 15:31:15 +02:00
Tom Payne
003ac5536e Configure ol.interaction.DragRotate with options 2013-04-23 15:31:15 +02:00
Tom Payne
ef17d4f3b8 Rename DblClickZoom to DoubleClickZoom 2013-04-23 15:31:15 +02:00
Tom Payne
eb9f6c027b Avoid duplicate property lookup 2013-04-23 15:29:17 +02:00
Tom Payne
f2836ea111 Configure ol.interaction.DblClickZoom with options 2013-04-23 15:29:17 +02:00
Tom Payne
a4d8e1c4d8 Correct property in ol.interaction.DefaultsOptions 2013-04-23 15:29:17 +02:00
Tom Payne
baf8cc49a1 Avoid generating long lines in exports 2013-04-23 15:29:17 +02:00
Tom Payne
a85363ac03 Use negative frame index as frame marker to avoid conflict with goog.getUid 2013-04-23 15:22:49 +02:00
Tom Payne
c78602ba7a Merge pull request #644 from twpayne/remove-fragile-test
Remove fragile test
2013-04-23 05:56:38 -07:00
Éric Lemoine
d3d0d1e007 Test isElement instead of isDef (thanks @fredj) 2013-04-23 14:44:36 +02:00
Tom Payne
6751c2640d Remove fragile test
The user animation test is sensitive to small timing differences and
randomly fails.  This randomly breaks the integration tests.
2013-04-23 14:24:16 +02:00
Tom Payne
b2987d3054 Merge pull request #643 from twpayne/fix-dispose
Fix dispose
2013-04-23 05:20:05 -07:00
Frédéric Junod
b5076091fa Merge pull request #647 from fredj/wmts.projection
Change ol.source.WMTSOptions.projection type to ol.ProjectionLike
2013-04-23 05:15:47 -07:00
Éric Lemoine
29e69d3833 Simplify teleport example 2013-04-23 14:05:11 +02:00
Éric Lemoine
11efafffd8 Make setTarget accept a string 2013-04-23 14:04:46 +02:00
Frédéric Junod
e9a5eff753 Merge pull request #645 from fredj/ol.object.changed
Remove unused ol.Object.prototype.changed
2013-04-23 04:52:13 -07:00
Frederic Junod
29137b5ad1 Change ol.source.WMTSOptions.projection type to ol.ProjectionLike
Same type as base class.
2013-04-23 13:34:37 +02:00
Frederic Junod
e3bec11d2e Remove unused ol.Object.prototype.changed 2013-04-23 11:06:42 +02:00
Éric Lemoine
8e8804caf1 Add a teleport map example 2013-04-23 10:42:18 +02:00
Éric Lemoine
2dfe36b588 Map target may be undefined 2013-04-23 10:42:18 +02:00
Éric Lemoine
7547b50bd8 Add map property "target" 2013-04-23 10:42:18 +02:00
ahocevar
f681a99ce0 Merge pull request #638 from ahocevar/kml-options
KML rendering in advanced compilation mode. r=@bartvde
2013-04-23 00:09:26 -07:00
Bart van den Eijnden
334b2276cf Merge pull request #641 from bartvde/kmlexample
Add AsyncStringFeatureParser and use plain (r=@ahocevar)
2013-04-22 23:35:21 -07:00
ahocevar
8515e30ad8 Making the linter happy
... although jsdoc files are none of the linter's business.
2013-04-22 22:47:13 +02:00
ahocevar
c16b941909 Exporting KML parser options
This is necessary because application developers need to be able
to configure the KML parser.
2013-04-22 22:37:20 +02:00
Frédéric Junod
0421ad71e8 Merge pull request #642 from fredj/geolocation-export
Fix ol.Geolocation and ol.GeolocationOptions export
2013-04-22 12:42:37 -07:00
Tom Payne
e686eff886 Fix use of dispose in ol.renderer.webgl.ImageLayer tests 2013-04-22 17:16:44 +02:00
Tom Payne
6c369ae907 Fix use of dispose in ol.Map tests 2013-04-22 17:16:44 +02:00
Tom Payne
71e06761f0 Fix use of dispose in ol.layer.Vector tests 2013-04-22 17:16:44 +02:00
Tom Payne
3c541045bb Fix use of dispose in ol.layer.Layer tests 2013-04-22 17:16:43 +02:00
Tom Payne
744f72355b Fix use of dispose in ol.control.ZoomSlider tests 2013-04-22 17:16:30 +02:00
Tom Payne
c2e1623529 Fix use of dispose in ol.control tests 2013-04-22 17:16:22 +02:00
Tom Payne
d8357ae932 Fix use of dispose in ol.parser.KML 2013-04-22 17:14:31 +02:00
Frederic Junod
abbbe3d41b Fix ol.Geolocation and ol.GeolocationOptions export 2013-04-22 16:53:11 +02:00
Bart van den Eijnden
feb6c4c2d7 Add AsyncStringFeatureParser and use plain
XMLHttpRequest in the KML example

Since the content-type on github.io is application/octet-stream we need
to implement an Async string based parser interface in the KML parser.
Also use plain XmlHttpRequest in the example instead of jQuery Ajax since
the vector-features example also uses that.
2013-04-22 16:45:33 +02:00
Tom Payne
d45a63ee5c Merge pull request #637 from twpayne/remove-unused-functions
Remove unused functions
2013-04-22 01:40:04 -07:00
Tom Payne
bc3dc0fd74 Merge pull request #636 from twpayne/cache-length
Cache array length in ol.control.Attribution
2013-04-22 01:34:20 -07:00
Tom Payne
4c42f4e1ba Remove ol.PixelBounds 2013-04-22 10:14:22 +02:00
Tom Payne
ee2e448220 Remove ol.tilegrid.TileGrid#getPixelBoundsForTileCoordAndResolution 2013-04-22 10:11:13 +02:00
Tom Payne
8264343e54 Cache array length in ol.control.Attribution 2013-04-22 10:05:21 +02:00
Éric Lemoine
fe1475105a Merge pull request #635 from elemoine/handletilechange
Remove unused function
2013-04-21 13:49:31 -07:00
Éric Lemoine
9d901d26b2 Merge pull request #634 from elemoine/missing-description
Add missing description for @return tag
2013-04-21 13:49:03 -07:00
Éric Lemoine
a5519c2645 Add missing description for @return tag 2013-04-21 21:51:14 +02:00
Éric Lemoine
4f1b7c70b8 Remove unused function 2013-04-21 21:50:03 +02:00
Tom Payne
e6f354ce7c Merge pull request #632 from twpayne/mobile-full-screen-example
Mobile full screen example
2013-04-21 09:46:48 -07:00
Tom Payne
ddb295cc77 Add full screen example for mobile devices 2013-04-20 16:56:31 +02:00
Tom Payne
be7228f78e Add options to ol.Geolocation constructor 2013-04-20 16:55:26 +02:00
Tom Payne
945d2f6f5d Merge pull request #631 from twpayne/dont-use-foreach-in-loops
Don't use forEach in loops
2013-04-20 03:02:13 -07:00
Tom Payne
ac557d4eca Merge pull request #567 from twpayne/no-events-in-renderers
No events in renderers
2013-04-20 02:52:32 -07:00
Tom Payne
b2cc0c9bd8 Use ii instead of len for array length cache for consistency 2013-04-20 11:34:49 +02:00
Tom Payne
c48b9c5118 Cache array length in ol.TileRange 2013-04-20 11:34:48 +02:00
Tom Payne
ac489c6938 Cache array length in ol.structs.Buffer 2013-04-20 11:34:48 +02:00
Tom Payne
fb0f1fb209 Cache array length in layer renderer 2013-04-20 11:34:48 +02:00
Tom Payne
879d9758c0 Cache array length in WebGL renderer 2013-04-20 11:34:48 +02:00
Tom Payne
72a83b99b7 Cache array length in DOM renderer 2013-04-20 11:34:48 +02:00
Tom Payne
68440e7e0f Cache array length in canvas renderer 2013-04-20 11:34:39 +02:00
Tom Payne
e9b0e2b0e8 Cache array length in ol.Map 2013-04-20 11:27:55 +02:00
Tom Payne
332fd250b4 Cache array length in ol.Collection 2013-04-20 11:27:44 +02:00
Tom Payne
f047e5f6bd Cache array length in ol.Attribution 2013-04-20 11:27:32 +02:00
Tom Payne
7979726327 Avoid creating an ol.Size object 2013-04-19 20:52:40 +02:00
Tom Payne
d964bbc605 Use for loop instead of forEach in WebGL tile layer renderer 2013-04-19 20:41:54 +02:00
Tom Payne
f5611d6cd6 Use for loop instead of forEach in WebGL map renderer 2013-04-19 20:29:24 +02:00
Tom Payne
388e530420 Use for loop instead of forEach in DOM map renderer 2013-04-19 20:22:20 +02:00
Tom Payne
fe5c8a97d4 Add ol.renderer.Map#getLayerRendererByKey 2013-04-19 20:22:01 +02:00
Tom Payne
37d3f7b4c1 Use for loop instead of forEach in canvas map renderer 2013-04-19 20:12:11 +02:00
Tom Payne
72767f5d17 Merge pull request #555 from twpayne/extent-as-array
ol.Extent as Array.<number>
2013-04-19 08:41:19 -07:00
Tom Payne
965776160f Merge pull request #569 from twpayne/define-properties-in-constructor
Define properties in constructor
2013-04-19 01:21:34 -07:00
Tom Payne
a642868cfa Port examples to new extents 2013-04-19 10:03:36 +02:00
Tom Payne
f81658f542 Port parsers to new extents 2013-04-19 10:03:36 +02:00
Tom Payne
953f9c2e7a Port ol.geom to new extents 2013-04-19 10:03:36 +02:00
Tom Payne
01168e805a Port ol.filter.ExtentFilter to new extents 2013-04-19 10:03:35 +02:00
Tom Payne
a413f3046a Port interactions to new extents 2013-04-19 10:03:35 +02:00
Tom Payne
1d4eaf6824 Port ol.structs.RTree to new extents 2013-04-19 10:03:35 +02:00
Tom Payne
305089d84f Port ol.renderer.webgl to new extents 2013-04-19 10:03:35 +02:00
Tom Payne
10d1be695d Port ol.renderer.dom to new extents 2013-04-19 10:03:35 +02:00
Tom Payne
465e24cf4e Port ol.renderer.canvas to new extents 2013-04-19 10:03:35 +02:00
Tom Payne
aff9f5dbf9 Port ol.source.SingleImageWMS to new extents 2013-04-19 10:03:35 +02:00
Tom Payne
583564e484 Port ol.source.StaticImage to new extents 2013-04-19 10:03:34 +02:00
Tom Payne
559e85bc76 Port ol.source.TiledWMS to new extents 2013-04-19 10:03:34 +02:00
Tom Payne
9708fb4ea6 Port ol.source.WMTS to new extents 2013-04-19 10:03:34 +02:00
Tom Payne
10354cf607 Port ol.source.WMS to new extents 2013-04-19 10:03:34 +02:00
Tom Payne
f0c812482f Port ol.source.TileJSON to new extents 2013-04-19 10:03:34 +02:00
Tom Payne
e868954d9c Port ol.source.TileSource to new extents 2013-04-19 10:03:34 +02:00
Tom Payne
c2ff8347d9 Port ol.source.BingMaps to new extents 2013-04-19 10:03:34 +02:00
Tom Payne
e50253e316 Port ol.projection to new extents 2013-04-19 09:32:12 +02:00
Tom Payne
9773314803 Port ol.View2D to new extents 2013-04-19 09:32:12 +02:00
Tom Payne
7d21bd8133 Port ol.Map to new extents 2013-04-19 09:32:12 +02:00
Tom Payne
ca8647c808 Port ol.tilegrid to new extents 2013-04-19 09:32:12 +02:00
Tom Payne
b4f7259c7f Port function types to new extents 2013-04-19 09:32:12 +02:00
Tom Payne
16f70ba1a0 Replace ol.Extent and ol.Rectangle with Array.<number> 2013-04-19 09:32:11 +02:00
Tom Payne
0da8b0ae7f Don't inherit ol.PixelBounds from ol.Rectangle 2013-04-19 09:32:11 +02:00
Tom Payne
1ad7765f2f Don't derive ol.TileRange from ol.Rectangle 2013-04-19 09:32:11 +02:00
Tom Payne
7d610bde7b Initialize all properties in constructor in interactions 2013-04-18 21:02:53 +02:00
Tom Payne
b24c46dd19 Initialize all properties in constructor in ol.Geolocation 2013-04-18 21:02:18 +02:00
Tom Payne
43cfc2a4cd Initialize all properties in constructor in controls 2013-04-18 21:01:58 +02:00
Tom Payne
d291d23092 ol.renderer.Layer no longer needs to inherit from ol.Object 2013-04-18 18:59:22 +02:00
Tom Payne
85a95a0036 Call render and requestRenderFrame directly instead of using changed events 2013-04-18 18:58:59 +02:00
Tom Payne
f274cc99f6 Don't call event handlers in constructor 2013-04-18 16:35:06 +02:00
408 changed files with 26497 additions and 4611 deletions

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

@@ -111,7 +111,9 @@ class Class(Exportable):
lines.append(' }\n')
lines.append(' goog.base(this, arg);\n')
lines.append('};\n')
lines.append('goog.inherits(%sExport, %s);\n' % (self.name, self.name))
lines.append('goog.inherits(\n')
lines.append(' %sExport,\n' % (self.name,));
lines.append(' %s);\n' % (self.name,));
lines.append('goog.exportSymbol(\n')
lines.append(' \'%s\',\n' % (self.name,))
lines.append(' %s);\n' % (self.export_name(),))
@@ -276,7 +278,7 @@ def main(argv):
components = m.group('name').split('.')
if re.match(r'[A-Z]', components[-1]):
requires.add(name)
elif len(components) > 2:
elif len(components) > 1:
requires.add('.'.join(components[:-1]))
continue
raise RuntimeError(line)

View File

@@ -65,12 +65,19 @@
}
}
// CLOSURE_NO_DEPS has an effect in "raw" and "whitespace" modes only (i.e.
// when COMPILED is false). In "raw" mode we use our own deps file
// (ol-deps.js), so we set CLOSURE_NO_DEPS to true to prevent Google
// Library's base.js script to load deps.js. In "whitespace" mode
// no deps file is needed at all, yet base.js will attempt to load deps.js
// if CLOSURE_NO_DEPS is not set to true.
window.CLOSURE_NO_DEPS = true;
var scriptId = encodeURIComponent(scriptParams.id);
document.write('<link rel="stylesheet" href="../build/ol.css" type="text/css">');
if (mode != 'raw') {
document.write('<scr' + 'ipt type="text/javascript" src="../build/' + oljs + '"></scr' + 'ipt>');
} else {
window.CLOSURE_NO_DEPS = true; // we've got our own deps file
document.write('<scr' + 'ipt type="text/javascript" src="../closure-library/closure/goog/base.js"></scr' + 'ipt>');
document.write('<scr' + 'ipt type="text/javascript" src="../build/ol-deps.js"></scr' + 'ipt>');
document.write('<scr' + 'ipt type="text/javascript" src="' + scriptId + '-require.js"></scr' + 'ipt>');

View File

@@ -309,8 +309,10 @@ def examples_star_json(name, match):
'../externs/bingmaps.js',
'../externs/bootstrap.js',
'../externs/geojson.js',
'../externs/oli.js',
'../externs/proj4js.js',
'../externs/tilejson.js',
'../externs/w3c_device_sensor_event.js',
],
})
with open(t.name, 'w') as f:
@@ -332,8 +334,7 @@ def examples_star_combined_js(name, match):
return Target(name, action=action, dependencies=dependencies)
@target('serve', PLOVR_JAR, INTERNAL_SRC, 'build/test/requireall.js',
'examples')
@target('serve', PLOVR_JAR, 'test-deps', 'examples')
def serve(t):
t.run('%(JAVA)s', '-jar', PLOVR_JAR, 'serve', 'buildcfg/ol.json',
'buildcfg/ol-all.json', EXAMPLES_JSON, 'buildcfg/test.json')
@@ -345,19 +346,35 @@ def serve_precommit(t):
'buildcfg/ol-all.json', 'buildcfg/test.json')
virtual('lint', 'build/lint-timestamp', 'build/check-requires-timestamp',
'build/check-whitespace-timestamp')
virtual('lint', 'build/lint-timestamp', 'build/lint-generated-timestamp',
'build/check-requires-timestamp', 'build/check-whitespace-timestamp')
@target('build/lint-timestamp', SRC, INTERNAL_SRC, EXTERNAL_SRC, EXAMPLES_SRC,
SPEC, precious=True)
@target('build/lint-timestamp', SRC, EXAMPLES_SRC, SPEC, precious=True)
def build_lint_src_timestamp(t):
t.run('%(GJSLINT)s',
'--jslint_error=all',
'--strict',
t.newer(t.dependencies))
t.touch()
@target('build/lint-generated-timestamp', INTERNAL_SRC, EXTERNAL_SRC,
precious=True)
def build_lint_generated_timestamp(t):
limited_doc_files = [
path
for path in ifind('externs', 'build/src/external/externs')
if path.endswith('.js')]
t.run('%(GJSLINT)s', '--strict', '--limited_doc_files=%s' %
(','.join(limited_doc_files),), t.newer(t.dependencies))
t.run('%(GJSLINT)s',
'--jslint_error=all',
# ignore error for max line length (for these auto-generated sources)
'--disable=110',
# for a complete list of error codes to allow, see
# http://closure-linter.googlecode.com/svn/trunk/closure_linter/errors.py
'--limited_doc_files=%s' % (','.join(limited_doc_files),),
'--strict',
t.newer(t.dependencies))
t.touch()
@@ -477,6 +494,7 @@ def build_check_requires_timestamp(t):
provides = set()
requires = set()
uses = set()
uses_linenos = {}
for lineno, line in _strip_comments(open(filename)):
m = re.match(r'goog.provide\(\'(.*)\'\);', line)
if m:
@@ -491,6 +509,7 @@ def build_check_requires_timestamp(t):
m = provide_re.search(line)
if m:
uses.add(m.group())
uses_linenos[m.group()] = lineno
line = line[:m.start()] + line[m.end():]
break
else:
@@ -504,9 +523,10 @@ def build_check_requires_timestamp(t):
uses.discard('ol.renderer.%s.Map' % (m.group(1),))
missing_requires = uses - requires - provides
if missing_requires:
t.info('%s: missing goog.requires: %s', filename, ', '.join(
sorted(missing_requires)))
missing_count += len(missing_requires)
for missing_require in sorted(missing_requires):
t.info("%s:%d missing goog.require('%s')" %
(filename, uses_linenos[missing_require], missing_require))
missing_count += 1
if unused_count or missing_count:
t.error('%d unused goog.requires, %d missing goog.requires' %
(unused_count, missing_count))
@@ -554,20 +574,6 @@ 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))
@@ -576,7 +582,7 @@ virtual('doc', 'build/jsdoc-%(BRANCH)s-timestamp' % vars(variables))
SRC, SHADER_SRC, ifind('doc/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')
'-d', 'build/hosted/%(BRANCH)s/apidoc')
t.touch()
@@ -614,15 +620,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)
@@ -637,25 +643,25 @@ 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] + \
@@ -682,7 +688,10 @@ def proj4js_zip(t):
t.info('downloaded %r', t.name)
@target('test', INTERNAL_SRC, PROJ4JS, 'build/test/requireall.js', phony=True)
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')

View File

@@ -42,19 +42,64 @@
"//json.js",
"../externs/bingmaps.js",
"../externs/geojson.js",
"../externs/oli.js",
"../externs/proj4js.js",
"../externs/tilejson.js"
"../externs/tilejson.js",
"../externs/w3c_device_sensor_event.js"
],
"level": "VERBOSE",
"mode": "ADVANCED",
"name-suffixes-to-strip": [
"logger",
"logger_"
],
"paths": [
"../build/src/internal/src",
"../src"
],
"treat-warnings-as-errors": false
"treat-warnings-as-errors": false,
"type-prefixes-to-strip": [
"goog.asserts",
"goog.debug.Console",
"goog.debug.DebugWindow",
"goog.debug.DevCss",
"goog.debug.DivConsole",
"goog.debug.EntryPointMonitor",
"goog.debug.ErrorHandler",
"goog.debug.ErrorReporter",
"goog.debug.FancyWindow",
"goog.debug.Formatter",
"goog.debug.FpsDisplay",
"goog.debug.GcDiagnostics",
"goog.debug.HtmlFormatter",
"goog.debug.LogBuffer",
"goog.debug.LogManager",
"goog.debug.LogRecord",
"goog.debug.Logger",
"goog.debug.RelativeTimeProvider",
"goog.debug.TextFormatter",
"goog.debug.Trace",
"goog.debug.catchErrors",
"goog.debug.deepExpose",
"goog.debug.enhanceError",
"goog.debug.entryPointRegistry",
"goog.debug.errorHandlerWeakDep",
"goog.debug.expose",
"goog.debug.exposeArray",
"goog.debug.exposeException",
"goog.debug.getFunctionName",
"goog.debug.getStacktrace",
"goog.debug.getStacktraceSimple",
"goog.debug.logRecordSerializer",
"goog.debug.makeWhitespaceVisible",
"goog.debug.normalizeErrorObject",
"goog.debug.reflect"
]
}

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,21 +1,27 @@
.ol-attribution {
position: absolute;
font-size: 10px;
text-align: right;
color: #eeeeee;
bottom: 0;
right: 0;
background: rgba(0,60,136,0.3);
font-family: 'Lucida Grande',Verdana,Geneva,Lucida,Arial,Helvetica,sans-serif;
padding: 2px 4px;
padding: 6px;
}
.ol-attribution a {
color: white;
text-decoration: none;
}
.ol-attribution ul {
margin: 0;
padding: 0;
font-size: 10px;
line-height: 12px;
}
.ol-attribution li {
display: inline;
list-style: none;
line-height: inherit;
}
.ol-attribution li:not(:last-child):after {
content: "\2003";
@@ -81,6 +87,13 @@ a.ol-full-screen-true:after {
display: inline;
list-style: none;
}
.ol-mouse-position {
top: 8px;
right: 8px;
position: absolute;
}
.ol-scale-line {
background: rgba(0,60,136,0.3);
border-radius: 4px;

View File

@@ -1,5 +1,5 @@
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.

View File

@@ -30,22 +30,27 @@
<div class="row-fluid">
<div class="span12">
<div id="map" class="map"></div>
<button id="rotate-left"><i class="icon-arrow-left"></i></button>
<button>Rotate</button>
<button id="rotate-right"><i class="icon-arrow-right"></i></button>
</div>
</div>
<div class="row-fluid">
<div class="span12">
<button id="rotate-left"><i class="icon-arrow-left"></i></button>
<button id="rotate-right"><i class="icon-arrow-right"></i></button>
<button id="pan-to-london">Pan to London</button>
<button id="elastic-to-moscow">Elastic to Moscow</button>
<button id="bounce-to-istanbul">Bounce to Istanbul</button>
<button id="spin-to-rome">Spin to Rome</button>
<button id="fly-to-bern">Fly to Bern</button>
<button id="spiral-to-madrid">Spiral to Madrid</button>
</div>
</div>
<div class="row-fluid">
<div class="span4">
<div class="span12">
<h4 id="title">Animation example</h4>
<p id="shortdesc">Example animations.</p>
<p id="shortdesc">Demonstrates animated pan, zoom, and rotation.</p>
<div id="docs">
<p>See the <a href="animation.js" target="_blank">animation.js source</a> to see how this is done.</p>
</div>

View File

@@ -4,20 +4,16 @@ goog.require('ol.View2D');
goog.require('ol.animation');
goog.require('ol.easing');
goog.require('ol.layer.TileLayer');
goog.require('ol.projection');
goog.require('ol.proj');
goog.require('ol.source.OSM');
var london = ol.projection.transform(
[-0.12755, 51.507222], 'EPSG:4326', 'EPSG:3857');
var moscow = ol.projection.transform(
[37.6178, 55.7517], 'EPSG:4326', 'EPSG:3857');
var istanbul = ol.projection.transform(
[28.9744, 41.0128], 'EPSG:4326', 'EPSG:3857');
var rome = ol.projection.transform(
[12.5, 41.9], 'EPSG:4326', 'EPSG:3857');
var bern = ol.projection.transform(
[7.4458, 46.95], 'EPSG:4326', 'EPSG:3857');
var london = ol.proj.transform([-0.12755, 51.507222], 'EPSG:4326', 'EPSG:3857');
var moscow = ol.proj.transform([37.6178, 55.7517], 'EPSG:4326', 'EPSG:3857');
var istanbul = ol.proj.transform([28.9744, 41.0128], 'EPSG:4326', 'EPSG:3857');
var rome = ol.proj.transform([12.5, 41.9], 'EPSG:4326', 'EPSG:3857');
var bern = ol.proj.transform([7.4458, 46.95], 'EPSG:4326', 'EPSG:3857');
var madrid = ol.proj.transform([-3.683333, 40.4], 'EPSG:4326', 'EPSG:3857');
var view = new ol.View2D({
// the view's initial state
@@ -37,7 +33,6 @@ var map = new ol.Map({
view: view
});
var rotateLeft = document.getElementById('rotate-left');
rotateLeft.addEventListener('click', function() {
var rotateLeft = ol.animation.rotate({
@@ -123,3 +118,26 @@ flyToBern.addEventListener('click', function() {
map.addPreRenderFunctions([pan, bounce]);
view.setCenter(bern);
}, false);
var spiralToMadrid = document.getElementById('spiral-to-madrid');
spiralToMadrid.addEventListener('click', function() {
var duration = 2000;
var start = +new Date();
var pan = ol.animation.pan({
duration: duration,
source: view.getCenter(),
start: start
});
var bounce = ol.animation.bounce({
duration: duration,
resolution: 2 * view.getResolution(),
start: start
});
var rotate = ol.animation.rotate({
duration: duration,
rotation: -4 * Math.PI,
start: start
});
map.addPreRenderFunctions([pan, bounce, rotate]);
view.setCenter(madrid);
}, false);

View File

@@ -37,7 +37,7 @@
<div class="span4">
<h4 id="title">Bind HTML input example</h4>
<p id="shortdesc">Bind an HTML input to an ol object.</p>
<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>
@@ -71,7 +71,8 @@
<legend>View</legend>
<label>rotation</label>
<input id="rotation" type="range" min="-3.141592653589793" max="3.141592653589793" step="0.01"/>
</fieldset>
<label>resolution</label>
<input id="resolution" type="number" min="0" step="250"/>
</fieldset>
</form>
</div>

View File

@@ -39,3 +39,6 @@ brightness.bindTo('value', layer, 'brightness');
var rotation = new ol.dom.Input(document.getElementById('rotation'));
rotation.bindTo('value', map.getView(), 'rotation');
var resolution = new ol.dom.Input(document.getElementById('resolution'));
resolution.bindTo('value', map.getView(), 'resolution');

View File

@@ -41,7 +41,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">

View File

@@ -2,7 +2,7 @@ goog.require('ol.Map');
goog.require('ol.RendererHints');
goog.require('ol.View2D');
goog.require('ol.layer.TileLayer');
goog.require('ol.projection');
goog.require('ol.proj');
goog.require('ol.source.BingMaps');
@@ -23,7 +23,7 @@ var map = new ol.Map({
renderers: ol.RendererHints.createFromQueryData(),
target: 'map',
view: new ol.View2D({
center: ol.projection.transform([-123.1, 49.25], 'EPSG:4326', 'EPSG:3857'),
center: ol.proj.transform([-123.1, 49.25], 'EPSG:4326', 'EPSG:3857'),
zoom: 8
})
});

View File

@@ -8,6 +8,14 @@
<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>Brightness/contrast example</title>
<style>
#reset-brightness {
min-width: 138px;
}
#reset-contrast {
min-width: 120px;
}
</style>
</head>
<body>
@@ -45,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">

View File

@@ -20,27 +20,46 @@ var map = new ol.Map({
});
var increaseBrightness = document.getElementById('increase-brightness');
increaseBrightness.addEventListener('click', function() {
layer.setBrightness(layer.getBrightness() + 0.125);
}, false);
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);
var decreaseBrightness = document.getElementById('decrease-brightness');
decreaseBrightness.addEventListener('click', function() {
layer.setBrightness(layer.getBrightness() - 0.125);
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);
setResetContrastButtonHTML();
}, false);
var resetContrast = document.getElementById('reset-contrast');
resetContrast.addEventListener('click', function() {
layer.setContrast(1);
setResetContrastButtonHTML();
}, false);
var decreaseContrast = document.getElementById('decrease-contrast');
decreaseContrast.addEventListener('click', function() {
layer.setContrast(layer.getContrast() - 0.125);
layer.setContrast(Math.max(layer.getContrast() - 0.125, 0));
setResetContrastButtonHTML();
}, false);

View File

@@ -35,10 +35,11 @@
<div class="row-fluid">
<div class="span4">
<div class="span12">
<h4 id="title">Canvas tiles example</h4>
<p id="shortdesc">The black grid tiles are generated on the client with an HTML5 canvas. Note that the tile coordinates are ol3 normalized tile coordinates (origin bottom left), not OSM tile coordinates (origin top left).</p>
<p id="shortdesc">Renders tiles with coordinates for debugging.</p>
<div id="docs">
<p>The black grid tiles are generated on the client with an HTML5 canvas. Note that the tile coordinates are ol3 normalized tile coordinates (origin bottom left), not OSM tile coordinates (origin top left).</p>
<p>See the <a href="canvas-tiles.js" target="_blank">canvas-tiles.js source</a> to see how this is done.</p>
</div>
<div id="tags">layers, openstreetmap, canvas</div>

View File

@@ -2,7 +2,7 @@ goog.require('ol.Map');
goog.require('ol.RendererHints');
goog.require('ol.View2D');
goog.require('ol.layer.TileLayer');
goog.require('ol.projection');
goog.require('ol.proj');
goog.require('ol.source.DebugTileSource');
goog.require('ol.source.OSM');
goog.require('ol.tilegrid.XYZ');
@@ -25,7 +25,7 @@ var map = new ol.Map({
renderers: ol.RendererHints.createFromQueryData(),
target: 'map',
view: new ol.View2D({
center: ol.projection.transform(
center: ol.proj.transform(
[-0.1275, 51.507222], 'EPSG:4326', 'EPSG:3857'),
zoom: 10
})

View File

@@ -0,0 +1,94 @@
<!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 type="text/css">
.zoom-extent {
position: absolute;
top: 65px;
left: 8px;
background: rgba(255,255,255,0.4);
border-radius: 4px;
padding: 2px;
}
.zoom-extent a {
display: block;
margin: 1px;
padding: 0;
color: white;
font-size: 18px;
font-family: 'Lucida Grande',Verdana,Geneva,Lucida,Arial,Helvetica,sans-serif;
font-weight: bold;
text-decoration: none;
text-align: center;
height: 22px;
width: 22px;
line-height: 19px;
background: rgba(0,60,136,0.5);
}
.zoom-extent 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>
<body>
<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>
</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="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.
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">
custom, control
</div>
</div>
</div>
</div>
<script src="loader.js?id=custom-controls" type="text/javascript"></script>
<script src="../resources/social-links.js" type="text/javascript"></script>
</body>
</html>

109
examples/custom-controls.js Normal file
View File

@@ -0,0 +1,109 @@
goog.require('ol');
goog.require('ol.Map');
goog.require('ol.RendererHints');
goog.require('ol.View2D');
goog.require('ol.control.Control');
goog.require('ol.control.defaults');
goog.require('ol.layer.TileLayer');
goog.require('ol.source.OSM');
/**
* Define a namespace for the application.
*/
window.app = {};
var app = window.app;
//
// Define zoom extent control.
//
/**
* @constructor
* @extends {ol.control.Control}
* @param {Object=} opt_options Control options.
*/
app.ZoomExtentControl = function(opt_options) {
var options = opt_options || {};
this.extent_ = options.extent;
var anchor = document.createElement('a');
anchor.href = '#zoom-to';
anchor.className = 'zoom-to';
var this_ = this;
var handleZoomTo = function(e) {
this_.handleZoomTo(e);
};
anchor.addEventListener('click', handleZoomTo, false);
anchor.addEventListener('touchstart', handleZoomTo, false);
var element = document.createElement('div');
element.className = 'zoom-extent 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();
}
};
//
// Create map, giving it a zoom extent control.
//
var map = new ol.Map({
controls: ol.control.defaults({}, [
new app.ZoomExtentControl({
extent: [813079.7791264898, 848966.9639063801,
5929220.284081122, 5936863.986909639]
})
]),
layers: [
new ol.layer.TileLayer({
source: new ol.source.OSM()
})
],
renderers: ol.RendererHints.createFromQueryData(),
target: 'map',
view: new ol.View2D({
center: [0, 0],
zoom: 2
})
});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

1073
examples/data/gpx/yahoo.xml Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

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="../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>Device-Orientation example</title>
</head>
<body>
<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>
</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="span12">
<h4 id="title">Device orientation example</h4>
<label class="checkbox" for="track">
<input id="track" type="checkbox"/>track changes
</label>
<p>&alpha; : <code id="alpha"></code></p>
<p>&beta; : <code id="beta"></code></p>
<p>&gamma; : <code id="gamma"></code></p>
<p>heading : <code id="heading"></code></p>
<p id="shortdesc">Listen to DeviceOrientation events</p>
<div id="docs">
<p>See the <a href="device-orientation.js" target="_blank">device-orientation.js source</a> to see how this is done.</p>
</div>
<div id="tags">orientation, openstreetmap</div>
</div>
</div>
</div>
<script src="loader.js?id=device-orientation" type="text/javascript"></script>
<script src="../resources/social-links.js" type="text/javascript"></script>
</body>
</html>

View File

@@ -0,0 +1,46 @@
goog.require('ol.DeviceOrientation');
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.source.OSM');
var map = new ol.Map({
layers: [
new ol.layer.TileLayer({
source: new ol.source.OSM()
})
],
renderers: ol.RendererHints.createFromQueryData(),
target: 'map',
view: new ol.View2D({
center: [0, 0],
zoom: 2
})
});
var view = map.getView();
var deviceOrientation = new ol.DeviceOrientation();
var track = new ol.dom.Input(document.getElementById('track'));
track.bindTo('checked', deviceOrientation, 'tracking');
deviceOrientation.on('change', function(event) {
document.getElementById('alpha').innerHTML = event.target.getAlpha();
document.getElementById('beta').innerHTML = event.target.getBeta();
document.getElementById('gamma').innerHTML = event.target.getGamma();
document.getElementById('heading').innerHTML = event.target.getHeading();
});
// tilt the map
deviceOrientation.on(['change:beta', 'change:gamma'], function(event) {
var center = view.getCenter();
var resolution = view.getResolution();
var beta = event.target.getBeta() || 0;
var gamma = event.target.getGamma() || 0;
center[0] -= resolution * gamma * 25;
center[1] += resolution * beta * 25;
view.setCenter(center);
});

View File

@@ -0,0 +1,56 @@
<!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">
<title>Drag rotate and zoom example</title>
</head>
<body>
<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>
</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="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">
<p><code>Shift</code> + Drag to rotate and zoom the map around its center.</p>
<p>See the <a href="drag-rotate-and-zoom.js" target="_blank">drag-rotate-and-zoom.js source</a> to see how this is done.</p>
</div>
<div id="tags">drag, rotate, zoom, interaction</div>
</div>
</div>
</div>
<script src="loader.js?id=drag-rotate-and-zoom" type="text/javascript"></script>
<script src="../resources/social-links.js" type="text/javascript"></script>
</body>
</html>

View File

@@ -0,0 +1,25 @@
goog.require('ol.Map');
goog.require('ol.RendererHints');
goog.require('ol.View2D');
goog.require('ol.interaction.DragRotateAndZoom');
goog.require('ol.interaction.defaults');
goog.require('ol.layer.TileLayer');
goog.require('ol.source.MapQuestOpenAerial');
var map = new ol.Map({
interactions: ol.interaction.defaults({}, [
new ol.interaction.DragRotateAndZoom()
]),
layers: [
new ol.layer.TileLayer({
source: new ol.source.MapQuestOpenAerial()
})
],
renderers: ol.RendererHints.createFromQueryData(),
target: 'map',
view: new ol.View2D({
center: [0, 0],
zoom: 2
})
});

View File

@@ -35,7 +35,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">

View File

@@ -37,7 +37,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">

View File

@@ -0,0 +1,68 @@
<!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>
.map:-moz-full-screen {
height: 100%;
}
.map:-webkit-full-screen {
height: 100%;
}
.map:full-screen {
height: 100%;
}
</style>
<title>Full screen drag rotate and zoom example</title>
</head>
<body>
<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>
</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="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">
<p>Hold down <code>Shift</code> + drag to rotate and zoom. Click the button in the top right corner to go full screen. Then do the <code>Shift</code> + drag thing again.</p>
<p>If there is no button on the map, your browser does not support the <a href="http://caniuse.com/#feat=fullscreen">Full Screen API</a>.</p>
<p>See the <a href="full-screen-drag-rotate-and-zoom.js" target="_blank">full-screen-drag-rotate-and-zoom.js source</a> to see how this is done.</p>
</div>
<div id="tags">full-screen, drag, rotate, zoom, bing, bing-maps</div>
</div>
</div>
</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>
</body>
</html>

View File

@@ -0,0 +1,35 @@
goog.require('ol.Map');
goog.require('ol.RendererHint');
goog.require('ol.View2D');
goog.require('ol.control.FullScreen');
goog.require('ol.control.defaults');
goog.require('ol.interaction.DragRotateAndZoom');
goog.require('ol.interaction.defaults');
goog.require('ol.layer.TileLayer');
goog.require('ol.source.BingMaps');
var map = new ol.Map({
controls: ol.control.defaults({}, [
new ol.control.FullScreen()
]),
interactions: ol.interaction.defaults({}, [
new ol.interaction.DragRotateAndZoom()
]),
layers: [
new ol.layer.TileLayer({
source: new ol.source.BingMaps({
key: 'AlQLZ0-5yk301_ESrmNLma3LYxEKNSg7w-e_knuRfyYFtld-UFvXVs38NOulku3Q',
style: 'Aerial'
})
})
],
// Use the canvas renderer because it's currently the fastest
renderer: ol.RendererHint.CANVAS,
target: 'map',
view: new ol.View2D({
center: [-33519607, 5616436],
rotation: -Math.PI / 8,
zoom: 8
})
});

View File

@@ -46,11 +46,12 @@
<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. Click the control in the top right corner to go full screen. Click it again to exit full screen.</p>
<p>If there is no button on the map, your browser does not support the <a href="http://caniuse.com/#feat=fullscreen">Full Screen API</a>.</p>
<p id="shortdesc">Example of a full screen control.</p>
<div id="docs">
<p>Click the control in the top right corner to go full screen. Click it again to exit full screen.</p>
<p>If there is no button on the map, your browser does not support the <a href="http://caniuse.com/#feat=fullscreen">Full Screen API</a>.</p>
<p>See the <a href="full-screen.js" target="_blank">full-screen.js source</a> to see how this is done.</p>
</div>
<div id="tags">full-screen, bing, bing-maps</div>

View File

@@ -12,6 +12,9 @@
font-size: 22px;
text-shadow: 2px 2px 3px #013;
}
.tooltip-inner {
white-space: nowrap;
}
</style>
<title>Geolocation example</title>
</head>
@@ -41,16 +44,25 @@
<div class="row-fluid">
<div class="span4">
<div class="span12">
<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">
<div id="info" class="alert alert-error" style="display: none;"></div>
</div>
</div>

View File

@@ -3,6 +3,7 @@ goog.require('ol.Map');
goog.require('ol.Overlay');
goog.require('ol.RendererHints');
goog.require('ol.View2D');
goog.require('ol.dom.Input');
goog.require('ol.layer.TileLayer');
goog.require('ol.source.OSM');
@@ -24,6 +25,17 @@ 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))
@@ -31,12 +43,13 @@ var marker = new ol.Overlay({
// bind the marker position to the device location.
marker.bindTo('position', geolocation);
geolocation.addEventListener('accuracy_changed', function() {
geolocation.on('change:accuracy', function() {
$(marker.getElement()).tooltip({
title: this.getAccuracy() + 'm from this point'
});
});
$('#locate').click(function() {
geolocation.setTracking(true);
geolocation.on('error', function(error) {
var info = document.getElementById('info');
info.innerHTML = error.message;
info.style.display = '';
});

55
examples/gml.html Normal file
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="../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>GML example</title>
</head>
<body>
<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>
</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="span12">
<h4 id="title">GML example</h4>
<p id="shortdesc">Example of using the GML parser.</p>
<div id="docs">
<p>See the <a href="gml.js" target="_blank">gml.js source</a> to see how this is done.</p>
</div>
<div id="tags">GML</div>
</div>
</div>
</div>
<script src="loader.js?id=gml" type="text/javascript"></script>
<script src="../resources/social-links.js" type="text/javascript"></script>
</body>
</html>

60
examples/gml.js Normal file
View File

@@ -0,0 +1,60 @@
goog.require('ol.Map');
goog.require('ol.RendererHint');
goog.require('ol.View2D');
goog.require('ol.layer.TileLayer');
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.Style');
var raster = new ol.layer.TileLayer({
source: new ol.source.MapQuestOpenAerial()
});
var vector = new ol.layer.Vector({
source: new ol.source.Vector({
projection: ol.proj.get('EPSG:4326')
}),
style: new ol.style.Style({rules: [
new ol.style.Rule({
symbolizers: [
new ol.style.Polygon({
strokeColor: '#bada55'
})
]
})
]})
});
var map = new ol.Map({
layers: [raster, vector],
renderer: ol.RendererHint.CANVAS,
target: 'map',
view: new ol.View2D({
center: [-10997171.194994785, 5206335.565590534],
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();

59
examples/gpx.html Normal file
View File

@@ -0,0 +1,59 @@
<!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">
<title>GPX example</title>
</head>
<body>
<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>
</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">GPX example</h4>
<p id="shortdesc">Example of using the GPX parser.</p>
<div id="docs">
<p>See the <a href="gpx.js" target="_blank">gpx.js source</a> to see how this is done.</p>
</div>
<div id="tags">GPX</div>
</div>
<div class="span4 offset4">
<div id="info" class="alert alert-success">
&nbsp;
</div>
</div>
</div>
</div>
<script src="loader.js?id=gpx" type="text/javascript"></script>
<script src="../resources/social-links.js" type="text/javascript"></script>
</body>
</html>

65
examples/gpx.js Normal file
View File

@@ -0,0 +1,65 @@
goog.require('ol.Map');
goog.require('ol.RendererHint');
goog.require('ol.View2D');
goog.require('ol.layer.TileLayer');
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({
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(', ');
}
});
var map = new ol.Map({
layers: [raster, vector],
renderer: ol.RendererHint.CANVAS,
target: 'map',
view: new ol.View2D({
center: [-7916461.9312699, 5226343.9091441],
zoom: 11
})
});
map.on(['click', 'mousemove'], function(evt) {
map.getFeatureInfo({
pixel: evt.getPixel(),
layers: [vector],
success: function(featureInfo) {
document.getElementById('info').innerHTML = featureInfo[0] || '&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

@@ -8,6 +8,14 @@
<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>Hue/saturation example</title>
<style>
#reset-hue {
min-width: 90px;
}
#reset-saturation {
min-width: 124px;
}
</style>
</head>
<body>
@@ -45,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">

View File

@@ -2,7 +2,7 @@ goog.require('ol.Map');
goog.require('ol.RendererHint');
goog.require('ol.View2D');
goog.require('ol.layer.TileLayer');
goog.require('ol.projection');
goog.require('ol.proj');
goog.require('ol.source.BingMaps');
@@ -18,34 +18,52 @@ var map = new ol.Map({
renderer: ol.RendererHint.WEBGL,
target: 'map',
view: new ol.View2D({
center: ol.projection.transform(
[-9.375, 51.483333], 'EPSG:4326', 'EPSG:3857'),
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);
var resetHue = document.getElementById('reset-hue');
resetHue.addEventListener('click', function() {
layer.setHue(0);
setResetHueButtonHTML();
}, false);
var decreaseHue = document.getElementById('decrease-hue');
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);
setResetSaturationButtonHTML();
}, false);
var resetSaturation = document.getElementById('reset-saturation');
resetSaturation.addEventListener('click', function() {
layer.setSaturation(1);
setResetSaturationButtonHTML();
}, false);
var decreaseSaturation = document.getElementById('decrease-saturation');
decreaseSaturation.addEventListener('click', function() {
layer.setSaturation(layer.getSaturation() - 0.25);
layer.setSaturation(Math.max(layer.getSaturation() - 0.25, 0));
setResetSaturationButtonHTML();
}, false);

View File

@@ -0,0 +1,68 @@
<!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">
<title>Timezones in KML</title>
<style>
#map {
position: relative;
}
#info {
position: absolute;
height: 1px;
width: 1px;
z-index: 100;
}
</style>
</head>
<body>
<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>
</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">Timezones in KML</h4>
<p id="shortdesc">Demonstrates rendering timezones from KML.</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 fills timezones yellow with an opacity calculated based on the current offset to local noon.</p>
<p>See the <a href="kml-timezones.js" target="_blank">kml-timezones.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-timezones" type="text/javascript"></script>
<script src="../resources/social-links.js" type="text/javascript"></script>
</body>
</html>

123
examples/kml-timezones.js Normal file
View File

@@ -0,0 +1,123 @@
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.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.Style');
/**
* Register a function to be used in a symbolizer. Here we want the opacity
* of polygons to be based on the offset from local noon. For example, a
* timezone where it is currently noon would have an opacity of 0.75. And a
* timezone where it is currently midnight would have an opacity of 0. This
* doesn't account for daylight savings, so don't use it to plan your vacation.
*/
ol.expr.register('getOpacity', function() {
var feature = this;
var offset = 0;
var name = feature.get('name'); // e.g. GMT -08:30
var match = name.match(/([-+]\d{2}):(\d{2})$/);
if (match) {
var hours = parseInt(match[1], 10);
var minutes = parseInt(match[2], 10);
offset = 60 * hours + minutes;
}
var date = new Date();
var local = new Date(date.getTime() +
(date.getTimezoneOffset() + offset) * 60000);
// offset from local noon (in hours)
var delta = Math.abs(12 - local.getHours() + (local.getMinutes() / 60));
if (delta > 12) {
delta = 24 - delta;
}
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 vector = new ol.layer.Vector({
source: new ol.source.Vector({
projection: ol.proj.get('EPSG:4326')
}),
style: style
});
var raster = new ol.layer.TileLayer({
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');
}
}
});
});
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

@@ -43,12 +43,16 @@
</div>
<div id="tags">KML</div>
</div>
<div class="span4 offset4">
<div id="info" class="alert alert-success">
&nbsp;
</div>
</div>
</div>
</div>
<script src="jquery.min.js" type="text/javascript"></script>
<script src="loader.js?id=kml" type="text/javascript"></script>
<script src="../resources/social-links.js" type="text/javascript"></script>

View File

@@ -1,11 +1,10 @@
goog.require('ol.Collection');
goog.require('ol.Map');
goog.require('ol.RendererHint');
goog.require('ol.View2D');
goog.require('ol.layer.TileLayer');
goog.require('ol.layer.Vector');
goog.require('ol.parser.KML');
goog.require('ol.projection');
goog.require('ol.proj');
goog.require('ol.source.TiledWMS');
goog.require('ol.source.Vector');
@@ -21,16 +20,23 @@ var raster = new ol.layer.TileLayer({
})
});
var epsg4326 = ol.projection.get('EPSG:4326');
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(', ');
}
});
var map = new ol.Map({
layers: new ol.Collection([raster, vector]),
layers: [raster, vector],
renderer: ol.RendererHint.CANVAS,
target: 'map',
view: new ol.View2D({
@@ -43,8 +49,28 @@ var map = new ol.Map({
var kml = new ol.parser.KML({
maxDepth: 1, dimension: 2, extractStyles: true, extractAttributes: true});
$.ajax({
url: 'data/kml/lines.kml'
}).done(function(data) {
vector.parseFeatures(data, kml, epsg4326);
map.on(['click', 'mousemove'], function(evt) {
map.getFeatureInfo({
pixel: evt.getPixel(),
layers: [vector],
success: function(featureInfo) {
document.getElementById('info').innerHTML = featureInfo[0] || '&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();

View File

@@ -8,7 +8,7 @@
*
* * 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) {

View File

@@ -35,7 +35,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">

View File

@@ -35,7 +35,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">

View File

@@ -2,7 +2,7 @@ goog.require('ol.Map');
goog.require('ol.RendererHints');
goog.require('ol.View2D');
goog.require('ol.layer.TileLayer');
goog.require('ol.projection');
goog.require('ol.proj');
goog.require('ol.source.MapQuestOSM');
@@ -15,7 +15,7 @@ var map = new ol.Map({
renderers: ol.RendererHints.createFromQueryData(),
target: 'map',
view: new ol.View2D({
center: ol.projection.transform(
center: ol.proj.transform(
[139.6917, 35.689506], 'EPSG:4326', 'EPSG:3857'),
zoom: 9
})

View File

@@ -0,0 +1,27 @@
<!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">
<title>Mobile full screen example</title>
<style type="text/css">
html, body, .map {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
}
</style>
</head>
<body>
<div id="map" class="map"></div>
<script src="loader.js?id=mobile-full-screen" type="text/javascript"></script>
<div style="display: none;">
<div id="title">Mobile full screen example</div>
<div id="shortdesc">Example of a full screen map.</div>
<div id="tags">fullscreen, bing, geolocation, mobile</div>
</div>
</body>
</html>

View File

@@ -0,0 +1,35 @@
goog.require('ol.Geolocation');
goog.require('ol.Map');
goog.require('ol.RendererHints');
goog.require('ol.View2D');
goog.require('ol.layer.TileLayer');
goog.require('ol.source.BingMaps');
var view = new ol.View2D({
center: [0, 0],
zoom: 2
});
var map = new ol.Map({
layers: [
new ol.layer.TileLayer({
source: new ol.source.BingMaps({
key: 'AlQLZ0-5yk301_ESrmNLma3LYxEKNSg7w-e_knuRfyYFtld-UFvXVs38NOulku3Q',
style: 'Road'
})
})
],
renderers: ol.RendererHints.createFromQueryData(),
target: 'map',
view: view
});
var geolocation = new ol.Geolocation({
tracking: true
});
geolocation.bindTo('projection', view);
geolocation.once('change:position', function() {
view.setCenter(geolocation.getPosition());
view.setResolution(2.388657133911758);
});

View File

@@ -30,21 +30,28 @@
<div class="row-fluid">
<div class="span12">
<div id="map" class="map"></div>
<small id="mouse-position"></small>
</div>
</div>
<div class="row-fluid">
<div class="span4">
<div class="span6">
<h4 id="title">Mouse position example</h4>
<p id="shortdesc">Example of a mouse position control, outside the map.</p>
<div id="docs">
<p>See the <a href="mouse-position.js" target="_blank">mouse-position.js source</a> to see how this is done.</p>
</div>
<div id="tags">mouse-position, openstreetmap</div>
<form>
<label>Projection </label>
<select id="projection">
<option value="EPSG:4326">EPSG:4326</option>
<option value="EPSG:3857">EPSG:3857</option>
</select>
<label>Precision </label>
<input id="precision" type="number" min="0" max="12" value="4"/>
</form>
</div>
<div class="span6" id="mouse-position">&nbsp;</div>
</div>
</div>

View File

@@ -4,19 +4,23 @@ goog.require('ol.View2D');
goog.require('ol.control.MousePosition');
goog.require('ol.control.defaults');
goog.require('ol.coordinate');
goog.require('ol.dom.Input');
goog.require('ol.layer.TileLayer');
goog.require('ol.proj');
goog.require('ol.source.OSM');
var map = new ol.Map({
controls: ol.control.defaults({}, [
new ol.control.MousePosition({
coordinateFormat: ol.coordinate.toStringHDMS,
var mousePositionControl = new ol.control.MousePosition({
coordinateFormat: ol.coordinate.createStringXY(4),
projection: 'EPSG:4326',
// comment the following two lines to have the mouse position
// be placed within the map.
className: 'custom-mouse-position',
target: document.getElementById('mouse-position'),
undefinedHTML: '&nbsp;'
})
]),
});
var map = new ol.Map({
controls: ol.control.defaults({}, [mousePositionControl]),
layers: [
new ol.layer.TileLayer({
source: new ol.source.OSM()
@@ -29,3 +33,14 @@ var map = new ol.Map({
zoom: 2
})
});
var projectionSelect = new ol.dom.Input(document.getElementById('projection'));
projectionSelect.on('change:value', function() {
mousePositionControl.setProjection(ol.proj.get(projectionSelect.getValue()));
});
var precisionInput = new ol.dom.Input(document.getElementById('precision'));
precisionInput.on('change:value', function() {
var format = ol.coordinate.createStringXY(precisionInput.getValue());
mousePositionControl.setCoordinateFormat(format);
});

View File

@@ -47,11 +47,12 @@
<div class="row-fluid">
<div class="span4">
<div class="span12">
<h4 id="title">Overlay example</h4>
<p id="shortdesc">Demonstrates overlays. The popups are created using
<a href="http://twitter.github.com/bootstrap/javascript.html#popovers">Popovers</a> from Bootstrap.</p>
<p id="shortdesc">Demonstrates overlays.</p>
<div id="docs">
<p>The popups are created using
<a href="http://twitter.github.com/bootstrap/javascript.html#popovers">Popovers</a> from Bootstrap.</p>
<p>See the <a href="overlay.js" target="_blank">overlay.js source</a> to see how this is done.</p>
</div>
<div id="tags">overlay, popup, bootstrap, popover, mapquest, openaerial</div>

View File

@@ -4,7 +4,7 @@ goog.require('ol.RendererHints');
goog.require('ol.View2D');
goog.require('ol.coordinate');
goog.require('ol.layer.TileLayer');
goog.require('ol.projection');
goog.require('ol.proj');
goog.require('ol.source.MapQuestOpenAerial');
@@ -25,7 +25,7 @@ var map = new ol.Map({
// Vienna label
var vienna = new ol.Overlay({
map: map,
position: ol.projection.transform(
position: ol.proj.transform(
[16.3725, 48.208889], 'EPSG:4326', 'EPSG:3857'),
element: document.getElementById('vienna')
});
@@ -38,7 +38,7 @@ var popup = new ol.Overlay({
map.on('click', function(evt) {
var element = popup.getElement();
var coordinate = evt.getCoordinate();
var hdms = ol.coordinate.toStringHDMS(ol.projection.transform(
var hdms = ol.coordinate.toStringHDMS(ol.proj.transform(
coordinate, 'EPSG:3857', 'EPSG:4326'));
$(element).popover('destroy');

View File

@@ -38,10 +38,11 @@
<div class="row-fluid">
<div class="span4">
<div class="span12">
<h4 id="title">Preload example</h4>
<p id="shortdesc">Example of tile preloading. Low resolution tiles for the map are preloaded, the map on the right does not use any preloading. Try zooming out and panning to see the difference.</p>
<p id="shortdesc">Example of tile preloading.</p>
<div id="docs">
<p>The map on the left preloads low resolution tiles. The map on the right does not use any preloading. Try zooming out and panning to see the difference.</p>
<p>See the <a href="preload.js" target="_blank">preload.js source</a> to see how this is done.</p>
</div>
<div id="tags">preload, bing</div>

View File

@@ -35,10 +35,11 @@
<div class="row-fluid">
<div class="span4">
<div class="span12">
<h4 id="title">Rotation example</h4>
<p id="shortdesc">Example of a rotated map. Use <code>Alt</code>+<code>Shift</code>+drag to rotate the map.</p>
<p id="shortdesc">Example of a rotated map.</p>
<div id="docs">
<p>Use <code>Alt</code>+<code>Shift</code>+drag to rotate the map.</p>
<p>See the <a href="rotation.js" target="_blank">rotation.js source</a> to see how this is done.</p>
</div>
<div id="tags">rotation, openstreetmap</div>

View File

@@ -30,12 +30,17 @@
<div class="row-fluid">
<div class="span12">
<div id="map" class="map"></div>
<select id="units">
<option value="degrees">degrees</option>
<option value="imperial">imperial</option>
<option value="metric">metric</option>
</select>
</div>
</div>
<div class="row-fluid">
<div class="span4">
<div class="span12">
<h4 id="title">Scale line example</h4>
<p id="shortdesc">Example of a scale line.</p>
<div id="docs">

View File

@@ -2,17 +2,17 @@ goog.require('ol.Map');
goog.require('ol.RendererHints');
goog.require('ol.View2D');
goog.require('ol.control.ScaleLine');
goog.require('ol.control.ScaleLineUnits');
goog.require('ol.control.defaults');
goog.require('ol.dom.Input');
goog.require('ol.layer.TileLayer');
goog.require('ol.source.OSM');
var scaleLineControl = new ol.control.ScaleLine();
var map = new ol.Map({
controls: ol.control.defaults({}, [
new ol.control.ScaleLine({
units: ol.control.ScaleLineUnits.IMPERIAL
})
scaleLineControl
]),
layers: [
new ol.layer.TileLayer({
@@ -26,3 +26,7 @@ var map = new ol.Map({
zoom: 2
})
});
var unitsSelect = new ol.dom.Input(document.getElementById('units'));
unitsSelect.bindTo('value', scaleLineControl, 'units');

View File

@@ -35,7 +35,7 @@
<div class="row-fluid">
<div class="span4">
<div class="span12">
<h4 id="title">Semi-transparent layer example</h4>
<p id="shortdesc">Example of a map with a semi-transparent layer.</p>
<div id="docs">

View File

@@ -2,7 +2,7 @@ goog.require('ol.Map');
goog.require('ol.RendererHints');
goog.require('ol.View2D');
goog.require('ol.layer.TileLayer');
goog.require('ol.projection');
goog.require('ol.proj');
goog.require('ol.source.MapQuestOpenAerial');
goog.require('ol.source.TileJSON');
@@ -22,8 +22,7 @@ var map = new ol.Map({
renderers: ol.RendererHints.createFromQueryData(),
target: 'map',
view: new ol.View2D({
center: ol.projection.transform(
[-77.93255, 37.9555], 'EPSG:4326', 'EPSG:3857'),
center: ol.proj.transform([-77.93255, 37.9555], 'EPSG:4326', 'EPSG:3857'),
zoom: 5
})
});

View File

@@ -44,7 +44,7 @@
<div class="row-fluid">
<div class="span4">
<div class="span12">
<h4 id="title">Side-by-side example</h4>
<p id="shortdesc">The three maps, one WebGL, one Canvas, one DOM, share the same center, resolution, rotation and layers.</p>
<div id="docs">

View File

@@ -35,7 +35,7 @@
<div class="row-fluid">
<div class="span4">
<div class="span12">
<h4 id="title">Simple example</h4>
<p id="shortdesc">Example of a simple map.</p>
<div id="docs">

View File

@@ -35,7 +35,7 @@
<div class="row-fluid">
<div class="span4">
<div class="span12">
<h4 id="title">Stamen example</h4>
<p id="shortdesc">Example of a Stamen tile source. Two layers are composed: the watercolor base layer with the terrain labels.</p>
<div id="docs">

View File

@@ -2,7 +2,7 @@ goog.require('ol.Map');
goog.require('ol.RendererHints');
goog.require('ol.View2D');
goog.require('ol.layer.TileLayer');
goog.require('ol.projection');
goog.require('ol.proj');
goog.require('ol.source.Stamen');
@@ -22,7 +22,7 @@ var map = new ol.Map({
renderers: ol.RendererHints.createFromQueryData(),
target: 'map',
view: new ol.View2D({
center: ol.projection.transform(
center: ol.proj.transform(
[-122.416667, 37.783333], 'EPSG:4326', 'EPSG:3857'),
zoom: 12
})

View File

@@ -35,7 +35,7 @@
<div class="row-fluid">
<div class="span4">
<div class="span12">
<h4 id="title">Style with rules example</h4>
<p id="shortdesc">Draws features with rule based styles.</p>
<div id="docs">

View File

@@ -1,36 +1,32 @@
goog.require('ol.Collection');
goog.require('ol.Expression');
goog.require('ol.Map');
goog.require('ol.RendererHint');
goog.require('ol.View2D');
goog.require('ol.control.defaults');
goog.require('ol.filter.Filter');
goog.require('ol.expr');
goog.require('ol.layer.Vector');
goog.require('ol.parser.GeoJSON');
goog.require('ol.projection');
goog.require('ol.proj');
goog.require('ol.source.Vector');
goog.require('ol.style.Line');
goog.require('ol.style.Rule');
goog.require('ol.style.Shape');
goog.require('ol.style.Style');
goog.require('ol.style.Text');
var style = new ol.style.Style({rules: [
new ol.style.Rule({
filter: new ol.filter.Filter(function(feature) {
return feature.get('where') == 'outer';
}),
filter: 'where == "outer"',
symbolizers: [
new ol.style.Line({
strokeColor: new ol.Expression('color'),
strokeColor: ol.expr.parse('color'),
strokeWidth: 4,
opacity: 1
})
]
}),
new ol.style.Rule({
filter: new ol.filter.Filter(function(feature) {
return feature.get('where') == 'inner';
}),
filter: 'where == "inner"',
symbolizers: [
new ol.style.Line({
strokeColor: '#013',
@@ -38,18 +34,33 @@ var style = new ol.style.Style({rules: [
opacity: 1
}),
new ol.style.Line({
strokeColor: new ol.Expression('color'),
strokeColor: ol.expr.parse('color'),
strokeWidth: 2,
opacity: 1
})
]
}),
new ol.style.Rule({
filter: 'geometryType("point")',
symbolizers: [
new ol.style.Shape({
size: 40,
fillColor: '#013'
}),
new ol.style.Text({
color: '#bada55',
text: ol.expr.parse('label'),
fontFamily: 'Calibri,sans-serif',
fontSize: 14
})
]
})
]});
var vector = new ol.layer.Vector({
style: style,
source: new ol.source.Vector({
projection: ol.projection.get('EPSG:3857')
projection: ol.proj.get('EPSG:3857')
})
});
@@ -115,8 +126,44 @@ vector.parseFeatures({
'type': 'LineString',
'coordinates': [[10000000, -10000000], [-10000000, -10000000]]
}
}, {
'type': 'Feature',
'properties': {
'label': 'South'
},
'geometry': {
'type': 'Point',
'coordinates': [0, -6000000]
}
}, {
'type': 'Feature',
'properties': {
'label': 'West'
},
'geometry': {
'type': 'Point',
'coordinates': [-6000000, 0]
}
}, {
'type': 'Feature',
'properties': {
'label': 'North'
},
'geometry': {
'type': 'Point',
'coordinates': [0, 6000000]
}
}, {
'type': 'Feature',
'properties': {
'label': 'East'
},
'geometry': {
'type': 'Point',
'coordinates': [6000000, 0]
}
}]
}, new ol.parser.GeoJSON(), ol.projection.get('EPSG:3857'));
}, new ol.parser.GeoJSON(), ol.proj.get('EPSG:3857'));
var map = new ol.Map({

65
examples/teleport.html Normal file
View File

@@ -0,0 +1,65 @@
<!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">
<title>Teleport example</title>
</head>
<body>
<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>
</div>
</div>
</div>
<div class="container-fluid">
<div class="row-fluid">
<div class="span8">
<div id="map1" class="map"></div>
</div>
<div class="span4">
<div id="map2" class="map"></div>
</div>
</div>
<div class="row-fluid">
<div class="span12">
<a id="teleport" href="#" class="btn">Teleport</a>
</div>
</div>
<div class="row-fluid">
<div class="span12">
<h4 id="title">Teleport example</h4>
<p id="shortdesc">Example of moving a map from one target to another.</p>
<div id="docs">
<p>Click on the Teleport button below the map to move the map from one target to another.</p>
<p>See the <a href="teleport.js" target="_blank">teleport.js source</a> to see how this is done.</p>
</div>
<div id="tags">teleport, openstreetmap</div>
</div>
</div>
</div>
<script src="loader.js?id=teleport" type="text/javascript"></script>
<script src="../resources/social-links.js" type="text/javascript"></script>
</body>
</html>

28
examples/teleport.js Normal file
View File

@@ -0,0 +1,28 @@
goog.require('ol.Map');
goog.require('ol.RendererHints');
goog.require('ol.View2D');
goog.require('ol.layer.TileLayer');
goog.require('ol.source.OSM');
var map = new ol.Map({
layers: [
new ol.layer.TileLayer({
source: new ol.source.OSM()
})
],
renderers: ol.RendererHints.createFromQueryData(),
view: new ol.View2D({
center: [0, 0],
zoom: 2
})
});
map.setTarget('map1');
var teleportButton = document.getElementById('teleport');
teleportButton.addEventListener('click', function() {
var target = map.getTarget().id === 'map1' ? 'map2' : 'map1';
map.setTarget(target);
}, false);

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="../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>Ten thousand points example</title>
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="example-list.html">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>
</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="span12">
<h4 id="title">Ten thousand points example</h4>
<p id="shortdesc">Example of a map with ten thousand points.</p>
<div id="docs">
<p>See the <a href="ten-thousand-points.js" target="_blank">ten-thousand-points.js source</a> to see how this is done.</p>
</div>
<div id="tags">points, vector, openstreetmap</div>
</div>
</div>
</div>
<script src="loader.js?id=ten-thousand-points" type="text/javascript"></script>
<script src="../resources/social-links.js" type="text/javascript"></script>
</body>
</html>

View File

@@ -0,0 +1,68 @@
goog.require('ol.Map');
goog.require('ol.RendererHint');
goog.require('ol.View2D');
goog.require('ol.control.MousePosition');
goog.require('ol.control.defaults');
goog.require('ol.geom2.LineStringCollection');
goog.require('ol.geom2.PointCollection');
goog.require('ol.layer.TileLayer');
goog.require('ol.layer.VectorLayer2');
goog.require('ol.source.OSM');
goog.require('ol.source.VectorSource2');
// WARNING
// This example is an experimental testbed for WebGL vector work. The function
// calls used here are internal and low-level and are not representative of the
// final API.
var pointCollection = ol.geom2.PointCollection.createEmpty(101 * 101);
var i, j, x, y;
for (i = 0; i < 101; ++i) {
for (j = 0; j < 101; ++j) {
x = 20000000 * (i - 50) / 50;
y = 20000000 * (j - 50) / 50;
pointCollection.add([x, y]);
}
}
var k = 1000000;
var lineStringCollection = ol.geom2.LineStringCollection.pack([
[[-20 * k, -20 * k], [20 * k, 20 * k]],
[[-20 * k, 20 * k], [20 * k, -20 * k]],
[[0 * k, 15 * k],
[10 * k, 5 * k],
[5 * k, 5 * k],
[5 * k, -15 * k],
[-5 * k, -15 * k],
[-5 * k, 5 * k],
[-10 * k, 5 * k],
[0 * k, 15 * k]]
]);
var map = new ol.Map({
controls: ol.control.defaults({}, [
new ol.control.MousePosition({
undefinedHTML: '&nbsp;'
})
]),
layers: [
new ol.layer.TileLayer({
source: new ol.source.OSM()
}),
new ol.layer.VectorLayer2({
source: new ol.source.VectorSource2({
lineStringCollections: [lineStringCollection],
projection: 'EPSG:3857',
pointCollections: [pointCollection]
})
})
],
renderer: ol.RendererHint.WEBGL,
target: 'map',
view: new ol.View2D({
center: [0, 0],
zoom: 0
})
});

View File

@@ -35,7 +35,7 @@
<div class="row-fluid">
<div class="span4">
<div class="span12">
<h4 id="title">TileJSON example</h4>
<p id="shortdesc">Example of a TileJSON layer.</p>
<div id="docs">

View File

@@ -37,12 +37,17 @@
<div class="span4">
<h4 id="title">Vector layer example</h4>
<p id="shortdesc">Example of a vector layer.</p>
<p id="shortdesc">Example of a countries vector layer with country information on hover and country labels at higher zoom levels.</p>
<div id="docs">
<p>See the <a href="vector-layer.js" target="_blank">vector-layer.js source</a> to see how this is done.</p>
</div>
<div id="tags">vector, geojson, style</div>
</div>
<div class="span4 offset4">
<div id="info" class="alert alert-success">
&nbsp;
</div>
</div>
</div>

View File

@@ -1,25 +1,31 @@
goog.require('ol.Collection');
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.Vector');
goog.require('ol.parser.GeoJSON');
goog.require('ol.projection');
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.Style');
goog.require('ol.style.Text');
var raster = new ol.layer.TileLayer({
source: new ol.source.MapQuestOpenAerial()
});
// TODO: discuss scale dependent rules
ol.expr.register('resolution', function() {
return map.getView().getView2D().getResolution();
});
var vector = new ol.layer.Vector({
source: new ol.source.Vector({
projection: ol.projection.get('EPSG:4326')
projection: ol.proj.get('EPSG:4326')
}),
style: new ol.style.Style({rules: [
new ol.style.Rule({
@@ -28,12 +34,27 @@ var vector = new ol.layer.Vector({
strokeColor: '#bada55'
})
]
}),
new ol.style.Rule({
filter: 'resolution() < 5000',
symbolizers: [
new ol.style.Text({
color: '#bada55',
text: ol.expr.parse('name'),
fontFamily: 'Calibri,sans-serif',
fontSize: 12
})
]})
]
})
]}),
transformFeatureInfo: function(features) {
return features.length > 0 ?
features[0].getFeatureId() + ': ' + features[0].get('name') : '&nbsp;';
}
});
var map = new ol.Map({
layers: new ol.Collection([raster, vector]),
layers: [raster, vector],
renderer: ol.RendererHint.CANVAS,
target: 'map',
view: new ol.View2D({
@@ -42,9 +63,19 @@ var map = new ol.Map({
})
});
map.on(['click', 'mousemove'], function(evt) {
map.getFeatureInfo({
pixel: evt.getPixel(),
layers: [vector],
success: function(featureInfo) {
document.getElementById('info').innerHTML = featureInfo[0];
}
});
});
var geojson = new ol.parser.GeoJSON();
var url = 'data/countries.json';
var url = 'data/countries.geojson';
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);

View File

@@ -7,7 +7,7 @@
<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>Tiled WMS with custom projection example</title>
<title>Tiled WMS with Proj4js projection example</title>
</head>
<body>
@@ -35,13 +35,13 @@
<div class="row-fluid">
<div class="span4">
<h4 id="title">Tiled WMS with custom projection example</h4>
<div class="span12">
<h4 id="title">Tiled WMS with Proj4js projection example</h4>
<p id="shortdesc">Example of two tiled WMS layers (Pixelmap 1:1'000'000 and national parks) using the projection EPSG:21781.</p>
<div id="docs">
<p>See the <a href="wms-custom-proj.js" target="_blank">wms-custom-proj.js source</a> to see how this is done.</p>
</div>
<div id="tags">wms, tile, tilelayer, projection</div>
<div id="tags">wms, tile, tilelayer, proj4js, projection</div>
</div>
</div>

View File

@@ -1,5 +1,4 @@
goog.require('ol.Attribution');
goog.require('ol.Extent');
goog.require('ol.Map');
goog.require('ol.RendererHints');
goog.require('ol.View2D');
@@ -7,16 +6,16 @@ goog.require('ol.control.ScaleLine');
goog.require('ol.control.ScaleLineUnits');
goog.require('ol.control.defaults');
goog.require('ol.layer.TileLayer');
goog.require('ol.projection');
goog.require('ol.proj');
goog.require('ol.source.TiledWMS');
var projection = ol.projection.configureProj4jsProjection({
var projection = ol.proj.configureProj4jsProjection({
code: 'EPSG:21781',
extent: new ol.Extent(485869.5728, 76443.1884, 837076.5648, 299941.7864)
extent: [485869.5728, 837076.5648, 76443.1884, 299941.7864]
});
var extent = new ol.Extent(420000, 30000, 900000, 350000);
var extent = [420000, 900000, 30000, 350000];
var layers = [
new ol.layer.TileLayer({
source: new ol.source.TiledWMS({

55
examples/wms-no-proj.html Normal file
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="../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>WMS without client projection example</title>
</head>
<body>
<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>
</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="span12">
<h4 id="title">WMS without client projection example</h4>
<p id="shortdesc">Example of two WMS layers using the projection EPSG:21781, which is unknown to the client.</p>
<div id="docs">
<p>See the <a href="wms-no-proj.js" target="_blank">wms-no-proj.js source</a> to see how this is done.</p>
</div>
<div id="tags">wms, projection</div>
</div>
</div>
</div>
<script src="loader.js?id=wms-no-proj" type="text/javascript"></script>
<script src="../resources/social-links.js" type="text/javascript"></script>
</body>
</html>

58
examples/wms-no-proj.js Normal file
View File

@@ -0,0 +1,58 @@
goog.require('ol.Attribution');
goog.require('ol.Map');
goog.require('ol.Projection');
goog.require('ol.ProjectionUnits');
goog.require('ol.RendererHints');
goog.require('ol.View2D');
goog.require('ol.layer.ImageLayer');
goog.require('ol.layer.TileLayer');
goog.require('ol.source.SingleImageWMS');
goog.require('ol.source.TiledWMS');
var layers = [
new ol.layer.TileLayer({
source: new ol.source.TiledWMS({
attributions: [new ol.Attribution(
'&copy; ' +
'<a href="http://www.geo.admin.ch/internet/geoportal/en/home.html">' +
'Pixelmap 1:1000000 / geo.admin.ch</a>')],
crossOrigin: 'anonymous',
params: {
'LAYERS': 'ch.swisstopo.pixelkarte-farbe-pk1000.noscale',
'FORMAT': 'image/jpeg'
},
url: 'http://wms.geo.admin.ch/'
})
}),
new ol.layer.ImageLayer({
source: new ol.source.SingleImageWMS({
attributions: [new ol.Attribution(
'&copy; ' +
'<a href="http://www.geo.admin.ch/internet/geoportal/en/home.html">' +
'National parks / geo.admin.ch</a>')],
crossOrigin: 'anonymous',
params: {'LAYERS': 'ch.bafu.schutzgebiete-paerke_nationaler_bedeutung'},
url: 'http://wms.geo.admin.ch/'
})
})
];
// A minimal projection object is configured with only the SRS code and the map
// units. No client side coordinate transforms are possible with such a
// projection object.
var projection = new ol.Projection({
code: 'EPSG:21781',
units: ol.ProjectionUnits.METERS
});
var map = new ol.Map({
layers: layers,
renderers: ol.RendererHints.createFromQueryData(),
target: 'map',
view: new ol.View2D({
center: [660000, 190000],
projection: projection,
zoom: 9
})
});

View File

@@ -35,10 +35,11 @@
<div class="row-fluid">
<div class="span4">
<div class="span12">
<h4 id="title">Single image WMS with custom projection example</h4>
<p id="shortdesc">Example of two single image WMS layers (Pixelmap 1:1'000'000 and national parks) using the projection EPSG:21781.</p>
<p id="shortdesc">Example of two single image WMS layers.</p>
<div id="docs">
<p>Pixelmap 1:1'000'000 with National Parks overlay using the projection EPSG:21781.</p>
<p>See the <a href="wms-single-image-custom-proj.js" target="_blank">wms-single-image-custom-proj.js source</a> to see how this is done.</p>
</div>
<div id="tags">wms, single image, projection</div>

View File

@@ -1,19 +1,18 @@
goog.require('ol.Attribution');
goog.require('ol.Extent');
goog.require('ol.Map');
goog.require('ol.RendererHints');
goog.require('ol.View2D');
goog.require('ol.layer.ImageLayer');
goog.require('ol.projection');
goog.require('ol.proj');
goog.require('ol.source.SingleImageWMS');
var projection = ol.projection.configureProj4jsProjection({
var projection = ol.proj.configureProj4jsProjection({
code: 'EPSG:21781',
extent: new ol.Extent(485869.5728, 76443.1884, 837076.5648, 299941.7864)
extent: [485869.5728, 837076.5648, 76443.1884, 299941.7864]
});
var extent = new ol.Extent(420000, 30000, 900000, 350000);
var extent = [420000, 900000, 30000, 350000];
var layers = [
new ol.layer.ImageLayer({
source: new ol.source.SingleImageWMS({

View File

@@ -35,7 +35,7 @@
<div class="row-fluid">
<div class="span4">
<div class="span12">
<h4 id="title">Single image WMS example</h4>
<p id="shortdesc">Example of a single image WMS layer.</p>
<div id="docs">

View File

@@ -1,4 +1,3 @@
goog.require('ol.Extent');
goog.require('ol.Map');
goog.require('ol.RendererHint');
goog.require('ol.View2D');
@@ -16,7 +15,7 @@ var layers = [
source: new ol.source.SingleImageWMS({
url: 'http://demo.opengeo.org/geoserver/wms',
params: {'LAYERS': 'topp:states'},
extent: new ol.Extent(-13884991, 2870341, -7455066, 6338219)
extent: [-13884991, -7455066, 2870341, 6338219]
})
})
];

View File

@@ -35,7 +35,7 @@
<div class="row-fluid">
<div class="span4">
<div class="span12">
<h4 id="title">Tiled WMS example</h4>
<p id="shortdesc">Example of a tiled WMS layer.</p>
<div id="docs">

View File

@@ -1,4 +1,3 @@
goog.require('ol.Extent');
goog.require('ol.Map');
goog.require('ol.RendererHint');
goog.require('ol.View2D');
@@ -15,7 +14,7 @@ var layers = [
source: new ol.source.TiledWMS({
url: 'http://demo.opengeo.org/geoserver/wms',
params: {'LAYERS': 'topp:states', 'TILED': true},
extent: new ol.Extent(-13884991, 2870341, -7455066, 6338219)
extent: [-13884991, -7455066, 2870341, 6338219]
})
})
];

View File

@@ -1,7 +1,7 @@
goog.require('ol.parser.ogc.WMTSCapabilities');
goog.require('ol.projection.addCommonProjections');
goog.require('ol.proj.addCommonProjections');
ol.projection.addCommonProjections();
ol.proj.addCommonProjections();
Proj4js.defs['EPSG:31256'] = '+proj=tmerc +lat_0=0 ' +
'+lon_0=16.33333333333333 +k=1 +x_0=0 +y_0=-5000000 +ellps=bessel ' +
'+towgs84=577.326,90.129,463.919,5.137,1.474,5.297,2.4232 ' +

View File

@@ -35,7 +35,7 @@
<div class="row-fluid">
<div class="span4">
<div class="span12">
<h4 id="title">WMTS from capabilities example</h4>
<p id="shortdesc">Example of a WMTS source built from a WMTS getCapabilities response.</p>
<div id="docs">

64
examples/wmts-ign.html Normal file
View File

@@ -0,0 +1,64 @@
<!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">
<title>IGN WMTS example</title>
<style>
.ol-logo ul li {
margin-right: 3px;
}
</style>
</head>
<body>
<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>
</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="span12">
<h4 id="title">IGN WMTS example</h4>
<p id="shortdesc">Demonstrates displaying IGN (France) WMTS layers.</p>
<div id="docs">
<p>In this example two IGN WMTS layers are displayed: <em>Ortho imagery and Cadastral parcels.</em>.
For more information on IGN's WMTS service see the
<a href="http://professionnels.ign.fr/api-sig">IGN Géoportail API web page</a> (french).</p>
<p>See the <a href="wmts-ign.js" target="_blank">wmts-ign.js source</a> to see how this is done.</p>
</div>
<div id="tags">french, ign, geoportail, wmts</div>
</div>
</div>
</div>
<script src="http://cdnjs.cloudflare.com/ajax/libs/proj4js/1.1.0/proj4js-compressed.js" type="text/javascript"></script>
<script src="loader.js?id=wmts-ign" type="text/javascript"></script>
<script src="../resources/social-links.js" type="text/javascript"></script>
</body>
</html>

83
examples/wmts-ign.js Normal file
View File

@@ -0,0 +1,83 @@
goog.require('ol.Attribution');
goog.require('ol.Map');
goog.require('ol.RendererHint');
goog.require('ol.View2D');
goog.require('ol.layer.TileLayer');
goog.require('ol.parser.ogc.WMTSCapabilities');
goog.require('ol.source.WMTS');
// The WMTS Capabilities document includes IGNF:WGS84G as a supported
// CRS. We include the Proj4js definition of that projection to prevent
// Proj4js from requesting that definition from spatialreference.org.
Proj4js.defs['IGNF:WGS84G'] = '+title=World Geodetic System 1984 ' +
'+proj=longlat +towgs84=0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,' +
'0.000000 +a=6378137.0000 +rf=298.2572221010000 +units=m +no_defs <>';
// API key valid for "localhost" and "ol3js.org". Expiration date
// is 21/06/2014.
var key = 'crrypaoz7j1ifbalcobnumb0';
var map = new ol.Map({
renderer: ol.RendererHint.CANVAS,
target: 'map'
});
var xhr = new XMLHttpRequest();
// data/IGNWMTSCapabilities.xml downloaded from
// http://wxs.ign.fr/cle/geoportail/wmts?SERVICE=WMTS&REQUEST=GetCapabilities
// Stored locally because of the Same Origin Policy.
xhr.open('GET', 'data/IGNWMTSCapabilities.xml', true);
/**
* onload handler for the XHR request.
*/
xhr.onload = function() {
if (xhr.status == 200) {
var parser = new ol.parser.ogc.WMTSCapabilities();
var capabilities = parser.read(xhr.responseXML);
var wmtsUrl = 'http://wxs.ign.fr/' + key + '/geoportail/wmts';
var layerIdentifiers = [
'ORTHOIMAGERY.ORTHOPHOTOS',
'CADASTRALPARCELS.PARCELS'
];
var layerLogos = [
'http://gpp3-wxs.ign.fr/static/logos/PLANETOBSERVER/PLANETOBSERVER.gif',
'http://gpp3-wxs.ign.fr/static/logos/IGN/IGN.gif'
];
var attribution = new ol.Attribution(
'<a href="http://www.geoportail.fr/" target="_blank">' +
'<img src="http://api.ign.fr/geoportail/api/js/latest/' +
'theme/geoportal/img/logo_gp.gif"></a>');
var sourceOptions;
var source;
var layer;
var i;
for (i = 0; i < layerIdentifiers.length; ++i) {
sourceOptions = ol.source.WMTS.optionsFromCapabilities(
capabilities, layerIdentifiers[i]);
// we need to set the URL because it must include the key.
sourceOptions.urls = [wmtsUrl];
sourceOptions.attributions = [attribution];
sourceOptions.logo = layerLogos[i];
source = new ol.source.WMTS(sourceOptions);
layer = new ol.layer.TileLayer({source: source});
map.addLayer(layer);
}
var view = new ol.View2D();
view.fitExtent([257596.65942095537, 262082.55751844167,
6250898.984085131, 6251854.446938695], map.getSize());
map.setView(view);
}
};
xhr.send();

View File

@@ -35,7 +35,7 @@
<div class="row-fluid">
<div class="span4">
<div class="span12">
<h4 id="title">WMTS example</h4>
<p id="shortdesc">Example of a WMTS source.</p>
<div id="docs">

View File

@@ -1,17 +1,17 @@
goog.require('ol.Extent');
goog.require('ol.Map');
goog.require('ol.RendererHint');
goog.require('ol.View2D');
goog.require('ol.extent');
goog.require('ol.layer.TileLayer');
goog.require('ol.projection');
goog.require('ol.proj');
goog.require('ol.source.OSM');
goog.require('ol.source.WMTS');
goog.require('ol.tilegrid.WMTS');
var projection = ol.projection.get('EPSG:900913');
var projection = ol.proj.get('EPSG:900913');
var projectionExtent = projection.getExtent();
var size = projectionExtent.getWidth() / 256;
var size = ol.extent.getWidth(projectionExtent) / 256;
var resolutions = new Array(26);
var matrixIds = new Array(26);
for (var z = 0; z < 26; ++z) {
@@ -34,12 +34,12 @@ var map = new ol.Map({
format: 'image/png',
projection: projection,
tileGrid: new ol.tilegrid.WMTS({
origin: projectionExtent.getTopLeft(),
origin: ol.extent.getTopLeft(projectionExtent),
resolutions: resolutions,
matrixIds: matrixIds
}),
style: '_null',
extent: new ol.Extent(-13682835, 5204068, -13667473, 5221690)
extent: [-13682835, -13667473, 5204068, 5221690]
})
})
],

View File

@@ -96,7 +96,7 @@
<div class="row-fluid">
<div class="span4">
<div class="span12">
<h4 id="title">ZoomSlider control</h4>
<p id="shortdesc">Example of various ZoomSlider controls.</p>
<div id="docs">

29
externs/oli.js Normal file
View File

@@ -0,0 +1,29 @@
/**
* @externs
*/
/**
* @type {Object}
*/
var oli;
/**
* @interface
*/
oli.control.Control = function() {};
/**
* @param {ol.MapEvent} mapEvent Map event.
* @return {undefined} Undefined.
*/
oli.control.Control.prototype.handleMapPostrender = function(mapEvent) {};
/**
* @param {ol.Map} map Map.
* @return {undefined} Undefined.
*/
oli.control.Control.prototype.setMap = function(map) {};

View File

@@ -76,6 +76,12 @@ Proj4js.Proj.prototype.units;
Proj4js.Proj.prototype.srsCode;
/**
* @type {number}
*/
Proj4js.Proj.prototype.to_meter;
/**
* @nosideeffects
* @param {Proj4js.Proj} source

View File

@@ -0,0 +1,89 @@
/*
* Copyright 2013 The Closure Compiler Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @fileoverview Definitions for W3C's device orientation and device motion
* events specification.
* This file depends on w3c_event.js.
* The whole file has been partially type annotated.
* Created from http://dev.w3.org/geo/api/spec-source-orientation.
*
* @externs
*/
/**
* @constructor
* @extends {Event}
*/
function DeviceOrientationEvent() {}
/** @type {?number} */
DeviceOrientationEvent.prototype.alpha;
/** @type {?number} */
DeviceOrientationEvent.prototype.beta;
/** @type {?number} */
DeviceOrientationEvent.prototype.gamma;
/** @type {boolean} */
DeviceOrientationEvent.prototype.absolute;
/**
* @constructor
*/
function DeviceAcceleration() {}
/** @type {?number} */
DeviceAcceleration.prototype.x;
/** @type {?number} */
DeviceAcceleration.prototype.y;
/** @type {?number} */
DeviceAcceleration.prototype.z;
/**
* @constructor
*/
function DeviceRotationRate() {}
/** @type {?number} */
DeviceOrientationEvent.prototype.alpha;
/** @type {?number} */
DeviceOrientationEvent.prototype.beta;
/** @type {?number} */
DeviceOrientationEvent.prototype.gamma;
/**
* @constructor
* @extends {Event}
*/
function DeviceMotionEvent() {}
/** @type {?DeviceAcceleration} */
DeviceMotionEvent.prototype.acceleration;
/** @type {?DeviceAcceleration} */
DeviceMotionEvent.prototype.accelerationIncludingGravity;
/** @type {?DeviceRotationRate} */
DeviceMotionEvent.prototype.rotationRate;
/** @type {?number} */
DeviceMotionEvent.prototype.interval;

View File

@@ -6,6 +6,7 @@ body {
.map {
height: 400px;
width: 100%;
background: url(textured_paper.jpeg) repeat;
}
.ol-attribution {
max-width: 50%;

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

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