Пример #1
0
        // ***************** Duplicate ***************
        // *******************************************
        public static ILegendCommand CreateCloneDrawingItemCommand(MapPresenter map, DrawingItemLayer layer)
        {
            var result = new LegendCommand()
            {
                PathMarkup = IRI.Jab.Common.Assets.ShapeStrings.Appbar.appbarPageCopy,
                Layer      = layer,
                ToolTip    = "ایجاد کپی از عارضه",
            };

            result.Command = new RelayCommand(async param =>
            {
                try
                {
                    var cloned = layer.Geometry.Clone();

                    map.AddDrawingItem(cloned, $"{layer.LayerName} cloned-{map.CurrentZoomLevel}");
                }
                catch (Exception ex)
                {
                    await map.DialogService.ShowMessageAsync(null, ex.Message, null, null);
                }
            });

            return(result);
        }
Пример #2
0
        // ***************** Simplify by Area ********
        // *******************************************
        public static ILegendCommand CreateSimplifyByAreaCommand(MapPresenter map, DrawingItemLayer layer)
        {
            var result = new LegendCommand()
            {
                PathMarkup = IRI.Jab.Common.Assets.ShapeStrings.Appbar.appbarFlag,
                Layer      = layer,
                ToolTip    = "ساده‌سازی روش مساحت",
            };

            result.Command = new RelayCommand(async param =>
            {
                try
                {
                    var simplified = layer.Geometry.Simplify(SimplificationType.AdditiveByArea, map.CurrentZoomLevel, new SimplificationParamters()
                    {
                        Retain3Points = true
                    });
                    //VisualSimplification.sim layer.Geometry.Simplify()
                    map.AddDrawingItem(simplified, $"{layer.LayerName} simplified-{map.CurrentZoomLevel}");
                }
                catch (Exception ex)
                {
                    await map.DialogService.ShowMessageAsync(null, ex.Message, null, null);
                }
            });

            return(result);
        }
Пример #3
0
        // ***************** Extract points **********
        // *******************************************
        public static ILegendCommand CreateBreakIntoPointsCommand(MapPresenter map, DrawingItemLayer layer)
        {
            var result = new LegendCommand()
            {
                PathMarkup = IRI.Jab.Common.Assets.ShapeStrings.SegoePrint.extractPoints,
                Layer      = layer,
                ToolTip    = "تفکیک به نقاط",
            };

            result.Command = new RelayCommand(async param =>
            {
                try
                {
                    var pointCollection = IRI.Ket.SqlServerSpatialExtension.SqlSpatialUtility.MakePointCollection(layer.Geometry.GetAllPoints());

                    map.AddDrawingItem(pointCollection.AsGeometry(), $"{layer.LayerName} Points");
                }
                catch (Exception ex)
                {
                    await map.DialogService.ShowMessageAsync(null, ex.Message, null, null);
                }
            });

            return(result);
        }
Пример #4
0
        // ***************** Break into geometries ***
        // *******************************************
        public static ILegendCommand CreateBreakIntoGeometriesCommand(MapPresenter map, DrawingItemLayer layer)
        {
            var result = new LegendCommand()
            {
                PathMarkup = IRI.Jab.Common.Assets.ShapeStrings.SegoePrint.extractGeometries,
                Layer      = layer,
                ToolTip    = "تفکیک به هندسه",
            };

            result.Command = new RelayCommand(async param =>
            {
                try
                {
                    var geometries = layer.Geometry.AsSqlGeometry().GetGeometries();

                    var counter = 0;

                    foreach (var geo in geometries)
                    {
                        map.AddDrawingItem(geo.AsGeometry(), $"{layer.LayerName} Geometry #{counter++}");
                    }
                }
                catch (Exception ex)
                {
                    await map.DialogService.ShowMessageAsync(null, ex.Message, null, null);
                }
            });

            return(result);
        }
Пример #5
0
        // ***************** Boundary ****************
        // *******************************************
        public static ILegendCommand CreateGetBoundaryCommand(MapPresenter map, DrawingItemLayer layer)
        {
            var result = new LegendCommand()
            {
                PathMarkup = IRI.Jab.Common.Assets.ShapeStrings.SegoePrint.boundary,
                Layer      = layer,
                ToolTip    = "مرز",
            };

            result.Command = new RelayCommand(async param =>
            {
                try
                {
                    var geometry = layer.Geometry.AsSqlGeometry().STBoundary();

                    map.AddDrawingItem(geometry.AsGeometry(), $"{layer.LayerName}-Boundary");
                }
                catch (Exception ex)
                {
                    await map.DialogService.ShowMessageAsync(null, ex.Message, null, null);
                }
            });

            return(result);
        }
Пример #6
0
        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);
        }