Exemplo n.º 1
0
        private void btnQuery_Click(object sender, EventArgs e)
        {
            _waitForm = new WaitForm()
            {
                VisibleBackButton         = false,
                VisibleprogressBarControl = false,
                TopMost = true
            };
            _waitForm.Worker.RunWorkerCompleted += Worker_RunWorkerCompleted;
            _waitForm.Worker.DoWork             += Worker_DoWork;

            _waitForm.Description = "状态:正在查询交叉口,请稍等...";
            _waitForm.Show();
            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.comboRoad2.FindString(this.comboRoad2.Text);
                    if (num < 0)
                    {
                        string text2 = $"道路名称[{this.comboRoad2.Text}]错误!";
                        MessageBox.Show(text2);
                    }
                    else
                    {
                        itemInfo = (this.comboRoad2.Items[num] as QueryIntersectionUI.ItemInfo);
                        int oID2 = itemInfo.OID;

                        _waitForm.Worker.RunWorkerAsync(new int[] { oID, oID2 });
                    }
                }
            }
        }
Exemplo n.º 2
0
 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(@"选择的道路没有交叉口!");
                 }
             }
         }
     }
 }