public bool get_IsActiveProperty(int propIndex) { bool bIsActive = false; int count = activeProps.Count; for (int i = 0; i < count; i++) { long temp = activeProps.get_Element(i); if (temp == propIndex) { bIsActive = true; } } return(bIsActive); }
private void FindTerminusForSequence(ref IGSForwardStar FwdStar, int StartNodeId, ref int TerminusPoint, int iInfinityChecker) { if (TerminusPoint > -1) { return; } //iInfinityChecker++; if (iInfinityChecker++ > 5000) { return; } ILongArray iLngArr = FwdStar.get_ToNodes(StartNodeId); int iCnt2 = 0; iCnt2 = iLngArr.Count; IGSLine pGSLine = null; for (int i = 0; i < iCnt2; i++) { int i2 = iLngArr.get_Element(i); bool bIsReversed = FwdStar.GetLine(StartNodeId, i2, ref pGSLine); if (iCnt2 == 1) //this is a terminus/end-line { TerminusPoint = StartNodeId; } FindTerminusForSequence(ref FwdStar, i2, ref TerminusPoint, iInfinityChecker); } }
public static IEnumerable <long> AsEnumerable(this ILongArray longArray) { for (int i = 0; i < longArray.Count; i++) { yield return(longArray.get_Element(i)); } }
public bool TestForEditLocks(ICadastralFabric Fabric, string NewJobName, List <int> ParcelsToLock) { ICadastralFabricLocks pFabLocks = (ICadastralFabricLocks)Fabric; pFabLocks.LockingJob = NewJobName; ILongArray pLocksInConflict = null; ILongArray pSoftLcksInConflict = null; ILongArray TheParcelsToLock = new LongArrayClass(); foreach (int i in ParcelsToLock) { TheParcelsToLock.Add(i); } try { pFabLocks.AcquireLocks(TheParcelsToLock, true, ref pLocksInConflict, ref pSoftLcksInConflict); return(true); } 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) { string sListOfFirst10 = ""; for (int i = 0; i < pLocksInConflict.Count; i++) { if (i == 10) { break; } sListOfFirst10 += pLocksInConflict.get_Element(i).ToString() + ", "; } MessageBox.Show("Edit Locks could not be acquired on all parcels." + Environment.NewLine + "Parcel ids: " + sListOfFirst10.Trim().TrimEnd(','), "Move Fabric Points"); // 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(false); } }
private bool TraceLines(ref IGSForwardStar FwdStar, int StartNodeId, ref int BranchCount, ref int TracedLinesCount, ref int LoopCount, ref int TerminusCount, ref List <string> FromToLine, ref List <int> FromList, ref List <int> ToList, int iInfinityChecker) { iInfinityChecker++; if (iInfinityChecker > 5000) { return(false); } //(This is a self-calling function.) In this context 5000 downstream lines is like infinity, //so exit gracefully, and avoid probable endless loop. //Possible cause of endless loop? Corrupted data; example, a line with the same from and to point id IVector3D vect = new Vector3DClass(); try { ILongArray iLngArr = FwdStar.get_ToNodes(StartNodeId); //get_ToNodes returns an array of radiated points, not "TO" points in the fabric data model sense int iCnt2 = 0; iCnt2 = iLngArr.Count; if (iCnt2 == 1) { TerminusCount++; } IGSLine pGSLine = null; for (int i = 0; i < iCnt2; i++) { int i2 = iLngArr.get_Element(i); string sFromTo = StartNodeId.ToString() + "," + i2.ToString(); string sToFrom = i2.ToString() + "," + StartNodeId.ToString(); if (FromToLine.Contains(sFromTo) || FromToLine.Contains(sToFrom)) { if (FromToLine.Contains(sFromTo)) { LoopCount++; } continue; } if (iCnt2 > 2) { BranchCount++; } TracedLinesCount++; FromToLine.Add(StartNodeId.ToString() + "," + i2.ToString()); bool bIsReversed = FwdStar.GetLine(StartNodeId, i2, ref pGSLine); if (bIsReversed) { FromList.Add(-StartNodeId); ToList.Add(-i2); vect.PolarSet(pGSLine.Bearing + Math.PI, 0, pGSLine.Distance); //Azimuth of IVector3D is north azimuth radians zero degrees north } else { FromList.Add(StartNodeId); ToList.Add(i2); vect.PolarSet(pGSLine.Bearing, 0, pGSLine.Distance); //Azimuth of IVector3D is north azimuth radians zero degrees north } if (!TraceLines(ref FwdStar, i2, ref BranchCount, ref TracedLinesCount, ref LoopCount, ref TerminusCount, ref FromToLine, ref FromList, ref ToList, iInfinityChecker)) { return(false); } } return(true); } catch { return(false); } }
protected override void OnClick() { ICadastralEditor pCadEd = (ICadastralEditor)ArcMap.Application.FindExtensionByName("esriCadastralUI.CadastralEditorExtension"); IParcelEditManager pParcEditorMan = (IParcelEditManager)pCadEd; ICadastralExtensionManager pCadMan = pCadEd as ICadastralExtensionManager; ICadastralPacketManager pCadPacketMan = (ICadastralPacketManager)pCadEd; //bool bStartedWithPacketOpen = pCadPacketMan.PacketOpen; if (!(pCadMan.ContextItem is IGSLine)) { return; } IGSLine pGSLine = pCadMan.ContextItem as IGSLine; if (pParcEditorMan == null) { return; } IEditor pEd = (IEditor)ArcMap.Application.FindExtensionByName("esri object editor"); if (pEd.EditState == esriEditState.esriStateNotEditing) { MessageBox.Show("Please start editing and try again."); return; } IParcelConstruction pConstr = pParcEditorMan.ParcelConstruction; ICadastralLinePoints2Ex pCadLPsEx = pConstr as ICadastralLinePoints2Ex; ILongArray pLngArrBefore = pCadLPsEx.LinePoints; List <int> lstLPBefore = new List <int>(); for (int i = 0; i < pLngArrBefore.Count; i++) { lstLPBefore.Add(pLngArrBefore.get_Element(i)); } //first get the current set of breakpoints Utilities FabUTILS = new Utilities(); FabUTILS.ExecuteCommand("{9987F18B-8CC4-4548-8C41-7DB51F289BB3}"); //Run COTS Breakline command ILongArray pLngArrAfter = pCadLPsEx.LinePoints; List <int> lstLPAfter = new List <int>(); for (int i = 0; i < pLngArrAfter.Count; i++) { lstLPAfter.Add(pLngArrAfter.get_Element(i)); } List <int> lstNewBreakPoints = lstLPAfter.Except(lstLPBefore).ToList(); if (lstNewBreakPoints.Count == 0) { return; } IParcelConstruction4 pConstr4 = pConstr as IParcelConstruction4; ICadastralPoints pCadastralPts = pConstr4 as ICadastralPoints; IEnumCELines pCELines = new EnumCELinesClass(); IEnumGSLines pEnumGSLines = (IEnumGSLines)pCELines; pCELines.Add(pGSLine); //check if it's a construction line or parent line bool bIsParentLine = true; IEnumGSLines pEnumGSConstructionLines = pConstr4.GetLines(false, false); IGSLine pGSTestLine = null; IGSParcel pGSParc = null; pEnumGSConstructionLines.Reset(); pEnumGSConstructionLines.Next(ref pGSParc, ref pGSTestLine); while (pGSTestLine != null) { if ((pGSLine.FromPoint == pGSTestLine.FromPoint) && (pGSLine.ToPoint == pGSTestLine.ToPoint)) { bIsParentLine = false; break; } pEnumGSConstructionLines.Next(ref pGSParc, ref pGSTestLine); } IParcelLineFunctions3 pParcLineFunctions = new ParcelFunctionsClass(); IEnumGSLines pNewLinesEnum = pParcLineFunctions.BreakLinesAtLinePoints(pEnumGSLines, pCadastralPts, true, false); IGSParcel pGSParcel = null; IGSLine pGSNewLine = null; ICadastralUndoRedo pCadUndoRedo = pConstr as ICadastralUndoRedo; pCadUndoRedo.StartUndoRedoSession("Break-line"); pNewLinesEnum.Reset(); pNewLinesEnum.Next(ref pGSParcel, ref pGSNewLine); while (pGSNewLine != null) { pConstr4.InsertGridRow(-1, pGSNewLine, true); pNewLinesEnum.Next(ref pGSParcel, ref pGSNewLine); } ICadastralUnbuildableLines pUnbuildable = pConstr4 as ICadastralUnbuildableLines; if (bIsParentLine) { pUnbuildable.AddLine(pGSLine); } else { pConstr4.Planarize(0.001); //delete the original construction line } pCadUndoRedo.WriteUndoRedoSession(true); }