//public static Func<MapPresenter, FeatureTableCommand> CreateZoomToExtentCommandFunc = (presenter) => CreateZoomToExtentCommand(presenter); public static FeatureTableCommand CreateZoomToExtentCommand(MapPresenter map) { var result = new FeatureTableCommand() { PathMarkup = IRI.Jab.Common.Assets.ShapeStrings.Appbar.appbarMagnify, //Layer = layer.AssociatedLayer, ToolTip = "محدودهٔ عوارض" }; result.Command = new RelayCommand((param) => { var layer = param as ISelectedLayer; if (layer == null || map == null) { return; } var features = layer.GetHighlightedFeatures(); var extent = BoundingBox.GetMergedBoundingBox(features.Select(f => f.TheSqlGeometry.GetBoundingBox())); map.ZoomToExtent(extent, false, () => { TryFlashPoint(map, features); }); }); return(result); }
public static FeatureTableCommand CreateExportAsDrawingLayersCommand(MapPresenter map) { var result = new FeatureTableCommand() { PathMarkup = IRI.Jab.Common.Assets.ShapeStrings.Appbar.appbarVectorPenAdd, //Layer = layer.AssociatedLayer, ToolTip = "انتقال به ترسیمها" }; result.Command = new RelayCommand((param) => { var layer = param as ISelectedLayer; if (layer == null || map == null) { return; } var features = layer.GetHighlightedFeatures(); if (features.IsNullOrEmpty()) { return; } foreach (var feature in features) { map.AddDrawingItem(feature.TheSqlGeometry.AsGeometry()); } // //List<Dictionary<string, object>> rows = new List<Dictionary<string, object>>(); //foreach (var item in features) //{ // if (item is SqlFeature feature) // { // rows.Add(feature.Attributes); // } //} ////گرفتن مسیر فایل //var fileName = map.SaveFile("*.xlsx|*.xlsx"); //if (string.IsNullOrWhiteSpace(fileName)) // return; //Ket.OfficeFormat.ExcelHelper.WriteDictionary(rows, fileName, "Sheet1", null, null); }); return(result); }
public static FeatureTableCommand Create(Action action, string markup, string tooltip) { var result = new FeatureTableCommand() { PathMarkup = markup, Command = new RelayCommand(param => action()), ToolTip = tooltip, }; result.Command = new RelayCommand(param => action()); return(result); }
public static FeatureTableCommand CreateExportToExcelCommand(MapPresenter map) { var result = new FeatureTableCommand() { PathMarkup = IRI.Jab.Common.Assets.ShapeStrings.Appbar.appbarPageExcel, //Layer = layer.AssociatedLayer, ToolTip = "خروجی اکسل" }; result.Command = new RelayCommand((param) => { var layer = param as ISelectedLayer; if (layer == null || map == null) { return; } var features = layer.GetSelectedFeatures(); // List <Dictionary <string, object> > rows = new List <Dictionary <string, object> >(); foreach (var item in features) { if (item is SqlFeature feature) { rows.Add(feature.Attributes); } } //گرفتن مسیر فایل var fileName = map.DialogService.ShowSaveFileDialog("*.xlsx|*.xlsx", null, layer.LayerName); if (string.IsNullOrWhiteSpace(fileName)) { return; } Ket.OfficeFormat.ExcelHelper.WriteDictionary(rows, fileName, "Sheet1", null, null); }); return(result); }