Hello,
I am having a slight issue with editing and manipulating features on ThinkGeo project.
I have designed the project so that users are able to select and edit features that they have drawn on the map.
Currently the user is able to move, edit, resize and rotate features and this does work. However, the user has to click on the feature twice in order to display the edit controls.
For example, a user selects one of the features they have drawn on the map. When the feature has been selected, they user clicks the ‘Move Feature’ button to be able to enter edit mode and move the selected feature. When the ‘Move Feature’ button is selected however, the user needs to select that feature again in order to display the Move Control. The same applies for displaying the Resize, Rotate and Edit Control nodes too.
What I require is for the Move, Resize, Rotate and Edit Control nodes to display automatically when the user clicks the ‘Move Feature’ button, essentially cutting out the extra mouse click that the user currently has to do.
Here is a sample of the code in question:
Javascript
function EditFeature(actionName, settingEnum) {
GISView.ajaxCallAction('Map', 'StartEdit', { action: actionName }, function (result)
{
var json = result.get_responseData();
var featureSet = GISView.getFeaturesFromJson(json);
var editOverlay = GISView.getEditOverlay();
editOverlay.addFeatures(featureSet);
GISView.setEditSetting(settingEnum);
_MapStateEdit = true;
}
}
Server Side Code
public string StartEdit(Map map, GeoCollection<object> args)
{
string action = args[0] as string;
if (String.IsNullOrWhiteSpace(action))
return StringNotificationResult("Error Editing Features", "The edit action was undefined. Please reload the map and try again.");
else
Session["EditAction"] = action;
ProjectData prjData = (ProjectData)Session[CurrentMap];
var highlightOverlay = map.CustomOverlays[HighlightOverlay] as LayerOverlay;
var highlightLayer = highlightOverlay.Layers[0] as FeatureLayer;
// get the features to edit
highlightLayer.Open();
var featureSet = highlightLayer.QueryTools.GetAllFeatures(ReturningColumnsType.NoColumns);
highlightLayer.Close();
// Make sure that none belong to a ref layer
if (featureSet.Any(x => ((FeatureTag)x.Tag).associatedDatasourceName != prjData.projectName))
return StringNotificationResult(
"Error Editing Features",
"Some selected features cannot be edited, please deselect those features and try again."
);
// what is being returned?
if (featureSet.Count == 1)
return MapHelper.ConvertFeaturesToJson(featureSet)
}
I’m not sure if the feature is now on the HighlightOverlay and EditOverlay and the hightlightoverlay is appearing above the editoverlay layer? or that the feature on the editoverlay layer has not been selected so needs an extra click to display the nodes?
Any help is greatly appreciated.