Beispiel #1
0
        private void txtLayer_Click(object sender, EventArgs e)
        {
            Plugin.SelectLayerByTree frm = new Plugin.SelectLayerByTree(1);
            SysCommon.ModSysSetting.CopyLayerTreeXmlFromDataBase(Plugin.ModuleCommon.TmpWorkSpace, frm._LayerTreePath);
            if (frm.ShowDialog() == DialogResult.OK)
            {
                if (frm.m_NodeKey.Trim() != "")
                {
                    _ListLayers.Clear();
                    _ListFeatureClasses.Clear();
                    _ListLayerNames.Clear();
                    IMap        pMap    = _MapControl.Map;
                    XmlDocument pXmldoc = new XmlDocument();
                    pXmldoc.Load(frm._LayerTreePath);
                    ILayer pLayer = SysCommon.ModuleMap.GetLayerByNodeKey(Plugin.ModuleCommon.TmpWorkSpace, pMap, frm.m_NodeKey, pXmldoc);
                    pXmldoc = null;
                    IFeatureClass pFeatureClass = null;
                    string        strLayerName  = "";
                    if (pLayer != null)
                    {
                        strLayerName = pLayer.Name;
                        try
                        {
                            pFeatureClass = (pLayer as IFeatureLayer).FeatureClass;
                        }
                        catch
                        { }
                    }
                    else
                    {
                        pFeatureClass = ModQuery.GetFeatureClassByNodeKey(frm._LayerTreePath, frm.m_NodeKey, out strLayerName);
                    }
                    _ListLayers.Add(pLayer);
                    _ListLayerNames.Add(strLayerName);
                    _ListFeatureClasses.Add(pFeatureClass);
                    txtLayer.Text = strLayerName;
                }

                if (_ListFeatureClasses != null)
                {
                    if (_ListFeatureClasses.Count > 0)
                    {
                        IntialComBox(_ListFeatureClasses[0]);
                    }
                }
            }
        }
Beispiel #2
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);
            }
        }