summaryrefslogtreecommitdiff
path: root/misc/openlayers/examples/mobile-drawing.js
diff options
context:
space:
mode:
authorChris Schlaeger <chris@linux.com>2014-08-12 21:56:44 +0200
committerChris Schlaeger <chris@linux.com>2014-08-12 21:56:44 +0200
commitea346a785dc1b3f7c156f6fc33da634e1f1a627b (patch)
treeaf67530553d20b6e82ad60fd79593e9c4abf5565 /misc/openlayers/examples/mobile-drawing.js
parent59741cd535c47f25971bf8c32b25da25ceadc6d5 (diff)
downloadpostrunner-0.0.4.zip
Adding jquery, flot and openlayers to be included with the GEM.v0.0.4
Diffstat (limited to 'misc/openlayers/examples/mobile-drawing.js')
-rw-r--r--misc/openlayers/examples/mobile-drawing.js71
1 files changed, 71 insertions, 0 deletions
diff --git a/misc/openlayers/examples/mobile-drawing.js b/misc/openlayers/examples/mobile-drawing.js
new file mode 100644
index 0000000..bac903c
--- /dev/null
+++ b/misc/openlayers/examples/mobile-drawing.js
@@ -0,0 +1,71 @@
+function init() {
+
+ // create a vector layer for drawing
+ var vector = new OpenLayers.Layer.Vector('Vector Layer', {
+ styleMap: new OpenLayers.StyleMap({
+ temporary: OpenLayers.Util.applyDefaults({
+ pointRadius: 16
+ }, OpenLayers.Feature.Vector.style.temporary),
+ 'default': OpenLayers.Util.applyDefaults({
+ pointRadius: 16,
+ strokeWidth: 3,
+ }, OpenLayers.Feature.Vector.style['default']),
+ select: OpenLayers.Util.applyDefaults({
+ pointRadius: 16,
+ strokeWidth: 3
+ }, OpenLayers.Feature.Vector.style.select)
+ })
+ });
+
+ // OpenLayers' EditingToolbar internally creates a Navigation control, we
+ // want a TouchNavigation control here so we create our own editing toolbar
+ var toolbar = new OpenLayers.Control.Panel({
+ displayClass: 'olControlEditingToolbar'
+ });
+ toolbar.addControls([
+ // this control is just there to be able to deactivate the drawing
+ // tools
+ new OpenLayers.Control({
+ displayClass: 'olControlNavigation'
+ }),
+ new OpenLayers.Control.ModifyFeature(vector, {
+ vertexRenderIntent: 'temporary',
+ displayClass: 'olControlModifyFeature'
+ }),
+ new OpenLayers.Control.DrawFeature(vector, OpenLayers.Handler.Point, {
+ displayClass: 'olControlDrawFeaturePoint'
+ }),
+ new OpenLayers.Control.DrawFeature(vector, OpenLayers.Handler.Path, {
+ displayClass: 'olControlDrawFeaturePath'
+ }),
+ new OpenLayers.Control.DrawFeature(vector, OpenLayers.Handler.Polygon, {
+ displayClass: 'olControlDrawFeaturePolygon'
+ })
+ ]);
+
+ var osm = new OpenLayers.Layer.OSM();
+ osm.wrapDateLine = false;
+
+ map = new OpenLayers.Map({
+ div: 'map',
+ projection: 'EPSG:900913',
+ numZoomLevels: 18,
+ controls: [
+ new OpenLayers.Control.TouchNavigation({
+ dragPanOptions: {
+ enableKinetic: true
+ }
+ }),
+ new OpenLayers.Control.Zoom(),
+ toolbar
+ ],
+ layers: [osm, vector],
+ center: new OpenLayers.LonLat(0, 0),
+ zoom: 1,
+ theme: null
+ });
+
+ // activate the first control to render the "navigation icon"
+ // as active
+ toolbar.controls[0].activate();
+}