private void gvResult_DoubleClick(object sender, EventArgs e) { if (this.m_ContentType == enumContentType.Rule) return; DataRow rowError = gvResult.GetFocusedDataRow(); if (rowError == null) return; if (this.m_HookHelper.FocusMap != null) { IMap theMap = this.m_HookHelper.FocusMap; theMap.ClearSelection(); string strTargetLayer = rowError[Field_Name_TargetLayer] as string; if ((enumErrorType)rowError["ErrorType"] == enumErrorType.Topology) strTargetLayer = rowError["TPTC"] as string; MapLayersController mapController = new MapLayersController(theMap); mapController.SetAllLayersVisible(false); mapController.SetLayerVisible(strTargetLayer, true); if (rowError.Table.Columns.Contains(Field_Name_ReferLayer)) { string strReferLayer = rowError[Field_Name_ReferLayer] as string; mapController.SetLayerVisible(strReferLayer, true); } IFeature fRefer = null; IFeature fError=GetErrorFeature(rowError,ref fRefer); if (this.SelectedErrorFeatureChanged != null) this.SelectedErrorFeatureChanged.Invoke(fError,fRefer); //if (fRefer!=null && this.SelectedReferFeatureChanged != null) // this.SelectedReferFeatureChanged.Invoke(fRefer); if (fError != null) { Hy.Common.Utility.Esri.MapOperAPI.ZoomToFeature(Control.FromHandle((IntPtr)(this.m_HookHelper.Hook as IMapControl2).hWnd) as AxMapControl, fError.Shape); Hy.Common.Utility.Esri.MapOperAPI.FlashGeometry(this.m_HookHelper.Hook as IMapControl4, fError.Shape); } } }
/// <summary> /// Sets the task. /// </summary> /// <param name="task">The task.</param> public void SetTask(CheckTask task) { XGifProgress progressbar = new XGifProgress(); try { //���taskΪnull����Ϊ�ͷ���Դ if (task == null) { UCDispose(); return; } //�����Ϊ�գ������� m_CurrentTask = task; //������½������� progressbar.ShowHint("���ڴ�ǰ�ʼ�����....."); //��ʼ�������� this.ucRulesTree.CurrentSchemaId = task.SchemaID; this.ucRulesTree.CurrentTaskName = task.Name; //����ί�У��ڴ����˿ؼ����߳��ϵ��ü���tree��������ֹ���֡���ǰ�������������ط�ʹ�á��Ĵ���; LoadRules Load = new LoadRules(this.ucRulesTree.LoadRulesTree); this.BeginInvoke(Load); this.ucResult.CurrentTask = m_CurrentTask; if (File.Exists(task.GetMXDFile())) { //�����õ�mxdģ��ͼ�� UcMap.LoadMxFile(task.GetMXDFile()); TocControl.SetBuddyControl(UcMap.Object); TocControl.Update(); UcMap.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null); m_MapLayersController = new MapLayersController(UcMap.Map); } else { progressbar.Hide(); MessageBoxApi.ShowErrorMessageBox(task.GetMXDFile() + "�����ڣ���������"); return; } //���ؽ�� if (task.ResultConnection != null) { //�����Ѿ������ɵ����� this.TabCtrl.ShowTabHeader = DefaultBoolean.True; this.TabCtrl.SelectedTabPage = this.TabPageCheckResults; this.ucResultsTree.CurrentSchemaId = task.SchemaID; this.ucResultsTree.CurrentTaskName = task.Name; Sundary.ResultDbOper resultOper = new Hy.Check.UI.UC.Sundary.ResultDbOper(task.ResultConnection); this.ucResultsTree.LayersResultsDt = resultOper.GetLayersResults(); this.ucResultsTree.ResultsDt = resultOper.GetAllResults(); this.ucResultsTree.CheckResultsCount = resultOper.GetResultsCount(); this.ucResultsTree.LoadResultsTree(); } else { TabCtrl.SelectedTabPage = this.TabPageRules; this.TabCtrl.ShowTabHeader = DefaultBoolean.False; this.ucResultsTree.CurrentTreeList.Nodes.Clear(); } //����top����ͼ�㵽map if (task.TopoWorkspace != null) { //��ȡ��ǰ�����ӿ��е�ͼ�㼯�� m_pDatasetSon = TopoOperAPI.GetCurrentSonDataSet(task.TopoWorkspace as IFeatureWorkspace); // ��ȡ�ӿ������е�Ҫ��������� TopoOperAPI.GetFcTopoNameInSon(UcMap, task.TopoWorkspace as IFeatureWorkspace, m_pDatasetSon); } this.dockTree.Visibility = DockVisibility.Visible; this.dockTree.Text = "�����б�"; this.dockTree.Width = 260; this.dockLegend.Visibility = DockVisibility.Visible; } catch (Exception ex) { progressbar.Hide(); //GT_CONST.LogAPI.CheckLog.AppendErrLogs(ex.Message); XtraMessageBox.Show("�����ʧ�ܣ�", "��ʾ"); } finally { progressbar.Hide(); //�رմ������ȷ��� } }
private IFeature GetFeature(DataRow rowError, string strLayerName) { IMap theMap = this.m_HookHelper.FocusMap; MapLayersController mapController = new MapLayersController(theMap); enumErrorType errType = (enumErrorType)Convert.ToInt32(rowError["ErrorType"]); switch (errType) { case enumErrorType.Topology: { ITopologyLayer topoLayerTarget = mapController.GetLayer(strLayerName) as ITopologyLayer; if (topoLayerTarget == null) return null; ITopology topology = topoLayerTarget.Topology; IErrorFeatureContainer errFeatureContainer = topology as IErrorFeatureContainer; esriTopologyRuleType ruleType = (esriTopologyRuleType)Convert.ToInt32( rowError[Field_Name_TopologyRuleType]); //string strGeoType = rowError[Field_Name_TopologyGeometryType] as string; //esriGeometryType geoType = (strGeoType == "��" ? esriGeometryType.esriGeometryPoint : (strGeoType == "��" ? esriGeometryType.esriGeometryLine : esriGeometryType.esriGeometryPolygon)); esriGeometryType geoType = (esriGeometryType)Convert.ToInt32(rowError[Field_Name_TopologyGeometryType]); int sourceClassID = (int)rowError["SourceLayerID"]; int sourceOID = (int)rowError["OID"]; int targetClassID = (int)rowError["TargetLayerID"]; int targetOID = Convert.ToInt32( rowError["OID2"]); return errFeatureContainer.get_ErrorFeature((topology as IGeoDataset).SpatialReference, ruleType, geoType, sourceClassID, sourceOID, targetClassID, targetOID) as IFeature; } break; case enumErrorType.Normal: { IFeatureLayer flyrTarget = mapController.GetLayer(strLayerName) as IFeatureLayer; if (flyrTarget == null) return null; // ��Ϊ���ȴ�OID���Ҷ�λ if (rowError.Table.Columns.Contains(Field_Name_TargetOID) && rowError[Field_Name_TargetOID] != DBNull.Value) { return flyrTarget.FeatureClass.GetFeature((int)rowError[Field_Name_TargetOID]); } else if (rowError.Table.Columns.Contains(Field_Name_TargetBSM) && !string.IsNullOrEmpty(rowError[Field_Name_TargetBSM] as string)) { IQueryFilter qFilter = new QueryFilterClass(); IFields fields = flyrTarget.FeatureClass.Fields; int fieldIndex = fields.FindField("BSM"); if (fieldIndex < 0) return null; IField bsmField = fields.get_Field(fieldIndex); if (bsmField.Type == esriFieldType.esriFieldTypeInteger) { qFilter.WhereClause = string.Format("BSM={0}", rowError[Field_Name_TargetBSM]); } else { qFilter.WhereClause = string.Format("BSM='{0}'", rowError[Field_Name_TargetBSM]); } IFeatureCursor fCursor = flyrTarget.FeatureClass.Search(qFilter, false); return fCursor.NextFeature(); } else { return null; } } default: return null; } }