Ejemplo n.º 1
0
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog();

            dialog.Multiselect = true;//该值确定是否可以选择多个文件
            dialog.Title       = "请选择文件";
            dialog.Filter      = "ESRI Shapefile(*.shp)|*.shp|所有文件(*.*)|*.*";
            if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                string        file     = dialog.FileName;
                WEVectorLayer newLayer = WEIO.ReadLayer(file);
                newLayer.InitializeData();
                newLayer.SelectDisplay();

                AllLayer.Add(newLayer);
                weMapControl1.AllLayer = AllLayer;

                treeView1.Nodes.Clear();
                foreach (var layer in AllLayer)
                {
                    TreeNode node0_0 = new TreeNode();
                    node0_0.Text    = layer.LayerName;
                    node0_0.Checked = layer.Visible;
                    treeView1.Nodes.Add(node0_0);
                }

                if (AllLayer.Count() != 0)
                {
                    weMapControl1.FullExitence();
                }
            }
        }
Ejemplo n.º 2
0
        public WELayer(string filePath, FeatureType layerType = FeatureType.WENULL)
        {
            string fileType = filePath.Split('.').Last();

            if (fileType == "shp")
            {
                WELayer newLayer = WEIO.ReadLayer(filePath);
                this._ID          = newLayer.ID;
                this._LayerName   = newLayer.LayerName;
                this._FileName    = filePath;
                this._Description = newLayer.Description;
                this._FeatureType = newLayer.FeatureType;
                this._LayerStyle  = newLayer.SymbolStyle;
                this._MBR         = newLayer._MBR;
                this._Visible     = true;
                this._Selectable  = true;
            }
            else if (fileType == "tif")
            {
                ;
            }
        }