forked from SharpMap/SharpMap
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript_editor.js
More file actions
66 lines (59 loc) · 2.04 KB
/
script_editor.js
File metadata and controls
66 lines (59 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
$(document).ready(function () {
var options, init;
OpenLayers.DOTS_PER_INCH = 25.4 / 0.28;
OpenLayers.IMAGE_RELOAD_ATTEMPTS = 5;
OpenLayers.Util.onImageLoadErrorColor = 'transparent';
OpenLayers.Util.onImageLoadError = function () {
this.src = '/Content/Images/sorry.jpg';
this.style.backgroundColor = OpenLayers.Util.onImageLoadErrorColor;
};
options = {
controls: [],
projection: 'EPSG:900913',
displayProjection: 'EPSG:4326',
format: 'image/png'
};
init = function () {
var lon = -73.9529, lat = 40.7723, zoom = 10,
map, center, editor;
map = new OpenLayers.Map('map', options);
map.addLayers([new OpenLayers.Layer.OSM()]);
map.addControl(new OpenLayers.Control.PanZoom({
position: new OpenLayers.Pixel(2, 10)
}));
map.addControl(new OpenLayers.Control.MousePosition());
map.addControl(new OpenLayers.Control.LoadingPanel());
center = new OpenLayers.LonLat(lon, lat);
center.transform(options.displayProjection, options.projection);
map.setCenter(center, zoom);
editor = new OpenLayers.Editor(map, {
oleUrl: window.location.origin + '/',
activeControls: [
'Navigation',
'SnappingSettings',
'CADTools',
'Separator',
'SplitFeature',
'MergeFeature',
'CleanFeature',
'DeleteFeature',
'SelectFeature',
'Separator',
'DragFeature',
'DrawHole',
'ModifyFeature',
'Separator'
],
featureTypes: [
'polygon',
'path',
'point'
],
showStatus: function (type, message) {
alert(message);
}
});
editor.startEditMode();
};
init();
});