brettlawson

Pracel Fabric Editing

Discussion created by brettlawson on Feb 6, 2014
Does anybody have any hints or samples that deal with parcel fabric editing?  What I need to do is split an existing parcel into 2 pieces with construction lines and have the ability to do some post parcel construction processing to the 2 newly created parcels.  My thoughts were to implement a custom button that would act like the Build Parcel button in the Parcel Details dialog, but the document is almost non existent when dealing with the interfaces in the CadastralUI dll.  Below is my stab in the dark at it and I maybe off on the wrong path here, so any help is appreciated.  My first problem is that I always get m_ParcelLine == null.


ICadastralEditor pCadasteral = ArcMap.Application.FindExtensionByName("esriCadastralUI.CadastralEditorExtension") as ICadastralEditor;
           
IParcelEditManager         m_PEMan = pCadasteral as IParcelEditManager;
ICadastralExtensionManager           m_CadExtMan = (ICadastralExtensionManager)m_PEMan;
ICadastralExtension m_GeoCadExt = m_CadExtMan.GSExtension;
ICadastralPacket m_JobPacket = m_GeoCadExt.GetJobPacket();
ICadastralPacket m_EditPacket = m_GeoCadExt.GetEditPacket(); 

               long ConstrLineCount;
            MessageBoxButtons buttons = MessageBoxButtons.OK;
            int i;
            bool GotLine;

            m_ParcelConstr = m_PEMan.ParcelConstruction;
            m_ParentParcel = m_ParcelConstr.Parcel;
            //Get number of construction lines present
            ConstrLineCount = m_ParcelConstr.LineCount;
            //There must be at least one complete construction line in the line grid
            if (ConstrLineCount == 1)
            {
                MessageBox.Show("No Construction lines found.", "Build Easements", buttons);
            }
            else
            {
                //Get parent parcel lines
                ICadastralFeature pFeature = m_ParentParcel as ICadastralFeature;
                bool f = m_ParentParcel is CEParcelFeature;
                m_SrcLines = new EnumCELinesClass();
                m_ParentLines = m_ParentParcel.GetParcelLines(pEnv, false);
                m_ParentLines.Reset();
                m_ParentLines.Next(ref m_ParentParcel2, ref m_ParcelLine);
                //There must be a parent parcel present (new from parent)
                if (m_ParcelLine == null)
                {
                    MessageBox.Show("No Parent Parcel Found. Easement parcels are added to New From Parent parcels.", "Build Easements", buttons);
                }
                while (m_ParcelLine != null)
                {
                    m_SrcLines.Add(m_ParcelLine);
                    m_ParentLines.Next(ref m_ParentParcel2, ref m_ParcelLine);
                }

                //Get Construction lines
                for (i = 0; i < ConstrLineCount; i++)
                {
                    GotLine = m_ParcelConstr.GetLine(i, ref m_ConstrLine);
                    if (GotLine == true)
                    {
                        double x = 0;
                        double y = 0;
                        m_ConstrLine.FromPointCoords(ref x, ref y);
                        m_ConstrLine.ToPointCoords(ref x, ref y);
                        m_SrcLines.Add(m_ConstrLine);
                    }
                }

                //Break parcel lines with construction lines
                m_ConstrParcelFunct = new ParcelFunctionsClass();
                m_ParcelLineFunct = (IParcelLineFunctions)m_ConstrParcelFunct;
                m_AllLines = (IEnumGSLines)m_SrcLines;
                m_SrcPoints = (ICadastralPoints)m_ParcelConstr;
                m_BrokenLines = m_ParcelLineFunct.BreakLinesWithLinePoints(m_AllLines, m_SrcPoints);

                //Now construct new parcels from broken lines
                m_ConstrParcelFunct = new ParcelFunctionsClass();
                m_Plan = m_ParentParcel.Plan;
                //Add new parcels to new group ID
                grp = 1;
                m_ConstrParcelFunct.ConstructParcelsFromLines(m_Plan, m_SrcPoints, m_BrokenLines, m_EditPacket, grp, ref m_BuildParcels, ref m_ErrorLinePtFrom, ref m_ErrorLinePtTo);
}

Thanks!

Outcomes