~shikharkohli/sahana-eden/gsoc1

« back to all changes in this revision

Viewing changes to views/gis/unused/unused_ol_controls_switch.js

  • Committer: Shikhar Kohli
  • Date: 2010-08-11 18:40:09 UTC
  • mfrom: (802.1.156 eden)
  • Revision ID: shikharkohli@gmail.com-20100811184009-yy8zag5dowlam0ip
Merge trunk and update (a bit) of JS

Show diffs side-by-side

added added

removed removed

Lines of Context:
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';
6
 
}
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();
13
 
}
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();
20
 
}
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();
27
 
}
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();
34
 
}
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();
41
 
}
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();
48
 
}
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;
56
 
    } else{
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;
61
 
    }
62
 
}
63
 
// Deactivate all other controls
64
 
function shn_gis_map_control_deactivate_all(){
65
 
    // Turn off navigate
66
 
    var nav = document.getElementById('gis_map_icon_select')
67
 
    if(nav != null){
68
 
        nav.style.backgroundImage = "url(res/OpenLayers/theme/default/img/move_feature_off.png)";
69
 
    }
70
 
    // Turn off select
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)";
75
 
    }
76
 
    // Turn off drag
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)";
80
 
    }
81
 
    // Turn off modify
82
 
    //if(modifyControl != null){
83
 
    //modifyControl.deactivate();
84
 
    //}
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);
90
 
        }
91
 
        featuresLayer.removeFeatures([currentFeature]);
92
 
        currentFeature.destroy();
93
 
        currentFeature = null;
94
 
    }
95
 
    // Hide any popup showing and deactivate current feature.
96
 
    if(currentFeature != null){
97
 
        if(currentFeature.popup != null){
98
 
            currentFeature.popup.hide();
99
 
        }
100
 
        currentFeature = null;
101
 
    }
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)";
106
 
    }
107
 
    // Turn off line add
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)";
111
 
    }
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)";
116
 
    }
117
 
}
 
 
b'\\ No newline at end of file'