1
// We add the controls in mf_toolbar.js
3
// Add control to add new points to the map.
4
pointControl = new OpenLayers.Control.DrawFeature(featuresLayer, OpenLayers.Handler.Point);
5
pointControl.featureAdded = shn_gis_map_create_feature;
6
map.addControl(pointControl);
8
// Add control to add new lines to the map.
9
lineControl = new OpenLayers.Control.DrawFeature(featuresLayer, OpenLayers.Handler.Path);
10
lineControl.featureAdded = shn_gis_map_create_feature;
11
map.addControl(lineControl);
13
// Add control to add new polygons to the map.
14
polygonControl = new OpenLayers.Control.DrawFeature(featuresLayer, OpenLayers.Handler.Polygon);
15
polygonControl.featureAdded = shn_gis_map_create_feature;
16
map.addControl(polygonControl);
18
// Add control to select features (showing info popup).
19
selectControl = new OpenLayers.Control.SelectFeature(featuresLayer, {
20
onSelect: onFeatureSelect_1,
21
onUnselect: onFeatureUnselect_1,
26
map.addControl(selectControl);
28
// Supports feature select control.
29
function onFeatureSelect_1(feature){
30
// Set global for back referencing
31
currentFeature = feature;
32
if (feature.popup.map == null) {
33
map.addPopup(feature.popup);
36
feature.popup.toggle();
39
// Supports feature select control.
40
function onFeatureUnselect_1(feature) {
46
// Add control to drag internal features around the map.
47
// unused currently (will need to be careful about icon clash with Map pan/drag!)
48
dragControl = new OpenLayers.Control.DragFeature(featuresLayer, {
49
onComplete: shn_gis_popup_edit_position
51
//map.addControl(dragControl);
53
// Called by dragControl after editing a Features position
54
function shn_gis_popup_edit_position(feature, pixel)
56
xmlHttp = GetXmlHttpObject();
58
alert ("Your browser does not support AJAX!");
61
currentFeature = feature;
62
// Move features popup to new location
63
feature.popup.lonlat = feature.geometry.getBounds().getCenterLonLat();
64
// Need id before clone
65
var id = feature.fid.substring(6)
66
// Clone to stop any effects on the current feature.
67
var cfcopy = feature.clone();
69
var lonlat = cfcopy.geometry.getBounds().getCenterLonLat().clone();
70
var proj_current = map.getProjectionObject();
71
lonlat.transform(proj_current, proj4326);
74
var wkt = cfcopy.geometry.transform(proj_current, proj4326).toString();
76
//ToDo: =URL(r=request,c='gis',f='feature',args=['create'],vars=dict(format='json')
77
var url='index.php?act=gis_popup_edit_position&mod=xst&stream=text&id=' + id;
78
url = url + "¢er_lat=" + lat + "¢er_lon=" + lon + "&wkt=" + wkt;
79
url = url +"&sid=" + Math.random();
80
//xmlHttp.onreadystatechange = shn_gis_popup_print;
81
xmlHttp.open("GET", url, true);
85
// Add control to modify the shape of internal features on the map.
86
// WARNING this seems to cause select feature to behaviour strangely
87
//(eg being able to drag a selected feature even if modify is disabled)
88
//modifyControl = new OpenLayers.Control.ModifyFeature(featuresLayer);
89
//map.addControl(modifyControl);
90
//modifyControl.mode = OpenLayers.Control.ModifyFeature.RESHAPE;
91
//modifyControl.mode &= ~OpenLayers.Control.ModifyFeature.DRAG;
93
// Start with select activated.
94
// unused_ol_controls_switch.js
95
//shn_gis_map_control_select();
b'\\ No newline at end of file'