private void OnSketchFinished()
        {
            //send a space to hide the construction toolbar
            SendKeys.SendWait(" ");

            try
            {
                m_editor.StartOperation();
            }
            catch
            {
                m_editor.AbortOperation();
                m_editor.StartOperation();
            }
            IFeature pRoadFeat = Globals.CreateFeature(m_edSketch.Geometry, m_editor.CurrentTemplate, m_editor, ArcMap.Application, false, true, true);

            pRoadFeat.Store();
            //AMGeometryTools.AddPointWithRef(m_application, pPnts.get_Point(0), configDetails, ((IFeatureLayer)m_editor.CurrentTemplate.Layer), ref idxConfig);//,config,null,true,true);

            AMGeometryTools.SplitAndProrate(ArcMap.Application, pRoadFeat, m_editor.CurrentTemplate.Layer as IFeatureLayer, ConfigUtil.GetAddressCenterlineConfig());

            // pFeats.Add(pFeat);
            ((IMxDocument)ArcMap.Application.Document).ActiveView.Refresh();
            try
            {
                m_editor.StopOperation("Create Point with Reference");
            }
            catch
            {
            }
            pRoadFeat = null;
        }
        private void OnSketchFinished()
        {
            //send a space to hide the construction toolbar
            SendKeys.SendWait(" ");

            List <CreatePointWithReferenceDetails> configDetails = null;
            AddressReturnInfo retInfo = null;
            IPointCollection  pPnts   = null;
            List <IFeature>   pFeats  = null;
            IPoint            pPnt    = null;

            try
            {
                ((IMxDocument)ArcMap.Document).FocusMap.ClearSelection();

                Keys ModKey = Control.ModifierKeys;


                pPnts = m_edSketch.Geometry as IPointCollection;
                if (pPnts == null)
                {
                    return;
                }

                if (pPnts.PointCount < 2)
                {
                    return;
                }

                try
                {
                    m_editor.StartOperation();
                }
                catch
                {
                    m_editor.AbortOperation();
                    m_editor.StartOperation();
                }

                int idxConfig = -1;
                // TODO: Add developer code here
                configDetails = ConfigUtil.GetCreatePointWithRefConfig();


                retInfo = AMGeometryTools.AddPointWithRef(ArcMap.Application, pPnts.get_Point(0), configDetails, ((IFeatureLayer)m_editor.CurrentTemplate.Layer), ref idxConfig);//,config,null,true,true);
                if (idxConfig == -1)
                {
                    return;
                }

                if (retInfo == null)
                {
                    return;
                }


                int targetAddFieldIdx = Globals.GetFieldIndex(((IFeatureLayer)m_editor.CurrentTemplate.Layer), configDetails[idxConfig].AddressField);

                if (targetAddFieldIdx == -1)
                {
                    return;
                }

                int targetNameFieldIdx = Globals.GetFieldIndex(((IFeatureLayer)m_editor.CurrentTemplate.Layer), configDetails[idxConfig].StreetNameField);

                if (targetNameFieldIdx == -1)
                {
                    return;
                }

                int targetIDFieldIdx = Globals.GetFieldIndex(((IFeatureLayer)m_editor.CurrentTemplate.Layer), configDetails[idxConfig].AddressPntKeyField);

                //if (targetIDFieldIdx == -1)
                //    return;

                //. .AddLaterals(m_application, ConfigUtil.GetAddLateralsConfig(), pFeat, false, true, false, false);

                //IFeature pFeat = null;
                pFeats = new List <IFeature>();

                for (int i = 1; i < pPnts.PointCount; i++)
                {
                    pFeats.Add(Globals.CreateFeature(pPnts.get_Point(i), m_editor.CurrentTemplate, m_editor, ArcMap.Application, false, false, true));
                    // pFeats.Add(pFeat);
                }

                foreach (IFeature pFeat in pFeats)
                {
                    if (retInfo.AddressDetails.StreetGeometry == null)
                    {
                        if (targetNameFieldIdx != -1)
                        {
                            pFeat.set_Value(targetNameFieldIdx, retInfo.AddressDetails.Messages);
                        }
                    }
                    else
                    {
                        bool rightSide = true;
                        pPnt = Globals.GetPointOnLine(pFeat.Shape as IPoint, retInfo.AddressDetails.StreetGeometry as IPolyline, 400, out rightSide);
                        if (rightSide)
                        {
                            pFeat.set_Value(targetAddFieldIdx, retInfo.AddressDetails.RightAddress);
                        }
                        else
                        {
                            pFeat.set_Value(targetAddFieldIdx, retInfo.AddressDetails.LeftAddress);
                        }
                        if (targetNameFieldIdx != -1)
                        {
                            pFeat.set_Value(targetNameFieldIdx, retInfo.AddressDetails.StreetName);
                        }

                        if (targetIDFieldIdx != -1)
                        {
                            pFeat.set_Value(targetIDFieldIdx, retInfo.AddressPointKey);
                        }
                        pFeat.Store();
                    }
                }
                pPnts = null;
                ((IMxDocument)ArcMap.Document).ActiveView.Refresh();
                try
                {
                    m_editor.StopOperation("Create Point with Reference");
                }
                catch
                {
                }
            }
            catch
            {
                configDetails = null;
                retInfo       = null;
                pPnts         = null;
                pFeats        = null;
                pPnt          = null;
                try
                {
                    m_editor.AbortOperation();
                }
                catch
                {
                }
            }
        }
 protected override void OnClick()
 {
     AMGeometryTools.FlipLines(ArcMap.Application, ConfigUtil.GetAddressCenterlineConfig(), true);
 }
 protected override void OnClick()
 {
     ConfigUtil.type = "address";
     AMGeometryTools.FlipLines(ArcMap.Application, ConfigUtil.GetAddressCenterlineConfig(), false);
 }
 protected override void OnClick()
 {
     AMGeometryTools.CreateIntersectionPoints(ArcMap.Application, ConfigUtil.GetAddressCenterlineConfig(), false);
 }