public static ILegendCommand CreateSelectByDrawing <T>(MapPresenter map, VectorLayer layer) where T : class, ISqlGeometryAware { var result = new LegendCommand() { PathMarkup = IRI.Jab.Common.Assets.ShapeStrings.Appbar.appbarVectorPenConvert, Layer = layer, ToolTip = "انتخاب عوارض محدودهٔ ترسیم", }; result.Command = new RelayCommand(async param => { var options = EditableFeatureLayerOptions.CreateDefaultForDrawing(false, false); options.IsOptionsAvailable = false; var drawingResult = await map.GetDrawingAsync(Model.DrawMode.Polygon, options); if (!drawingResult.HasNotNullResult()) { return; } var features = layer.GetFeatures <T>(drawingResult.Result.AsSqlGeometry()); if (features == null) { return; } var newLayer = new Model.Map.SelectedLayer <T>(layer) { ShowSelectedOnMap = true }; if (features != null) { newLayer.Features = new System.Collections.ObjectModel.ObservableCollection <T>(features); } map.AddSelectedLayer(newLayer); }); return(result); }