Example #1
0
        public async virtual void AddShapefile()
        {
            this.IsBusy = true;

            var fileName = this.RequestOpenFile("shapefile|*.shp");

            if (!File.Exists(fileName))
            {
                this.IsBusy = false;

                return;
            }

            FileInfo info = new FileInfo(fileName);

            //if (info.Length / 10000.0 > 1000) //5k
            //{
            //    ShowMessage("حجم فایل انتخابی بیش از حد مجاز است");

            //    return;
            //}

            try
            {
                var dataSource = await Task.Run <IFeatureDataSource>(async() =>
                {
                    var shp = (await IRI.Ket.ShapefileFormat.Shapefile.ProjectAsync(fileName, new IRI.Ham.CoordinateSystem.MapProjection.WebMercator()))
                              .Select(i => i.AsSqlGeometry(3857))
                              .Where(i => !i.IsNotValidOrEmpty())
                              .ToList();

                    MemoryDataSource <object> source = new MemoryDataSource <object>(shp);

                    return(source);
                });

                var vectorLayer = new VectorLayer(Path.GetFileNameWithoutExtension(fileName), dataSource,
                                                  new VisualParameters(null, BrushHelper.PickBrush(), 3, 1),
                                                  LayerType.VectorLayer,
                                                  RenderingApproach.Default,
                                                  IRI.Jab.Cartography.Model.RasterizationApproach.GdiPlus, ScaleInterval.All);

                this.SetLayer(vectorLayer);

                this.Refresh();
            }
            catch (Exception ex)
            {
                ShowMessage(ex.Message);
            }
            finally
            {
                this.IsBusy = false;
            }
        }
Example #2
0
        public static VisualParameters CreateNew(double opacity = 1, double strokeThickness = 1, bool withoutFill = false)
        {
            Brush fill = null;

            if (!withoutFill)
            {
                fill = BrushHelper.PickGoodBrush();
            }

            return(new VisualParameters(fill, BrushHelper.PickBrush(), strokeThickness, opacity));
        }
Example #3
0
 private VisualParameters(double opacity)
     : this(BrushHelper.PickBrush(), BrushHelper.PickBrush(), 1, opacity)
 {
 }
Example #4
0
 public VectorLayer(string name, List <SqlGeometry> features, LayerType type, RenderingApproach rendering, RasterizationApproach toRasterTechnique)
     : this(name, features, new VisualParameters(BrushHelper.PickBrush(), BrushHelper.PickBrush(), 1, 1, Visibility.Visible), type, rendering, toRasterTechnique)
 {
 }