From 386dacffb3a3a1ee6e0bf4ff87d99ab2e87d79e8 Mon Sep 17 00:00:00 2001 From: Matt Priour Date: Tue, 20 Mar 2012 20:16:03 -0500 Subject: [PATCH 1/4] Add a specific example which uses the OpenLayers.light.debug.js library, instead of the normal full multi-file debug version used for most examples --- examples/light-basic.html | 35 +++++++++++++++++++++ examples/light-basic.js | 66 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 101 insertions(+) create mode 100644 examples/light-basic.html create mode 100644 examples/light-basic.js diff --git a/examples/light-basic.html b/examples/light-basic.html new file mode 100644 index 0000000000..634b450198 --- /dev/null +++ b/examples/light-basic.html @@ -0,0 +1,35 @@ + + + + + + + OpenLayers Light - Basic Popups + + + + + + +

OpenLayers Light - Basic Popups

+
+ light, vector, feature, popup +
+

+ A basic use case example using the OpenLayers.light version of the library.
+ Shows popup info bubble when hovering over features on the map +

+ +
+ +
+

+ This example uses OpenLayers.light.js to display features and show + popup info bubbles when the feature is hovered over. +

+ See the + light-basic.js source to see how this is done. +

+
+ + diff --git a/examples/light-basic.js b/examples/light-basic.js new file mode 100644 index 0000000000..15381f460b --- /dev/null +++ b/examples/light-basic.js @@ -0,0 +1,66 @@ +var map; + +function init() { + map = new OpenLayers.Map("map",{projection:"EPSG:3857"}); + + var osm = new OpenLayers.Layer.OSM(); + var toMercator = OpenLayers.Projection.transforms['EPSG:4326']['EPSG:3857']; + var center = toMercator({x:-0.05,y:51.5}); + + /** + * Create 5 random vector features. Your features would typically be fetched + * from the server. The features are given an attribute named "foo". + * The value of this attribute is an integer that ranges from 0 to 100. + */ + var features = []; + for(var i = 0; i < 5; i++) { + features[i] = new OpenLayers.Feature.Vector( + toMercator(new OpenLayers.Geometry.Point( + -0.040 - 0.05*Math.random(), + 51.49 + 0.02*Math.random())), + { + foo : 100 * Math.random() | 0 + }, { + fillColor : '#008040', + fillOpacity : 0.8, + strokeColor : "#ee9900", + strokeOpacity : 1, + strokeWidth : 1, + pointRadius : 8 + }); + } + + // create the layer with listeners to create and destroy popups + var vector = new OpenLayers.Layer.Vector("Points",{ + eventListeners:{ + 'featureselected':function(evt){ + var feature = evt.feature; + var popup = new OpenLayers.Popup.FramedCloud("popup", + OpenLayers.LonLat.fromString(feature.geometry.toShortString()), + null, + "
Feature: " + feature.id +"
Foo: " + feature.attributes.foo+"
", + null, + true + ); + feature.popup = popup; + map.addPopup(popup); + }, + 'featureunselected':function(evt){ + var feature = evt.feature; + map.removePopup(feature.popup); + feature.popup.destroy(); + feature.popup = null; + } + } + }); + vector.addFeatures(features); + + // create the select feature control + var selector = new OpenLayers.Control.SelectFeature(vector,{ + autoActivate:true + }); + + map.addLayers([osm, vector]); + map.addControl(selector); + map.setCenter(new OpenLayers.LonLat(center.x,center.y), 13); +} From 6eee5025f2025d3d3f6b0ac69c9507a31c138571 Mon Sep 17 00:00:00 2001 From: Matt Priour Date: Tue, 20 Mar 2012 22:29:58 -0500 Subject: [PATCH 2/4] Add light tag to examples that could use the light build --- examples/all-overlays-google.html | 2 +- examples/all-overlays.html | 2 +- examples/animated_panning.html | 2 +- examples/attribution.html | 2 +- examples/bing-tiles-restrictedzoom.html | 2 +- examples/bing-tiles.html | 2 +- examples/bing.html | 2 +- examples/boxes-vector.html | 2 +- examples/buffer.html | 2 +- examples/click.html | 2 +- examples/clientzoom.html | 2 +- examples/custom-control.html | 2 +- examples/example.html | 2 +- examples/geojson.html | 2 +- examples/google-static.html | 2 +- examples/google-v3-alloverlays.html | 2 +- examples/google-v3.html | 2 +- examples/graphic-name.html | 2 +- examples/gutter.html | 2 +- examples/late-render.html | 2 +- examples/layer-opacity.html | 2 +- examples/layerLoadMonitoring.html | 2 +- examples/layerswitcher.html | 2 +- examples/markerResize.html | 2 +- examples/multiserver.html | 2 +- examples/navigation-control.html | 2 +- examples/ordering.html | 2 +- examples/osm-google.html | 2 +- examples/osm-grayscale.html | 2 +- examples/osm.html | 2 +- examples/resize-features.html | 2 +- examples/restricted-extent.html | 2 +- examples/rotate-features.html | 2 +- examples/select-feature-multilayer.html | 2 +- examples/single-tile.html | 2 +- examples/style-rules.html | 2 +- examples/stylemap.html | 2 +- examples/styles-context.html | 2 +- examples/styles-rotation.html | 2 +- examples/styles-unique.html | 2 +- examples/symbolizers-fill-stroke-graphic.html | 2 +- examples/tile-origin.html | 2 +- examples/transition.html | 2 +- examples/vector-features-with-text.html | 2 +- examples/vector-features.html | 2 +- examples/wms-long-url.html | 2 +- examples/wms-untiled.html | 2 +- examples/wms-v13.html | 2 +- examples/zoom.html | 2 +- 49 files changed, 49 insertions(+), 49 deletions(-) diff --git a/examples/all-overlays-google.html b/examples/all-overlays-google.html index 9d2527098d..9df8cff1d3 100644 --- a/examples/all-overlays-google.html +++ b/examples/all-overlays-google.html @@ -15,7 +15,7 @@

All Overlays with Google and OSM

- overlay, baselayer, google, osm, openstreetmap + overlay, baselayer, google, osm, openstreetmap, light

Using the Google and OSM layers as overlays. diff --git a/examples/all-overlays.html b/examples/all-overlays.html index cecda0e79c..49e138e0e3 100644 --- a/examples/all-overlays.html +++ b/examples/all-overlays.html @@ -61,7 +61,7 @@

OpenLayers Overlays Only Example

- overlay, baselayer + overlay, baselayer, light

Demonstrates a map with overlays only. diff --git a/examples/animated_panning.html b/examples/animated_panning.html index a07017cc8e..3baa23f836 100644 --- a/examples/animated_panning.html +++ b/examples/animated_panning.html @@ -78,7 +78,7 @@

map.panTo Example

- panning, animation, effect, smooth, panMethod + panning, animation, effect, smooth, panMethod, light
Show animated panning effects in the map
diff --git a/examples/attribution.html b/examples/attribution.html index 328f3427c8..1f4ce12ba4 100644 --- a/examples/attribution.html +++ b/examples/attribution.html @@ -40,7 +40,7 @@

Attribution Example

- copyright, watermark, logo, attribution + copyright, watermark, logo, attribution, light

diff --git a/examples/bing-tiles-restrictedzoom.html b/examples/bing-tiles-restrictedzoom.html index afbd6a9fb6..c68ea3d428 100644 --- a/examples/bing-tiles-restrictedzoom.html +++ b/examples/bing-tiles-restrictedzoom.html @@ -20,7 +20,7 @@

Bing Tiles with a Subset of Resolutions Example

- bing tiles restrictedMinZoom numZoomLevels + bing tiles restrictedMinZoom numZoomLevels, light
Use Bing with direct tile access
diff --git a/examples/bing-tiles.html b/examples/bing-tiles.html index dbc55d8314..f3fe61dfae 100644 --- a/examples/bing-tiles.html +++ b/examples/bing-tiles.html @@ -20,7 +20,7 @@

Basic Bing Tiles Example

- bing tiles + bing tiles, light
Use Bing with direct tile access
diff --git a/examples/bing.html b/examples/bing.html index 6f43336ef8..3f0c4cb3cc 100644 --- a/examples/bing.html +++ b/examples/bing.html @@ -48,7 +48,7 @@

Bing Example

- Bing, Microsoft, Virtual Earth + Bing, Microsoft, Virtual Earth, light

diff --git a/examples/boxes-vector.html b/examples/boxes-vector.html index f3b5f01972..d18dbbdcc0 100644 --- a/examples/boxes-vector.html +++ b/examples/boxes-vector.html @@ -45,7 +45,7 @@

Boxes Example Vector

- box, vector, annotation + box, vector, annotation, light

diff --git a/examples/buffer.html b/examples/buffer.html index db810bae46..77e88c4f9c 100644 --- a/examples/buffer.html +++ b/examples/buffer.html @@ -37,7 +37,7 @@

Buffer Example

- buffer, performance, tile + buffer, performance, tile, light

diff --git a/examples/click.html b/examples/click.html index 98945c33b3..094ff2922f 100644 --- a/examples/click.html +++ b/examples/click.html @@ -70,7 +70,7 @@

Click Event Example

click control, double, doubleclick, double-click, event, events, - propagation + propagation, light

diff --git a/examples/clientzoom.html b/examples/clientzoom.html index f69f65bd21..c32c7c1913 100644 --- a/examples/clientzoom.html +++ b/examples/clientzoom.html @@ -8,7 +8,7 @@ - +