Beispiel #1
0
        private void itemPanel1_ItemDoubleClick(object sender, MouseEventArgs e)
        {
            //若是左建双击缩放至要素:
            if (e.Clicks == 2)
            {
                ButtonItem item = new ButtonItem();
                item = sender as ButtonItem;
                if (item == null)
                {
                    return;
                }
                string FeatureClassName = item.Tooltip.Substring(item.Tooltip.IndexOf('.') + 1);
                string strOID           = item.Tooltip.Substring(0, item.Tooltip.IndexOf('.'));
                int    OID = Convert.ToInt32(strOID);

                IFeature   feature  = DBOperator.getFeatureFrom(OID, FeatureClassName, m_GlobalWorkspace);
                IGeometry5 geometry = feature.Shape as IGeometry5;
                this.m_MapCtrls.CenterAt(geometry.CentroidEx);
                this.m_MapCtrls.ActiveView.Extent = geometry.Envelope;
                ILayer iLayer = null;

                if (FeatureClassName.Contains("CheckItemPtn"))
                {
                    iLayer = m_MapCtrls.Map.Layer[1];
                }
                else if (FeatureClassName.Contains("CheckItemPtn"))
                {
                    iLayer = m_MapCtrls.Map.Layer[2];
                }
                else
                {
                    iLayer = m_MapCtrls.Map.Layer[3];
                }

                clearFeatureSelection();

                m_MapCtrls.Map.SelectFeature(iLayer, feature);
                //this.m_MapCtrls.ActiveView.FocusMap.SelectByShape(feature.Shape, null, true);
                //this.m_MapCtrls.ActiveView.FocusMap.SelectByShape(feature.Shape, selectionEnv, true);
            }
        }
Beispiel #2
0
 private void itemPanel3_ItemDoubleClick(object sender, MouseEventArgs e)
 {
     //双击,且不是点击非button item;
     if (e.Clicks == 2)
     {
         ButtonItem item = new ButtonItem();
         item = sender as ButtonItem;
         if (item == null)
         {
             return;
         }
         IFeature feature = DBOperator.getFeatureFrom(item.Name, Properties.Settings.Default.Grid, Properties.Settings.Default.GridCodeField, m_GlobalWorkspace);
         if (feature == null)
         {
             return;
         }
         IGeometry5 geometry = feature.Shape as IGeometry5;
         this.m_MapCtrls.CenterAt(geometry.CentroidEx);
         this.m_MapCtrls.ActiveView.Extent = geometry.Envelope;
     }
 }