private void btnCancel_Click(object sender, EventArgs e) { QueryIntersectionUI.DeleteAllElements(this.m_MapControl); base.Close(); }
private void QueryIntersectionUI_FormClosed(object sender, FormClosedEventArgs e) { QueryIntersectionUI.DeleteAllElements(this.m_MapControl); }
private void btnQuery_Click(object sender, EventArgs e) { if (this.m_pFtLayer != null) { int num = this.comboRoad1.FindString(this.comboRoad1.Text); if (num < 0) { string text = $"道路名称[{this.comboRoad1.Text}]错误!"; MessageBox.Show(text); } else { QueryIntersectionUI.ItemInfo itemInfo = this.comboRoad1.Items[num] as QueryIntersectionUI.ItemInfo; int oID = itemInfo.OID; num = this.comboRoad1.FindString(this.comboRoad2.Text); if (num < 0) { string text2 = $"道路名称[{this.comboRoad2.Text}]错误!"; MessageBox.Show(text2); } else { itemInfo = (this.comboRoad1.Items[num] as QueryIntersectionUI.ItemInfo); int oID2 = itemInfo.OID; IFeatureClass featureClass = this.m_pFtLayer.FeatureClass; IFeature feature = featureClass.GetFeature(oID); IFeature feature2 = featureClass.GetFeature(oID2); IPolyline polyline = feature.Shape as IPolyline; ITopologicalOperator topologicalOperator = polyline as ITopologicalOperator; IGeometry geometry = null; if (topologicalOperator != null) { geometry = topologicalOperator.Intersect(feature2.Shape, (esriGeometryDimension)1); } if (!geometry.IsEmpty) { IMultipoint multipoint = geometry as IMultipoint; IPointCollection pointCollection = multipoint as IPointCollection; IPoint point = pointCollection.get_Point(0); if (point != null) { this.m_pGeoFlash = point; this.timer1.Start(); this.timer1.Interval = 100; IEnvelope envelope = new Envelope() as IEnvelope; envelope = this.m_MapControl.Extent; envelope.CenterAt(point); this.m_MapControl.Extent = (envelope); this.m_MapControl.Refresh((esriViewDrawPhase)32, null, envelope); this.m_nTimerCount = 0; QueryIntersectionUI.NewBasePointElement(this.m_MapControl, point); } } else { MessageBox.Show(@"选择的道路没有交叉口!"); } } } } }