Exemplo n.º 1
0
        public override void OnClick()
        {//XZQLocation
            if (_hook == null)
            {
                return;
            }
            if (_hook.MainUserControl == null)
            {
                return;
            }

            IGeometry xzqGeo = ModGetData.getExtentByXZQ(m_xzqTree.SelectedNode);

            if (xzqGeo == null)
            {
                SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "未找到相应的行政区范围!");
                return;
            }
            ///ZQ  20111027 add  判断数据字典是否初始化
            if (SysCommon.ModField._DicFieldName.Count == 0)
            {
                SysCommon.ModField.InitNameDic(Plugin.ModuleCommon.TmpWorkSpace, SysCommon.ModField._DicFieldName, "属性对照表");
            }
            IList <string> listMapNo = new List <string>();
            IEnvelope      pExtent   = xzqGeo.Envelope;

            pExtent.Expand(1.5, 1.5, true);//跟地位效果一样 xisheng 20111104
            (_AppHk.ArcGisMapControl.Map as IActiveView).Extent = pExtent;
            //ZQ    20110914    modify   改变显示方式
            //drawPolygonElement(pGeometry as IPolygon, psGra);
            _AppHk.ArcGisMapControl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewBackground, null, null);
            //end
            //ZQ   20110809   modify   先刷新后闪烁问题
            _AppHk.ArcGisMapControl.ActiveView.ScreenDisplay.UpdateWindow();
            //end
            _AppHk.ArcGisMapControl.FlashShape(xzqGeo, 3, 200, null);
            //这里需要修改NodeKey 的值      ZQ  20110801     Add
            try
            {
                string        strMapNoField = "";
                string        NodeKey       = GetNodeKey("1:50000", out strMapNoField).ToString();//不同比例尺的接图表的ID号
                IFeatureClass pFeatureClass = ModQuery.GetFeatureClassByNodeKey(NodeKey);
                if (strMapNoField == "")
                {
                    return;
                }
                if (pFeatureClass == null)
                {
                    return;
                }
                ISpatialFilter pSpatialFilter = new SpatialFilterClass();
                pSpatialFilter.Geometry   = xzqGeo;
                pSpatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects;
                IFeatureCursor pFeaCursor = pFeatureClass.Search(pSpatialFilter, false);
                IFeature       pFeature   = pFeaCursor.NextFeature();
                while (pFeature != null)
                {
                    //ZQ   20110807  modify
                    listMapNo.Add((pFeature.get_Value(pFeature.Table.FindField(strMapNoField))).ToString());
                    //end
                    pFeature = pFeaCursor.NextFeature();
                }

                pFeaCursor = null;
                GeoUtilities.Gis.Form.frmExportDataByMapNO pfrmExportDataByMapNO = new GeoUtilities.Gis.Form.frmExportDataByMapNO(listMapNo, true, false, false, false, _AppHk.ArcGisMapControl as IMapControlDefault, _hook.CurWksInfo.Wks);
                pfrmExportDataByMapNO.ShowDialog();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
            }
        }