private void Print_Load(object sender, EventArgs e) { //Mxd文件是否存在 //******??????会打印两页 if (axPageLayoutControl1.CheckMxFile(m_FileName)) { //加载Mxd到PageLayout axPageLayoutControl1.LoadMxFile(m_FileName, ""); IActiveView activeView = axPageLayoutControl1.ActiveView.FocusMap as IActiveView; IDisplayTransformation displayeTransformation = activeView.ScreenDisplay.DisplayTransformation; displayeTransformation.VisibleBounds = GIS.Common.DataEditCommon.g_pAxMapControl.Extent; displayeTransformation.Rotation = axMap.Rotation; double angle = Math.Round(displayeTransformation.Rotation, 0); ILayer player = GIS.Common.DataEditCommon.GetLayerByName(activeView.FocusMap, LayerNames.LAYER_ALIAS_MR_HCGZMWSYCLD); MyMapHelp.Angle_Symbol(player, -angle); player = GIS.Common.DataEditCommon.GetLayerByName(activeView.FocusMap, LayerNames.LAYER_ALIAS_MR_WSHLD); MyMapHelp.Angle_Symbol(player, -angle); player = GIS.Common.DataEditCommon.GetLayerByName(activeView.FocusMap, LayerNames.LAYER_ALIAS_MR_WSYLD); MyMapHelp.Angle_Symbol(player, -angle); //displayeTransformation.ReferenceScale = axMap.ReferenceScale; activeView.Refresh(); m_graphicContainer = axPageLayoutControl1.PageLayout as IGraphicsContainer; } //MapCopy(); InitToolBar(); InitializePrintPreviewDialog(); //初始化打印预览对话框 m_printDialog = new PrintDialog(); //打印对话框实例化 InitializePageSetupDialog(); //初始化打印设置对话框 }
void m_axmap_OnMouseMove(object sender, ESRI.ArcGIS.Controls.IMapControlEvents2_OnMouseMoveEvent e) { statusBarXY.Text = "当前坐标:" + string.Format("{0}, {1} {2}", e.mapX.ToString("#######.##"), e.mapY.ToString("#######.##"), //this.mapControl_OP.MapUnits.ToString().Substring(4)); MyMapHelp.mapUnit(m_axmap.MapUnits.ToString().Substring(4))); }
/// <summary> /// 20140801SDE中添加瓦斯压力点 /// </summary> private void DrawGasGushQuantityPt(GasPressure gasGushQuantityEntity) { var dCoordinateX = Convert.ToDouble(txtCoordinateX.Text); var dCoordinateY = Convert.ToDouble(txtCoordinateY.Text); var dCoordinateZ = Convert.ToDouble(txtCoordinateZ.Text); IPoint pt = new PointClass(); pt.X = dCoordinateX; pt.Y = dCoordinateY; pt.Z = dCoordinateZ; var pLayer = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, LayerNames.LAYER_ALIAS_MR_WSYLD); if (pLayer == null) { MessageBox.Show(@"未找到瓦斯压力点图层,无法绘制瓦斯压力点图元。"); return; } var pFeatureLayer = (IFeatureLayer)pLayer; IGeometry geometry = pt; var list = new List <ziduan> { new ziduan("bid", gasGushQuantityEntity.BindingId), new ziduan("mc", gasGushQuantityEntity.CoalSeams.ToString()), new ziduan("addtime", DateTime.Now.ToString(CultureInfo.InvariantCulture)) }; var wsyl = gasGushQuantityEntity.GasPressureValue.ToString(CultureInfo.InvariantCulture); var cdbg = gasGushQuantityEntity.CoordinateZ.ToString(CultureInfo.InvariantCulture); var ms = gasGushQuantityEntity.Depth.ToString(CultureInfo.InvariantCulture); if (DataEditCommon.strLen(cdbg) < DataEditCommon.strLen(ms)) { var count = DataEditCommon.strLen(ms) - DataEditCommon.strLen(cdbg); for (var i = 0; i < count; i++) { cdbg = " " + cdbg; // // 测点标高 } } else if (DataEditCommon.strLen(cdbg) > DataEditCommon.strLen(ms)) { var count = DataEditCommon.strLen(cdbg) - DataEditCommon.strLen(ms); for (var i = 0; i < count; i++) { ms += " "; } } list.Add(new ziduan("wsyl", wsyl)); list.Add(new ziduan("cdbg", cdbg)); list.Add(new ziduan("ms", ms)); var pfeature = DataEditCommon.CreateNewFeature(pFeatureLayer, geometry, list); if (pfeature != null) { MyMapHelp.Jump(pt); DataEditCommon.g_pMyMapCtrl.ActiveView.PartialRefresh( (esriViewDrawPhase)34, null, null); } }
public void refresh() { MyMapHelp.Show_IsVisiable(axMapControlZZT.Map, pLayer, "BID='" + BID + "'"); pGeometry = setgeo(pGeometry); axMapControlZZT.Extent = pGeometry.Envelope; axMapControlZZT.MapScale = blc; axMapControlZZT.ActiveView.Refresh(); }
private void toolItemZoom_Click(object sender, EventArgs e) { IPoint pt = getPT(); if (pt != null) { MyMapHelp.Jump(pt); } }
/// <summary> /// 图显按钮事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnMap_Click(object sender, EventArgs e) { // 获取已选择明细行的索引 var iSelIdxsArr = GetSelIdxs(); if (iSelIdxsArr == null) { MessageBox.Show("未选中数据行!"); return; } var bid = ""; //ILayer pLayer = GIS.Common.DataEditCommon.GetLayerByName(GIS.Common.DataEditCommon.g_pMap, GIS.LayerNames.DEFALUT_HENGCHUAN); //if (pLayer == null) //{ // MessageBox.Show("未发现横川图层!"); // return; //} //IFeatureLayer pFeatureLayer = (IFeatureLayer)pLayer; var str = ""; for (var i = 0; i < iSelIdxsArr.Length; i++) { bid = fpDayReportHChuan.Sheets[0].Cells[iSelIdxsArr[i], _BIDIndex].Text.Trim(); if (bid != "") { if (i == 0) { str = "bid='" + bid + "'"; } else { str += " or bid='" + bid + "'"; } } } var list = MyMapHelp.FindFeatureListByWhereClause(Global.hdfdfulllyr, str); if (list.Count > 0) { MyMapHelp.Jump(MyMapHelp.GetGeoFromFeature(list)); DataEditCommon.g_pMap.ClearSelection(); for (var i = 0; i < list.Count; i++) { DataEditCommon.g_pMap.SelectFeature(Global.hdfdfulllyr, list[i]); } WindowState = FormWindowState.Normal; Location = DataEditCommon.g_axTocControl.Location; Width = DataEditCommon.g_axTocControl.Width; Height = DataEditCommon.g_axTocControl.Height; DataEditCommon.g_pMyMapCtrl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, DataEditCommon.g_pAxMapControl.Extent); } else { Alert.alert("图元丢失"); } }
/// <summary> /// 带参数的构造方法 /// </summary> public FaultageInfoEntering(Faultage faultage) { InitializeComponent(); Faultage = faultage; // 设置窗体默认属性 FormDefaultPropertiesSetter.SetEnteringFormDefaultProperties(this, Const_GM.UPDATE_FAULTAGE_INFO); // 设置断层信息 // 断层名称 txtFaultageName.Text = Faultage.FaultageName; // 落差 txtGap.Text = Faultage.Gap; // 倾角 txtAngle.Text = Faultage.Angle.ToString(CultureInfo.InvariantCulture); // 类型 if (Const_GM.FRONT_FAULTAGE.Equals(Faultage.Type)) { rbtnFrontFaultage.Checked = true; } else { rbtnOppositeFaultage.Checked = true; } // 走向 txtTrend.Text = Faultage.Trend.ToString(CultureInfo.InvariantCulture); // 断距 txtSeparation.Text = Faultage.Separation; // 坐标X txtCoordinateX.Text = Faultage.CoordinateX.ToString(CultureInfo.InvariantCulture); // 坐标Y txtCoordinateY.Text = Faultage.CoordinateY.ToString(CultureInfo.InvariantCulture); // 坐标Z txtCoordinateZ.Text = Faultage.CoordinateZ.ToString(CultureInfo.InvariantCulture); //长度 var bid = Faultage.BindingId; var pLayer = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, LayerNames.DEFALUT_EXPOSE_FAULTAGE); var featureLayer = (IFeatureLayer)pLayer; if (pLayer == null) { txtLength.Text = @"0"; return; } var pFeature = MyMapHelp.FindFeatureByWhereClause(featureLayer, "BID='" + bid + "'"); if (pFeature != null) { var pline = (IPolyline)pFeature.Shape; if (pline == null) { return; } txtLength.Text = Math.Round(pline.Length).ToString(CultureInfo.InvariantCulture); } }
/// <summary> /// 跳转到地图上所在的位置 /// </summary> /// <params name="sender"></params> /// <params name="e"></params> private void btnMap_Click(object sender, EventArgs e) { var selectedIndex = gridView1.GetSelectedRows(); var list = selectedIndex.Select(i => (GasContent)gridView1.GetRow(i)).Select(gasContent => new PointClass { X = gasContent.coordinate_x, Y = gasContent.coordinate_y }).Cast <IPoint>().ToList(); MyMapHelp.Jump(MyMapHelp.GetGeoFromPoint(list)); }
/// <summary> /// 图显按钮事件 /// </summary> /// <params name="sender"></params> /// <params name="e"></params> private void btnMap_Click(object sender, EventArgs e) { // 获取已选择明细行的索引 int[] iSelIdxsArr = { ((InferFaultage)gridView1.GetFocusedRow()).id }; var pLayer = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, LayerNames.DEFALUT_INFERRED_FAULTAGE); if (pLayer == null) { MessageBox.Show(@"未发现推断断层图层!"); return; } var pFeatureLayer = (IFeatureLayer)pLayer; var str = ""; for (var i = 0; i < iSelIdxsArr.Length; i++) { var bid = ((InferFaultage)gridView1.GetFocusedRow()).bid; if (bid == "") { continue; } if (i == 0) { str = "bid='" + bid + "'"; } else { str += " or bid='" + bid + "'"; } } var list = MyMapHelp.FindFeatureListByWhereClause(pFeatureLayer, str); if (list.Count > 0) { MyMapHelp.Jump(MyMapHelp.GetGeoFromFeature(list)); DataEditCommon.g_pMap.ClearSelection(); for (var i = 0; i < list.Count; i++) { DataEditCommon.g_pMap.SelectFeature(pLayer, list[i]); } WindowState = FormWindowState.Normal; Location = DataEditCommon.g_axTocControl.Location; Width = DataEditCommon.g_axTocControl.Width; Height = DataEditCommon.g_axTocControl.Height; DataEditCommon.g_pMyMapCtrl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, DataEditCommon.g_pAxMapControl.Extent); } else { Alert.AlertMsg("图元丢失"); } }
/// <summary> /// 带参数的构造方法 /// </summary> public FaultageInfoEntering(Faultage faultage) { InitializeComponent(); Faultage = faultage; // 设置断层信息 // 断层名称 txtFaultageName.Text = Faultage.name; // 落差 txtGap.Text = Faultage.gap; // 倾角 txtAngle.Text = Faultage.angle.ToString(CultureInfo.InvariantCulture); // 类型 if (Faultage.type == "正断层") { rbtnFrontFaultage.Checked = true; } else { rbtnOppositeFaultage.Checked = true; } // 走向 txtTrend.Text = Faultage.trend.ToString(CultureInfo.InvariantCulture); // 断距 txtSeparation.Text = Faultage.separation; // 坐标X txtCoordinateX.Text = Faultage.coordinate_x.ToString(CultureInfo.InvariantCulture); // 坐标Y txtCoordinateY.Text = Faultage.coordinate_y.ToString(CultureInfo.InvariantCulture); // 坐标Z txtCoordinateZ.Text = Faultage.coordinate_z.ToString(CultureInfo.InvariantCulture); //长度 var bid = Faultage.bid; var pLayer = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, LayerNames.DEFALUT_EXPOSE_FAULTAGE); var featureLayer = (IFeatureLayer)pLayer; if (pLayer == null) { txtLength.Text = @"0"; return; } var pFeature = MyMapHelp.FindFeatureByWhereClause(featureLayer, "BID='" + bid + "'"); if (pFeature != null) { var pline = (IPolyline)pFeature.Shape; if (pline == null) { return; } txtLength.Text = Math.Round(pline.Length).ToString(CultureInfo.InvariantCulture); } }
private void dgrdvZhzzt_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 4 && Alert.confirm(Const.DEL_CONFIRM_MSG)) { //删除 if (GIS.Common.DataEditCommon.DeleteFeatureByWhereClause(frmzhzzt.pFeatureClass, "BID='" + dgrdvZhzzt.Rows[e.RowIndex].Cells[2].Value.ToString() + "'")) { binddata(); } } if (e.ColumnIndex == 5) { //打开 string bid = dgrdvZhzzt.Rows[e.RowIndex].Cells[2].Value.ToString(); string bilichi = dgrdvZhzzt.Rows[e.RowIndex].Cells[3].Value.ToString(); List <ESRI.ArcGIS.Geometry.IGeometry> listgeo = new List <ESRI.ArcGIS.Geometry.IGeometry>(); IQueryFilter pFilter = new QueryFilterClass(); pFilter.WhereClause = "BID='" + bid + "'"; IFeatureCursor pCursor = frmzhzzt.pFeatureClass.Search(pFilter, false); IFeature pFeature = pCursor.NextFeature(); while (pFeature != null) { listgeo.Add(pFeature.Shape); pFeature = pCursor.NextFeature(); } frmzhzzt.pGeometry = MyMapHelp.GetGeoFromGeos(listgeo); frmzhzzt.BID = bid; frmzhzzt.blc = Convert.ToDouble(bilichi); DialogResult = DialogResult.OK; this.Close(); } if (e.ColumnIndex == 6) { //修改 this.Close(); string bid = dgrdvZhzzt.Rows[e.RowIndex].Cells[2].Value.ToString(); FrmNewZHZZT frm = new FrmNewZHZZT(frmzhzzt, bid); frm.Show(frmzhzzt); } if (e.ColumnIndex == 0) { if (dgrdvZhzzt.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString().ToLower() == "true") { dgrdvZhzzt.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = false; } else { dgrdvZhzzt.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = true; } } }
void m_axmap_OnViewRefreshed(object sender, IMapControlEvents2_OnViewRefreshedEvent e) { if (Math.Round(m_axmap.Rotation, 0) != angle) { angle = Math.Round(m_axmap.Rotation, 0); txtRoate.Text = angle.ToString(); ILayer player = GIS.Common.DataEditCommon.GetLayerByName(m_axmap.Map, LayerNames.LAYER_ALIAS_MR_HCGZMWSYCLD); MyMapHelp.Angle_Symbol(player, -angle); player = GIS.Common.DataEditCommon.GetLayerByName(m_axmap.Map, LayerNames.LAYER_ALIAS_MR_WSHLD); MyMapHelp.Angle_Symbol(player, -angle); player = GIS.Common.DataEditCommon.GetLayerByName(m_axmap.Map, LayerNames.LAYER_ALIAS_MR_WSYLD); MyMapHelp.Angle_Symbol(player, -angle); } }
private void btnMap_Click(object sender, EventArgs e) { var faultage = (Faultage)gridView1.GetFocusedRow(); var bid = faultage.bid; var pLayer = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, LayerNames.DEFALUT_EXPOSE_FAULTAGE); if (pLayer == null) { MessageBox.Show(@"未发现揭露断层图层!"); return; } var pFeatureLayer = (IFeatureLayer)pLayer; var str = ""; //for (int i = 0; i < iSelIdxsArr.Length; i++) //{ if (bid != "") { if (true) { str = "bid='" + bid + "'"; } //else // str += " or bid='" + bid + "'"; } //} var list = MyMapHelp.FindFeatureListByWhereClause(pFeatureLayer, str); if (list.Count > 0) { MyMapHelp.Jump(MyMapHelp.GetGeoFromFeature(list)); DataEditCommon.g_pMap.ClearSelection(); foreach (var t in list) { DataEditCommon.g_pMap.SelectFeature(pLayer, t); } WindowState = FormWindowState.Normal; Location = DataEditCommon.g_axTocControl.Location; Width = DataEditCommon.g_axTocControl.Width; Height = DataEditCommon.g_axTocControl.Height; DataEditCommon.g_pMyMapCtrl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, DataEditCommon.g_pAxMapControl.Extent); } else { Alert.AlertMsg("图元丢失"); } }
private void tStripBtnOpen_Click(object sender, EventArgs e) { FrmManageZhzzt frm = new FrmManageZhzzt(this); if (frm.ShowDialog(this) == DialogResult.OK) { MyMapHelp.Show_IsVisiable(axMapControlZZT.Map, pLayer, "BID='" + BID + "'"); pGeometry = setgeo(pGeometry); axMapControlZZT.Extent = pGeometry.Envelope; axMapControlZZT.MapScale = blc; axMapControlZZT.ActiveView.Refresh(); } else { MyMapHelp.Show_IsVisiable(axMapControlZZT.Map, pLayer, "BID='-1'"); } }
/// <summary> /// 图显按钮事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnMap_Click(object sender, EventArgs e) { // 获取已选择明细行的索引 var pLayer = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, LayerNames.DEFALUT_BOREHOLE); if (pLayer == null) { MessageBox.Show(@"未发现钻孔图层!"); return; } var pFeatureLayer = (IFeatureLayer)pLayer; var str = ""; var bid = ((Borehole)gridView1.GetFocusedRow()).BindingId; if (bid != "") { if (true) { str = "bid='" + bid + "'"; } //else // str += " or bid='" + bid + "'"; } var list = MyMapHelp.FindFeatureListByWhereClause(pFeatureLayer, str); if (list.Count > 0) { MyMapHelp.Jump(MyMapHelp.GetGeoFromFeature(list)); DataEditCommon.g_pMap.ClearSelection(); foreach (var t in list) { DataEditCommon.g_pMap.SelectFeature(pLayer, t); } WindowState = FormWindowState.Normal; Location = DataEditCommon.g_axTocControl.Location; Width = DataEditCommon.g_axTocControl.Width; Height = DataEditCommon.g_axTocControl.Height; DataEditCommon.g_pMyMapCtrl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, DataEditCommon.g_pAxMapControl.Extent); } else { Alert.alert("图元丢失"); } }
/// <summary> /// 图显按钮事件 /// </summary> /// <params name="sender"></params> /// <params name="e"></params> private void btnMap_Click(object sender, EventArgs e) { var pLayer = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, LayerNames.LAYER_ALIAS_MR_XianLuoZhu1); if (pLayer == null) { MessageBox.Show(@"未发现陷落柱图层!"); return; } var pFeatureLayer = (IFeatureLayer)pLayer; var str = ""; var obj = (CollapsePillar)gridView1.GetFocusedRow(); var bid = obj.bid; if (bid != "") { if (true) { str = "bid='" + bid + "'"; } //else // str += " or bid='" + bid + "'"; } var list = MyMapHelp.FindFeatureListByWhereClause(pFeatureLayer, str); if (list.Count > 0) { MyMapHelp.Jump(MyMapHelp.GetGeoFromFeature(list)); DataEditCommon.g_pMap.ClearSelection(); foreach (var t in list) { DataEditCommon.g_pMap.SelectFeature(pLayer, t); } WindowState = FormWindowState.Normal; Location = DataEditCommon.g_axTocControl.Location; Width = DataEditCommon.g_axTocControl.Width; Height = DataEditCommon.g_axTocControl.Height; DataEditCommon.g_pMyMapCtrl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, DataEditCommon.g_pAxMapControl.Extent); } else { Alert.AlertMsg("图元丢失"); } }
private void btnMap_Click(object sender, EventArgs e) { // 获取已选择明细行的索引 var pLayer = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, LayerNames.LAYER_ALIAS_MR_TUNNEL); if (pLayer == null) { MessageBox.Show(@"未发现巷道全图层!"); return; } var pFeatureLayer = (IFeatureLayer)pLayer; //for (int i = 0; i < iSelIdxsArr.Length; i++) //{ var tunnel = (Tunnel)gridView1.GetFocusedRow(); //if (bid != "") //{ //if (true) var str = "HdId='" + tunnel.TunnelId + "'"; //else // str += " or HdId='" + bid + "'"; //} //} var list = MyMapHelp.FindFeatureListByWhereClause(pFeatureLayer, str); if (list.Count > 0) { MyMapHelp.Jump(MyMapHelp.GetGeoFromFeature(list)); DataEditCommon.g_pMap.ClearSelection(); foreach (var t in list) { DataEditCommon.g_pMap.SelectFeature(pLayer, t); } WindowState = FormWindowState.Normal; Location = DataEditCommon.g_axTocControl.Location; Width = DataEditCommon.g_axTocControl.Width; Height = DataEditCommon.g_axTocControl.Height; DataEditCommon.g_pMyMapCtrl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, DataEditCommon.g_pAxMapControl.Extent); } else { Alert.alert("图元丢失"); } }
private void FrmZhzzt_Load(object sender, EventArgs e) { axMapControlZZT.LoadMxFile(Application.StartupPath + @"\综合柱状图.mxd"); pLayer = DataEditCommon.GetLayerByName(axMapControlZZT.Map, LayerNames.LAYER_ALIAS_MR_Zhuzhuang); ESRI.ArcGIS.Carto.IFeatureLayer pFeatureLayer = (ESRI.ArcGIS.Carto.IFeatureLayer)pLayer; pFeatureClass = pFeatureLayer.FeatureClass; if (pFeatureLayer == null) { MessageBox.Show("柱状图图层缺失!"); this.Close(); return; } if (pFeatureClass == null) { MessageBox.Show("柱状图图层缺失!"); this.Close(); return; } if (BID == "" || pGeometry == null) { return; } List <IGeometry> listgeo = new List <IGeometry>(); IQueryFilter pFilter = new QueryFilterClass(); pFilter.WhereClause = "BID='" + BID + "'"; IFeatureCursor pCursor = pFeatureClass.Search(pFilter, false); IFeature pFeature = pCursor.NextFeature(); while (pFeature != null) { listgeo.Add(pFeature.Shape); pFeature = pCursor.NextFeature(); } pGeometry = setgeo(MyMapHelp.GetGeoFromGeos(listgeo)); axMapControlZZT.Extent = pGeometry.Envelope; axMapControlZZT.MapScale = blc; axMapControlZZT.ActiveView.Refresh(); }
/// <summary> /// 图显按钮事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnMap_Click(object sender, EventArgs e) { var pLayer = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, LayerNames.LAYER_ALIAS_MR_TUNNEL_FD); if (pLayer == null) { MessageBox.Show(@"未发现掘进进尺图层!"); return; } var pFeatureLayer = (IFeatureLayer)pLayer; var str = ""; //for (int i = 0; i < iSelIdxsArr.Length; i++) //{ var bid = ((DayReportJj)gridView1.GetFocusedRow()).BindingId; if (bid != "") { if (true) { str = "bid='" + bid + "'"; } //else // str += " or bid='" + bid + "'"; } //} var list = MyMapHelp.FindFeatureListByWhereClause(pFeatureLayer, str); if (list.Count > 0) { MyMapHelp.Jump(MyMapHelp.GetGeoFromFeature(list)); } else { Alert.alert("图元丢失"); } }
/// <summary> /// 20140801SDE中添加瓦斯涌出量点 /// </summary> private void DrawGasGushQuantityPt(GasGushQuantity gasGushQuantityEntity) { var dCoordinateX = Convert.ToDouble(txtCoordinateX.Text); var dCoordinateY = Convert.ToDouble(txtCoordinateY.Text); var dCoordinateZ = Convert.ToDouble(txtCoordinateZ.Text); IPoint pt = new PointClass(); pt.X = dCoordinateX; pt.Y = dCoordinateY; pt.Z = dCoordinateZ; var pLayer = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, LayerNames.LAYER_ALIAS_MR_HCGZMWSYCLD); if (pLayer == null) { MessageBox.Show(@"未找到瓦斯涌出量点图层,无法绘制瓦斯涌出量点图元。"); return; } var pFeatureLayer = (IFeatureLayer)pLayer; IGeometry geometry = pt; var list = new List <ziduan> { new ziduan("bid", gasGushQuantityEntity.binding_id), new ziduan("mc", gasGushQuantityEntity.coal_seam.ToString()), new ziduan("addtime", DateTime.Now.ToString(CultureInfo.InvariantCulture)) }; var hcny = gasGushQuantityEntity.stope_date.ToLongDateString(); var ydwsycl = gasGushQuantityEntity.absolute_gas_gush_quantity.ToString(CultureInfo.InvariantCulture); var xdwsycl = gasGushQuantityEntity.relative_gas_gush_quantity.ToString(CultureInfo.InvariantCulture); var gzmrcl = gasGushQuantityEntity.working_face_day_output.ToString(CultureInfo.InvariantCulture); if (DataEditCommon.strLen(ydwsycl) < DataEditCommon.strLen(xdwsycl)) { var count = DataEditCommon.strLen(xdwsycl) - DataEditCommon.strLen(ydwsycl); for (var i = 0; i < count; i++) { ydwsycl += " "; } } else if (DataEditCommon.strLen(ydwsycl) > DataEditCommon.strLen(xdwsycl)) { var count = DataEditCommon.strLen(ydwsycl) - DataEditCommon.strLen(xdwsycl); for (var i = 0; i < count; i++) { xdwsycl += " "; } } if (DataEditCommon.strLen(gzmrcl) < DataEditCommon.strLen(hcny)) { var count = DataEditCommon.strLen(hcny) - DataEditCommon.strLen(gzmrcl); for (var i = 0; i < count; i++) { gzmrcl = " " + gzmrcl; } } else if (DataEditCommon.strLen(gzmrcl) > DataEditCommon.strLen(hcny)) { var count = DataEditCommon.strLen(gzmrcl) - DataEditCommon.strLen(hcny); for (var i = 0; i < count; i++) { hcny += " "; } } list.Add(new ziduan("hcny", hcny)); list.Add(new ziduan("jdwsycl", ydwsycl)); list.Add(new ziduan("xdwsycl", xdwsycl)); list.Add(new ziduan("gzmrcl", gzmrcl)); var pfeature = DataEditCommon.CreateNewFeature(pFeatureLayer, geometry, list); if (pfeature != null) { MyMapHelp.Jump(pt); DataEditCommon.g_pMyMapCtrl.ActiveView.PartialRefresh((esriViewDrawPhase)34, null, null); } }
//延伸 private void mniExtend_ItemClick(object sender, ItemClickEventArgs e) { MyMapHelp.SetCurrentTool(new ExtendTool()); }
/// <summary> /// 未见煤钻孔 /// </summary> /// <param name="breholeEntity">钻孔实体</param> private void DrawZuanKong(Borehole breholeEntity) { ////1.获得当前编辑图层 //DrawSpecialCommon drawspecial = new DrawSpecialCommon(); //string sLayerAliasName = LibCommon.LibLayerNames.DEFALUT_BOREHOLE;//“默认_钻孔”图层 //IFeatureLayer featureLayer = drawspecial.GetFeatureLayerByName(sLayerAliasName); //if (featureLayer == null) //{ // MessageBox.Show("未找到" + sLayerAliasName + "图层,无法绘制钻孔图元。"); // return; //} ////2.绘制图元 //IPoint pt = new PointClass(); //pt.X = breholeEntity.CoordinateX; //pt.Y = breholeEntity.CoordinateY; //pt.Z = breholeEntity.CoordinateZ; //if (pt.Z == double.NaN) // pt.Z = 0; //GIS.SpecialGraphic.DrawZK2 drawZK2 = null; ////标注内容 //string strH =breholeEntity.GroundElevation.ToString();//地面标高 //string strName = breholeEntity.BoreholeNumber.ToString();//孔号(名称) //IFeature feature = featureLayer.FeatureClass.CreateFeature(); //IGeometry geometry = pt; //DataEditCommon.ZMValue(feature, geometry); //几何图形Z值处理 ////drawspecial.ZMValue(feature, geometry); //几何图形Z值处理 //feature.Shape = pt;//要素形状 ////要素ID字段赋值(对应属性表中BindingID) //int iFieldID = feature.Fields.FindField("ID"); //feature.Value[iFieldID] = breholeEntity.BindingId.ToString(); //feature.Store();//存储要素 //string strValue = feature.get_Value(feature.Fields.FindField("OBJECTID")).ToString(); //DataEditCommon.SpecialPointRenderer(featureLayer, "OBJECTID", strValue, drawZK2.m_Bitmap); /////3.显示钻孔图层 //if (featureLayer.Visible == false) // featureLayer.Visible = true; //IEnvelope envelop = feature.Shape.Envelope; //DataEditCommon.g_pMyMapCtrl.ActiveView.Extent = envelop; //DataEditCommon.g_pMyMapCtrl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewBackground, null, null); //DataEditCommon.g_pMyMapCtrl.ActiveView.Refresh(); IPoint pt = new PointClass(); pt.X = breholeEntity.CoordinateX; pt.Y = breholeEntity.CoordinateY; pt.Z = breholeEntity.CoordinateZ; if (double.IsNaN(pt.Z)) { pt.Z = 0; } var pLayer = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, LayerNames.DEFALUT_BOREHOLE); if (pLayer == null) { MessageBox.Show(@"未找到钻孔图层,无法绘制钻孔图元。"); return; } var pFeatureLayer = (IFeatureLayer)pLayer; IGeometry geometry = pt; var list = new List <ziduan> { new ziduan(GIS_Const.FIELD_BID, breholeEntity.BindingId), new ziduan(GIS_Const.FIELD_BOREHOLE_NUMBER, breholeEntity.BoreholeNumber), new ziduan(GIS_Const.FIELD_ADD_TIME, DateTime.Now.ToString(CultureInfo.InvariantCulture)), new ziduan(GIS_Const.FIELD_GROUND_ELEVATION, breholeEntity.GroundElevation.ToString(CultureInfo.InvariantCulture)), new ziduan(GIS_Const.FIELD_GROUND_FLOOR_ELEVATION, ""), new ziduan(GIS_Const.FIELD_THICKNESS, ""), new ziduan(GIS_Const.FIELD_TYPE, "1") }; var pfeature = DataEditCommon.CreateNewFeature(pFeatureLayer, geometry, list); if (pfeature == null) { return; } MyMapHelp.Jump(pt); DataEditCommon.g_pMyMapCtrl.ActiveView.PartialRefresh( (esriViewDrawPhase)34, null, null); }
private void DrawXlz(List <CollapsePillarsPoint> lstCollapsePillarsEntKeyPts, string sCollapseId) { ILayer mPCurrentLayer = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, LayerNames.LAYER_ALIAS_MR_XianLuoZhu1); var pFeatureLayer = mPCurrentLayer as IFeatureLayer; INewBezierCurveFeedback pBezier = new NewBezierCurveFeedbackClass(); IPoint pt; IPolyline polyline = new PolylineClass(); for (int i = 0; i < lstCollapsePillarsEntKeyPts.Count; i++) { pt = new PointClass(); var mZAware = (IZAware)pt; mZAware.ZAware = true; pt.X = lstCollapsePillarsEntKeyPts[i].CoordinateX; pt.Y = lstCollapsePillarsEntKeyPts[i].CoordinateY; pt.Z = lstCollapsePillarsEntKeyPts[i].CoordinateZ; if (i == 0) { pBezier.Start(pt); } else if (i == lstCollapsePillarsEntKeyPts.Count - 1) { pBezier.AddPoint(pt); pt = new PointClass(); var zZAware = (IZAware)pt; zZAware.ZAware = true; pt.X = lstCollapsePillarsEntKeyPts[0].CoordinateX; pt.Y = lstCollapsePillarsEntKeyPts[0].CoordinateY; pt.Z = lstCollapsePillarsEntKeyPts[0].CoordinateZ; pBezier.AddPoint(pt); polyline = pBezier.Stop(); } else { pBezier.AddPoint(pt); } } //polyline = (IPolyline)geo; var pSegmentCollection = polyline as ISegmentCollection; if (pSegmentCollection != null) { for (int i = 0; i < pSegmentCollection.SegmentCount; i++) { pt = new PointClass(); var mZAware = (IZAware)pt; mZAware.ZAware = true; pt.X = lstCollapsePillarsEntKeyPts[i].CoordinateX; pt.Y = lstCollapsePillarsEntKeyPts[i].CoordinateY; pt.Z = lstCollapsePillarsEntKeyPts[i].CoordinateZ; IPoint pt1 = new PointClass(); mZAware = (IZAware)pt1; mZAware.ZAware = true; if (i == pSegmentCollection.SegmentCount - 1) { pt1.X = lstCollapsePillarsEntKeyPts[0].CoordinateX; pt1.Y = lstCollapsePillarsEntKeyPts[0].CoordinateY; pt1.Z = lstCollapsePillarsEntKeyPts[0].CoordinateZ; pSegmentCollection.Segment[i].FromPoint = pt; pSegmentCollection.Segment[i].ToPoint = pt1; } else { pt1.X = lstCollapsePillarsEntKeyPts[i + 1].CoordinateX; pt1.Y = lstCollapsePillarsEntKeyPts[i + 1].CoordinateY; pt1.Z = lstCollapsePillarsEntKeyPts[i + 1].CoordinateZ; pSegmentCollection.Segment[i].FromPoint = pt; pSegmentCollection.Segment[i].ToPoint = pt1; } } } polyline = pSegmentCollection as IPolyline; //polyline = DataEditCommon.PDFX(polyline, "Bezier"); IPolygon pPolygon = DataEditCommon.PolylineToPolygon(polyline); var list = new List <ziduan> { new ziduan("COLLAPSE_PILLAR_NAME", lstCollapsePillarsEntKeyPts.First().CollapsePillars.CollapsePillarsName), new ziduan("BID", sCollapseId), radioBtnX.Checked ? new ziduan("XTYPE", "0") : new ziduan("XTYPE", "1") }; IFeature pFeature = DataEditCommon.CreateNewFeature(pFeatureLayer, pPolygon, list); if (pFeature != null) { MyMapHelp.Jump(pFeature.Shape); DataEditCommon.g_pMyMapCtrl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewBackground, null, null); } #region 暂时无用 //string sTempFolderPath = System.Windows.Forms.Application.StartupPath + "\\TempFolder"; /////1.将关键点坐标存储到临时文件中 //string sPtsCoordinateTxtPath = sTempFolderPath + "\\PtsCoordinate.txt"; //bool bIsWrite = WritePtsInfo2Txt(lstCollapsePillarsEntKeyPts, sPtsCoordinateTxtPath); //if (!bIsWrite) return; /////2.读取点坐标文件拟合生成陷落柱,仿照等值线 /////步骤:点文件生成点要素层→转为Raster→提取等值线 //Geoprocessor GP = new Geoprocessor(); //string featureOut = sTempFolderPath + "\\KeyPts.shp"; //DrawContours.ConvertASCIIDescretePoint2FeatureClass(GP, sPtsCoordinateTxtPath, featureOut);//点文件生成点要素层 //string sRasterOut = sTempFolderPath + "\\Raster"; //DrawContours.ConvertFeatureCls2Raster(GP, featureOut, sRasterOut);//要素层→Raster //string sR2Contour = sTempFolderPath + "\\Contour.shp"; //double douElevation = 0.5;//等高距0.5 //DrawContours.SplineRasterToContour(GP, sRasterOut, sR2Contour, douElevation);//提取等值线(即为拟合的陷落柱) /////3.复制生成的等值线(即为拟合的陷落柱)要素到陷落柱图层 /////3.1 获得源图层 //IFeatureLayer sourceFeaLayer = new FeatureLayerClass(); //string sourcefeatureClassName = "Contour.shp"; //IFeatureClass featureClass =PointsFit2Polyline.GetFeatureClassFromShapefileOnDisk(sTempFolderPath, sourcefeatureClassName);//获得等值线(即为拟合的陷落柱)图层 //if (featureClass == null) return; //sourceFeaLayer.FeatureClass = featureClass; /////3.2 获得当前编辑图层(目标图层) //DrawSpecialCommon drawspecial = new DrawSpecialCommon(); //string sLayerAliasName = LibCommon.LibLayerNames.DEFALUT_COLLAPSE_PILLAR;//“默认_陷落柱_1”图层 //IFeatureLayer featureLayer = drawspecial.GetFeatureLayerByName(sLayerAliasName); //if (featureLayer == null) //{ // MessageBox.Show("未找到" + sLayerAliasName + "图层,无法绘制陷落柱图元。"); // return; //} /////3.3 复制要素 //PointsFit2Polyline.CopyFeature(sourceFeaLayer, featureLayer, sCollapseID); #endregion }
//放大 private void mniMagnify_ItemClick(object sender, ItemClickEventArgs e) { MyMapHelp.SetCurrentTool(new ZoomInTool()); }
/// <summary> /// 绘制井筒图元 /// </summary> /// <param name="pitshaftEntity"></param> private void DrawJingTong(Pitshaft pitshaftEntity) { ////1.获得当前编辑图层 //DrawSpecialCommon drawspecial = new DrawSpecialCommon(); //string sLayerAliasName = LibCommon.LibLayerNames.DEFALUT_JINGTONG;//“默认_井筒”图层 //IFeatureLayer featureLayer = drawspecial.GetFeatureLayerByName(sLayerAliasName); //if (featureLayer == null) //{ // MessageBox.Show("未找到" + sLayerAliasName + "图层,无法绘制井筒图元。"); // return; //} ////2.绘制井筒 //double X = Convert.ToDouble(this.txtFigureCoordinateX.Text.ToString()); //double Y = Convert.ToDouble(this.txtFigureCoordinateY.Text.ToString()); //IPoint pt = new PointClass(); //pt.X = X; //pt.Y = Y; //double dZ = 0; //if (!string.IsNullOrEmpty(this.txtFigureCoordinateZ.Text)) //{ // double.TryParse(this.txtFigureCoordinateZ.Text, out dZ); //} //pt.Z = dZ; ////标注内容 //string strH =(Convert.ToDouble(this.txtWellheadElevation.Text.ToString())+ // Convert.ToDouble(this.txtWellbottomElevation.Text.ToString())).ToString();//井口标高+井底标高 //string strX = SplitStr(this.txtPitshaftCoordinateX.Text.ToString()); //string strY = SplitStr(this.txtPitshaftCoordinateY.Text.ToString()); ////string strName =this.cobPitshaftType.SelectedValue.ToString()+":"+ //// this.txtPitshaftName.Text.ToString(); //string strName = this.cobPitshaftType.SelectedValue.ToString() + ":" + // this.txtPitshaftName.Text.ToString(); //GIS.SpecialGraphic.DrawJT drawJT = new GIS.SpecialGraphic.DrawJT(strX, strY, strH, strName); ////dfs //DataEditCommon.InitEditEnvironment(); //DataEditCommon.CheckEditState(); //DataEditCommon.g_CurWorkspaceEdit.StartEditOperation(); ////dfe //IFeature feature = featureLayer.FeatureClass.CreateFeature(); //IGeometry geometry = pt; //DataEditCommon.ZMValue(feature, geometry); //几何图形Z值处理 ////drawspecial.ZMValue(feature, geometry);//几何图形Z值处理 //feature.Shape = pt; ////要素ID字段赋值(对应属性表中BindingID) //int iFieldID = feature.Fields.FindField(GIS_Const.FIELD_BID); //feature.Value[iFieldID] = pitshaftEntity.BindingId.ToString(); //feature.Store(); //DataEditCommon.g_CurWorkspaceEdit.StopEditOperation(); //string strValue = feature.get_Value(feature.Fields.FindField(GIS_Const.FIELD_OBJECTID)).ToString(); //DataEditCommon.SpecialPointRenderer(featureLayer, GIS_Const.FIELD_OBJECTID, strValue, drawJT.m_Bitmap); /////3.显示井筒图层 //if (featureLayer.Visible == false) // featureLayer.Visible = true; ////缩放到新增的线要素,并高亮该要素 //GIS.Common.DataEditCommon.g_pMyMapCtrl.ActiveView.Extent = feature.Shape.Envelope; //GIS.Common.DataEditCommon.g_pMyMapCtrl.ActiveView.Extent.Expand(2.5, 2.5, true); //GIS.Common.DataEditCommon.g_pMyMapCtrl.Map.SelectFeature(featureLayer, feature); //GIS.Common.DataEditCommon.g_pMyMapCtrl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewAll, null, null); ////DataEditCommon.g_pMyMapCtrl.ActiveView.Refresh(); var X = Convert.ToDouble(txtFigureCoordinateX.Text); var Y = Convert.ToDouble(txtFigureCoordinateY.Text); IPoint pt = new PointClass(); pt.X = X; pt.Y = Y; double dZ = 0; if (!string.IsNullOrEmpty(txtFigureCoordinateZ.Text)) { double.TryParse(txtFigureCoordinateZ.Text, out dZ); } pt.Z = dZ; var pLayer = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, LayerNames.DEFALUT_JINGTONG); if (pLayer == null) { MessageBox.Show("未找到井筒图层,无法绘制井筒图元。"); return; } var pFeatureLayer = (IFeatureLayer)pLayer; IGeometry geometry = pt; var list = new List <ziduan>(); list.Add(new ziduan("bid", pitshaftEntity.BindingId)); list.Add(new ziduan("mc", pitshaftEntity.PitshaftName)); list.Add(new ziduan("addtime", DateTime.Now.ToString())); list.Add(new ziduan("jkgc", pitshaftEntity.WellheadElevation.ToString())); list.Add(new ziduan("jdgc", pitshaftEntity.WellbottomElevation.ToString())); list.Add(new ziduan("yt", cobPitshaftType.Text)); list.Add(new ziduan("x", pitshaftEntity.PitshaftCoordinateX.ToString())); list.Add(new ziduan("y", pitshaftEntity.PitshaftCoordinateY.ToString())); list.Add(new ziduan("h", (pitshaftEntity.WellbottomElevation + pitshaftEntity.WellheadElevation).ToString())); var pfeature = DataEditCommon.CreateNewFeature(pFeatureLayer, geometry, list); if (pfeature != null) { MyMapHelp.Jump(pt); DataEditCommon.g_pMyMapCtrl.ActiveView.PartialRefresh( esriViewDrawPhase.esriViewGeography | esriViewDrawPhase.esriViewForeground, null, null); } }
/// <summary> /// 完成新建对象,取得绘制的对象,并添加到图层中 /// 建议在Map.DblClick或Map.MouseDown(Button = 2)事件中调用本方法 /// </summary> public void NewFeatureEnd() { IGeometry pGeom = null; IPointCollection pPointCollection; object obj = Type.Missing; try { if (m_pFeedback is INewMultiPointFeedback) { INewMultiPointFeedback pMPFeed = (INewMultiPointFeedback)m_pFeedback; pMPFeed.Stop(); pGeom = (IGeometry)m_pPointCollection; if (m_GeometryCollection == null) { m_GeometryCollection = new PointClass() as IGeometryCollection; } m_GeometryCollection.AddGeometryCollection(pGeom as IGeometryCollection); } else if (m_pFeedback is INewLineFeedback) { INewLineFeedback pLineFeed = (INewLineFeedback)m_pFeedback; if (m_GeometryCollection == null) { m_GeometryCollection = new PolylineClass() as IGeometryCollection; } IPolyline pPolyLine = pLineFeed.Stop(); pPointCollection = (IPointCollection)pPolyLine; if (pPointCollection.PointCount < 2) { MessageBox.Show("至少输入两个节点"); } else { pGeom = (IGeometry)pPointCollection; } m_GeometryCollection.AddGeometryCollection(pGeom as IGeometryCollection); } else if (m_pFeedback is INewPolygonFeedback) { INewPolygonFeedback pPolyFeed = (INewPolygonFeedback)m_pFeedback; if (m_GeometryCollection == null) { m_GeometryCollection = new PolygonClass() as IGeometryCollection; } IPolygon pPolygon; pPolygon = pPolyFeed.Stop(); if (pPolygon != null) { pPointCollection = (IPointCollection)pPolygon; if (pPointCollection.PointCount < 3) { MessageBox.Show("至少输入三个节点"); } else { pGeom = (IGeometry)pPointCollection; } m_GeometryCollection.AddGeometryCollection(pGeom as IGeometryCollection); } } if (pFeatureLayer.FeatureClass.ShapeType == esriGeometryType.esriGeometryPolyline) { IPolyline pline = MyMapHelp.PolygonToPolyline(m_GeometryCollection as IPolygon); CreateFeature(pline as IGeometry); } else { CreateFeature(m_GeometryCollection as IGeometry); } m_pFeedback = null; m_bInUse = false; m_GeometryCollection = null; } catch (Exception e) { m_pFeedback = null; m_bInUse = false; m_GeometryCollection = null; Console.WriteLine(e.Message.ToString()); } }
private void tStripBtnSave_Click(object sender, EventArgs e) { MyMapHelp.ExportPicPdf((IMapControl3)axMapControlZZT.Object); }
//缩小 private void mniShrink_ItemClick(object sender, ItemClickEventArgs e) { MyMapHelp.SetCurrentTool(new ZoomOutTool()); }
//平移 private void mniOffset_ItemClick(object sender, ItemClickEventArgs e) { MyMapHelp.SetCurrentTool(new PanTool()); }
//局部视图 private void mniBrokenView_ItemClick(object sender, ItemClickEventArgs e) { MyMapHelp.SetCurrentTool(new LocalView()); }