private void 打开文件ToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog dialog = new OpenFileDialog(); dialog.Multiselect = true;//该值确定是否可以选择多个文件 dialog.Title = "请选择文件"; dialog.Filter = "Yao, Zhang, Yin(*.yzy)|*.yzy|所有文件(*.*)|*.*"; if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string file = dialog.FileName; WEMap wEMap = WEIO.ReadMap(dialog.FileName); AllLayer.Clear(); AllLayer.AddRange(wEMap.VectorLayers.ToArray()); 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(); } } }
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(); } } }
private void 导出图层ToolStripMenuItem_Click(object sender, EventArgs e) { SaveFileDialog saved = new SaveFileDialog(); if (saved.ShowDialog() == DialogResult.OK) { WEIO.SaveLayer(AllLayer[StyleLayerNum], saved.FileName); } }
private void 导出文件ToolStripMenuItem_Click(object sender, EventArgs e) { SaveFileDialog saved = new SaveFileDialog(); if (saved.ShowDialog() == DialogResult.OK) { WEIO.SaveMap(new WEMap(saved.FileName, AllLayer.ToArray(), -180, 180, -90, 90), saved.FileName); foreach (var i in AllLayer) { WEIO.SaveLayer(i, i.LayerName); } } }
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") { ; } }