1
// Activate Control for navigating around the maps.
2
function shn_gis_map_control_navigate(){
3
shn_gis_map_control_deactivate_all();
4
document.getElementById('gis_map_icon_select').style.backgroundImage = "url(res/OpenLayers/theme/default/img/move_feature_on.png)";
5
document.getElementById('gis_map_icon_description').innerHTML = 'Mode: Navigate';
7
// Activate Control for selecting features.
8
function shn_gis_map_control_select(){
9
shn_gis_map_control_deactivate_all();
10
document.getElementById('gis_map_icon_select').style.backgroundImage = "url(res/OpenLayers/theme/default/img/move_feature_on.png)";
11
document.getElementById('gis_map_icon_description').innerHTML = 'Mode: Select';
12
selectControl.activate();
14
// Activate Control for dragging features.
15
function shn_gis_map_control_drag(){
16
shn_gis_map_control_deactivate_all();
17
document.getElementById('gis_map_icon_drag').style.backgroundImage = "url(res/OpenLayers/theme/default/img/pan_on.png)";
18
document.getElementById('gis_map_icon_description').innerHTML = 'Mode: Drag';
19
dragControl.activate();
21
// Activate Control for modifying features.
22
function shn_gis_map_control_modify(){
23
shn_gis_map_control_deactivate_all();
24
//document.getElementById('gis_map_icon_modify').style.backgroundImage = "url()";
25
//document.getElementById('gis_map_icon_description').innerHTML = 'Mode: Modify';
26
//modifyControl.activate();
28
// Activate Control for adding point features.
29
function shn_gis_map_control_add_point(){
30
shn_gis_map_control_deactivate_all();
31
document.getElementById('gis_map_icon_addpoint').style.backgroundImage = "url(res/OpenLayers/theme/default/img/draw_point_on.png)";
32
document.getElementById('gis_map_icon_description').innerHTML = 'Mode: Add Point';
33
pointControl.activate();
35
// Activate Control for adding line features.
36
function shn_gis_map_control_add_line(){
37
shn_gis_map_control_deactivate_all();
38
document.getElementById('gis_map_icon_addline').style.backgroundImage = "url(res/OpenLayers/theme/default/img/draw_line_on.png)";
39
document.getElementById('gis_map_icon_description').innerHTML = 'Mode: Add line';
40
lineControl.activate();
42
// Activate Control for adding polygon features.
43
function shn_gis_map_control_add_polygon(){
44
shn_gis_map_control_deactivate_all();
45
document.getElementById('gis_map_icon_addpolygon').style.backgroundImage = "url(res/OpenLayers/theme/default/img/draw_polygon_on.png)";
46
document.getElementById('gis_map_icon_description').innerHTML = 'Mode: Add Area';
47
polygonControl.activate();
49
// Activate Control for drawing features freehand.
50
function shn_gis_map_control_freehand(){
51
if(lineControl.handler.freehand){
52
document.getElementById('gis_map_icon_freehand').style.backgroundImage = "url(res/OpenLayers/theme/default/img/freehand_off.png)";
53
document.getElementById('gis_map_icon_description').innerHTML = 'Mode: Freehand OFF';
54
lineControl.handler.freehand = false;
55
polygonControl.handler.freehand = false;
57
document.getElementById('gis_map_icon_freehand').style.backgroundImage = "url(res/OpenLayers/theme/default/img/freehand_on.png)";
58
document.getElementById('gis_map_icon_description').innerHTML = 'Mode: Freehand ON';
59
lineControl.handler.freehand = true;
60
polygonControl.handler.freehand = true;
63
// Deactivate all other controls
64
function shn_gis_map_control_deactivate_all(){
66
var nav = document.getElementById('gis_map_icon_select')
68
nav.style.backgroundImage = "url(res/OpenLayers/theme/default/img/move_feature_off.png)";
71
if(selectControl != null){
72
selectControl.unselectAll();
73
selectControl.deactivate();
74
document.getElementById('gis_map_icon_select').style.backgroundImage = "url(res/OpenLayers/theme/default/img/move_feature_off.png)";
77
if(dragControl != null){
78
dragControl.deactivate();
79
document.getElementById('gis_map_icon_drag').style.backgroundImage = "url(res/OpenLayers/theme/default/img/pan_off.png)";
82
//if(modifyControl != null){
83
//modifyControl.deactivate();
85
// Drop features/popups in progress from a create feature.
86
if(currentFeature != null && ((pointControl != null && pointControl.active) || (lineControl != null && lineControl.active) || (polygonControl != null && polygonControl.active))){
87
if(currentFeature.popup != null){
88
currentFeature.popup.hide();
89
currentFeature.popup.destroy(currentFeature.popup);
91
featuresLayer.removeFeatures([currentFeature]);
92
currentFeature.destroy();
93
currentFeature = null;
95
// Hide any popup showing and deactivate current feature.
96
if(currentFeature != null){
97
if(currentFeature.popup != null){
98
currentFeature.popup.hide();
100
currentFeature = null;
102
// Turn off point add
103
if(pointControl != null){
104
pointControl.deactivate();
105
document.getElementById('gis_map_icon_addpoint').style.backgroundImage = "url(res/OpenLayers/theme/default/img/draw_point_off.png)";
108
if(lineControl != null){
109
lineControl.deactivate();
110
document.getElementById('gis_map_icon_addline').style.backgroundImage = "url(res/OpenLayers/theme/default/img/draw_line_off.png)";
112
// Turn off polygon add
113
if(polygonControl != null){
114
polygonControl.deactivate();
115
document.getElementById('gis_map_icon_addpolygon').style.backgroundImage = "url(res/OpenLayers/theme/default/img/draw_polygon_off.png)";
b'\\ No newline at end of file'