public void ToolToolLibrary(string toolName) { bool isFea = false; ILayer layer = null; switch (toolName) { case "AddPoint": MapEditing.CreateLayer pCreatePointLayer = new CreateLayer(m_mapControl); pCreatePointLayer.CreatePointLayer(); break; case "AddPolyLine": MapEditing.CreateLayer pCreatePolylineLayer = new CreateLayer(m_mapControl); pCreatePolylineLayer.CreatePolylineLayer(); break; case "AddPolygon": MapEditing.CreateLayer pCreatePolygonLayer = new CreateLayer(m_mapControl); pCreatePolygonLayer.CreatePolygonLayer(); break; case "DrawPoint": for (int i = 0; i < this.m_mapControl.LayerCount; i++) { layer = this.m_mapControl.get_Layer(i); if (layer is IFeatureLayer) { isFea = true; break; } } if (isFea == false) { MessageBox.Show("请先添加SHP数据!", "提示"); return; } TextToShapefile pTextToPoint = new TextToShapefile(m_mapControl, m_statusBar); pTextToPoint.TextToPoint(); break; case "DrawPointandAtrri": for (int i = 0; i < this.m_mapControl.LayerCount; i++) { layer = this.m_mapControl.get_Layer(i); if (layer is IFeatureLayer) { isFea = true; break; } } if (isFea == false) { MessageBox.Show("请先添加SHP数据!", "提示"); return; } //TextToShapefile pTextToPoint = new TextToShapefile(m_mapControl, m_statusBar); //pTextToPoint.TextToPoint(); frmField frmfield = new frmField(this.m_mapControl, this.m_statusBar); frmfield.ShowDialog(); break; case "DrawPolyLine": for (int i = 0; i < this.m_mapControl.LayerCount; i++) { layer = this.m_mapControl.get_Layer(i); if (layer is IFeatureLayer) { isFea = true; break; } } if (isFea == false) { MessageBox.Show("请先添加SHP数据!", "提示"); return; } TextToShapefile pTextToPolyline = new TextToShapefile(m_mapControl, m_statusBar); pTextToPolyline.TextToPolyline(); break; case "DrawPolygon": for (int i = 0; i < this.m_mapControl.LayerCount; i++) { layer = this.m_mapControl.get_Layer(i); if (layer is IFeatureLayer) { isFea = true; break; } } if (isFea == false) { MessageBox.Show("请先添加SHP数据!", "提示"); return; } TextToShapefile pTextToPolygon = new TextToShapefile(m_mapControl, m_statusBar); pTextToPolygon.TextToPolygon(); break; } }
public void ToolToolLibrary(string toolName) { bool isFea = false; ILayer layer = null; switch (toolName) { case "AddPoint": MapEditing.CreateLayer pCreatePointLayer = new CreateLayer(m_mapControl); pCreatePointLayer.CreatePointLayer(); break; case "AddPolyLine": MapEditing.CreateLayer pCreatePolylineLayer = new CreateLayer(m_mapControl); pCreatePolylineLayer.CreatePolylineLayer(); break; case "AddPolygon": MapEditing.CreateLayer pCreatePolygonLayer = new CreateLayer(m_mapControl); pCreatePolygonLayer.CreatePolygonLayer(); break; case "DrawPoint": for (int i = 0; i < this.m_mapControl.LayerCount; i++) { layer = this.m_mapControl.get_Layer(i); if (layer is IFeatureLayer) { isFea = true; break; } } if (isFea == false) { MessageBox.Show("请先添加SHP数据!", "提示"); return; } TextToShapefile pTextToPoint = new TextToShapefile(m_mapControl, m_statusBar); pTextToPoint.TextToPoint(); break; case"DrawPointandAtrri": for (int i = 0; i < this.m_mapControl.LayerCount; i++) { layer = this.m_mapControl.get_Layer(i); if (layer is IFeatureLayer) { isFea = true; break; } } if (isFea == false) { MessageBox.Show("请先添加SHP数据!", "提示"); return; } //TextToShapefile pTextToPoint = new TextToShapefile(m_mapControl, m_statusBar); //pTextToPoint.TextToPoint(); frmField frmfield = new frmField(this.m_mapControl,this.m_statusBar); frmfield.ShowDialog(); break; case "DrawPolyLine": for (int i = 0; i < this.m_mapControl.LayerCount; i++) { layer = this.m_mapControl.get_Layer(i); if (layer is IFeatureLayer) { isFea = true; break; } } if (isFea == false) { MessageBox.Show("请先添加SHP数据!", "提示"); return; } TextToShapefile pTextToPolyline = new TextToShapefile(m_mapControl, m_statusBar); pTextToPolyline.TextToPolyline(); break; case "DrawPolygon": for (int i = 0; i < this.m_mapControl.LayerCount; i++) { layer = this.m_mapControl.get_Layer(i); if (layer is IFeatureLayer) { isFea = true; break; } } if (isFea == false) { MessageBox.Show("请先添加SHP数据!", "提示"); return; } TextToShapefile pTextToPolygon = new TextToShapefile(m_mapControl, m_statusBar); pTextToPolygon.TextToPolygon(); break; } }