Esempio n. 1
0
        public ILayer Create(string layerName, string connectionInfo)
        {
            var generator = new XYFileMapPointSetGenerator(connectionInfo);
            var points    = generator.GeneratePoints(false);

            var table = new FeatureDataTable();

            table.Columns.Add(new DataColumn("Label", typeof(string)));
            table.Columns.Add(new DataColumn("SiteID", typeof(int)));
            table.Columns.Add(new DataColumn("SiteVisitID", typeof(int)));
            table.Columns.Add(new DataColumn("MaterialID", typeof(int)));

            foreach (MapPoint mp in points)
            {
                var row = table.NewRow();
                row.Geometry       = new Point(mp.Longitude, mp.Latitude);
                row["Label"]       = mp.Label;
                row["SiteID"]      = mp.SiteID;
                row["SiteVisitID"] = mp.SiteVisitID;
                row["MaterialID"]  = mp.MaterialID;

                table.AddRow(row);
            }
            string labelLayerName = string.Format("{0} Labels", points.Name);
            var    shapeFileLayer = new VectorLayer(points.Name, new GeometryFeatureProvider(table))
            {
                SmoothingMode = SmoothingMode.AntiAlias, Style = { Symbol = MapSymbolGenerator.GetSymbolForPointSet(points), PointSize = points.Size }
            };

            return(shapeFileLayer);
        }
        private void LoadPointFile()
        {
            var frm = new OpenFileDialog();

            frm.Filter = "XY Files (*.xy)|*.xy|All Files (*.*)|*.*";
            if (frm.ShowDialog(this.FindParentWindow()) == true)
            {
                var generator = new XYFileMapPointSetGenerator(frm.FileName);
                var set       = generator.GeneratePoints(false);
                AddPointSet(set);
            }
        }
Esempio n. 3
0
        public ILayer Create(string layerName, string connectionInfo)
        {
            var generator = new XYFileMapPointSetGenerator(connectionInfo);
            var points = generator.GeneratePoints(false);

            var table = new FeatureDataTable();
            table.Columns.Add(new DataColumn("Label", typeof(string)));
            table.Columns.Add(new DataColumn("SiteID", typeof(int)));
            table.Columns.Add(new DataColumn("SiteVisitID", typeof(int)));
            table.Columns.Add(new DataColumn("MaterialID", typeof(int)));

            foreach (MapPoint mp in points) {
                var row = table.NewRow();
                row.Geometry = new Point(mp.Longitude, mp.Latitude);
                row["Label"] = mp.Label;
                row["SiteID"] = mp.SiteID;
                row["SiteVisitID"] = mp.SiteVisitID;
                row["MaterialID"] = mp.MaterialID;

                table.AddRow(row);
            }
            string labelLayerName = string.Format("{0} Labels", points.Name);
            var shapeFileLayer = new VectorLayer(points.Name, new GeometryFeatureProvider(table)) { SmoothingMode = SmoothingMode.AntiAlias, Style = { Symbol = MapSymbolGenerator.GetSymbolForPointSet(points), PointSize = points.Size } };

            return shapeFileLayer;
        }