Skip to content

Commit

Permalink
Initial work for annotation layer.
Browse files Browse the repository at this point in the history
  • Loading branch information
manthey committed Sep 2, 2016
1 parent 4cc666f commit 7b1ef3d
Show file tree
Hide file tree
Showing 10 changed files with 518 additions and 3 deletions.
9 changes: 9 additions & 0 deletions examples/annotations/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"path": "annotations",
"title": "Annotation Layer",
"exampleCss": ["main.css"],
"exampleJs": ["main.js"],
"about": {
"text": "This example shows how to add annotations, such as marked rectangles, to a map."
}
}
1 change: 1 addition & 0 deletions examples/annotations/index.jade
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extends ../common/templates/index.jade
Empty file added examples/annotations/main.css
Empty file.
35 changes: 35 additions & 0 deletions examples/annotations/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/* globals $, geo, utils */

var annotationDebug = {};

// Run after the DOM loads
$(function () {
'use strict';

var query = utils.getQuery();
var map = geo.map({
node: '#map',
center: {
x: -119.5420833,
y: 37.4958333
},
zoom: 8
});
if (query.map !== 'false') {
if (query.map !== 'satellite') {
annotationDebug.mapLayer = map.createLayer('osm');
}
if (query.map === 'satellite' || query.map === 'dual') {
annotationDebug.satelliteLayer = map.createLayer('osm', {url: 'http://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}.png', opacity: query.map === 'dual' ? 0.25 : 1});
}
}
var layer = map.createLayer('annotation', {
renderer: query.renderer ? (query.renderer === 'html' ? null : query.renderer) : undefined,
features: query.renderer ? undefined : ['polygon']
});

map.draw();

annotationDebug.map = map;
annotationDebug.layer = layer;
});
Binary file added examples/annotations/thumb.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion src/action.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ var geo_action = {
select: 'geo_action_select',
unzoomselect: 'geo_action_unzoomselect',
zoom: 'geo_action_zoom',
zoomselect: 'geo_action_zoomselect'
zoomselect: 'geo_action_zoomselect',

// annotation actions
annotation_polygon: 'geo_annotation_polygon',
annotation_rectangle: 'geo_annotation_rectangle'
};

module.exports = geo_action;
Loading

0 comments on commit 7b1ef3d

Please sign in to comment.