获取应用程序中的漏洞更新
URL 已复制
共享 URL
漏洞
Importing Cadastral Fabric XML back to ICadastralFabric via ArcObjects fails to update the cadastral fabric dataset.
上次发布: May 24, 2018
ArcObjects SDK
漏洞 ID 编号
BUG-000112264
已提交
March 8, 2018
上次修改时间
June 5, 2024
适用范围
ArcObjects SDK
找到的版本
10.5.1
操作系统
Windows OS
操作系统版本
10.0 64 Bit
状态
Will Not Be Addressed
开发团队已考虑过该问题或请求,并决定不会解决该问题。 问题的“其他信息”部分可能包含进一步说明。
附加信息
The goal is to use a Cadastral XML file as source information to update the attributes of a pre-existing parcel stored in the parcel fabric dataset. This task can be done via SDK without any fixes required from Esri development. The sample add-in source code below includes the steps required to achieve this specific goal. using System; using System.Collections.Generic; using System.Text; using System.IO; using System.Text.RegularExpressions; using System.Runtime.InteropServices; using ESRI.ArcGIS.CadastralUI; using ESRI.ArcGIS.GeoSurvey; using ESRI.ArcGIS.Editor; using System.Windows.Forms; using ESRI.ArcGIS.GeoDatabaseExtensions; using ESRI.ArcGIS.Geodatabase; using ESRI.ArcGIS.Geometry; using ESRI.ArcGIS.esriSystem; using System.Reflection; namespace TestXML { public class LoadXML : ESRI.ArcGIS.Desktop.AddIns.Button { public LoadXML() { } protected override void OnClick() { IEditor pEd = null; try { ICadastralEditor pCadEd = (ICadastralEditor)ArcMap.Application.FindExtensionByName("esriCadastralUI.CadastralEditorExtension"); pEd = (IEditor)ArcMap.Application.FindExtensionByName("esri object editor"); if (pEd.EditState == esriEditState.esriStateNotEditing) { MessageBox.Show("Please start editing and try again."); return; } IFIDSet pFIDSetParcels = new FIDSetClass(); ICadastralSelection pSelection = (ICadastralSelection)pCadEd; IEnumGSParcels pGSParcels = pSelection.SelectedParcels; //IEnumCEParcels pCEParcels = (IEnumCEParcels)pGSParcels; pGSParcels.Reset(); IGSParcel pGSParcel = pGSParcels.Next(); while (pGSParcel != null) { pFIDSetParcels.Add(pGSParcel.DatabaseId); pGSParcel = pGSParcels.Next(); } if (pFIDSetParcels.Count() == 0) { MessageBox.Show("No selection. Please select parcels to be updated and try again."); return; } ICadastralFabric pCadaFab = pCadEd.CadastralFabric; ICadastralJob job = new CadastralJob { Name = Convert.ToString(DateTime.Now), Owner = "Test", Description = "Test" }; pCadaFab.CreateJob(job); #region Test for Edit Locks ICadastralFabricLocks pFabLocks = (ICadastralFabricLocks)pCadaFab; int[] pParcelIds = new int[pFIDSetParcels.Count()]; ILongArray pParcelsToLock = new LongArrayClass(); FIDsetToLongArray(pFIDSetParcels, ref pParcelsToLock, ref pParcelIds); pFabLocks.LockingJob = job.Name; ILongArray pLocksInConflict = null; ILongArray pSoftLcksInConflict = null; try { pFabLocks.AcquireLocks(pParcelsToLock, true, ref pLocksInConflict, ref pSoftLcksInConflict); } catch (COMException pCOMEx) { if (pCOMEx.ErrorCode == (int)fdoError.FDO_E_CADASTRAL_FABRIC_JOB_LOCK_ALREADY_EXISTS || pCOMEx.ErrorCode == (int)fdoError.FDO_E_CADASTRAL_FABRIC_JOB_CURRENTLY_EDITED) { MessageBox.Show("Edit Locks could not be acquired on all selected parcels."); // since the operation is being aborted, release any locks that were acquired pFabLocks.UndoLastAcquiredLocks(); } else MessageBox.Show(pCOMEx.Message + Environment.NewLine + Convert.ToString(pCOMEx.ErrorCode)); return; } #endregion #region Get Cadastral XML File, add locked tag OpenFileDialog pFileBrowser = new OpenFileDialog(); pFileBrowser.Multiselect = false; pFileBrowser.InitialDirectory = Application.ExecutablePath; pFileBrowser.Filter = "Cadastral XML|*.xml"; pFileBrowser.Title = "Browse and Open the Cadastral XML"; DialogResult result = pFileBrowser.ShowDialog(); // Show the dialog. if (result != DialogResult.OK) { ArcMap.Application.CurrentTool = null; return; } string sourceCadasatrlXMLPath = pFileBrowser.FileName; string sTempPath = System.IO.Path.GetTempPath(); string sCopiedCadastralXMLFile = System.IO.Path.Combine(sTempPath, job.Name.Replace('/','_').Replace(':','_') + ".xml"); ReplaceInFile(sourceCadasatrlXMLPath, sCopiedCadastralXMLFile, "
", "
true
"); #endregion //do an extract to set the spatial reference ((ICadastralFabric3)pCadaFab).ExtractCadastralPacket(job.Name, pEd.Map.SpatialReference as IProjectedCoordinateSystem, null, true); IXMLStream pStream = new XMLStream(); pStream.LoadFromFile(sCopiedCadastralXMLFile); IFIDSet pSet = new FIDSet(); pEd.StartOperation(); ((ICadastralFabric3)pCadaFab).PostCadastralPacket(pStream, null, esriCadastralPacketSetting.esriCadastralPacketNoSetting, ref pSet); int setCnt = pSet.Count(); pEd.StopOperation("Update by Cadastral XML"); } catch (Exception ex) { pEd.AbortOperation(); MessageBox.Show(ex.Message); } ArcMap.Application.CurrentTool = null; } protected override void OnUpdate() { Enabled = ArcMap.Application != null; } static public void FIDsetToLongArray(IFIDSet InFIDSet, ref ILongArray OutLongArray, ref int[] OutIntArray) { Int32 pfID = -1; InFIDSet.Reset(); double dMax = InFIDSet.Count(); int iMax = (int)(dMax); for (Int32 pCnt = 0; pCnt <= (InFIDSet.Count() - 1); pCnt++) { InFIDSet.Next(out pfID); OutLongArray.Add(pfID); OutIntArray[pCnt] = pfID; } return; } static public void ReplaceInFile(string inFilePath, string outFilePath, string searchText, string replaceText) { StreamReader reader = new StreamReader(inFilePath); string content = reader.ReadToEnd(); reader.Close(); content = Regex.Replace(content, searchText, replaceText); StreamWriter writer = new StreamWriter(outFilePath); writer.Write(content); writer.Close(); } } }
重现步骤
漏洞 ID: BUG-000112264
软件:
ArcObjects SDK
当漏洞状态发生变化时获得通知
下载 Esri 支持应用程序
发现关于本主题的更多内容
Esri Community
搜索相关信息
Training
查找与此主题相关的培训
ArcGIS Ideas
探索想法并提供反馈
获取来自 ArcGIS 专家的帮助
联系技术支持部门
下载 Esri 支持应用程序
转至下载选项