Can I create a custom Move Tool similar to ArcGIS Pro's Move Tool but only selects a particular feature layer (point) and moves it within a range on a polyline?
Hi Anandha,
To select features from particular layer set Tool property UseSnapping to true. Then switch off snapping on all map layers except layer you need. In sample all snappable layers are separated by ";" in the input string.
public static async Task ConfigureSnappingAsync(string sLayerNames)
{
// General Snapping
Snapping.IsEnabled = true;
Snapping.SetSnapMode(SnapMode.Point, true);
// Snapping on any point Feature Layers
var flayers = MapView.Active.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>().ToList();
if (flayers.Count() > 0)
//GetDefinition and SetDefinition must be called inside QueuedTask
await QueuedTask.Run(() => {
string sNames = string.Empty;
if (!string.IsNullOrEmpty(sLayerNames))
sNames = sLayerNames.ToUpper();
}
foreach (var fl in flayers)
var layerDef = fl.GetDefinition() as CIMGeoFeatureLayerBase;
if (string.IsNullOrEmpty(sNames))
if (!layerDef.Snappable)
layerDef.Snappable = true;
fl.SetDefinition(layerDef);
else
string searchName = fl.Name.ToUpper() + ";";
layerDef.Snappable = sNames.Contains(searchName);
});
The next step is more complicated. There are two ways:
1. Control mouse cursor (set direction you want)
2. Change cursor icon on mouse move then user selects wrong direction and do not accept wrong position on mouse down.
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.